Skip to content

Commit

Permalink
Merge branch 'development' into add_analysis_embedded_boundary_remova…
Browse files Browse the repository at this point in the history
…l_depth
  • Loading branch information
RemiLehe committed Dec 13, 2024
2 parents fe118a7 + 5bc4790 commit 737df48
Show file tree
Hide file tree
Showing 89 changed files with 1,695 additions and 327 deletions.
17 changes: 4 additions & 13 deletions .github/workflows/clang_sanitizers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ concurrency:
jobs:
build_UB_sanitizer:
name: Clang UB sanitizer
runs-on: ubuntu-22.04
container: ubuntu:23.10
runs-on: ubuntu-24.04
if: github.event.pull_request.draft == false
env:
CC: clang
Expand Down Expand Up @@ -65,10 +64,6 @@ jobs:
- name: run with UB sanitizer
run: |
# We need these two lines because these tests run inside a docker container
export OMPI_ALLOW_RUN_AS_ROOT=1
export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1
export OMP_NUM_THREADS=2
#MPI implementations often leak memory
Expand All @@ -81,9 +76,9 @@ jobs:
build_thread_sanitizer:
name: Clang thread sanitizer
runs-on: ubuntu-22.04
container: ubuntu:23.10
if: github.event.pull_request.draft == false
runs-on: ubuntu-24.04
# TODO Fix data race conditions and re-enable job
if: 0 #github.event.pull_request.draft == false
env:
CC: clang
CXX: clang++
Expand Down Expand Up @@ -149,10 +144,6 @@ jobs:
export TSAN_OPTIONS='ignore_noninstrumented_modules=1'
export ARCHER_OPTIONS="verbose=1"
# We need these two lines because these tests run inside a docker container
export OMPI_ALLOW_RUN_AS_ROOT=1
export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1
export OMP_NUM_THREADS=2
mpirun -n 2 ./build/bin/warpx.rz Examples/Physics_applications/laser_acceleration/inputs_base_rz warpx.serialize_initial_conditions = 0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ jobs:
which nvcc || echo "nvcc not in PATH!"
git clone https://github.com/AMReX-Codes/amrex.git ../amrex
cd ../amrex && git checkout --detach 456c93c7d9512f1cdffac0574973d7df41417898 && cd -
cd ../amrex && git checkout --detach 96db0a665ff1e6bbe638490fd02d3aafb9188f6b && cd -
make COMP=gcc QED=FALSE USE_MPI=TRUE USE_GPU=TRUE USE_OMP=FALSE USE_FFT=TRUE USE_CCACHE=TRUE -j 4
ccache -s
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/dependencies/clang17.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@

set -eu -o pipefail

# This dependency file is currently used within a docker container,
# which does not come with sudo.
apt-get -qqq update
apt-get -y install sudo

# `man apt.conf`:
# Number of retries to perform. If this is non-zero APT will retry
# failed files the given number of times.
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ repos:
# Python: Ruff linter & formatter
# https://docs.astral.sh/ruff/
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.3
rev: v0.8.2
hooks:
# Run the linter
- id: ruff
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Preamble ####################################################################
#
cmake_minimum_required(VERSION 3.24.0)
project(WarpX VERSION 24.11)
project(WarpX VERSION 24.12)

include(${WarpX_SOURCE_DIR}/cmake/WarpXFunctions.cmake)

Expand Down
2 changes: 1 addition & 1 deletion Docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ openpmd-viewer # for checksumAPI

# PICMI API docs
# note: keep in sync with version in ../requirements.txt
picmistandard==0.31.0
picmistandard==0.33.0
# for development against an unreleased PICMI version, use:
# picmistandard @ git+https://github.com/picmi-standard/picmi.git#subdirectory=PICMI_Python

Expand Down
4 changes: 2 additions & 2 deletions Docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ def __init__(self, *args, **kwargs):
# built documents.
#
# The short X.Y version.
version = "24.11"
version = "24.12"
# The full version, including alpha/beta/rc tags.
release = "24.11"
release = "24.12"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
12 changes: 12 additions & 0 deletions Docs/source/refs.bib
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,18 @@ @article{VayFELB2009
url = {https://doi.org/10.1063/1.3080930},
}

@article{Barnes2021,
title = {Improved C1 shape functions for simplex meshes},
author = {D.C. Barnes},
journal = {Journal of Computational Physics},
volume = {424},
pages = {109852},
year = {2021},
issn = {0021-9991},
doi = {https://doi.org/10.1016/j.jcp.2020.109852},
url = {https://www.sciencedirect.com/science/article/pii/S0021999120306264},
}

@article{Rhee1987,
author = {Rhee, M. J. and Schneider, R. F. and Weidman, D. J.},
title = "{Simple time‐resolving Thomson spectrometer}",
Expand Down
53 changes: 37 additions & 16 deletions Docs/source/usage/parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,23 @@ Overall simulation parameters
\boldsymbol{\nabla}^2 \phi = - \rho/\epsilon_0 \qquad \boldsymbol{E} = - \boldsymbol{\nabla}\phi \\
\boldsymbol{\nabla}^2 \boldsymbol{A} = - \mu_0 \boldsymbol{j} \qquad \boldsymbol{B} = \boldsymbol{\nabla}\times\boldsymbol{A}
* ``labframe-effective-potential``: Poisson's equation is solved with a modified dielectric function
(resulting in an "effective potential") to create a semi-implicit scheme which is robust to the
numerical instability seen in explicit electrostatic PIC when :math:`\Delta t \omega_{pe} > 2`.
If this option is used the additional parameter ``warpx.effective_potential_factor`` can also be
specified to set the value of :math:`C_{EP}` (default 4). The method is stable for :math:`C_{EP} \geq 1`
regardless of :math:`\Delta t`, however, the larger :math:`C_{EP}` is set, the lower the numerical plasma
frequency will be and therefore care must be taken to not set it so high that the plasma mode
hybridizes with other modes of interest.
Details of the method can be found in Appendix A of :cite:t:`param-Barnes2021` (note that in that paper
the method is referred to as "semi-implicit electrostatic" but here it has been renamed to "effective potential"
to avoid confusion with the semi-implicit method of Chen et al.).
In short, the code solves:

.. math::
\boldsymbol{\nabla}\cdot\left(1+\frac{C_{EP}}{4}\sum_{s \in \text{species}}(\omega_{ps}\Delta t)^2 \right)\boldsymbol{\nabla} \phi = - \rho/\epsilon_0 \qquad \boldsymbol{E} = - \boldsymbol{\nabla}\phi
* ``relativistic``: Poisson's equation is solved **for each species**
in their respective rest frame. The corresponding field
is mapped back to the simulation frame and will produce both E and B
Expand Down Expand Up @@ -2680,7 +2697,7 @@ WarpX has five types of diagnostics:
``TimeAveraged`` diagnostics only allow field data, which they output after averaging over a period of time,
``BackTransformed`` diagnostics are used when running a simulation in a boosted frame, to reconstruct output data to the lab frame,
``BoundaryScraping`` diagnostics are used to collect the particles that are absorbed at the boundary, throughout the simulation, and
``ReducedDiags`` allow the user to compute some reduced quantity (particle temperature, max of a field) and write a small amount of data to text files.
``ReducedDiags`` enable users to compute specific reduced quantities, such as particle temperature, energy histograms, or maximum field values, and efficiently save this in-situ analyzed data to files.
Similar to what is done for physical species, WarpX has a class Diagnostics that allows users to initialize different diagnostics, each of them with different fields, resolution and period.
This currently applies to standard diagnostics, but should be extended to back-transformed diagnostics and reduced diagnostics (and others) in a near future.

Expand Down Expand Up @@ -3064,23 +3081,22 @@ In addition to their usual attributes, the saved particles have
Reduced Diagnostics
^^^^^^^^^^^^^^^^^^^

``ReducedDiags`` allow the user to compute some reduced quantity (particle temperature, max of a field) and write a small amount of data to text files.
``ReducedDiags`` enable users to compute specific reduced quantities, such as particle temperature, energy histograms, or maximum field values, and efficiently save this in-situ analyzed data to files.
This shifts analysis from post-processing to runtime calculation of reduction operations (average, maximum, ...) and can greatly save disk space when "raw" particle and field outputs from `FullDiagnostics` can be avoided in favor of single values, 1D or 2D data at possibly even higher time resolution.

* ``warpx.reduced_diags_names`` (`strings`, separated by spaces)
The names given by the user of simple reduced diagnostics.
Also the names of the output `.txt` files.
This reduced diagnostics aims to produce simple outputs
of the time history of some physical quantities.
A list of user-given names for reduced diagnostics.
By default, these names are also prefixing the names of output files.
If ``warpx.reduced_diags_names`` is not provided in the input file,
no reduced diagnostics will be done.
no reduced diagnostics will be activated during the run.
This is then used in the rest of the input deck;
in this documentation we use ``<reduced_diags_name>`` as a placeholder.

* ``<reduced_diags_name>.type`` (`string`)
The type of reduced diagnostics associated with this ``<reduced_diags_name>``.
For example, ``ParticleEnergy``, ``FieldEnergy``, etc.
All available types are described below in detail.
For all reduced diagnostics,
For all reduced diagnostics that are writing tabular data into text files,
the first and the second columns in the output file are
the time step and the corresponding physical time in seconds, respectively.

Expand Down Expand Up @@ -3590,22 +3606,27 @@ Reduced Diagnostics
* ``Timestep``
This type outputs the simulation's physical timestep (in seconds) at each mesh refinement level.

* ``<reduced_diags_name>.intervals`` (`string`)
* ``reduced_diags.intervals`` (`string`)
Using the `Intervals Parser`_ syntax, this string defines the timesteps at which reduced
diagnostics are written to file.
diagnostics are written to the file.
This can also be specified for the specific diagnostic by setting ``<reduced_diags_name>.intervals``.

* ``<reduced_diags_name>.path`` (`string`) optional (default `./diags/reducedfiles/`)
The path that the output file will be stored.
* ``reduced_diags.path`` (`string`) optional (default `./diags/reducedfiles/`)
The path where the output file will be stored.
This can also be specified for the specific diagnostic by setting ``<reduced_diags_name>.path``.

* ``<reduced_diags_name>.extension`` (`string`) optional (default `txt`)
The extension of the output file.
* ``reduced_diags.extension`` (`string`) optional (default `txt`)
The extension of the output file (the suffix).
This can also be specified for the specific diagnostic by setting ``<reduced_diags_name>.extension``.

* ``<reduced_diags_name>.separator`` (`string`) optional (default a `whitespace`)
* ``reduced_diags.separator`` (`string`) optional (default a `whitespace`)
The separator between row values in the output file.
The default separator is a whitespace.
This can also be specified for the specific diagnostic by setting ``<reduced_diags_name>.separator``.

* ``<reduced_diags_name>.precision`` (`integer`) optional (default `14`)
* ``reduced_diags.precision`` (`integer`) optional (default `14`)
The precision used when writing out the data to the text files.
This can also be specified for the specific diagnostic by setting ``<reduced_diags_name>.precision``.

Lookup tables and other settings for QED modules
------------------------------------------------
Expand Down
4 changes: 4 additions & 0 deletions Docs/source/usage/python.rst
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ Particle distributions can be used for to initialize particles in a particle spe

.. autoclass:: pywarpx.picmi.AnalyticDistribution

.. autoclass:: pywarpx.picmi.UniformFluxDistribution

.. autoclass:: pywarpx.picmi.AnalyticFluxDistribution

.. autoclass:: pywarpx.picmi.ParticleListDistribution

Particle layouts determine how to microscopically place macro particles in a grid cell.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@
histuH_rdiag = picmi.ReducedDiagnostic(
diag_type="ParticleHistogram",
name="histuH",
period=100,
species=hydrogen,
bin_number=1000,
bin_min=0.0,
Expand All @@ -208,7 +207,6 @@
histue_rdiag = picmi.ReducedDiagnostic(
diag_type="ParticleHistogram",
name="histue",
period=100,
species=electrons,
bin_number=1000,
bin_min=0.0,
Expand All @@ -222,7 +220,6 @@
histuzAll_rdiag = picmi.ReducedDiagnostic(
diag_type="ParticleHistogram",
name="histuzAll",
period=100,
species=hydrogen,
bin_number=1000,
bin_min=-0.474,
Expand All @@ -233,7 +230,6 @@
field_probe_z_rdiag = picmi.ReducedDiagnostic(
diag_type="FieldProbe",
name="FieldProbe_Z",
period=100,
integrate=0,
probe_geometry="Line",
x_probe=0.0,
Expand All @@ -246,7 +242,6 @@
field_probe_scat_point_rdiag = picmi.ReducedDiagnostic(
diag_type="FieldProbe",
name="FieldProbe_ScatPoint",
period=1,
integrate=0,
probe_geometry="Point",
x_probe=0.0,
Expand All @@ -256,7 +251,6 @@
field_probe_scat_line_rdiag = picmi.ReducedDiagnostic(
diag_type="FieldProbe",
name="FieldProbe_ScatLine",
period=100,
integrate=1,
probe_geometry="Line",
x_probe=-2.5e-6,
Expand All @@ -267,7 +261,8 @@
)

load_balance_costs_rdiag = picmi.ReducedDiagnostic(
diag_type="LoadBalanceCosts", name="LBC", period=100
diag_type="LoadBalanceCosts",
name="LBC",
)

# Set up simulation
Expand All @@ -278,6 +273,7 @@
particle_shape="cubic",
warpx_numprocs=[1, 2], # deactivate `numprocs` for dynamic load balancing
warpx_use_filter=1,
warpx_reduced_diags_intervals=100,
warpx_load_balance_intervals=100,
warpx_load_balance_costs_update="heuristic",
)
Expand Down
1 change: 1 addition & 0 deletions Examples/Tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ add_subdirectory(restart)
add_subdirectory(restart_eb)
add_subdirectory(rigid_injection)
add_subdirectory(scraping)
add_subdirectory(effective_potential_electrostatic)
add_subdirectory(silver_mueller)
add_subdirectory(single_particle)
add_subdirectory(space_charge_initialization)
Expand Down
12 changes: 12 additions & 0 deletions Examples/Tests/effective_potential_electrostatic/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Add tests (alphabetical order) ##############################################
#

add_warpx_test(
test_3d_effective_potential_electrostatic_picmi # name
3 # dims
2 # nprocs
inputs_test_3d_effective_potential_electrostatic_picmi.py # inputs
analysis.py # analysis
diags/field_diag/ # output
OFF # dependency
)
Loading

0 comments on commit 737df48

Please sign in to comment.