Skip to content

Commit

Permalink
Merge ECP-WarpX:development into EZoni:ctest_checksums_args
Browse files Browse the repository at this point in the history
  • Loading branch information
EZoni committed Dec 11, 2024
2 parents eb9fcb3 + d5d4a9d commit 653eda3
Show file tree
Hide file tree
Showing 39 changed files with 276 additions and 216 deletions.
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
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.8.1
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
18 changes: 8 additions & 10 deletions Source/BoundaryConditions/WarpXFieldBoundaries.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace

}

void WarpX::ApplyEfieldBoundary(const int lev, PatchType patch_type)
void WarpX::ApplyEfieldBoundary(const int lev, PatchType patch_type, amrex::Real time)
{
using ablastr::fields::Direction;

Expand Down Expand Up @@ -94,23 +94,22 @@ void WarpX::ApplyEfieldBoundary(const int lev, PatchType patch_type)
}

if (::isAnyBoundary<FieldBoundaryType::PECInsulator>(field_boundary_lo, field_boundary_hi)) {
amrex::Real const tnew = gett_new(lev);
if (patch_type == PatchType::fine) {
pec_insulator_boundary->ApplyPEC_InsulatortoEfield(
{m_fields.get(FieldType::Efield_fp,Direction{0},lev),
m_fields.get(FieldType::Efield_fp,Direction{1},lev),
m_fields.get(FieldType::Efield_fp,Direction{2},lev)},
field_boundary_lo, field_boundary_hi,
get_ng_fieldgather(), Geom(lev),
lev, patch_type, ref_ratio, tnew);
lev, patch_type, ref_ratio, time);
if (::isAnyBoundary<FieldBoundaryType::PML>(field_boundary_lo, field_boundary_hi)) {
// apply pec on split E-fields in PML region
const bool split_pml_field = true;
pec_insulator_boundary->ApplyPEC_InsulatortoEfield(
m_fields.get_alldirs(FieldType::pml_E_fp, lev),
field_boundary_lo, field_boundary_hi,
get_ng_fieldgather(), Geom(lev),
lev, patch_type, ref_ratio, tnew,
lev, patch_type, ref_ratio, time,
split_pml_field);
}
} else {
Expand All @@ -120,15 +119,15 @@ void WarpX::ApplyEfieldBoundary(const int lev, PatchType patch_type)
m_fields.get(FieldType::Efield_cp,Direction{2},lev)},
field_boundary_lo, field_boundary_hi,
get_ng_fieldgather(), Geom(lev),
lev, patch_type, ref_ratio, tnew);
lev, patch_type, ref_ratio, time);
if (::isAnyBoundary<FieldBoundaryType::PML>(field_boundary_lo, field_boundary_hi)) {
// apply pec on split E-fields in PML region
const bool split_pml_field = true;
pec_insulator_boundary->ApplyPEC_InsulatortoEfield(
m_fields.get_alldirs(FieldType::pml_E_cp, lev),
field_boundary_lo, field_boundary_hi,
get_ng_fieldgather(), Geom(lev),
lev, patch_type, ref_ratio, tnew,
lev, patch_type, ref_ratio, time,
split_pml_field);
}
}
Expand All @@ -147,7 +146,7 @@ void WarpX::ApplyEfieldBoundary(const int lev, PatchType patch_type)
#endif
}

void WarpX::ApplyBfieldBoundary (const int lev, PatchType patch_type, DtType a_dt_type)
void WarpX::ApplyBfieldBoundary (const int lev, PatchType patch_type, DtType a_dt_type, amrex::Real time)
{
using ablastr::fields::Direction;

Expand All @@ -172,23 +171,22 @@ void WarpX::ApplyBfieldBoundary (const int lev, PatchType patch_type, DtType a_d
}

if (::isAnyBoundary<FieldBoundaryType::PECInsulator>(field_boundary_lo, field_boundary_hi)) {
amrex::Real const tnew = gett_new(lev);
if (patch_type == PatchType::fine) {
pec_insulator_boundary->ApplyPEC_InsulatortoBfield(
{m_fields.get(FieldType::Bfield_fp,Direction{0},lev),
m_fields.get(FieldType::Bfield_fp,Direction{1},lev),
m_fields.get(FieldType::Bfield_fp,Direction{2},lev)},
field_boundary_lo, field_boundary_hi,
get_ng_fieldgather(), Geom(lev),
lev, patch_type, ref_ratio, tnew);
lev, patch_type, ref_ratio, time);
} else {
pec_insulator_boundary->ApplyPEC_InsulatortoBfield(
{m_fields.get(FieldType::Bfield_cp,Direction{0},lev),
m_fields.get(FieldType::Bfield_cp,Direction{1},lev),
m_fields.get(FieldType::Bfield_cp,Direction{2},lev)},
field_boundary_lo, field_boundary_hi,
get_ng_fieldgather(), Geom(lev),
lev, patch_type, ref_ratio, tnew);
lev, patch_type, ref_ratio, time);
}
}

Expand Down
Loading

0 comments on commit 653eda3

Please sign in to comment.