OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
ParallelTracker Class Reference

Implements the main time-based simulation loop for parallel tracking. More...

#include <ParallelTracker.h>

Inheritance diagram for ParallelTracker:
Inheritance graph
Collaboration diagram for ParallelTracker:
Collaboration graph

Public Types

enum  {
  X , PX , Y , PY ,
  T , PT
}
 

Public Member Functions

 ParallelTracker (const Beamline &bl, bool revBeam)
 Construct tracker with beamline only (no bunch attached here).
 
 ParallelTracker (const Beamline &bl, PartBunch_t &bunch, DataSink *ds, bool revBeam, const std::vector< unsigned long long > &maxSTEPS, double zstart, const std::vector< double > &zstop, const std::vector< double > &dt, const std::vector< std::vector< std::shared_ptr< SamplingBase > > > &emittingSamplers={})
 Construct tracker with bunch, output sink, and step-size schedule.
 
virtual ~ParallelTracker ()
 Destructor; releases tracker resources.
 
virtual void visitBeamline (const Beamline &)
 Visit the full beamline (iterates elements into OpalBeamline). Overrides DefaultVisitor.
 
virtual void visitComponent (const Component &)
 Visit a generic component using the base tracker behavior.
 
virtual void visitConstantEFieldCavity (const ConstantEFieldCavity &)
 Apply the algorithm to a constant E-field cavity.
 
virtual void visitDrift (const Drift &)
 Apply the algorithm to a drift.
 
virtual void visitLaser (const Laser &)
 Reject laser tracking until dedicated laser tracking is implemented.
 
virtual void visitMonitor (const Monitor &)
 Apply the algorithm to a monitor.
 
virtual void visitMarker (const Marker &)
 Apply the algorithm to a marker.
 
virtual void visitMultipole (const Multipole &)
 Apply the algorithm to a multipole.
 
virtual void visitMultipoleT (const MultipoleT &)
 Apply the algorithm to a multipole (templated type).
 
virtual void visitRBend (const RBend &)
 Apply the algorithm to a rectangular bend.
 
virtual void visitRFCavity (const RFCavity &)
 Apply the algorithm to an RF cavity.
 
virtual void visitSBend (const SBend &)
 Apply the algorithm to a sector bend.
 
virtual void visitTravelingWave (const TravelingWave &)
 Apply the algorithm to a traveling wave cavity.
 
virtual void visitSolenoid (const Solenoid &)
 Apply the algorithm to a solenoid.
 
virtual void execute ()
 Run the main tracking loop until all step-size segments complete.
 
void kickParticles (const BorisPusher &pusher, PartBunch_t::ParticleContainer_t &pc)
 Boris half-kick using E, B and per-particle dt on one container.
 
void pushParticles (const BorisPusher &pusher, PartBunch_t::ParticleContainer_t &pc)
 Boris position push (unitless positions) on one container.
 
void timeIntegration1 (BorisPusher &pusher)
 First half of the leapfrog step: push all active containers.
 
void timeIntegration2 (BorisPusher &pusher)
 Second half: kick then push all active containers.
 
void evolveSpinTBMT ()
 Thomas-BMT spin precession across all active containers that store Pol. Must be called after external + space-charge fields have been accumulated and before the momentum kick (so E, B at the particle are the lab-frame fields the particle sees during this step).
 
void computeSpaceChargeFields (unsigned long long step)
 Self-fields in beam frame (primary container); optional binary repartition.
 
void computeExternalFields (OrbitThreader &oth)
 Apply external fields from elements intersecting each active container.
 
void emitFromEmissionSources (double t, double dt)
 Emit macroparticles from configured samplers per container.
 
size_t applyGlobalProcesses (double dt)
 Apply global processes and return the global number of particles marked invalid.
 
void resetFields ()
 Zero E and B on all active particle containers.
 
void changeDT ()
 Set bunch dt from StepSizeConfig and copy to all container dt views.
 
void setTime ()
 Reset per-particle dt views to the current global bunch dt.
 
size_t markBackwardParticlesAtSourcePlane ()
 Mark particles moving backward behind an active source/cathode plane.
 
PartBunch_tgetBunch () const
 Return the currently attached borrowed bunch.
 
void addToBunch (const OpalParticle &)
 Add particle to bunch.
 
virtual void setNumBunch (short)
 set total number of tracked bunches
 
virtual short getNumBunch ()
 get total number of tracked bunches
 
void visitFlaggedElmPtr (const FlaggedElmPtr &) override
 Apply the algorithm to a FlaggedElmPtr.
 
void visitRing (const Ring &) override
 Apply the algorithm to a Ring.
 
void visitScalingFFAMagnet (const ScalingFFAMagnet &spiral) override
 Apply the algorithm to a scaling FFA magnet.
 
void visitVerticalFFAMagnet (const VerticalFFAMagnet &) override
 Apply the algorithm to a vertical FFA magnet.
 
void visitVariableRFCavity (const VariableRFCavity &) override
 Apply the algorithm to a variable RF cavity.
 
void visitProbe (const Probe &prob) override
 Apply the algorithm to a Probe.
 

Public Attributes

FieldList cavities_m
 
const BeamlineitsBeamline_m
 

Protected Attributes

PartBunch_titsBunch_m
 The bunch of particles to be tracked. Borrowed; lifetime is managed by TrackRun.
 
const BeamlineitsLine
 
bool back_beam
 
bool back_track
 
bool back_path
 
double flip_B
 
double flip_s
 

Private Member Functions

void updateReference (const BorisPusher &pusher)
 Update reference trajectories and lab/reference coordinate transforms.
 
void updateReferenceParticles (const BorisPusher &pusher)
 Advance reference positions/momenta through the beamline for one step.
 
void updateRefToLabCSTrafo ()
 Refresh each container's reference-to-lab transform from current state.
 
void writePhaseSpace (const long long step, bool psDump, bool statDump)
 Write phase space and/or statistics when flags request it.
 
void dumpStats (long long step, bool psDump, bool statDump)
 Log per-container stats and trigger dumps according to dump flags.
 
void prepareSections ()
 Accept beamline visitor, prepare sections, compute and save 3D lattice.
 
void selectDT ()
 Set global bunch dt to dtCurrentTrack_m.
 
void setOptionalVariables ()
 Load REPARTFREQ and related options from input.
 
bool hasEndOfLineReached (const BoundingBox &globalBoundingBox)
 Whether tracking should stop at end-of-line (global reduction).
 
void doBinaryRepartition ()
 Trigger binary repartition for the field solver if configured.
 
size_t deleteInvalidParticles (bool activeOnly, Inform &m, const std::string &reason)
 Delete particles marked invalid by the central per-container mask.
 
void activateEmittingContainers (double t)
 Force-activate containers whose emitting samplers have not yet finished.
 
void computeInitialBounds (Vector_t< double, 3 > &rmin, Vector_t< double, 3 > &rmax)
 Union of per-container spatial bounds over MPI.
 
void printInitialContainerRefs (Inform &m) const
 Log reference state for each container at track start.
 
void findStartPositions (const BorisPusher &pusher)
 Integrate references in time until path length reaches zstart_m.
 
void autophaseCavities (const BorisPusher &pusher)
 Autophase TRAVELINGWAVE and RFCAVITY elements along the reference orbit.
 
void updateRFElement (std::string elName, double maxPhi)
 Set stored RF phase on the named cavity or traveling-wave element.
 
void printRFPhases ()
 Print RF phases (debug/diagnostic hook).
 
void saveCavityPhases ()
 Persist cavity phases to the data sink.
 
void restoreCavityPhases ()
 Restore cavity phases from a prior track or restart.
 
virtual void applyDefault (const ElementBase &)
 

Private Attributes

DataSinkitsDataSink_m
 Borrowed beam statistics and phase-space output sink.
 
OpalBeamline itsOpalBeamline_m
 Cloned field elements and coordinate transforms.
 
bool globalEOL_m
 End-of-line flag (e.g. orbit threader out of bounds).
 
double zstart_m
 Path-length start position for the track (m).
 
StepSizeConfig stepSizes_m
 
double dtCurrentTrack_m
 Global \(\Delta t\) for the current track segment.
 
unsigned long long repartFreq_m
 Space-charge repartition period (steps); 0 disables it.
 
std::vector< std::vector< std::shared_ptr< SamplingBase > > > emittingSamplers_m
 Per-container emitters.
 
IpplTimings::TimerRef timeIntegrationTimer1_m
 
IpplTimings::TimerRef timeIntegrationTimer2_m
 
IpplTimings::TimerRef fieldEvaluationTimer_m
 
IpplTimings::TimerRef WakeFieldTimer_m
 
IpplTimings::TimerRef PluginElemTimer_m
 
IpplTimings::TimerRef BinRepartTimer_m
 
IpplTimings::TimerRef OrbThreader_m
 
bool local_flip
 

Detailed Description

Implements the main time-based simulation loop for parallel tracking.

Note
TRACK and RUN in the input file construct a ParallelTracker and run ParallelTracker::execute().

Definition at line 71 of file ParallelTracker.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
inherited
Enumerator
PX 
PY 
PT 

Definition at line 36 of file AbstractTracker.h.

Constructor & Destructor Documentation

◆ ParallelTracker() [1/2]

ParallelTracker::ParallelTracker ( const Beamline bl,
bool  revBeam 
)
explicit

Construct tracker with beamline only (no bunch attached here).

Construct tracker from a beamline only (see class constructor overload).

Parameters
blBeamline definition.
revBeamIf true, reversed beam direction (s = C to 0); OPAL-T parallel tracking is forward-only; revTrack is not used.

Definition at line 70 of file ParallelTracker.cpp.

◆ ParallelTracker() [2/2]

ParallelTracker::ParallelTracker ( const Beamline bl,
PartBunch_t bunch,
DataSink ds,
bool  revBeam,
const std::vector< unsigned long long > &  maxSTEPS,
double  zstart,
const std::vector< double > &  zstop,
const std::vector< double > &  dt,
const std::vector< std::vector< std::shared_ptr< SamplingBase > > > &  emittingSamplers = {} 
)
explicit

Construct tracker with bunch, output sink, and step-size schedule.

Construct tracker with bunch, data sink, z-segments, and optional emitters.

Parameters
blBeamline definition.
bunchBorrowed particle bunch (multi-container).
dsBorrowed data sink for statistics and dumps.
revBeamReversed beam flag (see single-argument constructor).
maxSTEPSMax integration steps per z-segment (parallel to zstop/dt).
zstartStarting path length (m).
zstopStop path length per segment (m).
dtTime step per segment (s).
emittingSamplersOptional per-container samplers for emitParticles(t, dt).

Definition at line 88 of file ParallelTracker.cpp.

References StepSizeConfig::push_back(), StepSizeConfig::resetIterator(), StepSizeConfig::sortAscendingZStop(), and stepSizes_m.

Here is the call graph for this function:

◆ ~ParallelTracker()

ParallelTracker::~ParallelTracker ( )
virtual

Destructor; releases tracker resources.

Destructor; releases tracker resources.

Definition at line 117 of file ParallelTracker.cpp.

Member Function Documentation

◆ activateEmittingContainers()

void ParallelTracker::activateEmittingContainers ( double  t)
private

Force-activate containers whose emitting samplers have not yet finished.

Force-activate containers whose emitting samplers have not yet finished.

Definition at line 1150 of file ParallelTracker.cpp.

References emittingSamplers_m, Tracker::itsBunch_m, and PartBunch< T, Dim >::setPcActive().

Referenced by execute().

Here is the call graph for this function:

◆ addToBunch()

void Tracker::addToBunch ( const OpalParticle )
inherited

Add particle to bunch.

Definition at line 93 of file Tracker.cpp.

References gmsg.

◆ applyDefault()

◆ applyGlobalProcesses()

size_t ParallelTracker::applyGlobalProcesses ( double  dt)

Apply global processes and return the global number of particles marked invalid.

Definition at line 837 of file ParallelTracker.cpp.

References PartBunch< T, Dim >::getGlobalTrackStep(), and Tracker::itsBunch_m.

Referenced by execute().

Here is the call graph for this function:

◆ autophaseCavities()

void ParallelTracker::autophaseCavities ( const BorisPusher pusher)
private

Autophase TRAVELINGWAVE and RFCAVITY elements along the reference orbit.

Autophase TRAVELINGWAVE and RFCAVITY elements along the reference orbit.

Definition at line 1693 of file ParallelTracker.cpp.

References Physics::c, RFCavity::getAutophaseVeto(), PartBunch< T, Dim >::getdT(), OpalBeamline::getElements(), CavityAutophaser::getPhaseAtMaxEnergy(), PartBunch< T, Dim >::getReference(), PartBunch< T, Dim >::getT(), Tracker::itsBunch_m, itsOpalBeamline_m, BorisPusher::push(), RFCAVITY, OpalBeamline::rotateToLocalCS(), OpalBeamline::transformToLocalCS(), and TRAVELINGWAVE.

Referenced by findStartPositions().

Here is the call graph for this function:

◆ changeDT()

void ParallelTracker::changeDT ( )

Set bunch dt from StepSizeConfig and copy to all container dt views.

Set bunch dt from StepSizeConfig and copy to all container dt views.

Definition at line 1135 of file ParallelTracker.cpp.

References PartBunch< T, Dim >::getdT(), Tracker::itsBunch_m, and selectDT().

Referenced by execute(), and findStartPositions().

Here is the call graph for this function:

◆ computeExternalFields()

void ParallelTracker::computeExternalFields ( OrbitThreader oth)

Apply external fields from elements intersecting each active container.

Apply external fields from elements intersecting each active container.

Parameters
othOrbit threader for element queries.

Definition at line 717 of file ParallelTracker.cpp.

References fieldEvaluationTimer_m, OpalBeamline::getCSTrafoLab2Local(), OpalBeamline::getMisalignment(), globalEOL_m, gmsg, CoordinateSystemTrafo::inverted(), PartBunch< T, Dim >::isPcActive(), Tracker::itsBunch_m, itsOpalBeamline_m, and OrbitThreader::query().

Referenced by execute().

Here is the call graph for this function:

◆ computeInitialBounds()

void ParallelTracker::computeInitialBounds ( Vector_t< double, 3 > &  rmin,
Vector_t< double, 3 > &  rmax 
)
private

Union of per-container spatial bounds over MPI.

Union of per-container spatial bounds over MPI.

Parameters
[out]rminCorner of the axis-aligned bounding box (min).
[out]rmaxCorner of the axis-aligned bounding box (max).

Definition at line 1175 of file ParallelTracker.cpp.

References Tracker::itsBunch_m.

Referenced by execute().

◆ computeSpaceChargeFields()

void ParallelTracker::computeSpaceChargeFields ( unsigned long long  step)

Self-fields in beam frame (primary container); optional binary repartition.

Self-fields in beam frame (primary container); optional binary repartition.

Parameters
stepGlobal step index (used for repartition cadence).
Frame of reference
  • Entry: \(R\), \(E\), \(B\) in the reference (lab) frame.
  • After transform to beam: \(R\) in the beam frame (origin at reference, z along momentum).
  • Inside computeSelfFields / bunchUpdate: mesh follows \(R\), so mesh is in the beam frame.
  • After transform back: \(R\), \(E\), \(B\) in the reference frame again.
  • After final bunchUpdate(): mesh matches reference-frame \(R\).

Definition at line 636 of file ParallelTracker.cpp.

References PartBunch< T, Dim >::bunchUpdate(), PartBunch< T, Dim >::calcBeamParameters(), PartBunch< T, Dim >::computeSelfFields(), Quaternion::conjugate(), doBinaryRepartition(), dot(), getQuaternion(), gmsg, PartBunch< T, Dim >::hasFieldSolver(), CoordinateSystemTrafo::inverted(), Tracker::itsBunch_m, PartBunch< T, Dim >::R(), repartFreq_m, CoordinateSystemTrafo::rotateBunchTo(), and CoordinateSystemTrafo::transformBunchTo().

Referenced by execute().

Here is the call graph for this function:

◆ deleteInvalidParticles()

size_t ParallelTracker::deleteInvalidParticles ( bool  activeOnly,
Inform &  m,
const std::string &  reason 
)
private

Delete particles marked invalid by the central per-container mask.

Definition at line 860 of file ParallelTracker.cpp.

References PartBunch< T, Dim >::isPcActive(), and Tracker::itsBunch_m.

Referenced by execute().

Here is the call graph for this function:

◆ doBinaryRepartition()

void ParallelTracker::doBinaryRepartition ( )
private

Trigger binary repartition for the field solver if configured.

Trigger binary repartition for the field solver if configured.

Definition at line 1164 of file ParallelTracker.cpp.

Referenced by computeSpaceChargeFields().

◆ dumpStats()

void ParallelTracker::dumpStats ( long long  step,
bool  psDump,
bool  statDump 
)
private

Log per-container stats and trigger dumps according to dump flags.

Log per-container stats and trigger dumps according to dump flags.

Parameters
stepCurrent integration step index.
psDumpForwarded to writePhaseSpace when logging occurs.
statDumpForwarded to writePhaseSpace when logging occurs.

Definition at line 1424 of file ParallelTracker.cpp.

References Util::getEnergyString(), PartBunch< T, Dim >::getGlobalTrackStep(), Util::getLengthString(), PartBunch< T, Dim >::getT(), Util::getTimeString(), PartBunch< T, Dim >::getTotalNumAllContainers(), gmsg, Tracker::itsBunch_m, Options::stepInfoFreq, OPALTimer::Timer::time(), PartBunch< T, Dim >::updateMoments(), and writePhaseSpace().

Referenced by execute().

Here is the call graph for this function:

◆ emitFromEmissionSources()

void ParallelTracker::emitFromEmissionSources ( double  t,
double  dt 
)

Emit macroparticles from configured samplers per container.

Emit macroparticles from configured samplers per container.

Parameters
tBunch time (s).
dtGlobal time step (s).

Definition at line 784 of file ParallelTracker.cpp.

References emittingSamplers_m, OpalBeamline::getCSTrafoLab2Local(), CoordinateSystemTrafo::inverted(), Tracker::itsBunch_m, itsOpalBeamline_m, PartBunch< T, Dim >::pcAtZStop(), PartBunch< T, Dim >::R(), and PartBunch< T, Dim >::refreshPcActiveAfterEmit().

Referenced by execute().

Here is the call graph for this function:

◆ evolveSpinTBMT()

void ParallelTracker::evolveSpinTBMT ( )

Thomas-BMT spin precession across all active containers that store Pol. Must be called after external + space-charge fields have been accumulated and before the momentum kick (so E, B at the particle are the lab-frame fields the particle sees during this step).

Definition at line 1045 of file ParallelTracker.cpp.

References SpinTBMTPusher::evolve(), PartData::getAnomaly(), PartData::getM(), PartData::getQ(), PartBunch< T, Dim >::isPcActive(), and Tracker::itsBunch_m.

Referenced by execute().

Here is the call graph for this function:

◆ execute()

void ParallelTracker::execute ( )
virtual

Run the main tracking loop until all step-size segments complete.

Run the main tracking loop until all step-size segments complete.

Reimplemented from DefaultVisitor.

Definition at line 165 of file ParallelTracker.cpp.

References OpalBeamline::activateElements(), activateEmittingContainers(), StepSizeConfig::advanceToPos(), PartBunch< T, Dim >::anyPcActive(), applyGlobalProcesses(), Options::boundpDestroy, PartBunch< T, Dim >::bunchUpdate(), Physics::c, changeDT(), computeExternalFields(), computeInitialBounds(), computeSpaceChargeFields(), deleteInvalidParticles(), dot(), dtCurrentTrack_m, dumpStats(), emitFromEmissionSources(), emittingSamplers_m, euclidean_norm(), evolveSpinTBMT(), OrbitThreader::execute(), findStartPositions(), OrbitThreader::getBoundingBox(), FieldSolver< T, Dim >::getCallCounter(), OpalBeamline::getCSTrafoLab2Local(), StepSizeConfig::getdT(), PartBunch< T, Dim >::getdT(), OpalBeamline::getElements(), PartBunch< T, Dim >::getFieldSolver(), Util::getGamma(), OpalData::getGlobalPhaseShift(), PartBunch< T, Dim >::getGlobalTrackStep(), OpalData::getInstance(), Util::getLengthString(), PartData::getM(), StepSizeConfig::getMaxSteps(), StepSizeConfig::getMinTimeStep(), StepSizeConfig::getNumSteps(), PartData::getP(), PartBunch< T, Dim >::getReference(), PartBunch< T, Dim >::getT(), Util::getTimeString(), PartBunch< T, Dim >::getTotalNumAllContainers(), StepSizeConfig::getZStop(), globalEOL_m, gmsg, PartBunch< T, Dim >::hasFieldSolver(), PartBunch< T, Dim >::incrementT(), PartBunch< T, Dim >::incTrackSteps(), CoordinateSystemTrafo::inverted(), PartBunch< T, Dim >::isPcActive(), Tracker::itsBunch_m, itsOpalBeamline_m, markBackwardParticlesAtSourcePlane(), OrbThreader_m, PartBunch< T, Dim >::performBunchSanityChecks(), prepareSections(), StepSizeConfig::printDirect(), printInitialContainerRefs(), Options::psDumpFreq, StepSizeConfig::reachedEnd(), resetFields(), PartBunch< T, Dim >::resetPcActive(), CoordinateSystemTrafo::rotateTo(), selectDT(), PartBunch< T, Dim >::setdT(), setOptionalVariables(), PartBunch< T, Dim >::setPcAtZStop(), PartBunch< T, Dim >::setT(), setTime(), Options::statDumpFreq, stepSizes_m, OpalBeamline::switchElementsOff(), OPALTimer::Timer::time(), timeIntegration1(), timeIntegration2(), CoordinateSystemTrafo::transformTo(), updateReference(), DumpEMFields::writeFields(), writePhaseSpace(), and zstart_m.

◆ findStartPositions()

void ParallelTracker::findStartPositions ( const BorisPusher pusher)
private

Integrate references in time until path length reaches zstart_m.

Integrate references in time until path length reaches zstart_m.

Definition at line 1328 of file ParallelTracker.cpp.

References autophaseCavities(), Physics::c, changeDT(), dtCurrentTrack_m, euclidean_norm(), StepSizeConfig::getdT(), PartBunch< T, Dim >::getdT(), Util::getGamma(), PartBunch< T, Dim >::getT(), StepSizeConfig::getZStop(), Tracker::itsBunch_m, StepSizeConfig::reachedEnd(), selectDT(), PartBunch< T, Dim >::setT(), stepSizes_m, updateReferenceParticles(), and zstart_m.

Referenced by execute().

Here is the call graph for this function:

◆ getBunch()

PartBunch_t & Tracker::getBunch ( ) const
inherited

Return the currently attached borrowed bunch.

Definition at line 86 of file Tracker.cpp.

References Tracker::itsBunch_m.

◆ getNumBunch()

virtual short Tracker::getNumBunch ( )
inlinevirtualinherited

get total number of tracked bunches

Definition at line 110 of file Tracker.h.

◆ hasEndOfLineReached()

bool ParallelTracker::hasEndOfLineReached ( const BoundingBox globalBoundingBox)
private

Whether tracking should stop at end-of-line (global reduction).

Whether tracking should stop at end-of-line (global reduction).

Parameters
globalBoundingBoxSpatial bounds from the orbit threader.

Definition at line 1508 of file ParallelTracker.cpp.

References globalEOL_m, BoundingBox::isOutside(), and Tracker::itsBunch_m.

Here is the call graph for this function:

◆ kickParticles()

void ParallelTracker::kickParticles ( const BorisPusher pusher,
PartBunch_t::ParticleContainer_t pc 
)

Boris half-kick using E, B and per-particle dt on one container.

Boris velocity kick from E and B using per-particle dt.

Parameters
pusherBoris pusher instance.
pcNon-null particle container.
pusherBoris pusher.
pcNon-null target particle container.

Definition at line 1008 of file ParallelTracker.cpp.

References ParticleContainer< T, Dim >::B, ParticleContainer< T, Dim >::dt, ParticleContainer< T, Dim >::E, PartData::getM(), PartData::getQ(), ParticleContainer< T, Dim >::getReference(), BorisPusher::kick(), ParticleContainer< T, Dim >::markMomentsDirty(), and ParticleContainer< T, Dim >::P.

Referenced by timeIntegration2().

Here is the call graph for this function:

◆ markBackwardParticlesAtSourcePlane()

size_t ParallelTracker::markBackwardParticlesAtSourcePlane ( )

Mark particles moving backward behind an active source/cathode plane.

Todo:
this function should probably be integrated as a GunSource element similar to old OPAL!!!

Definition at line 885 of file ParallelTracker.cpp.

References OpalBeamline::getCSTrafoLab2Local(), PartBunch< T, Dim >::getFieldSolver(), CoordinateSystemTrafo::getOrigin(), CoordinateSystemTrafo::getRotationMatrix(), BinnedFieldSolver< T, Dim >::isImageChargeEnabled(), PartBunch< T, Dim >::isPcActive(), Tracker::itsBunch_m, itsOpalBeamline_m, and prod_vector().

Referenced by execute().

Here is the call graph for this function:

◆ prepareSections()

void ParallelTracker::prepareSections ( )
private

Accept beamline visitor, prepare sections, compute and save 3D lattice.

Accept beamline visitor, prepare sections, compute and save 3D lattice.

Definition at line 1083 of file ParallelTracker.cpp.

References ElementBase::accept(), OpalBeamline::compute3DLattice(), Tracker::itsBeamline_m, itsOpalBeamline_m, OpalBeamline::prepareSections(), OpalBeamline::save3DInput(), and OpalBeamline::save3DLattice().

Referenced by execute().

Here is the call graph for this function:

◆ printInitialContainerRefs()

void ParallelTracker::printInitialContainerRefs ( Inform &  m) const
private

Log reference state for each container at track start.

Log reference state for each container at track start.

Parameters
mInform stream for log output.

Definition at line 1220 of file ParallelTracker.cpp.

References PartBunch< T, Dim >::getTotalNumAllContainers(), and Tracker::itsBunch_m.

Referenced by execute().

Here is the call graph for this function:

◆ printRFPhases()

void ParallelTracker::printRFPhases ( )
private

Print RF phases (debug/diagnostic hook).

◆ pushParticles()

void ParallelTracker::pushParticles ( const BorisPusher pusher,
PartBunch_t::ParticleContainer_t pc 
)

Boris position push (unitless positions) on one container.

Boris position push in unitless coordinates (per-particle dt via pusher internals).

Parameters
pusherBoris pusher instance.
pcNon-null particle container.
pusherBoris pusher.
pcNon-null target particle container.

Definition at line 973 of file ParallelTracker.cpp.

References ParticleContainer< T, Dim >::markMomentsDirty(), ParticleContainer< T, Dim >::P, BorisPusher::push(), ParticleContainer< T, Dim >::switchOffUnitlessPositions(), and ParticleContainer< T, Dim >::switchToUnitlessPositions().

Referenced by timeIntegration1(), and timeIntegration2().

Here is the call graph for this function:

◆ resetFields()

void ParallelTracker::resetFields ( )

Zero E and B on all active particle containers.

Zero E and B on all active particle containers.

Definition at line 953 of file ParallelTracker.cpp.

References PartBunch< T, Dim >::isPcActive(), and Tracker::itsBunch_m.

Referenced by execute().

Here is the call graph for this function:

◆ restoreCavityPhases()

void ParallelTracker::restoreCavityPhases ( )
private

Restore cavity phases from a prior track or restart.

Restore cavity phases from a prior track or restart.

Definition at line 1678 of file ParallelTracker.cpp.

References OpalData::getFirstMaxPhases(), OpalData::getInstance(), OpalData::getLastMaxPhases(), and updateRFElement().

Here is the call graph for this function:

◆ saveCavityPhases()

void ParallelTracker::saveCavityPhases ( )
private

Persist cavity phases to the data sink.

Persist cavity phases to the data sink.

Definition at line 1673 of file ParallelTracker.cpp.

References itsDataSink_m, and DataSink::storeCavityInformation().

Here is the call graph for this function:

◆ selectDT()

void ParallelTracker::selectDT ( )
private

Set global bunch dt to dtCurrentTrack_m.

Set global bunch dt to dtCurrentTrack_m.

Definition at line 1107 of file ParallelTracker.cpp.

References dtCurrentTrack_m, emittingSamplers_m, PartBunch< T, Dim >::getT(), Tracker::itsBunch_m, and PartBunch< T, Dim >::setdT().

Referenced by changeDT(), execute(), and findStartPositions().

Here is the call graph for this function:

◆ setNumBunch()

virtual void Tracker::setNumBunch ( short  )
inlinevirtualinherited

set total number of tracked bunches

Definition at line 107 of file Tracker.h.

◆ setOptionalVariables()

void ParallelTracker::setOptionalVariables ( )
private

Load REPARTFREQ and related options from input.

Load REPARTFREQ and related options from input.

Definition at line 1470 of file ParallelTracker.cpp.

References OpalData::find(), OpalData::getInstance(), RealVariable::getReal(), Options::repartFreq, and repartFreq_m.

Referenced by execute().

Here is the call graph for this function:

◆ setTime()

void ParallelTracker::setTime ( )

Reset per-particle dt views to the current global bunch dt.

Reset per-particle dt views to the current global bunch dt.

Definition at line 1521 of file ParallelTracker.cpp.

References PartBunch< T, Dim >::getdT(), and Tracker::itsBunch_m.

Referenced by execute().

Here is the call graph for this function:

◆ timeIntegration1()

void ParallelTracker::timeIntegration1 ( BorisPusher pusher)

First half of the leapfrog step: push all active containers.

First half of the leapfrog step: push all active containers.

Definition at line 575 of file ParallelTracker.cpp.

References PartBunch< T, Dim >::isPcActive(), Tracker::itsBunch_m, pushParticles(), and timeIntegrationTimer1_m.

Referenced by execute().

Here is the call graph for this function:

◆ timeIntegration2()

void ParallelTracker::timeIntegration2 ( BorisPusher pusher)

Second half: kick then push all active containers.

Second half: kick then push all active containers.

Definition at line 596 of file ParallelTracker.cpp.

References PartBunch< T, Dim >::getdT(), PartBunch< T, Dim >::isPcActive(), Tracker::itsBunch_m, kickParticles(), pushParticles(), and timeIntegrationTimer2_m.

Referenced by execute().

Here is the call graph for this function:

◆ updateReference()

void ParallelTracker::updateReference ( const BorisPusher pusher)
private

Update reference trajectories and lab/reference coordinate transforms.

Update reference trajectories and lab/reference coordinate transforms.

Definition at line 1245 of file ParallelTracker.cpp.

References updateReferenceParticles(), and updateRefToLabCSTrafo().

Referenced by execute().

Here is the call graph for this function:

◆ updateReferenceParticles()

void ParallelTracker::updateReferenceParticles ( const BorisPusher pusher)
private

◆ updateRefToLabCSTrafo()

void ParallelTracker::updateRefToLabCSTrafo ( )
private

Refresh each container's reference-to-lab transform from current state.

Refresh each container's reference-to-lab transform from current state.

Definition at line 1309 of file ParallelTracker.cpp.

References PartBunch< T, Dim >::getdT(), PartBunch< T, Dim >::isPcActive(), and Tracker::itsBunch_m.

Referenced by updateReference().

Here is the call graph for this function:

◆ updateRFElement()

void ParallelTracker::updateRFElement ( std::string  elName,
double  maxPhi 
)
private

Set stored RF phase on the named cavity or traveling-wave element.

Set stored RF phase on the named cavity or traveling-wave element.

Parameters
elNameElement name to match.
maxPhiRF phase to apply (rad).

Definition at line 1649 of file ParallelTracker.cpp.

References OpalBeamline::getElementByType(), ElementBase::getName(), itsOpalBeamline_m, RFCAVITY, RFCavity::setAutophaseVeto(), RFCavity::setPhasem(), and TRAVELINGWAVE.

Referenced by restoreCavityPhases().

Here is the call graph for this function:

◆ visitBeamline()

void ParallelTracker::visitBeamline ( const Beamline bl)
virtual

Visit the full beamline (iterates elements into OpalBeamline). Overrides DefaultVisitor.

Iterate beamline elements and dispatch into OpalBeamline.

Parameters
blFlagged beamline whose elements are visited.

Reimplemented from DefaultVisitor.

Definition at line 142 of file ParallelTracker.cpp.

References TBeamline< T >::iterate().

Here is the call graph for this function:

◆ visitComponent()

void ParallelTracker::visitComponent ( const Component comp)
virtual

Visit a generic component using the base tracker behavior.

Visit a generic component using the base tracker behavior.

Reimplemented from Tracker.

Definition at line 123 of file ParallelTracker.cpp.

References Component::getType(), LASER, and Tracker::visitComponent().

Here is the call graph for this function:

◆ visitConstantEFieldCavity()

void ParallelTracker::visitConstantEFieldCavity ( const ConstantEFieldCavity cav)
inlinevirtual

Apply the algorithm to a constant E-field cavity.

Reimplemented from DefaultVisitor.

Definition at line 315 of file ParallelTracker.h.

References Tracker::itsBunch_m, itsOpalBeamline_m, and OpalBeamline::visit().

Here is the call graph for this function:

◆ visitDrift()

void ParallelTracker::visitDrift ( const Drift drift)
inlinevirtual

Apply the algorithm to a drift.

Reimplemented from DefaultVisitor.

Definition at line 319 of file ParallelTracker.h.

References Tracker::itsBunch_m, itsOpalBeamline_m, and OpalBeamline::visit().

Here is the call graph for this function:

◆ visitFlaggedElmPtr()

void DefaultVisitor::visitFlaggedElmPtr ( const FlaggedElmPtr fep)
overridevirtualinherited

◆ visitLaser()

void ParallelTracker::visitLaser ( const Laser )
virtual

Reject laser tracking until dedicated laser tracking is implemented.

Reimplemented from DefaultVisitor.

Definition at line 132 of file ParallelTracker.cpp.

◆ visitMarker()

void ParallelTracker::visitMarker ( const Marker marker)
inlinevirtual

Apply the algorithm to a marker.

Reimplemented from DefaultVisitor.

Definition at line 327 of file ParallelTracker.h.

References Tracker::itsBunch_m, itsOpalBeamline_m, and OpalBeamline::visit().

Here is the call graph for this function:

◆ visitMonitor()

void ParallelTracker::visitMonitor ( const Monitor monitor)
inlinevirtual

Apply the algorithm to a monitor.

Reimplemented from DefaultVisitor.

Definition at line 323 of file ParallelTracker.h.

References Tracker::itsBunch_m, itsOpalBeamline_m, and OpalBeamline::visit().

Here is the call graph for this function:

◆ visitMultipole()

void ParallelTracker::visitMultipole ( const Multipole mult)
inlinevirtual

Apply the algorithm to a multipole.

Reimplemented from DefaultVisitor.

Definition at line 331 of file ParallelTracker.h.

References Tracker::itsBunch_m, itsOpalBeamline_m, and OpalBeamline::visit().

Here is the call graph for this function:

◆ visitMultipoleT()

void ParallelTracker::visitMultipoleT ( const MultipoleT mult)
inlinevirtual

Apply the algorithm to a multipole (templated type).

Reimplemented from DefaultVisitor.

Definition at line 335 of file ParallelTracker.h.

References Tracker::itsBunch_m, itsOpalBeamline_m, and OpalBeamline::visit().

Here is the call graph for this function:

◆ visitProbe()

void DefaultVisitor::visitProbe ( const Probe prob)
overridevirtualinherited

Apply the algorithm to a Probe.

Implements BeamlineVisitor.

Definition at line 95 of file DefaultVisitor.cpp.

References DefaultVisitor::applyDefault().

Here is the call graph for this function:

◆ visitRBend()

void ParallelTracker::visitRBend ( const RBend bend)
inlinevirtual

Apply the algorithm to a rectangular bend.

Reimplemented from DefaultVisitor.

Definition at line 339 of file ParallelTracker.h.

References Tracker::itsBunch_m, itsOpalBeamline_m, and OpalBeamline::visit().

Here is the call graph for this function:

◆ visitRFCavity()

void ParallelTracker::visitRFCavity ( const RFCavity as)
inlinevirtual

Apply the algorithm to an RF cavity.

Reimplemented from DefaultVisitor.

Definition at line 343 of file ParallelTracker.h.

References Tracker::itsBunch_m, itsOpalBeamline_m, and OpalBeamline::visit().

Here is the call graph for this function:

◆ visitRing()

void DefaultVisitor::visitRing ( const Ring ring)
overridevirtualinherited

Apply the algorithm to a Ring.

Implements BeamlineVisitor.

Definition at line 79 of file DefaultVisitor.cpp.

References DefaultVisitor::applyDefault().

Here is the call graph for this function:

◆ visitSBend()

void ParallelTracker::visitSBend ( const SBend bend)
inlinevirtual

Apply the algorithm to a sector bend.

Reimplemented from DefaultVisitor.

Definition at line 347 of file ParallelTracker.h.

References Tracker::itsBunch_m, itsOpalBeamline_m, and OpalBeamline::visit().

Here is the call graph for this function:

◆ visitScalingFFAMagnet()

void DefaultVisitor::visitScalingFFAMagnet ( const ScalingFFAMagnet spiral)
overridevirtualinherited

Apply the algorithm to a scaling FFA magnet.

Implements BeamlineVisitor.

Definition at line 89 of file DefaultVisitor.cpp.

References DefaultVisitor::applyDefault().

Here is the call graph for this function:

◆ visitSolenoid()

void ParallelTracker::visitSolenoid ( const Solenoid so)
inlinevirtual

Apply the algorithm to a solenoid.

Reimplemented from DefaultVisitor.

Definition at line 355 of file ParallelTracker.h.

References Tracker::itsBunch_m, itsOpalBeamline_m, and OpalBeamline::visit().

Here is the call graph for this function:

◆ visitTravelingWave()

void ParallelTracker::visitTravelingWave ( const TravelingWave tw)
inlinevirtual

Apply the algorithm to a traveling wave cavity.

Reimplemented from DefaultVisitor.

Definition at line 351 of file ParallelTracker.h.

References Tracker::itsBunch_m, itsOpalBeamline_m, and OpalBeamline::visit().

Here is the call graph for this function:

◆ visitVariableRFCavity()

void DefaultVisitor::visitVariableRFCavity ( const VariableRFCavity cavity)
overridevirtualinherited

Apply the algorithm to a variable RF cavity.

Implements BeamlineVisitor.

Definition at line 93 of file DefaultVisitor.cpp.

References DefaultVisitor::applyDefault().

Here is the call graph for this function:

◆ visitVerticalFFAMagnet()

void DefaultVisitor::visitVerticalFFAMagnet ( const VerticalFFAMagnet mag)
overridevirtualinherited

Apply the algorithm to a vertical FFA magnet.

Implements BeamlineVisitor.

Definition at line 91 of file DefaultVisitor.cpp.

References DefaultVisitor::applyDefault().

Here is the call graph for this function:

◆ writePhaseSpace()

void ParallelTracker::writePhaseSpace ( const long long  step,
bool  psDump,
bool  statDump 
)
private

Write phase space and/or statistics when flags request it.

Write phase space and/or statistics when flags request it.

Parameters
stepStep index (reserved for diagnostics; may be unused in body).
psDumpIf true, write phase-space snapshot when applicable.
statDumpIf true, write statistics (e.g. SDDS).

Definition at line 1533 of file ParallelTracker.cpp.

References DataSink::dumpH5(), DataSink::dumpSDDS(), PartBunch< T, Dim >::get_bounds(), PartBunch< T, Dim >::getdT(), OpalBeamline::getFieldAt(), PartBunch< T, Dim >::getT(), PartBunch< T, Dim >::getTotalNumAllContainers(), gmsg, Tracker::itsBunch_m, itsDataSink_m, itsOpalBeamline_m, and Units::Vpm2MVpm.

Referenced by dumpStats(), and execute().

Here is the call graph for this function:

Member Data Documentation

◆ back_beam

bool DefaultVisitor::back_beam
protectedinherited

◆ back_path

bool DefaultVisitor::back_path
protectedinherited

Definition at line 112 of file DefaultVisitor.h.

Referenced by DefaultVisitor::DefaultVisitor().

◆ back_track

bool DefaultVisitor::back_track
protectedinherited

◆ BinRepartTimer_m

IpplTimings::TimerRef ParallelTracker::BinRepartTimer_m
private

Definition at line 92 of file ParallelTracker.h.

◆ cavities_m

FieldList Tracker::cavities_m
inherited

Definition at line 113 of file Tracker.h.

◆ dtCurrentTrack_m

double ParallelTracker::dtCurrentTrack_m
private

Global \(\Delta t\) for the current track segment.

Definition at line 81 of file ParallelTracker.h.

Referenced by execute(), findStartPositions(), and selectDT().

◆ emittingSamplers_m

std::vector<std::vector<std::shared_ptr<SamplingBase> > > ParallelTracker::emittingSamplers_m
private

Per-container emitters.

Definition at line 84 of file ParallelTracker.h.

Referenced by activateEmittingContainers(), emitFromEmissionSources(), execute(), and selectDT().

◆ fieldEvaluationTimer_m

IpplTimings::TimerRef ParallelTracker::fieldEvaluationTimer_m
private

Definition at line 89 of file ParallelTracker.h.

Referenced by computeExternalFields().

◆ flip_B

double DefaultVisitor::flip_B
protectedinherited

Definition at line 115 of file DefaultVisitor.h.

Referenced by DefaultVisitor::DefaultVisitor().

◆ flip_s

double DefaultVisitor::flip_s
protectedinherited

Definition at line 116 of file DefaultVisitor.h.

Referenced by DefaultVisitor::DefaultVisitor().

◆ globalEOL_m

bool ParallelTracker::globalEOL_m
private

End-of-line flag (e.g. orbit threader out of bounds).

Definition at line 75 of file ParallelTracker.h.

Referenced by computeExternalFields(), execute(), hasEndOfLineReached(), and updateReferenceParticles().

◆ itsBeamline_m

const Beamline& Tracker::itsBeamline_m
inherited

Definition at line 115 of file Tracker.h.

Referenced by prepareSections().

◆ itsBunch_m

◆ itsDataSink_m

DataSink* ParallelTracker::itsDataSink_m
private

Borrowed beam statistics and phase-space output sink.

Definition at line 73 of file ParallelTracker.h.

Referenced by saveCavityPhases(), and writePhaseSpace().

◆ itsLine

const Beamline& DefaultVisitor::itsLine
protectedinherited

Definition at line 107 of file DefaultVisitor.h.

Referenced by DefaultVisitor::execute().

◆ itsOpalBeamline_m

◆ local_flip

bool DefaultVisitor::local_flip
privateinherited

◆ OrbThreader_m

IpplTimings::TimerRef ParallelTracker::OrbThreader_m
private

Definition at line 93 of file ParallelTracker.h.

Referenced by execute().

◆ PluginElemTimer_m

IpplTimings::TimerRef ParallelTracker::PluginElemTimer_m
private

Definition at line 91 of file ParallelTracker.h.

◆ repartFreq_m

unsigned long long ParallelTracker::repartFreq_m
private

Space-charge repartition period (steps); 0 disables it.

Definition at line 82 of file ParallelTracker.h.

Referenced by computeSpaceChargeFields(), and setOptionalVariables().

◆ stepSizes_m

StepSizeConfig ParallelTracker::stepSizes_m
private

Step-size segments: z-stop, dt, and steps per segment.

Definition at line 79 of file ParallelTracker.h.

Referenced by execute(), findStartPositions(), and ParallelTracker().

◆ timeIntegrationTimer1_m

IpplTimings::TimerRef ParallelTracker::timeIntegrationTimer1_m
private

Definition at line 87 of file ParallelTracker.h.

Referenced by timeIntegration1().

◆ timeIntegrationTimer2_m

IpplTimings::TimerRef ParallelTracker::timeIntegrationTimer2_m
private

Definition at line 88 of file ParallelTracker.h.

Referenced by timeIntegration2().

◆ WakeFieldTimer_m

IpplTimings::TimerRef ParallelTracker::WakeFieldTimer_m
private

Definition at line 90 of file ParallelTracker.h.

◆ zstart_m

double ParallelTracker::zstart_m
private

Path-length start position for the track (m).

Definition at line 76 of file ParallelTracker.h.

Referenced by execute(), and findStartPositions().


The documentation for this class was generated from the following files: