Celeritas  0.5.0-56+6b053cd
Classes | Public Member Functions | List of all members
celeritas::FieldDriver< StepperT > Class Template Reference

Advance the field state by a single substep based on user tolerances. More...

#include <FieldDriver.hh>

Public Member Functions

CELER_FUNCTION FieldDriver (FieldDriverOptions const &options, StepperT &&perform_step)
 Construct with options and the step advancement functor.
 
CELER_FUNCTION DriverResult advance (real_type step, OdeState const &state)
 Adaptive step control based on G4ChordFinder and G4MagIntegratorDriver. More...
 
CELER_FUNCTION DriverResult accurate_advance (real_type step, OdeState const &state, real_type hinitial) const
 Accurate advance for an adaptive step control. More...
 
CELER_FUNCTION short int max_substeps () const
 
CELER_FUNCTION real_type minimum_step () const
 
CELER_FUNCTION real_type delta_intersection () const
 

Detailed Description

template<class StepperT>
class celeritas::FieldDriver< StepperT >

Advance the field state by a single substep based on user tolerances.

The substep length is based on the radius of curvature for the step, ensuring that the "miss distance" (sagitta, the distance between the straight-line arc and the furthest point) is less than the delta_chord option. This target length is reduced into sub-substeps if necessary to meet a targeted relative error epsilon_rel_max based on the position and momentum update.

This iteratively reduces the given step length until the sagitta is no more than delta_chord . The sagitta is calculated as the projection of the mid-step point onto the line between the start and end-step points.

Each iteration reduces the step length by a factor of no more than min_chord_shrink , but is based on an approximate "exact" correction factor if the chord length is very small and the curve is circular. The sagitta h is related to the chord length s and radius of curvature r with the trig expression:

\[ r - h = r \cos \frac{s}{2r} \]

For small chord lengths or a large radius, we expand \( \cos \theta \sim 1 \frac{\theta^2}{2} \), giving a radius of curvature

\[ r = \frac{s^2}{8h} \; . \]

Given a trial step (chord length) s and resulting sagitta of h, the exact step needed to give a chord length of \( \epsilon = {} \) delta_chord is

\[ s' = s \sqrt{\frac{\epsilon}{h}} \,. \]

Note
This class is based on G4ChordFinder and G4MagIntegratorDriver.

Member Function Documentation

◆ accurate_advance()

template<class StepperT >
CELER_FUNCTION DriverResult celeritas::FieldDriver< StepperT >::accurate_advance ( real_type  step,
OdeState const &  state,
real_type  hinitial 
) const
inline

Accurate advance for an adaptive step control.

Perform an adaptive step integration for a proposed step or a series of sub-steps within a required tolerance until the the accumulated curved path is equal to the input step length.

◆ advance()

template<class StepperT >
CELER_FUNCTION DriverResult celeritas::FieldDriver< StepperT >::advance ( real_type  step,
OdeState const &  state 
)
inline

Adaptive step control based on G4ChordFinder and G4MagIntegratorDriver.

Parameters
stepmaximum step length
statestarting state
Returns
substep and updated state

For a given trial step, advance by a sub-step within a required tolerance and update the current state (position and momentum). For an efficient adaptive integration, the proposed chord of which the sagitta (the closest distance from the curved trajectory to the chord) is smaller than a reference distance (dist_chord) will be accepted if its stepping error is within a reference accuracy. Otherwise, the more accurate step integration (advance_accurate) will be performed.


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