33 #ifdef HAVE_SAAMG_SOLVER
42 #ifdef AMREX_ENABLE_FBASELIB
50 #ifdef HAVE_AMR_MG_SOLVER
56 using namespace Expressions;
62 namespace deprecated {
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;
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() +
".");
Attribute makeReal(const std::string &name, const std::string &help)
Make real attribute.
static OpalData * getInstance()
void setFieldSolverType()
void setRealArray(Attribute &attr, const std::vector< double > &value)
Set array value.
double getMY() const
Return meshsize.
void setReal(Attribute &attr, double val)
Set real value.
int grid[3]
Number of grid points in x-, y- and z-direction.
std::string getString(const Attribute &attr)
Get string value.
Inform & printInfo(Inform &os) const
void setMT(double)
Store emittance for mode 3.
static std::string getTaggingString(int number)
int maxlevel
Maximum level for AMR (0: single-level)
FieldLayout_t * FL_m
The field layout f.
int bf[3]
Grid blocking factor in x-, y- and z-direction.
virtual void update()
Update the field solver data.
int maxgrid[3]
Maximum grid size in x-, y- and z-direction.
std::string getTagging_m() const
BoundaryGeometry * getGlobalGeometry()
static BoundaryGeometry * find(const std::string &name)
std::vector< double > getRealArray(const Attribute &attr)
Get array value.
std::unique_ptr< Layout_t > PL_m
The particle layout.
void initCartesianFields()
Attribute makeRealArray(const std::string &name, const std::string &help)
Create real array attribute.
Inform & endl(Inform &inf)
static FieldSolver * find(const std::string &name)
Find named FieldSolver.
CenteredFieldLayout< 3, Mesh_t, Center_t > FieldLayout_t
bool getBool(const Attribute &attr)
Return logical value.
Attribute makeBool(const std::string &name, const std::string &help)
Make logical attribute.
Mesh_t * mesh_m
The cartesian mesh.
virtual void set_meshEnlargement(double dh)
void registerOwnership(const AttributeHandler::OwnerType &itsClass) const
The base class for all OPAL exceptions.
Attribute makePredefinedString(const std::string &name, const std::string &help, const std::initializer_list< std::string > &predefinedStrings)
Make predefined string attribute.
bool isAllDigits(const std::string &str)
UniformCartesian< 3, double > Mesh_t
double getMT() const
Return meshsize.
static std::unique_ptr< AmrBoxLib > create(const AmrInfo &info, AmrPartBunch *bunch_p)
PartBunchBase< double, 3 > * itsBunch_m
all the particles are here ...
int refratio[3]
Mesh refinement ratio in x-, y- and z-direction.
const std::string & getOpalName() const
Return object name.
void initSolver(PartBunchBase< double, 3 > *b)
std::vector< Attribute > itsAttr
The object attributes.
void setMX(double)
Store emittance for mode 1.
bool amr
Enable AMR if true.
FieldSolver()
Exemplar constructor.
bool isAmrSolverType() const
std::unique_ptr< AmrObject > itsAmrObject_mp
virtual void execute()
Execute (init) the field solver data.
double getReal(const Attribute &attr)
Return real value.
The base class for all OPAL definitions.
Inform & level3(Inform &inf)
virtual FieldSolver * clone(const std::string &name)
Make clone.
Object * find(const std::string &name)
Find entry.
constexpr double e
The value of .
double getMX() const
Return meshsize.
PoissonSolver * solver_m
the actual solver, should be a base object
Attribute makeUpperCaseString(const std::string &name, const std::string &help)
Make uppercase string attribute.
ParticleSpatialLayout< double, 3, Mesh_t > Layout_t
void clear()
Clear the occurrence counter.
void setMY(double)
Store emittance for mode 2.