aboutsummaryrefslogtreecommitdiff
path: root/Source/FieldSolver/SpectralSolver
diff options
context:
space:
mode:
Diffstat (limited to 'Source/FieldSolver/SpectralSolver')
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmComoving.H2
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmComoving.cpp15
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmFirstOrder.H4
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmFirstOrder.cpp4
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmGalileanRZ.H2
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmGalileanRZ.cpp4
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJConstantInTime.H4
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJConstantInTime.cpp23
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJLinearInTime.H4
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJLinearInTime.cpp4
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmPml.H2
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmPml.cpp4
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmPmlRZ.H2
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmPmlRZ.cpp4
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmRZ.H2
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmRZ.cpp4
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithm.H2
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithm.cpp10
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithmRZ.H4
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralKSpace.H2
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp15
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralSolver.H4
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralSolver.cpp14
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralSolverRZ.H2
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralSolverRZ.cpp10
25 files changed, 74 insertions, 73 deletions
diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmComoving.H b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmComoving.H
index bc7dc7699..bb9775e1c 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmComoving.H
+++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmComoving.H
@@ -32,7 +32,7 @@ class PsatdAlgorithmComoving : public SpectralBaseAlgorithm
const int norder_x,
const int norder_y,
const int norder_z,
- const bool nodal,
+ const short grid_type,
const amrex::Vector<amrex::Real>& v_comoving,
const amrex::Real dt,
const bool update_with_rho);
diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmComoving.cpp b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmComoving.cpp
index dfd7ffe92..8f576dad7 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmComoving.cpp
+++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmComoving.cpp
@@ -1,6 +1,7 @@
#include "PsatdAlgorithmComoving.H"
#include "Utils/TextMsg.H"
+#include "Utils/WarpXAlgorithmSelection.H"
#include "Utils/WarpXConst.H"
#include "Utils/WarpX_Complex.H"
@@ -25,21 +26,21 @@ PsatdAlgorithmComoving::PsatdAlgorithmComoving (const SpectralKSpace& spectral_k
const DistributionMapping& dm,
const SpectralFieldIndex& spectral_index,
const int norder_x, const int norder_y,
- const int norder_z, const bool nodal,
+ const int norder_z, const short grid_type,
const amrex::Vector<amrex::Real>& v_comoving,
const amrex::Real dt,
const bool update_with_rho)
// Members initialization
- : SpectralBaseAlgorithm(spectral_kspace, dm, spectral_index, norder_x, norder_y, norder_z, nodal),
+ : SpectralBaseAlgorithm(spectral_kspace, dm, spectral_index, norder_x, norder_y, norder_z, grid_type),
m_spectral_index(spectral_index),
// Initialize the infinite-order k vectors (the argument n_order = -1 selects
- // the infinite order option, the argument nodal = false is then irrelevant)
- kx_vec(spectral_kspace.getModifiedKComponent(dm, 0, -1, false)),
+ // the infinite order option, the argument grid_type=GridType::Staggered is then irrelevant)
+ kx_vec(spectral_kspace.getModifiedKComponent(dm, 0, -1, GridType::Staggered)),
#if defined(WARPX_DIM_3D)
- ky_vec(spectral_kspace.getModifiedKComponent(dm, 1, -1, false)),
- kz_vec(spectral_kspace.getModifiedKComponent(dm, 2, -1, false)),
+ ky_vec(spectral_kspace.getModifiedKComponent(dm, 1, -1, GridType::Staggered)),
+ kz_vec(spectral_kspace.getModifiedKComponent(dm, 2, -1, GridType::Staggered)),
#else
- kz_vec(spectral_kspace.getModifiedKComponent(dm, 1, -1, false)),
+ kz_vec(spectral_kspace.getModifiedKComponent(dm, 1, -1, GridType::Staggered)),
#endif
m_v_comoving(v_comoving),
m_dt(dt)
diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmFirstOrder.H b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmFirstOrder.H
index c90b19e1a..512c4f489 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmFirstOrder.H
+++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmFirstOrder.H
@@ -37,7 +37,7 @@ class PsatdAlgorithmFirstOrder : public SpectralBaseAlgorithm
* \param[in] norder_x order of the spectral solver along x
* \param[in] norder_y order of the spectral solver along y
* \param[in] norder_z order of the spectral solver along z
- * \param[in] nodal whether the E and B fields are defined on a fully nodal grid or a Yee grid
+ * \param[in] grid_type type of grid (collocated or not)
* \param[in] dt time step of the simulation
* \param[in] div_cleaning whether to use divergence correction for both E and B (thus, F and G)
* \param[in] J_in_time time dependency of J (currently supported: constant, linear)
@@ -50,7 +50,7 @@ class PsatdAlgorithmFirstOrder : public SpectralBaseAlgorithm
const int norder_x,
const int norder_y,
const int norder_z,
- const bool nodal,
+ const short grid_type,
const amrex::Real dt,
const bool div_cleaning,
const int J_in_time,
diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmFirstOrder.cpp b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmFirstOrder.cpp
index d32604760..3701fb889 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmFirstOrder.cpp
+++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmFirstOrder.cpp
@@ -35,13 +35,13 @@ PsatdAlgorithmFirstOrder::PsatdAlgorithmFirstOrder(
const int norder_x,
const int norder_y,
const int norder_z,
- const bool nodal,
+ const short grid_type,
const amrex::Real dt,
const bool div_cleaning,
const int J_in_time,
const int rho_in_time)
// Initializer list
- : SpectralBaseAlgorithm(spectral_kspace, dm, spectral_index, norder_x, norder_y, norder_z, nodal),
+ : SpectralBaseAlgorithm(spectral_kspace, dm, spectral_index, norder_x, norder_y, norder_z, grid_type),
m_spectral_index(spectral_index),
m_dt(dt),
m_div_cleaning(div_cleaning),
diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmGalileanRZ.H b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmGalileanRZ.H
index d3c519c94..aee8bc5ed 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmGalileanRZ.H
+++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmGalileanRZ.H
@@ -20,7 +20,7 @@ class PsatdAlgorithmGalileanRZ : public SpectralBaseAlgorithmRZ
amrex::DistributionMapping const & dm,
const SpectralFieldIndex& spectral_index,
int const n_rz_azimuthal_modes, int const norder_z,
- bool const nodal,
+ short const grid_type,
const amrex::Vector<amrex::Real>& v_galilean,
amrex::Real const dt_step,
bool const update_with_rho);
diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmGalileanRZ.cpp b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmGalileanRZ.cpp
index af3e2e336..75f0e49d1 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmGalileanRZ.cpp
+++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmGalileanRZ.cpp
@@ -21,12 +21,12 @@ PsatdAlgorithmGalileanRZ::PsatdAlgorithmGalileanRZ (SpectralKSpaceRZ const & spe
amrex::DistributionMapping const & dm,
const SpectralFieldIndex& spectral_index,
int const n_rz_azimuthal_modes, int const norder_z,
- bool const nodal,
+ short const grid_type,
const amrex::Vector<amrex::Real>& v_galilean,
amrex::Real const dt,
bool const update_with_rho)
// Initialize members of base class
- : SpectralBaseAlgorithmRZ(spectral_kspace, dm, spectral_index, norder_z, nodal),
+ : SpectralBaseAlgorithmRZ(spectral_kspace, dm, spectral_index, norder_z, grid_type),
m_spectral_index(spectral_index),
m_dt(dt),
m_v_galilean(v_galilean),
diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJConstantInTime.H b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJConstantInTime.H
index 0d2d67434..0dd3d179d 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJConstantInTime.H
+++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJConstantInTime.H
@@ -37,7 +37,7 @@ class PsatdAlgorithmJConstantInTime : public SpectralBaseAlgorithm
* \param[in] norder_x order of the spectral solver along x
* \param[in] norder_y order of the spectral solver along y
* \param[in] norder_z order of the spectral solver along z
- * \param[in] nodal whether the E and B fields are defined on a fully nodal grid or a Yee grid
+ * \param[in] grid_type type of grid (collocated or not)
* \param[in] v_galilean Galilean velocity (three-dimensional array)
* \param[in] dt time step of the simulation
* \param[in] update_with_rho whether the update equation for E uses rho or not
@@ -52,7 +52,7 @@ class PsatdAlgorithmJConstantInTime : public SpectralBaseAlgorithm
const int norder_x,
const int norder_y,
const int norder_z,
- const bool nodal,
+ const short grid_type,
const amrex::Vector<amrex::Real>& v_galilean,
const amrex::Real dt,
const bool update_with_rho,
diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJConstantInTime.cpp b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJConstantInTime.cpp
index c52437bf8..8c28c42b2 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJConstantInTime.cpp
+++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJConstantInTime.cpp
@@ -7,6 +7,7 @@
#include "PsatdAlgorithmJConstantInTime.H"
#include "Utils/TextMsg.H"
+#include "Utils/WarpXAlgorithmSelection.H"
#include "Utils/WarpXConst.H"
#include "Utils/WarpX_Complex.H"
@@ -34,7 +35,7 @@ PsatdAlgorithmJConstantInTime::PsatdAlgorithmJConstantInTime(
const int norder_x,
const int norder_y,
const int norder_z,
- const bool nodal,
+ const short grid_type,
const amrex::Vector<amrex::Real>& v_galilean,
const amrex::Real dt,
const bool update_with_rho,
@@ -42,17 +43,17 @@ PsatdAlgorithmJConstantInTime::PsatdAlgorithmJConstantInTime(
const bool dive_cleaning,
const bool divb_cleaning)
// Initializer list
- : SpectralBaseAlgorithm(spectral_kspace, dm, spectral_index, norder_x, norder_y, norder_z, nodal),
+ : SpectralBaseAlgorithm(spectral_kspace, dm, spectral_index, norder_x, norder_y, norder_z, grid_type),
m_spectral_index(spectral_index),
// Initialize the centered finite-order modified k vectors:
// these are computed always with the assumption of centered grids
- // (argument nodal = true), for both nodal and staggered simulations
- modified_kx_vec_centered(spectral_kspace.getModifiedKComponent(dm, 0, norder_x, true)),
+ // (argument grid_type=GridType::Collocated), for both collocated and staggered grids
+ modified_kx_vec_centered(spectral_kspace.getModifiedKComponent(dm, 0, norder_x, GridType::Collocated)),
#if defined(WARPX_DIM_3D)
- modified_ky_vec_centered(spectral_kspace.getModifiedKComponent(dm, 1, norder_y, true)),
- modified_kz_vec_centered(spectral_kspace.getModifiedKComponent(dm, 2, norder_z, true)),
+ modified_ky_vec_centered(spectral_kspace.getModifiedKComponent(dm, 1, norder_y, GridType::Collocated)),
+ modified_kz_vec_centered(spectral_kspace.getModifiedKComponent(dm, 2, norder_z, GridType::Collocated)),
#else
- modified_kz_vec_centered(spectral_kspace.getModifiedKComponent(dm, 1, norder_z, true)),
+ modified_kz_vec_centered(spectral_kspace.getModifiedKComponent(dm, 1, norder_z, GridType::Collocated)),
#endif
m_v_galilean(v_galilean),
m_dt(dt),
@@ -419,8 +420,8 @@ void PsatdAlgorithmJConstantInTime::InitializeSpectralCoefficients (
const amrex::Real dt2 = std::pow(dt, 2);
// Calculate the dot product of the k vector with the Galilean velocity.
- // This has to be computed always with the centered (that is, nodal) finite-order
- // modified k vectors, to work correctly for both nodal and staggered simulations.
+ // This has to be computed always with the centered (collocated) finite-order
+ // modified k vectors, to work correctly for both collocated and staggered grids.
// w_c = 0 always with standard PSATD (zero Galilean velocity).
const amrex::Real w_c = kx_c[i]*vg_x +
#if defined(WARPX_DIM_3D)
@@ -580,8 +581,8 @@ void PsatdAlgorithmJConstantInTime::InitializeSpectralCoefficientsAveraging (
const amrex::Real dt2 = std::pow(dt, 2);
// Calculate the dot product of the k vector with the Galilean velocity.
- // This has to be computed always with the centered (that is, nodal) finite-order
- // modified k vectors, to work correctly for both nodal and staggered simulations.
+ // This has to be computed always with the centered (collocated) finite-order
+ // modified k vectors, to work correctly for both collocated and staggered grids.
// w_c = 0 always with standard PSATD (zero Galilean velocity).
const amrex::Real w_c = kx_c[i]*vg_x +
#if defined(WARPX_DIM_3D)
diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJLinearInTime.H b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJLinearInTime.H
index e0eded5f5..13db64b74 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJLinearInTime.H
+++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJLinearInTime.H
@@ -40,7 +40,7 @@ class PsatdAlgorithmJLinearInTime : public SpectralBaseAlgorithm
* \param[in] norder_x order of the spectral solver along x
* \param[in] norder_y order of the spectral solver along y
* \param[in] norder_z order of the spectral solver along z
- * \param[in] nodal whether the E and B fields are defined on a fully nodal grid or a Yee grid
+ * \param[in] grid_type type of grid (collocated or not)
* \param[in] dt time step of the simulation
* \param[in] time_averaging whether to use time averaging for large time steps
* \param[in] dive_cleaning Update F as part of the field update, so that errors in divE=rho propagate away at the speed of light
@@ -53,7 +53,7 @@ class PsatdAlgorithmJLinearInTime : public SpectralBaseAlgorithm
const int norder_x,
const int norder_y,
const int norder_z,
- const bool nodal,
+ const short grid_type,
const amrex::Real dt,
const bool time_averaging,
const bool dive_cleaning,
diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJLinearInTime.cpp b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJLinearInTime.cpp
index 861001c78..b0580422b 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJLinearInTime.cpp
+++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJLinearInTime.cpp
@@ -34,13 +34,13 @@ PsatdAlgorithmJLinearInTime::PsatdAlgorithmJLinearInTime(
const int norder_x,
const int norder_y,
const int norder_z,
- const bool nodal,
+ const short grid_type,
const amrex::Real dt,
const bool time_averaging,
const bool dive_cleaning,
const bool divb_cleaning)
// Initializer list
- : SpectralBaseAlgorithm(spectral_kspace, dm, spectral_index, norder_x, norder_y, norder_z, nodal),
+ : SpectralBaseAlgorithm(spectral_kspace, dm, spectral_index, norder_x, norder_y, norder_z, grid_type),
m_spectral_index(spectral_index),
m_dt(dt),
m_time_averaging(time_averaging),
diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmPml.H b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmPml.H
index 0c1aeb885..e858dc1bf 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmPml.H
+++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmPml.H
@@ -31,7 +31,7 @@ class PsatdAlgorithmPml : public SpectralBaseAlgorithm
const amrex::DistributionMapping& dm,
const SpectralFieldIndex& spectral_index,
const int norder_x, const int norder_y,
- const int norder_z, const bool nodal,
+ const int norder_z, const short grid_type,
const amrex::Real dt,
const bool dive_cleaning,
const bool divb_cleaning);
diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmPml.cpp b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmPml.cpp
index 45a4d1580..217998d18 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmPml.cpp
+++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmPml.cpp
@@ -34,11 +34,11 @@ PsatdAlgorithmPml::PsatdAlgorithmPml(const SpectralKSpace& spectral_kspace,
const DistributionMapping& dm,
const SpectralFieldIndex& spectral_index,
const int norder_x, const int norder_y,
- const int norder_z, const bool nodal,
+ const int norder_z, const short grid_type,
const Real dt,
const bool dive_cleaning, const bool divb_cleaning)
// Initialize members of base class
- : SpectralBaseAlgorithm(spectral_kspace, dm, spectral_index, norder_x, norder_y, norder_z, nodal),
+ : SpectralBaseAlgorithm(spectral_kspace, dm, spectral_index, norder_x, norder_y, norder_z, grid_type),
m_spectral_index(spectral_index),
m_dt(dt),
m_dive_cleaning(dive_cleaning),
diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmPmlRZ.H b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmPmlRZ.H
index 6ea63c5a2..255b645ba 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmPmlRZ.H
+++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmPmlRZ.H
@@ -20,7 +20,7 @@ class PsatdAlgorithmPmlRZ : public SpectralBaseAlgorithmRZ
amrex::DistributionMapping const & dm,
const SpectralFieldIndex& spectral_index,
int const n_rz_azimuthal_modes, int const norder_z,
- bool const nodal, amrex::Real const dt_step);
+ short const grid_type, amrex::Real const dt_step);
// Redefine functions from base class
virtual void pushSpectralFields (SpectralFieldDataRZ & f) override final;
diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmPmlRZ.cpp b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmPmlRZ.cpp
index ca85648ac..60f7209de 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmPmlRZ.cpp
+++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmPmlRZ.cpp
@@ -21,9 +21,9 @@ PsatdAlgorithmPmlRZ::PsatdAlgorithmPmlRZ (SpectralKSpaceRZ const & spectral_kspa
amrex::DistributionMapping const & dm,
const SpectralFieldIndex& spectral_index,
int const n_rz_azimuthal_modes, int const norder_z,
- bool const nodal, amrex::Real const dt)
+ short const grid_type, amrex::Real const dt)
// Initialize members of base class
- : SpectralBaseAlgorithmRZ(spectral_kspace, dm, spectral_index, norder_z, nodal),
+ : SpectralBaseAlgorithmRZ(spectral_kspace, dm, spectral_index, norder_z, grid_type),
m_spectral_index(spectral_index),
m_dt(dt)
{
diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmRZ.H b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmRZ.H
index 097a1a9d6..350db81c3 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmRZ.H
+++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmRZ.H
@@ -20,7 +20,7 @@ class PsatdAlgorithmRZ : public SpectralBaseAlgorithmRZ
amrex::DistributionMapping const & dm,
const SpectralFieldIndex& spectral_index,
int const n_rz_azimuthal_modes, int const norder_z,
- bool const nodal, amrex::Real const dt_step,
+ short const grid_type, amrex::Real const dt_step,
bool const update_with_rho,
const bool time_averaging,
const int J_in_time,
diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmRZ.cpp b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmRZ.cpp
index effb1cc2b..46ac2c0b8 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmRZ.cpp
+++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmRZ.cpp
@@ -21,7 +21,7 @@ PsatdAlgorithmRZ::PsatdAlgorithmRZ (SpectralKSpaceRZ const & spectral_kspace,
amrex::DistributionMapping const & dm,
const SpectralFieldIndex& spectral_index,
int const n_rz_azimuthal_modes, int const norder_z,
- bool const nodal, amrex::Real const dt,
+ short const grid_type, amrex::Real const dt,
bool const update_with_rho,
const bool time_averaging,
const int J_in_time,
@@ -29,7 +29,7 @@ PsatdAlgorithmRZ::PsatdAlgorithmRZ (SpectralKSpaceRZ const & spectral_kspace,
const bool dive_cleaning,
const bool divb_cleaning)
// Initialize members of base class
- : SpectralBaseAlgorithmRZ(spectral_kspace, dm, spectral_index, norder_z, nodal),
+ : SpectralBaseAlgorithmRZ(spectral_kspace, dm, spectral_index, norder_z, grid_type),
m_spectral_index(spectral_index),
m_dt(dt),
m_update_with_rho(update_with_rho),
diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithm.H b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithm.H
index ef08c4432..fe624e9b8 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithm.H
+++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithm.H
@@ -83,7 +83,7 @@ class SpectralBaseAlgorithm
const amrex::DistributionMapping& dm,
const SpectralFieldIndex& spectral_index,
const int norder_x, const int norder_y,
- const int norder_z, const bool nodal);
+ const int norder_z, const short grid_type);
SpectralFieldIndex m_spectral_index;
diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithm.cpp b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithm.cpp
index 1a2334cc6..099f6edf3 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithm.cpp
+++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithm.cpp
@@ -31,15 +31,15 @@ SpectralBaseAlgorithm::SpectralBaseAlgorithm(const SpectralKSpace& spectral_kspa
const amrex::DistributionMapping& dm,
const SpectralFieldIndex& spectral_index,
const int norder_x, const int norder_y,
- const int norder_z, const bool nodal):
+ const int norder_z, const short grid_type):
m_spectral_index(spectral_index),
// Compute and assign the modified k vectors
- modified_kx_vec(spectral_kspace.getModifiedKComponent(dm,0,norder_x,nodal)),
+ modified_kx_vec(spectral_kspace.getModifiedKComponent(dm,0,norder_x,grid_type)),
#if defined(WARPX_DIM_3D)
- modified_ky_vec(spectral_kspace.getModifiedKComponent(dm,1,norder_y,nodal)),
- modified_kz_vec(spectral_kspace.getModifiedKComponent(dm,2,norder_z,nodal))
+ modified_ky_vec(spectral_kspace.getModifiedKComponent(dm,1,norder_y,grid_type)),
+ modified_kz_vec(spectral_kspace.getModifiedKComponent(dm,2,norder_z,grid_type))
#else
- modified_kz_vec(spectral_kspace.getModifiedKComponent(dm,1,norder_z,nodal))
+ modified_kz_vec(spectral_kspace.getModifiedKComponent(dm,1,norder_z,grid_type))
#endif
{
#if !defined(WARPX_DIM_3D)
diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithmRZ.H b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithmRZ.H
index a2e293dc2..37bb862a9 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithmRZ.H
+++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithmRZ.H
@@ -63,10 +63,10 @@ class SpectralBaseAlgorithmRZ
SpectralBaseAlgorithmRZ(SpectralKSpaceRZ const & spectral_kspace,
amrex::DistributionMapping const & dm,
const SpectralFieldIndex& spectral_index,
- int const norder_z, bool const nodal)
+ int const norder_z, short const grid_type)
// Compute and assign the modified k vectors
: m_spectral_index(spectral_index),
- modified_kz_vec(spectral_kspace.getModifiedKComponent(dm, 1, norder_z, nodal))
+ modified_kz_vec(spectral_kspace.getModifiedKComponent(dm, 1, norder_z, grid_type))
{}
SpectralFieldIndex m_spectral_index;
diff --git a/Source/FieldSolver/SpectralSolver/SpectralKSpace.H b/Source/FieldSolver/SpectralSolver/SpectralKSpace.H
index 68aa7931a..d5266b2a2 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralKSpace.H
+++ b/Source/FieldSolver/SpectralSolver/SpectralKSpace.H
@@ -58,7 +58,7 @@ class SpectralKSpace
const int i_dim, const bool only_positive_k ) const;
KVectorComponent getModifiedKComponent(
const amrex::DistributionMapping& dm, const int i_dim,
- const int n_order, const bool nodal ) const;
+ const int n_order, const short grid_type ) const;
SpectralShiftFactor getSpectralShiftFactor(
const amrex::DistributionMapping& dm, const int i_dim,
const int shift_type ) const;
diff --git a/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp b/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp
index b9afc63b4..8330b645e 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp
+++ b/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp
@@ -141,7 +141,7 @@ SpectralKSpace::getKComponent( const DistributionMapping& dm,
* corresponding correcting "shift" factor, along the dimension
* specified by `i_dim`.
*
- * (By default, we assume the FFT is done from/to a nodal grid in real space
+ * (By default, we assume the FFT is done from/to a collocated grid in real space
* It the FFT is performed from/to a cell-centered grid in real space,
* a correcting "shift" factor must be applied in spectral space.)
*/
@@ -190,14 +190,13 @@ SpectralKSpace::getSpectralShiftFactor( const DistributionMapping& dm,
*
* \param n_order Order of accuracy of the stencil, in discretizing
* a spatial derivative
- * \param nodal Whether the stencil is to be applied to a nodal or
- staggered set of fields
+ * \param grid_type type of grid (collocated or not)
*/
KVectorComponent
SpectralKSpace::getModifiedKComponent( const DistributionMapping& dm,
const int i_dim,
const int n_order,
- const bool nodal ) const
+ const short grid_type ) const
{
// Initialize an empty DeviceVector in each box
KVectorComponent modified_k_comp(spectralspace_ba, dm);
@@ -217,7 +216,7 @@ SpectralKSpace::getModifiedKComponent( const DistributionMapping& dm,
} else {
// Compute real-space stencil coefficients
- Vector<Real> h_stencil_coef = WarpX::getFornbergStencilCoefficients(n_order, nodal);
+ Vector<Real> h_stencil_coef = WarpX::getFornbergStencilCoefficients(n_order, grid_type);
Gpu::DeviceVector<Real> d_stencil_coef(h_stencil_coef.size());
Gpu::copyAsync(Gpu::hostToDevice, h_stencil_coef.begin(), h_stencil_coef.end(),
d_stencil_coef.begin());
@@ -243,7 +242,7 @@ SpectralKSpace::getModifiedKComponent( const DistributionMapping& dm,
{
p_modified_k[i] = 0;
for (int n=0; n<nstencil; n++){
- if (nodal){
+ if (grid_type == GridType::Collocated){
p_modified_k[i] += p_stencil_coef[n]*
std::sin( p_k[i]*(n+1)*delta_x )/( (n+1)*delta_x );
} else {
@@ -252,12 +251,12 @@ SpectralKSpace::getModifiedKComponent( const DistributionMapping& dm,
}
}
- // By construction, at finite order and for a nodal grid,
+ // By construction, at finite order and for a collocated grid,
// the *modified* k corresponding to the Nyquist frequency
// (i.e. highest *real* k) is 0. However, the above calculation
// based on stencil coefficients does not give 0 to machine precision.
// Therefore, we need to enforce the fact that the modified k be 0 here.
- if (nodal){
+ if (grid_type == GridType::Collocated){
if (i_dim == 0){
// Because of the real-to-complex FFTs, the first axis (idim=0)
// contains only the positive k, and the Nyquist frequency is
diff --git a/Source/FieldSolver/SpectralSolver/SpectralSolver.H b/Source/FieldSolver/SpectralSolver/SpectralSolver.H
index 66fe1b816..4ff9654ed 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralSolver.H
+++ b/Source/FieldSolver/SpectralSolver/SpectralSolver.H
@@ -46,7 +46,7 @@ class SpectralSolver
* \param[in] norder_x spectral order along x
* \param[in] norder_y spectral order along y
* \param[in] norder_z spectral order along z
- * \param[in] nodal whether the spectral solver is applied to a nodal or staggered grid
+ * \param[in] grid_type type of grid (collocated or not)
* \param[in] v_galilean three-dimensional vector containing the components of the Galilean
* velocity for the standard or averaged Galilean PSATD solvers
* \param[in] v_comoving three-dimensional vector containing the components of the comoving
@@ -73,7 +73,7 @@ class SpectralSolver
const amrex::BoxArray& realspace_ba,
const amrex::DistributionMapping& dm,
const int norder_x, const int norder_y,
- const int norder_z, const bool nodal,
+ const int norder_z, const short grid_type,
const amrex::Vector<amrex::Real>& v_galilean,
const amrex::Vector<amrex::Real>& v_comoving,
const amrex::RealVect dx,
diff --git a/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp b/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp
index f29a0bd03..362af06a3 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp
+++ b/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp
@@ -25,7 +25,7 @@ SpectralSolver::SpectralSolver(
const amrex::BoxArray& realspace_ba,
const amrex::DistributionMapping& dm,
const int norder_x, const int norder_y,
- const int norder_z, const bool nodal,
+ const int norder_z, const short grid_type,
const amrex::Vector<amrex::Real>& v_galilean,
const amrex::Vector<amrex::Real>& v_comoving,
const amrex::RealVect dx, const amrex::Real dt,
@@ -55,7 +55,7 @@ SpectralSolver::SpectralSolver(
if (pml) // PSATD equations in the PML region
{
algorithm = std::make_unique<PsatdAlgorithmPml>(
- k_space, dm, m_spectral_index, norder_x, norder_y, norder_z, nodal,
+ k_space, dm, m_spectral_index, norder_x, norder_y, norder_z, grid_type,
dt, dive_cleaning, divb_cleaning);
}
else // PSATD equations in the regular domain
@@ -64,14 +64,14 @@ SpectralSolver::SpectralSolver(
if (v_comoving[0] != 0. || v_comoving[1] != 0. || v_comoving[2] != 0.)
{
algorithm = std::make_unique<PsatdAlgorithmComoving>(
- k_space, dm, m_spectral_index, norder_x, norder_y, norder_z, nodal,
+ k_space, dm, m_spectral_index, norder_x, norder_y, norder_z, grid_type,
v_comoving, dt, update_with_rho);
}
// Galilean PSATD algorithm (only J constant in time)
else if (v_galilean[0] != 0. || v_galilean[1] != 0. || v_galilean[2] != 0.)
{
algorithm = std::make_unique<PsatdAlgorithmJConstantInTime>(
- k_space, dm, m_spectral_index, norder_x, norder_y, norder_z, nodal,
+ k_space, dm, m_spectral_index, norder_x, norder_y, norder_z, grid_type,
v_galilean, dt, update_with_rho, fft_do_time_averaging,
dive_cleaning, divb_cleaning);
}
@@ -88,7 +88,7 @@ SpectralSolver::SpectralSolver(
const bool div_cleaning = (dive_cleaning && divb_cleaning);
algorithm = std::make_unique<PsatdAlgorithmFirstOrder>(
- k_space, dm, m_spectral_index, norder_x, norder_y, norder_z, nodal,
+ k_space, dm, m_spectral_index, norder_x, norder_y, norder_z, grid_type,
dt, div_cleaning, J_in_time, rho_in_time);
}
else if (psatd_solution_type == PSATDSolutionType::SecondOrder)
@@ -96,14 +96,14 @@ SpectralSolver::SpectralSolver(
if (J_in_time == JInTime::Constant)
{
algorithm = std::make_unique<PsatdAlgorithmJConstantInTime>(
- k_space, dm, m_spectral_index, norder_x, norder_y, norder_z, nodal,
+ k_space, dm, m_spectral_index, norder_x, norder_y, norder_z, grid_type,
v_galilean, dt, update_with_rho, fft_do_time_averaging,
dive_cleaning, divb_cleaning);
}
else if (J_in_time == JInTime::Linear)
{
algorithm = std::make_unique<PsatdAlgorithmJLinearInTime>(
- k_space, dm, m_spectral_index, norder_x, norder_y, norder_z, nodal,
+ k_space, dm, m_spectral_index, norder_x, norder_y, norder_z, grid_type,
dt, fft_do_time_averaging, dive_cleaning, divb_cleaning);
}
}
diff --git a/Source/FieldSolver/SpectralSolver/SpectralSolverRZ.H b/Source/FieldSolver/SpectralSolver/SpectralSolverRZ.H
index 45b55d9d4..4a6c15630 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralSolverRZ.H
+++ b/Source/FieldSolver/SpectralSolver/SpectralSolverRZ.H
@@ -31,7 +31,7 @@ class SpectralSolverRZ
amrex::BoxArray const & realspace_ba,
amrex::DistributionMapping const & dm,
int const n_rz_azimuthal_modes,
- int const norder_z, bool const nodal,
+ int const norder_z, short const grid_type,
const amrex::Vector<amrex::Real>& v_galilean,
amrex::RealVect const dx, amrex::Real const dt,
bool const with_pml,
diff --git a/Source/FieldSolver/SpectralSolver/SpectralSolverRZ.cpp b/Source/FieldSolver/SpectralSolver/SpectralSolverRZ.cpp
index 23d93fe04..9b0d2f21f 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralSolverRZ.cpp
+++ b/Source/FieldSolver/SpectralSolver/SpectralSolverRZ.cpp
@@ -20,7 +20,7 @@
*
* \param n_rz_azimuthal_modes Number of azimuthal modes
* \param norder_z Order of accuracy of the spatial derivatives along z
- * \param nodal Whether the solver is applied to a nodal or staggered grid
+ * \param grid_type Type of grid (collocated or not)
* \param dx Cell size along each dimension
* \param dt Time step
* \param with_pml Whether PML boundary will be used
@@ -29,7 +29,7 @@ SpectralSolverRZ::SpectralSolverRZ (const int lev,
amrex::BoxArray const & realspace_ba,
amrex::DistributionMapping const & dm,
int const n_rz_azimuthal_modes,
- int const norder_z, bool const nodal,
+ int const norder_z, short const grid_type,
const amrex::Vector<amrex::Real>& v_galilean,
amrex::RealVect const dx, amrex::Real const dt,
bool const with_pml,
@@ -56,17 +56,17 @@ SpectralSolverRZ::SpectralSolverRZ (const int lev,
// Initialize the corresponding coefficients over k space
if (with_pml) {
PML_algorithm = std::make_unique<PsatdAlgorithmPmlRZ>(
- k_space, dm, m_spectral_index, n_rz_azimuthal_modes, norder_z, nodal, dt);
+ k_space, dm, m_spectral_index, n_rz_azimuthal_modes, norder_z, grid_type, dt);
}
if (v_galilean[2] == 0) {
// v_galilean is 0: use standard PSATD algorithm
algorithm = std::make_unique<PsatdAlgorithmRZ>(
- k_space, dm, m_spectral_index, n_rz_azimuthal_modes, norder_z, nodal, dt,
+ k_space, dm, m_spectral_index, n_rz_azimuthal_modes, norder_z, grid_type, dt,
update_with_rho, fft_do_time_averaging, J_in_time, rho_in_time, dive_cleaning, divb_cleaning);
} else {
// Otherwise: use the Galilean algorithm
algorithm = std::make_unique<PsatdAlgorithmGalileanRZ>(
- k_space, dm, m_spectral_index, n_rz_azimuthal_modes, norder_z, nodal, v_galilean, dt, update_with_rho);
+ k_space, dm, m_spectral_index, n_rz_azimuthal_modes, norder_z, grid_type, v_galilean, dt, update_with_rho);
}
// - Initialize arrays for fields in spectral space + FFT plans