Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
amrex::FFT::OpenBCSolver< T > Class Template Reference

Convolution-based solver for open boundary conditions using Green's functions. More...

#include <AMReX_FFT_OpenBCSolver.H>

Public Types

using MF = typename R2C< T >::MF
 
using cMF = typename R2C< T >::cMF
 

Public Member Functions

 OpenBCSolver (Box const &domain, Info const &info=Info{})
 Build a solver over domain using the FFT Info settings in info.
 
template<class F >
void setGreensFunction (F const &greens_function)
 Populate the spectral Green's function used by subsequent solves.
 
void solve (MF &phi, MF const &rho)
 Solve for phi given right-hand side rho.
 
Box const & Domain () const
 Access the physical domain this solver was built for.
 
IntVect const & PaddedLength () const
 Access the one-sided padded length used to build the internal FFT domain.
 
cMFgreensFunctionFFT () noexcept
 Access the spectral Green's function held by this solver.
 
cMF const & greensFunctionFFT () const noexcept
 Access the spectral Green's function held by this solver.
 

Detailed Description

template<typename T = Real>
class amrex::FFT::OpenBCSolver< T >

Convolution-based solver for open boundary conditions using Green's functions.

The class wraps an internal R2C plan and multiplies spectral data by a user-provided Green's function to solve Laplace/Poisson problems on a rectangular domain. It currently solves one right-hand-side component per call; the supplied FFT::Info must have batch_size == 1.

Member Typedef Documentation

◆ cMF

template<typename T = Real>
using amrex::FFT::OpenBCSolver< T >::cMF = typename R2C<T>::cMF

◆ MF

template<typename T = Real>
using amrex::FFT::OpenBCSolver< T >::MF = typename R2C<T>::MF

Constructor & Destructor Documentation

◆ OpenBCSolver()

template<typename T >
amrex::FFT::OpenBCSolver< T >::OpenBCSolver ( Box const &  domain,
Info const &  info = Info{} 
)
explicit

Build a solver over domain using the FFT Info settings in info.

Parameters
domainPhysical domain (cell or nodal indexing).
infoOptional FFT configuration. Batched solves are not supported.

Member Function Documentation

◆ Domain()

template<typename T = Real>
Box const & amrex::FFT::OpenBCSolver< T >::Domain ( ) const
inline

Access the physical domain this solver was built for.

Returns
Original (un-extended) problem domain.

◆ greensFunctionFFT() [1/2]

template<typename T = Real>
cMF const & amrex::FFT::OpenBCSolver< T >::greensFunctionFFT ( ) const
inlinenoexcept

Access the spectral Green's function held by this solver.

Returns
The spectral Green's function.

◆ greensFunctionFFT() [2/2]

template<typename T = Real>
cMF & amrex::FFT::OpenBCSolver< T >::greensFunctionFFT ( )
inlinenoexcept

Access the spectral Green's function held by this solver.

This lets a caller keep its own set of Green's functions and move them into and out of the solver, for instance with std::swap, instead of recomputing them with setGreensFunction(). Since solve() only reads the spectral Green's function, one moved in this way needs no further preparation.

Note
In 2D, this is an alias of the Green's function R2C's spectral data. Callers may write through it, but must not swap or otherwise re-seat it, because a later setGreensFunction() writes into the aliased array.
Returns
The spectral Green's function.

◆ PaddedLength()

template<typename T = Real>
IntVect const & amrex::FFT::OpenBCSolver< T >::PaddedLength ( ) const
inline

Access the one-sided padded length used to build the internal FFT domain.

Returns
Padded length before the open-boundary convolution domain is doubled.

◆ setGreensFunction()

template<typename T >
template<class F >
void amrex::FFT::OpenBCSolver< T >::setGreensFunction ( F const &  greens_function)

Populate the spectral Green's function used by subsequent solves.

Template Parameters
FCallable type satisfying T(int i, int j, int k).
Parameters
greens_functionFunctor that evaluates the physical-space Green's function.

◆ solve()

template<typename T >
void amrex::FFT::OpenBCSolver< T >::solve ( MF phi,
MF const &  rho 
)

Solve for phi given right-hand side rho.

Parameters
phiSolution MultiFab (overwritten in place).
rhoRight-hand-side MultiFab.

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