OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
FFTPoissonSolver Class Reference

#include <FFTPoissonSolver.h>

Inheritance diagram for FFTPoissonSolver:
Collaboration diagram for FFTPoissonSolver:

Public Types

typedef FFT< RCTransform, 3, double > FFT_t

Public Member Functions

 FFTPoissonSolver (PartBunch &bunch, std::string greensFuntion)
 FFTPoissonSolver (Mesh_t *mesh, FieldLayout_t *fl, std::string greensFunction, std::string bcz)
 ~FFTPoissonSolver ()
void computePotential (Field_t &rho, Vector_t hr, double zshift)
void computePotential (Field_t &rho, Vector_t hr)
void greensFunction ()
void integratedGreensFunction ()
 compute the integrated Green function as described in Three-dimensional quasistatic model for high brightness beam dynamics simulation by Qiang et al.
void shiftedIntGreensFunction (double zshift)
 compute the shifted integrated Green function as described in Three-dimensional quasistatic model for high brightness beam dynamics simulation by Qiang et al.
double getXRangeMin (unsigned short)
double getXRangeMax (unsigned short)
double getYRangeMin (unsigned short)
double getYRangeMax (unsigned short)
double getZRangeMin (unsigned short)
double getZRangeMax (unsigned short)
void test (PartBunchBase< double, 3 > *)
Informprint (Inform &os) const
virtual void solve (AmrScalarFieldContainer_t &, AmrScalarFieldContainer_t &, AmrVectorFieldContainer_t &, unsigned short, unsigned short, bool=true)
virtual void hasToRegrid ()
virtual void resizeMesh (Vector_t &, Vector_t &, const Vector_t &, const Vector_t &, double)
virtual double getinteractionRadius () const
virtual void calculatePairForces (PartBunchBase< double, 3 > *, double)

Protected Types

typedef Field< int, 3, Mesh_t, Center_tIField_t
typedef Field< std::complex< double >, 3, Mesh_t, Center_tCxField_t

Private Member Functions

void initializeFields ()
void mirrorRhoField ()
void mirrorRhoField (Field_t &ggrn2)

Private Attributes

Field_t rho2_m
Field_t greentr_m
CxField_t rho2tr_m
CxField_t imgrho2tr_m
CxField_t grntr_m
IField_t grnIField_m [3]
std::unique_ptr< FFT_tfft_m
Mesh_tmesh_m
FieldLayout_tlayout_m
std::unique_ptr< Mesh_tmesh2_m
std::unique_ptr< FieldLayout_tlayout2_m
std::unique_ptr< Mesh_tmesh3_m
std::unique_ptr< FieldLayout_tlayout3_m
std::unique_ptr< Mesh_tmesh4_m
std::unique_ptr< FieldLayout_tlayout4_m
Field_t tmpgreen_m
NDIndex< 3 > domain_m
NDIndex< 3 > domain2_m
NDIndex< 3 > domain3_m
NDIndex< 3 > domain4_m
NDIndex< 3 > domainFFTConstruct_m
Vector_t hr_m
Vektor< int, 3 > nr_m
BConds< double, 3, Mesh_t, Center_tbc_m
 for defining the boundary conditions
BConds< Vector_t, 3, Mesh_t, Center_tvbc_m
bool bcz_m
bool integratedGreens_m
IpplTimings::TimerRef GreensFunctionTimer_m
IpplTimings::TimerRef ComputePotential_m

Detailed Description

Definition at line 41 of file FFTPoissonSolver.h.

Member Typedef Documentation

◆ CxField_t

typedef Field<std::complex<double>, 3, Mesh_t, Center_t> PoissonSolver::CxField_t
protectedinherited

Definition at line 20 of file PoissonSolver.h.

◆ FFT_t

Definition at line 43 of file FFTPoissonSolver.h.

◆ IField_t

typedef Field<int, 3, Mesh_t, Center_t> PoissonSolver::IField_t
protectedinherited

Definition at line 19 of file PoissonSolver.h.

Constructor & Destructor Documentation

◆ FFTPoissonSolver() [1/2]

FFTPoissonSolver::FFTPoissonSolver ( PartBunch & bunch,
std::string greensFuntion )

Definition at line 70 of file FFTPoissonSolver.cpp.

References ComputePotential_m, IpplTimings::getTimer(), greensFunction(), GreensFunctionTimer_m, initializeFields(), integratedGreens_m, layout2_m, layout3_m, layout4_m, layout_m, mesh2_m, mesh3_m, mesh4_m, and mesh_m.

Here is the call graph for this function:

◆ FFTPoissonSolver() [2/2]

FFTPoissonSolver::FFTPoissonSolver ( Mesh_t * mesh,
FieldLayout_t * fl,
std::string greensFunction,
std::string bcz )

Definition at line 50 of file FFTPoissonSolver.cpp.

References bcz_m, ComputePotential_m, IpplTimings::getTimer(), greensFunction(), GreensFunctionTimer_m, initializeFields(), integratedGreens_m, layout2_m, layout3_m, layout4_m, layout_m, mesh2_m, mesh3_m, mesh4_m, and mesh_m.

Here is the call graph for this function:

◆ ~FFTPoissonSolver()

FFTPoissonSolver::~FFTPoissonSolver ( )

Definition at line 90 of file FFTPoissonSolver.cpp.

Member Function Documentation

◆ calculatePairForces()

virtual void PoissonSolver::calculatePairForces ( PartBunchBase< double, 3 > * ,
double  )
inlinevirtualinherited

Reimplemented in P3MPoissonSolver.

Definition at line 74 of file PoissonSolver.h.

◆ computePotential() [1/2]

void FFTPoissonSolver::computePotential ( Field_t & rho,
Vector_t hr )
virtual

Implements PoissonSolver.

Definition at line 260 of file FFTPoissonSolver.cpp.

References ComputePotential_m, domain_m, fft_m, greensFunction(), GreensFunctionTimer_m, grntr_m, hr_m, integratedGreens_m, integratedGreensFunction(), rho2_m, rho2tr_m, IpplTimings::startTimer(), and IpplTimings::stopTimer().

Here is the call graph for this function:

◆ computePotential() [2/2]

void FFTPoissonSolver::computePotential ( Field_t & rho,
Vector_t hr,
double zshift )
virtual

Implements PoissonSolver.

Definition at line 212 of file FFTPoissonSolver.cpp.

References domain_m, fft_m, GreensFunctionTimer_m, grntr_m, hr_m, imgrho2tr_m, nr_m, rho2_m, rho2tr_m, shiftedIntGreensFunction(), IpplTimings::startTimer(), and IpplTimings::stopTimer().

Here is the call graph for this function:

◆ getinteractionRadius()

virtual double PoissonSolver::getinteractionRadius ( ) const
inlinevirtualinherited

Reimplemented in P3MPoissonSolver.

Definition at line 72 of file PoissonSolver.h.

◆ getXRangeMax()

double FFTPoissonSolver::getXRangeMax ( unsigned short )
inlinevirtual

Implements PoissonSolver.

Definition at line 72 of file FFTPoissonSolver.h.

◆ getXRangeMin()

double FFTPoissonSolver::getXRangeMin ( unsigned short )
inlinevirtual

Implements PoissonSolver.

Definition at line 71 of file FFTPoissonSolver.h.

◆ getYRangeMax()

double FFTPoissonSolver::getYRangeMax ( unsigned short )
inlinevirtual

Implements PoissonSolver.

Definition at line 74 of file FFTPoissonSolver.h.

◆ getYRangeMin()

double FFTPoissonSolver::getYRangeMin ( unsigned short )
inlinevirtual

Implements PoissonSolver.

Definition at line 73 of file FFTPoissonSolver.h.

◆ getZRangeMax()

double FFTPoissonSolver::getZRangeMax ( unsigned short )
inlinevirtual

Implements PoissonSolver.

Definition at line 76 of file FFTPoissonSolver.h.

◆ getZRangeMin()

double FFTPoissonSolver::getZRangeMin ( unsigned short )
inlinevirtual

Implements PoissonSolver.

Definition at line 75 of file FFTPoissonSolver.h.

◆ greensFunction()

void FFTPoissonSolver::greensFunction ( )

Definition at line 305 of file FFTPoissonSolver.cpp.

References fft_m, grnIField_m, grntr_m, hr_m, and rho2_m.

Referenced by computePotential(), FFTPoissonSolver(), and FFTPoissonSolver().

◆ hasToRegrid()

virtual void PoissonSolver::hasToRegrid ( )
inlinevirtualinherited

Tell solver to regrid

Reimplemented in AmrPoissonSolver< AmrObject >, and AmrPoissonSolver< AmrBoxLib >.

Definition at line 52 of file PoissonSolver.h.

Referenced by AmrBoxLib::postRegrid_m().

◆ initializeFields()

void FFTPoissonSolver::initializeFields ( )
private

Definition at line 92 of file FFTPoissonSolver.cpp.

References bc_m, bcz_m, domain2_m, domain3_m, domain4_m, domain_m, domainFFTConstruct_m, fft_m, greentr_m, grnIField_m, grntr_m, hr_m, imgrho2tr_m, layout2_m, layout3_m, layout4_m, layout_m, lt(), mesh2_m, mesh3_m, mesh4_m, mesh_m, nr_m, rho2_m, rho2tr_m, tmpgreen_m, vbc_m, and where().

Referenced by FFTPoissonSolver(), and FFTPoissonSolver().

Here is the call graph for this function:

◆ integratedGreensFunction()

void FFTPoissonSolver::integratedGreensFunction ( )

compute the integrated Green function as described in Three-dimensional quasistatic model for high brightness beam dynamics simulation by Qiang et al.

If the beam has a longitudinal size >> transverse size the direct Green function at each mesh point is not efficient (needs a lot of mesh points along the transverse size to get a good resolution)

If the charge density function is uniform within each cell the following Green's function can be defined:

\[ \overline{G}(x_i - x_{i'}, y_j - y_{j'}, z_k - z_{k'} cout << I << endl; cout << J << endl; cout << K << endl; cout << IE << endl; cout << JE << endl; cout << KE << endl; ) = \int_{x_{i'} - h_x/2}^{x_{i'} + h_x/2} dx' \int_{y_{j'} - h_y/2}^{y_{j'} + h_y/2} dy' \int_{z_{k'} - h_z/2}^{z_{k'} + h_z/2} dz' G(x_i - x_{i'}, y_j - y_{j'}, z_k - z_{k'}). \]

This integral can be calculated analytically in a closed from:

Definition at line 338 of file FFTPoissonSolver.cpp.

References atan(), fft_m, grntr_m, hr_m, layout4_m, log(), mirrorRhoField(), nr_m, rho2_m, sqrt(), and tmpgreen_m.

Referenced by computePotential().

Here is the call graph for this function:

◆ mirrorRhoField() [1/2]

void FFTPoissonSolver::mirrorRhoField ( )
private

Definition at line 499 of file FFTPoissonSolver.cpp.

References bcz_m, nr_m, and rho2_m.

Referenced by integratedGreensFunction(), and shiftedIntGreensFunction().

◆ mirrorRhoField() [2/2]

void FFTPoissonSolver::mirrorRhoField ( Field_t & ggrn2)
private

Definition at line 524 of file FFTPoissonSolver.cpp.

References bcz_m, nr_m, and rho2_m.

◆ print()

Inform & FFTPoissonSolver::print ( Inform & os) const

Definition at line 551 of file FFTPoissonSolver.cpp.

References endl(), and hr_m.

Here is the call graph for this function:

◆ resizeMesh()

virtual void PoissonSolver::resizeMesh ( Vector_t & ,
Vector_t & ,
const Vector_t & ,
const Vector_t & ,
double  )
inlinevirtualinherited

Definition at line 68 of file PoissonSolver.h.

◆ shiftedIntGreensFunction()

void FFTPoissonSolver::shiftedIntGreensFunction ( double zshift)

compute the shifted integrated Green function as described in Three-dimensional quasistatic model for high brightness beam dynamics simulation by Qiang et al.

(x[0:nr_m[0]-1]^2 + y[0:nr_m[1]-1]^2 + (z_c + z[0:nr_m[2]-1])^2)^{-0.5} (x[nr_m[0]:1]^2 + y[0:nr_m[1]-1]^2 + (z_c + z[0:nr_m[2]-1])^2)^{-0.5} (x[0:nr_m[0]-1]^2 + y[nr_m[1]:1]^2 + (z_c + z[0:nr_m[2]-1])^2)^{-0.5} (x[nr_m[0]:1]^2 + y[nr_m[1]:1]^2 + (z_c + z[0:nr_m[2]-1])^2)^{-0.5}

(x[0:nr_m[0]-1]^2 + y[0:nr_m[1]-1]^2 + (z_c - z[nr_m[2]:1])^2)^{-0.5} (x[nr_m[0]:1]^2 + y[0:nr_m[1]-1]^2 + (z_c - z[nr_m[2]:1])^2)^{-0.5} (x[0:nr_m[0]-1]^2 + y[nr_m[1]:1]^2 + (z_c - z[nr_m[2]:1])^2)^{-0.5} (x[nr_m[0]:1]^2 + y[nr_m[1]:1]^2 + (z_c - z[nr_m[2]:1])^2)^{-0.5}

Definition at line 404 of file FFTPoissonSolver.cpp.

References atan(), fft_m, grntr_m, hr_m, layout4_m, log(), mesh4_m, mirrorRhoField(), nr_m, rho2_m, sqrt(), and tmpgreen_m.

Referenced by computePotential().

Here is the call graph for this function:

◆ solve()

virtual void PoissonSolver::solve ( AmrScalarFieldContainer_t & ,
AmrScalarFieldContainer_t & ,
AmrVectorFieldContainer_t & ,
unsigned short ,
unsigned short ,
bool = true )
inlinevirtualinherited

AMR solver calls

Parameters
rhoright-hand side charge density on grid [C / m]
phielectrostatic potential (unknown) [V]
efieldelectric field [V / m]
baseLevelfor solve
finestLevelfor solve
prevAsGuessuse of previous solution as initial guess

Reimplemented in AmrMultiGrid.

Definition at line 39 of file PoissonSolver.h.

Referenced by AmrBoxLib::computeSelfFields_cycl(), and AmrBoxLib::solvePoisson_m().

◆ test()

void FFTPoissonSolver::test ( PartBunchBase< double, 3 > * )
inlinevirtual

Implements PoissonSolver.

Definition at line 77 of file FFTPoissonSolver.h.

Member Data Documentation

◆ bc_m

BConds<double, 3, Mesh_t, Center_t> FFTPoissonSolver::bc_m
private

for defining the boundary conditions

Definition at line 141 of file FFTPoissonSolver.h.

Referenced by initializeFields().

◆ bcz_m

bool FFTPoissonSolver::bcz_m
private

◆ ComputePotential_m

IpplTimings::TimerRef FFTPoissonSolver::ComputePotential_m
private

Definition at line 162 of file FFTPoissonSolver.h.

Referenced by computePotential(), FFTPoissonSolver(), and FFTPoissonSolver().

◆ domain2_m

NDIndex<3> FFTPoissonSolver::domain2_m
private

Definition at line 130 of file FFTPoissonSolver.h.

Referenced by initializeFields().

◆ domain3_m

NDIndex<3> FFTPoissonSolver::domain3_m
private

Definition at line 131 of file FFTPoissonSolver.h.

Referenced by initializeFields().

◆ domain4_m

NDIndex<3> FFTPoissonSolver::domain4_m
private

Definition at line 132 of file FFTPoissonSolver.h.

Referenced by initializeFields().

◆ domain_m

NDIndex<3> FFTPoissonSolver::domain_m
private

Definition at line 127 of file FFTPoissonSolver.h.

Referenced by computePotential(), computePotential(), and initializeFields().

◆ domainFFTConstruct_m

NDIndex<3> FFTPoissonSolver::domainFFTConstruct_m
private

Definition at line 134 of file FFTPoissonSolver.h.

Referenced by initializeFields().

◆ fft_m

std::unique_ptr<FFT_t> FFTPoissonSolver::fft_m
private

◆ GreensFunctionTimer_m

IpplTimings::TimerRef FFTPoissonSolver::GreensFunctionTimer_m
private

◆ greentr_m

Field_t FFTPoissonSolver::greentr_m
private

Definition at line 89 of file FFTPoissonSolver.h.

Referenced by initializeFields().

◆ grnIField_m

IField_t FFTPoissonSolver::grnIField_m[3]
private

Definition at line 102 of file FFTPoissonSolver.h.

Referenced by greensFunction(), and initializeFields().

◆ grntr_m

◆ hr_m

◆ imgrho2tr_m

CxField_t FFTPoissonSolver::imgrho2tr_m
private

Definition at line 94 of file FFTPoissonSolver.h.

Referenced by computePotential(), and initializeFields().

◆ integratedGreens_m

bool FFTPoissonSolver::integratedGreens_m
private

Definition at line 145 of file FFTPoissonSolver.h.

Referenced by computePotential(), FFTPoissonSolver(), and FFTPoissonSolver().

◆ layout2_m

std::unique_ptr<FieldLayout_t> FFTPoissonSolver::layout2_m
private

Definition at line 113 of file FFTPoissonSolver.h.

Referenced by FFTPoissonSolver(), FFTPoissonSolver(), and initializeFields().

◆ layout3_m

std::unique_ptr<FieldLayout_t> FFTPoissonSolver::layout3_m
private

Definition at line 117 of file FFTPoissonSolver.h.

Referenced by FFTPoissonSolver(), FFTPoissonSolver(), and initializeFields().

◆ layout4_m

std::unique_ptr<FieldLayout_t> FFTPoissonSolver::layout4_m
private

◆ layout_m

FieldLayout_t* FFTPoissonSolver::layout_m
private

Definition at line 109 of file FFTPoissonSolver.h.

Referenced by FFTPoissonSolver(), FFTPoissonSolver(), and initializeFields().

◆ mesh2_m

std::unique_ptr<Mesh_t> FFTPoissonSolver::mesh2_m
private

Definition at line 112 of file FFTPoissonSolver.h.

Referenced by FFTPoissonSolver(), FFTPoissonSolver(), and initializeFields().

◆ mesh3_m

std::unique_ptr<Mesh_t> FFTPoissonSolver::mesh3_m
private

Definition at line 116 of file FFTPoissonSolver.h.

Referenced by FFTPoissonSolver(), FFTPoissonSolver(), and initializeFields().

◆ mesh4_m

std::unique_ptr<Mesh_t> FFTPoissonSolver::mesh4_m
private

◆ mesh_m

Mesh_t* FFTPoissonSolver::mesh_m
private

Definition at line 108 of file FFTPoissonSolver.h.

Referenced by FFTPoissonSolver(), FFTPoissonSolver(), and initializeFields().

◆ nr_m

Vektor<int, 3> FFTPoissonSolver::nr_m
private

◆ rho2_m

◆ rho2tr_m

CxField_t FFTPoissonSolver::rho2tr_m
private

Definition at line 93 of file FFTPoissonSolver.h.

Referenced by computePotential(), computePotential(), and initializeFields().

◆ tmpgreen_m

Field_t FFTPoissonSolver::tmpgreen_m
private

◆ vbc_m

BConds<Vector_t, 3, Mesh_t, Center_t> FFTPoissonSolver::vbc_m
private

Definition at line 142 of file FFTPoissonSolver.h.

Referenced by initializeFields().


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