OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
MGPoissonSolver Class Reference

#include <MGPoissonSolver.h>

Inheritance diagram for MGPoissonSolver:
Inheritance graph
[legend]
Collaboration diagram for MGPoissonSolver:
Collaboration graph
[legend]

Public Types

typedef Tpetra::Vector TpetraVector_t
 
typedef Tpetra::MultiVector TpetraMultiVector_t
 
typedef Tpetra::Map TpetraMap_t
 
typedef Tpetra::Vector ::scalar_type TpetraScalar_t
 
typedef Tpetra::Vector ::global_ordinal_type TpetraGlobalOrdinal_t
 
typedef Tpetra::Operator TpetraOperator_t
 
typedef MueLu::TpetraOperator MueLuTpetraOperator_t
 
typedef Tpetra::CrsMatrix TpetraCrsMatrix_t
 
typedef Teuchos::MpiComm< int > Comm_t
 
typedef Teuchos::ParameterList ParameterList_t
 
typedef Belos::SolverManager< TpetraScalar_t, TpetraMultiVector_t, TpetraOperator_tSolverManager_t
 
typedef Belos::LinearProblem< TpetraScalar_t, TpetraMultiVector_t, TpetraOperator_tLinearProblem_t
 

Public Member Functions

 MGPoissonSolver (PartBunch *beam, Mesh_t *mesh, FieldLayout_t *fl, std::vector< BoundaryGeometry * > geometries, std::string itsolver, std::string interpl, double tol, int maxiters, std::string precmode)
 
 ~MGPoissonSolver ()
 
void computePotential (Field_t &rho, Vector_t hr)
 
void computePotential (Field_t &rho, Vector_t hr, double zshift)
 
void setGeometry (std::vector< BoundaryGeometry * > geometries)
 set a geometry 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 > *)
 
void printLoadBalanceStats ()
 useful load balance information More...
 
void extrapolateLHS ()
 
void resizeMesh (Vector_t &origin, Vector_t &hr, const Vector_t &rmin, const Vector_t &rmax, double dh)
 
Informprint (Inform &os) const
 
- Public Member Functions inherited from PoissonSolver
virtual void solve (AmrScalarFieldContainer_t &, AmrScalarFieldContainer_t &, AmrVectorFieldContainer_t &, unsigned short, unsigned short, bool=true)
 
virtual void hasToRegrid ()
 
virtual ~PoissonSolver ()
 

Protected Member Functions

void setupBelosList ()
 Setup the parameters for the Belos iterative solver. More...
 
void setupMueLuList ()
 Setup the parameters for the SAAMG preconditioner. More...
 

Private Member Functions

void deletePtr ()
 
void computeMap (NDIndex< 3 > localId)
 recomputes the map More...
 
void IPPLToMap3D (NDIndex< 3 > localId)
 
void ComputeStencil (Vector_t hr, Teuchos::RCP< TpetraVector_t > RHS)
 

Private Attributes

bool isMatrixfilled_m
 
bool useLeftPrec_m
 
BoundaryGeometrycurrentGeometry
 holding the currently active geometry More...
 
std::vector< BoundaryGeometry * > geometries_m
 container for multiple geometries More...
 
int repartFreq_m
 
bool verbose_m
 flag specifying if we are verbose More...
 
double tol_m
 tolerance for the iterative solver More...
 
int maxiters_m
 maximal number of iterations for the iterative solver More...
 
int precmode_m
 preconditioner mode More...
 
int numBlocks_m
 maximum number of blocks in Krylov space More...
 
int recycleBlocks_m
 number of vectors in recycle space More...
 
std::unique_ptr< IrregularDomainbp_m
 structure that holds boundary points More...
 
Teuchos::RCP< TpetraVector_tRHS
 right hand side of our problem More...
 
Teuchos::RCP< TpetraVector_tLHS
 left hand side of the linear system of equations we solve More...
 
Teuchos::RCP< TpetraCrsMatrix_tA
 matrix used in the linear system of equations More...
 
Teuchos::RCP< TpetraMap_tmap_p
 Map holding the processor distribution of data. More...
 
Teuchos::RCP< const Comm_tcomm_mp
 communicator used by Trilinos More...
 
unsigned int nLHS_m
 last N LHS's for extrapolating the new LHS as starting vector More...
 
Teuchos::RCP< TpetraMultiVector_tP_mp
 
std::deque< TpetraVector_tOldLHS
 
Teuchos::RCP< LinearProblem_tproblem_mp
 
Teuchos::RCP< SolverManager_tsolver_mp
 
Teuchos::RCP< MueLuTpetraOperator_tprec_mp
 MueLu preconditioner object. More...
 
Teuchos::ParameterList MueLuList_m
 parameter list for the MueLu solver More...
 
Teuchos::ParameterList belosList
 parameter list for the iterative solver (Belos) More...
 
PartBunchitsBunch_m
 PartBunch object. More...
 
Mesh_tmesh_m
 
FieldLayout_tlayout_m
 
NDIndex< 3 > domain_m
 
Vector_t hr_m
 mesh spacings in each direction More...
 
Vektor< int, 3 > nr_m
 current number of mesh points in each direction More...
 
Vektor< int, 3 > orig_nr_m
 global number of mesh points in each direction More...
 
IpplTimings::TimerRef FunctionTimer1_m
 
IpplTimings::TimerRef FunctionTimer2_m
 
IpplTimings::TimerRef FunctionTimer3_m
 
IpplTimings::TimerRef FunctionTimer4_m
 
IpplTimings::TimerRef FunctionTimer5_m
 
IpplTimings::TimerRef FunctionTimer6_m
 
IpplTimings::TimerRef FunctionTimer7_m
 
IpplTimings::TimerRef FunctionTimer8_m
 

Additional Inherited Members

- Protected Types inherited from PoissonSolver
typedef Field< int, 3, Mesh_t, Center_tIField_t
 
typedef Field< std::complex< double >, 3, Mesh_t, Center_tCxField_t
 

Detailed Description

Definition at line 73 of file MGPoissonSolver.h.

Member Typedef Documentation

◆ Comm_t

typedef Teuchos::MpiComm<int> MGPoissonSolver::Comm_t

Definition at line 84 of file MGPoissonSolver.h.

◆ LinearProblem_t

Definition at line 94 of file MGPoissonSolver.h.

◆ MueLuTpetraOperator_t

typedef MueLu::TpetraOperator MGPoissonSolver::MueLuTpetraOperator_t

Definition at line 82 of file MGPoissonSolver.h.

◆ ParameterList_t

typedef Teuchos::ParameterList MGPoissonSolver::ParameterList_t

Definition at line 86 of file MGPoissonSolver.h.

◆ SolverManager_t

Definition at line 90 of file MGPoissonSolver.h.

◆ TpetraCrsMatrix_t

typedef Tpetra::CrsMatrix MGPoissonSolver::TpetraCrsMatrix_t

Definition at line 83 of file MGPoissonSolver.h.

◆ TpetraGlobalOrdinal_t

typedef Tpetra::Vector ::global_ordinal_type MGPoissonSolver::TpetraGlobalOrdinal_t

Definition at line 80 of file MGPoissonSolver.h.

◆ TpetraMap_t

typedef Tpetra::Map MGPoissonSolver::TpetraMap_t

Definition at line 78 of file MGPoissonSolver.h.

◆ TpetraMultiVector_t

typedef Tpetra::MultiVector MGPoissonSolver::TpetraMultiVector_t

Definition at line 77 of file MGPoissonSolver.h.

◆ TpetraOperator_t

typedef Tpetra::Operator MGPoissonSolver::TpetraOperator_t

Definition at line 81 of file MGPoissonSolver.h.

◆ TpetraScalar_t

typedef Tpetra::Vector ::scalar_type MGPoissonSolver::TpetraScalar_t

Definition at line 79 of file MGPoissonSolver.h.

◆ TpetraVector_t

typedef Tpetra::Vector MGPoissonSolver::TpetraVector_t

Definition at line 76 of file MGPoissonSolver.h.

Constructor & Destructor Documentation

◆ MGPoissonSolver()

MGPoissonSolver::MGPoissonSolver ( PartBunch beam,
Mesh_t mesh,
FieldLayout_t fl,
std::vector< BoundaryGeometry * >  geometries,
std::string  itsolver,
std::string  interpl,
double  tol,
int  maxiters,
std::string  precmode 
)

◆ ~MGPoissonSolver()

MGPoissonSolver::~MGPoissonSolver ( )

Definition at line 217 of file MGPoissonSolver.cpp.

References deletePtr(), problem_mp, and solver_mp.

Here is the call graph for this function:

Member Function Documentation

◆ computeMap()

void MGPoissonSolver::computeMap ( NDIndex< 3 >  localId)
private

recomputes the map

Definition at line 227 of file MGPoissonSolver.cpp.

References deletePtr(), extrapolateLHS(), PartBunchBase< T, Dim >::getLocalTrackStep(), IPPLToMap3D(), itsBunch_m, and repartFreq_m.

Referenced by computePotential().

Here is the call graph for this function:

◆ computePotential() [1/2]

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

◆ computePotential() [2/2]

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

Implements PoissonSolver.

Definition at line 223 of file MGPoissonSolver.cpp.

◆ ComputeStencil()

void MGPoissonSolver::ComputeStencil ( Vector_t  hr,
Teuchos::RCP< TpetraVector_t RHS 
)
private

returns a discretized stencil that has Neumann BC in z direction and Dirichlet BC on the surface of a specified geometry

Parameters
hrgridspacings in each direction
RHSright hand side might be scaled

Definition at line 519 of file MGPoissonSolver.cpp.

References A, IrregularDomain::Stencil< T >::back, bp_m, IrregularDomain::Stencil< T >::center, IrregularDomain::Stencil< T >::east, IrregularDomain::Stencil< T >::front, isMatrixfilled_m, map_p, IrregularDomain::Stencil< T >::north, RHS, IrregularDomain::Stencil< T >::south, and IrregularDomain::Stencil< T >::west.

Referenced by computePotential().

◆ deletePtr()

void MGPoissonSolver::deletePtr ( )
private

Definition at line 208 of file MGPoissonSolver.cpp.

References A, isMatrixfilled_m, LHS, map_p, prec_mp, and RHS.

Referenced by computeMap(), and ~MGPoissonSolver().

◆ extrapolateLHS()

void MGPoissonSolver::extrapolateLHS ( )

Definition at line 236 of file MGPoissonSolver.cpp.

References LHS, map_p, Hypervolume::n, nLHS_m, OldLHS, and P_mp.

Referenced by computeMap().

◆ getXRangeMax()

double MGPoissonSolver::getXRangeMax ( unsigned short  )
inlinevirtual

Implements PoissonSolver.

Definition at line 117 of file MGPoissonSolver.h.

References bp_m.

◆ getXRangeMin()

double MGPoissonSolver::getXRangeMin ( unsigned short  )
inlinevirtual

Implements PoissonSolver.

Definition at line 116 of file MGPoissonSolver.h.

References bp_m.

◆ getYRangeMax()

double MGPoissonSolver::getYRangeMax ( unsigned short  )
inlinevirtual

Implements PoissonSolver.

Definition at line 119 of file MGPoissonSolver.h.

References bp_m.

◆ getYRangeMin()

double MGPoissonSolver::getYRangeMin ( unsigned short  )
inlinevirtual

Implements PoissonSolver.

Definition at line 118 of file MGPoissonSolver.h.

References bp_m.

◆ getZRangeMax()

double MGPoissonSolver::getZRangeMax ( unsigned short  )
inlinevirtual

Implements PoissonSolver.

Definition at line 121 of file MGPoissonSolver.h.

References bp_m.

◆ getZRangeMin()

double MGPoissonSolver::getZRangeMin ( unsigned short  )
inlinevirtual

Implements PoissonSolver.

Definition at line 120 of file MGPoissonSolver.h.

References bp_m.

◆ IPPLToMap3D()

void MGPoissonSolver::IPPLToMap3D ( NDIndex< 3 >  localId)
private

converts IPPL grid to a 3D map

Parameters
localIdlocal IPPL grid node indices

Definition at line 498 of file MGPoissonSolver.cpp.

References bp_m, comm_mp, and map_p.

Referenced by computeMap().

◆ print()

Inform & MGPoissonSolver::print ( Inform os) const

Definition at line 689 of file MGPoissonSolver.cpp.

References endl(), and hr_m.

Here is the call graph for this function:

◆ printLoadBalanceStats()

void MGPoissonSolver::printLoadBalanceStats ( )

useful load balance information

Definition at line 590 of file MGPoissonSolver.cpp.

References comm_mp, endl(), gmsg, map_p, max(), Hypervolume::maxn, min(), and reduce().

Here is the call graph for this function:

◆ resizeMesh()

void MGPoissonSolver::resizeMesh ( Vector_t origin,
Vector_t hr,
const Vector_t rmin,
const Vector_t rmax,
double  dh 
)
inlinevirtual

Reimplemented from PoissonSolver.

Definition at line 128 of file MGPoissonSolver.h.

References bp_m.

◆ setGeometry()

void MGPoissonSolver::setGeometry ( std::vector< BoundaryGeometry * >  geometries)

set a geometry

◆ setupBelosList()

void MGPoissonSolver::setupBelosList ( )
protected

Setup the parameters for the Belos iterative solver.

Definition at line 614 of file MGPoissonSolver.cpp.

References belosList, maxiters_m, numBlocks_m, recycleBlocks_m, tol_m, and verbose_m.

Referenced by MGPoissonSolver().

◆ setupMueLuList()

void MGPoissonSolver::setupMueLuList ( )
protected

Setup the parameters for the SAAMG preconditioner.

Definition at line 632 of file MGPoissonSolver.cpp.

References comm_mp, max(), MueLuList_m, precmode_m, REUSE_HIERARCHY, REUSE_PREC, and STD_PREC.

Referenced by MGPoissonSolver().

Here is the call graph for this function:

◆ test()

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

Implements PoissonSolver.

Definition at line 122 of file MGPoissonSolver.h.

Member Data Documentation

◆ A

Teuchos::RCP<TpetraCrsMatrix_t> MGPoissonSolver::A
private

matrix used in the linear system of equations

Definition at line 176 of file MGPoissonSolver.h.

Referenced by computePotential(), ComputeStencil(), deletePtr(), and MGPoissonSolver().

◆ belosList

Teuchos::ParameterList MGPoissonSolver::belosList
private

parameter list for the iterative solver (Belos)

Definition at line 198 of file MGPoissonSolver.h.

Referenced by MGPoissonSolver(), and setupBelosList().

◆ bp_m

std::unique_ptr<IrregularDomain> MGPoissonSolver::bp_m
private

◆ comm_mp

Teuchos::RCP<const Comm_t> MGPoissonSolver::comm_mp
private

communicator used by Trilinos

Definition at line 182 of file MGPoissonSolver.h.

Referenced by computePotential(), IPPLToMap3D(), printLoadBalanceStats(), and setupMueLuList().

◆ currentGeometry

BoundaryGeometry* MGPoissonSolver::currentGeometry
private

holding the currently active geometry

Definition at line 148 of file MGPoissonSolver.h.

Referenced by MGPoissonSolver().

◆ domain_m

NDIndex<3> MGPoissonSolver::domain_m
private

Definition at line 208 of file MGPoissonSolver.h.

Referenced by MGPoissonSolver().

◆ FunctionTimer1_m

IpplTimings::TimerRef MGPoissonSolver::FunctionTimer1_m
private

Definition at line 218 of file MGPoissonSolver.h.

Referenced by computePotential(), and MGPoissonSolver().

◆ FunctionTimer2_m

IpplTimings::TimerRef MGPoissonSolver::FunctionTimer2_m
private

Definition at line 219 of file MGPoissonSolver.h.

Referenced by computePotential(), and MGPoissonSolver().

◆ FunctionTimer3_m

IpplTimings::TimerRef MGPoissonSolver::FunctionTimer3_m
private

Definition at line 220 of file MGPoissonSolver.h.

Referenced by computePotential(), and MGPoissonSolver().

◆ FunctionTimer4_m

IpplTimings::TimerRef MGPoissonSolver::FunctionTimer4_m
private

Definition at line 221 of file MGPoissonSolver.h.

Referenced by computePotential(), and MGPoissonSolver().

◆ FunctionTimer5_m

IpplTimings::TimerRef MGPoissonSolver::FunctionTimer5_m
private

Definition at line 222 of file MGPoissonSolver.h.

Referenced by computePotential(), and MGPoissonSolver().

◆ FunctionTimer6_m

IpplTimings::TimerRef MGPoissonSolver::FunctionTimer6_m
private

Definition at line 223 of file MGPoissonSolver.h.

Referenced by computePotential(), and MGPoissonSolver().

◆ FunctionTimer7_m

IpplTimings::TimerRef MGPoissonSolver::FunctionTimer7_m
private

Definition at line 224 of file MGPoissonSolver.h.

Referenced by computePotential(), and MGPoissonSolver().

◆ FunctionTimer8_m

IpplTimings::TimerRef MGPoissonSolver::FunctionTimer8_m
private

Definition at line 225 of file MGPoissonSolver.h.

Referenced by computePotential(), and MGPoissonSolver().

◆ geometries_m

std::vector<BoundaryGeometry *> MGPoissonSolver::geometries_m
private

container for multiple geometries

Definition at line 151 of file MGPoissonSolver.h.

Referenced by MGPoissonSolver().

◆ hr_m

Vector_t MGPoissonSolver::hr_m
private

mesh spacings in each direction

Definition at line 211 of file MGPoissonSolver.h.

Referenced by MGPoissonSolver(), and print().

◆ isMatrixfilled_m

bool MGPoissonSolver::isMatrixfilled_m
private

Definition at line 140 of file MGPoissonSolver.h.

Referenced by ComputeStencil(), and deletePtr().

◆ itsBunch_m

PartBunch* MGPoissonSolver::itsBunch_m
private

PartBunch object.

Definition at line 201 of file MGPoissonSolver.h.

Referenced by computeMap(), computePotential(), and MGPoissonSolver().

◆ layout_m

FieldLayout_t* MGPoissonSolver::layout_m
private

Definition at line 205 of file MGPoissonSolver.h.

Referenced by computePotential(), and MGPoissonSolver().

◆ LHS

Teuchos::RCP<TpetraVector_t> MGPoissonSolver::LHS
private

left hand side of the linear system of equations we solve

Definition at line 174 of file MGPoissonSolver.h.

Referenced by computePotential(), deletePtr(), extrapolateLHS(), and MGPoissonSolver().

◆ map_p

Teuchos::RCP<TpetraMap_t> MGPoissonSolver::map_p
private

Map holding the processor distribution of data.

Definition at line 179 of file MGPoissonSolver.h.

Referenced by computePotential(), ComputeStencil(), deletePtr(), extrapolateLHS(), IPPLToMap3D(), MGPoissonSolver(), and printLoadBalanceStats().

◆ maxiters_m

int MGPoissonSolver::maxiters_m
private

maximal number of iterations for the iterative solver

Definition at line 160 of file MGPoissonSolver.h.

Referenced by setupBelosList().

◆ mesh_m

Mesh_t* MGPoissonSolver::mesh_m
private

Definition at line 204 of file MGPoissonSolver.h.

Referenced by MGPoissonSolver().

◆ MueLuList_m

Teuchos::ParameterList MGPoissonSolver::MueLuList_m
private

parameter list for the MueLu solver

Definition at line 196 of file MGPoissonSolver.h.

Referenced by computePotential(), and setupMueLuList().

◆ nLHS_m

unsigned int MGPoissonSolver::nLHS_m
private

last N LHS's for extrapolating the new LHS as starting vector

Definition at line 185 of file MGPoissonSolver.h.

Referenced by computePotential(), extrapolateLHS(), and MGPoissonSolver().

◆ nr_m

Vektor<int, 3> MGPoissonSolver::nr_m
private

current number of mesh points in each direction

Definition at line 213 of file MGPoissonSolver.h.

Referenced by computePotential().

◆ numBlocks_m

int MGPoissonSolver::numBlocks_m
private

maximum number of blocks in Krylov space

Definition at line 164 of file MGPoissonSolver.h.

Referenced by computePotential(), MGPoissonSolver(), and setupBelosList().

◆ OldLHS

std::deque< TpetraVector_t > MGPoissonSolver::OldLHS
private

Definition at line 187 of file MGPoissonSolver.h.

Referenced by computePotential(), and extrapolateLHS().

◆ orig_nr_m

Vektor<int, 3> MGPoissonSolver::orig_nr_m
private

global number of mesh points in each direction

Definition at line 215 of file MGPoissonSolver.h.

Referenced by computePotential(), and MGPoissonSolver().

◆ P_mp

Teuchos::RCP<TpetraMultiVector_t> MGPoissonSolver::P_mp
private

Definition at line 186 of file MGPoissonSolver.h.

Referenced by extrapolateLHS().

◆ prec_mp

Teuchos::RCP<MueLuTpetraOperator_t> MGPoissonSolver::prec_mp
private

MueLu preconditioner object.

Definition at line 193 of file MGPoissonSolver.h.

Referenced by computePotential(), deletePtr(), and MGPoissonSolver().

◆ precmode_m

int MGPoissonSolver::precmode_m
private

preconditioner mode

Definition at line 162 of file MGPoissonSolver.h.

Referenced by computePotential(), MGPoissonSolver(), and setupMueLuList().

◆ problem_mp

Teuchos::RCP<LinearProblem_t> MGPoissonSolver::problem_mp
private

Definition at line 189 of file MGPoissonSolver.h.

Referenced by computePotential(), MGPoissonSolver(), and ~MGPoissonSolver().

◆ recycleBlocks_m

int MGPoissonSolver::recycleBlocks_m
private

number of vectors in recycle space

Definition at line 166 of file MGPoissonSolver.h.

Referenced by computePotential(), MGPoissonSolver(), and setupBelosList().

◆ repartFreq_m

int MGPoissonSolver::repartFreq_m
private

Definition at line 153 of file MGPoissonSolver.h.

Referenced by computeMap(), and MGPoissonSolver().

◆ RHS

Teuchos::RCP<TpetraVector_t> MGPoissonSolver::RHS
private

right hand side of our problem

Definition at line 172 of file MGPoissonSolver.h.

Referenced by computePotential(), ComputeStencil(), deletePtr(), and MGPoissonSolver().

◆ solver_mp

Teuchos::RCP<SolverManager_t> MGPoissonSolver::solver_mp
private

Definition at line 190 of file MGPoissonSolver.h.

Referenced by computePotential(), MGPoissonSolver(), and ~MGPoissonSolver().

◆ tol_m

double MGPoissonSolver::tol_m
private

tolerance for the iterative solver

Definition at line 158 of file MGPoissonSolver.h.

Referenced by setupBelosList().

◆ useLeftPrec_m

bool MGPoissonSolver::useLeftPrec_m
private

Definition at line 143 of file MGPoissonSolver.h.

Referenced by computePotential(), and MGPoissonSolver().

◆ verbose_m

bool MGPoissonSolver::verbose_m
private

flag specifying if we are verbose

Definition at line 155 of file MGPoissonSolver.h.

Referenced by computePotential(), MGPoissonSolver(), and setupBelosList().


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