Skip to content

Commit

Permalink
Merge branch 'nodal_electrostatic' of github.com:aeriforme/WarpX into…
Browse files Browse the repository at this point in the history
… electrostatic_nodal_collider_diags
  • Loading branch information
aeriforme committed Aug 3, 2023
2 parents f05e61e + 82c9e0c commit 35abaf7
Show file tree
Hide file tree
Showing 84 changed files with 732 additions and 532 deletions.
34 changes: 34 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Checks: '-*,
-bugprone-easily-swappable-parameters,
-bugprone-implicit-widening-of-multiplication-result,
-bugprone-misplaced-widening-cast,
cert-*
-cert-err58-cpp,
cppcoreguidelines-avoid-goto,
cppcoreguidelines-interfaces-global-init,
-cppcoreguidelines-avoid-non-const-global-variables,
Expand All @@ -12,16 +14,48 @@ Checks: '-*,
-cppcoreguidelines-no-malloc,
-cppcoreguidelines-owning-memory,
misc-const-correctness,
misc-misleading-bidirectional,
modernize-avoid-bind,
modernize-concat-nested-namespaces,
modernize-deprecated-headers,
modernize-deprecated-ios-base-aliases,
modernize-loop-convert,
modernize-make-shared,
modernize-make-unique,
modernize-pass-by-value,
modernize-raw-string-literal,
modernize-redundant-void-arg,
modernize-replace-auto-ptr,
modernize-replace-disallow-copy-and-assign-macro,
modernize-replace-random-shuffle,
modernize-return-braced-init-list,
modernize-shrink-to-fit,
modernize-unary-static-assert,
modernize-use-nullptr,
mpi-*,
performance-faster-string-find,
performance-for-range-copy,
performance-implicit-conversion-in-loop,
performance-inefficient-algorithm,
performance-inefficient-string-concatenation,
performance-inefficient-vector-operation,
performance-move-const-arg,
performance-move-constructor-init,
readability-non-const-parameter,
readability-simplify-boolean-expr,
readability-simplify-subscript-expr,
readability-static-accessed-through-instance,
readability-static-definition-in-anonymous-namespace,
readability-string-compare,
readability-suspicious-call-argument,
readability-uniqueptr-delete-release,
-readability-uppercase-literal-suffix,
readability-use-anyofallof,
readability-non-const-parameter
'

CheckOptions:
- key: modernize-pass-by-value.ValuesOnly
value: 'true'

HeaderFilterRegex: 'Source[a-z_A-Z0-9\/]+\.H$'
2 changes: 1 addition & 1 deletion .github/workflows/cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ jobs:
which nvcc || echo "nvcc not in PATH!"
git clone https://github.com/AMReX-Codes/amrex.git ../amrex
cd ../amrex && git checkout --detach b75dd9d5279263768c418ce19285f87de37209f9 && cd -
cd ../amrex && git checkout --detach cf8d9f8e233be2ac68aeb65a95e992adfb483939 && cd -
make COMP=gcc QED=FALSE USE_MPI=TRUE USE_GPU=TRUE USE_OMP=FALSE USE_PSATD=TRUE USE_CCACHE=TRUE -j 2
build_nvhpc21-11-nvcc:
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ repos:

# Autoremoves unused Python imports
- repo: https://github.com/hadialqattan/pycln
rev: v2.1.6
rev: v2.2.0
hooks:
- id: pycln
name: pycln (python)
Expand Down
3 changes: 1 addition & 2 deletions Docs/source/usage/parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,7 @@ We follow the same naming, but remove the ``SIG`` prefix, e.g., the WarpX signal
The ``TSTP`` (terminal stop) command is sent interactively from ``Ctrl+Z`` to temporarily send a process to sleep (until send in the background with commands such as ``bg`` or continued with ``fg``), overwriting it would thus disable that functionality.
The signals ``KILL`` and ``STOP`` cannot be used.

The ``FPE`` signal should not be overwritten in WarpX, as it is `controlled by AMReX <https://amrex-codes.github.io/amrex/docs_html/Debugging.html#breaking-into-debuggers>`__ for :ref:`debug workflows that catch invalid floating-point operations <debugging_warpx>`.

The ``FPE`` and ``ILL`` signals should not be overwritten in WarpX, as they are `controlled by AMReX <https://amrex-codes.github.io/amrex/docs_html/Debugging.html#breaking-into-debuggers>`__ for :ref:`debug workflows that catch invalid floating-point operations <debugging_warpx>`.
.. tip::

For example, the following logic can be added to `Slurm batch scripts <https://docs.gwdg.de/doku.php?id=en:services:application_services:high_performance_computing:running_jobs_slurm:signals>`__ (`signal name to number mapping here <https://en.wikipedia.org/wiki/Signal_(IPC)#Default_action>`__) to gracefully shut down 6 min prior to walltime.
Expand Down
2 changes: 1 addition & 1 deletion Regression/WarpX-GPU-tests.ini
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ emailBody = Check https://ccse.lbl.gov/pub/GpuRegressionTesting/WarpX/ for more

[AMReX]
dir = /home/regtester/git/amrex/
branch = b75dd9d5279263768c418ce19285f87de37209f9
branch = cf8d9f8e233be2ac68aeb65a95e992adfb483939

[source]
dir = /home/regtester/git/WarpX
Expand Down
2 changes: 1 addition & 1 deletion Regression/WarpX-tests.ini
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ emailBody = Check https://ccse.lbl.gov/pub/RegressionTesting/WarpX/ for more det

[AMReX]
dir = /home/regtester/AMReX_RegTesting/amrex/
branch = b75dd9d5279263768c418ce19285f87de37209f9
branch = cf8d9f8e233be2ac68aeb65a95e992adfb483939

[source]
dir = /home/regtester/AMReX_RegTesting/warpx
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

#include <AMReX_REAL.H>
#include <AMReX_ParmParse.H>
#include <AMReX_Vector.H>
#include <AMReX_GpuContainers.H>

#include <string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
* License: BSD-3-Clause-LBNL
*/
#include "HardEdgedPlasmaLens.H"
#include "Utils/WarpXUtil.H"
#include "Utils/TextMsg.H"

#include <AMReX_ParmParse.H>
#include <AMReX_REAL.H>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

#include <AMReX_REAL.H>
#include <AMReX_ParmParse.H>
#include <AMReX_Vector.H>
#include <AMReX_GpuContainers.H>

#include <string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
* License: BSD-3-Clause-LBNL
*/
#include "HardEdgedQuadrupole.H"
#include "Utils/WarpXUtil.H"
#include "Utils/TextMsg.H"

#include <AMReX_ParmParse.H>
#include <AMReX_REAL.H>
Expand Down
1 change: 0 additions & 1 deletion Source/AcceleratorLattice/LatticeElements/HardEdged_K.H
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "Utils/WarpXConst.H"

#include <AMReX_REAL.H>
#include <AMReX_Vector.H>

/**
* \brief Calculate the residence correction, the fraction of the time step the particle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
* License: BSD-3-Clause-LBNL
*/
#include "LatticeElementBase.H"
#include "Utils/WarpXUtil.H"
#include "Utils/TextMsg.H"

#include <AMReX_ParmParse.H>
#include <AMReX_REAL.H>
Expand Down
6 changes: 3 additions & 3 deletions Source/BoundaryConditions/PML.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ using namespace amrex;

namespace
{
static void FillLo (Sigma& sigma, Sigma& sigma_cumsum,
void FillLo (Sigma& sigma, Sigma& sigma_cumsum,
Sigma& sigma_star, Sigma& sigma_star_cumsum,
const int olo, const int ohi, const int glo, Real fac,
const amrex::Real v_sigma)
Expand Down Expand Up @@ -87,7 +87,7 @@ namespace
});
}

static void FillHi (Sigma& sigma, Sigma& sigma_cumsum,
void FillHi (Sigma& sigma, Sigma& sigma_cumsum,
Sigma& sigma_star, Sigma& sigma_star_cumsum,
const int olo, const int ohi, const int ghi, Real fac,
const amrex::Real v_sigma)
Expand Down Expand Up @@ -115,7 +115,7 @@ namespace
}

#if (AMREX_SPACEDIM != 1)
static void FillZero (Sigma& sigma, Sigma& sigma_cumsum,
void FillZero (Sigma& sigma, Sigma& sigma_cumsum,
Sigma& sigma_star, Sigma& sigma_star_cumsum,
const int olo, const int ohi)
{
Expand Down
34 changes: 16 additions & 18 deletions Source/BoundaryConditions/WarpX_PEC.H
Original file line number Diff line number Diff line change
Expand Up @@ -166,23 +166,22 @@ using namespace amrex;
// For 2D : for icomp==1, (Ey in XZ, Etheta in RZ),
// icomp=1 is tangential to both x and z boundaries
// The logic below ensures that the flags are set right for 2D
const bool is_tangent_to_PEC = ( (icomp == AMREX_SPACEDIM*idim)
? false : true );
const bool is_tangent_to_PEC = (icomp != AMREX_SPACEDIM*idim);
#elif (defined WARPX_DIM_1D_Z)
// For 1D : icomp=0 and icomp=1 (Ex and Ey are tangential to the z boundary)
// The logic below ensures that the flags are set right for 1D
const bool is_tangent_to_PEC = ( ( icomp == idim+2) ? false : true );
const bool is_tangent_to_PEC = (icomp != idim+2);
#else
const bool is_tangent_to_PEC = ( ( icomp == idim) ? false : true );
const bool is_tangent_to_PEC = (icomp != idim);
#endif
if (isPECBoundary == true) {
if (isPECBoundary) {
// grid point ijk_vec is ig number of points pass the
// domain boundary in direction, idim
const int ig = get_cell_count_to_boundary(
dom_lo, dom_hi, ijk_vec, is_nodal, idim, iside);

if (ig == 0) {
if (is_tangent_to_PEC == true and is_nodal[idim] == 1) {
if (is_tangent_to_PEC && is_nodal[idim] == 1) {
OnPECBoundary = true;
}
} else if (ig > 0) {
Expand All @@ -192,15 +191,15 @@ using namespace amrex;
: (dom_hi[idim] + 1 - ig));
GuardCell = true;
// tangential components are inverted across PEC boundary
if (is_tangent_to_PEC == true) sign *= -1._rt;
if (is_tangent_to_PEC) sign *= -1._rt;
}
} // is PEC boundary
} // loop over iside
} // loop over dimensions
if (OnPECBoundary == true) {
if (OnPECBoundary) {
// if ijk_vec is on a PEC boundary in any direction, set Etangential to 0.
Efield(ijk_vec,n) = 0._rt;
} else if (GuardCell == true) {
} else if (GuardCell) {
Efield(ijk_vec,n) = sign * Efield(ijk_mirror,n);
}
}
Expand Down Expand Up @@ -288,19 +287,18 @@ using namespace amrex;
const bool isPECBoundary = ( (iside == 0 )
? is_boundary_PEC(fbndry_lo, idim)
: is_boundary_PEC(fbndry_hi, idim) );
if (isPECBoundary == true) {
if (isPECBoundary) {
#if (defined WARPX_DIM_XZ) || (defined WARPX_DIM_RZ)
// For 2D : for icomp==1, (By in XZ, Btheta in RZ),
// icomp=1 is not normal to x or z boundary
// The logic below ensures that the flags are set right for 2D
const bool is_normal_to_PEC = ( (icomp == AMREX_SPACEDIM*idim)
? true : false );
const bool is_normal_to_PEC = (icomp == (AMREX_SPACEDIM*idim));
#elif (defined WARPX_DIM_1D_Z)
// For 1D : icomp=0 and icomp=1 (Bx and By are not normal to the z boundary)
// The logic below ensures that the flags are set right for 1D
const bool is_normal_to_PEC = ( ( icomp == idim+2) ? true : false );
const bool is_normal_to_PEC = (icomp == (idim+2));
#else
const bool is_normal_to_PEC = ( ( icomp == idim) ? true : false );
const bool is_normal_to_PEC = (icomp == idim);
#endif

// grid point ijk_vec is ig number of points pass the
Expand All @@ -310,7 +308,7 @@ using namespace amrex;

if (ig == 0) {
// Only normal component is set to 0
if (is_normal_to_PEC == true and is_nodal[idim]==1) {
if (is_normal_to_PEC && is_nodal[idim]==1) {
OnPECBoundary = true;
}
} else if ( ig > 0) {
Expand All @@ -321,16 +319,16 @@ using namespace amrex;
: (dom_hi[idim] + 1 - ig));
GuardCell = true;
// Sign of the normal component in guard cell is inverted
if (is_normal_to_PEC == true) sign *= -1._rt;
if (is_normal_to_PEC) sign *= -1._rt;
}
} // if PEC Boundary
} // loop over sides
} // loop of dimensions

if (OnPECBoundary == true) {
if (OnPECBoundary) {
// if ijk_vec is on a PEC boundary in any direction, set Bnormal to 0.
Bfield(ijk_vec,n) = 0._rt;
} else if (GuardCell == true) {
} else if (GuardCell) {
// Bnormal and Btangential is set opposite and equal to the value
// in the mirror location, respectively.
Bfield(ijk_vec,n) = sign * Bfield(ijk_mirror,n);
Expand Down
7 changes: 3 additions & 4 deletions Source/BoundaryConditions/WarpX_PEC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,15 +361,14 @@ PEC::ApplyPECtoJfield(amrex::MultiFab* Jx, amrex::MultiFab* Jy,
#if (defined WARPX_DIM_1D_Z)
// For 1D : icomp=0 and icomp=1 (Ex and Ey are tangential to the z boundary)
// The logic below ensures that the flags are set right for 1D
is_tangent_to_bndy[icomp][idim] = ( ( icomp == idim+2) ? false : true );
is_tangent_to_bndy[icomp][idim] = (icomp != (idim+2));
#elif (defined WARPX_DIM_XZ) || (defined WARPX_DIM_RZ)
// For 2D : for icomp==1, (Ey in XZ, Etheta in RZ),
// icomp=1 is tangential to both x and z boundaries
// The logic below ensures that the flags are set right for 2D
is_tangent_to_bndy[icomp][idim] = ( (icomp == AMREX_SPACEDIM*idim)
? false : true );
is_tangent_to_bndy[icomp][idim] = (icomp != AMREX_SPACEDIM*idim);
#else
is_tangent_to_bndy[icomp][idim] = ( ( icomp == idim) ? false : true );
is_tangent_to_bndy[icomp][idim] = (icomp != idim);
#endif

if (is_tangent_to_bndy[icomp][idim]){
Expand Down
15 changes: 8 additions & 7 deletions Source/Diagnostics/BTD_Plotfile_Header_Impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
#include "BTD_Plotfile_Header_Impl.H"

#include "Utils/TextMsg.H"
#include "WarpX.H"

#include <ablastr/utils/text/StreamUtils.H>

#include <AMReX.H>
#include <AMReX_FileSystem.H>
Expand All @@ -21,7 +22,7 @@
using namespace amrex::literals;

BTDPlotfileHeaderImpl::BTDPlotfileHeaderImpl (std::string const & Headerfile_path)
: m_Header_path(Headerfile_path)
: m_Header_path{Headerfile_path}
{

}
Expand Down Expand Up @@ -71,7 +72,7 @@ BTDPlotfileHeaderImpl::ReadHeaderData ()
for (int idim = 0; idim < m_spacedim; ++idim) {
is >> m_prob_hi[idim];
}
WarpX::GotoNextLine(is);
ablastr::utils::text::goto_next_line(is);

is >> m_prob_domain;

Expand Down Expand Up @@ -177,7 +178,7 @@ BTDPlotfileHeaderImpl::WriteHeader ()


BTDMultiFabHeaderImpl::BTDMultiFabHeaderImpl (std::string const & Headerfile_path)
: m_Header_path(Headerfile_path)
: m_Header_path{Headerfile_path}
{

}
Expand Down Expand Up @@ -232,7 +233,7 @@ BTDMultiFabHeaderImpl::ReadMultiFabHeader ()
for (int ifab = 0; ifab < m_ba.size(); ++ifab) {
is >> m_FabOnDiskPrefix[ifab] >> m_fabname[ifab] >> m_fabhead[ifab];
}
WarpX::GotoNextLine(is);
ablastr::utils::text::goto_next_line(is);
char ch;
is >> in_hash >> ch >> in_hash;
m_minval.resize(m_ba.size());
Expand All @@ -243,7 +244,7 @@ BTDMultiFabHeaderImpl::ReadMultiFabHeader ()
if( ch != ',' ) amrex::Error("Expected a ',' got something else");
}
}
WarpX::GotoNextLine(is);
ablastr::utils::text::goto_next_line(is);
is >> in_hash >> ch >> in_hash;
m_maxval.resize(m_ba.size());
for (int ifab = 0; ifab < m_ba.size(); ++ifab) {
Expand Down Expand Up @@ -353,7 +354,7 @@ BTDMultiFabHeaderImpl::CopyVec(amrex::Vector<amrex::Real>& dst,


BTDSpeciesHeaderImpl::BTDSpeciesHeaderImpl (std::string const & Headerfile_path, std::string const& species_name)
: m_Header_path(Headerfile_path), m_species_name(species_name)
: m_Header_path{Headerfile_path}, m_species_name{species_name}
{

}
Expand Down
4 changes: 2 additions & 2 deletions Source/Diagnostics/BTDiagnostics.H
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ private:
*/
bool m_do_back_transformed_particles = true;

/** m_gamma_boost, is a copy of warpx.gamma_boost
/** m_gamma_boost, is a copy of WarpX::gamma_boost
* That is, the Lorentz factor of the boosted frame in which the simulation is run.
* The direction for Lorentz transformation is assumed to be along
* ``warpx.boost_direction``, which is the same as the moving window direction.
Expand All @@ -157,7 +157,7 @@ private:
*/
amrex::Real m_gamma_boost;
amrex::Real m_beta_boost;
/** m_moving_window_dir is a copy of warpx.moving_window_dir
/** m_moving_window_dir is a copy of WarpX::moving_window_dir
* Currently, back-transformed diagnostics only works if moving window is
* in z-direction for both 2D and 3D simulations in the Cartesian frame of reference.
*/
Expand Down
Loading

0 comments on commit 35abaf7

Please sign in to comment.