33#ifdef HAVE_SAAMG_SOLVER
42#ifdef AMREX_ENABLE_FBASELIB
54#ifdef HAVE_AMR_MG_SOLVER
112#ifdef HAVE_AMR_MG_SOLVER
132 "The \"FIELDSOLVER\" statement defines data for a the field solver") {
135 {
"FFT",
"FFTPERIODIC",
"SAAMG",
"FMG",
"ML",
"AMR_MG",
"NONE",
"P3M"});
142 "True, dimension 0 i.e x is parallelized",
146 "True, dimension 1 i.e y is parallelized",
150 "True, dimension 2 i.e z(t) is parallelized",
155 "Boundary conditions in x.",
156 {
"OPEN",
"DIRICHLET",
"PERIODIC"},
160 "Boundary conditions in y.",
161 {
"OPEN",
"DIRICHLET",
"PERIODIC"},
165 "Boundary conditions in z(t).",
166 {
"OPEN",
"DIRICHLET",
"PERIODIC"},
170 "Boundary conditions in z(t).",
171 {
"OPEN",
"DIRICHLET",
"PERIODIC"},
176 "Which Greensfunction to be used.",
177 {
"STANDARD",
"INTEGRATED"},
181 "Increase of bounding box in % ",
186 "cutoff radius for PP interactions",
190 "Standard Ewald Green’s function splitting parameter",
194 "GEOMETRY to be used as domain boundary",
198 "Type of iterative solver.",
217 "interpolation used for boundary points.",
218 {
"CONSTANT",
"LINEAR",
"QUADRATIC"},
222 "Tolerance for iterative solver",
226 "Maximum number of iterations of iterative solver",
230 "Preconditioner Mode.",
231 {
"STD",
"HIERARCHY",
"REUSE"},
237 "Maximum number of levels in AMR",
241 "Refinement ration in x-direction in AMR",
245 "Refinement ration in y-direction in AMR",
249 "Refinement ration in z-direction in AMR",
253 "Maximum grid size in x for AMR",
257 "Maximum grid size in y for AMR",
261 "Maximum grid size in z for AMR",
265 "Blocking factor in x for AMR (AMR_MAXGRIDX needs to be a multiple)",
269 "Blocking factor in y for AMR (AMR_MAXGRIDY needs to be a multiple)",
273 "Blocking factor in y for AMR (AMR_MAXGRIDZ needs to be a multiple)",
277 "Refinement criteria [CHARGE_DENSITY | POTENTIAL | EFIELD]",
281 "Tagging value for charge density refinement [C / cell volume]",
285 "Tagging value for max. #particles",
289 "Tagging value for min. #particles",
293 "Scaling value for maximum value tagging "
294 "(only POTENTIAL / CHARGE_DENSITY / "
298 "Box ratio of AMR computation domain. Default: [-1, 1]^3");
304#ifdef HAVE_AMR_MG_SOLVER
306 "Smoothing of level solution.",
307 {
"GS",
"SGS",
"JACOBI"},
"GS");
310 "Number of relaxation steps",
314 "Preconditioner of bottom solver.",
315 {
"NONE",
"ILUT",
"CHEBYSHEV",
"RILUK",
"JACOBI",
"BLOCK_JACOBI",
"GS",
"BLOCK_GS",
"SA"},
319 "Interpolater between levels.",
320 {
"TRILINEAR",
"LAGRANGE",
"PC"},
324 "Norm for convergence criteria.",
325 {
"L1_NORM",
"L2_NORM",
"LINF_NORM"},
329 "Write solver info in SDDS format (*.solver)",
333 "Rebalancing of Smoothed Aggregation "
338 "Reuse type of Smoothed Aggregation.",
339 {
"NONE",
"RP",
"RAP",
"SYMBOLIC",
"FULL"},
343 "AMR MG solver tolerance (default: 1.0e-10)",
394 throw OpalException(
"FieldSolver::find()",
"FieldSolver \"" +
name +
"\" not found.");
448 decomp[0] = decomp[1] =
SERIAL;
464 if (
itsAttr[deprecated::BCFFTT])
475 "The attribute \"FSTYPE\" has not correct type for AMR solver");
482 static const std::map<std::string, FieldSolverType> stringFSType_s = {
497 "The attribute \"FSTYPE\" isn't set for \"FIELDSOLVER\"!");
515 Inform m(
"FieldSolver::initAmrSolver");
523 bool sinTrafo = ((bcx ==
"DIRICHLET") && (bcy ==
"DIRICHLET") && (bcz ==
"DIRICHLET"));
525 std::cout <<
"FFTBOX ACTIVE" <<
std::endl;
530 std::vector<BoundaryGeometry*> geometries;
531 for (
unsigned int i = 0; i <= geoms.length(); i++) {
532 if (i == geoms.length() || geoms[i] ==
',') {
535 geometries.push_back(geom);
560#ifdef HAVE_SAAMG_SOLVER
565 std::vector<BoundaryGeometry*> geometries;
566 for (
unsigned int i = 0; i <= geoms.length(); i++) {
567 if (i == geoms.length() || geoms[i] ==
',') {
570 geometries.push_back(geom);
586 "SAAMG Solver not enabled! Please build OPAL with -DENABLE_SAAMG_SOLVER=1");
599 os <<
"* ************* F I E L D S O L V E R ********************************************** " <<
endl;
639 os <<
"* AMR_DOMAIN_RATIO ( ";
640 for (
auto& l : length) {
647#ifdef HAVE_AMR_MG_SOLVER
649 os <<
"* ITSOLVER (AMR_MG) "
653 <<
"* AMR_MG_REBALANCE "
657 <<
"* AMR_MG_SMOOTHER "
659 <<
"* AMR_MG_NSWEEPS "
661 <<
"* AMR_MG_INTERP "
667 <<
"* AMR_MG_VERBOSE "
673 if (
itsAttr[deprecated::BCFFTT]) {
674 os <<
"* BCFFTT (deprec.) "
684 os <<
"* XDIM parallel " <<
endl;
686 os <<
"* XDIM serial " <<
endl;
690 os <<
"* YDIM parallel " <<
endl;
692 os <<
"* YDIM serial " <<
endl;
696 os <<
"* Z(T)DIM parallel " <<
endl;
698 os <<
"* Z(T)DIM serial " <<
endl;
708 os <<
"* ********************************************************************************** " <<
endl;
716 std::function<bool(
const std::string&)> all_digits = [](
const std::string& s) {
719 return std::all_of(s.begin(), s.end(),
720 [](
char c) { return std::isdigit(c); });
723 if ( all_digits(tagging) )
776 "ML solver requires AMReX.");
778#ifdef AMREX_ENABLE_FBASELIB
783 "FMultiGrid solver requires AMReX.");
789 "HYPRE solver not yet implemented.");
792 "HPGMG solver not yet implemented.");
794#ifdef HAVE_AMR_MG_SOLVER
797 "FMultiGrid solver requires AMReX.");
823 "Multigrid solver not enabled! "
824 "Please build OPAL with -DENABLE_AMR_MG_SOLVER=1");
828 "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)
py::list function(PolynomialPatch *patch, py::list point)
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.
constexpr double e
The value of.
constexpr double c
The velocity of light in m/s.
bool amr
Enable AMR if true.
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 enum2string(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
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.