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[BCFFTZ].defaultUsed() &&
461 !
itsAttr[deprecated::BCFFTT].defaultUsed()) {
462 return itsAttr[deprecated::BCFFTT];
471 return (bcz ==
"PERIODIC");
479 "The attribute \"FSTYPE\" has not correct type for AMR solver");
486 static const std::map<std::string, FieldSolverType> stringFSType_s = {
501 "The attribute \"FSTYPE\" isn't set for \"FIELDSOLVER\"!");
516 Inform m(
"FieldSolver::initAmrSolver");
524 bool sinTrafo = ((bcx ==
"DIRICHLET") && (bcy ==
"DIRICHLET") && (bcz ==
"DIRICHLET"));
526 std::cout <<
"FFTBOX ACTIVE" << std::endl;
531 std::vector<BoundaryGeometry*> geometries;
532 for (
unsigned int i = 0; i <= geoms.length(); i++) {
533 if (i == geoms.length() || geoms[i] ==
',') {
536 geometries.push_back(geom);
561#ifdef HAVE_SAAMG_SOLVER
566 std::vector<BoundaryGeometry*> geometries;
567 for (
unsigned int i = 0; i <= geoms.length(); i++) {
568 if (i == geoms.length() || geoms[i] ==
',') {
571 geometries.push_back(geom);
587 "SAAMG Solver not enabled! Please build OPAL with -DENABLE_SAAMG_SOLVER=1");
600 os <<
"* ************* F I E L D S O L V E R ********************************************** " <<
endl;
643 os <<
"* AMR_DOMAIN_RATIO ( ";
644 for (
auto& l : length) {
651#ifdef HAVE_AMR_MG_SOLVER
653 os <<
"* ITSOLVER (AMR_MG) "
657 <<
"* AMR_MG_REBALANCE "
661 <<
"* AMR_MG_SMOOTHER "
663 <<
"* AMR_MG_NSWEEPS "
665 <<
"* AMR_MG_INTERP "
671 <<
"* AMR_MG_VERBOSE "
683 os <<
"* XDIM parallel " <<
endl;
685 os <<
"* XDIM serial " <<
endl;
689 os <<
"* YDIM parallel " <<
endl;
691 os <<
"* YDIM serial " <<
endl;
695 os <<
"* Z(T)DIM parallel " <<
endl;
697 os <<
"* Z(T)DIM serial " <<
endl;
707 os <<
"* ********************************************************************************** " <<
endl;
733 info.grid[0] = (int)this->
getMX();
770 "ML solver requires AMReX.");
772#ifdef AMREX_ENABLE_FBASELIB
777 "FMultiGrid solver requires AMReX.");
783 "HYPRE solver not yet implemented.");
786 "HPGMG solver not yet implemented.");
788#ifdef HAVE_AMR_MG_SOLVER
791 "FMultiGrid solver requires AMReX.");
815 "Multigrid solver not enabled! "
816 "Please build OPAL with -DENABLE_AMR_MG_SOLVER=1");
820 "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)
A representation of an Object attribute.
The base class for all OPAL definitions.
void registerOwnership(const AttributeHandler::OwnerType &itsClass) const
const std::string & getOpalName() const
Return object name.
void clear()
Clear the occurrence counter.
std::vector< Attribute > itsAttr
The object attributes.
virtual void set_meshEnlargement(double dh)
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)
static std::string getTaggingString(int number)
int grid[3]
Number of grid points in x-, y- and z-direction.
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
const Attribute & getBCZAttribute() const
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.