OPAL (Object Oriented Parallel Accelerator Library) 2024.2
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
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
167
168inline
170 return fs.printInfo(os);
171}
172
173#endif // OPAL_FieldSolver_HH
UniformCartesian< 3, double > Mesh_t
Definition PBunchDefs.h:22
ParticleSpatialLayout< double, 3, Mesh_t > Layout_t
Definition PBunchDefs.h:24
CenteredFieldLayout< 3, Mesh_t, Center_t > FieldLayout_t
Definition PBunchDefs.h:28
FieldSolverType
Definition FieldSolver.h:38
Inform & operator<<(Inform &os, const FieldSolver &fs)
const std::string name
Definition(int size, const char *name, const char *help)
Constructor for exemplars.
Layout_t & getParticleLayout()
virtual void update()
Update the field solver data.
std::unique_ptr< Layout_t > PL_m
The particle layout.
FieldSolverType fsType_m
void setMT(double)
Store emittance for mode 3.
unsigned int getInteractionRadius()
void initCartesianFields()
double getMY() const
Return meshsize.
FieldLayout_t * getFieldLayout()
std::string getTagging_m() const
Mesh_t * mesh_m
The cartesian mesh.
const AmrObject * getAmrObject() const
std::string fsName_m
PartBunchBase< double, 3 > * itsBunch_m
all the particles are here ...
std::string getType()
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.
void operator=(const FieldSolver &)
FieldLayout_t * FL_m
The field layout f.
FieldSolverType getFieldSolverType() const
bool hasPeriodicZ()
void initAmrObject_m()
AmrObject * getAmrObject()
std::unique_ptr< AmrObject > itsAmrObject_mp
void setMY(double)
Store emittance for mode 2.
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 FFT.h:48