From 0564feb5041728173716ef251f1d66d37c314770 Mon Sep 17 00:00:00 2001 From: Edoardo Zoni <59625522+EZoni@users.noreply.github.com> Date: Thu, 6 Aug 2020 06:30:14 -0700 Subject: Galilean PSATD: current correction and rho-free formulation (#1151) * Introduce option to update E with/without rho * Clean up * Implement current correction for Galilean PSATD (needs bug fix) * Include equations in docs * Fix EOL whitespaces error * Small clean-up * Implement Galilean PSATD update without rho * Clean up * Fix bug in current correction * Fix EOL whitespaces * Clean up * Fix unused import * Remove unused variable * [skip CI] Improve docs * Clean up style * Fix EOL whitespaces * Fix EOL whitespaces * Clean up style * Revert analysis script to old status * [skip CI] Clean up style * Make equations more human-readable and improve comments * 2D test with current correction works * Temporary build fix as in #1197 * 3D test with current correction works * Rename th and th_star as theta and theta_star * Fix a couple of wrong comments * Add vertical spaces to improve readability * Improve documentation * Function CurrentCorrection is now pure * 2D benchmark fields data are now correct * Add limits of coefficients for nu=-1 * Change default of update_with_rho for Galilean PSATD --- .../SpectralAlgorithms/GalileanAlgorithm.H | 43 ++++++++++++++++------ 1 file changed, 31 insertions(+), 12 deletions(-) (limited to 'Source/FieldSolver/SpectralSolver/SpectralAlgorithms/GalileanAlgorithm.H') diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/GalileanAlgorithm.H b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/GalileanAlgorithm.H index 799eca8b1..83ae83d69 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/GalileanAlgorithm.H +++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/GalileanAlgorithm.H @@ -10,21 +10,37 @@ class GalileanAlgorithm : public SpectralBaseAlgorithm { public: - GalileanAlgorithm(const SpectralKSpace& spectral_kspace, - const amrex::DistributionMapping& dm, - const int norder_x, const int norder_y, - const int norder_z, const bool nodal, - const amrex::Array& v_galilean, - const amrex::Real dt); + GalileanAlgorithm (const SpectralKSpace& spectral_kspace, + const amrex::DistributionMapping& dm, + const int norder_x, const int norder_y, + const int norder_z, const bool nodal, + const amrex::Array& v_galilean, + const amrex::Real dt, + const bool update_with_rho); // Redefine update equation from base class - virtual void pushSpectralFields(SpectralFieldData& f) const override final; - virtual int getRequiredNumberOfFields() const override final { + virtual void pushSpectralFields (SpectralFieldData& f) const override final; + virtual int getRequiredNumberOfFields () const override final { return SpectralFieldIndex::n_fields; }; - void InitializeSpectralCoefficients(const SpectralKSpace& spectral_kspace, - const amrex::DistributionMapping& dm, - const amrex::Array& v_galilean, - const amrex::Real dt); + void InitializeSpectralCoefficients (const SpectralKSpace& spectral_kspace, + const amrex::DistributionMapping& dm, + const amrex::Real dt); + + /** + * \brief Virtual function for current correction in Fourier space + * ( Vay et al, 2013). + * This function overrides the virtual function \c CurrentCorrection in the + * base class \c SpectralBaseAlgorithm 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 + * \param[in] rho Unique pointer to \c MultiFab storing the charge density + */ + virtual void CurrentCorrection (SpectralFieldData& field_data, + std::array,3>& current, + const std::unique_ptr& rho) override final; /** * \brief Virtual function for Vay current deposition in Fourier space @@ -43,6 +59,9 @@ class GalileanAlgorithm : public SpectralBaseAlgorithm private: SpectralRealCoefficients C_coef, S_ck_coef; SpectralComplexCoefficients Theta2_coef, X1_coef, X2_coef, X3_coef, X4_coef; + amrex::Array m_v_galilean; + amrex::Real m_dt; + bool m_update_with_rho; }; #endif // WARPX_USE_PSATD #endif // WARPX_GALILEAN_ALGORITHM_H_ -- cgit v1.2.3