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

#include <FFTBoxPoissonSolver.h>

Inheritance diagram for FFTBoxPoissonSolver:
Inheritance graph
Collaboration diagram for FFTBoxPoissonSolver:
Collaboration graph

Public Types

typedef FFT< SineTransform, 3, double > SINE_t
 

Public Member Functions

 FFTBoxPoissonSolver (PartBunch &bunch, std::string greensFuntion)
 
 FFTBoxPoissonSolver (Mesh_t *mesh, FieldLayout_t *fl, std::string greensFunction, double boxSize)
 
 ~FFTBoxPoissonSolver ()
 
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. More...
 
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. More...
 
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)
 AMR solver calls. More...
 
virtual void hasToRegrid ()
 Tell solver to regrid. More...
 
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 Attributes

Field_t rho2_m
 
Field_t grntr_m
 
IField_t grnIField_m [3]
 
SINE_tsine_m
 
Mesh_tmesh_m
 
FieldLayout_tlayout_m
 
Mesh_tmesh2_m
 
FieldLayout_tlayout2_m
 
Field_t tmpgreen
 
NDIndex< 3 > domain_m
 
NDIndex< 3 > domain2_m
 
Vector_t hr_m
 
Vektor< int, 3 > nr_m
 
std::string greensFunction_m
 
double a_m
 
IpplTimings::TimerRef GreensFunctionTimer_m
 
IpplTimings::TimerRef IntGreensFunctionTimer1_m
 
IpplTimings::TimerRef IntGreensFunctionTimer2_m
 
IpplTimings::TimerRef IntGreensFunctionTimer3_m
 
IpplTimings::TimerRef IntGreensFunctionTimer4_m
 
IpplTimings::TimerRef ShIntGreensFunctionTimer1_m
 
IpplTimings::TimerRef ShIntGreensFunctionTimer2_m
 
IpplTimings::TimerRef ShIntGreensFunctionTimer3_m
 
IpplTimings::TimerRef ShIntGreensFunctionTimer4_m
 
IpplTimings::TimerRef GreensFunctionTimer1_m
 
IpplTimings::TimerRef GreensFunctionTimer4_m
 

Detailed Description

Definition at line 32 of file FFTBoxPoissonSolver.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.

◆ IField_t

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

Definition at line 19 of file PoissonSolver.h.

◆ SINE_t

Definition at line 34 of file FFTBoxPoissonSolver.h.

Constructor & Destructor Documentation

◆ FFTBoxPoissonSolver() [1/2]

◆ FFTBoxPoissonSolver() [2/2]

◆ ~FFTBoxPoissonSolver()

FFTBoxPoissonSolver::~FFTBoxPoissonSolver ( )

Definition at line 178 of file FFTBoxPoissonSolver.cpp.

References sine_m.

Member Function Documentation

◆ calculatePairForces()

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

Reimplemented in P3MPoissonSolver.

Definition at line 74 of file PoissonSolver.h.

Referenced by PartBunch::computeSelfFields().

◆ computePotential() [1/2]

void FFTBoxPoissonSolver::computePotential ( Field_t rho,
Vector_t  hr 
)
virtual

◆ computePotential() [2/2]

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

Implements PoissonSolver.

Definition at line 188 of file FFTBoxPoissonSolver.cpp.

References GreensFunctionTimer_m, grntr_m, hr_m, nr_m, shiftedIntGreensFunction(), sine_m, 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 FFTBoxPoissonSolver::getXRangeMax ( unsigned short  )
inlinevirtual

Implements PoissonSolver.

Definition at line 63 of file FFTBoxPoissonSolver.h.

References a_m.

◆ getXRangeMin()

double FFTBoxPoissonSolver::getXRangeMin ( unsigned short  )
inlinevirtual

Implements PoissonSolver.

Definition at line 62 of file FFTBoxPoissonSolver.h.

References a_m.

◆ getYRangeMax()

double FFTBoxPoissonSolver::getYRangeMax ( unsigned short  )
inlinevirtual

Implements PoissonSolver.

Definition at line 65 of file FFTBoxPoissonSolver.h.

References a_m.

◆ getYRangeMin()

double FFTBoxPoissonSolver::getYRangeMin ( unsigned short  )
inlinevirtual

Implements PoissonSolver.

Definition at line 64 of file FFTBoxPoissonSolver.h.

References a_m.

◆ getZRangeMax()

double FFTBoxPoissonSolver::getZRangeMax ( unsigned short  )
inlinevirtual

Implements PoissonSolver.

Definition at line 67 of file FFTBoxPoissonSolver.h.

References a_m.

◆ getZRangeMin()

double FFTBoxPoissonSolver::getZRangeMin ( unsigned short  )
inlinevirtual

Implements PoissonSolver.

Definition at line 66 of file FFTBoxPoissonSolver.h.

References a_m.

◆ greensFunction()

void FFTBoxPoissonSolver::greensFunction ( )

Definition at line 270 of file FFTBoxPoissonSolver.cpp.

References GreensFunctionTimer1_m, GreensFunctionTimer4_m, grnIField_m, grntr_m, hr_m, sine_m, IpplTimings::startTimer(), and IpplTimings::stopTimer().

Referenced by computePotential().

Here is the call graph for this function:

◆ 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().

◆ integratedGreensFunction()

void FFTBoxPoissonSolver::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 305 of file FFTBoxPoissonSolver.cpp.

References atan(), FieldLayout< Dim >::getLocalNDIndex(), grntr_m, hr_m, IntGreensFunctionTimer1_m, IntGreensFunctionTimer2_m, IntGreensFunctionTimer3_m, IntGreensFunctionTimer4_m, layout2_m, log(), min(), nr_m, sine_m, sqrt(), IpplTimings::startTimer(), IpplTimings::stopTimer(), and tmpgreen.

Referenced by computePotential().

Here is the call graph for this function:

◆ print()

Inform & FFTBoxPoissonSolver::print ( Inform os) const

Definition at line 512 of file FFTBoxPoissonSolver.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

Reimplemented in MGPoissonSolver.

Definition at line 68 of file PoissonSolver.h.

Referenced by PartBunch::resizeMesh().

◆ shiftedIntGreensFunction()

void FFTBoxPoissonSolver::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 387 of file FFTBoxPoissonSolver.cpp.

References atan(), FieldLayout< Dim >::getLocalNDIndex(), grntr_m, hr_m, Field< T, Dim, M, C >::initialize(), layout2_m, log(), mesh2_m, min(), nr_m, ShIntGreensFunctionTimer1_m, ShIntGreensFunctionTimer2_m, ShIntGreensFunctionTimer3_m, ShIntGreensFunctionTimer4_m, sine_m, sqrt(), IpplTimings::startTimer(), IpplTimings::stopTimer(), and tmpgreen.

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, MLPoissonSolver, and FMGPoissonSolver.

Definition at line 39 of file PoissonSolver.h.

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

◆ test()

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

Implements PoissonSolver.

Definition at line 68 of file FFTBoxPoissonSolver.h.

Member Data Documentation

◆ a_m

double FFTBoxPoissonSolver::a_m
private

◆ domain2_m

NDIndex<3> FFTBoxPoissonSolver::domain2_m
private

Definition at line 102 of file FFTBoxPoissonSolver.h.

◆ domain_m

NDIndex<3> FFTBoxPoissonSolver::domain_m
private

Definition at line 99 of file FFTBoxPoissonSolver.h.

Referenced by FFTBoxPoissonSolver().

◆ greensFunction_m

std::string FFTBoxPoissonSolver::greensFunction_m
private

Definition at line 108 of file FFTBoxPoissonSolver.h.

Referenced by computePotential(), and FFTBoxPoissonSolver().

◆ GreensFunctionTimer1_m

IpplTimings::TimerRef FFTBoxPoissonSolver::GreensFunctionTimer1_m
private

Definition at line 124 of file FFTBoxPoissonSolver.h.

Referenced by FFTBoxPoissonSolver(), and greensFunction().

◆ GreensFunctionTimer4_m

IpplTimings::TimerRef FFTBoxPoissonSolver::GreensFunctionTimer4_m
private

Definition at line 125 of file FFTBoxPoissonSolver.h.

Referenced by FFTBoxPoissonSolver(), and greensFunction().

◆ GreensFunctionTimer_m

IpplTimings::TimerRef FFTBoxPoissonSolver::GreensFunctionTimer_m
private

Definition at line 112 of file FFTBoxPoissonSolver.h.

Referenced by computePotential(), and FFTBoxPoissonSolver().

◆ grnIField_m

IField_t FFTBoxPoissonSolver::grnIField_m[3]
private

Definition at line 83 of file FFTBoxPoissonSolver.h.

Referenced by FFTBoxPoissonSolver(), and greensFunction().

◆ grntr_m

Field_t FFTBoxPoissonSolver::grntr_m
private

◆ hr_m

◆ IntGreensFunctionTimer1_m

IpplTimings::TimerRef FFTBoxPoissonSolver::IntGreensFunctionTimer1_m
private

Definition at line 114 of file FFTBoxPoissonSolver.h.

Referenced by FFTBoxPoissonSolver(), and integratedGreensFunction().

◆ IntGreensFunctionTimer2_m

IpplTimings::TimerRef FFTBoxPoissonSolver::IntGreensFunctionTimer2_m
private

Definition at line 115 of file FFTBoxPoissonSolver.h.

Referenced by FFTBoxPoissonSolver(), and integratedGreensFunction().

◆ IntGreensFunctionTimer3_m

IpplTimings::TimerRef FFTBoxPoissonSolver::IntGreensFunctionTimer3_m
private

Definition at line 116 of file FFTBoxPoissonSolver.h.

Referenced by FFTBoxPoissonSolver(), and integratedGreensFunction().

◆ IntGreensFunctionTimer4_m

IpplTimings::TimerRef FFTBoxPoissonSolver::IntGreensFunctionTimer4_m
private

Definition at line 117 of file FFTBoxPoissonSolver.h.

Referenced by FFTBoxPoissonSolver(), and integratedGreensFunction().

◆ layout2_m

FieldLayout_t* FFTBoxPoissonSolver::layout2_m
private

Definition at line 93 of file FFTBoxPoissonSolver.h.

Referenced by integratedGreensFunction(), and shiftedIntGreensFunction().

◆ layout_m

FieldLayout_t* FFTBoxPoissonSolver::layout_m
private

Definition at line 89 of file FFTBoxPoissonSolver.h.

Referenced by FFTBoxPoissonSolver().

◆ mesh2_m

Mesh_t* FFTBoxPoissonSolver::mesh2_m
private

Definition at line 92 of file FFTBoxPoissonSolver.h.

Referenced by shiftedIntGreensFunction().

◆ mesh_m

Mesh_t* FFTBoxPoissonSolver::mesh_m
private

Definition at line 88 of file FFTBoxPoissonSolver.h.

Referenced by FFTBoxPoissonSolver().

◆ nr_m

Vektor<int, 3> FFTBoxPoissonSolver::nr_m
private

◆ rho2_m

Field_t FFTBoxPoissonSolver::rho2_m
private

Definition at line 76 of file FFTBoxPoissonSolver.h.

◆ ShIntGreensFunctionTimer1_m

IpplTimings::TimerRef FFTBoxPoissonSolver::ShIntGreensFunctionTimer1_m
private

Definition at line 119 of file FFTBoxPoissonSolver.h.

Referenced by FFTBoxPoissonSolver(), and shiftedIntGreensFunction().

◆ ShIntGreensFunctionTimer2_m

IpplTimings::TimerRef FFTBoxPoissonSolver::ShIntGreensFunctionTimer2_m
private

Definition at line 120 of file FFTBoxPoissonSolver.h.

Referenced by FFTBoxPoissonSolver(), and shiftedIntGreensFunction().

◆ ShIntGreensFunctionTimer3_m

IpplTimings::TimerRef FFTBoxPoissonSolver::ShIntGreensFunctionTimer3_m
private

Definition at line 121 of file FFTBoxPoissonSolver.h.

Referenced by FFTBoxPoissonSolver(), and shiftedIntGreensFunction().

◆ ShIntGreensFunctionTimer4_m

IpplTimings::TimerRef FFTBoxPoissonSolver::ShIntGreensFunctionTimer4_m
private

Definition at line 122 of file FFTBoxPoissonSolver.h.

Referenced by FFTBoxPoissonSolver(), and shiftedIntGreensFunction().

◆ sine_m

◆ tmpgreen

Field_t FFTBoxPoissonSolver::tmpgreen
private

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