diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/WarpX.H | 10 | ||||
-rw-r--r-- | Source/WarpX.cpp | 31 | ||||
-rw-r--r-- | Source/WarpXIO.cpp | 53 | ||||
-rw-r--r-- | Source/WarpXInitData.cpp | 5 | ||||
-rw-r--r-- | Source/WarpXPML.H | 2 | ||||
-rw-r--r-- | Source/WarpXPML.cpp | 7 | ||||
-rw-r--r-- | Source/WarpX_picsar.F90 | 27 |
7 files changed, 77 insertions, 58 deletions
diff --git a/Source/WarpX.H b/Source/WarpX.H index 26a5c871c..d0876afd2 100644 --- a/Source/WarpX.H +++ b/Source/WarpX.H @@ -13,6 +13,7 @@ #include <AMReX_BLProfiler.H> #include <AMReX_Print.H> #include <AMReX_RealVect.H> +#include <AMReX_VisMF.H> #include <ParticleContainer.H> #include <WarpXPML.H> @@ -382,6 +383,15 @@ private: bool plot_raw_fields = false; bool plot_raw_fields_guards = false; + amrex::VisMF::Header::Version checkpoint_headerversion = amrex::VisMF::Header::NoFabHeader_v1; +// amrex::VisMF::Header::Version plotfile_headerversion = amrex::VisMF::Header::NoFabHeader_v1; + amrex::VisMF::Header::Version plotfile_headerversion = amrex::VisMF::Header::Version_v1; + bool use_single_read = true; + bool use_single_write = true; + int mffile_nstreams = 4; + int field_io_nfiles = 1024; + int particle_io_nfiles = 1024; + amrex::RealVect fine_tag_lo; amrex::RealVect fine_tag_hi; diff --git a/Source/WarpX.cpp b/Source/WarpX.cpp index 6a68c473e..f0d3c0c3f 100644 --- a/Source/WarpX.cpp +++ b/Source/WarpX.cpp @@ -201,7 +201,7 @@ WarpX::ReadParameters () } } - pp.queryarr("B_external", B_external); + pp.queryarr("B_external", B_external); pp.query("do_moving_window", do_moving_window); if (do_moving_window) @@ -299,6 +299,28 @@ WarpX::ReadParameters () pp.query("plot_crsepatch", plot_crsepatch); } + { + bool plotfile_min_max = true; + pp.query("plotfile_min_max", plotfile_min_max); + if (plotfile_min_max) { + plotfile_headerversion = amrex::VisMF::Header::Version_v1; + } else { + plotfile_headerversion = amrex::VisMF::Header::NoFabHeader_v1; + } + pp.query("usesingleread", use_single_read); + pp.query("usesinglewrite", use_single_write); + ParmParse ppv("vismf"); + ppv.add("usesingleread", use_single_read); + ppv.add("usesinglewrite", use_single_write); + pp.query("mffile_nstreams", mffile_nstreams); + VisMF::SetMFFileInStreams(mffile_nstreams); + pp.query("field_io_nfiles", field_io_nfiles); + VisMF::SetNOutFiles(field_io_nfiles); + pp.query("particle_io_nfiles", particle_io_nfiles); + ParmParse ppp("particles"); + ppp.add("particles_nfiles", particle_io_nfiles); + } + if (maxLevel() > 0) { Vector<Real> lo, hi; pp.getarr("fine_tag_lo", lo); @@ -369,7 +391,8 @@ WarpX::AllocLevelData (int lev, const BoxArray& ba, const DistributionMapping& d int ngE = (WarpX::nox % 2) ? WarpX::nox+1 : WarpX::nox; // Always even number int ngJ = ngE; int ngRho = ngE; - + int ngF = (do_moving_window) ? 2 : 0; + // // The fine patch // @@ -387,7 +410,7 @@ WarpX::AllocLevelData (int lev, const BoxArray& ba, const DistributionMapping& d if (do_dive_cleaning) { - F_fp[lev].reset (new MultiFab(amrex::convert(ba,IntVect::TheUnitVector()),dm,1, 0)); + F_fp[lev].reset (new MultiFab(amrex::convert(ba,IntVect::TheUnitVector()),dm,1, ngF)); rho_fp[lev].reset(new MultiFab(amrex::convert(ba,IntVect::TheUnitVector()),dm,1,ngRho)); } @@ -440,7 +463,7 @@ WarpX::AllocLevelData (int lev, const BoxArray& ba, const DistributionMapping& d if (do_dive_cleaning) { - F_cp[lev].reset (new MultiFab(amrex::convert(cba,IntVect::TheUnitVector()),dm,1, 0)); + F_cp[lev].reset (new MultiFab(amrex::convert(cba,IntVect::TheUnitVector()),dm,1, ngF)); rho_cp[lev].reset(new MultiFab(amrex::convert(cba,IntVect::TheUnitVector()),dm,1,ngRho)); } } diff --git a/Source/WarpXIO.cpp b/Source/WarpXIO.cpp index 768dd9ecc..b289fdde9 100644 --- a/Source/WarpXIO.cpp +++ b/Source/WarpXIO.cpp @@ -97,13 +97,13 @@ WarpX::WriteCheckPointFile() const { BL_PROFILE("WarpX::WriteCheckPointFile()"); + VisMF::Header::Version current_version = VisMF::GetHeaderVersion(); + VisMF::SetHeaderVersion(checkpoint_headerversion); + const std::string& checkpointname = amrex::Concatenate(check_file,istep[0]); amrex::Print() << " Writing checkpoint " << checkpointname << "\n"; - const int checkpoint_nfiles = 64; // could make this parameter - VisMF::SetNOutFiles(checkpoint_nfiles); - const int nlevels = finestLevel()+1; amrex::PreBuildDirectorHierarchy(checkpointname, level_prefix, nlevels, true); @@ -171,6 +171,8 @@ WarpX::WriteCheckPointFile() const } mypc->Checkpoint(checkpointname, "particle", true); + + VisMF::SetHeaderVersion(current_version); } @@ -181,9 +183,6 @@ WarpX::InitFromCheckpoint () amrex::Print() << " Restart from checkpoint " << restart_chkfile << "\n"; - const int checkpoint_nfiles = 64; // could make this parameter - VisMF::SetNOutFiles(checkpoint_nfiles); - // Header { std::string File(restart_chkfile + "/WarpXHeader"); @@ -446,6 +445,9 @@ WarpX::WritePlotFile () const { BL_PROFILE("WarpX::WritePlotFile()"); + VisMF::Header::Version current_version = VisMF::GetHeaderVersion(); + VisMF::SetHeaderVersion(plotfile_headerversion); + const std::string& plotfilename = amrex::Concatenate(plot_file,istep[0]); amrex::Print() << " Writing plotfile " << plotfilename << "\n"; @@ -661,23 +663,23 @@ WarpX::WritePlotFile () const } #endif + Vector<std::string> rfs; + if (plot_raw_fields) rfs.emplace_back("raw_fields"); // pre-build raw_fields/ amrex::WriteMultiLevelPlotfile(plotfilename, finest_level+1, amrex::GetVecOfConstPtrs(mf), - varnames, Geom(), t_new[0], istep, refRatio()); + varnames, Geom(), t_new[0], istep, refRatio(), + "HyperCLaw-V1.1", + "Level_", + "Cell", + rfs); } if (plot_raw_fields) { - const int raw_plot_nfiles = 64; // could make this parameter - VisMF::SetNOutFiles(raw_plot_nfiles); - const int nlevels = finestLevel()+1; - const std::string raw_plotfilename = plotfilename + "/raw_fields"; - amrex::PreBuildDirectorHierarchy(raw_plotfilename, level_prefix, nlevels, true); - for (int lev = 0; lev < nlevels; ++lev) { - + const std::string raw_plotfilename = plotfilename + "/raw_fields"; // Plot auxilary patch if (plot_raw_fields_guards) { VisMF::Write(*Efield_aux[lev][0], amrex::MultiFabFileFullPrefix(lev, raw_plotfilename, level_prefix, "Ex_aux")); @@ -811,6 +813,8 @@ WarpX::WritePlotFile () const WriteJobInfo(plotfilename); WriteWarpXHeader(plotfilename); + + VisMF::SetHeaderVersion(current_version); } void @@ -821,13 +825,14 @@ WritePlotFileES (const amrex::Vector<std::unique_ptr<amrex::MultiFab> >& rho, { BL_PROFILE("WarpX::WritePlotFileES()"); + VisMF::Header::Version current_version = VisMF::GetHeaderVersion(); + VisMF::SetHeaderVersion(plotfile_headerversion); + const std::string& plotfilename = amrex::Concatenate(plot_file,istep[0]); amrex::Print() << " Writing plotfile " << plotfilename << "\n"; const int nlevels = finestLevel()+1; - const std::string raw_plotfilename = plotfilename + "/raw_fields"; - amrex::PreBuildDirectorHierarchy(raw_plotfilename, level_prefix, nlevels, true); { Vector<std::string> varnames; @@ -863,19 +868,19 @@ WritePlotFileES (const amrex::Vector<std::unique_ptr<amrex::MultiFab> >& rho, dcomp += 1; } + Vector<std::string> rfs(1,"raw_fields"); // pre-build raw_fields/ amrex::WriteMultiLevelPlotfile(plotfilename, finest_level+1, amrex::GetVecOfConstPtrs(mf), - varnames, Geom(), t_new[0], istep, refRatio()); + varnames, Geom(), t_new[0], istep, refRatio(), + "HyperCLaw-V1.1", + "Level_", + "Cell", + rfs); } { - const int raw_plot_nfiles = 64; // could make this parameter - VisMF::SetNOutFiles(raw_plot_nfiles); - - const int nlevels = finestLevel()+1; const std::string raw_plotfilename = plotfilename + "/raw_fields"; - amrex::PreBuildDirectorHierarchy(raw_plotfilename, level_prefix, nlevels, true); - + const int nlevels = finestLevel()+1; for (int lev = 0; lev < nlevels; ++lev) { const DistributionMapping& dm = DistributionMap(lev); @@ -919,6 +924,8 @@ WritePlotFileES (const amrex::Vector<std::unique_ptr<amrex::MultiFab> >& rho, WriteJobInfo(plotfilename); WriteWarpXHeader(plotfilename); + + VisMF::SetHeaderVersion(current_version); } void diff --git a/Source/WarpXInitData.cpp b/Source/WarpXInitData.cpp index 873adcbaf..df01afe88 100644 --- a/Source/WarpXInitData.cpp +++ b/Source/WarpXInitData.cpp @@ -92,12 +92,13 @@ WarpX::InitPML () if (do_pml) { pml[0].reset(new PML(boxArray(0), DistributionMap(0), &Geom(0), nullptr, - pml_ncell, pml_delta, 0, do_dive_cleaning)); + pml_ncell, pml_delta, 0, do_dive_cleaning, do_moving_window)); for (int lev = 1; lev <= finest_level; ++lev) { pml[lev].reset(new PML(boxArray(lev), DistributionMap(lev), &Geom(lev), &Geom(lev-1), - pml_ncell, pml_delta, refRatio(lev-1)[0], do_dive_cleaning)); + pml_ncell, pml_delta, refRatio(lev-1)[0], do_dive_cleaning, + do_moving_window)); } } } diff --git a/Source/WarpXPML.H b/Source/WarpXPML.H index 4a44bedb3..c516f012d 100644 --- a/Source/WarpXPML.H +++ b/Source/WarpXPML.H @@ -109,7 +109,7 @@ class PML public: PML (const amrex::BoxArray& ba, const amrex::DistributionMapping& dm, const amrex::Geometry* geom, const amrex::Geometry* cgeom, - int ncell, int delta, int ref_ratio, int do_dive_cleaning); + int ncell, int delta, int ref_ratio, int do_dive_cleaning, int do_moving_window); void ComputePMLFactors (amrex::Real dt, const std::string& pml_type); diff --git a/Source/WarpXPML.cpp b/Source/WarpXPML.cpp index 6db887136..19e36f38a 100644 --- a/Source/WarpXPML.cpp +++ b/Source/WarpXPML.cpp @@ -425,7 +425,7 @@ MultiSigmaBox::ComputePMLFactorsE (const Real* dx, Real dt, const std::string& p PML::PML (const BoxArray& grid_ba, const DistributionMapping& grid_dm, const Geometry* geom, const Geometry* cgeom, - int ncell, int delta, int ref_ratio, int do_dive_cleaning) + int ncell, int delta, int ref_ratio, int do_dive_cleaning, int do_moving_window) : m_geom(geom), m_cgeom(cgeom) { @@ -441,6 +441,7 @@ PML::PML (const BoxArray& grid_ba, const DistributionMapping& grid_dm, int nge = 2; int ngb = 2; + int ngf = (do_moving_window) ? 2 : 0; pml_E_fp[0].reset(new MultiFab(amrex::convert(ba,WarpX::Ex_nodal_flag), dm, 3, nge)); pml_E_fp[1].reset(new MultiFab(amrex::convert(ba,WarpX::Ey_nodal_flag), dm, 3, nge)); @@ -458,7 +459,7 @@ PML::PML (const BoxArray& grid_ba, const DistributionMapping& grid_dm, if (do_dive_cleaning) { - pml_F_fp.reset(new MultiFab(amrex::convert(ba,IntVect::TheUnitVector()), dm, 3, 0)); + pml_F_fp.reset(new MultiFab(amrex::convert(ba,IntVect::TheUnitVector()), dm, 3, ngf)); pml_F_fp->setVal(0.0); } @@ -492,7 +493,7 @@ PML::PML (const BoxArray& grid_ba, const DistributionMapping& grid_dm, if (do_dive_cleaning) { - pml_F_cp.reset(new MultiFab(amrex::convert(cba,IntVect::TheUnitVector()), cdm, 3, 0)); + pml_F_cp.reset(new MultiFab(amrex::convert(cba,IntVect::TheUnitVector()), cdm, 3, ngf)); pml_F_cp->setVal(0.0); } diff --git a/Source/WarpX_picsar.F90 b/Source/WarpX_picsar.F90 index 2c1ea106c..7a68f12ee 100644 --- a/Source/WarpX_picsar.F90 +++ b/Source/WarpX_picsar.F90 @@ -320,13 +320,11 @@ subroutine warpx_charge_deposition(rho,np,xp,yp,zp,w,q,xmin,ymin,zmin,dx,dy,dz,n !! Vay pusher -- Full push CASE (1_c_long) -!#if (BL_SPACEDIM == 3) + CALL pxr_set_gamma(np,uxp,uyp,uzp,gaminv) + CALL pxr_ebcancelpush3d(np,uxp,uyp,uzp,gaminv, & ex,ey,ez, & bx,by,bz,q,m,dt,0_c_long) -!#else -! call bl_error("Is there a 2d Vay pusher implemented?") -!#endif CASE DEFAULT ! Momentum pusher in a single loop @@ -336,27 +334,6 @@ subroutine warpx_charge_deposition(rho,np,xp,yp,zp,w,q,xmin,ymin,zmin,dx,dy,dz,n bx,by,bz, & q,m,dt) - ! Momentum pusher by block -! CALL pxr_boris_push_u_3d_block(np,uxp,uyp,uzp,& -! gaminv, & -! ex,ey,ez, & -! bx,by,bz, & -! q,m,dt,lvect) - - !! --- Push velocity with E half step -! CALL pxr_epush_v(np,uxp,uyp,uzp, & -! ex,ey,ez,q,m,dt*0.5_amrex_real) - !! --- Set gamma of particles -! CALL pxr_set_gamma(np,uxp,uyp,uzp,gaminv) - !! --- Push velocity with B -! CALL pxr_bpush_v(np,uxp,uyp,uzp,gaminv, & -! bx,by,bz,q,m,dt) - !!! --- Push velocity with E half step -! CALL pxr_epush_v(np,uxp,uyp,uzp, & -! ex,ey,ez,q,m,dt*0.5_amrex_real) - !! --- Set gamma of particles -! CALL pxr_set_gamma(np,uxp,uyp,uzp,gaminv) - END SELECT !!!! --- push particle species positions a time step |