WarpX
Public Member Functions | Public Attributes | Protected Attributes | Private Member Functions | Private Attributes | List of all members
SpectralSolver Class Reference

Top-level class for the electromagnetic spectral solver. More...

#include <SpectralSolver.H>

Public Member Functions

 SpectralSolver (int lev, const amrex::BoxArray &realspace_ba, const amrex::DistributionMapping &dm, int norder_x, int norder_y, int norder_z, short grid_type, const amrex::Vector< amrex::Real > &v_galilean, const amrex::Vector< amrex::Real > &v_comoving, amrex::RealVect dx, amrex::Real dt, bool pml, bool periodic_single_box, bool update_with_rho, bool fft_do_time_averaging, int psatd_solution_type, int J_in_time, int rho_in_time, bool dive_cleaning, bool divb_cleaning)
 Constructor of the class SpectralSolver. More...
 
void ForwardTransform (int lev, const amrex::MultiFab &mf, int field_index, int i_comp=0)
 Transform the component i_comp of the MultiFab mf to Fourier space, and store the result internally (in the spectral field specified by field_index) More...
 
void BackwardTransform (int lev, amrex::MultiFab &mf, int field_index, const amrex::IntVect &fill_guards, int i_comp=0)
 Transform spectral field specified by field_index back to real space, and store it in the component i_comp of mf More...
 
void pushSpectralFields ()
 Update the fields in spectral space, over one timestep. More...
 
void ComputeSpectralDivE (int lev, const std::array< std::unique_ptr< amrex::MultiFab >, 3 > &Efield, amrex::MultiFab &divE)
 Public interface to call the member function ComputeSpectralDivE of the base class SpectralBaseAlgorithm from objects of class SpectralSolver. More...
 
void CurrentCorrection ()
 Public interface to call the virtual function CurrentCorrection, defined in the base class SpectralBaseAlgorithm and possibly overridden by its derived classes (e.g. PsatdAlgorithm, PsatdAlgorithmComoving, etc.), from objects of class SpectralSolver through the private unique pointer algorithm. More...
 
void VayDeposition ()
 Public interface to call the virtual function VayDeposition, declared in the base class SpectralBaseAlgorithm and defined in its derived classes, from objects of class SpectralSolver through the private unique pointer algorithm. More...
 
void CopySpectralDataComp (const int src_comp, const int dest_comp)
 Copy spectral data from component src_comp to component dest_comp of field_data.fields. More...
 
void ZeroOutDataComp (const int icomp)
 Set to zero the data on component icomp of field_data.fields. More...
 
void ScaleDataComp (const int icomp, const amrex::Real scale_factor)
 Scale the data on component icomp of field_data.fields by a given scale factor. More...
 

Public Attributes

SpectralFieldIndex m_spectral_index
 

Protected Attributes

amrex::IntVect m_fill_guards
 

Private Member Functions

void ReadParameters ()
 

Private Attributes

SpectralFieldData field_data
 
std::unique_ptr< SpectralBaseAlgorithmalgorithm
 

Detailed Description

Top-level class for the electromagnetic spectral solver.

Stores the field in spectral space, and has member functions to Fourier-transform the fields between real space and spectral space and to update fields in spectral space over one time step.

Constructor & Destructor Documentation

◆ SpectralSolver()

SpectralSolver::SpectralSolver ( int  lev,
const amrex::BoxArray realspace_ba,
const amrex::DistributionMapping dm,
int  norder_x,
int  norder_y,
int  norder_z,
short  grid_type,
const amrex::Vector< amrex::Real > &  v_galilean,
const amrex::Vector< amrex::Real > &  v_comoving,
amrex::RealVect  dx,
amrex::Real  dt,
bool  pml,
bool  periodic_single_box,
bool  update_with_rho,
bool  fft_do_time_averaging,
int  psatd_solution_type,
int  J_in_time,
int  rho_in_time,
bool  dive_cleaning,
bool  divb_cleaning 
)

Constructor of the class SpectralSolver.

Select the spectral algorithm to be used, allocate the corresponding coefficients for the discrete field update equations, and prepare the structures that store the fields in spectral space.

Parameters
[in]levmesh refinement level
[in]realspace_baBoxArray in real space
[in]dmDistributionMapping for the given BoxArray
[in]norder_xspectral order along x
[in]norder_yspectral order along y
[in]norder_zspectral order along z
[in]grid_typetype of grid (collocated or not)
[in]v_galileanthree-dimensional vector containing the components of the Galilean velocity for the standard or averaged Galilean PSATD solvers
[in]v_comovingthree-dimensional vector containing the components of the comoving velocity for the comoving PSATD solver
[in]dxAMREX_SPACEDIM-dimensional vector containing the cell sizes along each direction
[in]dttime step for the analytical integration of Maxwell's equations
[in]pmlwhether the boxes in the given BoxArray are PML boxes
[in]periodic_single_boxwhether there is only one periodic single box (no domain decomposition)
[in]update_with_rhowhether rho is used in the field update equations
[in]fft_do_time_averagingwhether the time averaging algorithm is used
[in]psatd_solution_typewhether the PSATD equations are derived from a first-order or second-order model
[in]J_in_timeinteger that corresponds to the time dependency of J (constant, linear) for the PSATD algorithm
[in]rho_in_timeinteger that corresponds to the time dependency of rho (linear, quadratic) for the PSATD algorithm
[in]dive_cleaningwhether to use div(E) cleaning to account for errors in Gauss law (new field F in the update equations)
[in]divb_cleaningwhether to use div(B) cleaning to account for errors in div(B) = 0 law (new field G in the update equations)

Member Function Documentation

◆ BackwardTransform()

void SpectralSolver::BackwardTransform ( int  lev,
amrex::MultiFab mf,
int  field_index,
const amrex::IntVect fill_guards,
int  i_comp = 0 
)

Transform spectral field specified by field_index back to real space, and store it in the component i_comp of mf

◆ ComputeSpectralDivE()

void SpectralSolver::ComputeSpectralDivE ( int  lev,
const std::array< std::unique_ptr< amrex::MultiFab >, 3 > &  Efield,
amrex::MultiFab divE 
)
inline

Public interface to call the member function ComputeSpectralDivE of the base class SpectralBaseAlgorithm from objects of class SpectralSolver.

◆ CopySpectralDataComp()

void SpectralSolver::CopySpectralDataComp ( const int  src_comp,
const int  dest_comp 
)
inline

Copy spectral data from component src_comp to component dest_comp of field_data.fields.

Parameters
[in]src_compcomponent of the source FabArray from which the data are copied
[in]dest_compcomponent of the destination FabArray where the data are copied

◆ CurrentCorrection()

void SpectralSolver::CurrentCorrection ( )
inline

Public interface to call the virtual function CurrentCorrection, defined in the base class SpectralBaseAlgorithm and possibly overridden by its derived classes (e.g. PsatdAlgorithm, PsatdAlgorithmComoving, etc.), from objects of class SpectralSolver through the private unique pointer algorithm.

◆ ForwardTransform()

void SpectralSolver::ForwardTransform ( int  lev,
const amrex::MultiFab mf,
int  field_index,
int  i_comp = 0 
)

Transform the component i_comp of the MultiFab mf to Fourier space, and store the result internally (in the spectral field specified by field_index)

Parameters
[in]levmesh refinement level
[in]mfMultiFab that is transformed to Fourier space (component i_comp)
[in]field_indexindex of the spectral field that stores the FFT result
[in]i_compcomponent of the MultiFab mf that is transformed to Fourier space

◆ pushSpectralFields()

void SpectralSolver::pushSpectralFields ( )

Update the fields in spectral space, over one timestep.

◆ ReadParameters()

void SpectralSolver::ReadParameters ( )
private

◆ ScaleDataComp()

void SpectralSolver::ScaleDataComp ( const int  icomp,
const amrex::Real  scale_factor 
)
inline

Scale the data on component icomp of field_data.fields by a given scale factor.

Parameters
[in]icompcomponent of the FabArray where the data are scaled
[in]scale_factorscale factor to use for scaling

◆ VayDeposition()

void SpectralSolver::VayDeposition ( )
inline

Public interface to call the virtual function VayDeposition, declared in the base class SpectralBaseAlgorithm and defined in its derived classes, from objects of class SpectralSolver through the private unique pointer algorithm.

◆ ZeroOutDataComp()

void SpectralSolver::ZeroOutDataComp ( const int  icomp)
inline

Set to zero the data on component icomp of field_data.fields.

Parameters
[in]icompcomponent of the FabArray where the data are set to zero

Member Data Documentation

◆ algorithm

std::unique_ptr<SpectralBaseAlgorithm> SpectralSolver::algorithm
private

◆ field_data

SpectralFieldData SpectralSolver::field_data
private

◆ m_fill_guards

amrex::IntVect SpectralSolver::m_fill_guards
protected

◆ m_spectral_index

SpectralFieldIndex SpectralSolver::m_spectral_index

The documentation for this class was generated from the following files: