IPPL API Reference
Independent Parallel Particle Layer C++ API
Loading...
Searching...
No Matches
ippl::FFTOpenPoissonSolver< FieldLHS, FieldRHS > Class Template Reference
+ Inheritance diagram for ippl::FFTOpenPoissonSolver< FieldLHS, FieldRHS >:
+ Collaboration diagram for ippl::FFTOpenPoissonSolver< FieldLHS, FieldRHS >:

Public Types

enum  Algorithm { HOCKNEY = 0b01 , VICO = 0b10 , BIHARMONIC = 0b11 , DCT_VICO = 0b100 }
 
enum  GreenFunction { STANDARD = 0 , INTEGRATED = 1 }
 Real-space Green-function model used by the Hockney open-boundary solver. More...
 
using Base = Poisson< FieldLHS, FieldRHS >
 
typedef FFT< RCTransform, FieldRHS > FFT_t
 
typedef FieldRHS Field_t
 
typedef FieldLHS::Centering_t Centering
 
typedef Field< int, Dim, mesh_type, CenteringIField_t
 
typedef Field< Tg, Dim, mesh_type, CenteringField_gt
 
typedef Field< Kokkos::complex< Tg >, Dim, mesh_type, CenteringCxField_gt
 
typedef FFT_t::ComplexField CxField_t
 
typedef Vector< Trhs, Dim > Vector_t
 
typedef mesh_type::matrix_type Matrix_t
 
typedef Field< Matrix_t, Dim, mesh_type, CenteringMField_t
 
typedef FieldLayout< Dim > FieldLayout_t
 
using memory_space = typename FieldLHS::memory_space
 
using buffer_type = mpi::Communicator::buffer_type< memory_space >
 
using vector_type = typename mesh_type::vector_type
 
using scalar_type = typename mesh_type::value_type
 
using lhs_type = FieldLHS
 
using rhs_type = FieldRHS
 
- Public Types inherited from ippl::Poisson< FieldLHS, FieldRHS >
enum  OutputType { SOL = 0b01 , GRAD = 0b10 , SOL_AND_GRAD = 0b11 }
 
using lhs_type = FieldLHS
 
using rhs_type = FieldRHS
 
using Tlhs = typename FieldLHS::value_type
 
using Trhs = typename FieldRHS::value_type
 
using grad_type = Field< Vector< Tlhs, Dim >, Dim, Mesh, Centering >
 

Public Member Functions

 FFTOpenPoissonSolver (rhs_type &rhs, ParameterList &params)
 
 FFTOpenPoissonSolver (lhs_type &lhs, rhs_type &rhs, ParameterList &params)
 
void setRhs (rhs_type &rhs) override
 
void setGradFD ()
 
void solve () override
 
MField_tgetHessian () override
 
void greensFunction ()
 Compute and cache the FFT of the selected Green function.
 
void shiftedGreensFunction (const Vector< double, Dim > &shift)
 Replace the cached kernel by a shifted Hockney Green function.
 
void initializeFields ()
 
void communicateVico (Vector< int, Dim > size, typename CxField_gt::view_type view_g, const ippl::NDIndex< Dim > ldom_g, const int nghost_g, typename Field_t::view_type view, const ippl::NDIndex< Dim > ldom, const int nghost)
 
void communicateVico (Vector< int, Dim > size, typename Field_t::view_type view_g, const ippl::NDIndex< Dim > ldom_g, const int nghost_g, typename Field_t::view_type view, const ippl::NDIndex< Dim > ldom, const int nghost)
 
- Public Member Functions inherited from ippl::Poisson< FieldLHS, FieldRHS >
 Poisson ()
 
 Poisson (lhs_type &lhs, rhs_type &rhs)
 
template<typename T >
void updateParameter (const std::string &key, const T &value)
 
void updateParameters (const ParameterList &params)
 
void mergeParameters (const ParameterList &params)
 
virtual void setLhs (lhs_type &lhs)
 
void setGradient (grad_type &grad)
 

Protected Member Functions

virtual void setDefaultParameters () override
 

Additional Inherited Members

- Protected Attributes inherited from ippl::Poisson< FieldLHS, FieldRHS >
ParameterList params_m
 
rhs_type * rhs_mp = nullptr
 
lhs_type * lhs_mp = nullptr
 
grad_typegrad_mp
 

Member Enumeration Documentation

◆ GreenFunction

template<typename FieldLHS , typename FieldRHS >
enum ippl::FFTOpenPoissonSolver::GreenFunction

Real-space Green-function model used by the Hockney open-boundary solver.

STANDARD samples the free-space Green function at doubled-grid points:

\[ G(\mathbf{r}) = -\frac{1}{4\pi |\mathbf{r}|}. \]

INTEGRATED uses the cell-averaged Green function of Qiang et al. for a uniform charge density in each source cell:

\[ \overline{G}(\mathbf{r}) = -\frac{1}{4\pi h_x h_y h_z} \int_{-h_x/2}^{h_x/2} \int_{-h_y/2}^{h_y/2} \int_{-h_z/2}^{h_z/2} \frac{dx' dy' dz'} {\sqrt{(x-x')^2 + (y-y')^2 + (z-z')^2}}. \]

The integrated kernel is currently supported for 3D Hockney open boundary conditions only. It is intended for high-aspect-ratio beams where point sampling of \(1/r\) can be inefficient near narrow dimensions.

References:

Member Function Documentation

◆ getHessian()

template<typename FieldLHS , typename FieldRHS >
MField_t * ippl::FFTOpenPoissonSolver< FieldLHS, FieldRHS >::getHessian ( )
inlineoverridevirtual

Get the Hessian matrix of the solution

Returns
Matrix field containing the Hessian of the lhs

Reimplemented from ippl::Poisson< FieldLHS, FieldRHS >.

◆ greensFunction()

template<typename FieldLHS , typename FieldRHS >
void ippl::FFTOpenPoissonSolver< FieldLHS, FieldRHS >::greensFunction ( )

Compute and cache the FFT of the selected Green function.

The selected kernel is controlled by the integer parameter greens_function, with values from GreenFunction. For Hockney, the real-space kernel is filled on the doubled convolution grid and then transformed into grntr_m. The default is GreenFunction::STANDARD to preserve historical IPPL behavior.

◆ setDefaultParameters()

template<typename FieldLHS , typename FieldRHS >
virtual void ippl::FFTOpenPoissonSolver< FieldLHS, FieldRHS >::setDefaultParameters ( )
inlineoverrideprotectedvirtual

Utility function for initializing a solver's default parameters (to be overridden for each base class)

Reimplemented from ippl::Poisson< FieldLHS, FieldRHS >.

◆ setRhs()

template<typename FieldLHS , typename FieldRHS >
void ippl::FFTOpenPoissonSolver< FieldLHS, FieldRHS >::setRhs ( rhs_type &  rhs)
overridevirtual

Set the problem RHS

Parameters
rhsReference to problem RHS field

Reimplemented from ippl::Poisson< FieldLHS, FieldRHS >.

◆ shiftedGreensFunction()

template<typename FieldLHS , typename FieldRHS >
void ippl::FFTOpenPoissonSolver< FieldLHS, FieldRHS >::shiftedGreensFunction ( const Vector< double, Dim > &  shift)

Replace the cached kernel by a shifted Hockney Green function.

For GreenFunction::STANDARD, the shifted kernel is

\[ G_s(\mathbf{r}) = -\frac{1}{4\pi |\mathbf{r}-\mathbf{s}|}, \]

where \(\mathbf{s}\) is shift.

For GreenFunction::INTEGRATED, the same translation is applied before the cell average:

\[ \overline{G}_s(\mathbf{r}) = -\frac{1}{4\pi h_x h_y h_z} \int_{\mathrm{cell}} \frac{d^3\mathbf{r}'} {|\mathbf{r}-\mathbf{s}-\mathbf{r}'|}. \]

After this call, solve() convolves the RHS with the shifted kernel until greensFunction() is called again or the mesh spacing changes.

Intended use for Dirichlet boundary conditions via the method of images: choose the shift from the plane location and domain center, solve with the shifted kernel, then let the caller flip/sign-compose the image contribution. See test/solver/TestShiftedGreensFunction.cpp for the reference orchestration.

Precondition
algorithm == HOCKNEY.
GreenFunction::INTEGRATED additionally requires Dim == 3.

◆ solve()

template<typename FieldLHS , typename FieldRHS >
void ippl::FFTOpenPoissonSolver< FieldLHS, FieldRHS >::solve ( )
overridevirtual

Solve the Poisson problem described by -laplace(lhs) = rhs

Implements ippl::Poisson< FieldLHS, FieldRHS >.


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