Skip to content

Commit b14c2ed

Browse files
committed
Merge BLAST-WarpX:development into EZoni:ci_docs_skip_checks
2 parents a426481 + 3960f80 commit b14c2ed

File tree

262 files changed

+5700
-3922
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

262 files changed

+5700
-3922
lines changed

.azure-pipelines.yml

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- mode: yaml -*-
22

33
pool:
4-
vmImage: 'ubuntu-20.04'
4+
vmImage: 'ubuntu-24.04'
55

66
trigger:
77
branches:
@@ -52,9 +52,12 @@ jobs:
5252
timeoutInMinutes: 240
5353

5454
steps:
55-
# set up caches:
55+
# Ccache caching:
5656
# - once stored under a key, they become immutable (even if cache content changes)
5757
# - for a refresh the key has to change, e.g., hash of a tracked file in the key
58+
- bash: |
59+
mkdir -p /home/vsts/.ccache
60+
displayName: 'Create Ccache Directory'
5861
- task: Cache@2
5962
continueOnError: true
6063
inputs:
@@ -64,7 +67,7 @@ jobs:
6467
Ccache | "$(System.JobName)" | .azure-pipelines.yml
6568
path: /home/vsts/.ccache
6669
cacheHitVar: CCACHE_CACHE_RESTORED
67-
displayName: Cache Ccache Objects
70+
displayName: 'Cache Ccache Objects'
6871

6972
- bash: |
7073
set -o nounset errexit pipefail
@@ -111,6 +114,10 @@ jobs:
111114
-DCMAKE_CXX_STANDARD=17 \
112115
-Duse_cmake_find_lapack=ON -Dbuild_tests=OFF -DCMAKE_VERBOSE_MAKEFILE=ON
113116
fi
117+
# Remove system copy of Matplotlib to avoid conflict
118+
# with version set in the requirements file - see, e.g.,
119+
# https://github.com/matplotlib/matplotlib/issues/28768.
120+
sudo apt remove python3-matplotlib
114121
# Python modules required for test analysis
115122
python3 -m pip install --upgrade -r Regression/requirements.txt
116123
python3 -m pip cache purge

.github/workflows/clang_sanitizers.yml

+18-18
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ jobs:
2727
${{ github.event.pull_request.head.repo.clone_url }}
2828
outputs:
2929
skip: ${{ env.SKIP_CHECKS }}
30+
3031
build_UB_sanitizer:
3132
name: Clang UB sanitizer
3233
runs-on: ubuntu-24.04
@@ -82,12 +83,13 @@ jobs:
8283
mpirun -n 2 ./build/bin/warpx.1d Examples/Physics_applications/laser_acceleration/inputs_base_1d
8384
mpirun -n 2 ./build/bin/warpx.2d Examples/Physics_applications/laser_acceleration/inputs_base_2d
8485
mpirun -n 2 ./build/bin/warpx.3d Examples/Physics_applications/laser_acceleration/inputs_base_3d
86+
mpirun -n 2 ./build/bin/warpx.2d Examples/Tests/implicit/inputs_test_2d_theta_implicit_jfnk_vandb
87+
8588
build_thread_sanitizer:
8689
name: Clang thread sanitizer
8790
runs-on: ubuntu-24.04
88-
# TODO Fix data race conditions and re-enable job
8991
needs: skip_checks
90-
if: 0 #${{ github.event.pull_request.draft == false && needs.skip_checks.outputs.skip == 'false' }}
92+
if: ${{ github.event.pull_request.draft == false && needs.skip_checks.outputs.skip == 'false' }}
9193
env:
9294
CC: clang
9395
CXX: clang++
@@ -124,30 +126,28 @@ jobs:
124126
-DWarpX_QED=ON \
125127
-DWarpX_QED_TABLE_GEN=ON \
126128
-DWarpX_OPENPMD=ON \
127-
-DWarpX_EB=OFF \
128129
-DWarpX_PRECISION=DOUBLE \
129130
-DWarpX_PARTICLE_PRECISION=DOUBLE
130131
cmake --build build -j 4
131-
cmake -S . -B build_EB \
132-
-GNinja \
133-
-DCMAKE_VERBOSE_MAKEFILE=ON \
134-
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
135-
-DWarpX_DIMS="2" \
136-
-DWarpX_FFT=ON \
137-
-DWarpX_QED=ON \
138-
-DWarpX_QED_TABLE_GEN=ON \
139-
-DWarpX_OPENPMD=ON \
140-
-DWarpX_EB=ON \
141-
-DWarpX_PRECISION=DOUBLE \
142-
-DWarpX_PARTICLE_PRECISION=DOUBLE
143-
cmake --build build_EB -j 4
144132
ccache -s
145133
du -hs ~/.cache/ccache
146134
- name: Run with thread sanitizer
147135
run: |
136+
# Disabling the gds/shmem component by using gds/hash instead
137+
# is required to avoid issues with shared memory.
148138
export PMIX_MCA_gds=hash
149-
export TSAN_OPTIONS='ignore_noninstrumented_modules=1'
139+
# Archer is a data race detector for OpenMP programs.
140+
# It is required to avoid false positives with OpenMP and it is
141+
# included in llvm. However with many Linux it is necessary
142+
# to define this environment variable to make sure that the
143+
# Archer library is actually used.
144+
# When the Archer library is used and ARCHER_OPTIONS="verbose=1",
145+
# the following message should be displayed:
146+
# Archer detected OpenMP application with TSan, supplying OpenMP synchronization semantics
147+
export OMP_TOOL_LIBRARIES=/usr/lib/llvm-17/lib/libarcher.so
150148
export ARCHER_OPTIONS="verbose=1"
149+
# This option is required to avoid false positive reports from the OpenMP runtime
150+
export TSAN_OPTIONS='ignore_noninstrumented_modules=1'
151151
export OMP_NUM_THREADS=2
152152
mpirun -n 2 ./build/bin/warpx.rz Examples/Physics_applications/laser_acceleration/inputs_base_rz warpx.serialize_initial_conditions = 0
153153
mpirun -n 2 ./build/bin/warpx.1d Examples/Physics_applications/laser_acceleration/inputs_base_1d warpx.serialize_initial_conditions = 0
@@ -156,4 +156,4 @@ jobs:
156156
git clone https://github.com/BLAST-WarpX/warpx-data ../warpx-data
157157
cd Examples/Tests/embedded_circle
158158
ulimit -c unlimited
159-
mpirun -n 2 ../../../build_EB/bin/warpx.2d inputs_test_2d_embedded_circle warpx.serialize_initial_conditions = 0
159+
mpirun -n 2 ../../../build/bin/warpx.2d inputs_test_2d_embedded_circle warpx.serialize_initial_conditions = 0

.github/workflows/cuda.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ jobs:
134134
export LD_LIBRARY_PATH=/usr/local/nvidia/lib:/usr/local/nvidia/lib64:/usr/local/cuda/lib64:${LD_LIBRARY_PATH}
135135
which nvcc || echo "nvcc not in PATH!"
136136
git clone https://github.com/AMReX-Codes/amrex.git ../amrex
137-
cd ../amrex && git checkout --detach 25.03 && cd -
137+
cd ../amrex && git checkout --detach e24e4a8c4df84ed71f961efe7637f86ba1c2ce62 && cd -
138138
make COMP=gcc QED=FALSE USE_MPI=TRUE USE_GPU=TRUE USE_OMP=FALSE USE_FFT=TRUE USE_CCACHE=TRUE -j 4
139139
ccache -s
140140
du -hs ~/.cache/ccache

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ repos:
7373
# Python: Ruff linter & formatter
7474
# https://docs.astral.sh/ruff/
7575
- repo: https://github.com/astral-sh/ruff-pre-commit
76-
rev: v0.11.2
76+
rev: v0.11.4
7777
hooks:
7878
# Run the linter
7979
- id: ruff

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Preamble ####################################################################
22
#
33
cmake_minimum_required(VERSION 3.24.0)
4-
project(WarpX VERSION 25.03)
4+
project(WarpX VERSION 25.04)
55

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

Docs/source/conf.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ def __init__(self, *args, **kwargs):
112112
# built documents.
113113
#
114114
# The short X.Y version.
115-
version = "25.03"
115+
version = "25.04"
116116
# The full version, including alpha/beta/rc tags.
117-
release = "25.03"
117+
release = "25.04"
118118

119119
# The language for content autogenerated by Sphinx. Refer to documentation
120120
# for a list of supported languages.

Docs/source/highlights.rst

+5
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,11 @@ Related works using WarpX:
219219
Nuclear Fusion and Plasma Confinement
220220
*************************************
221221

222+
#. Tyushev M., Smolyakov A., Sabo A., Groenewald R., Necas A., and Yushmanov P.
223+
**Drift-kinetic PIC simulations of plasma flow and energy transport in the magnetic mirror configuration**.
224+
Physics of Plasmas **32**, 032514, 2025.
225+
`DOI:10.1063/5.0227040 <https://doi.org/10.1063/5.0227040>`__
226+
222227
#. Tyushev M., Papahn Zadeh M., Chopra N. S., Raitses Y., Romadanov I., Likhanskii A., Fubiani G., Garrigues L., Groenewald R. and Smolyakov A.
223228
**Mode transitions and spoke structures in E×B Penning discharge**.
224229
Physics of Plasmas **32**, 013511, 2025.

Docs/source/usage/parameters.rst

+4
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ Overall simulation parameters
126126
, this sets the relative tolerance for the iterative method used to obtain a self-consistent update of the particles at
127127
each iteration in the JFNK process.
128128

129+
* ``implicit_evolve.use_mass_matrices`` (`bool`, default: false)
130+
When `algo.evolve_scheme` is either `theta_implicit_em`, `strang_implicit_spectral_em`, or `semi_implicit_em` and `implicit_evolve.nonlinear_solver = newton` and a preconditioner is being used
131+
, the diagonal components of the diagonal mass matrices are used to capture the plasma response in the preconditioner.
132+
129133
* ``picard.verbose`` (`bool`, default: 1)
130134
When `implicit_evolve.nonlinear_solver = picard`, this sets the verbosity of the Picard solver. If true, then information
131135
on the nonlinear error are printed to screen at each nonlinear iteration.

Docs/source/usage/workflows/ml_materials/run_warpx_training.py

-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ def get_species_of_accelerator_stage(
107107
density_expression=f"n0*(1.+4.*(x**2+y**2)/(kp**2*Rc**4))*(0.5*(1.-cos(pi*(z-{stage_zmin})/Lplus)))*((z-{stage_zmin})<Lplus)"
108108
+ f"+n0*(1.+4.*(x**2+y**2)/(kp**2*Rc**4))*((z-{stage_zmin})>=Lplus)*((z-{stage_zmin})<(Lplus+Lp))"
109109
+ f"+n0*(1.+4.*(x**2+y**2)/(kp**2*Rc**4))*(0.5*(1.+cos(pi*((z-{stage_zmin})-Lplus-Lp)/Lminus)))*((z-{stage_zmin})>=(Lplus+Lp))*((z-{stage_zmin})<(Lplus+Lp+Lminus))",
110-
pi=3.141592653589793,
111110
n0=n0,
112111
kp=q_e / c * math.sqrt(n0 / (m_e * ep0)),
113112
Rc=Rc,

Examples/Tests/collision/analysis_collision_1d.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
import numpy as np
2121
import yt
22-
from scipy.constants import e
22+
from scipy.constants import e, m_e, m_u
2323

2424
# this will be the name of the plot file
2525
last_fn = sys.argv[1]
@@ -29,7 +29,7 @@
2929
)
3030

3131
# carbon 12 ion (mass = 12*amu - 6*me)
32-
mass = 1.992100316897910e-26
32+
mass = 12.0 * m_u - 6.0 * m_e
3333

3434
# Separate macroparticles from group A (low weight) and group B (high weight)
3535
# by sorting based on weight

Examples/Tests/collision/analysis_collision_2d.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import numpy
3232
import post_processing_utils
3333
import yt
34+
from scipy.constants import c, m_e
3435

3536
test_name = os.path.split(os.getcwd())[1]
3637

@@ -41,9 +42,7 @@
4142
ni = ng * 200
4243
np = ne + ni
4344

44-
c = 299792458.0
45-
me = 9.10938356e-31
46-
mi = me * 5.0
45+
mi = m_e * 5.0
4746

4847
## In the first part of the test we verify that the output data is consistent with the exponential
4948
## fit.
@@ -76,7 +75,7 @@
7675
# get time index j
7776
j = int(fn[-5:])
7877
# compute error
79-
vxe = numpy.mean(px[0:ne]) / me / c
78+
vxe = numpy.mean(px[0:ne]) / m_e / c
8079
vxi = numpy.mean(px[ne:np]) / mi / c
8180
vxd = vxe - vxi
8281
fit = a * math.exp(b * j)

Examples/Tests/collision/analysis_collision_3d.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import numpy
3131
import post_processing_utils
3232
import yt
33+
from scipy.constants import c, m_e
3334

3435
tolerance = 0.001
3536

@@ -38,9 +39,7 @@
3839
ni = ng * 200
3940
np = ne + ni
4041

41-
c = 299792458.0
42-
me = 9.10938356e-31
43-
mi = me * 5.0
42+
mi = m_e * 5.0
4443

4544
## In the first part of the test we verify that the output data is consistent with the exponential
4645
## fit.
@@ -69,7 +68,7 @@
6968
# get time index j
7069
j = int(fn[-5:])
7170
# compute error
72-
vxe = numpy.mean(pxe) / me / c
71+
vxe = numpy.mean(pxe) / m_e / c
7372
vxi = numpy.mean(pxi) / mi / c
7473
vxd = vxe - vxi
7574
fit = a * math.exp(b * j)

Examples/Tests/collision/inputs_test_2d_collision_xz

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ electron.uz_th = 0.044237441120300
4747
electron.ux_m = 0.044237441120300
4848

4949
ion.charge = q_e
50-
ion.mass = 4.554691780000000e-30
50+
ion.mass = 5*m_e
5151
ion.injection_style = "NRandomPerCell"
5252
ion.num_particles_per_cell = 200
5353
ion.profile = constant

Examples/Tests/electrostatic_sphere/analysis_electrostatic_sphere.py

+9-10
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import numpy as np
2626
import yt
2727
from openpmd_viewer import OpenPMDTimeSeries
28-
from scipy.constants import c
28+
from scipy.constants import c, e, epsilon_0, m_e
2929
from scipy.optimize import fsolve
3030

3131
yt.funcs.mylog.setLevel(0)
@@ -41,10 +41,10 @@
4141

4242
if emass_10:
4343
l2_tolerance = 0.096
44-
m_e = 10
44+
e_mass = 10
4545
else:
4646
l2_tolerance = 0.05
47-
m_e = 9.10938356e-31 # Electron mass in kg
47+
e_mass = m_e # Electron mass in kg
4848
ndims = np.count_nonzero(ds.domain_dimensions > 1)
4949

5050
if ndims == 2:
@@ -68,8 +68,7 @@
6868
iz0 = round((0.0 - zmin) / dz)
6969

7070
# Constants
71-
eps_0 = 8.8541878128e-12 # Vacuum Permittivity in C/(V*m)
72-
q_e = -1.60217662e-19 # Electron charge in C
71+
q_e = -e # Electron charge in C
7372
pi = np.pi # Circular constant of the universe
7473
r_0 = 0.1 # Initial radius of sphere
7574
q_tot = -1e-15 # Total charge of sphere in C
@@ -81,15 +80,15 @@
8180
# v(r) and t(r) can be solved analytically.
8281
#
8382
# The solution r(t) solves the ODE: r''(t) = a/(r(t)**2) with initial conditions
84-
# r(0) = r_0, r'(0) = 0, and a = q_e*q_tot/(4*pi*eps_0*m_e)
83+
# r(0) = r_0, r'(0) = 0, and a = q_e*q_tot/(4*pi*epsilon_0*e_mass)
8584
#
8685
# The E was calculated at the end of the last time step
8786
def v_exact(r):
88-
return np.sqrt(q_e * q_tot / (2 * pi * m_e * eps_0) * (1 / r_0 - 1 / r))
87+
return np.sqrt(q_e * q_tot / (2 * pi * e_mass * epsilon_0) * (1 / r_0 - 1 / r))
8988

9089

9190
def t_exact(r):
92-
return np.sqrt(r_0**3 * 2 * pi * m_e * eps_0 / (q_e * q_tot)) * (
91+
return np.sqrt(r_0**3 * 2 * pi * e_mass * epsilon_0 / (q_e * q_tot)) * (
9392
np.sqrt(r / r_0 - 1) * np.sqrt(r / r_0)
9493
+ np.log(np.sqrt(r / r_0 - 1) + np.sqrt(r / r_0))
9594
)
@@ -104,8 +103,8 @@ def func(rho):
104103

105104
def E_exact(r):
106105
return np.sign(r) * (
107-
q_tot / (4 * pi * eps_0 * r**2) * (abs(r) >= r_end)
108-
+ q_tot * abs(r) / (4 * pi * eps_0 * r_end**3) * (abs(r) < r_end)
106+
q_tot / (4 * pi * epsilon_0 * r**2) * (abs(r) >= r_end)
107+
+ q_tot * abs(r) / (4 * pi * epsilon_0 * r_end**3) * (abs(r) < r_end)
109108
)
110109

111110

Examples/Tests/embedded_boundary_cube/inputs_test_3d_embedded_boundary_cube_macroscopic

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ FILE = inputs_base_3d
33

44
# test input parameters
55
algo.em_solver_medium = macroscopic
6-
macroscopic.epsilon = 1.5*8.8541878128e-12
7-
macroscopic.mu = 1.25663706212e-06
6+
macroscopic.epsilon = 1.5*epsilon0
7+
macroscopic.mu = mu0
88
macroscopic.sigma = 0

Examples/Tests/embedded_boundary_rotated_cube/inputs_test_2d_embedded_boundary_rotated_cube

+1-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ my_constants.xmin = -0.53
1818
my_constants.zmin = -0.53
1919
my_constants.xmax = 0.53
2020
my_constants.zmax = 0.53
21-
my_constants.pi = 3.141592653589793
2221
my_constants.theta = pi/8
2322

2423
warpx.eb_implicit_function = "xr=x*cos(-theta)+z*sin(-theta); zr=-x*sin(-theta)+z*cos(-theta); max(max(xr+xmin,-(xr+xmax)), max(zr+zmin,-(zr+zmax)))"
@@ -29,12 +28,11 @@ my_constants.Lx = 1.06
2928
my_constants.Lz = 1.06
3029
my_constants.x_cent = 0.
3130
my_constants.z_cent = 0.
32-
my_constants.mu_0 = 1.25663706212e-06
3331

3432
warpx.B_ext_grid_init_style = parse_B_ext_grid_function
3533

3634
warpx.Bx_external_grid_function(x,y,z) = 0
37-
warpx.By_external_grid_function(x,y,z) = "mu_0 *
35+
warpx.By_external_grid_function(x,y,z) = "mu0 *
3836
cos(m * pi / Lx * (x*cos(-theta)+z*sin(-theta) - Lx / 2 - x_cent)) *
3937
cos(p * pi / Lz * (-x*sin(-theta)+z*cos(-theta) - Lz / 2 - z_cent))"
4038
warpx.Bz_external_grid_function(x,y,z) = 0

0 commit comments

Comments
 (0)