33#ifdef HAVE_SAAMG_SOLVER
42#ifdef AMREX_ENABLE_FBASELIB
50#ifdef HAVE_AMR_MG_SOLVER
69 FSTYPE = deprecated::SIZE,
108#ifdef HAVE_AMR_MG_SOLVER
128 "The \"FIELDSOLVER\" statement defines data for a the field solver") {
131 {
"FFT",
"FFTPERIODIC",
"SAAMG",
"FMG",
"ML",
"AMR_MG",
"NONE",
"P3M"});
138 "True, dimension 0 i.e x is parallelized",
142 "True, dimension 1 i.e y is parallelized",
146 "True, dimension 2 i.e z(t) is parallelized",
151 "Boundary conditions in x.",
152 {
"OPEN",
"DIRICHLET",
"PERIODIC"},
156 "Boundary conditions in y.",
157 {
"OPEN",
"DIRICHLET",
"PERIODIC"},
161 "Boundary conditions in z(t).",
162 {
"OPEN",
"DIRICHLET",
"PERIODIC"},
166 "Boundary conditions in z(t).",
167 {
"OPEN",
"DIRICHLET",
"PERIODIC"},
172 "Which Greensfunction to be used.",
173 {
"STANDARD",
"INTEGRATED"},
177 "Increase of bounding box in % ",
182 "cutoff radius for PP interactions",
186 "Standard Ewald Green’s function splitting parameter",
190 "GEOMETRY to be used as domain boundary",
194 "Type of iterative solver.",
213 "interpolation used for boundary points.",
214 {
"CONSTANT",
"LINEAR",
"QUADRATIC"},
218 "Tolerance for iterative solver",
222 "Maximum number of iterations of iterative solver",
226 "Preconditioner Mode.",
227 {
"STD",
"HIERARCHY",
"REUSE"},
233 "Maximum number of levels in AMR",
237 "Refinement ration in x-direction in AMR",
241 "Refinement ration in y-direction in AMR",
245 "Refinement ration in z-direction in AMR",
249 "Maximum grid size in x for AMR",
253 "Maximum grid size in y for AMR",
257 "Maximum grid size in z for AMR",
261 "Blocking factor in x for AMR (AMR_MAXGRIDX needs to be a multiple)",
265 "Blocking factor in y for AMR (AMR_MAXGRIDY needs to be a multiple)",
269 "Blocking factor in y for AMR (AMR_MAXGRIDZ needs to be a multiple)",
273 "Refinement criteria [CHARGE_DENSITY | POTENTIAL | EFIELD | MIN_NUM_PARTICLES | MAX_NUM_PARTICLES]",
277 "Tagging value for charge density refinement [C / cell volume]",
281 "Tagging value for max. #particles",
285 "Tagging value for min. #particles",
289 "Scaling value for maximum value tagging "
290 "(only POTENTIAL / CHARGE_DENSITY / "
294 "Box ratio of AMR computation domain. Default: [-1, 1]^3");
300#ifdef HAVE_AMR_MG_SOLVER
302 "Smoothing of level solution.",
303 {
"GS",
"SGS",
"JACOBI"},
"GS");
306 "Number of relaxation steps",
310 "Preconditioner of bottom solver.",
311 {
"NONE",
"ILUT",
"CHEBYSHEV",
"RILUK",
"JACOBI",
"BLOCK_JACOBI",
"GS",
"BLOCK_GS",
"SA"},
315 "Interpolater between levels.",
316 {
"TRILINEAR",
"LAGRANGE",
"PC"},
320 "Norm for convergence criteria.",
321 {
"L1_NORM",
"L2_NORM",
"LINF_NORM"},
325 "Write solver info in SDDS format (*.solver)",
329 "Rebalancing of Smoothed Aggregation "
334 "Reuse type of Smoothed Aggregation.",
335 {
"NONE",
"RP",
"RAP",
"SYMBOLIC",
"FULL"},
339 "AMR MG solver tolerance (default: 1.0e-10)",
390 throw OpalException(
"FieldSolver::find()",
"FieldSolver \"" +
name +
"\" not found.");
444 decomp[0] = decomp[1] =
SERIAL;
460 if (
itsAttr[deprecated::BCFFTT])
471 "The attribute \"FSTYPE\" has not correct type for AMR solver");
478 static const std::map<std::string, FieldSolverType> stringFSType_s = {
493 "The attribute \"FSTYPE\" isn't set for \"FIELDSOLVER\"!");
511 Inform m(
"FieldSolver::initAmrSolver");
519 bool sinTrafo = ((bcx ==
"DIRICHLET") && (bcy ==
"DIRICHLET") && (bcz ==
"DIRICHLET"));
521 std::cout <<
"FFTBOX ACTIVE" << std::endl;
526 std::vector<BoundaryGeometry*> geometries;
527 for (
unsigned int i = 0; i <= geoms.length(); i++) {
528 if (i == geoms.length() || geoms[i] ==
',') {
531 geometries.push_back(geom);
556#ifdef HAVE_SAAMG_SOLVER
561 std::vector<BoundaryGeometry*> geometries;
562 for (
unsigned int i = 0; i <= geoms.length(); i++) {
563 if (i == geoms.length() || geoms[i] ==
',') {
566 geometries.push_back(geom);
582 "SAAMG Solver not enabled! Please build OPAL with -DENABLE_SAAMG_SOLVER=1");
595 os <<
"* ************* F I E L D S O L V E R ********************************************** " <<
endl;
635 os <<
"* AMR_DOMAIN_RATIO ( ";
636 for (
auto& l : length) {
643#ifdef HAVE_AMR_MG_SOLVER
645 os <<
"* ITSOLVER (AMR_MG) "
649 <<
"* AMR_MG_REBALANCE "
653 <<
"* AMR_MG_SMOOTHER "
655 <<
"* AMR_MG_NSWEEPS "
657 <<
"* AMR_MG_INTERP "
663 <<
"* AMR_MG_VERBOSE "
669 if (
itsAttr[deprecated::BCFFTT]) {
670 os <<
"* BCFFTT (deprec.) "
680 os <<
"* XDIM parallel " <<
endl;
682 os <<
"* XDIM serial " <<
endl;
686 os <<
"* YDIM parallel " <<
endl;
688 os <<
"* YDIM serial " <<
endl;
692 os <<
"* Z(T)DIM parallel " <<
endl;
694 os <<
"* Z(T)DIM serial " <<
endl;
704 os <<
"* ********************************************************************************** " <<
endl;
730 info.grid[0] = (int)this->
getMX();
767 "ML solver requires AMReX.");
769#ifdef AMREX_ENABLE_FBASELIB
774 "FMultiGrid solver requires AMReX.");
780 "HYPRE solver not yet implemented.");
783 "HPGMG solver not yet implemented.");
785#ifdef HAVE_AMR_MG_SOLVER
788 "FMultiGrid solver requires AMReX.");
814 "Multigrid solver not enabled! "
815 "Please build OPAL with -DENABLE_AMR_MG_SOLVER=1");
819 "Unknown solver " +
getType() +
".");
UniformCartesian< 3, double > Mesh_t
ParticleSpatialLayout< double, 3, Mesh_t > Layout_t
CenteredFieldLayout< 3, Mesh_t, Center_t > FieldLayout_t
Inform & endl(Inform &inf)
Inform & level3(Inform &inf)
Representation objects and parsers for attribute expressions.
Attribute makeBool(const std::string &name, const std::string &help)
Make logical attribute.
double getReal(const Attribute &attr)
Return real value.
void setRealArray(Attribute &attr, const std::vector< double > &value)
Set array value.
Attribute makeUpperCaseString(const std::string &name, const std::string &help)
Make uppercase string attribute.
Attribute makePredefinedString(const std::string &name, const std::string &help, const std::initializer_list< std::string > &predefinedStrings)
Make predefined string attribute.
Attribute makeReal(const std::string &name, const std::string &help)
Make real attribute.
bool getBool(const Attribute &attr)
Return logical value.
void setReal(Attribute &attr, double val)
Set real value.
Attribute makeRealArray(const std::string &name, const std::string &help)
Create real array attribute.
std::vector< double > getRealArray(const Attribute &attr)
Get array value.
std::string getString(const Attribute &attr)
Get string value.
bool amr
Enable AMR if true.
bool isAllDigits(const std::string &str)
Definition(int size, const char *name, const char *help)
Constructor for exemplars.
void registerOwnership(const AttributeHandler::OwnerType &itsClass) const
const std::string & getOpalName() const
Return object name.
std::vector< Attribute > itsAttr
The object attributes.
Object * find(const std::string &name)
Find entry.
static OpalData * getInstance()
BoundaryGeometry * getGlobalGeometry()
static std::unique_ptr< AmrBoxLib > create(const AmrInfo &info, AmrPartBunch *bunch_p)
int grid[3]
Number of grid points in x-, y- and z-direction.
static std::string getTaggingString(int number)
int maxgrid[3]
Maximum grid size in x-, y- and z-direction.
static BoundaryGeometry * find(const std::string &name)
virtual void update()
Update the field solver data.
std::unique_ptr< Layout_t > PL_m
The particle layout.
void setMT(double)
Store emittance for mode 3.
void initCartesianFields()
double getMY() const
Return meshsize.
std::string getTagging_m() const
Mesh_t * mesh_m
The cartesian mesh.
PartBunchBase< double, 3 > * itsBunch_m
all the particles are here ...
PoissonSolver * solver_m
the actual solver, should be a base object
Inform & printInfo(Inform &os) const
bool isAmrSolverType() const
static FieldSolver * find(const std::string &name)
Find named FieldSolver.
FieldSolver()
Exemplar constructor.
void setFieldSolverType()
virtual void execute()
Execute (init) the field solver data.
double getMX() const
Return meshsize.
FieldLayout_t * FL_m
The field layout f.
std::unique_ptr< AmrObject > itsAmrObject_mp
void setMY(double)
Store emittance for mode 2.
double getMT() const
Return meshsize.
void setMX(double)
Store emittance for mode 1.
virtual FieldSolver * clone(const std::string &name)
Make clone.
void initSolver(PartBunchBase< double, 3 > *b)
The base class for all OPAL exceptions.