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..b50989f2f5c 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 f1ec8df75c562d2a4822cea84d284cf8e72c2e14 && 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/refs.bib b/Docs/source/refs.bib index 4b1cd1bd1a1..d94938775c6 100644 --- a/Docs/source/refs.bib +++ b/Docs/source/refs.bib @@ -277,6 +277,21 @@ @Inbook{VanLeerBookChapter1997 year = {1997} } +@article{Yakimenko2019, + title = {Prospect of Studying Nonperturbative QED with Beam-Beam Collisions}, + author = {Yakimenko, V. and Meuren, S. and Del Gaudio, F. and Baumann, C. and Fedotov, A. and Fiuza, F. and Grismayer, T. and Hogan, M. J. and Pukhov, A. and Silva, L. O. and White, G.}, + journal = {Phys. Rev. Lett.}, + volume = {122}, + issue = {19}, + pages = {190404}, + numpages = {7}, + year = {2019}, + month = {May}, + publisher = {American Physical Society}, + doi = {10.1103/PhysRevLett.122.190404}, + url = {https://link.aps.org/doi/10.1103/PhysRevLett.122.190404} +} + @article{Groenewald2023, author = {Groenewald, R. E. and Veksler, A. and Ceccherini, F. and Necas, A. and Nicks, B. S. and Barnes, D. C. and Tajima, T. and Dettrick, S. A.}, title = "{Accelerated kinetic model for global macro stability studies of high-beta fusion reactors}", diff --git a/Docs/source/usage/examples.rst b/Docs/source/usage/examples.rst index 5490068e448..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 ----------------------------------- @@ -56,12 +43,7 @@ Particle Accelerator & Beam Physics :maxdepth: 1 examples/gaussian_beam/README.rst - -Coming soon: - -* Beam-Beam Collision -* Beam Transport or Injector -* Cathode/source + examples/beam-beam_collision/README.rst High Energy Astrophysical Plasma Physics @@ -89,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 -------------------------- @@ -104,9 +81,6 @@ Fundamental Plasma Physics examples/langmuir/README.rst examples/capacitive_discharge/README.rst -Coming soon: - -* Expanding Sphere example .. _examples-hybrid-model: @@ -149,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/examples/beam-beam_collision b/Docs/source/usage/examples/beam-beam_collision new file mode 120000 index 00000000000..8c6ac6b30b1 --- /dev/null +++ b/Docs/source/usage/examples/beam-beam_collision @@ -0,0 +1 @@ +../../../../Examples/Physics_applications/beam-beam_collision \ No newline at end of file diff --git a/Docs/source/usage/parameters.rst b/Docs/source/usage/parameters.rst index 88d8b4dbe6f..674f86143e3 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. @@ -2585,8 +2602,8 @@ In-situ capabilities can be used by turning on Sensei or Ascent (provided they a Only works with ``.format = plotfile``. * ``.coarsening_ratio`` (list of `int`) optional (default `1 1 1`) - Reduce size of the field output by this ratio in each dimension. - (This is done by averaging the field over 1 or 2 points along each direction, depending on the staggering). + Reduce size of the selected diagnostic fields output by this ratio in each dimension. + (For a ratio of N, this is done by averaging the fields over N or (N+1) points depending on the staggering). If ``blocking_factor`` and ``max_grid_size`` are used for the domain decomposition, as detailed in the :ref:`domain decomposition ` section, ``coarsening_ratio`` should be an integer divisor of ``blocking_factor``. If ``warpx.numprocs`` is used instead, the total number of cells in a given @@ -2737,6 +2754,8 @@ This can be important if a large number of particles are lost, avoiding filling In addition to their usual attributes, the saved particles have an integer attribute ``timestamp``, which indicates the PIC iteration at which each particle was absorbed at the boundary. +``BoundaryScrapingDiagnostics`` can be used with ``..random_fraction``, ``..uniform_stride``, and ``..plot_filter_function``, which have the same behavior as for ``FullDiagnostics``. For ``BoundaryScrapingDiagnostics``, these filters are applied at the time the data is written to file. An implication of this is that more particles may initially be accumulated in memory than are ultimately written. ``t`` in ``plot_filter_function`` refers to the time the diagnostic is written rather than the time the particle crossed the boundary. + .. _running-cpp-parameters-diagnostics-reduced: Reduced Diagnostics @@ -2868,8 +2887,9 @@ Reduced Diagnostics defaulting to ``1``. In RZ geometry, this only saves the 0'th azimuthal mode component of the fields. - Integrated electric and magnetic field components can instead be obtained by specifying + Time integrated electric and magnetic field components can instead be obtained by specifying ``.integrate = true``. + The integration is done every time step even when the data is written out less often. In a *moving window* simulation, the FieldProbe can be set to follow the moving frame by specifying ``.do_moving_window_FP = 1`` (default 0). .. warning:: diff --git a/Examples/Physics_applications/beam-beam_collision/README.rst b/Examples/Physics_applications/beam-beam_collision/README.rst new file mode 100644 index 00000000000..559a81277db --- /dev/null +++ b/Examples/Physics_applications/beam-beam_collision/README.rst @@ -0,0 +1,70 @@ +.. _examples-beam-beam_collision: + +Beam-beam collision +==================== + +This example shows how to simulate the collision between two ultra-relativistic particle beams. +This is representative of what happens at the interaction point of a linear collider. +We consider a right-propagating electron bunch colliding against a left-propagating positron bunch. + +We turn on the Quantum Synchrotron QED module for photon emission (also known as beamstrahlung in the collider community) and +the Breit-Wheeler QED module for the generation of electron-positron pairs (also known as coherent pair generation in the collider community). + +To solve for the electromagnetic field we use the nodal version of the electrostatic relativistic solver. +This solver computes the average velocity of each species, and solves the corresponding relativistic Poisson equation (see the WarpX documentation for `warpx.do_electrostatic = relativistic` for more detail). This solver accurately reproduced the subtle cancellation that occur for some component of the ``E + v x B`` terms which are crucial in simulations of relativistic particles. + + +This example is based on the following paper :cite:t:`ex-Yakimenko2019`. + + +Run +--- + +The PICMI input file is not available for this example yet. + +For `MPI-parallel `__ runs, prefix these lines with ``mpiexec -n 4 ...`` or ``srun -n 4 ...``, depending on the system. + +.. literalinclude:: inputs + :language: ini + :caption: You can copy this file from ``Examples/Physics_applications/beam-beam_collision/inputs``. + + +Visualize +--------- + +The figure below shows the number of photons emitted per beam particle (left) and the number of secondary pairs generated per beam particle (right). + +We compare different results: +* (red) simplified WarpX simulation as the example stored in the directory ``/Examples/Physics_applications/beam-beam_collision``; +* (blue) large-scale WarpX simulation (high resolution and ad hoc generated tables ; +* (black) literature results from :cite:t:`ex-Yakimenko2019`. + +The small-scale simulation has been performed with a resolution of ``nx = 64, ny = 64, nz = 128`` grid cells, while the large-scale one has a much higher resolution of ``nx = 512, ny = 512, nz = 1024``. Moreover, the large-scale simulation uses dedicated QED lookup tables instead of the builtin tables. To generate the tables within WarpX, the code must be compiled with the flag ``-DWarpX_QED_TABLE_GEN=ON``. For the large-scale simulation we have used the following options: + +.. code-block:: ini + + qed_qs.lookup_table_mode = generate + qed_bw.lookup_table_mode = generate + qed_qs.tab_dndt_chi_min=1e-3 + qed_qs.tab_dndt_chi_max=2e3 + qed_qs.tab_dndt_how_many=512 + qed_qs.tab_em_chi_min=1e-3 + qed_qs.tab_em_chi_max=2e3 + qed_qs.tab_em_chi_how_many=512 + qed_qs.tab_em_frac_how_many=512 + qed_qs.tab_em_frac_min=1e-12 + qed_qs.save_table_in=my_qs_table.txt + qed_bw.tab_dndt_chi_min=1e-2 + qed_bw.tab_dndt_chi_max=2e3 + qed_bw.tab_dndt_how_many=512 + qed_bw.tab_pair_chi_min=1e-2 + qed_bw.tab_pair_chi_max=2e3 + qed_bw.tab_pair_chi_how_many=512 + qed_bw.tab_pair_frac_how_many=512 + qed_bw.save_table_in=my_bw_table.txt + +.. figure:: https://user-images.githubusercontent.com/17280419/291749626-aa61fff2-e6d2-45a3-80ee-84b2851ea0bf.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTEiLCJleHAiOjE3MDMwMzQzNTEsIm5iZiI6MTcwMzAzNDA1MSwicGF0aCI6Ii8xNzI4MDQxOS8yOTE3NDk2MjYtYWE2MWZmZjItZTZkMi00NWEzLTgwZWUtODRiMjg1MWVhMGJmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFJV05KWUFYNENTVkVINTNBJTJGMjAyMzEyMjAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjMxMjIwVDAxMDA1MVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWFiYzY2MGQyYzIyZGIzYzUxOWI3MzNjZTk5ZDM1YzgyNmY4ZDYxOGRlZjAyZTIwNTAyMTc3NTgwN2Q0YjEwNGMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.I96LQpjqmFXirPDVnBlFQIkCuenR6IuOSY0OIIQvtCo + :alt: Beam-beam collision benchmark against :cite:t:`ex-Yakimenko2019`. + :width: 100% + + Beam-beam collision benchmark against :cite:t:`ex-Yakimenko2019`. diff --git a/Examples/Physics_applications/beam-beam_collision/inputs b/Examples/Physics_applications/beam-beam_collision/inputs new file mode 100644 index 00000000000..488e997f895 --- /dev/null +++ b/Examples/Physics_applications/beam-beam_collision/inputs @@ -0,0 +1,231 @@ +################################# +########## MY CONSTANTS ######### +################################# +my_constants.mc2 = m_e*clight*clight +my_constants.nano = 1.0e-9 +my_constants.GeV = q_e*1.e9 + +# BEAMS +my_constants.beam_energy = 125.*GeV +my_constants.beam_uz = beam_energy/(mc2) +my_constants.beam_charge = 0.14*nano +my_constants.sigmax = 10*nano +my_constants.sigmay = 10*nano +my_constants.sigmaz = 10*nano +my_constants.beam_uth = 0.1/100.*beam_uz +my_constants.n0 = beam_charge / (q_e * sigmax * sigmay * sigmaz * (2.*pi)**(3./2.)) +my_constants.omegab = sqrt(n0 * q_e**2 / (epsilon0*m_e)) +my_constants.mux = 0.0 +my_constants.muy = 0.0 +my_constants.muz = -0.5*Lz+3.2*sigmaz + +# BOX +my_constants.Lx = 100.0*clight/omegab +my_constants.Ly = 100.0*clight/omegab +my_constants.Lz = 180.0*clight/omegab + +# for a full scale simulation use: nx, ny, nz = 512, 512, 1024 +my_constants.nx = 64 +my_constants.ny = 64 +my_constants.nz = 128 + + +# TIME +my_constants.T = 0.7*Lz/clight +my_constants.dt = sigmaz/clight/10. + +# DIAGS +my_constants.every_red = 1. +warpx.used_inputs_file = warpx_used_inputs.txt + +################################# +####### GENERAL PARAMETERS ###### +################################# +stop_time = T +amr.n_cell = nx ny nz +amr.max_grid_size = 128 +amr.blocking_factor = 2 +amr.max_level = 0 +geometry.dims = 3 +geometry.prob_lo = -0.5*Lx -0.5*Ly -0.5*Lz +geometry.prob_hi = 0.5*Lx 0.5*Ly 0.5*Lz + +################################# +######## BOUNDARY CONDITION ##### +################################# +boundary.field_lo = PEC PEC PEC +boundary.field_hi = PEC PEC PEC +boundary.particle_lo = Absorbing Absorbing Absorbing +boundary.particle_hi = Absorbing Absorbing Absorbing + +################################# +############ NUMERICS ########### +################################# +warpx.do_electrostatic = relativistic +warpx.const_dt = dt +warpx.grid_type = collocated +algo.particle_shape = 3 +algo.load_balance_intervals=100 +algo.particle_pusher = vay + +################################# +########### PARTICLES ########### +################################# +particles.species_names = beam1 beam2 pho1 pho2 ele1 pos1 ele2 pos2 +particles.photon_species = pho1 pho2 + +beam1.species_type = electron +beam1.injection_style = NUniformPerCell +beam1.num_particles_per_cell_each_dim = 1 1 1 +beam1.profile = parse_density_function +beam1.density_function(x,y,z) = "n0 * exp(-(x-mux)**2/(2*sigmax**2)) * exp(-(y-muy)**2/(2*sigmay**2)) * exp(-(z-muz)**2/(2*sigmaz**2))" +beam1.density_min = n0 / 1e3 +beam1.momentum_distribution_type = gaussian +beam1.uz_m = beam_uz +beam1.uy_m = 0.0 +beam1.ux_m = 0.0 +beam1.ux_th = beam_uth +beam1.uy_th = beam_uth +beam1.uz_th = beam_uth +beam1.initialize_self_fields = 1 +beam1.self_fields_required_precision = 5e-10 +beam1.self_fields_max_iters = 10000 +beam1.do_qed_quantum_sync = 1 +beam1.qed_quantum_sync_phot_product_species = pho1 +beam1.do_classical_radiation_reaction = 0 + +beam2.species_type = positron +beam2.injection_style = NUniformPerCell +beam2.num_particles_per_cell_each_dim = 1 1 1 +beam2.profile = parse_density_function +beam2.density_function(x,y,z) = "n0 * exp(-(x-mux)**2/(2*sigmax**2)) * exp(-(y-muy)**2/(2*sigmay**2)) * exp(-(z+muz)**2/(2*sigmaz**2))" +beam2.density_min = n0 / 1e3 +beam2.momentum_distribution_type = gaussian +beam2.uz_m = -beam_uz +beam2.uy_m = 0.0 +beam2.ux_m = 0.0 +beam2.ux_th = beam_uth +beam2.uy_th = beam_uth +beam2.uz_th = beam_uth +beam2.initialize_self_fields = 1 +beam2.self_fields_required_precision = 5e-10 +beam2.self_fields_max_iters = 10000 +beam2.do_qed_quantum_sync = 1 +beam2.qed_quantum_sync_phot_product_species = pho2 +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 = 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 + +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 ############### +################################# +qed_qs.photon_creation_energy_threshold = 0. + +qed_qs.lookup_table_mode = builtin +qed_qs.chi_min = 1.e-3 + +qed_bw.lookup_table_mode = builtin +qed_bw.chi_min = 1.e-2 + +# for accurate results use the generated tables with +# the following parameters +# note: must compile with -DWarpX_QED_TABLE_GEN=ON +#qed_qs.lookup_table_mode = generate +#qed_bw.lookup_table_mode = generate +#qed_qs.tab_dndt_chi_min=1e-3 +#qed_qs.tab_dndt_chi_max=2e3 +#qed_qs.tab_dndt_how_many=512 +#qed_qs.tab_em_chi_min=1e-3 +#qed_qs.tab_em_chi_max=2e3 +#qed_qs.tab_em_chi_how_many=512 +#qed_qs.tab_em_frac_how_many=512 +#qed_qs.tab_em_frac_min=1e-12 +#qed_qs.save_table_in=my_qs_table.txt +#qed_bw.tab_dndt_chi_min=1e-2 +#qed_bw.tab_dndt_chi_max=2e3 +#qed_bw.tab_dndt_how_many=512 +#qed_bw.tab_pair_chi_min=1e-2 +#qed_bw.tab_pair_chi_max=2e3 +#qed_bw.tab_pair_chi_how_many=512 +#qed_bw.tab_pair_frac_how_many=512 +#qed_bw.save_table_in=my_bw_table.txt + +warpx.do_qed_schwinger = 0. + +################################# +######### DIAGNOSTICS ########### +################################# +# FULL +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_ele1 rho_pos1 rho_ele2 rho_pos2 +diag1.format = openpmd +diag1.dump_last_timestep = 1 +diag1.species = pho1 pho2 ele1 pos1 ele2 pos2 beam1 beam2 + +# REDUCED +warpx.reduced_diags_names = ParticleNumber ColliderRelevant_beam1_beam2 + +ColliderRelevant_beam1_beam2.type = ColliderRelevant +ColliderRelevant_beam1_beam2.intervals = every_red +ColliderRelevant_beam1_beam2.species = beam1 beam2 + +ParticleNumber.type = ParticleNumber +ParticleNumber.intervals = every_red diff --git a/Examples/Physics_applications/capacitive_discharge/PICMI_inputs_1d.py b/Examples/Physics_applications/capacitive_discharge/PICMI_inputs_1d.py index dd970cc15ea..38b83e46948 100644 --- a/Examples/Physics_applications/capacitive_discharge/PICMI_inputs_1d.py +++ b/Examples/Physics_applications/capacitive_discharge/PICMI_inputs_1d.py @@ -187,6 +187,9 @@ def __init__(self, n=0, test=False, pythonsolver=False, dsmc=False): else: self.mcc_subcycling_steps = None + if self.dsmc: + self.rng = np.random.default_rng(23094290) + self.ion_density_array = np.zeros(self.nz + 1) self.setup_run() @@ -397,9 +400,9 @@ def rethermalize_neutrals(self): vel_std = np.sqrt(constants.kb * self.gas_temp / self.m_ion) for ii in range(len(ux_arrays)): nps = len(ux_arrays[ii]) - ux_arrays[ii][:] = vel_std * np.random.normal(size=nps) - uy_arrays[ii][:] = vel_std * np.random.normal(size=nps) - uz_arrays[ii][:] = vel_std * np.random.normal(size=nps) + ux_arrays[ii][:] = vel_std * self.rng.normal(size=nps) + uy_arrays[ii][:] = vel_std * self.rng.normal(size=nps) + uz_arrays[ii][:] = vel_std * self.rng.normal(size=nps) def _get_rho_ions(self): # deposit the ion density in rho_fp 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/Implicit/analysis_1d.py b/Examples/Tests/Implicit/analysis_1d.py index 3d4fc375bc9..0f00010a505 100755 --- a/Examples/Tests/Implicit/analysis_1d.py +++ b/Examples/Tests/Implicit/analysis_1d.py @@ -10,6 +10,7 @@ # This is a script that analyses the simulation results from # the script `inputs_1d`. This simulates a 1D periodic plasma using the implicit solver. import os +import re import sys import numpy as np @@ -28,7 +29,11 @@ delta_E = (total_energy - total_energy[0])/total_energy[0] max_delta_E = np.abs(delta_E).max() -tolerance_rel = 1.e-14 +if re.match('SemiImplicitPicard_1d', fn): + tolerance_rel = 2.5e-5 +elif re.match('ImplicitPicard_1d', fn): + # This case should have near machine precision conservation of energy + tolerance_rel = 1.e-14 print(f"max change in energy: {max_delta_E}") print(f"tolerance: {tolerance_rel}") diff --git a/Examples/Tests/Implicit/inputs_1d_semiimplicit b/Examples/Tests/Implicit/inputs_1d_semiimplicit new file mode 100644 index 00000000000..2271a0bb1bc --- /dev/null +++ b/Examples/Tests/Implicit/inputs_1d_semiimplicit @@ -0,0 +1,81 @@ +################################# +############ CONSTANTS ############# +################################# + +my_constants.n0 = 1.e30 # plasma densirty, m^-3 +my_constants.nz = 40 # number of grid cells +my_constants.Ti = 100. # ion temperature, eV +my_constants.Te = 100. # electron temperature, eV +my_constants.wpe = q_e*sqrt(n0/(m_e*epsilon0)) # electron plasma frequency, radians/s +my_constants.de0 = clight/wpe # skin depth, m +my_constants.nppcz = 100 # number of particles/cell in z +my_constants.dt = 0.1/wpe # time step size, s + +################################# +####### GENERAL PARAMETERS ###### +################################# + +max_step = 100 +amr.n_cell = nz +amr.max_level = 0 + +geometry.dims = 1 +geometry.prob_lo = 0.0 +geometry.prob_hi = 10.*de0 +boundary.field_lo = periodic +boundary.field_hi = periodic +boundary.particle_lo = periodic +boundary.particle_hi = periodic + +################################# +############ NUMERICS ########### +################################# + +warpx.const_dt = dt +algo.evolve_scheme = semi_implicit_picard +algo.max_picard_iterations = 5 +algo.picard_iteration_tolerance = 0. +algo.current_deposition = esirkepov +algo.field_gathering = energy-conserving +algo.particle_shape = 2 +warpx.use_filter = 0 + +################################# +############ PLASMA ############# +################################# + +particles.species_names = electrons protons + +electrons.species_type = electron +electrons.injection_style = "NUniformPerCell" +electrons.num_particles_per_cell_each_dim = nppcz +electrons.profile = constant +electrons.density = n0 +electrons.momentum_distribution_type = gaussian +electrons.ux_th = sqrt(Te*q_e/m_e)/clight +electrons.uy_th = sqrt(Te*q_e/m_e)/clight +electrons.uz_th = sqrt(Te*q_e/m_e)/clight + +protons.species_type = proton +protons.injection_style = "NUniformPerCell" +protons.num_particles_per_cell_each_dim = nppcz +protons.profile = constant +protons.density = n0 +protons.momentum_distribution_type = gaussian +protons.ux_th = sqrt(Ti*q_e/m_p)/clight +protons.uy_th = sqrt(Ti*q_e/m_p)/clight +protons.uz_th = sqrt(Ti*q_e/m_p)/clight + +# Diagnostics +diagnostics.diags_names = diag1 +diag1.intervals = 100 +diag1.diag_type = Full +diag1.fields_to_plot = Ex Ey Ez Bx By Bz jx jy jz rho divE +diag1.electrons.variables = w ux uy uz +diag1.protons.variables = w ux uy uz + +warpx.reduced_diags_names = particle_energy field_energy +particle_energy.type = ParticleEnergy +particle_energy.intervals = 1 +field_energy.type = FieldEnergy +field_energy.intervals = 1 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/Examples/Tests/boosted_diags/analysis.py b/Examples/Tests/boosted_diags/analysis.py index c6c089f9807..c0b03f4a20b 100755 --- a/Examples/Tests/boosted_diags/analysis.py +++ b/Examples/Tests/boosted_diags/analysis.py @@ -21,6 +21,7 @@ import numpy as np import openpmd_api as io +from openpmd_viewer import OpenPMDTimeSeries import yt yt.funcs.mylog.setLevel(0) @@ -48,9 +49,13 @@ Ez_openpmd = ds_openpmd.meshes['E']['z'].load_chunk() Ez_openpmd = Ez_openpmd.transpose() series.flush() - # Compare arrays to check consistency between new BTD formats (plotfile and openPMD) assert(np.allclose(Ez_plotfile, Ez_openpmd, rtol=rtol, atol=atol)) +# Check that particle random sub-selection has been applied +ts = OpenPMDTimeSeries('./diags/diag2/') +w, = ts.get_particle(['w'], species='beam', iteration=3) +assert (400 < len(w)) & (len(w) < 600) + test_name = os.path.split(os.getcwd())[1] checksumAPI.evaluate_checksum(test_name, filename) diff --git a/Examples/Tests/boosted_diags/inputs_3d b/Examples/Tests/boosted_diags/inputs_3d index ba98558be47..1b6b3448f26 100644 --- a/Examples/Tests/boosted_diags/inputs_3d +++ b/Examples/Tests/boosted_diags/inputs_3d @@ -122,3 +122,4 @@ diag2.fields_to_plot = Ex Ey Ez Bx By Bz jx jy jz rho diag2.format = openpmd diag2.buffer_size = 32 diag2.openpmd_backend = h5 +diag2.beam.random_fraction = 0.5 diff --git a/Examples/Tests/scraping/analysis_rz_filter.py b/Examples/Tests/scraping/analysis_rz_filter.py new file mode 100755 index 00000000000..b97b6e0eb5a --- /dev/null +++ b/Examples/Tests/scraping/analysis_rz_filter.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python + +# Copyright 2023 Kale Weichman +# +# This file is part of WarpX. +# +# License: BSD-3-Clause-LBNL + +# This script tests the particle scraping for the embedded boundary in RZ. +# Particles are initialized between r=0.15 and r=0.2 +# having a negative radial velocity. +# A cylindrical embedded surface is placed at r=0.1. +# Upon reaching the surface, particles should be removed. +# At the end of the simulation, i.e., at time step 37, +# there should be 512 particles left. +# This test checks that plot_filter_fucntion works with the boundary scraping diagnostic +# by making sure that the particles removed from only half the domain (z>0) have been recorded. + +# Possible errors: 0 +# tolerance: 0 +# Possible running time: < 1 s + +import sys + +import numpy as np +from openpmd_viewer import OpenPMDTimeSeries +import yt + +tolerance = 0 + +fn = sys.argv[1] +ds = yt.load( fn ) +ad = ds.all_data() +x = ad['electron', 'particle_position_x'].v + +error = len(x)-512 +print('error = ', error) +print('tolerance = ', tolerance) +assert(error==tolerance) + +# Check that all the removed particles are properly recorded +# by making sure that, at each iteration, the sum of the number of +# remaining particles and scraped particles is equal to half the +# original number of particles +# also check that no particles with z <= 0 have been scraped +ts_full = OpenPMDTimeSeries('./diags/diag2/') +ts_scraping = OpenPMDTimeSeries('./diags/diag3/particles_at_eb') + +def n_remaining_particles( iteration ): + w, = ts_full.get_particle(['w'], iteration=iteration) + return len(w) +def n_scraped_particles( iteration ): + timestamp = ts_scraping.get_particle( ['timestamp'], iteration=ts_scraping.iterations[0] ) + return (timestamp <= iteration).sum() +def n_scraped_z_leq_zero( iteration ): + z_pos, = ts_scraping.get_particle( ['z'], iteration=ts_scraping.iterations[0] ) + return (z_pos <= 0).sum() +n_remaining = np.array([ n_remaining_particles(iteration) for iteration in ts_full.iterations ]) +n_scraped = np.array([ n_scraped_particles(iteration) for iteration in ts_full.iterations ]) +n_z_leq_zero = np.array([ n_scraped_z_leq_zero(iteration) for iteration in ts_full.iterations ]) +n_total = n_remaining[0] +assert np.all( 2*n_scraped+n_remaining == n_total) +assert np.all( n_z_leq_zero == 0) diff --git a/Examples/Tests/scraping/inputs_rz_filter b/Examples/Tests/scraping/inputs_rz_filter new file mode 100644 index 00000000000..0d67fb96f6c --- /dev/null +++ b/Examples/Tests/scraping/inputs_rz_filter @@ -0,0 +1,58 @@ +amr.max_level = 1 +warpx.fine_tag_lo = 0.0 -0.5 +warpx.fine_tag_hi = 0.25 0.0 + +max_step = 37 + +amr.n_cell = 64 64 +amr.blocking_factor = 8 +amr.max_grid_size = 128 + +geometry.dims = RZ +geometry.prob_lo = 0.0 -0.5 +geometry.prob_hi = 0.5 0.5 + +boundary.field_lo = none periodic +boundary.field_hi = pec periodic +boundary.potential_lo_x = 0 +boundary.potential_hi_x = 0 +boundary.potential_lo_y = 0 +boundary.potential_hi_y = 0 +boundary.potential_lo_z = 0 +boundary.potential_hi_z = 0 + +warpx.const_dt = 1.216119097e-11 +warpx.eb_implicit_function = "-(x**2-0.1**2)" + +# Do not evolve the E and B fields +algo.maxwell_solver = none +algo.field_gathering = momentum-conserving +algo.particle_shape = 1 + +particles.species_names = electron +electron.charge = -q_e +electron.mass = m_e +electron.injection_style = "NUniformPerCell" +electron.num_particles_per_cell_each_dim = 2 4 2 +electron.profile = parse_density_function +electron.density_function(x,y,z) = "(x*x+y*y>0.15*0.15)*(x*x+y*y<0.2*0.2)*1.0e21" +electron.momentum_distribution_type = parse_momentum_function +electron.momentum_function_ux(x,y,z) = "if(x*x+y*y>0.0, -1.0*x/sqrt(x*x+y*y), 0.0)" +electron.momentum_function_uy(x,y,z) = "if(x*x+y*y>0.0, -1.0*y/sqrt(x*x+y*y), 0.0)" +electron.momentum_function_uz(x,y,z) = "0" +electron.save_particles_at_eb = 1 + +diagnostics.diags_names = diag1 diag2 diag3 + +diag1.intervals = 1 +diag1.diag_type = Full +diag1.fields_to_plot = Er + +diag2.intervals = 1 +diag2.diag_type = Full +diag2.fields_to_plot = Er +diag2.format = openpmd + +diag3.diag_type = BoundaryScraping +diag3.format = openpmd +diag3.electron.plot_filter_function(t,x,y,z,ux,uy,uz) = "z > 0" diff --git a/Python/pywarpx/particle_containers.py b/Python/pywarpx/particle_containers.py index 273a981f4bd..648b0a6c42e 100644 --- a/Python/pywarpx/particle_containers.py +++ b/Python/pywarpx/particle_containers.py @@ -117,8 +117,10 @@ def add_particles(self, x=None, y=None, z=None, ux=None, uy=None, kwargs[key] = np.full(maxlen, val) # --- The number of built in attributes + # --- The positions + built_in_attrs = libwarpx.dim # --- The three velocities - built_in_attrs = 3 + built_in_attrs += 3 if libwarpx.geometry_dim == 'rz': # --- With RZ, there is also theta built_in_attrs += 1 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/BTD_rz.json b/Regression/Checksum/benchmarks_json/BTD_rz.json index 3110120b70a..01e4c687292 100644 --- a/Regression/Checksum/benchmarks_json/BTD_rz.json +++ b/Regression/Checksum/benchmarks_json/BTD_rz.json @@ -1,13 +1,13 @@ { "lev=0": { - "Br": 1.8705552174367742e-08, - "Bt": 2380179.567792259, - "Bz": 2.4079075035536954e-08, + "Br": 1.8705552264208163e-08, + "Bt": 2380179.5677922587, + "Bz": 2.4079077116116535e-08, "Er": 497571119514841.25, - "Et": 7.048225282653208, - "Ez": 137058870936728.17, + "Et": 7.048225464720808, + "Ez": 137058870936728.28, "jr": 0.0, "jt": 0.0, "jz": 0.0 } -} +} \ No newline at end of file diff --git a/Regression/Checksum/benchmarks_json/BeamBeamCollision.json b/Regression/Checksum/benchmarks_json/BeamBeamCollision.json new file mode 100644 index 00000000000..16c27055ab5 --- /dev/null +++ b/Regression/Checksum/benchmarks_json/BeamBeamCollision.json @@ -0,0 +1,96 @@ +{ + "lev=0": { + "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": 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": 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 + }, + "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 + }, + "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": 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": 61063948.68610941 + }, + "pho2": { + "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": 62299636.622087024 + }, + "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 + }, + "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 ee19b84c7af..0efcdaeca3c 100644 --- a/Regression/Checksum/benchmarks_json/LaserAccelerationBoost.json +++ b/Regression/Checksum/benchmarks_json/LaserAccelerationBoost.json @@ -1,38 +1,38 @@ { - "beam": { - "particle_momentum_x": 3.535284585563231e-19, - "particle_momentum_y": 4.403094613346061e-19, - "particle_momentum_z": 5.658013779496569e-17, - "particle_position_x": 0.008317876520240174, - "particle_position_y": 1.1704335094514386, - "particle_weight": 62415090744.60765 + "lev=0": { + "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.2135959939611405e-23, - "particle_momentum_y": 2.822519730011994e-22, - "particle_momentum_z": 5.260625039372931e-22, - "particle_position_x": 0.010800577787577741, - "particle_position_y": 0.21115060628258137, + "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.248472008953412e-23, - "particle_momentum_y": 4.449200926395666e-22, - "particle_momentum_z": 5.768167708374496e-22, - "particle_position_x": 0.010800001678510793, - "particle_position_y": 0.21114947608115497, + "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 }, - "lev=0": { - "Bx": 4818965.813977506, - "By": 1752.781451346485, - "Bz": 14516.29947347909, - "Ex": 2366115950699.717, - "Ey": 1446115205306590.0, - "Ez": 21864183756771.12, - "jx": 1996366451911408.0, - "jy": 5.312642483130767e+16, - "jz": 2.049134468340688e+16, - "rho": 68443935.06252655 + "beam": { + "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/LaserAccelerationRZ.json b/Regression/Checksum/benchmarks_json/LaserAccelerationRZ.json index 0c6f5242b87..1602058dbdc 100644 --- a/Regression/Checksum/benchmarks_json/LaserAccelerationRZ.json +++ b/Regression/Checksum/benchmarks_json/LaserAccelerationRZ.json @@ -1,55 +1,55 @@ { "lev=0": { - "Br": 104965.61239547668, - "Br_0_real": 0.27473110662919303, - "Br_1_imag": 104.10451752777047, + "Br": 104965.61239547684, + "Br_0_real": 0.2747311066289638, + "Br_1_imag": 104.10451752777048, "Br_1_real": 104965.62478916143, - "Bt": 1296.2723279668432, - "Btheta_0_real": 1297.3296772773876, + "Bt": 1296.2723277779253, + "Btheta_0_real": 1297.3296772773874, "Btheta_1_imag": 105725.25398122355, - "Btheta_1_real": 141.255481019691, - "Bz": 5076.744762384442, - "Bz_0_real": 0.4603819957305941, - "Bz_1_imag": 1.007360812967319, + "Btheta_1_real": 141.2554810196911, + "Bz": 5076.74476238461, + "Bz_0_real": 0.4603819957306249, + "Bz_1_imag": 1.0073608129672305, "Bz_1_real": 5076.632351216658, - "Er": 273570494222.5625, + "Er": 273570493775.55588, "Er_0_real": 271974091013.7082, "Er_1_imag": 39530787242966.72, - "Er_1_real": 42616886403.53066, - "Et": 39016542462571.72, - "Etheta_0_real": 112249482.93967965, - "Etheta_1_imag": 33602799006.8748, + "Er_1_real": 42616886403.53069, + "Et": 39016542462571.68, + "Etheta_0_real": 112249482.93975669, + "Etheta_1_imag": 33602799006.874825, "Etheta_1_real": 39016517454881.91, - "Ez": 511653064866.5733, + "Ez": 511653064863.048, "Ez_0_real": 496845125310.57947, - "Ez_1_imag": 1245709520854.4875, - "Ez_1_real": 24849976994.356285, - "Jr_0_real": 1264417193501.7915, + "Ez_1_imag": 1245709520854.488, + "Ez_1_real": 24849976994.356266, + "Jr_0_real": 1264417193503.146, "Jr_1_imag": 2.3356633334993878e+17, - "Jr_1_real": 2272922066062.2944, + "Jr_1_real": 2272922066062.586, "Jtheta_0_real": 475304056513.7001, - "Jtheta_1_imag": 1028929701334.7467, + "Jtheta_1_imag": 1028929701334.8286, "Jtheta_1_real": 2.1766379427377802e+17, "Jz_0_real": 1832468408628522.8, "Jz_1_imag": 556484600934089.9, "Jz_1_real": 602703622358902.4, - "jr": 1749994884866.3667, - "jt": 2.176637940885753e+17, - "jz": 1954078685186198.5, - "rho": 39314210.88334631, + "jr": 1749985661974.403, + "jt": 2.1766379408857264e+17, + "jz": 1954078684852864.2, + "rho": 39314210.931097575, "rho_0_real": 38889615.839967206, - "rho_1_imag": 21546499.619336687, - "rho_1_real": 2012888.5658883716 + "rho_1_imag": 21546499.619336277, + "rho_1_real": 2012888.5658883736 }, "electrons": { - "particle_momentum_x": 1.3203417227476259e-24, + "particle_momentum_x": 1.3203417227476271e-24, "particle_momentum_y": 4.0070625287284664e-22, - "particle_momentum_z": 1.2493391415020164e-23, + "particle_momentum_z": 1.2493391415020162e-23, "particle_orig_x": 0.026508328457558912, "particle_orig_z": 0.04789125000000001, "particle_position_x": 0.04160250006680718, "particle_position_y": 0.04789125046517409, - "particle_theta": 7325.121266775259, + "particle_theta": 7325.160426984388, "particle_weight": 813672305.532158 }, "beam": { @@ -61,4 +61,4 @@ "particle_theta": 151.40797316586125, "particle_weight": 6241509.074460764 } -} +} \ No newline at end of file diff --git a/Regression/Checksum/benchmarks_json/LaserAcceleration_BTD.json b/Regression/Checksum/benchmarks_json/LaserAcceleration_BTD.json index 6b30064365c..dd224516c5c 100644 --- a/Regression/Checksum/benchmarks_json/LaserAcceleration_BTD.json +++ b/Regression/Checksum/benchmarks_json/LaserAcceleration_BTD.json @@ -1,32 +1,32 @@ { "lev=0": { - "Bx": 497087553.4743837, - "By": 252364344.72213668, - "Bz": 16986109.62608196, - "Ex": 7.304419665394173e+16, - "Ey": 1.4583459400150573e+17, - "Ez": 2.261309965998215e+16, - "jx": 8.273582439836952e+17, - "jy": 2.1044181577417728e+18, - "jz": 2.84208498868846e+19, - "rho": 91637594416.50476 + "Bx": 497756265.44724107, + "By": 252197580.117894, + "Bz": 16988475.5444833, + "Ex": 7.299911104263803e+16, + "Ey": 1.460116488178734e+17, + "Ez": 2.26033100286114e+16, + "jx": 8.27644503757345e+17, + "jy": 2.1062078409959675e+18, + "jz": 2.8491727096438305e+19, + "rho": 91863764144.41415 }, "electrons": { - "particle_momentum_x": 5.922677819206403e-20, - "particle_momentum_y": 2.7778096010261295e-19, - "particle_momentum_z": 4.183846407463124e-19, - "particle_position_x": 0.0025865980636989934, - "particle_position_y": 0.002652673793955211, - "particle_position_z": 0.18411922027879662, - "particle_weight": 1731649095408.5505 + "particle_momentum_x": 5.76165226700654e-20, + "particle_momentum_y": 2.7567389504898156e-19, + "particle_momentum_z": 4.134562048099117e-19, + "particle_position_x": 0.0025269863605945427, + "particle_position_y": 0.0024538321295153346, + "particle_position_z": 0.17818421763751244, + "particle_weight": 1675789447169.5652 }, "beam": { - "particle_momentum_x": 1.1925686969448298e-17, - "particle_momentum_y": 2.570810132551278e-17, - "particle_momentum_z": 5.156190278524037e-14, - "particle_position_x": 0.0005608477913384702, - "particle_position_y": 0.0008431191912437461, - "particle_position_z": 2.9800048756186395, + "particle_momentum_x": 1.1926313055043134e-17, + "particle_momentum_y": 2.7056205218547404e-17, + "particle_momentum_z": 5.1562131494813424e-14, + "particle_position_x": 0.000560821518739447, + "particle_position_y": 0.000800729816549036, + "particle_position_z": 2.9800048650570097, "particle_weight": 62415.090744607616 } -} +} \ No newline at end of file diff --git a/Regression/Checksum/benchmarks_json/LaserAcceleration_single_precision_comms.json b/Regression/Checksum/benchmarks_json/LaserAcceleration_single_precision_comms.json index 793d8c11cb3..30eef0cedb7 100644 --- a/Regression/Checksum/benchmarks_json/LaserAcceleration_single_precision_comms.json +++ b/Regression/Checksum/benchmarks_json/LaserAcceleration_single_precision_comms.json @@ -1,25 +1,25 @@ { + "lev=0": { + "Bx": 5863879.051452597, + "By": 2411.5124004699082, + "Bz": 116025.40178726945, + "Ex": 6267725953308.365, + "Ey": 1670763222566621.8, + "Ez": 104345977762699.77, + "jx": 555688154318027.4, + "jy": 1595897074125252.8, + "jz": 1045267363178542.9, + "rho": 2205684400.3678846 + }, "electrons": { "particle_initialenergy": 0.0, - "particle_momentum_x": 1.7921229236407606e-20, - "particle_momentum_y": 7.225825184653885e-20, - "particle_momentum_z": 4.231731488281653e-20, - "particle_position_x": 0.7139122621535502, - "particle_position_y": 0.7150340889556129, - "particle_position_z": 1.3175770602802896, "particle_regionofinterest": 1936.0, + "particle_position_x": 0.7139122620952513, + "particle_position_y": 0.7150340902640349, + "particle_position_z": 1.317577060220835, + "particle_momentum_x": 1.7921232385614662e-20, + "particle_momentum_y": 7.22582607277354e-20, + "particle_momentum_z": 4.231730764749506e-20, "particle_weight": 12926557617.187498 - }, - "lev=0": { - "Bx": 5863879.02030842, - "By": 2411.501904737579, - "Bz": 116025.42462998998, - "Ex": 6267728094111.663, - "Ey": 1670763233105822.0, - "Ez": 104345989831222.4, - "jx": 555687912108453.8, - "jy": 1595896363359136.0, - "jz": 1045267552192496.5, - "rho": 2205684400.307701 } } \ No newline at end of file diff --git a/Regression/Checksum/benchmarks_json/LaserInjectionFromLASYFile_RZ.json b/Regression/Checksum/benchmarks_json/LaserInjectionFromLASYFile_RZ.json index d98aabd84e9..242cf00f0c3 100644 --- a/Regression/Checksum/benchmarks_json/LaserInjectionFromLASYFile_RZ.json +++ b/Regression/Checksum/benchmarks_json/LaserInjectionFromLASYFile_RZ.json @@ -1,12 +1,12 @@ { "lev=0": { "Br": 100278645.72225758, - "Bz": 2509008.1146699777, - "Er": 3.258880159474263, + "Bz": 2509008.1146699786, + "Er": 3.263343388037509, "Et": 3.0045297157982412e+16, - "Ez": 0.24010979707502123, - "jr": 50.13668665903749, - "jt": 4.305139762894391e+17, + "Ez": 0.2422526411295923, + "jr": 49.67802097760541, + "jt": 4.3051397628943917e+17, "jz": 0.0 } -} +} \ No newline at end of file diff --git a/Regression/Checksum/benchmarks_json/LaserIonAcc2d.json b/Regression/Checksum/benchmarks_json/LaserIonAcc2d.json index 36b2bc66aed..1678e794683 100644 --- a/Regression/Checksum/benchmarks_json/LaserIonAcc2d.json +++ b/Regression/Checksum/benchmarks_json/LaserIonAcc2d.json @@ -1,34 +1,33 @@ { - "electrons": { - "particle_momentum_x": 3.856058278845215e-19, - "particle_momentum_y": 0.0, - "particle_momentum_z": 1.633111056849423e-18, - "particle_position_x": 0.008155341094488198, - "particle_position_y": 0.03087362289643631, - "particle_weight": 2.6462205036771795e+17 - }, - "hydrogen": { - "particle_momentum_x": 2.237944099185357e-18, - "particle_momentum_z": 1.0744000122946915e-18, - "particle_orig_x": 0.007768349609375002, - "particle_orig_z": 0.035127407226562504, - "particle_position_x": 0.007767975241766832, - "particle_position_y": 0.03512562609400349, - "particle_weight": 2.68584931046923e+17 - }, "lev=0": { "Bx": 0.0, - "By": 11399442.711372176, + "By": 11411047.898351602, "Bz": 0.0, - "Ex": 2033057399920464.5, + "Ex": 2031641076084948.5, "Ey": 0.0, - "Ez": 339244862686685.9, - "jx": 1.6477362358927364e+19, + "Ez": 334777106874158.8, + "jx": 1.6602050255725978e+19, "jy": 0.0, - "jz": 9.633815033523364e+18, - "rho": 68121082972.17873, - "rho_electrons": 17448735668294.348, - "rho_hydrogen": 17441797017887.941 + "jz": 9.545451466990307e+18, + "rho": 67237998613.86053, + "rho_electrons": 17449705826002.385, + "rho_hydrogen": 17441792654743.146 + }, + "hydrogen": { + "particle_momentum_x": 2.2575255298569512e-18, + "particle_momentum_z": 1.0773391029868316e-18, + "particle_orig_x": 0.007763427734375002, + "particle_orig_z": 0.0351975439453125, + "particle_position_x": 0.007763034484095496, + "particle_position_y": 0.035195761508116416, + "particle_weight": 2.6792730619156992e+17 + }, + "electrons": { + "particle_momentum_x": 3.8463518636930147e-19, + "particle_momentum_y": 0.0, + "particle_momentum_z": 1.6287398567676136e-18, + "particle_position_x": 0.008139313907538123, + "particle_position_y": 0.0308605164193468, + "particle_weight": 2.647983436428149e+17 } -} - +} \ No newline at end of file diff --git a/Regression/Checksum/benchmarks_json/PlasmaMirror.json b/Regression/Checksum/benchmarks_json/PlasmaMirror.json index 9a686e78d56..861f42f2d74 100644 --- a/Regression/Checksum/benchmarks_json/PlasmaMirror.json +++ b/Regression/Checksum/benchmarks_json/PlasmaMirror.json @@ -1,29 +1,29 @@ { - "electrons": { - "particle_momentum_x": 2.000457748960032e-17, - "particle_momentum_y": 0.0, - "particle_momentum_z": 2.446670640741138e-17, - "particle_position_x": 0.37688793289418476, - "particle_position_y": 0.1714047288635171, - "particle_weight": 2.904173860599889e+18 - }, - "ions": { - "particle_momentum_x": 2.805690782833416e-17, - "particle_momentum_y": 0.0, - "particle_momentum_z": 9.605283484426823e-17, - "particle_position_x": 0.3828171295926821, - "particle_position_y": 0.17237242725257168, - "particle_weight": 2.9212132379167017e+18 - }, "lev=0": { "Bx": 0.0, - "By": 75294856.83091721, + "By": 75293687.71417463, "Bz": 0.0, - "Ex": 2.081697252453305e+16, + "Ex": 2.0817302986029584e+16, "Ey": 0.0, - "Ez": 2.350511387513211e+16, - "jx": 5.496779405360711e+19, + "Ez": 2.350518662171605e+16, + "jx": 5.496864993586538e+19, "jy": 0.0, - "jz": 7.159348923050661e+19 + "jz": 7.159302467888838e+19 + }, + "ions": { + "particle_momentum_x": 2.8056907319288714e-17, + "particle_momentum_y": 0.0, + "particle_momentum_z": 9.605283524169195e-17, + "particle_position_x": 0.382817129592504, + "particle_position_y": 0.1723724272525192, + "particle_weight": 2.9212132379167017e+18 + }, + "electrons": { + "particle_momentum_x": 2.000448978774197e-17, + "particle_momentum_y": 0.0, + "particle_momentum_z": 2.446668081246458e-17, + "particle_position_x": 0.376887964713013, + "particle_position_y": 0.17140472970668535, + "particle_weight": 2.9041738605998894e+18 } } \ No newline at end of file diff --git a/Regression/Checksum/benchmarks_json/Python_LaserAcceleration.json b/Regression/Checksum/benchmarks_json/Python_LaserAcceleration.json index 0b0355b7cb6..08969db023e 100644 --- a/Regression/Checksum/benchmarks_json/Python_LaserAcceleration.json +++ b/Regression/Checksum/benchmarks_json/Python_LaserAcceleration.json @@ -1,32 +1,32 @@ { + "lev=0": { + "Bx": 5866866.518334419, + "By": 11175.108378013305, + "Bz": 116026.79919117832, + "Ex": 8178060925462.576, + "Ey": 1671615340558021.2, + "Ez": 106548534464553.72, + "jx": 555903248104584.56, + "jy": 1595980426561245.2, + "jz": 1366292265497407.5, + "rho": 2206755250.226452 + }, "beam": { - "particle_momentum_x": 4.707586336874016e-20, - "particle_momentum_y": 4.4850722108112576e-20, - "particle_momentum_z": 1.36054441043288e-17, - "particle_position_x": 4.058764306495361e-05, - "particle_position_y": 3.7888695722549883e-05, - "particle_position_z": 0.00019656701118308398, + "particle_momentum_x": 4.7075864374777216e-20, + "particle_momentum_y": 4.4875025179072e-20, + "particle_momentum_z": 1.3605444179112827e-17, + "particle_position_x": 4.058764328440382e-05, + "particle_position_y": 3.788866110052658e-05, + "particle_position_z": 0.00019656700944015084, "particle_weight": 6241509.074460764 }, "electrons": { - "particle_momentum_x": 1.7921232203945004e-20, - "particle_momentum_y": 7.225819894813053e-20, - "particle_momentum_z": 4.231725460173154e-20, - "particle_position_x": 0.7139122621161993, - "particle_position_y": 0.7150340887578637, - "particle_position_z": 1.3175770600690966, + "particle_momentum_x": 1.7921232210868553e-20, + "particle_momentum_y": 7.225819896136567e-20, + "particle_momentum_z": 4.2317254599358777e-20, + "particle_position_x": 0.713912262116188, + "particle_position_y": 0.7150340887578024, + "particle_position_z": 1.31757706006908, "particle_weight": 12926557617.187498 - }, - "lev=0": { - "Bx": 5866866.85492377, - "By": 11177.920546471447, - "Bz": 116026.93444649166, - "Ex": 8178548880638.266, - "Ey": 1671614207789070.8, - "Ez": 106548168484665.61, - "jx": 555903247963958.4, - "jy": 1595974150308405.2, - "jz": 1366292284444382.5, - "rho": 2206755250.226321 } } \ No newline at end of file diff --git a/Regression/Checksum/benchmarks_json/Python_LaserAccelerationRZ.json b/Regression/Checksum/benchmarks_json/Python_LaserAccelerationRZ.json index d4c8d2b0c4e..720148888e2 100644 --- a/Regression/Checksum/benchmarks_json/Python_LaserAccelerationRZ.json +++ b/Regression/Checksum/benchmarks_json/Python_LaserAccelerationRZ.json @@ -1,45 +1,54 @@ { "lev=0": { - "Br": 142258.01161290862, - "Br_0_real": 0.36356680791862006, - "Br_1_imag": 115.41915541351702, + "Br": 142258.01161290894, + "Br_0_real": 0.36356680791855334, + "Br_1_imag": 115.41915541351706, "Br_1_real": 142258.0180774376, - "Bt": 1301.5691011565148, + "Bt": 1301.5691003159159, "Btheta_0_real": 1299.8813681794945, "Btheta_1_imag": 143318.04184449295, "Btheta_1_real": 155.37799428725944, - "Bz": 5993.6411733668865, - "Bz_0_real": 0.47374186122724626, - "Bz_1_imag": 1.140891753831192, - "Bz_1_real": 5993.529100973487, - "Er": 278531478924.55994, + "Bz": 5993.641173367065, + "Bz_0_real": 0.4737418612272665, + "Bz_1_imag": 1.1408917538312353, + "Bz_1_real": 5993.529100973486, + "Er": 278531478379.8872, "Er_0_real": 276179480674.09875, - "Er_1_imag": 47911368149173.87, - "Er_1_real": 46900731766.21943, - "Et": 47328876349791.84, - "Etheta_0_real": 135868018.29309198, - "Etheta_1_imag": 36802947213.299355, + "Er_1_imag": 47911368149173.86, + "Er_1_real": 46900731766.219345, + "Et": 47328876349791.85, + "Etheta_0_real": 135868018.2930996, + "Etheta_1_imag": 36802947213.299324, "Etheta_1_real": 47328835574237.43, - "Ez": 514006688163.9632, + "Ez": 514006688162.3537, "Ez_0_real": 499008057521.7594, - "Ez_1_imag": 1565161964565.9727, - "Ez_1_real": 28898941539.846138, - "Jr_0_real": 1458783813352.3413, + "Ez_1_imag": 1565161964565.9724, + "Ez_1_real": 28898941539.846146, + "Jr_0_real": 1458783813352.7048, "Jr_1_imag": 2.335663323286376e+17, - "Jr_1_real": 2725720908169.8604, - "Jtheta_0_real": 499386783042.54987, - "Jtheta_1_imag": 1179203035377.7158, + "Jr_1_real": 2725720908168.6816, + "Jtheta_0_real": 499386783042.5499, + "Jtheta_1_imag": 1179203035377.2214, "Jtheta_1_real": 2.1766371791828432e+17, "Jz_0_real": 1832469778455967.8, "Jz_1_imag": 621923937700173.0, "Jz_1_real": 660910016274555.4, - "jr": 2108653492279.1746, - "jt": 2.1766371088503258e+17, - "jz": 1954236547127886.2, - "rho": 39480728.028152466, + "jr": 2108641839684.7007, + "jt": 2.1766371088502803e+17, + "jz": 1954236547059862.2, + "rho": 39480728.08547403, "rho_0_real": 39055923.162689775, - "rho_1_imag": 21660762.696674928, - "rho_1_real": 2131498.588887921 + "rho_1_imag": 21660762.696674515, + "rho_1_real": 2131498.5888879234 + }, + "electrons": { + "particle_momentum_x": 1.237777638089911e-24, + "particle_momentum_y": 3.9465600403988994e-22, + "particle_momentum_z": 1.0097949593654349e-23, + "particle_position_x": 0.04160250006989259, + "particle_position_y": 0.047891250488567585, + "particle_theta": 7325.162679147719, + "particle_weight": 813672305.532158 }, "beam": { "particle_momentum_x": 3.8798818966213747e-20, @@ -49,14 +58,5 @@ "particle_position_y": 0.0026764363296859625, "particle_theta": 151.40797595010355, "particle_weight": 6241509.074460764 - }, - "electrons": { - "particle_momentum_x": 1.2377776380899228e-24, - "particle_momentum_y": 3.9465600403988994e-22, - "particle_momentum_z": 1.009794959365435e-23, - "particle_position_x": 0.04160250006989259, - "particle_position_y": 0.047891250488567585, - "particle_theta": 7325.119014611929, - "particle_weight": 813672305.532158 } -} +} \ 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/Python_ionization.json b/Regression/Checksum/benchmarks_json/Python_ionization.json index 35aa2c07a60..31f426aa362 100644 --- a/Regression/Checksum/benchmarks_json/Python_ionization.json +++ b/Regression/Checksum/benchmarks_json/Python_ionization.json @@ -1,30 +1,30 @@ { + "lev=0": { + "Bx": 0.0, + "By": 26296568.434868, + "Bz": 0.0, + "Ex": 7878103122971888.0, + "Ey": 0.0, + "Ez": 3027.995293554466, + "jx": 1.2111358330750162e+16, + "jy": 0.0, + "jz": 1.3483401471475687e-07 + }, "electrons": { - "particle_momentum_x": 4.410992240916769e-18, + "particle_momentum_x": 4.4206237143449475e-18, "particle_momentum_y": 0.0, - "particle_momentum_z": 2.637306716013194e-18, - "particle_position_x": 0.1095060155214851, - "particle_position_y": 0.6411875726789248, - "particle_weight": 3.44453125e-10 + "particle_momentum_z": 2.6361297302081026e-18, + "particle_position_x": 0.11009154442846772, + "particle_position_y": 0.6414658436421568, + "particle_weight": 3.4450781249999996e-10 }, "ions": { "particle_ionizationLevel": 72897.0, - "particle_momentum_x": 1.761324019342538e-18, + "particle_momentum_x": 1.76132401934254e-18, "particle_momentum_y": 0.0, - "particle_momentum_z": 3.644887006212893e-23, - "particle_position_x": 0.03199998810579664, - "particle_position_y": 0.12800000462171646, + "particle_momentum_z": 3.644887053263054e-23, + "particle_position_x": 0.03200001189420337, + "particle_position_y": 0.1280000046901387, "particle_weight": 9.999999999999999e-11 - }, - "lev=0": { - "Bx": 0.0, - "By": 26296568.43487075, - "Bz": 0.0, - "Ex": 7878103122973058.0, - "Ey": 0.0, - "Ez": 3027.995293554496, - "jx": 1.2111358333819302e+16, - "jy": 0.0, - "jz": 1.355517269126987e-07 } -} +} \ No newline at end of file diff --git a/Regression/Checksum/benchmarks_json/RefinedInjection.json b/Regression/Checksum/benchmarks_json/RefinedInjection.json index 8be545f3887..43cc8e3072c 100644 --- a/Regression/Checksum/benchmarks_json/RefinedInjection.json +++ b/Regression/Checksum/benchmarks_json/RefinedInjection.json @@ -1,11 +1,27 @@ { - "beam": { - "particle_momentum_x": 4.5603842543853726e-20, - "particle_momentum_y": 4.191542263916011e-20, - "particle_momentum_z": 1.363947302075425e-17, - "particle_position_x": 4.672031050423284e-05, - "particle_position_y": 0.00024387147640533396, - "particle_weight": 12483018148921.525 + "lev=0": { + "Bx": 26338425.87401078, + "By": 160257.72293376247, + "Bz": 694883.1248007242, + "Ex": 56513906294889.77, + "Ey": 7806060318610865.0, + "Ez": 65816740142650.89, + "jx": 6873283794395257.0, + "jy": 4286847636945161.5, + "jz": 7506503405703726.0, + "rho": 278060758.9118884 + }, + "lev=1": { + "Bx": 41971351.93872842, + "By": 347834.73215718823, + "Bz": 1093501.9056767717, + "Ex": 136247073074384.92, + "Ey": 1.2435868091440666e+16, + "Ez": 92449081296414.34, + "jx": 1.6499002361434856e+16, + "jy": 1568934856430368.5, + "jz": 2.2190671920159212e+16, + "rho": 298322648.1883917 }, "electrons": { "particle_momentum_x": 4.599605609558194e-19, @@ -15,28 +31,12 @@ "particle_position_y": 0.3695766840020302, "particle_weight": 216500976562500.75 }, - "lev=0": { - "Bx": 26338374.3731115, - "By": 160257.72168459874, - "Bz": 694868.2285976049, - "Ex": 56513906233209.63, - "Ey": 7806074074131210.0, - "Ez": 65816739650512.98, - "jx": 6873283793354275.0, - "jy": 4287548168426209.0, - "jz": 7506499988368183.0, - "rho": 278060758.9118884 - }, - "lev=1": { - "Bx": 41971136.54330983, - "By": 347834.7278931723, - "Bz": 1093489.2683699469, - "Ex": 136247072743280.97, - "Ey": 1.2435931966910504e+16, - "Ez": 92449079327862.72, - "jx": 1.6499002357270928e+16, - "jy": 1571736982354559.0, - "jz": 2.219065825081704e+16, - "rho": 298322648.1883917 + "beam": { + "particle_momentum_x": 4.560382242970367e-20, + "particle_momentum_y": 4.2263074230751857e-20, + "particle_momentum_z": 1.3639472455787962e-17, + "particle_position_x": 4.672031008809431e-05, + "particle_position_y": 0.0002438714470005561, + "particle_weight": 12483018148921.525 } } \ No newline at end of file diff --git a/Regression/Checksum/benchmarks_json/SemiImplicitPicard_1d.json b/Regression/Checksum/benchmarks_json/SemiImplicitPicard_1d.json new file mode 100644 index 00000000000..2c9859b037d --- /dev/null +++ b/Regression/Checksum/benchmarks_json/SemiImplicitPicard_1d.json @@ -0,0 +1,29 @@ +{ + "lev=0": { + "Bx": 3559.0541122456157, + "By": 1685.942868827529, + "Bz": 0.0, + "Ex": 796541204346.5195, + "Ey": 961740397927.6577, + "Ez": 3528140764527.8877, + "divE": 2.0829159085076083e+21, + "jx": 7.683674095607745e+17, + "jy": 1.4132459141738875e+18, + "jz": 1.350650739310074e+18, + "rho": 18442528652.19583 + }, + "protons": { + "particle_momentum_x": 5.231109104020749e-19, + "particle_momentum_y": 5.367985047933474e-19, + "particle_momentum_z": 5.253213505843665e-19, + "particle_position_x": 0.00010628272743703473, + "particle_weight": 5.314093261582036e+22 + }, + "electrons": { + "particle_momentum_x": 1.196357181461066e-20, + "particle_momentum_y": 1.2271903040162696e-20, + "particle_momentum_z": 1.2277743615209627e-20, + "particle_position_x": 0.0001064956905491333, + "particle_weight": 5.314093261582036e+22 + } +} diff --git a/Regression/Checksum/benchmarks_json/comoving_2d_psatd_hybrid.json b/Regression/Checksum/benchmarks_json/comoving_2d_psatd_hybrid.json index d62cd008670..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 @@ { - "beam": { - "particle_momentum_x": 6.875024052604206e-19, - "particle_momentum_y": 4.375444487966637e-19, - "particle_momentum_z": 6.432593176909762e-18, - "particle_position_x": 0.0012933598223665212, - "particle_position_y": 0.35872101659459354, - "particle_weight": 3120754537230.3823 - }, - "electrons": { - "particle_momentum_x": 7.058217306102507e-19, - "particle_momentum_y": 2.2042314720139012e-18, - "particle_momentum_z": 2.5305214299582585e-16, - "particle_position_x": 1.5006580327952221, - "particle_position_y": 16.454388306646475, - "particle_weight": 1.234867020725368e+18 + "lev=0": { + "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.6150569264030943e-18, - "particle_momentum_y": 2.2334239793537862e-18, - "particle_momentum_z": 4.279249530683602e-13, - "particle_position_x": 1.4883816864868449, - "particle_position_y": 16.452386504130835, + "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 }, - "lev=0": { - "Bx": 1118823.5061574595, - "By": 3248957.084212374, - "Bz": 280624.78102759377, - "Ex": 975532719061463.4, - "Ey": 402851207946673.1, - "Ez": 159049601047523.06, - "jx": 2.9997052529118484e+16, - "jy": 8.866616130905646e+16, - "jz": 3.163974567840701e+17, - "rho": 1059977703.1166165 + "electrons": { + "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.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 cfd4bc83a85..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 @@ { - "beam": { - "particle_momentum_x": 7.005046981277183e-19, - "particle_momentum_y": 4.375209352729912e-19, - "particle_momentum_z": 6.175459223479959e-18, - "particle_position_x": 0.001602571749982411, - "particle_position_y": 0.35897924403061005, - "particle_weight": 3120754537230.3823 - }, - "electrons": { - "particle_momentum_x": 6.240989852249656e-19, - "particle_momentum_y": 1.5790301798509742e-18, - "particle_momentum_z": 2.5064352637575283e-16, - "particle_position_x": 1.501413662801212, - "particle_position_y": 16.523781706919216, - "particle_weight": 1.2372401466086835e+18 + "lev=0": { + "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.4394968631660078e-18, - "particle_momentum_y": 1.5967458174525868e-18, - "particle_momentum_z": 4.2873406586841774e-13, - "particle_position_x": 1.4911814217840753, - "particle_position_y": 16.52196497877435, + "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 }, - "lev=0": { - "Bx": 1086731.2285090145, - "By": 2886537.258822082, - "Bz": 264280.80501631316, - "Ex": 867382744066315.0, - "Ey": 392669698675093.25, - "Ez": 146897949570681.72, - "jx": 2.7028852724044516e+16, - "jy": 8.615686606708202e+16, - "jz": 2.7328720244417827e+17, - "rho": 915931431.8889401 + "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.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/Checksum/benchmarks_json/ionization_boost.json b/Regression/Checksum/benchmarks_json/ionization_boost.json index cb02eeba5b0..35b2db84a1a 100644 --- a/Regression/Checksum/benchmarks_json/ionization_boost.json +++ b/Regression/Checksum/benchmarks_json/ionization_boost.json @@ -1,30 +1,30 @@ { + "lev=0": { + "Bx": 0.0, + "By": 18263123.342891, + "Bz": 0.0, + "Ex": 5472992180428804.0, + "Ey": 0.0, + "Ez": 922.5589707939612, + "jx": 12440856508004.96, + "jy": 0.0, + "jz": 78616.0000011086 + }, "electrons": { - "particle_momentum_x": 2.137334032699983e-17, + "particle_momentum_x": 2.1386770170623736e-17, "particle_momentum_y": 0.0, - "particle_momentum_z": 1.729179869336611e-17, - "particle_position_x": 0.11036860836114047, - "particle_position_y": 1.7121959960266107, - "particle_weight": 3.075501431906104e-09 + "particle_momentum_z": 1.7287241262743654e-17, + "particle_position_x": 0.11064981928849067, + "particle_position_y": 1.7121826057017473, + "particle_weight": 3.0755014319061045e-09 }, "ions": { "particle_ionizationLevel": 52741.0, - "particle_momentum_x": 3.63061972838759e-18, + "particle_momentum_x": 3.630619728387593e-18, "particle_momentum_y": 0.0, "particle_momentum_z": 1.0432995297946715e-13, - "particle_position_x": 0.021440031727258925, + "particle_position_x": 0.021439968272741083, "particle_position_y": 0.4742770090248555, "particle_weight": 5.000948082142308e-10 - }, - "lev=0": { - "Bx": 0.0, - "By": 18263123.342890996, - "Bz": 0.0, - "Ex": 5472992180428804.0, - "Ey": 0.0, - "Ez": 922.6036749671132, - "jx": 12440856508004.96, - "jy": 0.0, - "jz": 78616.00000110848 } -} +} \ No newline at end of file diff --git a/Regression/Checksum/benchmarks_json/ionization_lab.json b/Regression/Checksum/benchmarks_json/ionization_lab.json index f1be9ec3017..82984141b59 100644 --- a/Regression/Checksum/benchmarks_json/ionization_lab.json +++ b/Regression/Checksum/benchmarks_json/ionization_lab.json @@ -1,31 +1,31 @@ { - "electrons": { - "particle_momentum_x": 4.407898469197755e-18, - "particle_momentum_y": 0.0, - "particle_momentum_z": 2.642991174223682e-18, - "particle_orig_z": 0.43016526372226926, - "particle_position_x": 0.1095015206652257, - "particle_position_y": 0.6413864600981052, - "particle_weight": 3.443203125e-10 + "lev=0": { + "Bx": 0.0, + "By": 26296568.434868, + "Bz": 0.0, + "Ex": 7878103122971888.0, + "Ey": 0.0, + "Ez": 3027.995293554467, + "jx": 1.2111358330750162e+16, + "jy": 0.0, + "jz": 1.3575651149270143e-07 }, "ions": { "particle_ionizationLevel": 72897.0, - "particle_momentum_x": 1.761324005206226e-18, + "particle_momentum_x": 1.7613240052056494e-18, "particle_momentum_y": 0.0, - "particle_momentum_z": 3.618696690270335e-23, - "particle_position_x": 0.03199998819289686, + "particle_momentum_z": 3.6186967375178554e-23, + "particle_position_x": 0.0320000118071032, "particle_position_y": 0.12800000462171646, "particle_weight": 9.999999999999999e-11 }, - "lev=0": { - "Bx": 0.0, - "By": 26296568.43487075, - "Bz": 0.0, - "Ex": 7878103122973058.0, - "Ey": 0.0, - "Ez": 3027.995293554496, - "jx": 1.2111358333819302e+16, - "jy": 0.0, - "jz": 1.346772722412443e-07 + "electrons": { + "particle_momentum_x": 4.428135211584547e-18, + "particle_momentum_y": 0.0, + "particle_momentum_z": 2.6627518442038486e-18, + "particle_orig_z": 0.43043207622230534, + "particle_position_x": 0.11023346490802505, + "particle_position_y": 0.6417814148540429, + "particle_weight": 3.44453125e-10 } -} +} \ No newline at end of file diff --git a/Regression/Checksum/benchmarks_json/restart.json b/Regression/Checksum/benchmarks_json/restart.json index 9ed02d0faad..d8aa0788997 100644 --- a/Regression/Checksum/benchmarks_json/restart.json +++ b/Regression/Checksum/benchmarks_json/restart.json @@ -1,12 +1,15 @@ { - "beam": { - "particle_momentum_x": 4.178482505909375e-19, - "particle_momentum_y": 4.56492260137707e-19, - "particle_momentum_z": 2.733972888170628e-17, - "particle_position_x": 0.0003995213395426269, - "particle_position_y": 0.0004148795632360405, - "particle_position_z": 1.9019426942919677, - "particle_weight": 3120754537.230381 + "lev=0": { + "Bx": 115361.74185283793, + "By": 242516.32397638055, + "Bz": 62078.1602361236, + "Ex": 119701543932824.69, + "Ey": 20420953176049.12, + "Ez": 53561498853753.336, + "jx": 2.1550943713704252e+16, + "jy": 328452566832977.2, + "jz": 4525238578330174.0, + "rho": 22112877.392750103 }, "driver": { "particle_momentum_x": 4.700436405078562e+21, @@ -26,34 +29,31 @@ "particle_position_z": 0.4899808854005956, "particle_weight": 6241509074.460762 }, - "lev=0": { - "Bx": 115361.85363382133, - "By": 242516.41036288123, - "Bz": 62078.12299476949, - "Ex": 119701563770527.33, - "Ey": 20420746160110.2, - "Ez": 53561518084714.88, - "jx": 2.155094272131813e+16, - "jy": 328438528912277.4, - "jz": 4525204093100645.0, - "rho": 22113102.212642767 + "beam": { + "particle_momentum_x": 4.178482505909375e-19, + "particle_momentum_y": 4.56492260137707e-19, + "particle_momentum_z": 2.733972888170628e-17, + "particle_position_x": 0.0003995213395426269, + "particle_position_y": 0.0004148795632360405, + "particle_position_z": 1.9019426942919677, + "particle_weight": 3120754537.230381 }, - "plasma_e": { - "particle_momentum_x": 2.6421618201433585e-19, - "particle_momentum_y": 1.3141433018232061e-20, - "particle_momentum_z": 2.6326692402728787e-17, - "particle_position_x": 0.49916042906025937, - "particle_position_y": 0.4991834641855549, - "particle_position_z": 0.45626372602154797, + "plasma_p": { + "particle_momentum_x": 2.6392309174575904e-19, + "particle_momentum_y": 5.301543151656233e-21, + "particle_momentum_z": 4.829600619848831e-14, + "particle_position_x": 0.4991250033821341, + "particle_position_y": 0.49912499879083855, + "particle_position_z": 0.4563845472726038, "particle_weight": 33067341227104.594 }, - "plasma_p": { - "particle_momentum_x": 2.639231047445633e-19, - "particle_momentum_y": 5.302522423284582e-21, - "particle_momentum_z": 4.829600619851657e-14, - "particle_position_x": 0.4991250033821394, - "particle_position_y": 0.49912499879083844, - "particle_position_z": 0.45638454727260425, + "plasma_e": { + "particle_momentum_x": 2.6421607111722265e-19, + "particle_momentum_y": 1.3141424232991868e-20, + "particle_momentum_z": 2.6326692443085376e-17, + "particle_position_x": 0.49916042919135184, + "particle_position_y": 0.49918346422905135, + "particle_position_z": 0.4562637258155577, "particle_weight": 33067341227104.594 } } \ No newline at end of file diff --git a/Regression/Checksum/benchmarks_json/restart_psatd.json b/Regression/Checksum/benchmarks_json/restart_psatd.json index 81df3c64c4c..d22fb5b57e7 100644 --- a/Regression/Checksum/benchmarks_json/restart_psatd.json +++ b/Regression/Checksum/benchmarks_json/restart_psatd.json @@ -1,4 +1,16 @@ { + "lev=0": { + "Bx": 116102.13010406512, + "By": 245467.5412026496, + "Bz": 65305.35287114741, + "Ex": 118565481099326.73, + "Ey": 18640100573642.96, + "Ez": 51777969821120.38, + "jx": 2.1177246490642464e+16, + "jy": 351544815339900.3, + "jz": 4573466562652713.0, + "rho": 22294533.587530266 + }, "beam": { "particle_momentum_x": 4.178482505909375e-19, "particle_momentum_y": 4.56492260137707e-19, @@ -26,34 +38,22 @@ "particle_position_z": 0.4899808854005956, "particle_weight": 6241509074.460762 }, - "lev=0": { - "Bx": 116102.28415732287, - "By": 245468.57438100342, - "Bz": 65305.38781838063, - "Ex": 118565257880521.4, - "Ey": 18640027127418.004, - "Ez": 51777964618631.914, - "jx": 2.1177240176169996e+16, - "jy": 351529204246424.9, - "jz": 4573419547907262.0, - "rho": 22294773.912022192 - }, "plasma_e": { - "particle_momentum_x": 2.0912370354448323e-19, - "particle_momentum_y": 1.3510736736168866e-20, - "particle_momentum_z": 2.633607024821822e-17, - "particle_position_x": 0.4991733347875822, - "particle_position_y": 0.49919828067421096, - "particle_position_z": 0.4562416755755165, + "particle_momentum_x": 2.0912364079892767e-19, + "particle_momentum_y": 1.3510804924903876e-20, + "particle_momentum_z": 2.6336070297356917e-17, + "particle_position_x": 0.49917333523960167, + "particle_position_y": 0.49919828074154127, + "particle_position_z": 0.45624167532314724, "particle_weight": 33067341227104.625 }, "plasma_p": { - "particle_momentum_x": 2.105303160755537e-19, - "particle_momentum_y": 3.3281768098792752e-21, - "particle_momentum_z": 4.829599953650214e-14, - "particle_position_x": 0.4991250029759827, - "particle_position_y": 0.49912499825258744, - "particle_position_z": 0.4563845470979585, + "particle_momentum_x": 2.1053025446547977e-19, + "particle_momentum_y": 3.3272838305044046e-21, + "particle_momentum_z": 4.829599953646669e-14, + "particle_position_x": 0.49912500297599893, + "particle_position_y": 0.49912499825258866, + "particle_position_z": 0.45638454709795806, "particle_weight": 33067341227104.625 } } \ No newline at end of file diff --git a/Regression/Checksum/benchmarks_json/restart_psatd_time_avg.json b/Regression/Checksum/benchmarks_json/restart_psatd_time_avg.json index 344495f8144..50971f0d45e 100644 --- a/Regression/Checksum/benchmarks_json/restart_psatd_time_avg.json +++ b/Regression/Checksum/benchmarks_json/restart_psatd_time_avg.json @@ -1,4 +1,25 @@ { + "lev=0": { + "Bx": 115622.1878941125, + "By": 243403.66715242947, + "Bz": 63602.66529020351, + "Ex": 117118934931289.56, + "Ey": 18448377440588.27, + "Ez": 50821967818817.24, + "jx": 2.1044522674691452e+16, + "jy": 329314843111847.94, + "jz": 4524787623275627.0, + "rho": 22128883.53068064 + }, + "driverback": { + "particle_momentum_x": 4.813131349021332e+21, + "particle_momentum_y": 5.16548074090123e+21, + "particle_momentum_z": 3.005830430844926e+25, + "particle_position_x": 0.001649481123084974, + "particle_position_y": 0.0016172218745428432, + "particle_position_z": 0.4899808854005956, + "particle_weight": 6241509074.460762 + }, "beam": { "particle_momentum_x": 4.178482505909375e-19, "particle_momentum_y": 4.56492260137707e-19, @@ -8,6 +29,24 @@ "particle_position_z": 1.901942694291968, "particle_weight": 3120754537.230381 }, + "plasma_e": { + "particle_momentum_x": 1.9905288525315664e-19, + "particle_momentum_y": 1.2685401564810352e-20, + "particle_momentum_z": 2.6334746597885943e-17, + "particle_position_x": 0.4991702885212871, + "particle_position_y": 0.4991949978513417, + "particle_position_z": 0.4562491611716817, + "particle_weight": 33067341227104.625 + }, + "plasma_p": { + "particle_momentum_x": 2.002897995377179e-19, + "particle_momentum_y": 2.87423099731012e-21, + "particle_momentum_z": 4.8296000849128737e-14, + "particle_position_x": 0.49912500259846493, + "particle_position_y": 0.4991249979476612, + "particle_position_z": 0.45638454712861487, + "particle_weight": 33067341227104.625 + }, "driver": { "particle_momentum_x": 4.700436405078562e+21, "particle_momentum_y": 4.6785862113093076e+21, @@ -16,44 +55,5 @@ "particle_position_y": 0.0016212373149699414, "particle_position_z": 0.30417779498653386, "particle_weight": 6241509074.460762 - }, - "driverback": { - "particle_momentum_x": 4.813131349021332e+21, - "particle_momentum_y": 5.16548074090123e+21, - "particle_momentum_z": 3.005830430844926e+25, - "particle_position_x": 0.001649481123084974, - "particle_position_y": 0.0016172218745428432, - "particle_position_z": 0.4899808854005956, - "particle_weight": 6241509074.460762 - }, - "lev=0": { - "Bx": 115622.38124168929, - "By": 243405.25199746038, - "Bz": 63602.713209078014, - "Ex": 117118723119070.72, - "Ey": 18448325716024.688, - "Ez": 50821980097172.29, - "jx": 2.104451599585796e+16, - "jy": 329301545706958.4, - "jz": 4524740919108259.0, - "rho": 22129124.901803844 - }, - "plasma_e": { - "particle_momentum_x": 1.9905296213155052e-19, - "particle_momentum_y": 1.2685326003720766e-20, - "particle_momentum_z": 2.6334746549552728e-17, - "particle_position_x": 0.4991702881158205, - "particle_position_y": 0.4991949977965001, - "particle_position_z": 0.45624916139143146, - "particle_weight": 33067341227104.625 - }, - "plasma_p": { - "particle_momentum_x": 2.0028987523417718e-19, - "particle_momentum_y": 2.875037979316222e-21, - "particle_momentum_z": 4.8296000849162443e-14, - "particle_position_x": 0.49912500259844994, - "particle_position_y": 0.4991249979476608, - "particle_position_z": 0.4563845471286154, - "particle_weight": 33067341227104.625 } } \ No newline at end of file diff --git a/Regression/WarpX-GPU-tests.ini b/Regression/WarpX-GPU-tests.ini index 0566184848b..2a98d7b3736 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 = f1ec8df75c562d2a4822cea84d284cf8e72c2e14 [source] dir = /home/regtester/git/WarpX diff --git a/Regression/WarpX-tests.ini b/Regression/WarpX-tests.ini index da05ed4d5bc..f5ef38e881b 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 = f1ec8df75c562d2a4822cea84d284cf8e72c2e14 [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 @@ -4240,6 +4241,23 @@ doVis = 0 compareParticles = 0 analysisRoutine = Examples/Tests/scraping/analysis_rz.py +[scraping_filter] +buildDir = . +inputFile = Examples/Tests/scraping/inputs_rz_filter +runtime_params = warpx.abort_on_warning_threshold = medium +dim = 2 +addToCompileString = USE_EB=TRUE USE_RZ=TRUE USE_OPENPMD=TRUE +cmakeSetupOpts = -DWarpX_DIMS=RZ -DWarpX_EB=ON -DWarpX_OPENPMD=ON +restartTest = 0 +useMPI = 1 +numprocs = 2 +useOMP = 1 +numthreads = 1 +compileTest = 0 +doVis = 0 +compareParticles = 0 +analysisRoutine = Examples/Tests/scraping/analysis_rz_filter.py + [silver_mueller_1d] buildDir = . inputFile = Examples/Tests/silver_mueller/inputs_1d @@ -4463,6 +4481,23 @@ doVis = 0 compareParticles = 0 analysisRoutine = Examples/Tests/nodal_electrostatic/analysis_3d.py +[BeamBeamCollision] +buildDir = . +inputFile = Examples/Physics_applications/beam-beam_collision/inputs +runtime_params = warpx.abort_on_warning_threshold=high +dim = 3 +addToCompileString = USE_OPENPMD=TRUE +cmakeSetupOpts = -DWarpX_DIMS=3 -DWarpX_OPENPMD=ON +restartTest = 0 +useMPI = 1 +numprocs = 2 +useOMP = 1 +numthreads = 1 +compileTest = 0 +doVis = 0 +outputFile = BeamBeamCollision_plt +analysisRoutine = Examples/analysis_default_openpmd_regression.py + [ImplicitPicard_1d] buildDir = . inputFile = Examples/Tests/Implicit/inputs_1d @@ -4479,3 +4514,20 @@ compileTest = 0 doVis = 0 compareParticles = 1 analysisRoutine = Examples/Tests/Implicit/analysis_1d.py + +[SemiImplicitPicard_1d] +buildDir = . +inputFile = Examples/Tests/Implicit/inputs_1d_semiimplicit +runtime_params = warpx.abort_on_warning_threshold=high +dim = 1 +addToCompileString = +cmakeSetupOpts = -DWarpX_DIMS=1 +restartTest = 0 +useMPI = 1 +numprocs = 2 +useOMP = 0 +numthreads = 1 +compileTest = 0 +doVis = 0 +compareParticles = 1 +analysisRoutine = Examples/Tests/Implicit/analysis_1d.py 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 fd939b0370b..0e517e8190c 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 21d5ff699d0..53ce319d747 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/FlushFormats/FlushFormatAscent.cpp b/Source/Diagnostics/FlushFormats/FlushFormatAscent.cpp index 980047e3b46..c224bc4f871 100644 --- a/Source/Diagnostics/FlushFormats/FlushFormatAscent.cpp +++ b/Source/Diagnostics/FlushFormats/FlushFormatAscent.cpp @@ -94,9 +94,6 @@ FlushFormatAscent::WriteParticles(const amrex::Vector& particle_di // get names of real comps std::map real_comps_map = pc->getParticleComps(); - // WarpXParticleContainer compile-time extra AoS attributes (Real): 0 - // WarpXParticleContainer compile-time extra AoS attributes (int): 0 - // WarpXParticleContainer compile-time extra SoA attributes (Real): PIdx::nattribs // not an efficient search, but N is small... for(int j = 0; j < PIdx::nattribs; ++j) diff --git a/Source/Diagnostics/FlushFormats/FlushFormatCheckpoint.cpp b/Source/Diagnostics/FlushFormats/FlushFormatCheckpoint.cpp index 5f59cd723da..4486a6e0025 100644 --- a/Source/Diagnostics/FlushFormats/FlushFormatCheckpoint.cpp +++ b/Source/Diagnostics/FlushFormats/FlushFormatCheckpoint.cpp @@ -178,8 +178,8 @@ FlushFormatCheckpoint::CheckpointParticles ( Vector real_names; Vector int_names; + // note: positions skipped here, since we reconstruct a plotfile SoA from them real_names.push_back("weight"); - real_names.push_back("momentum_x"); real_names.push_back("momentum_y"); real_names.push_back("momentum_z"); diff --git a/Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp b/Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp index df73ed34c94..745ba39b37f 100644 --- a/Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp +++ b/Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp @@ -355,8 +355,8 @@ FlushFormatPlotfile::WriteParticles(const std::string& dir, Vector int_flags; Vector real_flags; + // note: positions skipped here, since we reconstruct a plotfile SoA from them real_names.push_back("weight"); - real_names.push_back("momentum_x"); real_names.push_back("momentum_y"); real_names.push_back("momentum_z"); diff --git a/Source/Diagnostics/MultiDiagnostics.H b/Source/Diagnostics/MultiDiagnostics.H index f9907b8bdc6..d220396ed12 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/FieldProbe.cpp b/Source/Diagnostics/ReducedDiags/FieldProbe.cpp index 0c23f3550a8..24ad0e64ea8 100644 --- a/Source/Diagnostics/ReducedDiags/FieldProbe.cpp +++ b/Source/Diagnostics/ReducedDiags/FieldProbe.cpp @@ -556,8 +556,7 @@ void FieldProbe::ComputeDiags (int step) amrex::ParticleReal xp, yp, zp; getPosition(ip, xp, yp, zp); long idx = ip*noutputs; - dvp[idx++] = idcpu[ip]; - dvp[idx++] = 0; + dvp[idx++] = amrex::ParticleIDWrapper{idcpu[ip]}; // all particles created on IO cpu dvp[idx++] = xp; dvp[idx++] = yp; dvp[idx++] = zp; diff --git a/Source/Diagnostics/ReducedDiags/FieldProbeParticleContainer.H b/Source/Diagnostics/ReducedDiags/FieldProbeParticleContainer.H index 06361b16286..7d59ade5dc6 100644 --- a/Source/Diagnostics/ReducedDiags/FieldProbeParticleContainer.H +++ b/Source/Diagnostics/ReducedDiags/FieldProbeParticleContainer.H @@ -24,7 +24,13 @@ struct FieldProbePIdx { enum { - x, y, z, +#if !defined (WARPX_DIM_1D_Z) + x, +#endif +#if defined (WARPX_DIM_3D) + y, +#endif + z, Ex, Ey, Ez, Bx, By, Bz, S, //!< the Poynting vector diff --git a/Source/Diagnostics/ReducedDiags/FieldProbeParticleContainer.cpp b/Source/Diagnostics/ReducedDiags/FieldProbeParticleContainer.cpp index f6f6d89f006..18137fe9b2c 100644 --- a/Source/Diagnostics/ReducedDiags/FieldProbeParticleContainer.cpp +++ b/Source/Diagnostics/ReducedDiags/FieldProbeParticleContainer.cpp @@ -109,9 +109,12 @@ FieldProbeParticleContainer::AddNParticles (int lev, #ifdef WARPX_DIM_RZ pinned_tile.push_back_real(FieldProbePIdx::theta, np, 0.0); #endif - +#if !defined (WARPX_DIM_1D_Z) pinned_tile.push_back_real(FieldProbePIdx::x, x); +#endif +#if defined (WARPX_DIM_3D) pinned_tile.push_back_real(FieldProbePIdx::y, y); +#endif pinned_tile.push_back_real(FieldProbePIdx::z, z); pinned_tile.push_back_real(FieldProbePIdx::Ex, np, 0.0); pinned_tile.push_back_real(FieldProbePIdx::Ey, np, 0.0); 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 cb7efc28941..110f1ada649 100644 --- a/Source/Diagnostics/WarpXOpenPMD.H +++ b/Source/Diagnostics/WarpXOpenPMD.H @@ -44,7 +44,7 @@ public: using ParticleIter = typename amrex::ParIterSoA; 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/Diagnostics/WarpXOpenPMD.cpp b/Source/Diagnostics/WarpXOpenPMD.cpp index c907484aa5c..d9b70a2e18d 100644 --- a/Source/Diagnostics/WarpXOpenPMD.cpp +++ b/Source/Diagnostics/WarpXOpenPMD.cpp @@ -546,6 +546,13 @@ for (unsigned i = 0, n = particle_diags.size(); i < n; ++i) { // see openPMD ED-PIC extension for namings // note: an underscore separates the record name from its component // for non-scalar records +#if !defined (WARPX_DIM_1D_Z) + real_names.push_back("position_x"); +#endif +#if defined (WARPX_DIM_3D) + real_names.push_back("position_y"); +#endif + real_names.push_back("position_z"); real_names.push_back("weighting"); real_names.push_back("momentum_x"); real_names.push_back("momentum_y"); @@ -587,20 +594,30 @@ for (unsigned i = 0, n = particle_diags.size(); i < n; ++i) { particle_diags[i].m_diag_domain); if (isBTD || use_pinned_pc) { - tmp.copyParticles(*pinned_pc, true); - particlesConvertUnits(ConvertDirection::WarpX_to_SI, &tmp, mass); + particlesConvertUnits(ConvertDirection::WarpX_to_SI, pinned_pc, mass); + using SrcData = WarpXParticleContainer::ParticleTileType::ConstParticleTileDataType; + tmp.copyParticles(*pinned_pc, + [random_filter,uniform_filter,parser_filter,geometry_filter] + AMREX_GPU_HOST_DEVICE + (const SrcData& src, int ip, const amrex::RandomEngine& engine) + { + const SuperParticleType& p = src.getSuperParticle(ip); + return random_filter(p, engine) * uniform_filter(p, engine) + * parser_filter(p, engine) * geometry_filter(p, engine); + }, true); + particlesConvertUnits(ConvertDirection::SI_to_WarpX, pinned_pc, mass); } else { particlesConvertUnits(ConvertDirection::WarpX_to_SI, pc, mass); using SrcData = WarpXParticleContainer::ParticleTileType::ConstParticleTileDataType; tmp.copyParticles(*pc, - [random_filter,uniform_filter,parser_filter,geometry_filter] - AMREX_GPU_HOST_DEVICE - (const SrcData& src, int ip, const amrex::RandomEngine& engine) - { - const SuperParticleType& p = src.getSuperParticle(ip); - return random_filter(p, engine) * uniform_filter(p, engine) - * parser_filter(p, engine) * geometry_filter(p, engine); - }, true); + [random_filter,uniform_filter,parser_filter,geometry_filter] + AMREX_GPU_HOST_DEVICE + (const SrcData& src, int ip, const amrex::RandomEngine& engine) + { + const SuperParticleType& p = src.getSuperParticle(ip); + return random_filter(p, engine) * uniform_filter(p, engine) + * parser_filter(p, engine) * geometry_filter(p, engine); + }, true); particlesConvertUnits(ConvertDirection::SI_to_WarpX, pc, mass); } @@ -821,10 +838,9 @@ WarpXOpenPMDPlot::SetupRealProperties (ParticleContainer const * pc, std::set< std::string > addedRecords; // add meta-data per record only once for (auto idx=0; idxNumRealComps(); idx++) { - auto ii = ParticleContainer::NStructReal + idx; // jump over extra AoS names - if (write_real_comp[ii]) { + if (write_real_comp[idx]) { // handle scalar and non-scalar records by name - const auto [record_name, component_name] = detail::name2openPMD(real_comp_names[ii]); + const auto [record_name, component_name] = detail::name2openPMD(real_comp_names[idx]); auto currRecord = currSpecies[record_name]; // meta data for ED-PIC extension @@ -845,10 +861,9 @@ WarpXOpenPMDPlot::SetupRealProperties (ParticleContainer const * pc, } } for (auto idx=0; idx 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/PlasmaInjector.cpp b/Source/Initialization/PlasmaInjector.cpp index 3b2ad76513a..008709abe48 100644 --- a/Source/Initialization/PlasmaInjector.cpp +++ b/Source/Initialization/PlasmaInjector.cpp @@ -501,18 +501,15 @@ void PlasmaInjector::setupExternalFile (amrex::ParmParse const& pp_species) } // IOProcessor // Broadcast charge and mass to non-IO processors if read in from the file - if (!charge_is_specified && !species_is_specified) { - // Use ReduceBoolOr since Bcast(bool) doesn't compile - amrex::ParallelDescriptor::ReduceBoolOr(charge_from_source, amrex::ParallelDescriptor::IOProcessorNumber()); - if (charge_from_source) { - amrex::ParallelDescriptor::Bcast(&charge, 1, amrex::ParallelDescriptor::IOProcessorNumber()); - } + std::array flags{charge_from_source, mass_from_source}; + amrex::ParallelDescriptor::Bcast(flags.data(), flags.size(), amrex::ParallelDescriptor::IOProcessorNumber()); + charge_from_source = flags[0]; + mass_from_source = flags[1]; + if (charge_from_source) { + amrex::ParallelDescriptor::Bcast(&charge, 1, amrex::ParallelDescriptor::IOProcessorNumber()); } - if (!mass_is_specified && !species_is_specified) { - amrex::ParallelDescriptor::ReduceBoolOr(mass_from_source, amrex::ParallelDescriptor::IOProcessorNumber()); - if (mass_from_source) { - amrex::ParallelDescriptor::Bcast(&mass, 1, amrex::ParallelDescriptor::IOProcessorNumber()); - } + if (mass_from_source) { + amrex::ParallelDescriptor::Bcast(&mass, 1, amrex::ParallelDescriptor::IOProcessorNumber()); } #else WARPX_ABORT_WITH_MESSAGE( diff --git a/Source/Initialization/WarpXInitData.cpp b/Source/Initialization/WarpXInitData.cpp index 3b36a6336bf..169453a6e99 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/BinaryCollision/DSMC/CollisionFilterFunc.H b/Source/Particles/Collision/BinaryCollision/DSMC/CollisionFilterFunc.H index a847b841ee2..c714cfdb133 100644 --- a/Source/Particles/Collision/BinaryCollision/DSMC/CollisionFilterFunc.H +++ b/Source/Particles/Collision/BinaryCollision/DSMC/CollisionFilterFunc.H @@ -77,18 +77,8 @@ void CollisionPairFilter (const amrex::ParticleReal& u1x, const amrex::ParticleR // In principle this is obtained by computing 1 - exp(-probability_estimate) // However, the computation of this quantity can fail numerically when probability_estimate is // too small (e.g. exp(-probability_estimate) returns 1 and the computation returns 0). - // In this case, we simply use "probability_estimate" instead of 1 - exp(-probability_estimate) - // The threshold exp_threshold at which we switch between the two formulas is determined by the - // fact that computing the exponential is only useful if it can resolve the x^2/2 term of its - // Taylor expansion, i.e. the square of probability_estimate should be greater than the - // machine epsilon. -#ifdef AMREX_SINGLE_PRECISION_PARTICLES - constexpr auto exp_threshold = amrex::ParticleReal(1.e-3); -#else - constexpr auto exp_threshold = amrex::ParticleReal(5.e-8); -#endif - const amrex::ParticleReal probability = (exponent < exp_threshold) ? - exponent: 1._prt - std::exp(-exponent); + // std::expm1 is used since it maintains correctness for small exponent. + const amrex::ParticleReal probability = -std::expm1(-exponent); // Now we determine if a collision should occur if (amrex::Random(engine) < probability) diff --git a/Source/Particles/Collision/BinaryCollision/NuclearFusion/SingleNuclearFusionEvent.H b/Source/Particles/Collision/BinaryCollision/NuclearFusion/SingleNuclearFusionEvent.H index bd0c6b06d6f..07e0174438b 100644 --- a/Source/Particles/Collision/BinaryCollision/NuclearFusion/SingleNuclearFusionEvent.H +++ b/Source/Particles/Collision/BinaryCollision/NuclearFusion/SingleNuclearFusionEvent.H @@ -113,18 +113,8 @@ void SingleNuclearFusionEvent (const amrex::ParticleReal& u1x, const amrex::Part // In principle this is obtained by computing 1 - exp(-probability_estimate) // However, the computation of this quantity can fail numerically when probability_estimate is // too small (e.g. exp(-probability_estimate) returns 1 and the computation returns 0). - // In this case, we simply use "probability_estimate" instead of 1 - exp(-probability_estimate) - // The threshold exp_threshold at which we switch between the two formulas is determined by the - // fact that computing the exponential is only useful if it can resolve the x^2/2 term of its - // Taylor expansion, i.e. the square of probability_estimate should be greater than the - // machine epsilon. -#ifdef AMREX_SINGLE_PRECISION_PARTICLES - constexpr auto exp_threshold = amrex::ParticleReal(1.e-3); -#else - constexpr auto exp_threshold = amrex::ParticleReal(5.e-8); -#endif - const amrex::ParticleReal probability = (probability_estimate < exp_threshold) ? - probability_estimate: 1._prt - std::exp(-probability_estimate); + // std::expm1 is used since it maintains correctness for small exponent. + const amrex::ParticleReal probability = -std::expm1(-probability_estimate); // Get a random number const amrex::ParticleReal random_number = amrex::Random(engine); 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/LaserParticleContainer.cpp b/Source/Particles/LaserParticleContainer.cpp index 88da5b0afad..fd4e9397253 100644 --- a/Source/Particles/LaserParticleContainer.cpp +++ b/Source/Particles/LaserParticleContainer.cpp @@ -870,7 +870,7 @@ LaserParticleContainer::update_laser_particle (WarpXParIter& pti, np, [=] AMREX_GPU_DEVICE (int i) { // Calculate the velocity according to the amplitude of E - const Real sign_charge = (pwp[i]>0) ? 1 : -1; + const Real sign_charge = (pwp[i]>0) ? -1 : 1; const Real v_over_c = sign_charge * tmp_mobility * amplitude[i]; AMREX_ALWAYS_ASSERT_WITH_MESSAGE(amrex::Math::abs(v_over_c) < amrex::Real(1.), "Error: calculated laser particle velocity greater than c." diff --git a/Source/Particles/NamedComponentParticleContainer.H b/Source/Particles/NamedComponentParticleContainer.H index 15457abb17b..e04e7dba6df 100644 --- a/Source/Particles/NamedComponentParticleContainer.H +++ b/Source/Particles/NamedComponentParticleContainer.H @@ -79,6 +79,13 @@ public: NamedComponentParticleContainer (amrex::AmrParGDB* amr_pgdb) : amrex::ParticleContainerPureSoA(amr_pgdb) { // build up the map of string names to particle component numbers +#if !defined (WARPX_DIM_1D_Z) + particle_comps["x"] = PIdx::x; +#endif +#if defined (WARPX_DIM_3D) + particle_comps["y"] = PIdx::y; +#endif + particle_comps["z"] = PIdx::z; particle_comps["w"] = PIdx::w; particle_comps["ux"] = PIdx::ux; particle_comps["uy"] = PIdx::uy; 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 a030fb68227..edf91a84526 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 93fe603b8b5..fd55e369040 100644 --- a/Source/Particles/PhysicalParticleContainer.cpp +++ b/Source/Particles/PhysicalParticleContainer.cpp @@ -235,7 +235,7 @@ namespace if (has_breit_wheeler) {p_optical_depth_BW[ip] = 0._rt;} #endif - amrex::ParticleIDWrapper{idcpu[ip]} = uint64_t(-1); + amrex::ParticleIDWrapper{idcpu[ip]} = -1; } } @@ -472,7 +472,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 @@ -809,7 +809,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 f01677fccfc..a244afc2389 100644 --- a/Source/Particles/WarpXParticleContainer.H +++ b/Source/Particles/WarpXParticleContainer.H @@ -443,6 +443,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; @@ -451,6 +452,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 7a7c5ee89c1..c9aa24d3973 100644 --- a/Source/WarpX.H +++ b/Source/WarpX.H @@ -727,7 +727,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 /** @@ -1020,6 +1020,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..316b68410c0 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 "f1ec8df75c562d2a4822cea84d284cf8e72c2e14" 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..175d3cab79e 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 "0283db4c8825b5e094b9184fd42a267ca843c61c" CACHE STRING "Repository branch for WarpX_pyamrex_repo if(WarpX_pyamrex_internal)") diff --git a/run_test.sh b/run_test.sh index deb4939da51..5dd813829c7 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 f1ec8df75c562d2a4822cea84d284cf8e72c2e14 && 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.',