Celeritas 0.6.0-47+develop.b3cbb238
Loading...
Searching...
No Matches
Functions
PhysicsStepUtils.hh File Reference

Helper functions for physics step processing. More...

#include "corecel/Assert.hh"
#include "corecel/Types.hh"
#include "corecel/cont/Range.hh"
#include "corecel/math/Algorithms.hh"
#include "corecel/math/NumericLimits.hh"
#include "corecel/random/distribution/GenerateCanonical.hh"
#include "corecel/random/distribution/Selector.hh"
#include "celeritas/Types.hh"
#include "celeritas/grid/EnergyLossCalculator.hh"
#include "celeritas/grid/InverseRangeCalculator.hh"
#include "celeritas/grid/RangeCalculator.hh"
#include "celeritas/grid/SplineCalculator.hh"
#include "celeritas/grid/XsCalculator.hh"
#include "celeritas/mat/MaterialTrackView.hh"
#include "ParticleTrackView.hh"
#include "PhysicsStepView.hh"
#include "PhysicsTrackView.hh"

Functions

template<class Engine >
CELER_FUNCTION ParticleProcessId celeritas::find_ppid (MaterialView const &material, ParticleTrackView const &particle, PhysicsTrackView const &physics, PhysicsStepView &pstep, Engine &rng)
 Sample the process for the discrete interaction.
 
CELER_FUNCTION StepLimit celeritas::calc_physics_step_limit (MaterialTrackView const &material, ParticleTrackView const &particle, PhysicsTrackView &physics, PhysicsStepView &pstep)
 Calculate physics step limits based on cross sections and range limiters.
 
CELER_FUNCTION ParticleTrackView::Energy celeritas::calc_mean_energy_loss (ParticleTrackView const &particle, PhysicsTrackView const &physics, real_type step)
 Calculate mean energy loss over the given "true" step length.
 
template<class Engine >
CELER_FUNCTION ActionId celeritas::select_discrete_interaction (MaterialView const &material, ParticleTrackView const &particle, PhysicsTrackView const &physics, PhysicsStepView &pstep, Engine &rng)
 Choose the physics model for a track's pending interaction.
 

Detailed Description

Helper functions for physics step processing.

Function Documentation

◆ calc_mean_energy_loss()

CELER_FUNCTION ParticleTrackView::Energy celeritas::calc_mean_energy_loss ( ParticleTrackView const particle,
PhysicsTrackView const physics,
real_type  step 
)
inline

Calculate mean energy loss over the given "true" step length.

Stopping power is an integral over low-exiting-energy secondaries. Above some threshold energy T_c we treat exiting secondaries discretely; below it, we lump them into this continuous loss term that varies based on the energy, the atomic number density, and the element number:

\[ \difd{E}{x} = N_Z \int_0^{T_c} \frac{d \sigma_Z(E, T)}{dT} T \dif T \]

Here, the cross section is a function of the primary's energy E and the exiting secondary energy T.

The stopping range R due to these low-energy processes is an integral over the inverse of the stopping power: basically the distance that will take a particle (without discrete processes at play) from its current energy to an energy of zero.

\[ R = \int_0 ^{E_0} - \difd{E}{x} \dif E . \]

Note
The inverse range correction assumes range is always the integral of the stopping power/energy loss.
Todo:
The GEANT3 manual [geant3-1993] makes the point that linear interpolation of energy loss rate results in a piecewise constant energy deposition curve, which is why they use spline interpolation. Investigate higher-order reconstruction of energy loss curve, e.g. through spline-based interpolation or log-log interpolation.
Note
See section 7.2.4 Run Time Energy Loss Computation of the Geant4 physics manual [g4prm]. See also the longer discussions in section 8 of PHYS010 of the Geant3 manual.

Zero energy loss can occur in the following cases:

  • The energy loss value at the given energy is zero (e.g. high energy particles)
  • The Urban model is selected and samples zero collisions (possible in thin materials and/or small steps)

◆ calc_physics_step_limit()

CELER_FUNCTION StepLimit celeritas::calc_physics_step_limit ( MaterialTrackView const material,
ParticleTrackView const particle,
PhysicsTrackView physics,
PhysicsStepView pstep 
)
inline

Calculate physics step limits based on cross sections and range limiters.

Processes with integral cross section rejection calculate an estimated "maximum" over the step: see PhysicsTrackView.calc_max_xs .

Todo:
For particles with decay, macro XS calculation will incorporate decay probability, dividing decay constant by speed to become 1/len to compete with interactions.
Todo:
For neutral particles that haven't changed material since the last step, we can reuse the previously calculated cross section (but may not want to if it's expensive).

◆ find_ppid()

template<class Engine >
CELER_FUNCTION ParticleProcessId celeritas::find_ppid ( MaterialView const material,
ParticleTrackView const particle,
PhysicsTrackView const physics,
PhysicsStepView pstep,
Engine rng 
)
inline

Sample the process for the discrete interaction.

  • If the particle is at rest and has an at-rest process, that is returned.
  • Sample a process by selecting from probabilities proportional to the cross sections calculated at the beginning of the step.
  • If the particle has changed energy over the step by continuous energy loss, and the process supports integral cross section rejection, then the cross section is recalculated with the new energy. The collision is sampled based by rejection sampling with the updated cross section.

    Todo:
    Support competing at-rest processes?
Returns
Sampled process, or null if integral xs rejection cancels interaction

◆ select_discrete_interaction()

template<class Engine >
CELER_FUNCTION ActionId celeritas::select_discrete_interaction ( MaterialView const material,
ParticleTrackView const particle,
PhysicsTrackView const physics,
PhysicsStepView pstep,
Engine rng 
)

Choose the physics model for a track's pending interaction.

  • Sample from the previously calculated per-process cross section/decay to determine the interacting process ID.
  • From the process ID and (post-slowing-down) particle energy, we obtain the applicable model ID.
  • For energy loss (continuous-discrete) processes, the post-step energy will be different from the pre-step energy, so the assumption that the cross section is constant along the step is no longer valid. Use the "integral approach" to sample the discrete interaction from the correct probability distribution (section 7.4 of the Geant4 Physics Reference release 10.6).