diff options
-rw-r--r-- | Example/Langmuir/inputs.multi.rt | 2 | ||||
-rw-r--r-- | Example/Langmuir/inputs.rt | 2 | ||||
-rw-r--r-- | Example/laser_acceleration/inputs.rt | 2 | ||||
-rw-r--r-- | Example/laser_injection/inputs.2d.rt | 2 | ||||
-rw-r--r-- | Example/laser_injection/inputs.rt | 2 | ||||
-rw-r--r-- | Example/plasma_acceleration/inputs.ext.beam | 124 | ||||
-rw-r--r-- | Example/uniform_plasma/inputs | 4 | ||||
-rw-r--r-- | Example/uniform_plasma/inputs.rt | 2 | ||||
-rw-r--r-- | README.md | 68 | ||||
-rw-r--r-- | Source/PhysicalParticleContainer.cpp | 10 | ||||
-rw-r--r-- | Source/WarpX.H | 3 | ||||
-rw-r--r-- | Source/WarpX.cpp | 2 | ||||
-rw-r--r-- | Source/WarpXComm.cpp | 6 | ||||
-rw-r--r-- | tests/Langmuir/langmuir.py | 2 |
14 files changed, 221 insertions, 10 deletions
diff --git a/Example/Langmuir/inputs.multi.rt b/Example/Langmuir/inputs.multi.rt index 0687df4b8..fb54c2080 100644 --- a/Example/Langmuir/inputs.multi.rt +++ b/Example/Langmuir/inputs.multi.rt @@ -19,6 +19,8 @@ geometry.is_periodic = 1 1 1 # Is periodic? geometry.prob_lo = -20.e-6 -20.e-6 -20.e-6 # physical domain geometry.prob_hi = 20.e-6 20.e-6 20.e-6 +warpx.serialize_ics = 1 + # Verbosity warpx.verbose = 1 diff --git a/Example/Langmuir/inputs.rt b/Example/Langmuir/inputs.rt index fa0c76cf6..48e2d0c8b 100644 --- a/Example/Langmuir/inputs.rt +++ b/Example/Langmuir/inputs.rt @@ -19,6 +19,8 @@ geometry.is_periodic = 1 1 1 # Is periodic? geometry.prob_lo = -20.e-6 -20.e-6 -20.e-6 # physical domain geometry.prob_hi = 20.e-6 20.e-6 20.e-6 +warpx.serialize_ics = 1 + # Verbosity warpx.verbose = 1 diff --git a/Example/laser_acceleration/inputs.rt b/Example/laser_acceleration/inputs.rt index 303ab9873..59bcc700e 100644 --- a/Example/laser_acceleration/inputs.rt +++ b/Example/laser_acceleration/inputs.rt @@ -19,6 +19,8 @@ geometry.is_periodic = 1 1 0 # Is periodic? geometry.prob_lo = -30.e-6 -30.e-6 -70.e-6 # physical domain geometry.prob_hi = 30.e-6 30.e-6 1.e-6 +warpx.serialize_ics = 1 + # Verbosity warpx.verbose = 1 warpx.plot_raw_fields = 1 diff --git a/Example/laser_injection/inputs.2d.rt b/Example/laser_injection/inputs.2d.rt index e882fcde1..49961166f 100644 --- a/Example/laser_injection/inputs.2d.rt +++ b/Example/laser_injection/inputs.2d.rt @@ -17,6 +17,8 @@ geometry.is_periodic = 0 1 # Is periodic? geometry.prob_lo = -12.e-6 -20.e-6 # physical domain geometry.prob_hi = 12.e-6 20.e-6 +warpx.serialize_ics = 1 + # Verbosity warpx.verbose = 1 diff --git a/Example/laser_injection/inputs.rt b/Example/laser_injection/inputs.rt index 4c7cb5085..a461f32c7 100644 --- a/Example/laser_injection/inputs.rt +++ b/Example/laser_injection/inputs.rt @@ -17,6 +17,8 @@ geometry.is_periodic = 1 1 0 # Is periodic? geometry.prob_lo = -20.e-6 -20.e-6 -12.e-6 # physical domain geometry.prob_hi = 20.e-6 20.e-6 12.e-6 +warpx.serialize_ics = 1 + # Verbosity warpx.verbose = 1 diff --git a/Example/plasma_acceleration/inputs.ext.beam b/Example/plasma_acceleration/inputs.ext.beam new file mode 100644 index 000000000..0a11cb971 --- /dev/null +++ b/Example/plasma_acceleration/inputs.ext.beam @@ -0,0 +1,124 @@ +# Maximum number of time steps +max_step = 10000 + +# number of grid points +amr.n_cell = 128 128 64 + +# Maximum allowable size of each subdomain in the problem domain; +# this is used to decompose the domain for parallel calculations. +amr.max_grid_size = 32 +# The lo and hi ends of grids are multipliers of blocking factor +amr.blocking_factor = 32 + +# Maximum level in hierarchy (for now must be 0, i.e., one level in total) +amr.max_level = 0 +warpx.fine_tag_lo = -220.e-6 -220.e-6 -350.e-6 +warpx.fine_tag_hi = 220.e-6 220.e-6 0.e-6 + +amr.plot_int = 200 # How often to write plotfiles. "<= 0" means no plotfiles. + +# Geometry +geometry.coord_sys = 0 # 0: Cartesian +geometry.is_periodic = 0 0 0 # Is periodic? +geometry.prob_lo = -220.e-6 -220.e-6 -350.e-6 # physical domain +geometry.prob_hi = 220.e-6 220.e-6 0.e-6 + +# Verbosity +warpx.verbose = 1 +warpx.plot_raw_fields = 1 +warpx.do_dive_cleaning = 0 +warpx.use_filter = 1 +warpx.do_pml = 1 + +# Algorithms +algo.current_deposition = 3 +algo.charge_deposition = 0 +algo.field_gathering = 0 +algo.particle_pusher = 0 + +# CFL +warpx.cfl = .99 +particles.nspecies = 3 +particles.species_names = driver beam plasma_e plasma_p + +# +# The driver species information +# + +driver.charge = -q_e +driver.mass = m_e +driver.injection_style = "NUniformPerCell" +driver.xmin = -20.e-6 +driver.xmax = 20.e-6 +driver.ymin = -20.e-6 +driver.ymax = 20.e-6 +driver.zmin = -90.e-6 +driver.zmax = -40.e-6 + +driver.profile = "constant" +driver.density = 2.e22 # number of particles per m^3 +driver.num_particles_per_cell_each_dim = 2 2 2 + +driver.momentum_distribution_type = "constant" +driver.ux = 0.0 +driver.uy = 0.0 +driver.uz = 1e6 + +# +# The beam species information +# + +beam.charge = -q_e +beam.mass = m_e +beam.injection_style = "NUniformPerCell" + +beam.xmin = -10.e-6 +beam.xmax = 10.e-6 +beam.ymin = -10.e-6 +beam.ymax = 10.e-6 +beam.zmin = -230.e-6 +beam.zmax = -210.e-6 + +beam.profile = "constant" +beam.density = 5.e20 # number of particles per m^3 +beam.num_particles_per_cell_each_dim = 4 4 4 + +beam.momentum_distribution_type = "gaussian" +beam.ux_m = 0.0 +beam.uy_m = 0.0 +beam.uz_m = 1.e3 +beam.u_th = 2. + +# +# The plasma species information +# + +plasma_e.charge = -q_e +plasma_e.mass = m_e +plasma_e.injection_style = "NUniformPerCell" + +plasma_e.xmin = -120.e-6 +plasma_e.xmax = 120.e-6 +plasma_e.ymin = -120.e-6 +plasma_e.ymax = 120.e-6 +plasma_e.zmin = 0.e-6 + +plasma_e.profile = "constant" +plasma_e.density = 1e22 +plasma_e.num_particles_per_cell_each_dim = 1 1 1 + +plasma_e.momentum_distribution_type = "constant" +plasma_e.ux = 0.0 +plasma_e.uy = 0.0 +plasma_e.uz = 0.0 +# plasma.u_th = 0. + +# Moving window +warpx.do_moving_window = 1 +warpx.moving_window_dir = z +warpx.moving_window_v = 1. # in units of the speed of light + +# Particle Injection +warpx.do_plasma_injection = 1 +warpx.num_injected_species = 1 +warpx.injected_plasma_species = 2 diff --git a/Example/uniform_plasma/inputs b/Example/uniform_plasma/inputs index 419e8909a..4494317aa 100644 --- a/Example/uniform_plasma/inputs +++ b/Example/uniform_plasma/inputs @@ -1,10 +1,10 @@ # Maximum number of time steps -max_step = 100 +max_step = 5 # number of grid points amr.n_cell = 64 64 64 -amr.plot_int = 5 # How often to write plotfiles. +amr.plot_int = -1 # How often to write plotfiles. # Maximum allowable size of each subdomain in the problem domain; # this is used to decompose the domain for parallel calculations. diff --git a/Example/uniform_plasma/inputs.rt b/Example/uniform_plasma/inputs.rt index bf6bb127a..765f68e2a 100644 --- a/Example/uniform_plasma/inputs.rt +++ b/Example/uniform_plasma/inputs.rt @@ -17,6 +17,8 @@ geometry.is_periodic = 1 1 1 # Is periodic? geometry.prob_lo = -20.e-6 -20.e-6 -20.e-6 # physical domain geometry.prob_hi = 20.e-6 20.e-6 20.e-6 +warpx.serialize_ics = 1 + # Verbosity warpx.verbose = 1 @@ -129,3 +129,71 @@ and follow the instructions that will pop up in your browser. - 0: pusher of Boris - 1: pusher of J. L. Vay + + +## Running the regression test + +In order to run the regression test: + +- **Prepare your environment**: Create a new directory (outside of warpx_directory) where the regression tests will be run. Here this directory will be denoted `<regression_directory>`. Then do +``` +cd <regression_directory> +cp <warpx_directory>/amrex/Tools/RegressionTesting/regtest.py ./ +cp <warpx_directory>/warpx/Regression/WarpX-tests.ini ./ +export PYTHONPATH=$PYTHONPATH:<warpx_directory>/amrex/Tools/RegressionTesting/ +``` +where `<regression_directory>` and `<warpx_directory>` should be replaced by the proper values for your environment. Then open the file `WarpX-tests.ini` and replace the section +``` +[main] +testTopDir = /home/regtester/AMReX_RegTesting/rt-WarpX/ +webTopDir = /home/regtester/AMReX_RegTesting/rt-WarpX/web +``` +by +``` +[main] +testTopDir = <warpx_directory> +webTopDir = <warpx_directory>/web +``` +(using only full paths; not relative paths) and replace the section +``` +[AMReX] +dir = /home/regtester/AMReX_RegTesting/amrex/ +branch = development + +[source] +dir = /home/regtester/AMReX_RegTesting/warpx/ +branch = master + +[extra-PICSAR] +dir = /home/regtester/AMReX_RegTesting/picsar/ +branch = master +``` +by +``` +[AMReX] +dir = <warpx_directory>/amrex/ +branch = development + +[source] +dir = <warpx_directory>/warpx/ +branch = master + +[extra-PICSAR] +dir = <warpx_directory>/picsar/ +branch = master +``` +(again using only full paths; not relative paths) + +- **Set the reference:** Type: +``` +python regtest.py --amrex_git_hash <amrex_hash> --source_git_hash <warpx_hash> --extra_src_git_hash <picsar_hash> --make_benchmarks "Resetting benchmarks" WarpX-tests.ini +``` +where `<amrex_hash>`, `<warpx_hash>` and `<picsar_hash>` correspond to the git +hash for the code that you wish to use as a reference (and are optional arguments.) + +- **Run the tests for a particular commit and compare with the reference:** Modify the same section as above to point to the relevant commit, and type: +``` +python regtest.py --amrex_git_hash <amrex_hash> --source_git_hash <warpx_hash> --extra_src_git_hash <picsar_hash> WarpX-tests.ini +``` +where `<amrex_hash>`, `<warpx_hash>` and `<picsar_hash>` correspond to the git +hash for the code that you wish to test (and are optional arguments.) diff --git a/Source/PhysicalParticleContainer.cpp b/Source/PhysicalParticleContainer.cpp index c221ddd84..b9ddd8ec4 100644 --- a/Source/PhysicalParticleContainer.cpp +++ b/Source/PhysicalParticleContainer.cpp @@ -103,16 +103,18 @@ PhysicalParticleContainer::AddParticles (int lev, Box part_box) #elif BL_SPACEDIM==2 scale_fac = dx[0]*dx[2]/num_ppc; #endif - + +#ifdef _OPENMP // First touch all tiles in the map in serial for (MFIter mfi = MakeMFIter(lev); mfi.isValid(); ++mfi) { const int grid_id = mfi.index(); const int tile_id = mfi.LocalTileIndex(); GetParticles(lev)[std::make_pair(grid_id, tile_id)]; } +#endif #ifdef _OPENMP -#pragma omp parallel +#pragma omp parallel if (not WarpX::serialize_ics) #endif { std::array<Real,PIdx::nattribs> attribs; @@ -474,8 +476,8 @@ PhysicalParticleContainer::Evolve (int lev, long ngRho = (rho) ? rho->nGrow() : 0; - long ngRhoDeposit = (WarpX::use_filter) ? ngRho : ngRho + 1; - long ngJDeposit = (WarpX::use_filter) ? ngJ : ngJ + 1; + long ngRhoDeposit = (WarpX::use_filter) ? ngRho +1 : ngRho; + long ngJDeposit = (WarpX::use_filter) ? ngJ +1 : ngJ; BL_ASSERT(OnSameGrids(lev,Ex)); diff --git a/Source/WarpX.H b/Source/WarpX.H index 6a16fed33..e036e0585 100644 --- a/Source/WarpX.H +++ b/Source/WarpX.H @@ -76,6 +76,7 @@ public: static bool use_laser; static bool use_filter; + static bool serialize_ics; const amrex::MultiFab& getcurrent (int lev, int direction) {return *current_fp[lev][direction];} const amrex::MultiFab& getEfield (int lev, int direction) {return *Efield_fp[lev][direction];} @@ -328,7 +329,7 @@ private: int do_electrostatic = 0; int n_buffer = 4; - Real const_dt = 0.5e-11; + amrex::Real const_dt = 0.5e-11; // Other runtime parameters int verbose = 1; diff --git a/Source/WarpX.cpp b/Source/WarpX.cpp index 3fd47d51d..9f2a7eeab 100644 --- a/Source/WarpX.cpp +++ b/Source/WarpX.cpp @@ -35,6 +35,7 @@ long WarpX::noz = 1; bool WarpX::use_laser = false; bool WarpX::use_filter = false; +bool WarpX::serialize_ics = false; #if (BL_SPACEDIM == 3) IntVect WarpX::Bx_nodal_flag(1,0,0); @@ -209,6 +210,7 @@ WarpX::ReadParameters () pp.query("use_laser", use_laser); pp.query("use_filter", use_filter); + pp.query("serialize_ics", serialize_ics); pp.query("do_dive_cleaning", do_dive_cleaning); pp.query("do_pml", do_pml); diff --git a/Source/WarpXComm.cpp b/Source/WarpXComm.cpp index d5c0c81b4..934ef1b34 100644 --- a/Source/WarpXComm.cpp +++ b/Source/WarpXComm.cpp @@ -54,9 +54,9 @@ WarpX::UpdateAuxilaryData () dBx.setVal(0.0); dBy.setVal(0.0); dBz.setVal(0.0); - dBx.copy(*Bfield_aux[lev-1][0], 0, 0, 1, 0, ng, crse_period); - dBy.copy(*Bfield_aux[lev-1][1], 0, 0, 1, 0, ng, crse_period); - dBz.copy(*Bfield_aux[lev-1][2], 0, 0, 1, 0, ng, crse_period); + dBx.copy(*Bfield_aux[lev-1][0], 0, 0, 1, ng, ng, crse_period); + dBy.copy(*Bfield_aux[lev-1][1], 0, 0, 1, ng, ng, crse_period); + dBz.copy(*Bfield_aux[lev-1][2], 0, 0, 1, ng, ng, crse_period); MultiFab::Subtract(dBx, *Bfield_cp[lev][0], 0, 0, 1, ng); MultiFab::Subtract(dBy, *Bfield_cp[lev][1], 0, 0, 1, ng); MultiFab::Subtract(dBz, *Bfield_cp[lev][2], 0, 0, 1, ng); diff --git a/tests/Langmuir/langmuir.py b/tests/Langmuir/langmuir.py index 7ef402445..666dc2757 100644 --- a/tests/Langmuir/langmuir.py +++ b/tests/Langmuir/langmuir.py @@ -111,6 +111,8 @@ geometry.is_periodic = "1 1 1" # Is periodic? geometry.prob_lo = "%7.0e %7.0e %7.0e"%(xmin, ymin, zmin) # physical domain geometry.prob_hi = "%7.0e %7.0e %7.0e"%(xmax, ymax, zmax) +warpx.serialize_ics = 1 + # Verbosity warpx.verbose = 1 |