OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
FieldSolver.h
Go to the documentation of this file.
1//
2// Class FieldSolver
3// The class for the OPAL FIELDSOLVER command.
4// A FieldSolver definition is used by most physics commands to define the
5// particle charge and the reference momentum, together with some other data.
6//
7// Copyright (c) 200x - 2022, Paul Scherrer Institut, Villigen PSI, Switzerland
8//
9// All rights reserved
10//
11// This file is part of OPAL.
12//
13// OPAL is free software: you can redistribute it and/or modify
14// it under the terms of the GNU General Public License as published by
15// the Free Software Foundation, either version 3 of the License, or
16// (at your option) any later version.
17//
18// You should have received a copy of the GNU General Public License
19// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
20//
21#ifndef OPAL_FieldSolver_HH
22#define OPAL_FieldSolver_HH
23
25#include "Algorithms/PartData.h"
27#ifdef ENABLE_AMR
28 #include "Amr/AmrObject.h"
30 #include <memory>
31#endif
32
33#include <string>
34
35template <class T, unsigned Dim>
36class PartBunchBase;
37
38enum class FieldSolverType: short {
39 NONE = -1,
40 FFT,
41 FFTBOX,
42 SAAMG,
43 P3M,
44 FMG,
45 ML,
46 AMRMG,
47 HYPRE,
48 HPGMG
49};
50
51
52class FieldSolver: public Definition {
53
54public:
57
58 virtual ~FieldSolver();
59
61 virtual FieldSolver* clone(const std::string& name);
62
64 static FieldSolver* find(const std::string& name);
65
66 std::string getType();
67
69 double getMX() const;
70
72 double getMY() const;
73
75 double getMT() const;
76
78 void setMX(double);
79
81 void setMY(double);
82
84 void setMT(double);
85
87 virtual void update();
88
90 virtual void execute();
91
93
95
96 bool hasValidSolver();
97
98 void setFieldSolverType();
100
101 inline Layout_t &getParticleLayout() { return* PL_m; }
102
104
105 Inform& printInfo(Inform& os) const;
106
107 unsigned int getInteractionRadius() {return (unsigned int) rpp_m; }
108
109 bool hasPeriodicZ();
110
111 bool isAmrSolverType() const;
112
113#ifdef ENABLE_AMR
115 return itsAmrObject_mp.get();
116 }
117
118 const AmrObject *getAmrObject() const {
119 return itsAmrObject_mp.get();
120 }
121#endif
122
125
126private:
127#ifdef ENABLE_AMR
128
129 std::string getTagging_m() const;
130
131 void initAmrObject_m();
132
133 void initAmrSolver_m();
134
135 std::unique_ptr<AmrObject> itsAmrObject_mp;
136#endif
137
138 // Not implemented.
140 void operator=(const FieldSolver&);
141
142 // Clone constructor.
143 FieldSolver(const std::string& name, FieldSolver* parent);
144
147
150
152 std::unique_ptr<Layout_t> PL_m;
153
156
157 std::string fsName_m;
159
160 double rpp_m;
161};
162
163inline
165 return fsType_m;
166}
167
168inline
170 return fs.printInfo(os);
171}
172
173#endif // OPAL_FieldSolver_HH
FieldSolverType
Definition: FieldSolver.h:38
Inform & operator<<(Inform &os, const FieldSolver &fs)
Definition: FieldSolver.h:169
const std::string name
FRONT * fs
Definition: hypervolume.cpp:59
The base class for all OPAL definitions.
Definition: Definition.h:30
Layout_t & getParticleLayout()
Definition: FieldSolver.h:101
virtual void update()
Update the field solver data.
std::unique_ptr< Layout_t > PL_m
The particle layout.
Definition: FieldSolver.h:152
FieldSolverType fsType_m
Definition: FieldSolver.h:158
void setMT(double)
Store emittance for mode 3.
unsigned int getInteractionRadius()
Definition: FieldSolver.h:107
void initCartesianFields()
double getMY() const
Return meshsize.
FieldLayout_t * getFieldLayout()
Definition: FieldSolver.h:103
std::string getTagging_m() const
Mesh_t * mesh_m
The cartesian mesh.
Definition: FieldSolver.h:146
const AmrObject * getAmrObject() const
Definition: FieldSolver.h:118
std::string fsName_m
Definition: FieldSolver.h:157
PartBunchBase< double, 3 > * itsBunch_m
all the particles are here ...
Definition: FieldSolver.h:155
std::string getType()
PoissonSolver * solver_m
the actual solver, should be a base object
Definition: FieldSolver.h:124
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.
void operator=(const FieldSolver &)
FieldLayout_t * FL_m
The field layout f.
Definition: FieldSolver.h:149
FieldSolverType getFieldSolverType() const
Definition: FieldSolver.h:164
bool hasPeriodicZ()
void initAmrObject_m()
AmrObject * getAmrObject()
Definition: FieldSolver.h:114
std::unique_ptr< AmrObject > itsAmrObject_mp
Definition: FieldSolver.h:135
void setMY(double)
Store emittance for mode 2.
double rpp_m
Definition: FieldSolver.h:160
double getMT() const
Return meshsize.
virtual ~FieldSolver()
FieldSolver(const FieldSolver &)
bool hasValidSolver()
void setMX(double)
Store emittance for mode 1.
virtual FieldSolver * clone(const std::string &name)
Make clone.
void initSolver(PartBunchBase< double, 3 > *b)
void initAmrSolver_m()
Definition: Inform.h:42