ARTEMIS
SpectralBaseAlgorithm.H
Go to the documentation of this file.
1 /* Copyright 2019 Remi Lehe, Edoardo Zoni
2  *
3  * This file is part of WarpX.
4  *
5  * License: BSD-3-Clause-LBNL
6  */
7 #ifndef WARPX_SPECTRAL_BASE_ALGORITHM_H_
8 #define WARPX_SPECTRAL_BASE_ALGORITHM_H_
9 
11 #include "Utils/WarpX_Complex.H"
12 
15 
16 #include <AMReX_BaseFab.H>
17 #include <AMReX_Config.H>
18 #include <AMReX_FabArray.H>
19 #include <AMReX_REAL.H>
20 
21 #include <AMReX_BaseFwd.H>
22 
23 #include <array>
24 #include <memory>
25 
26 #if WARPX_USE_PSATD
27 
28 /* \brief Class that updates the field in spectral space
29  * and stores the coefficients of the corresponding update equation.
30  *
31  * `SpectralBaseAlgorithm` is only a base class and cannot be used directly.
32  * Instead use its subclasses, which implement the specific field update
33  * equations for a given spectral algorithm.
34  */
36 {
37  public:
38  // Virtual member function ; meant to be overridden in subclasses
39  virtual void pushSpectralFields(SpectralFieldData& f) const = 0;
40 
41  // The destructor should also be a virtual function, so that
42  // a pointer to subclass of `SpectraBaseAlgorithm` actually
43  // calls the subclass's destructor.
45 
53  virtual void CurrentCorrection (SpectralFieldData& field_data) = 0;
54 
62  virtual void VayDeposition (SpectralFieldData& field_data) = 0;
63 
67  void ComputeSpectralDivE ( const int lev,
68  SpectralFieldData& field_data,
69  const std::array<std::unique_ptr<amrex::MultiFab>,3>& Efield,
70  amrex::MultiFab& divE );
71 
72  protected: // Meant to be used in the subclasses
73 
75  amrex::FabArray< amrex::BaseFab <amrex::Real> >;
77  amrex::FabArray< amrex::BaseFab <Complex> >;
78 
82  SpectralBaseAlgorithm(const SpectralKSpace& spectral_kspace,
84  const SpectralFieldIndex& spectral_index,
85  const int norder_x, const int norder_y,
86  const int norder_z, const short grid_type);
87 
89 
90  // Modified finite-order vectors
92 #if defined(WARPX_DIM_3D)
93  KVectorComponent modified_ky_vec;
94 #endif
96 };
97 
98 #endif // WARPX_USE_PSATD
99 #endif // WARPX_SPECTRAL_BASE_ALGORITHM_H_
Definition: SpectralBaseAlgorithm.H:36
KVectorComponent modified_kz_vec
Definition: SpectralBaseAlgorithm.H:95
virtual void pushSpectralFields(SpectralFieldData &f) const =0
SpectralFieldIndex m_spectral_index
Definition: SpectralBaseAlgorithm.H:88
virtual ~SpectralBaseAlgorithm()
Definition: SpectralBaseAlgorithm.H:44
KVectorComponent modified_kx_vec
Definition: SpectralBaseAlgorithm.H:91
SpectralBaseAlgorithm(const SpectralKSpace &spectral_kspace, const amrex::DistributionMapping &dm, const SpectralFieldIndex &spectral_index, const int norder_x, const int norder_y, const int norder_z, const short grid_type)
Constructor.
Definition: SpectralBaseAlgorithm.cpp:30
virtual void VayDeposition(SpectralFieldData &field_data)=0
Virtual function for Vay current deposition in Fourier space (Vay et al, 2013). This virtual function...
virtual void CurrentCorrection(SpectralFieldData &field_data)=0
Virtual function for current correction in Fourier space (Vay et al, 2013). This virtual function is ...
void ComputeSpectralDivE(const int lev, SpectralFieldData &field_data, const std::array< std::unique_ptr< amrex::MultiFab >, 3 > &Efield, amrex::MultiFab &divE)
Compute spectral divergence of E.
Definition: SpectralBaseAlgorithm.cpp:54
Class that stores the fields in spectral space, and performs the Fourier transforms between real spac...
Definition: SpectralFieldData.H:122
Definition: SpectralFieldData.H:33
Class that represents the spectral space.
Definition: SpectralKSpace.H:48
f
Definition: write_atomic_data_cpp.py:88