aboutsummaryrefslogtreecommitdiff
path: root/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/GalileanPsatdAlgorithmRZ.H
diff options
context:
space:
mode:
authorGravatar David Grote <grote1@llnl.gov> 2020-09-24 21:10:05 -0700
committerGravatar GitHub <noreply@github.com> 2020-09-24 21:10:05 -0700
commit6f0fbb9a685717070ffbf363d96a81343890526c (patch)
tree96c641b5d84be0a67b0dd917330126214cb59cda /Source/FieldSolver/SpectralSolver/SpectralAlgorithms/GalileanPsatdAlgorithmRZ.H
parentde61ccbe14a552f8ebbe9255b485cb6bbc0f90da (diff)
downloadWarpX-6f0fbb9a685717070ffbf363d96a81343890526c.tar.gz
WarpX-6f0fbb9a685717070ffbf363d96a81343890526c.tar.zst
WarpX-6f0fbb9a685717070ffbf363d96a81343890526c.zip
RZ spectral current correction and Galilean (#1216)
* Added stub for current correction in RZ spectral solver * Fixed comments in RZ spectral for current correction stub * Modified automated test for Galilean PSATD (#1033) * Impemented current correction in RZ spectral * Implementation Galilean version of RZ spectral solver * For RZ spectral, do forward and backward transform with current correction * Big fix in DivEFunctor.cpp for RZ spectral * Added RZ rho diagnostic for saving the modes * Implemented fft_periodic_single_box for RZ spectral * Moved routines from SpectralSolverRZ.H to .cpp * Added hook for VayDeposition in GalileanPsatdAlgorithmRZ * Bug fix in DivEFunctor * Fixes and cleanup for GalileanPsatdAlgorithmRZ * Fix line spacing in SpectralSolverRZ.H * Fix factor 1/2 in update of Ep_m * Fix factor 1/2 in update of Em_m * Fix sign error in current correction in GalileanPsatdAlgorithmRZ.cpp Co-authored-by: Edoardo Zoni <59625522+EZoni@users.noreply.github.com> * Add Langmuir RZ PSATD test with current correction * Add Galilean tests with/without current correction * For RZ psatd, simplified copy for forward transform * Added GalileanPsatdAlgorithmRZ.cpp to CMakeLists * Minor cleanup in RZ spectral solver * In GalileanPsatdAlgorithmRZ.cpp use member initialization for m_v_galilean Co-authored-by: Edoardo Zoni <59625522+EZoni@users.noreply.github.com> * Added some _rt to GalileanPsatdAlgorithmRZ.cpp Co-authored-by: Olga Shapoval <30510597+oshapoval@users.noreply.github.com> Co-authored-by: Edoardo Zoni <59625522+EZoni@users.noreply.github.com> Co-authored-by: Edoardo Zoni <ezoni@lbl.gov>
Diffstat (limited to 'Source/FieldSolver/SpectralSolver/SpectralAlgorithms/GalileanPsatdAlgorithmRZ.H')
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralAlgorithms/GalileanPsatdAlgorithmRZ.H72
1 files changed, 72 insertions, 0 deletions
diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/GalileanPsatdAlgorithmRZ.H b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/GalileanPsatdAlgorithmRZ.H
new file mode 100644
index 000000000..3c8d3d60e
--- /dev/null
+++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/GalileanPsatdAlgorithmRZ.H
@@ -0,0 +1,72 @@
+/* Copyright 2019 David Grote
+ *
+ * This file is part of WarpX.
+ *
+ * License: BSD-3-Clause-LBNL
+ */
+#ifndef WARPX_GALILEAN_PSATD_ALGORITHM_RZ_H_
+#define WARPX_GALILEAN_PSATD_ALGORITHM_RZ_H_
+
+#include "SpectralBaseAlgorithmRZ.H"
+
+/* \brief Class that updates the field in spectral space
+ * and stores the coefficients of the corresponding update equation.
+ */
+class GalileanPsatdAlgorithmRZ : public SpectralBaseAlgorithmRZ
+{
+
+ public:
+ GalileanPsatdAlgorithmRZ (SpectralKSpaceRZ const & spectral_kspace,
+ amrex::DistributionMapping const & dm,
+ int const n_rz_azimuthal_modes, int const norder_z,
+ bool const nodal,
+ const amrex::Array<amrex::Real,3>& v_galilean,
+ amrex::Real const dt_step);
+ // Redefine functions from base class
+ virtual void pushSpectralFields (SpectralFieldDataRZ & f) override final;
+ virtual int getRequiredNumberOfFields () const override final {
+ return SpectralFieldIndex::n_fields;
+ }
+
+ void InitializeSpectralCoefficients (SpectralFieldDataRZ const & f);
+
+ /**
+ * \brief Virtual function for current correction in Fourier space
+ * This function overrides the virtual function \c CurrentCorrection in the
+ * base class \c SpectralBaseAlgorithmRZ (qualifier \c override) and cannot be
+ * overridden by further derived classes (qualifier \c final).
+ *
+ * \param[in,out] field_data all fields in Fourier space
+ * \param[in,out] current two-dimensional array of unique pointers to MultiFab
+ * storing the three components of the current density
+ * \param[in] rho unique pointer to MultiFab storing the charge density
+ */
+ virtual void CurrentCorrection ( SpectralFieldDataRZ& field_data,
+ std::array<std::unique_ptr<amrex::MultiFab>,3>& current,
+ const std::unique_ptr<amrex::MultiFab>& rho ) override final;
+
+ /**
+ * \brief Virtual function for Vay current deposition in Fourier space
+ * This function overrides the virtual function \c VayDeposition in the
+ * base class \c SpectralBaseAlgorithmRZ and cannot be overridden by further
+ * derived classes.
+ *
+ * \param[in,out] field_data All fields in Fourier space
+ * \param[in,out] current Array of unique pointers to \c MultiFab storing
+ * the three components of the current density
+ */
+ virtual void VayDeposition (SpectralFieldDataRZ& field_data,
+ std::array<std::unique_ptr<amrex::MultiFab>,3>& current) override final;
+
+ private:
+ bool coefficients_initialized;
+ // Note that dt and v_galilean are saved to use in InitializeSpectralCoefficients
+ amrex::Real const m_dt;
+ amrex::Array<amrex::Real,3> m_v_galilean;
+
+ SpectralRealCoefficients C_coef, S_ck_coef;
+ SpectralComplexCoefficients Theta2_coef, X1_coef, X2_coef, X3_coef, X4_coef;
+
+};
+
+#endif // WARPX_GALILEAN_PSATD_ALGORITHM_RZ_H_