1 #ifndef OPAL_ParallelTTracker_HH
2 #define OPAL_ParallelTTracker_HH
96 const std::vector<unsigned long long> &maxSTEPS,
98 const std::vector<double> &zstop,
99 const std::vector<double> &dt);
266 int numDeviceElements;
269 void allocateDeviceMemory();
270 void freeDeviceMemory();
273 void pushParticlesDKS(
bool send =
true);
274 void kickParticlesDKS();
284 void writePhaseSpace(
const long long step,
bool psDump,
bool statDump);
297 void selectDT(
bool backTrack =
false);
298 void changeDT(
bool backTrack =
false);
305 void dumpStats(
long long step,
bool psDump,
bool statDump);
449 for (
int i = 0; i < localNum; ++i)
463 inline void ParallelTTracker::setupDKS() {
464 dksbase =
new DKSOPAL;
465 dksbase->setAPI(
"Cuda");
466 dksbase->setDevice(
"-gpu");
467 dksbase->initDevice();
469 dksbase->createStream(stream1);
470 dksbase->createStream(stream2);
474 inline void ParallelTTracker::allocateDeviceMemory() {
495 inline void ParallelTTracker::freeDeviceMemory() {
496 dksbase->freeMemory<
Vector_t>(r_ptr, numDeviceElements);
497 dksbase->freeMemory<
Vector_t>(p_ptr, numDeviceElements);
498 dksbase->freeMemory<
Vector_t>(Ef_ptr, numDeviceElements);
499 dksbase->freeMemory<
Vector_t>(Bf_ptr, numDeviceElements);
500 dksbase->freeMemory<
double>(dt_ptr, numDeviceElements);
511 inline void ParallelTTracker::sendRPdt() {
517 inline void ParallelTTracker::sendEfBf() {
524 inline void ParallelTTracker::pushParticlesDKS(
bool send) {
537 void ParallelTTracker::kickParticlesDKS() {
543 dksbase->syncDevice();
546 dksbase->callParallelTTrackerKick(r_ptr, p_ptr, Ef_ptr, Bf_ptr, dt_ptr,
550 dksbase->syncDevice();
558 #endif // OPAL_ParallelTTracker_HH
ParticleAttrib< Vector_t > P
void switchOffUnitlessPositions(bool use_dt_per_particle=false)
void pushParticles(const BorisPusher &pusher)
WakeFunction * wakeFunction_m
virtual void visitTravelingWave(const TravelingWave &)
Apply the algorithm to a RFCavity.
void findStartPosition(const BorisPusher &pusher)
ParticleAttrib< Vector_t > Ef
Interface for septum magnet.
void transformBunch(const CoordinateSystemTrafo &trafo)
virtual void visitRBend(const RBend &)
Apply the algorithm to a RBend.
Interface for electrostatic separator.
unsigned long totalParticlesInSimulation_m
virtual void execute()
Apply the algorithm to the top-level beamline.
virtual void visitBeamline(const Beamline &)
Apply the algorithm to a beam line.
void doBinaryRepartition()
Interface for beam position monitors.
Interface for RF Quadrupole.
virtual void visitRBend3D(const RBend3D &)
Apply the algorithm to a RBend.
virtual void visitLambertson(const Lambertson &)
Apply the algorithm to a Lambertson.
virtual void visitBeamBeam(const BeamBeam &)
Apply the algorithm to a BeamBeam.
IpplTimings::TimerRef timeIntegrationTimer1_m
Define the position of a misaligned element.
void updateReferenceParticle(const BorisPusher &pusher)
Interface for general corrector.
IpplTimings::TimerRef fieldEvaluationTimer_m
unsigned int emissionSteps_m
Interface for beam diagnostics.
virtual void visitRFQuadrupole(const RFQuadrupole &)
Apply the algorithm to a RFQuadrupole.
unsigned int repartFreq_m
Interface for drift space.
size_t numParticlesInSimulation_m
IpplTimings::TimerRef BinRepartTimer_m
void updateReference(const BorisPusher &pusher)
virtual void visitSeptum(const Septum &)
Apply the algorithm to a Septum.
virtual void visitCorrector(const Corrector &)
Apply the algorithm to a Corrector.
void kickParticles(const BorisPusher &pusher)
void updateRefToLabCSTrafo()
void computeParticleMatterInteraction(IndexMap::value_t elements, OrbitThreader &oth)
Interface for general multipole.
void restoreCavityPhases()
double zstart_m
where to start
T deg(T x)
Convert radians to degrees.
void updateRFElement(std::string elName, double maxPhi)
OpalBeamline itsOpalBeamline_m
void computeWakefield(IndexMap::value_t &elements)
void computeExternalFields(OrbitThreader &oth)
bool hasEndOfLineReached()
void writePhaseSpace(const long long step, bool psDump, bool statDump)
virtual void visitDegrader(const Degrader &)
Apply the algorithm to a Degrader.
virtual void visitMonitor(const Monitor &)
Apply the algorithm to a Monitor.
void applyFractionalStep(const BorisPusher &pusher, double tau)
double getQ() const
The constant charge per particle.
void computeSpaceChargeFields(unsigned long long step)
virtual void visitDiagnostic(const Diagnostic &)
Apply the algorithm to a Diagnostic.
bool particleMatterStatus_m
IpplTimings::TimerRef WakeFieldTimer_m
virtual void visitDrift(const Drift &)
Apply the algorithm to a Drift.
void changeDT(bool backTrack=false)
virtual void visitCyclotronValley(const CyclotronValley &)
Apply the algorithm to a CyclotronValley.
IpplTimings::TimerRef timeIntegrationTimer2_m
constexpr double c
The velocity of light in m/s.
Interface for cyclotron collimator.
virtual void visitMarker(const Marker &)
Apply the algorithm to a Marker.
void kick(const Vector_t &R, Vector_t &P, const Vector_t &Ef, const Vector_t &Bf, const double &dt) const
Abstract beam-beam interaction.
void visit(const T &, BeamlineVisitor &, PartBunchBase< double, 3 > *)
StepSizeConfig stepSizes_m
Interface for cyclotron valley.
void operator=(const ParallelTTracker &)
void switchToUnitlessPositions(bool use_dt_per_particle=false)
virtual void visitSeparator(const Separator &)
Apply the algorithm to a Separator.
virtual void visitMultipole(const Multipole &)
Apply the algorithm to a Multipole.
virtual void visitSolenoid(const Solenoid &)
Apply the algorithm to a Solenoid.
void emitParticles(long long step)
virtual void visitBeamStripping(const BeamStripping &)
Apply the algorithm to a BeamStripping.
An abstract sequence of beam line components.
const PartData itsReference
The reference information.
size_t getLocalNum() const
void timeIntegration2(BorisPusher &pusher)
virtual void visitRFCavity(const RFCavity &)
Apply the algorithm to a RFCavity.
ParticleAttrib< double > dt
virtual void visitSource(const Source &)
Apply the algorithm to a Solenoid.
double getM() const
The constant mass per particle.
virtual void visitSBend(const SBend &)
Apply the algorithm to a SBend.
virtual void visitCCollimator(const CCollimator &)
Apply the algorithm to a collimator.
virtual void visitProbe(const Probe &)
Apply the algorithm to a Probe.
virtual void visitParallelPlate(const ParallelPlate &)
Apply the algorithm to a ParallelPlate.
ParticleAttrib< Vector_t > Bf
void evenlyDistributeParticles()
void timeIntegration1(BorisPusher &pusher)
virtual void visitFlexibleCollimator(const FlexibleCollimator &)
Apply the algorithm to a flexible collimator.
Timing::TimerRef TimerRef
void setOptionalVariables()
std::set< ParticleMatterInteractionHandler * > activeParticleMatterInteractionHandlers_m
void push(Vector_t &R, const Vector_t &P, const double &dt) const
virtual void visitMultipoleT(const MultipoleT &)
Apply the algorithm to a MultipoleT.
PartBunchBase< double, 3 > * itsBunch_m
The bunch of particles to be tracked.
void autophaseCavities(const BorisPusher &pusher)
virtual void visitAlignWrapper(const AlignWrapper &)
Apply the algorithm to an align wrapper.
void selectDT(bool backTrack=false)
virtual ~ParallelTTracker()
Interface for a Lambertson septum.
std::set< std::shared_ptr< Component > > value_t
void dumpStats(long long step, bool psDump, bool statDump)
Track particles or bunches.