OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
ScalingFFAMagnet.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017, Chris Rogers
3 * All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 * 1. Redistributions of source code must retain the above copyright notice,
7 * this list of conditions and the following disclaimer.
8 * 2. Redistributions in binary form must reproduce the above copyright notice,
9 * this list of conditions and the following disclaimer in the documentation
10 * and/or other materials provided with the distribution.
11 * 3. Neither the name of STFC nor the names of its contributors may be used to
12 * endorse or promote products derived from this software without specific
13 * prior written permission.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE.
26 */
27
32
33#ifndef ABSBEAMLINE_ScalingFFAMagnet_H
34#define ABSBEAMLINE_ScalingFFAMagnet_H
35
48public:
53 explicit ScalingFFAMagnet(const std::string& name);
54
57
59 ScalingFFAMagnet* clone() const override;
60
70 bool apply(const std::shared_ptr<ParticleContainer_t>& pc) override;
71
72 bool apply(const size_t& i, const double& t, Vector_t<double, 3>& E, Vector_t<double, 3>& B)
73 override;
74
84 bool apply(
85 const Vector_t<double, 3>& R, const Vector_t<double, 3>& P, const double& t,
87
96
105
112 void initialise(PartBunch_t* bunch, double& startField, double& endField) override;
113
119 void initialise();
120
122 void finalise() override;
123
125 inline bool bends() const override;
126
128 void getFieldExtend(double& /*zBegin*/, double& /*zEnd*/) const override {}
129
131 BGeometryBase& getGeometry() override;
132
134 const BGeometryBase& getGeometry() const override;
135
137 EMField& getField() override;
138
140 const EMField& getField() const override;
141
143 void accept(BeamlineVisitor& visitor) const override;
144
146 double getTanDelta() const { return tanDelta_m; }
147
149 void setTanDelta(double tanDelta) { tanDelta_m = tanDelta; }
150
152 double getFieldIndex() const { return k_m; }
153
155 void setFieldIndex(double k) { k_m = k; }
156
158 double getDipoleConstant() const { return Bz_m; }
159
161 void setDipoleConstant(double Bz) { Bz_m = Bz; }
162
164 double getR0() const { return r0_m; }
165
167 void setR0(double r0) { r0_m = r0; }
168
171
173 void setCentre(Vector_t<double, 3> centre) { centre_m = centre; }
174
181
188
191 size_t getMaxOrder() const { return maxOrder_m; }
192
195 void setMaxOrder(size_t maxOrder) { maxOrder_m = maxOrder; }
196
199 double getPhiStart() const { return phiStart_m; }
200
203 void setPhiStart(double phiStart) { phiStart_m = phiStart; }
204
207 double getPhiEnd() const { return phiEnd_m; }
208
211 void setPhiEnd(double phiEnd) { phiEnd_m = phiEnd; }
212
215 double getRMin() const { return rMin_m; }
216
219 void setRMin(double rMin) { rMin_m = rMin; }
220
223 double getRMax() const { return rMax_m; }
224
227 void setRMax(double rMax) { rMax_m = rMax; }
228
231 double getAzimuthalExtent() const { return azimuthalExtent_m; }
232
235 void setAzimuthalExtent(double azimuthalExtent) { azimuthalExtent_m = azimuthalExtent; }
236
239 double getVerticalExtent() const { return verticalExtent_m; }
240
243 void setVerticalExtent(double verticalExtent) { verticalExtent_m = verticalExtent; }
244
246 std::vector<std::vector<double> > getDfCoefficients() { return dfCoefficients_m; }
247
256 void setupEndField();
257
263 void setEndFieldName(std::string name) { endFieldName_m = name; }
264
266 std::string getEndFieldName() const { return endFieldName_m; }
267
268private:
275
278
282
283 size_t maxOrder_m = 0;
284 double tanDelta_m = 0.;
285 double k_m = 0.;
286 double Bz_m = 0.;
287 double r0_m = 0.;
288 double rMin_m = 0.; // minimum radius
289 double rMax_m = 0.; // maximum radius
290 double phiStart_m = 0.; // offsets this element
291 double phiEnd_m = 0.; // used for placement of next element
292 double azimuthalExtent_m = 0.; // maximum distance used for field calculation
293 double verticalExtent_m = 0.; // maximum allowed distance from the midplane
296 std::string endFieldName_m = "";
297 const double fp_tolerance = 1e-18;
298 std::vector<std::vector<double> > dfCoefficients_m;
299};
300
301#endif
Defines the abstract interface for a single beamline component in the accelerator model.
ippl::Vector< T, Dim > Vector_t
Abstract base class for accelerator geometry classes.
Definition Geometry.h:42
The magnetic field of a multipole.
Abstract base class for electromagnetic fields.
Definition EMField.h:171
A simple arc in the XZ plane.
double getVerticalExtent() const
std::string endFieldName_m
void accept(BeamlineVisitor &visitor) const override
void setAzimuthalExtent(double azimuthalExtent)
void setRMin(double rMin)
void finalise() override
void setR0(double r0)
void setCentre(Vector_t< double, 3 > centre)
endfieldmodel::EndFieldModel * endField_m
double getDipoleConstant() const
void setVerticalExtent(double verticalExtent)
Vector_t< double, 3 > getCentre() const
std::vector< std::vector< double > > getDfCoefficients()
ScalingFFAMagnet * clone() const override
void setTanDelta(double tanDelta)
double getAzimuthalExtent() const
std::string getEndFieldName() const
void setDipoleConstant(double Bz)
void setPhiStart(double phiStart)
const double fp_tolerance
double getRMin() const
bool apply(const std::shared_ptr< ParticleContainer_t > &pc) override
double getPhiEnd() const
EMField & getField() override
size_t getMaxOrder() const
void setEndField(endfieldmodel::EndFieldModel *endField)
void setMaxOrder(size_t maxOrder)
void getFieldExtend(double &, double &) const override
BMultipoleField dummy
double getFieldIndex() const
void setFieldIndex(double k)
void setRMax(double rMax)
void setEndFieldName(std::string name)
void setPhiEnd(double phiEnd)
bool getFieldValue(const Vector_t< double, 3 > &R, Vector_t< double, 3 > &B) const
endfieldmodel::EndFieldModel * getEndField() const
Vector_t< double, 3 > centre_m
double getR0() const
double getRMax() const
std::vector< std::vector< double > > dfCoefficients_m
double getTanDelta() const
bool getFieldValueCylindrical(const Vector_t< double, 3 > &R, Vector_t< double, 3 > &B) const
double getPhiStart() const
BGeometryBase & getGeometry() override
bool bends() const override
ScalingFFAMagnet & operator=(const ScalingFFAMagnet &rhs)
PlanarArcGeometry planarArcGeometry_m