diff --git a/.clang-tidy b/.clang-tidy index 4e1463affba..21f0343519c 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -41,7 +41,6 @@ Checks: ' -readability-implicit-bool-conversion, -readability-isolate-declaration, -readability-magic-numbers, - -readability-make-member-function-const, -readability-named-parameter, -readability-uppercase-literal-suffix ' diff --git a/.github/workflows/cuda.yml b/.github/workflows/cuda.yml index 29a434dc579..830c33e9a91 100644 --- a/.github/workflows/cuda.yml +++ b/.github/workflows/cuda.yml @@ -115,7 +115,7 @@ jobs: which nvcc || echo "nvcc not in PATH!" git clone https://github.com/AMReX-Codes/amrex.git ../amrex - cd ../amrex && git checkout --detach 75571e2dcbf2417529c5ed8e24113580e8e1f3f1 && cd - + cd ../amrex && git checkout --detach 24.01 && cd - make COMP=gcc QED=FALSE USE_MPI=TRUE USE_GPU=TRUE USE_OMP=FALSE USE_PSATD=TRUE USE_CCACHE=TRUE -j 2 ccache -s diff --git a/CMakeLists.txt b/CMakeLists.txt index e6aa3c8174f..7a0b28c9f86 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ # Preamble #################################################################### # cmake_minimum_required(VERSION 3.20.0) -project(WarpX VERSION 23.12) +project(WarpX VERSION 24.01) include(${WarpX_SOURCE_DIR}/cmake/WarpXFunctions.cmake) diff --git a/Docs/source/conf.py b/Docs/source/conf.py index f21dea15f18..48a02c5d216 100644 --- a/Docs/source/conf.py +++ b/Docs/source/conf.py @@ -103,9 +103,9 @@ def __init__(self, *args, **kwargs): # built documents. # # The short X.Y version. -version = u'23.12' +version = u'24.01' # The full version, including alpha/beta/rc tags. -release = u'23.12' +release = u'24.01' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/Docs/source/usage/examples.rst b/Docs/source/usage/examples.rst index 855faab392a..0492372b4e6 100644 --- a/Docs/source/usage/examples.rst +++ b/Docs/source/usage/examples.rst @@ -25,14 +25,6 @@ Plasma-Based Acceleration examples/pwfa/README.rst pwfa.rst -Coming soon: - -* LWFA: External injection in the boosted frame -* LWFA: Ionization injection in the lab frame using a LASY data file -* PWFA: External injection in the boosted frame -* PWFA: Self-injection in the lab frame -* MR case? - Laser-Plasma Interaction ------------------------ @@ -43,11 +35,6 @@ Laser-Plasma Interaction examples/laser_ion/README.rst examples/plasma_mirror/README.rst -Coming soon: - -* MVA (3D & RZ) -* MR for the planar example? - Particle Accelerator & Beam Physics ----------------------------------- @@ -58,12 +45,6 @@ Particle Accelerator & Beam Physics examples/gaussian_beam/README.rst examples/beam-beam_collision/README.rst -Coming soon: - -* Beam-Beam Collision -* Beam Transport or Injector -* Cathode/source - High Energy Astrophysical Plasma Physics ---------------------------------------- @@ -90,11 +71,6 @@ Nuclear Fusion TODO -Coming soon: - -* Microchannel -* Magnetically Confined Plasma with a Single Coil - Magnetic bottle: simple geometry with an external field - Fundamental Plasma Physics -------------------------- @@ -105,9 +81,6 @@ Fundamental Plasma Physics examples/langmuir/README.rst examples/capacitive_discharge/README.rst -Coming soon: - -* Expanding Sphere example .. _examples-hybrid-model: @@ -150,7 +123,7 @@ Manipulating fields via Python .. note:: - TODO: The section needs to be sorted into either science cases (above) or later sections (workflows and Python API details). + TODO: The section needs to be sorted into either science cases (above) or later sections (:ref:`workflows and Python API details `). An example of using Python to access the simulation charge density, solve the Poisson equation (using ``superLU``) and write the resulting electrostatic potential back to the simulation is given in the input file below. This example uses the ``fields.py`` module included in the ``pywarpx`` library. diff --git a/Docs/source/usage/parameters.rst b/Docs/source/usage/parameters.rst index 81580f5c342..0597b21c393 100644 --- a/Docs/source/usage/parameters.rst +++ b/Docs/source/usage/parameters.rst @@ -1167,6 +1167,11 @@ Particle initialization * ``.do_field_ionization`` (`0` or `1`) optional (default `0`) Do field ionization for this species (using the ADK theory). +* ``.do_adk_correction`` (`0` or `1`) optional (default `0`) + Whether to apply the correction to the ADK theory proposed by Zhang, Lan and Lu in `Q. Zhang et al. (Phys. Rev. A 90, 043410, 2014) `__. + If so, the probability of ionization is modified using an empirical model that should be more accurate in the regime of high electric fields. + Currently, this is only implemented for Hydrogen, although Argon is also available in the same reference. + * ``.physical_element`` (`string`) Only read if `do_field_ionization = 1`. Symbol of chemical element for this species. Example: for Helium, use ``physical_element = He``. @@ -1508,9 +1513,15 @@ Laser initialization External fields --------------- -Grid initialization +Applied to the grid ^^^^^^^^^^^^^^^^^^^ +The external fields defined with input parameters that start with ``warpx.B_ext_grid_init_`` or ``warpx.E_ext_grid_init_`` +are applied to the grid directly. In particular, these fields can be seen in the diagnostics that output the fields on the grid. + + - When using an **electromagnetic** field solver, these fields are applied to the grid at the beginning of the simulation, and serve as initial condition for the Maxwell solver. + - When using an **electrostatic** or **magnetostatic** field solver, these fields are added to the fields computed by the Poisson solver, at each timestep. + * ``warpx.B_ext_grid_init_style`` (string) optional This parameter determines the type of initialization for the external magnetic field. By default, the @@ -1597,6 +1608,9 @@ Grid initialization Applied to Particles ^^^^^^^^^^^^^^^^^^^^ +The external fields defined with input parameters that start with ``warpx.B_ext_particle_init_`` or ``warpx.E_ext_particle_init_`` +are applied to the particles directly, at each timestep. As a results, these fields **cannot** be seen in the diagnostics that output the fields on the grid. + * ``particles.E_ext_particle_init_style`` & ``particles.B_ext_particle_init_style`` (string) optional (default "none") These parameters determine the type of the external electric and magnetic fields respectively that are applied directly to the particles at every timestep. @@ -1657,6 +1671,9 @@ Applied to Particles Applied to Cold Relativistic Fluids ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +The external fields defined with input parameters that start with ``warpx.B_ext_init_`` or ``warpx.E_ext_init_`` +are applied to the fluids directly, at each timestep. As a results, these fields **cannot** be seen in the diagnostics that output the fields on the grid. + * ``.E_ext_init_style`` & ``.B_ext_init_style`` (string) optional (default "none") These parameters determine the type of the external electric and magnetic fields respectively that are applied directly to the cold relativistic fluids at every timestep. diff --git a/Examples/Physics_applications/beam-beam_collision/inputs b/Examples/Physics_applications/beam-beam_collision/inputs index e66f0e63050..488e997f895 100644 --- a/Examples/Physics_applications/beam-beam_collision/inputs +++ b/Examples/Physics_applications/beam-beam_collision/inputs @@ -71,8 +71,8 @@ algo.particle_pusher = vay ################################# ########### PARTICLES ########### ################################# -particles.species_names = beam1 beam2 pho1 pho2 ele_nlbw1 pos_nlbw1 ele_nlbw2 pos_nlbw2 pho ele pos -particles.photon_species = pho1 pho2 pho +particles.species_names = beam1 beam2 pho1 pho2 ele1 pos1 ele2 pos2 +particles.photon_species = pho1 pho2 beam1.species_type = electron beam1.injection_style = NUniformPerCell @@ -117,68 +117,58 @@ beam2.do_classical_radiation_reaction = 0 pho1.species_type = photon pho1.injection_style = none pho1.do_qed_breit_wheeler = 1 -pho1.qed_breit_wheeler_ele_product_species = ele_nlbw1 -pho1.qed_breit_wheeler_pos_product_species = pos_nlbw1 +pho1.qed_breit_wheeler_ele_product_species = ele1 +pho1.qed_breit_wheeler_pos_product_species = pos1 pho2.species_type = photon pho2.injection_style = none pho2.do_qed_breit_wheeler = 1 -pho2.qed_breit_wheeler_ele_product_species = ele_nlbw2 -pho2.qed_breit_wheeler_pos_product_species = pos_nlbw2 - -ele_nlbw1.species_type = electron -ele_nlbw1.injection_style = none -ele_nlbw1.self_fields_required_precision = 1e-11 -ele_nlbw1.self_fields_max_iters = 10000 -ele_nlbw1.do_qed_quantum_sync = 1 -ele_nlbw1.qed_quantum_sync_phot_product_species = pho -ele_nlbw1.do_classical_radiation_reaction = 0 - -pos_nlbw1.species_type = positron -pos_nlbw1.injection_style = none -pos_nlbw1.self_fields_required_precision = 1e-11 -pos_nlbw1.self_fields_max_iters = 10000 -pos_nlbw1.do_qed_quantum_sync = 1 -pos_nlbw1.qed_quantum_sync_phot_product_species = pho -pos_nlbw1.do_classical_radiation_reaction = 0 - -ele_nlbw2.species_type = electron -ele_nlbw2.injection_style = none -ele_nlbw2.self_fields_required_precision = 1e-11 -ele_nlbw2.self_fields_max_iters = 10000 -ele_nlbw2.do_qed_quantum_sync = 1 -ele_nlbw2.qed_quantum_sync_phot_product_species = pho -ele_nlbw2.do_classical_radiation_reaction = 0 - -pos_nlbw2.species_type = positron -pos_nlbw2.injection_style = none -pos_nlbw2.self_fields_required_precision = 1e-11 -pos_nlbw2.self_fields_max_iters = 10000 -pos_nlbw2.do_qed_quantum_sync = 1 -pos_nlbw2.qed_quantum_sync_phot_product_species = pho -pos_nlbw2.do_classical_radiation_reaction = 0 - -pho.species_type = photon -pho.injection_style = none -pho.do_qed_breit_wheeler = 1 -pho.qed_breit_wheeler_ele_product_species = ele -pho.qed_breit_wheeler_pos_product_species = pos - -ele.species_type = electron -ele.injection_style = none -ele.self_fields_required_precision = 1e-11 -ele.self_fields_max_iters = 10000 -ele.do_qed_quantum_sync = 1 -ele.qed_quantum_sync_phot_product_species = pho -ele.do_classical_radiation_reaction = 0 - -pos.species_type = positron -pos.injection_style = none -pos.self_fields_required_precision = 1e-11 -pos.self_fields_max_iters = 10000 -pos.do_qed_quantum_sync = 1 -pos.qed_quantum_sync_phot_product_species = pho -pos.do_classical_radiation_reaction = 0 +pho2.qed_breit_wheeler_ele_product_species = ele2 +pho2.qed_breit_wheeler_pos_product_species = pos2 + +ele1.species_type = electron +ele1.injection_style = none +ele1.self_fields_required_precision = 1e-11 +ele1.self_fields_max_iters = 10000 +ele1.do_qed_quantum_sync = 1 +ele1.qed_quantum_sync_phot_product_species = pho1 +ele1.do_classical_radiation_reaction = 0 + +pos1.species_type = positron +pos1.injection_style = none +pos1.self_fields_required_precision = 1e-11 +pos1.self_fields_max_iters = 10000 +pos1.do_qed_quantum_sync = 1 +pos1.qed_quantum_sync_phot_product_species = pho1 +pos1.do_classical_radiation_reaction = 0 + +ele2.species_type = electron +ele2.injection_style = none +ele2.self_fields_required_precision = 1e-11 +ele2.self_fields_max_iters = 10000 +ele2.do_qed_quantum_sync = 1 +ele2.qed_quantum_sync_phot_product_species = pho2 +ele2.do_classical_radiation_reaction = 0 + +pos2.species_type = positron +pos2.injection_style = none +pos2.self_fields_required_precision = 1e-11 +pos2.self_fields_max_iters = 10000 +pos2.do_qed_quantum_sync = 1 +pos2.qed_quantum_sync_phot_product_species = pho2 +pos2.do_classical_radiation_reaction = 0 + +pho1.species_type = photon +pho1.injection_style = none +pho1.do_qed_breit_wheeler = 1 +pho1.qed_breit_wheeler_ele_product_species = ele1 +pho1.qed_breit_wheeler_pos_product_species = pos1 + +pho2.species_type = photon +pho2.injection_style = none +pho2.do_qed_breit_wheeler = 1 +pho2.qed_breit_wheeler_ele_product_species = ele2 +pho2.qed_breit_wheeler_pos_product_species = pos2 ################################# ############# QED ############### @@ -225,10 +215,10 @@ diagnostics.diags_names = diag1 diag1.intervals = 0 diag1.diag_type = Full diag1.write_species = 1 -diag1.fields_to_plot = Ex Ey Ez Bx By Bz rho_beam1 rho_beam2 rho_ele_nlbw1 rho_pos_nlbw1 rho_ele_nlbw2 rho_pos_nlbw2 rho_ele rho_pos +diag1.fields_to_plot = Ex Ey Ez Bx By Bz rho_beam1 rho_beam2 rho_ele1 rho_pos1 rho_ele2 rho_pos2 diag1.format = openpmd diag1.dump_last_timestep = 1 -diag1.species = pho1 pho2 pho ele_nlbw1 pos_nlbw1 ele_nlbw2 pos_nlbw2 ele pos beam1 beam2 +diag1.species = pho1 pho2 ele1 pos1 ele2 pos2 beam1 beam2 # REDUCED warpx.reduced_diags_names = ParticleNumber ColliderRelevant_beam1_beam2 diff --git a/Examples/Physics_applications/capacitive_discharge/analysis_dsmc.py b/Examples/Physics_applications/capacitive_discharge/analysis_dsmc.py index df773dd9deb..a7a76be46ad 100755 --- a/Examples/Physics_applications/capacitive_discharge/analysis_dsmc.py +++ b/Examples/Physics_applications/capacitive_discharge/analysis_dsmc.py @@ -15,46 +15,44 @@ fn = sys.argv[1] test_name = os.path.split(os.getcwd())[1] -my_check = checksumAPI.evaluate_checksum( - test_name, fn, do_particles=True, rtol=0.01 -) +my_check = checksumAPI.evaluate_checksum(test_name, fn, do_particles=True) ref_density = np.array([ - 1.27953969e+14, 2.23553999e+14, 2.55384510e+14, 2.55663110e+14, - 2.55805760e+14, 2.55812087e+14, 2.55813911e+14, 2.55754104e+14, - 2.55929601e+14, 2.56085472e+14, 2.55932867e+14, 2.55828121e+14, - 2.55901711e+14, 2.55985074e+14, 2.56182697e+14, 2.56446847e+14, - 2.56483696e+14, 2.56301187e+14, 2.56245301e+14, 2.56797584e+14, - 2.57257907e+14, 2.57023627e+14, 2.56500876e+14, 2.56106851e+14, - 2.56283546e+14, 2.56723967e+14, 2.56960855e+14, 2.56825486e+14, - 2.56674669e+14, 2.56567191e+14, 2.56310927e+14, 2.56361171e+14, - 2.56692197e+14, 2.56743606e+14, 2.56653108e+14, 2.56883854e+14, - 2.56763228e+14, 2.56343726e+14, 2.56385489e+14, 2.56570110e+14, - 2.56538112e+14, 2.56472179e+14, 2.56322922e+14, 2.56195384e+14, - 2.56474576e+14, 2.56764233e+14, 2.56533016e+14, 2.56257170e+14, - 2.56362463e+14, 2.56363962e+14, 2.56311292e+14, 2.56678788e+14, - 2.57061138e+14, 2.56785892e+14, 2.56406603e+14, 2.56334908e+14, - 2.56120051e+14, 2.56003269e+14, 2.56132187e+14, 2.56329572e+14, - 2.56535713e+14, 2.56708950e+14, 2.56661860e+14, 2.56448986e+14, - 2.56386823e+14, 2.56233660e+14, 2.56137632e+14, 2.56206263e+14, - 2.56364996e+14, 2.56483536e+14, 2.56308741e+14, 2.56447231e+14, - 2.56896301e+14, 2.56691405e+14, 2.56170780e+14, 2.56122216e+14, - 2.56427399e+14, 2.56897558e+14, 2.56928868e+14, 2.56659033e+14, - 2.56749993e+14, 2.56952497e+14, 2.56798907e+14, 2.56377081e+14, - 2.56453057e+14, 2.56796632e+14, 2.56944576e+14, 2.57248469e+14, - 2.57279426e+14, 2.56849516e+14, 2.56601834e+14, 2.56850545e+14, - 2.56953072e+14, 2.56442586e+14, 2.56329006e+14, 2.56790661e+14, - 2.57083582e+14, 2.57075550e+14, 2.56719615e+14, 2.56220486e+14, - 2.56222323e+14, 2.56547365e+14, 2.56499423e+14, 2.56434041e+14, - 2.56378587e+14, 2.56249892e+14, 2.56380492e+14, 2.56504513e+14, - 2.56337631e+14, 2.56204891e+14, 2.56325116e+14, 2.56297798e+14, - 2.56112782e+14, 2.56054218e+14, 2.56320120e+14, 2.56580938e+14, - 2.56446800e+14, 2.56267011e+14, 2.56372853e+14, 2.56617592e+14, - 2.56630745e+14, 2.56615242e+14, 2.56625259e+14, 2.56561320e+14, - 2.56640072e+14, 2.56693273e+14, 2.56613237e+14, 2.24169847e+14, - 1.27683197e+14 + 1.27957355e+14, 2.23554080e+14, 2.55373436e+14, 2.55659492e+14, + 2.55814670e+14, 2.55818418e+14, 2.55811882e+14, 2.55742272e+14, + 2.55912888e+14, 2.56086072e+14, 2.55944486e+14, 2.55830183e+14, + 2.55909337e+14, 2.56008609e+14, 2.56205930e+14, 2.56421940e+14, + 2.56369990e+14, 2.56151020e+14, 2.55925823e+14, 2.55924941e+14, + 2.56067211e+14, 2.56264104e+14, 2.56435035e+14, 2.56543804e+14, + 2.56715146e+14, 2.56639305e+14, 2.56509438e+14, 2.56478881e+14, + 2.56406748e+14, 2.56194832e+14, 2.56126186e+14, 2.56442221e+14, + 2.56603784e+14, 2.56592554e+14, 2.56475838e+14, 2.56304135e+14, + 2.56310993e+14, 2.56298883e+14, 2.56386742e+14, 2.56555670e+14, + 2.56588013e+14, 2.56851444e+14, 2.56928531e+14, 2.56637559e+14, + 2.56678652e+14, 2.56827322e+14, 2.56630197e+14, 2.56295404e+14, + 2.56285079e+14, 2.56558116e+14, 2.56676094e+14, 2.56577780e+14, + 2.56599749e+14, 2.56540500e+14, 2.56292984e+14, 2.56230350e+14, + 2.56363607e+14, 2.56553909e+14, 2.56501054e+14, 2.56249684e+14, + 2.56280268e+14, 2.56558208e+14, 2.56437837e+14, 2.56152650e+14, + 2.56143349e+14, 2.56067330e+14, 2.56020624e+14, 2.56039223e+14, + 2.56306096e+14, 2.56693084e+14, 2.56649778e+14, 2.56589778e+14, + 2.56594097e+14, 2.56368788e+14, 2.56290090e+14, 2.56420940e+14, + 2.56581419e+14, 2.56642649e+14, 2.56426887e+14, 2.56360122e+14, + 2.56573424e+14, 2.56679138e+14, 2.56488767e+14, 2.56217444e+14, + 2.56353118e+14, 2.56640765e+14, 2.56809490e+14, 2.56933226e+14, + 2.56633538e+14, 2.56203430e+14, 2.56202958e+14, 2.56564020e+14, + 2.56816347e+14, 2.56709830e+14, 2.56557382e+14, 2.56573904e+14, + 2.56745541e+14, 2.56784430e+14, 2.56580054e+14, 2.56210130e+14, + 2.56271415e+14, 2.56821160e+14, 2.56703292e+14, 2.56169296e+14, + 2.56166549e+14, 2.56467777e+14, 2.56573240e+14, 2.56437594e+14, + 2.56253730e+14, 2.56176123e+14, 2.56351125e+14, 2.56569916e+14, + 2.56761101e+14, 2.56891411e+14, 2.56628312e+14, 2.56180062e+14, + 2.56063564e+14, 2.56189728e+14, 2.56609454e+14, 2.57263643e+14, + 2.57097673e+14, 2.56666761e+14, 2.56622585e+14, 2.56432378e+14, + 2.56386718e+14, 2.56734491e+14, 2.57042448e+14, 2.24471147e+14, + 1.27720853e+14 ]) density_data = np.load( 'ion_density_case_1.npy' ) print(repr(density_data)) -assert np.allclose(density_data, ref_density, rtol=0.01) +assert np.allclose(density_data, ref_density) diff --git a/Examples/Tests/LoadExternalField/inputs_rz b/Examples/Tests/LoadExternalField/inputs_rz index 050118d036f..2e22ca299ea 100644 --- a/Examples/Tests/LoadExternalField/inputs_rz +++ b/Examples/Tests/LoadExternalField/inputs_rz @@ -46,7 +46,7 @@ algo.particle_shape = 1 ################################# ############ PLASMA ############# ################################# -particles.species_names = proton #electron +particles.species_names = proton proton.injection_style = "SingleParticle" proton.single_particle_pos = 0.0 0.2 2.5 proton.single_particle_u = 9.506735958279367e-05 0.0 0.00013435537232359165 @@ -55,14 +55,11 @@ proton.do_not_deposit = 1 proton.mass = m_p proton.charge = q_e -#electron.injection_style = "SingleParticle" -#electron.single_particle_pos = 0.0 0.2 2.5 -#electron.single_particle_u = 0.0 0.0 0.0 -#electron.single_particle_weight = 1.0 -#electron.mass = 1.0 -#electron.charge = -q_e*1.0e-20 - # Diagnostics -diagnostics.diags_names = diag1 +diagnostics.diags_names = diag1 chk diag1.intervals = 300 diag1.diag_type = Full + +chk.intervals = 150 +chk.diag_type = Full +chk.format = checkpoint diff --git a/Python/setup.py b/Python/setup.py index 47028642cce..f82e6563a31 100644 --- a/Python/setup.py +++ b/Python/setup.py @@ -54,7 +54,7 @@ package_data = {} setup(name = 'pywarpx', - version = '23.12', + version = '24.01', packages = ['pywarpx'], package_dir = {'pywarpx': 'pywarpx'}, description = """Wrapper of WarpX""", diff --git a/Regression/Checksum/benchmarks_json/BeamBeamCollision.json b/Regression/Checksum/benchmarks_json/BeamBeamCollision.json index da2a8500b53..16c27055ab5 100644 --- a/Regression/Checksum/benchmarks_json/BeamBeamCollision.json +++ b/Regression/Checksum/benchmarks_json/BeamBeamCollision.json @@ -1,128 +1,96 @@ { "lev=0": { - "Bx": 970235841795.1099, - "By": 970175630167.5084, - "Bz": 51789226.68307851, - "Ex": 2.90874251210462e+20, - "Ey": 2.908934769466038e+20, - "Ez": 1.70819200999153e+17, - "rho_beam1": 7.969271809437626e+16, - "rho_beam2": 7.969216746820773e+16, - "rho_ele": 0.0, - "rho_ele_nlbw1": 299758753127495.56, - "rho_ele_nlbw2": 289860995480960.4, - "rho_pos": 613963689581.3057, - "rho_pos_nlbw1": 287891375746148.75, - "rho_pos_nlbw2": 295214367940598.1 + "Bx": 971135657171.612, + "By": 971078812454.5405, + "Bz": 20140193.235893946, + "Ex": 2.9111756162943966e+20, + "Ey": 2.9113725115697712e+20, + "Ez": 1.0213536367191107e+17, + "rho_beam1": 7.970337929028706e+16, + "rho_beam2": 7.969213804851568e+16, + "rho_ele1": 343600677331163.7, + "rho_ele2": 302746939366837.25, + "rho_pos1": 333855946230626.06, + "rho_pos2": 310879461124837.44 }, "beam1": { - "particle_opticalDepthQSR": 104868.583557123, - "particle_position_x": 0.0015001423941487055, - "particle_position_y": 0.001500178877546805, - "particle_position_z": 0.004965525054740317, - "particle_momentum_x": 6.20719343794678e-15, - "particle_momentum_y": 6.1639864036830354e-15, - "particle_momentum_z": 6.807872002761295e-12, - "particle_weight": 635864683.4991333 + "particle_opticalDepthQSR": 104909.59461909423, + "particle_position_x": 0.001500222221634118, + "particle_position_y": 0.0015002445303035634, + "particle_position_z": 0.0049656251227976015, + "particle_momentum_x": 6.205341799808723e-15, + "particle_momentum_y": 6.1592257603817594e-15, + "particle_momentum_z": 6.806886719670214e-12, + "particle_weight": 635949610.5135971 }, "beam2": { - "particle_opticalDepthQSR": 104166.96636860794, - "particle_position_x": 0.001500093343835549, - "particle_position_y": 0.0015001802698114421, - "particle_position_z": 0.00496555337137147, - "particle_momentum_x": 6.1976310171196696e-15, - "particle_momentum_y": 6.1844493116189144e-15, - "particle_momentum_z": 6.796731846337045e-12, - "particle_weight": 635863931.615053 + "particle_opticalDepthQSR": 104164.848014815, + "particle_position_x": 0.0015001011957527532, + "particle_position_y": 0.001500139975740741, + "particle_position_z": 0.004965479176845744, + "particle_momentum_x": 6.200690794877584e-15, + "particle_momentum_y": 6.186048913459861e-15, + "particle_momentum_z": 6.7990490255176515e-12, + "particle_weight": 635863144.251134 }, - "ele": { - "particle_opticalDepthQSR": 0.0, - "particle_position_x": 0.0, - "particle_position_y": 0.0, - "particle_position_z": 0.0, - "particle_momentum_x": 0.0, - "particle_momentum_y": 0.0, - "particle_momentum_z": 0.0, - "particle_weight": 0.0 + "ele1": { + "particle_opticalDepthQSR": 435.73003117907257, + "particle_position_x": 4.882183530045367e-06, + "particle_position_y": 4.841391483672882e-06, + "particle_position_z": 1.8449175055560687e-05, + "particle_momentum_x": 5.6656608489971696e-18, + "particle_momentum_y": 5.724425295258085e-18, + "particle_momentum_z": 2.6277553331470036e-15, + "particle_weight": 2696555.9200674472 }, - "ele_nlbw1": { - "particle_opticalDepthQSR": 405.16545575146574, - "particle_position_x": 5.119886480641899e-06, - "particle_position_y": 5.266875857997872e-06, - "particle_position_z": 1.855770689791573e-05, - "particle_momentum_x": 5.744620543080891e-18, - "particle_momentum_y": 5.463133845399354e-18, - "particle_momentum_z": 2.562592228511742e-15, - "particle_weight": 2359597.3527386785 - }, - "ele_nlbw2": { - "particle_opticalDepthQSR": 354.8472581769572, - "particle_position_x": 5.235909912617143e-06, - "particle_position_y": 5.068613695636293e-06, - "particle_position_z": 1.6665840940849017e-05, - "particle_momentum_x": 4.47916023711595e-18, - "particle_momentum_y": 4.092494634513803e-18, - "particle_momentum_z": 2.2277004588526963e-15, - "particle_weight": 2354612.144268994 - }, - "pho": { - "particle_opticalDepthBW": 462.76829758918615, - "particle_position_x": 6.163512168886876e-06, - "particle_position_y": 5.4614856451855956e-06, - "particle_position_z": 2.0316590334121627e-05, - "particle_momentum_x": 0.0, - "particle_momentum_y": 0.0, - "particle_momentum_z": 0.0, - "particle_weight": 2923343.7532989895 + "ele2": { + "particle_opticalDepthQSR": 340.82229684726735, + "particle_position_x": 5.233059654483856e-06, + "particle_position_y": 4.781569085220371e-06, + "particle_position_z": 1.6293559425324337e-05, + "particle_momentum_x": 4.802611971470525e-18, + "particle_momentum_y": 4.3556825243407754e-18, + "particle_momentum_z": 2.41587659230925e-15, + "particle_weight": 2481137.860727036 }, "pho1": { - "particle_opticalDepthBW": 9769.560457892825, - "particle_position_x": 0.00013930069652083352, - "particle_position_y": 0.00014046343589264903, - "particle_position_z": 0.00046498427057467117, + "particle_opticalDepthBW": 9894.64959724129, + "particle_position_x": 0.00014191369823397644, + "particle_position_y": 0.00014347545392717968, + "particle_position_z": 0.00047442826029322116, "particle_momentum_x": 0.0, "particle_momentum_y": 0.0, "particle_momentum_z": 0.0, - "particle_weight": 59881947.934441805 + "particle_weight": 61063948.68610941 }, "pho2": { - "particle_opticalDepthBW": 9986.841892753177, - "particle_position_x": 0.000143478808886347, - "particle_position_y": 0.00014235781306129165, - "particle_position_z": 0.0004760406640177353, + "particle_opticalDepthBW": 10292.1955840901, + "particle_position_x": 0.00014731892710321073, + "particle_position_y": 0.00014515617182809124, + "particle_position_z": 0.00048756513452074315, "particle_momentum_x": 0.0, "particle_momentum_y": 0.0, "particle_momentum_z": 0.0, - "particle_weight": 60412035.77539255 - }, - "pos": { - "particle_opticalDepthQSR": 1.0913353138611541, - "particle_position_x": 1.297022467502343e-08, - "particle_position_y": 6.533761995664651e-09, - "particle_position_z": 5.270388297177834e-08, - "particle_momentum_x": 9.474214808949084e-21, - "particle_momentum_y": 3.664691658234474e-21, - "particle_momentum_z": 5.559027877774493e-20, - "particle_weight": 4777.4993625771185 + "particle_weight": 62299636.622087024 }, - "pos_nlbw1": { - "particle_opticalDepthQSR": 353.1921715878159, - "particle_position_x": 5.413239275792192e-06, - "particle_position_y": 5.599083716468022e-06, - "particle_position_z": 1.729829030925741e-05, - "particle_momentum_x": 5.130129014453181e-18, - "particle_momentum_y": 5.151236001734455e-18, - "particle_momentum_z": 2.7592435303859743e-15, - "particle_weight": 2298018.034763882 + "pos1": { + "particle_opticalDepthQSR": 387.7441392212553, + "particle_position_x": 5.1462880118803425e-06, + "particle_position_y": 5.2613832293016684e-06, + "particle_position_z": 1.7054223425917483e-05, + "particle_momentum_x": 4.6437665862693495e-18, + "particle_momentum_y": 4.761862836969051e-18, + "particle_momentum_z": 2.3776996599289627e-15, + "particle_weight": 2625121.7841375084 }, - "pos_nlbw2": { - "particle_opticalDepthQSR": 350.113008933412, - "particle_position_x": 4.925666132330728e-06, - "particle_position_y": 4.677928261139806e-06, - "particle_position_z": 1.7528432992559524e-05, - "particle_momentum_x": 5.3410973872204896e-18, - "particle_momentum_y": 5.0088980554153576e-18, - "particle_momentum_z": 2.4803849492900593e-15, - "particle_weight": 2379194.375363683 + "pos2": { + "particle_opticalDepthQSR": 361.943365907597, + "particle_position_x": 4.969019565031149e-06, + "particle_position_y": 4.361394970806125e-06, + "particle_position_z": 1.7413304358612675e-05, + "particle_momentum_x": 5.6348322786528905e-18, + "particle_momentum_y": 4.8171439953214205e-18, + "particle_momentum_z": 2.1937254860708963e-15, + "particle_weight": 2529794.7740602638 } } diff --git a/Regression/Checksum/benchmarks_json/LaserAccelerationBoost.json b/Regression/Checksum/benchmarks_json/LaserAccelerationBoost.json index 94e243f21a2..0efcdaeca3c 100644 --- a/Regression/Checksum/benchmarks_json/LaserAccelerationBoost.json +++ b/Regression/Checksum/benchmarks_json/LaserAccelerationBoost.json @@ -1,38 +1,38 @@ { "lev=0": { - "Bx": 4818955.485214876, - "By": 1752.8017794063862, - "Bz": 14516.212849468406, - "Ex": 2366115511749.6064, - "Ey": 1446112026972328.0, - "Ez": 21864189477873.78, - "jx": 1996366361598696.5, - "jy": 5.312583836700398e+16, - "jz": 2.0491352591140016e+16, - "rho": 68443961.6079968 + "Bx": 4818955.480792835, + "By": 1752.8025402207227, + "Bz": 14516.21278267981, + "Ex": 2366115496505.249, + "Ey": 1446112025634143.0, + "Ez": 21864189507353.19, + "jx": 1996366349839211.5, + "jy": 5.312583827165288e+16, + "jz": 2.049135262445976e+16, + "rho": 68443961.71835628 }, "electrons": { - "particle_momentum_x": 2.2135944672847805e-23, - "particle_momentum_y": 2.82245592458273e-22, - "particle_momentum_z": 5.260626007649988e-22, - "particle_position_x": 0.010800577787630073, - "particle_position_y": 0.21115060628317733, + "particle_momentum_x": 2.2135945391227107e-23, + "particle_momentum_y": 2.8224559499572622e-22, + "particle_momentum_z": 5.260626010211241e-22, + "particle_position_x": 0.010800577787628053, + "particle_position_y": 0.2111506062831815, "particle_weight": 4.121554826246186e+16 }, "ions": { - "particle_momentum_x": 6.24847236820344e-23, - "particle_momentum_y": 4.449097670697282e-22, - "particle_momentum_z": 5.768168724446374e-22, - "particle_position_x": 0.010800001678510515, - "particle_position_y": 0.21114947608115428, + "particle_momentum_x": 6.248472277235318e-23, + "particle_momentum_y": 4.449097689427615e-22, + "particle_momentum_z": 5.768168724780326e-22, + "particle_position_x": 0.010800001678510512, + "particle_position_y": 0.21114947608115425, "particle_weight": 4.121554826246186e+16 }, "beam": { - "particle_momentum_x": 3.5357352601344873e-19, - "particle_momentum_y": 4.363147101327531e-19, - "particle_momentum_z": 5.658494028187168e-17, - "particle_position_x": 0.008314957057032625, - "particle_position_y": 1.1704335719922687, + "particle_momentum_x": 3.535745635169933e-19, + "particle_momentum_y": 4.363391839372122e-19, + "particle_momentum_z": 5.658606416951657e-17, + "particle_position_x": 0.008314723025211447, + "particle_position_y": 1.1704335743854242, "particle_weight": 62415090744.60765 } -} \ No newline at end of file +} diff --git a/Regression/Checksum/benchmarks_json/Python_dsmc_1d.json b/Regression/Checksum/benchmarks_json/Python_dsmc_1d.json index 4d30f741bfb..0b38f78e6f9 100644 --- a/Regression/Checksum/benchmarks_json/Python_dsmc_1d.json +++ b/Regression/Checksum/benchmarks_json/Python_dsmc_1d.json @@ -1,27 +1,27 @@ { "lev=0": { - "rho_electrons": 0.004436602398896733, - "rho_he_ions": 0.0052003262664415285 + "rho_electrons": 0.00443743609125863, + "rho_he_ions": 0.005198801518328451 + }, + "neutrals": { + "particle_momentum_x": 1.404700281648976e-19, + "particle_momentum_y": 1.4028127127618884e-19, + "particle_momentum_z": 1.4090901433394346e-19, + "particle_position_x": 1120.7727446759352, + "particle_weight": 6.4588e+19 }, "he_ions": { - "particle_momentum_x": 2.7735512966774165e-19, - "particle_momentum_y": 2.7574111491186894e-19, - "particle_momentum_z": 3.620520352986572e-19, - "particle_position_x": 2201.236370518716, - "particle_weight": 17190734375000.002 + "particle_momentum_x": 2.770386771117138e-19, + "particle_momentum_y": 2.7568040242914223e-19, + "particle_momentum_z": 3.619756966185903e-19, + "particle_position_x": 2200.683185473434, + "particle_weight": 17185500000000.002 }, "electrons": { - "particle_momentum_x": 3.50212700099208e-20, - "particle_momentum_y": 3.5368926859820716e-20, - "particle_momentum_z": 1.2588108956625115e-19, - "particle_position_x": 2139.6498177543617, - "particle_weight": 14582968750000.002 - }, - "neutrals": { - "particle_momentum_x": 1.405588503355727e-19, - "particle_momentum_y": 1.408077689882847e-19, - "particle_momentum_z": 1.4024616940779626e-19, - "particle_position_x": 1121.2330379095083, - "particle_weight": 6.4588e+19 + "particle_momentum_x": 3.5129762363657864e-20, + "particle_momentum_y": 3.5431134517510143e-20, + "particle_momentum_z": 1.2592093336142964e-19, + "particle_position_x": 2142.0662480700303, + "particle_weight": 14593699218750.002 } -} \ No newline at end of file +} diff --git a/Regression/Checksum/benchmarks_json/comoving_2d_psatd_hybrid.json b/Regression/Checksum/benchmarks_json/comoving_2d_psatd_hybrid.json index c8571869cd5..8b03899369b 100644 --- a/Regression/Checksum/benchmarks_json/comoving_2d_psatd_hybrid.json +++ b/Regression/Checksum/benchmarks_json/comoving_2d_psatd_hybrid.json @@ -1,38 +1,38 @@ { "lev=0": { - "Bx": 1118808.3734374465, - "By": 3248957.1122179274, - "Bz": 280612.78289064515, - "Ex": 975532732112639.6, - "Ey": 402861836732114.4, - "Ez": 159049610399317.66, - "jx": 2.9997053130250828e+16, - "jy": 8.866654890775573e+16, - "jz": 3.163974708948631e+17, - "rho": 1059977729.0184418 + "Bx": 1118808.3686978193, + "By": 3248970.5506422943, + "Bz": 280612.7921641442, + "Ex": 975536649649286.1, + "Ey": 402861835403418.1, + "Ez": 159049265640492.28, + "jx": 2.9996888133195436e+16, + "jy": 8.866654944519546e+16, + "jz": 3.164008885453435e+17, + "rho": 1059988299.6088305 }, "ions": { - "particle_momentum_x": 1.6150569180478943e-18, - "particle_momentum_y": 2.2334266828401142e-18, - "particle_momentum_z": 4.2792495306800117e-13, - "particle_position_x": 1.4883816864865955, - "particle_position_y": 16.45238650413084, + "particle_momentum_x": 1.6150513873065298e-18, + "particle_momentum_y": 2.233426695677123e-18, + "particle_momentum_z": 4.279249529993671e-13, + "particle_position_x": 1.4883816864183497, + "particle_position_y": 16.452386504127254, "particle_weight": 1.234867369440658e+18 }, "electrons": { - "particle_momentum_x": 7.05821754019506e-19, - "particle_momentum_y": 2.2042393263043917e-18, - "particle_momentum_z": 2.5305214316289944e-16, - "particle_position_x": 1.5006580331362074, - "particle_position_y": 16.45438830674347, + "particle_momentum_x": 7.058167362825288e-19, + "particle_momentum_y": 2.204239326446281e-18, + "particle_momentum_z": 2.530521998715408e-16, + "particle_position_x": 1.5006581263609764, + "particle_position_y": 16.454388313398017, "particle_weight": 1.234867020725368e+18 }, "beam": { - "particle_momentum_x": 6.874634694077579e-19, - "particle_momentum_y": 4.374677735660533e-19, - "particle_momentum_z": 6.432600800266472e-18, - "particle_position_x": 0.0012933700124436584, - "particle_position_y": 0.358720803656086, + "particle_momentum_x": 6.869222298759882e-19, + "particle_momentum_y": 4.374719809060106e-19, + "particle_momentum_z": 6.4523206583503136e-18, + "particle_position_x": 0.001290816359726098, + "particle_position_y": 0.3586691102823157, "particle_weight": 3120754537230.3823 } } \ No newline at end of file diff --git a/Regression/Checksum/benchmarks_json/galilean_2d_psatd_hybrid.json b/Regression/Checksum/benchmarks_json/galilean_2d_psatd_hybrid.json index 03cf06b3158..dd56f8170a9 100644 --- a/Regression/Checksum/benchmarks_json/galilean_2d_psatd_hybrid.json +++ b/Regression/Checksum/benchmarks_json/galilean_2d_psatd_hybrid.json @@ -1,38 +1,38 @@ { "lev=0": { - "Bx": 1086729.9983020213, - "By": 2886537.292820136, - "Bz": 264259.5410465989, - "Ex": 867382749986595.4, - "Ey": 392666737316432.8, - "Ez": 146897959667920.22, - "jx": 2.7028854305928356e+16, - "jy": 8.615938520657634e+16, - "jz": 2.7328721771319978e+17, - "rho": 915931445.5917195 - }, - "electrons": { - "particle_momentum_x": 6.2409905560361695e-19, - "particle_momentum_y": 1.5790611507526441e-18, - "particle_momentum_z": 2.506435264953701e-16, - "particle_position_x": 1.5014136629221837, - "particle_position_y": 16.52378170697116, - "particle_weight": 1.2372401466086835e+18 + "Bx": 1086729.9718613266, + "By": 2886554.482275311, + "Bz": 264259.55093734514, + "Ex": 867387781289915.2, + "Ey": 392666724461952.5, + "Ez": 146897592531660.03, + "jx": 2.702866174672266e+16, + "jy": 8.615938361747776e+16, + "jz": 2.7329155817806224e+17, + "rho": 915945723.7934376 }, "ions": { - "particle_momentum_x": 1.4394967936107095e-18, - "particle_momentum_y": 1.5967629122067375e-18, - "particle_momentum_z": 4.287340658682592e-13, - "particle_position_x": 1.4911814217840271, - "particle_position_y": 16.521964978774346, + "particle_momentum_x": 1.4394902513923003e-18, + "particle_momentum_y": 1.5967629157922875e-18, + "particle_momentum_z": 4.287340658051679e-13, + "particle_position_x": 1.4911814217142487, + "particle_position_y": 16.521964978771, "particle_weight": 1.2372405194129536e+18 }, + "electrons": { + "particle_momentum_x": 6.240933687389075e-19, + "particle_momentum_y": 1.5790611427694247e-18, + "particle_momentum_z": 2.5064357834741096e-16, + "particle_position_x": 1.501413766926399, + "particle_position_y": 16.523781713952324, + "particle_weight": 1.2372401466086835e+18 + }, "beam": { - "particle_momentum_x": 7.0050974522936195e-19, - "particle_momentum_y": 4.374915691594075e-19, - "particle_momentum_z": 6.1754662837862646e-18, - "particle_position_x": 0.0016025830388130494, - "particle_position_y": 0.35897909980539305, + "particle_momentum_x": 7.000932845220306e-19, + "particle_momentum_y": 4.374936866729326e-19, + "particle_momentum_z": 6.194468548032543e-18, + "particle_position_x": 0.0016030835496557787, + "particle_position_y": 0.3589262705964349, "particle_weight": 3120754537230.3823 } } \ No newline at end of file diff --git a/Regression/WarpX-GPU-tests.ini b/Regression/WarpX-GPU-tests.ini index 0566184848b..68620e45b62 100644 --- a/Regression/WarpX-GPU-tests.ini +++ b/Regression/WarpX-GPU-tests.ini @@ -60,7 +60,7 @@ emailBody = Check https://ccse.lbl.gov/pub/GpuRegressionTesting/WarpX/ for more [AMReX] dir = /home/regtester/git/amrex/ -branch = 75571e2dcbf2417529c5ed8e24113580e8e1f3f1 +branch = 24.01 [source] dir = /home/regtester/git/WarpX diff --git a/Regression/WarpX-tests.ini b/Regression/WarpX-tests.ini index 974615ad725..da4da53e6a4 100644 --- a/Regression/WarpX-tests.ini +++ b/Regression/WarpX-tests.ini @@ -59,7 +59,7 @@ emailBody = Check https://ccse.lbl.gov/pub/RegressionTesting/WarpX/ for more det [AMReX] dir = /home/regtester/AMReX_RegTesting/amrex/ -branch = 75571e2dcbf2417529c5ed8e24113580e8e1f3f1 +branch = 24.01 [source] dir = /home/regtester/AMReX_RegTesting/warpx @@ -2214,11 +2214,12 @@ analysisRoutine = Examples/Tests/resampling/analysis_leveling_thinning.py [LoadExternalFieldRZ] buildDir = . inputFile = Examples/Tests/LoadExternalField/inputs_rz -runtime_params = warpx.abort_on_warning_threshold=medium +runtime_params = warpx.abort_on_warning_threshold=medium chk.file_prefix=LoadExternalFieldRZ_chk chk.file_min_digits=5 dim = 2 addToCompileString = USE_RZ=TRUE cmakeSetupOpts = -DWarpX_DIMS=RZ -DWarpX_OPENPMD=ON -restartTest = 0 +restartTest = 1 +restartFileNum = 150 useMPI = 1 numprocs = 1 useOMP = 1 diff --git a/Source/AcceleratorLattice/AcceleratorLattice.cpp b/Source/AcceleratorLattice/AcceleratorLattice.cpp index e05167c261d..8dc0983d622 100644 --- a/Source/AcceleratorLattice/AcceleratorLattice.cpp +++ b/Source/AcceleratorLattice/AcceleratorLattice.cpp @@ -88,8 +88,9 @@ AcceleratorLattice::InitElementFinder (int const lev, amrex::BoxArray const & ba } void -AcceleratorLattice::UpdateElementFinder (int const lev) -{ +AcceleratorLattice::UpdateElementFinder (int const lev) // NOLINT(readability-make-member-function-const) +{ // Techniquely clang-tidy is correct because + // m_element_finder is unique_ptr, not const*. if (m_lattice_defined) { for (amrex::MFIter mfi(*m_element_finder); mfi.isValid(); ++mfi) { diff --git a/Source/AcceleratorLattice/LatticeElementFinder.H b/Source/AcceleratorLattice/LatticeElementFinder.H index b7ca556d9ee..6773ed56a65 100644 --- a/Source/AcceleratorLattice/LatticeElementFinder.H +++ b/Source/AcceleratorLattice/LatticeElementFinder.H @@ -72,8 +72,8 @@ struct LatticeElementFinder * @param[in] a_offset particle index offset needed to access particle info * @param[in] accelerator_lattice a reference to the accelerator lattice at the refinement level */ - LatticeElementFinderDevice GetFinderDeviceInstance (WarpXParIter const& a_pti, int a_offset, - AcceleratorLattice const& accelerator_lattice); + [[nodiscard]] LatticeElementFinderDevice GetFinderDeviceInstance ( + WarpXParIter const& a_pti, int a_offset, AcceleratorLattice const& accelerator_lattice) const; /* The index lookup tables for each lattice element type */ amrex::Gpu::DeviceVector d_quad_indices; @@ -89,7 +89,7 @@ struct LatticeElementFinder */ void setup_lattice_indices (amrex::Gpu::DeviceVector const & zs, amrex::Gpu::DeviceVector const & ze, - amrex::Gpu::DeviceVector & indices); + amrex::Gpu::DeviceVector & indices) const; }; /** diff --git a/Source/AcceleratorLattice/LatticeElementFinder.cpp b/Source/AcceleratorLattice/LatticeElementFinder.cpp index bb2fe9c34a5..ba2e51715fb 100644 --- a/Source/AcceleratorLattice/LatticeElementFinder.cpp +++ b/Source/AcceleratorLattice/LatticeElementFinder.cpp @@ -78,7 +78,7 @@ LatticeElementFinder::UpdateIndices (int const lev, amrex::MFIter const& a_mfi, LatticeElementFinderDevice LatticeElementFinder::GetFinderDeviceInstance (WarpXParIter const& a_pti, int const a_offset, - AcceleratorLattice const& accelerator_lattice) + AcceleratorLattice const& accelerator_lattice) const { LatticeElementFinderDevice result; result.InitLatticeElementFinderDevice(a_pti, a_offset, accelerator_lattice, *this); @@ -124,7 +124,7 @@ LatticeElementFinderDevice::InitLatticeElementFinderDevice (WarpXParIter const& void LatticeElementFinder::setup_lattice_indices (amrex::Gpu::DeviceVector const & zs, amrex::Gpu::DeviceVector const & ze, - amrex::Gpu::DeviceVector & indices) + amrex::Gpu::DeviceVector & indices) const { using namespace amrex::literals; diff --git a/Source/BoundaryConditions/WarpXFieldBoundaries.cpp b/Source/BoundaryConditions/WarpXFieldBoundaries.cpp index 0864c00067b..af7a385b729 100644 --- a/Source/BoundaryConditions/WarpXFieldBoundaries.cpp +++ b/Source/BoundaryConditions/WarpXFieldBoundaries.cpp @@ -119,7 +119,7 @@ void WarpX::ApplyJfieldBoundary (const int lev, amrex::MultiFab* Jx, #ifdef WARPX_DIM_RZ // Applies the boundary conditions that are specific to the axis when in RZ. void -WarpX::ApplyFieldBoundaryOnAxis (amrex::MultiFab* Er, amrex::MultiFab* Et, amrex::MultiFab* Ez, int lev) +WarpX::ApplyFieldBoundaryOnAxis (amrex::MultiFab* Er, amrex::MultiFab* Et, amrex::MultiFab* Ez, int lev) const { const amrex::IntVect ngE = get_ng_fieldgather(); diff --git a/Source/Diagnostics/BTD_Plotfile_Header_Impl.H b/Source/Diagnostics/BTD_Plotfile_Header_Impl.H index 209113dedeb..b87c54be9f0 100644 --- a/Source/Diagnostics/BTD_Plotfile_Header_Impl.H +++ b/Source/Diagnostics/BTD_Plotfile_Header_Impl.H @@ -171,11 +171,11 @@ class BTDMultiFabHeaderImpl void WriteMultiFabHeader (); /** Returns size, m_ba_size, of the Box Array, m_ba.*/ - int ba_size () {return m_ba_size;} + [[nodiscard]] int ba_size () const {return m_ba_size;} /** Returns box corresponding to the ith box in the BoxArray, m_ba. * \param[in] ibox index of the box in the BoxArray. */ - amrex::Box ba_box (int ibox) {return m_ba[ibox]; } + [[nodiscard]] amrex::Box ba_box (int ibox) const {return m_ba[ibox]; } /** Returns prefix of the ith-fab on disk, i.e., ith fab of the MultiFab data. * \param[in] ifab index of the ith fab in the MultiFab data. */ @@ -316,9 +316,9 @@ public: /** Reads the particle header file at m_Header_path and stores its data*/ void ReadHeader (); /** Writes the meta-data of particle box array in header file, with path, m_Header_path*/ - void WriteHeader (); + void WriteHeader () const; /** Returns the size of the box array, m_ba_size */ - int ba_size () {return m_ba_size; } + [[nodiscard]] int ba_size () const {return m_ba_size; } /** Increases Box array size, m_ba_size, by add_size * \param[in] add_size */ @@ -326,7 +326,7 @@ public: /** Returns box corresponding to the ith box in the BoxArray, m_ba. * \param[in] ibox index of the box in the BoxArray. */ - amrex::Box ba_box (int ibox) {return m_ba[ibox]; } + [[nodiscard]] amrex::Box ba_box (int ibox) const {return m_ba[ibox]; } /** Resize boxArray, m_ba, to size, m_ba_size. */ void ResizeBoxArray () { m_ba.resize(m_ba_size); } /** Set Box indices of the ith-box in Box Array, m_ba, to the new Box, ba_box. diff --git a/Source/Diagnostics/BTD_Plotfile_Header_Impl.cpp b/Source/Diagnostics/BTD_Plotfile_Header_Impl.cpp index 8486a487f40..da4a3a79547 100644 --- a/Source/Diagnostics/BTD_Plotfile_Header_Impl.cpp +++ b/Source/Diagnostics/BTD_Plotfile_Header_Impl.cpp @@ -516,7 +516,7 @@ BTDParticleDataHeaderImpl::ReadHeader () } void -BTDParticleDataHeaderImpl::WriteHeader () +BTDParticleDataHeaderImpl::WriteHeader () const { if (amrex::FileExists(m_Header_path)) { amrex::FileSystem::Remove(m_Header_path); diff --git a/Source/Diagnostics/BTDiagnostics.H b/Source/Diagnostics/BTDiagnostics.H index 8940a89711a..ab894da69c2 100644 --- a/Source/Diagnostics/BTDiagnostics.H +++ b/Source/Diagnostics/BTDiagnostics.H @@ -275,7 +275,7 @@ private: * \param[in] t_lab lab-frame time of the snapshot * \param[in] t_boost boosted-frame time at level, lev */ - amrex::Real UpdateCurrentZBoostCoordinate(amrex::Real t_lab, amrex::Real t_boost) + [[nodiscard]] amrex::Real UpdateCurrentZBoostCoordinate(amrex::Real t_lab, amrex::Real t_boost) const { const amrex::Real current_z_boost = (t_lab / m_gamma_boost - t_boost) * PhysConst::c / m_beta_boost; return current_z_boost; @@ -284,7 +284,7 @@ private: * \param[in] t_lab lab-frame time of the snapshot * \param[in] t_boost boosted-frame time at level, lev */ - amrex::Real UpdateCurrentZLabCoordinate(amrex::Real t_lab, amrex::Real t_boost) + [[nodiscard]] amrex::Real UpdateCurrentZLabCoordinate(amrex::Real t_lab, amrex::Real t_boost) const { const amrex::Real current_z_lab = (t_lab - t_boost / m_gamma_boost ) * PhysConst::c / m_beta_boost; return current_z_lab; @@ -294,13 +294,13 @@ private: * \param[in] ref_ratio refinement ratio in the z-direction at level, lev-1. * The ref-ratio in the z-direction for single-level diagnostics is 1. */ - amrex::Real dz_lab (amrex::Real dt, amrex::Real ref_ratio); + [[nodiscard]] amrex::Real dz_lab (amrex::Real dt, amrex::Real ref_ratio) const; /** Compute k-index corresponding to current lab-frame z co-ordinate (m_current_z_lab) * for the ith buffer i_buffer, and at level, lev. * \param[in] i_buffer snapshot index * \param[in] lev mesh-refinement level at which the lab-frame z-index is computed */ - int k_index_zlab (int i_buffer, int lev); + [[nodiscard]] int k_index_zlab (int i_buffer, int lev) const; /** whether field buffer is full * \param[in] i_buffer buffer id for which the buffer size is checked. * returns bool = true is buffer is full, that is, diff --git a/Source/Diagnostics/BTDiagnostics.cpp b/Source/Diagnostics/BTDiagnostics.cpp index 604bc4d39f2..8958d85bfdf 100644 --- a/Source/Diagnostics/BTDiagnostics.cpp +++ b/Source/Diagnostics/BTDiagnostics.cpp @@ -863,13 +863,14 @@ BTDiagnostics::PrepareFieldDataForOutput () amrex::Real -BTDiagnostics::dz_lab (amrex::Real dt, amrex::Real ref_ratio){ +BTDiagnostics::dz_lab (amrex::Real dt, amrex::Real ref_ratio) const +{ return PhysConst::c * dt * 1._rt/m_beta_boost * 1._rt/m_gamma_boost * 1._rt/ref_ratio; } int -BTDiagnostics::k_index_zlab (int i_buffer, int lev) +BTDiagnostics::k_index_zlab (int i_buffer, int lev) const { auto & warpx = WarpX::GetInstance(); const amrex::Real prob_domain_zmin_lab = m_snapshot_domain_lab[i_buffer].lo( m_moving_window_dir ); diff --git a/Source/Diagnostics/Diagnostics.H b/Source/Diagnostics/Diagnostics.H index c2cfc79c9c0..48d63c01ff2 100644 --- a/Source/Diagnostics/Diagnostics.H +++ b/Source/Diagnostics/Diagnostics.H @@ -114,7 +114,7 @@ public: /** Whether the last timestep is always dumped */ [[nodiscard]] bool DoDumpLastTimestep () const {return m_dump_last_timestep;} /** Returns the number of snapshots used in BTD. For Full-Diagnostics, the value is 1*/ - int getnumbuffers() {return m_num_buffers;} + [[nodiscard]] int getnumbuffers() const {return m_num_buffers;} /** Time in lab-frame associated with the ith snapshot * \param[in] i_buffer index of the buffer */ diff --git a/Source/Diagnostics/MultiDiagnostics.H b/Source/Diagnostics/MultiDiagnostics.H index 5da69731fe1..5101f3e00b2 100644 --- a/Source/Diagnostics/MultiDiagnostics.H +++ b/Source/Diagnostics/MultiDiagnostics.H @@ -38,7 +38,7 @@ public: /** Start a new iteration, i.e., dump has not been done yet. */ void NewIteration (); Diagnostics& GetDiag(int idiag) {return *alldiags[idiag]; } - int GetTotalDiags() {return ndiags;} + [[nodiscard]] int GetTotalDiags() const {return ndiags;} DiagTypes diagstypes(int idiag) {return diags_types[idiag];} private: /** Vector of pointers to all diagnostics */ diff --git a/Source/Diagnostics/ReducedDiags/ReducedDiags.H b/Source/Diagnostics/ReducedDiags/ReducedDiags.H index 01847a1ff12..09aa85586be 100644 --- a/Source/Diagnostics/ReducedDiags/ReducedDiags.H +++ b/Source/Diagnostics/ReducedDiags/ReducedDiags.H @@ -94,7 +94,7 @@ public: * This function queries deprecated input parameters and aborts * the run if one of them is specified. */ - void BackwardCompatibility (); + void BackwardCompatibility () const; }; diff --git a/Source/Diagnostics/ReducedDiags/ReducedDiags.cpp b/Source/Diagnostics/ReducedDiags/ReducedDiags.cpp index b4f617a8520..ae6dae25a71 100644 --- a/Source/Diagnostics/ReducedDiags/ReducedDiags.cpp +++ b/Source/Diagnostics/ReducedDiags/ReducedDiags.cpp @@ -86,7 +86,7 @@ void ReducedDiags::LoadBalance () // load balancing operations } -void ReducedDiags::BackwardCompatibility () +void ReducedDiags::BackwardCompatibility () const { const amrex::ParmParse pp_rd_name(m_rd_name); std::vector backward_strings; diff --git a/Source/Diagnostics/WarpXOpenPMD.H b/Source/Diagnostics/WarpXOpenPMD.H index bf83c1ebb0b..e3b7b893d0a 100644 --- a/Source/Diagnostics/WarpXOpenPMD.H +++ b/Source/Diagnostics/WarpXOpenPMD.H @@ -44,7 +44,7 @@ public: using ParticleIter = typename amrex::ParIter<0, 0, PIdx::nattribs, 0, amrex::PinnedArenaAllocator>; WarpXParticleCounter (ParticleContainer* pc); - unsigned long GetTotalNumParticles () {return m_Total;} + [[nodiscard]] unsigned long GetTotalNumParticles () const {return m_Total;} std::vector m_ParticleOffsetAtRank; std::vector m_ParticleSizeAtRank; diff --git a/Source/FieldSolver/FiniteDifferenceSolver/HybridPICModel/HybridPICModel.H b/Source/FieldSolver/FiniteDifferenceSolver/HybridPICModel/HybridPICModel.H index c7ea9b46458..750a5e06933 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/HybridPICModel/HybridPICModel.H +++ b/Source/FieldSolver/FiniteDifferenceSolver/HybridPICModel/HybridPICModel.H @@ -126,7 +126,7 @@ public: */ void FillElectronPressureMF ( std::unique_ptr const& Pe_field, - amrex::MultiFab* const& rho_field ); + amrex::MultiFab* const& rho_field ) const; // Declare variables to hold hybrid-PIC model parameters /** Number of substeps to take when evolving B */ diff --git a/Source/FieldSolver/FiniteDifferenceSolver/HybridPICModel/HybridPICModel.cpp b/Source/FieldSolver/FiniteDifferenceSolver/HybridPICModel/HybridPICModel.cpp index 5a6f0018b2a..2cc6a8ec437 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/HybridPICModel/HybridPICModel.cpp +++ b/Source/FieldSolver/FiniteDifferenceSolver/HybridPICModel/HybridPICModel.cpp @@ -508,7 +508,7 @@ void HybridPICModel::CalculateElectronPressure(const int lev, DtType a_dt_type) void HybridPICModel::FillElectronPressureMF ( std::unique_ptr const& Pe_field, - amrex::MultiFab* const& rho_field ) + amrex::MultiFab* const& rho_field ) const { const auto n0_ref = m_n0_ref; const auto elec_temp = m_elec_temp; diff --git a/Source/Initialization/InjectorMomentum.cpp b/Source/Initialization/InjectorMomentum.cpp index 35513260827..4642d3a0cc6 100644 --- a/Source/Initialization/InjectorMomentum.cpp +++ b/Source/Initialization/InjectorMomentum.cpp @@ -9,7 +9,7 @@ using namespace amrex; -void InjectorMomentum::clear () +void InjectorMomentum::clear () // NOLINT(readability-make-member-function-const) { switch (type) { diff --git a/Source/Initialization/WarpXInitData.cpp b/Source/Initialization/WarpXInitData.cpp index dfefec50bbb..ae81377aa87 100644 --- a/Source/Initialization/WarpXInitData.cpp +++ b/Source/Initialization/WarpXInitData.cpp @@ -728,6 +728,9 @@ void WarpX::PostRestart () { mypc->PostRestart(); + for (int lev = 0; lev <= maxLevel(); ++lev) { + LoadExternalFieldsFromFile(lev); + } } @@ -901,34 +904,7 @@ WarpX::InitLevelData (int lev, Real /*time*/) } } - // Reading external fields from data file - if (m_p_ext_field_params->B_ext_grid_type == ExternalFieldType::read_from_file) { - -#if defined(WARPX_DIM_RZ) - WARPX_ALWAYS_ASSERT_WITH_MESSAGE(n_rz_azimuthal_modes == 1, - "External field reading is not implemented for more than one RZ mode (see #3829)"); - ReadExternalFieldFromFile(m_p_ext_field_params->external_fields_path, Bfield_fp_external[lev][0].get(), "B", "r"); - ReadExternalFieldFromFile(m_p_ext_field_params->external_fields_path, Bfield_fp_external[lev][1].get(), "B", "t"); - ReadExternalFieldFromFile(m_p_ext_field_params->external_fields_path, Bfield_fp_external[lev][2].get(), "B", "z"); -#else - ReadExternalFieldFromFile(m_p_ext_field_params->external_fields_path, Bfield_fp_external[lev][0].get(), "B", "x"); - ReadExternalFieldFromFile(m_p_ext_field_params->external_fields_path, Bfield_fp_external[lev][1].get(), "B", "y"); - ReadExternalFieldFromFile(m_p_ext_field_params->external_fields_path, Bfield_fp_external[lev][2].get(), "B", "z"); -#endif - } - if (m_p_ext_field_params->E_ext_grid_type == ExternalFieldType::read_from_file) { -#if defined(WARPX_DIM_RZ) - WARPX_ALWAYS_ASSERT_WITH_MESSAGE(n_rz_azimuthal_modes == 1, - "External field reading is not implemented for more than one RZ mode (see #3829)"); - ReadExternalFieldFromFile(m_p_ext_field_params->external_fields_path, Efield_fp_external[lev][0].get(), "E", "r"); - ReadExternalFieldFromFile(m_p_ext_field_params->external_fields_path, Efield_fp_external[lev][1].get(), "E", "t"); - ReadExternalFieldFromFile(m_p_ext_field_params->external_fields_path, Efield_fp_external[lev][2].get(), "E", "z"); -#else - ReadExternalFieldFromFile(m_p_ext_field_params->external_fields_path, Efield_fp_external[lev][0].get(), "E", "x"); - ReadExternalFieldFromFile(m_p_ext_field_params->external_fields_path, Efield_fp_external[lev][1].get(), "E", "y"); - ReadExternalFieldFromFile(m_p_ext_field_params->external_fields_path, Efield_fp_external[lev][2].get(), "E", "z"); -#endif - } + LoadExternalFieldsFromFile(lev); if (costs[lev]) { const auto iarr = costs[lev]->IndexArray(); @@ -1324,6 +1300,37 @@ void WarpX::CheckKnownIssues() #endif } +void +WarpX::LoadExternalFieldsFromFile (int const lev) +{ + if (m_p_ext_field_params->B_ext_grid_type == ExternalFieldType::read_from_file) { +#if defined(WARPX_DIM_RZ) + WARPX_ALWAYS_ASSERT_WITH_MESSAGE(n_rz_azimuthal_modes == 1, + "External field reading is not implemented for more than one RZ mode (see #3829)"); + ReadExternalFieldFromFile(m_p_ext_field_params->external_fields_path, Bfield_fp_external[lev][0].get(), "B", "r"); + ReadExternalFieldFromFile(m_p_ext_field_params->external_fields_path, Bfield_fp_external[lev][1].get(), "B", "t"); + ReadExternalFieldFromFile(m_p_ext_field_params->external_fields_path, Bfield_fp_external[lev][2].get(), "B", "z"); +#else + ReadExternalFieldFromFile(m_p_ext_field_params->external_fields_path, Bfield_fp_external[lev][0].get(), "B", "x"); + ReadExternalFieldFromFile(m_p_ext_field_params->external_fields_path, Bfield_fp_external[lev][1].get(), "B", "y"); + ReadExternalFieldFromFile(m_p_ext_field_params->external_fields_path, Bfield_fp_external[lev][2].get(), "B", "z"); +#endif + } + if (m_p_ext_field_params->E_ext_grid_type == ExternalFieldType::read_from_file) { +#if defined(WARPX_DIM_RZ) + WARPX_ALWAYS_ASSERT_WITH_MESSAGE(n_rz_azimuthal_modes == 1, + "External field reading is not implemented for more than one RZ mode (see #3829)"); + ReadExternalFieldFromFile(m_p_ext_field_params->external_fields_path, Efield_fp_external[lev][0].get(), "E", "r"); + ReadExternalFieldFromFile(m_p_ext_field_params->external_fields_path, Efield_fp_external[lev][1].get(), "E", "t"); + ReadExternalFieldFromFile(m_p_ext_field_params->external_fields_path, Efield_fp_external[lev][2].get(), "E", "z"); +#else + ReadExternalFieldFromFile(m_p_ext_field_params->external_fields_path, Efield_fp_external[lev][0].get(), "E", "x"); + ReadExternalFieldFromFile(m_p_ext_field_params->external_fields_path, Efield_fp_external[lev][1].get(), "E", "y"); + ReadExternalFieldFromFile(m_p_ext_field_params->external_fields_path, Efield_fp_external[lev][2].get(), "E", "z"); +#endif + } +} + #if defined(WARPX_USE_OPENPMD) && !defined(WARPX_DIM_1D_Z) && !defined(WARPX_DIM_XZ) void WarpX::ReadExternalFieldFromFile ( diff --git a/Source/Particles/Collision/BackgroundMCC/BackgroundMCCCollision.H b/Source/Particles/Collision/BackgroundMCC/BackgroundMCCCollision.H index 1db3922d178..1de6b999e0b 100644 --- a/Source/Particles/Collision/BackgroundMCC/BackgroundMCCCollision.H +++ b/Source/Particles/Collision/BackgroundMCC/BackgroundMCCCollision.H @@ -32,7 +32,7 @@ public: BackgroundMCCCollision ( BackgroundMCCCollision&& ) = delete; BackgroundMCCCollision& operator= ( BackgroundMCCCollision&& ) = delete; - amrex::ParticleReal get_nu_max (amrex::Vector const& mcc_processes); + [[nodiscard]] amrex::ParticleReal get_nu_max (amrex::Vector const& mcc_processes) const; /** Perform the collisions * diff --git a/Source/Particles/Collision/BackgroundMCC/BackgroundMCCCollision.cpp b/Source/Particles/Collision/BackgroundMCC/BackgroundMCCCollision.cpp index 672c6456ec7..4cb16f6fa50 100644 --- a/Source/Particles/Collision/BackgroundMCC/BackgroundMCCCollision.cpp +++ b/Source/Particles/Collision/BackgroundMCC/BackgroundMCCCollision.cpp @@ -162,7 +162,7 @@ BackgroundMCCCollision::BackgroundMCCCollision (std::string const collision_name * ranges from 1e-4 to 5000 eV in 0.2 eV increments */ amrex::ParticleReal -BackgroundMCCCollision::get_nu_max(amrex::Vector const& mcc_processes) +BackgroundMCCCollision::get_nu_max(amrex::Vector const& mcc_processes) const { using namespace amrex::literals; amrex::ParticleReal nu, nu_max = 0.0; diff --git a/Source/Particles/Collision/CollisionBase.H b/Source/Particles/Collision/CollisionBase.H index 272cc056b1a..db79eaf1a01 100644 --- a/Source/Particles/Collision/CollisionBase.H +++ b/Source/Particles/Collision/CollisionBase.H @@ -29,7 +29,7 @@ public: virtual ~CollisionBase() = default; - int get_ndt() {return m_ndt;} + [[nodiscard]] int get_ndt() const {return m_ndt;} protected: diff --git a/Source/Particles/ElementaryProcess/Ionization.H b/Source/Particles/ElementaryProcess/Ionization.H index 573491645ea..61aeb19aea1 100644 --- a/Source/Particles/ElementaryProcess/Ionization.H +++ b/Source/Particles/ElementaryProcess/Ionization.H @@ -33,9 +33,11 @@ struct IonizationFilterFunc const amrex::Real* AMREX_RESTRICT m_adk_prefactor; const amrex::Real* AMREX_RESTRICT m_adk_exp_prefactor; const amrex::Real* AMREX_RESTRICT m_adk_power; + const amrex::Real* AMREX_RESTRICT m_adk_correction_factors; int comp; int m_atomic_number; + int m_do_adk_correction = 0; GetParticlePosition m_get_position; GetExternalEBField m_get_externalEB; @@ -82,8 +84,10 @@ struct IonizationFilterFunc const amrex::Real* AMREX_RESTRICT a_adk_prefactor, const amrex::Real* AMREX_RESTRICT a_adk_exp_prefactor, const amrex::Real* AMREX_RESTRICT a_adk_power, + const amrex::Real* AMREX_RESTRICT a_adk_correction_factors, int a_comp, int a_atomic_number, + int a_do_adk_correction, int a_offset = 0) noexcept; template @@ -133,9 +137,16 @@ struct IonizationFilterFunc ); // Compute probability of ionization p - const amrex::Real w_dtau = (E <= 0._rt) ? 0._rt : 1._rt/ ga * m_adk_prefactor[ion_lev] * + amrex::Real w_dtau = (E <= 0._rt) ? 0._rt : 1._rt/ ga * m_adk_prefactor[ion_lev] * std::pow(E, m_adk_power[ion_lev]) * std::exp( m_adk_exp_prefactor[ion_lev]/E ); + // if requested, do Zhang's correction of ADK + if (m_do_adk_correction) { + const amrex::Real r = E / m_adk_correction_factors[3]; + w_dtau *= std::exp(m_adk_correction_factors[0]*r*r+m_adk_correction_factors[1]*r+ + m_adk_correction_factors[2]); + } + const amrex::Real p = 1._rt - std::exp( - w_dtau ); const amrex::Real random_draw = amrex::Random(engine); diff --git a/Source/Particles/ElementaryProcess/Ionization.cpp b/Source/Particles/ElementaryProcess/Ionization.cpp index c3681a30cad..b7b91e4d4e3 100644 --- a/Source/Particles/ElementaryProcess/Ionization.cpp +++ b/Source/Particles/ElementaryProcess/Ionization.cpp @@ -30,15 +30,19 @@ IonizationFilterFunc::IonizationFilterFunc (const WarpXParIter& a_pti, int lev, const amrex::Real* const AMREX_RESTRICT a_adk_prefactor, const amrex::Real* const AMREX_RESTRICT a_adk_exp_prefactor, const amrex::Real* const AMREX_RESTRICT a_adk_power, + const amrex::Real* const AMREX_RESTRICT a_adk_correction_factors, int a_comp, int a_atomic_number, + int a_do_adk_correction, int a_offset) noexcept: m_ionization_energies{a_ionization_energies}, m_adk_prefactor{a_adk_prefactor}, m_adk_exp_prefactor{a_adk_exp_prefactor}, m_adk_power{a_adk_power}, + m_adk_correction_factors{a_adk_correction_factors}, comp{a_comp}, m_atomic_number{a_atomic_number}, + m_do_adk_correction{a_do_adk_correction}, m_Ex_external_particle{E_external_particle[0]}, m_Ey_external_particle{E_external_particle[1]}, m_Ez_external_particle{E_external_particle[2]}, diff --git a/Source/Particles/Gather/ScaleFields.H b/Source/Particles/Gather/ScaleFields.H index 10a10cfe190..4cddfa5a342 100644 --- a/Source/Particles/Gather/ScaleFields.H +++ b/Source/Particles/Gather/ScaleFields.H @@ -47,8 +47,8 @@ struct ScaleFields // This only approximates what should be happening. The particles // should by advanced a fraction of a time step instead. // Scaling the fields is much easier and may be good enough. - const amrex::Real dtscale = m_dt - (m_z_plane_previous - zp)/(m_vz_ave_boosted + m_v_boost); - if (0._rt < dtscale && dtscale < m_dt) + const amrex::Real dtscale = 1._rt - (m_z_plane_previous - zp)/(m_vz_ave_boosted + m_v_boost)/m_dt; + if (0._rt < dtscale && dtscale < 1._rt) { Exp *= dtscale; Eyp *= dtscale; diff --git a/Source/Particles/ParticleBoundaries.H b/Source/Particles/ParticleBoundaries.H index 1f4fb0372eb..78b090056b1 100644 --- a/Source/Particles/ParticleBoundaries.H +++ b/Source/Particles/ParticleBoundaries.H @@ -27,7 +27,7 @@ struct ParticleBoundaries void SetBoundsY (ParticleBoundaryType bc_lo, ParticleBoundaryType bc_hi); void SetBoundsZ (ParticleBoundaryType bc_lo, ParticleBoundaryType bc_hi); - bool CheckAll (ParticleBoundaryType bc); + [[nodiscard]] bool CheckAll (ParticleBoundaryType bc) const; void BuildReflectionModelParsers (); diff --git a/Source/Particles/ParticleBoundaries.cpp b/Source/Particles/ParticleBoundaries.cpp index a6e80717e81..5b51fa3fd25 100644 --- a/Source/Particles/ParticleBoundaries.cpp +++ b/Source/Particles/ParticleBoundaries.cpp @@ -54,7 +54,7 @@ ParticleBoundaries::SetBoundsZ (ParticleBoundaryType bc_lo, ParticleBoundaryType } bool -ParticleBoundaries::CheckAll (ParticleBoundaryType bc) +ParticleBoundaries::CheckAll (ParticleBoundaryType bc) const { return (data.xmin_bc == bc && data.xmax_bc == bc #ifdef WARPX_DIM_3D diff --git a/Source/Particles/PhysicalParticleContainer.H b/Source/Particles/PhysicalParticleContainer.H index 1ec3473e81b..a12ae75f629 100644 --- a/Source/Particles/PhysicalParticleContainer.H +++ b/Source/Particles/PhysicalParticleContainer.H @@ -224,7 +224,7 @@ public: void MapParticletoBoostedFrame (amrex::ParticleReal& x, amrex::ParticleReal& y, amrex::ParticleReal& z, amrex::ParticleReal& ux, amrex::ParticleReal& uy, amrex::ParticleReal& uz, - amrex::Real t_lab = 0.); + amrex::Real t_lab = 0.) const; void AddGaussianBeam ( PlasmaInjector const& plasma_injector, @@ -253,7 +253,7 @@ public: amrex::Gpu::HostVector& particle_uy, amrex::Gpu::HostVector& particle_uz, amrex::Gpu::HostVector& particle_w, - amrex::Real t_lab= 0.); + amrex::Real t_lab= 0.) const; /** * \brief Default initialize runtime attributes in a tile. This routine does not initialize the diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp index ecf27cf7b99..1219fe78b66 100644 --- a/Source/Particles/PhysicalParticleContainer.cpp +++ b/Source/Particles/PhysicalParticleContainer.cpp @@ -471,7 +471,7 @@ void PhysicalParticleContainer::InitData () } void PhysicalParticleContainer::MapParticletoBoostedFrame ( - ParticleReal& x, ParticleReal& y, ParticleReal& z, ParticleReal& ux, ParticleReal& uy, ParticleReal& uz, Real t_lab) + ParticleReal& x, ParticleReal& y, ParticleReal& z, ParticleReal& ux, ParticleReal& uy, ParticleReal& uz, Real t_lab) const { // Map the particles from the lab frame to the boosted frame. // This boosts the particle to the lab frame and calculates @@ -817,7 +817,7 @@ PhysicalParticleContainer::CheckAndAddParticle ( Gpu::HostVector& particle_uy, Gpu::HostVector& particle_uz, Gpu::HostVector& particle_w, - Real t_lab) + Real t_lab) const { if (WarpX::gamma_boost > 1.) { MapParticletoBoostedFrame(x, y, z, ux, uy, uz, t_lab); @@ -3179,10 +3179,15 @@ PhysicalParticleContainer::InitIonizationModule () "overriding user value and setting charge = q_e."); charge = PhysConst::q_e; } + utils::parser::queryWithParser(pp_species_name, "do_adk_correction", do_adk_correction); + utils::parser::queryWithParser( pp_species_name, "ionization_initial_level", ionization_initial_level); pp_species_name.get("ionization_product_species", ionization_product_name); pp_species_name.get("physical_element", physical_element); + WARPX_ALWAYS_ASSERT_WITH_MESSAGE( + physical_element == "H" || !do_adk_correction, + "Correction to ADK by Zhang et al., PRA 90, 043410 (2014) only works with Hydrogen"); // Add runtime integer component for ionization level AddIntComp("ionizationLevel"); // Get atomic number and ionization energies from file @@ -3217,6 +3222,18 @@ PhysicalParticleContainer::InitIonizationModule () h_ionization_energies.begin(), h_ionization_energies.end(), ionization_energies.begin()); + adk_correction_factors.resize(4); + if (do_adk_correction) { + Vector h_correction_factors(4); + constexpr int offset_corr = 0; // hard-coded: only Hydrogen + for(int i=0; i<4; i++){ + h_correction_factors[i] = table_correction_factors[i+offset_corr]; + } + Gpu::copyAsync(Gpu::hostToDevice, + h_correction_factors.begin(), h_correction_factors.end(), + adk_correction_factors.begin()); + } + Real const* AMREX_RESTRICT p_ionization_energies = ionization_energies.data(); Real * AMREX_RESTRICT p_adk_power = adk_power.data(); Real * AMREX_RESTRICT p_adk_prefactor = adk_prefactor.data(); @@ -3254,8 +3271,10 @@ PhysicalParticleContainer::getIonizationFunc (const WarpXParIter& pti, adk_prefactor.dataPtr(), adk_exp_prefactor.dataPtr(), adk_power.dataPtr(), + adk_correction_factors.dataPtr(), particle_icomps["ionizationLevel"], - ion_atomic_number}; + ion_atomic_number, + do_adk_correction}; } PlasmaInjector* PhysicalParticleContainer::GetPlasmaInjector (int i) diff --git a/Source/Particles/WarpXParticleContainer.H b/Source/Particles/WarpXParticleContainer.H index e791ac25d22..33aa71d1c7d 100644 --- a/Source/Particles/WarpXParticleContainer.H +++ b/Source/Particles/WarpXParticleContainer.H @@ -445,6 +445,7 @@ protected: int do_continuous_injection = 0; int do_field_ionization = 0; + int do_adk_correction = 0; int ionization_product; std::string ionization_product_name; int ion_atomic_number; @@ -453,6 +454,8 @@ protected: amrex::Gpu::DeviceVector adk_power; amrex::Gpu::DeviceVector adk_prefactor; amrex::Gpu::DeviceVector adk_exp_prefactor; + /** for correction in Zhang et al., PRA 90, 043410 (2014). a1, a2, a3, Ecrit. */ + amrex::Gpu::DeviceVector adk_correction_factors; std::string physical_element; int do_resampling = 0; diff --git a/Source/Utils/Physics/IonizationEnergiesTable.H b/Source/Utils/Physics/IonizationEnergiesTable.H index f956e308dbe..b7c82e88247 100644 --- a/Source/Utils/Physics/IonizationEnergiesTable.H +++ b/Source/Utils/Physics/IonizationEnergiesTable.H @@ -1963,4 +1963,11 @@ namespace utils::physics } +constexpr int correction_factors_length = 4; +// a1, a2, a3, Ecrit from Zhang et al., PRA 90, 043410 (2014). +constexpr amrex::Real table_correction_factors[correction_factors_length]{ + // H + amrex::Real(0.11714), amrex::Real(-0.90933), amrex::Real(-0.06034), amrex::Real(32125000000.) +}; + #endif // #ifndef WARPX_UTILS_PHYSICS_IONIZATION_TABLE_H_ diff --git a/Source/WarpX.H b/Source/WarpX.H index 6694937c7d7..5fc161451e9 100644 --- a/Source/WarpX.H +++ b/Source/WarpX.H @@ -746,7 +746,7 @@ public: #ifdef WARPX_DIM_RZ // Applies the boundary conditions that are specific to the axis when in RZ. - void ApplyFieldBoundaryOnAxis (amrex::MultiFab* Er, amrex::MultiFab* Et, amrex::MultiFab* Ez, int lev); + void ApplyFieldBoundaryOnAxis (amrex::MultiFab* Er, amrex::MultiFab* Et, amrex::MultiFab* Ez, int lev) const; #endif /** @@ -1039,6 +1039,16 @@ public: char field, int lev, PatchType patch_type); + /** + * \brief Load field values from a user-specified openPMD file, + * for the fields Ex, Ey, Ez, Bx, By, Bz + */ + void LoadExternalFieldsFromFile (int lev); + + /** + * \brief Load field values from a user-specified openPMD file + * for a specific field (specified by `F_name`) + */ void ReadExternalFieldFromFile ( std::string read_fields_from_path, amrex::MultiFab* mf, std::string F_name, std::string F_component); diff --git a/Source/ablastr/utils/timer/Timer.H b/Source/ablastr/utils/timer/Timer.H index efbb7d6a2bb..5df37493d61 100644 --- a/Source/ablastr/utils/timer/Timer.H +++ b/Source/ablastr/utils/timer/Timer.H @@ -44,7 +44,7 @@ namespace ablastr::utils::timer * * @return the duration */ - double get_duration () noexcept; + [[nodiscard]] double get_duration () const noexcept; /** @@ -53,7 +53,7 @@ namespace ablastr::utils::timer * * @return the maximum duration across all the MPI ranks */ - double get_global_duration (); + [[nodiscard]] double get_global_duration () const; private: diff --git a/Source/ablastr/utils/timer/Timer.cpp b/Source/ablastr/utils/timer/Timer.cpp index 5682a07c290..096c079fa2a 100644 --- a/Source/ablastr/utils/timer/Timer.cpp +++ b/Source/ablastr/utils/timer/Timer.cpp @@ -24,13 +24,13 @@ Timer::record_stop_time() noexcept } double -Timer::get_duration () noexcept +Timer::get_duration () const noexcept { return m_stop_time - m_start_time; } double -Timer::get_global_duration () +Timer::get_global_duration () const { auto duration = this->get_duration(); amrex::ParallelDescriptor::ReduceRealMax( diff --git a/Tools/machines/perlmutter-nersc/perlmutter_gpu_warpx.profile.example b/Tools/machines/perlmutter-nersc/perlmutter_gpu_warpx.profile.example index 13ab2ead605..54cd33fe476 100644 --- a/Tools/machines/perlmutter-nersc/perlmutter_gpu_warpx.profile.example +++ b/Tools/machines/perlmutter-nersc/perlmutter_gpu_warpx.profile.example @@ -6,6 +6,12 @@ export MY_PROFILE=$(cd $(dirname $BASH_SOURCE) && pwd)"/"$(basename $BASH_SOURCE if [ -z ${proj-} ]; then echo "WARNING: The 'proj' variable is not yet set in your $MY_PROFILE file! Please edit its line 2 to continue!"; return; fi # required dependencies +module load gpu +module load PrgEnv-gnu +module load craype +module load craype-x86-milan +module load craype-accel-nvidia80 +module load cudatoolkit module load cmake/3.22.0 # optional: for QED support with detailed tables diff --git a/cmake/dependencies/AMReX.cmake b/cmake/dependencies/AMReX.cmake index 886ee9c951f..911d70ba215 100644 --- a/cmake/dependencies/AMReX.cmake +++ b/cmake/dependencies/AMReX.cmake @@ -250,7 +250,7 @@ macro(find_amrex) endif() set(COMPONENT_PRECISION ${WarpX_PRECISION} P${WarpX_PARTICLE_PRECISION}) - find_package(AMReX 23.12 CONFIG REQUIRED COMPONENTS ${COMPONENT_ASCENT} ${COMPONENT_DIMS} ${COMPONENT_EB} PARTICLES ${COMPONENT_PIC} ${COMPONENT_PRECISION} ${COMPONENT_SENSEI} LSOLVERS) + find_package(AMReX 24.01 CONFIG REQUIRED COMPONENTS ${COMPONENT_ASCENT} ${COMPONENT_DIMS} ${COMPONENT_EB} PARTICLES ${COMPONENT_PIC} ${COMPONENT_PRECISION} ${COMPONENT_SENSEI} LSOLVERS) # note: TINYP skipped because user-configured and optional # AMReX CMake helper scripts @@ -269,7 +269,7 @@ set(WarpX_amrex_src "" set(WarpX_amrex_repo "https://github.com/AMReX-Codes/amrex.git" CACHE STRING "Repository URI to pull and build AMReX from if(WarpX_amrex_internal)") -set(WarpX_amrex_branch "75571e2dcbf2417529c5ed8e24113580e8e1f3f1" +set(WarpX_amrex_branch "24.01" CACHE STRING "Repository branch for WarpX_amrex_repo if(WarpX_amrex_internal)") diff --git a/cmake/dependencies/pyAMReX.cmake b/cmake/dependencies/pyAMReX.cmake index 2ad63917965..7db3863d6ee 100644 --- a/cmake/dependencies/pyAMReX.cmake +++ b/cmake/dependencies/pyAMReX.cmake @@ -64,7 +64,7 @@ function(find_pyamrex) endif() elseif(NOT WarpX_pyamrex_internal) # TODO: MPI control - find_package(pyAMReX 23.12 CONFIG REQUIRED) + find_package(pyAMReX 24.01 CONFIG REQUIRED) message(STATUS "pyAMReX: Found version '${pyAMReX_VERSION}'") endif() endfunction() @@ -79,7 +79,7 @@ option(WarpX_pyamrex_internal "Download & build pyAMReX" ON) set(WarpX_pyamrex_repo "https://github.com/AMReX-Codes/pyamrex.git" CACHE STRING "Repository URI to pull and build pyamrex from if(WarpX_pyamrex_internal)") -set(WarpX_pyamrex_branch "eb24d03fac522d36fb27d20c6e026d8b59dfa908" +set(WarpX_pyamrex_branch "24.01" CACHE STRING "Repository branch for WarpX_pyamrex_repo if(WarpX_pyamrex_internal)") diff --git a/run_test.sh b/run_test.sh index deb4939da51..252e1cb89ae 100755 --- a/run_test.sh +++ b/run_test.sh @@ -68,7 +68,7 @@ python3 -m pip install --upgrade -r warpx/Regression/requirements.txt # Clone AMReX and warpx-data git clone https://github.com/AMReX-Codes/amrex.git -cd amrex && git checkout --detach 75571e2dcbf2417529c5ed8e24113580e8e1f3f1 && cd - +cd amrex && git checkout --detach 24.01 && cd - # warpx-data contains various required data sets git clone --depth 1 https://github.com/ECP-WarpX/warpx-data.git # openPMD-example-datasets contains various required data sets diff --git a/setup.py b/setup.py index 5228b7b3521..d3efeaaacd5 100644 --- a/setup.py +++ b/setup.py @@ -278,7 +278,7 @@ def build_extension(self, ext): setup( name='pywarpx', # note PEP-440 syntax: x.y.zaN but x.y.z.devN - version = '23.12', + version = '24.01', packages = ['pywarpx'], package_dir = {'pywarpx': 'Python/pywarpx'}, author='Jean-Luc Vay, David P. Grote, Maxence Thévenet, Rémi Lehe, Andrew Myers, Weiqun Zhang, Axel Huebl, et al.',