aboutsummaryrefslogtreecommitdiff
path: root/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithm.H
diff options
context:
space:
mode:
authorGravatar Edoardo Zoni <59625522+EZoni@users.noreply.github.com> 2021-03-29 12:47:19 -0700
committerGravatar GitHub <noreply@github.com> 2021-03-29 12:47:19 -0700
commit59826e1ed26081f442304db0ac112de90f0a390d (patch)
tree29d016a72bb0b8531b72a53d99af94917f4f3528 /Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithm.H
parent329037c07180517491388e54e5ed4f728f39396b (diff)
downloadWarpX-59826e1ed26081f442304db0ac112de90f0a390d.tar.gz
WarpX-59826e1ed26081f442304db0ac112de90f0a390d.tar.zst
WarpX-59826e1ed26081f442304db0ac112de90f0a390d.zip
Class `PsatdAlgorithm`: Simplify Initialization of Coefficients (#1819)
* Split Initialization Functions of Spectral Coefficients * Simplify Initialization of Coefficients Without Averaging * Do Not Store Coefficients C1,S1,C3,S3 With Averaging * Simplify Initialization of Coefficients With Averaging * Add amrex:: Prefix Following WarpX Style Guidelines * Match Names Of Coefficients With/Without Averaging * 'pow' Cannot Be Used in a Constant Expression * Update Doxygen Documentation
Diffstat (limited to '')
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithm.H50
1 files changed, 43 insertions, 7 deletions
diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithm.H b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithm.H
index efa907d14..973265cdf 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithm.H
+++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithm.H
@@ -17,7 +17,20 @@ class PsatdAlgorithm : public SpectralBaseAlgorithm
{
public:
- // TODO Add Doxygen docs
+ /**
+ * \brief Constructor of the class PsatdAlgorithm
+ *
+ * \param[in] spectral_kspace spectral space
+ * \param[in] dm distribution mapping
+ * \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] 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
+ * \param[in] time_averaging whether to use time averaging for large time steps
+ */
PsatdAlgorithm (
const SpectralKSpace& spectral_kspace,
const amrex::DistributionMapping& dm,
@@ -30,10 +43,16 @@ class PsatdAlgorithm : public SpectralBaseAlgorithm
const bool update_with_rho,
const bool time_averaging);
- // TODO Add Doxygen docs
+ /**
+ * \brief Updates the E and B fields in spectral space, according to the relevant PSATD equations
+ *
+ * \param[in,out] f all the fields in spectral space
+ */
virtual void pushSpectralFields (SpectralFieldData& f) const override final;
- // TODO Add Doxygen docs
+ /**
+ * \brief Returns the number of fields stored in spectral space
+ */
virtual int getRequiredNumberOfFields () const override final
{
if (m_time_averaging) {
@@ -43,13 +62,32 @@ class PsatdAlgorithm : public SpectralBaseAlgorithm
}
}
- // TODO Add Doxygen docs
+ /**
+ * \brief Initializes the coefficients used in \c pushSpectralFields to update the E and B fields
+ *
+ * \param[in] spectral_kspace spectral space
+ * \param[in] dm distribution mapping
+ * \param[in] dt time step of the simulation
+ */
void InitializeSpectralCoefficients (
const SpectralKSpace& spectral_kspace,
const amrex::DistributionMapping& dm,
const amrex::Real dt);
/**
+ * \brief Initializes additional coefficients used in \c pushSpectralFields to update the E and B fields,
+ * required only when using time averaging with large time steps
+ *
+ * \param[in] spectral_kspace spectral space
+ * \param[in] dm distribution mapping
+ * \param[in] dt time step of the simulation
+ */
+ void InitializeSpectralCoefficientsAveraging (
+ const SpectralKSpace& spectral_kspace,
+ const amrex::DistributionMapping& dm,
+ const amrex::Real dt);
+
+ /**
* \brief Virtual function for current correction in Fourier space
* (<a href="https://doi.org/10.1016/j.jcp.2013.03.010"> Vay et al, 2013</a>).
* This function overrides the virtual function \c CurrentCorrection in the
@@ -90,9 +128,7 @@ class PsatdAlgorithm : public SpectralBaseAlgorithm
SpectralComplexCoefficients T2_coef, X1_coef, X2_coef, X3_coef, X4_coef;
// These real and complex coefficients are allocated only with averaged Galilean PSATD
- SpectralRealCoefficients C1_coef, C3_coef, S1_coef, S3_coef;
- SpectralComplexCoefficients Psi1_coef, Psi2_coef, Psi3_coef, Psi4_coef,
- A1_coef, A2_coef, Rhoold_coef, Rhonew_coef, Jcoef_coef;
+ SpectralComplexCoefficients Psi1_coef, Psi2_coef, Y1_coef, Y2_coef, Y3_coef, Y4_coef;
// Centered modified finite-order k vectors
KVectorComponent modified_kx_vec_centered;