Skip to content

Commit

Permalink
Merge branch 'plasma_chamber' of github.com:ajnonaka/WarpX into plasm…
Browse files Browse the repository at this point in the history
…a_chamber
  • Loading branch information
ajnonaka committed Dec 11, 2024
2 parents 76645c4 + 7f07527 commit b2bdfaa
Show file tree
Hide file tree
Showing 48 changed files with 282 additions and 430 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 24.12 && 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.4
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
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
21 changes: 13 additions & 8 deletions Docs/source/usage/parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3589,22 +3589,27 @@ This shifts analysis from post-processing to runtime calculation of reduction op
* ``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
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
3 changes: 1 addition & 2 deletions Examples/Tests/implicit/inputs_test_1d_semi_implicit_picard
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ diag1.electrons.variables = z w ux uy uz
diag1.protons.variables = z w ux uy uz

warpx.reduced_diags_names = particle_energy field_energy
reduced_diags.intervals = 1
particle_energy.type = ParticleEnergy
particle_energy.intervals = 1
field_energy.type = FieldEnergy
field_energy.intervals = 1
3 changes: 1 addition & 2 deletions Examples/Tests/implicit/inputs_test_1d_theta_implicit_picard
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ diag1.electrons.variables = z w ux uy uz
diag1.protons.variables = z w ux uy uz

warpx.reduced_diags_names = particle_energy field_energy
reduced_diags.intervals = 1
particle_energy.type = ParticleEnergy
particle_energy.intervals = 1
field_energy.type = FieldEnergy
field_energy.intervals = 1
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ diag1.electrons.variables = x z w ux uy uz
diag1.protons.variables = x z w ux uy uz

warpx.reduced_diags_names = particle_energy field_energy
reduced_diags.intervals = 1
particle_energy.type = ParticleEnergy
particle_energy.intervals = 1
field_energy.type = FieldEnergy
field_energy.intervals = 1
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ diag1.electrons.variables = x z w ux uy uz
diag1.protons.variables = x z w ux uy uz

warpx.reduced_diags_names = particle_energy field_energy
reduced_diags.intervals = 1
particle_energy.type = ParticleEnergy
particle_energy.intervals = 1
field_energy.type = FieldEnergy
field_energy.intervals = 1
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ diag1.electrons.variables = x z w ux uy uz
diag1.protons.variables = x z w ux uy uz

warpx.reduced_diags_names = particle_energy field_energy
reduced_diags.intervals = 1
particle_energy.type = ParticleEnergy
particle_energy.intervals = 1
field_energy.type = FieldEnergy
field_energy.intervals = 1
30 changes: 29 additions & 1 deletion Python/pywarpx/picmi.py
Original file line number Diff line number Diff line change
Expand Up @@ -2770,6 +2770,21 @@ class Simulation(picmistandard.PICMI_Simulation):
warpx_used_inputs_file: string, optional
The name of the text file that the used input parameters is written to,
warpx_reduced_diags_path: string, optional
Sets the default path for reduced diagnostic output files
warpx_reduced_diags_extension: string, optional
Sets the default extension for reduced diagnostic output files
warpx_reduced_diags_intervals: string, optional
Sets the default intervals for reduced diagnostic output files
warpx_reduced_diags_separator: string, optional
Sets the default separator for reduced diagnostic output files
warpx_reduced_diags_precision: integer, optional
Sets the default precision for reduced diagnostic output files
"""

# Set the C++ WarpX interface (see _libwarpx.LibWarpX) as an extension to
Expand Down Expand Up @@ -2836,6 +2851,12 @@ def init(self, kw):
self.checkpoint_signals = kw.pop("warpx_checkpoint_signals", None)
self.numprocs = kw.pop("warpx_numprocs", None)

self.reduced_diags_path = kw.pop("warpx_reduced_diags_path", None)
self.reduced_diags_extension = kw.pop("warpx_reduced_diags_extension", None)
self.reduced_diags_intervals = kw.pop("warpx_reduced_diags_intervals", None)
self.reduced_diags_separator = kw.pop("warpx_reduced_diags_separator", None)
self.reduced_diags_precision = kw.pop("warpx_reduced_diags_precision", None)

self.inputs_initialized = False
self.warpx_initialized = False

Expand Down Expand Up @@ -2902,6 +2923,13 @@ def initialize_inputs(self):

pywarpx.warpx.numprocs = self.numprocs

reduced_diags = pywarpx.warpx.get_bucket("reduced_diags")
reduced_diags.path = self.reduced_diags_path
reduced_diags.extension = self.reduced_diags_extension
reduced_diags.intervals = self.reduced_diags_intervals
reduced_diags.separator = self.reduced_diags_separator
reduced_diags.precision = self.reduced_diags_precision

particle_shape = self.particle_shape
for s in self.species:
if s.particle_shape is not None:
Expand Down Expand Up @@ -3943,7 +3971,7 @@ def __init__(
self,
diag_type,
name=None,
period=1,
period=None,
path=None,
extension=None,
separator=None,
Expand Down
2 changes: 1 addition & 1 deletion Python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@

setup(
name="pywarpx",
version="24.11",
version="24.12",
packages=["pywarpx"],
package_dir={"pywarpx": "pywarpx"},
description="""Wrapper of WarpX""",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"lev=0": {
"Bx": 0.0,
"By": 0.33065279639752304,
"By": 0.3605690508580849,
"Bz": 0.0,
"Ex": 31873416.396984838,
"Ex": 37101418.32484252,
"Ey": 0.0,
"Ez": 99285542.27022335,
"Ez": 108228802.9434361,
"jx": 0.0,
"jy": 0.0,
"jz": 0.0
Expand Down
15 changes: 9 additions & 6 deletions Source/BoundaryConditions/PEC_Insulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ namespace
amrex::GpuArray<FieldBoundaryType, 3> const fbndry_hi)
{
using namespace amrex::literals;
amrex::IntVect ijk_next = ijk_vec;
amrex::IntVect ijk_nextp1 = ijk_vec;
amrex::IntVect ijk_mirror = ijk_vec;
amrex::IntVect ijk_mirrorp1 = ijk_vec;
bool OnBoundary = false;
bool GuardCell = false;
bool isInsulatorBoundary = false;
Expand Down Expand Up @@ -114,12 +115,14 @@ namespace
} else if (ig > 0) {
GuardCell = true;

// Location of the next cells inward
ijk_next[idim] = ijk_vec[idim] - ig*iside;
ijk_nextp1[idim] = ijk_next[idim] - ig*iside;

// Mirror location inside the domain by "ig" number of cells
ijk_mirror[idim] = ( (iside == -1)
? (dom_lo[idim] + ig - (1 - is_nodal[idim]))
: (dom_hi[idim] + 1 - ig));
// Location twice as far in, for extrapolation
ijk_mirrorp1[idim] = 2*ijk_mirror[idim] - ijk_vec[idim];
: (dom_hi[idim] - ig + 1));

// Check for components with even symmetry.
// True for E_like and tangential, and B_like and normal
Expand Down Expand Up @@ -156,12 +159,12 @@ namespace
// The value on the boundary is left unmodified
// The values in the guard cells are extrapolated
if (GuardCell) {
field(ijk_vec, n) = 2._rt*field(ijk_mirror, n) - field(ijk_mirrorp1, n);
field(ijk_vec, n) = 2._rt*field(ijk_next, n) - field(ijk_nextp1, n);
}
} else if ((OnBoundary || GuardCell) && set_field) {
field(ijk_vec, n) = field_value;
} else if (GuardCell) {
field(ijk_vec, n) = 2._rt*field(ijk_mirror, n) - field(ijk_mirrorp1, n);
field(ijk_vec, n) = 2._rt*field(ijk_next, n) - field(ijk_nextp1, n);
}
} else {
if (OnBoundary && (E_like ^ is_normal_to_boundary)) {
Expand Down
Loading

0 comments on commit b2bdfaa

Please sign in to comment.