Skip to content

Commit

Permalink
Merge branch 'develop' into googletest-xml-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sethrj authored Sep 27, 2024
2 parents abcace3 + 7bbf401 commit 61e985c
Show file tree
Hide file tree
Showing 37 changed files with 1,406 additions and 588 deletions.
2 changes: 1 addition & 1 deletion doc/implementation/core-physics/stepping.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ stepping loop: :cpp:class:`CoreBeginRunActionInterface` is called once per event
is called once per step, ordered using :cpp:enum:`celeritas::StepActionOrder`.

.. doxygenclass:: celeritas::ActionInterface
.. doxygenclass:: celeritas::CoreBeginRunActionInterface
.. doxygentypedef:: celeritas::CoreBeginRunActionInterface
.. doxygenclass:: celeritas::StepActionInterface

.. doxygenenum:: celeritas::StepActionOrder
Expand Down
32 changes: 21 additions & 11 deletions doc/implementation/em-physics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,19 @@ The following table summarizes the EM processes and models in Celeritas.
| +---------------------+-----------------------------+-----------------------------------------------------+--------------------------+
| | Rayleigh scattering | Livermore | :cpp:class:`celeritas::RayleighInteractor` | 0--100 TeV |
+----------------+---------------------+-----------------------------+-----------------------------------------------------+--------------------------+
| :math:`\mu^-` | Ionization | ICRU73QO | :cpp:class:`celeritas::BraggICRU73QOInteractor` | 0--200 keV |
| :math:`\mu^-` | Ionization | ICRU73QO | :cpp:class:`celeritas::MuHadIonizationInteractor` | 0--200 keV |
| + +-----------------------------+-----------------------------------------------------+--------------------------+
| | | Bethe--Bloch | :cpp:class:`celeritas::MuBetheBlochInteractor` | 200 keV--100 TeV |
| | | Bethe--Bloch | :cpp:class:`celeritas::MuHadIonizationInteractor` | 200 keV--1 GeV |
| + +-----------------------------+-----------------------------------------------------+--------------------------+
| | | Mu Bethe--Bloch | :cpp:class:`celeritas::MuHadIonizationInteractor` | 200 keV--100 TeV |
| +---------------------+-----------------------------+-----------------------------------------------------+--------------------------+
| | Bremsstrahlung | Mu bremsstrahlung | :cpp:class:`celeritas::MuBremsstrahlungInteractor` | 0--100 TeV |
+----------------+---------------------+-----------------------------+-----------------------------------------------------+--------------------------+
| :math:`\mu^+` | Ionization | Bragg | :cpp:class:`celeritas::BraggICRU73QOInteractor` | 0--200 keV |
| :math:`\mu^+` | Ionization | Bragg | :cpp:class:`celeritas::MuHadIonizationInteractor` | 0--200 keV |
| + +-----------------------------+-----------------------------------------------------+--------------------------+
| | | Bethe--Bloch | :cpp:class:`celeritas::MuHadIonizationInteractor` | 200 keV--1 GeV |
| + +-----------------------------+-----------------------------------------------------+--------------------------+
| | | Bethe--Bloch | :cpp:class:`celeritas::MuBetheBlochInteractor` | 200 keV--100 TeV |
| | | Mu Bethe--Bloch | :cpp:class:`celeritas::MuHadIonizationInteractor` | 200 keV--100 TeV |
| +---------------------+-----------------------------+-----------------------------------------------------+--------------------------+
| | Bremsstrahlung | Mu bremsstrahlung | :cpp:class:`celeritas::MuBremsstrahlungInteractor` | 0--100 TeV |
+----------------+---------------------+-----------------------------+-----------------------------------------------------+--------------------------+
Expand Down Expand Up @@ -109,15 +113,19 @@ The following table summarizes the EM processes and models in Celeritas.
\cline{2-5}
& Rayleigh scattering & Livermore & \texttt{\scriptsize celeritas::RayleighInteractor} & 0--100 TeV \\
\hline
\multirow{3}{*}{$\mu^-$} & \multirow{2}{*}{Ionization} & ICRU73QO & \texttt{\scriptsize celeritas::BraggICRU73QOInteractor} & 0--200 keV \\
\multirow{3}{*}{$\mu^-$} & \multirow{2}{*}{Ionization} & ICRU73QO & \texttt{\scriptsize celeritas::MuHadIonizationInteractor} & 0--200 keV \\
\cline{3-5}
& & Bethe--Bloch & \texttt{\scriptsize celeritas::MuBetheBlochInteractor} & 200 keV -- 100 TeV \\
& & Bethe--Bloch & \texttt{\scriptsize celeritas::MuHadIonizationInteractor} & 200 keV -- 1 GeV \\
\cline{3-5}
& & Mu Bethe--Bloch & \texttt{\scriptsize celeritas::MuHadIonizationInteractor} & 200 keV -- 100 TeV \\
\cline{2-5}
& Bremsstrahlung & Mu bremsstrahlung & \texttt{\scriptsize celeritas::MuBremsstrahlungInteractor} & 0--100 TeV \\
\hline
\multirow{3}{*}{$\mu^+$} & \multirow{2}{*}{Ionization} & Bragg & \texttt{\scriptsize celeritas::BraggICRU73QOInteractor} & 0--200 keV \\
\multirow{3}{*}{$\mu^+$} & \multirow{2}{*}{Ionization} & Bragg & \texttt{\scriptsize celeritas::MuHadIonizationInteractor} & 0--200 keV \\
\cline{3-5}
& & Bethe--Bloch & \texttt{\scriptsize celeritas::MuHadIonizationInteractor} & 200 keV -- 1 GeV \\
\cline{3-5}
& & Bethe--Bloch & \texttt{\scriptsize celeritas::MuBetheBlochInteractor} & 200 keV -- 100 TeV \\
& & Mu Bethe--Bloch & \texttt{\scriptsize celeritas::MuHadIonizationInteractor} & 200 keV -- 100 TeV \\
\cline{2-5}
& Bremsstrahlung & Mu bremsstrahlung & \texttt{\scriptsize celeritas::MuBremsstrahlungInteractor} & 0--100 TeV \\
\hline
Expand Down Expand Up @@ -154,13 +162,14 @@ as properties of any secondary particles produced.
Ionization
----------

.. doxygenclass:: celeritas::BraggICRU73QOInteractor
.. doxygenclass:: celeritas::MollerBhabhaInteractor
.. doxygenclass:: celeritas::MuBetheBlochInteractor
.. doxygenclass:: celeritas::MuHadIonizationInteractor

The exiting energy distribution from most of these ionization models
are sampled using external helper distributions.

.. doxygenclass:: celeritas::BetheBlochEnergyDistribution
.. doxygenclass:: celeritas::BraggICRU73QOEnergyDistribution
.. doxygenclass:: celeritas::BhabhaEnergyDistribution
.. doxygenclass:: celeritas::MollerEnergyDistribution
.. doxygenclass:: celeritas::MuBBEnergyDistribution
Expand Down Expand Up @@ -280,4 +289,5 @@ to provide cross sections, setup options, and other data to the EM physics.
.. doxygenstruct:: celeritas::ImportLivermoreSubshell
.. doxygenstruct:: celeritas::ImportLivermorePE

.. doxygenstruct:: celeritas::ImportSBTable
.. doxygenstruct:: celeritas::ImportMuPairProductionTable
.. doxygentypedef:: celeritas::ImportSBTable
1 change: 1 addition & 0 deletions src/celeritas/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ macro(celeritas_polysource filename_we)
endmacro()

celeritas_polysource(em/model/BetheHeitlerModel)
celeritas_polysource(em/model/BetheBlochModel)
celeritas_polysource(em/model/BraggModel)
celeritas_polysource(em/model/CombinedBremModel)
celeritas_polysource(em/model/EPlusGGModel)
Expand Down
47 changes: 0 additions & 47 deletions src/celeritas/em/data/BraggICRU73QOData.hh

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
// See the top-level COPYRIGHT file for details.
// SPDX-License-Identifier: (Apache-2.0 OR MIT)
//---------------------------------------------------------------------------//
//! \file celeritas/em/data/MuBetheBlochData.hh
//! \file celeritas/em/data/MuHadIonizationData.hh
//---------------------------------------------------------------------------//
#pragma once

#include "corecel/Macros.hh"
#include "corecel/Types.hh"
#include "celeritas/Quantities.hh"
#include "celeritas/Types.hh"
Expand All @@ -16,23 +15,22 @@ namespace celeritas
{
//---------------------------------------------------------------------------//
/*!
* Device data for creating an interactor.
* Data for muon and hadron ionization.
*
* This data is used for the Bragg, ICRU73QO, Bethe-Bloch, and muon Bethe-Bloch
* models and can be reused for different incident particle types.
*/
struct MuBetheBlochData
struct MuHadIonizationData
{
//! Particle IDs
//! Secondary particle ID
ParticleId electron;
ParticleId mu_minus;
ParticleId mu_plus;

//! Electron mass [MeV / c^2]
units::MevMass electron_mass;

//! Whether all data are assigned and valid
explicit CELER_FUNCTION operator bool() const
{
return electron && mu_minus && mu_plus
&& electron_mass > zero_quantity();
return electron && electron_mass > zero_quantity();
}
};

Expand Down
132 changes: 132 additions & 0 deletions src/celeritas/em/distribution/BetheBlochEnergyDistribution.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
//----------------------------------*-C++-*----------------------------------//
// Copyright 2024 UT-Battelle, LLC, and other Celeritas developers.
// See the top-level COPYRIGHT file for details.
// SPDX-License-Identifier: (Apache-2.0 OR MIT)
//---------------------------------------------------------------------------//
//! \file celeritas/em/distribution/BetheBlochEnergyDistribution.hh
//---------------------------------------------------------------------------//
#pragma once

#include <cmath>

#include "corecel/Macros.hh"
#include "corecel/Types.hh"
#include "corecel/math/Algorithms.hh"
#include "celeritas/Constants.hh"
#include "celeritas/Quantities.hh"
#include "celeritas/phys/ParticleTrackView.hh"
#include "celeritas/random/distribution/InverseSquareDistribution.hh"
#include "celeritas/random/distribution/RejectionSampler.hh"

#include "detail/Utils.hh"

namespace celeritas
{
//---------------------------------------------------------------------------//
/*!
* Sample the energy of the delta ray for muon or hadron ionization.
*
* This samples the energy according to the Bethe-Bloch model, as described in
* the Geant4 Physics Reference Manual release 11.2 section 12.1.5. The
* Bethe-Bloch differential cross section can be written as
* \f[
\difd{\sigma}{T} = 2\pi r_e^2 mc^2 Z \frac{z_p^2}{\beta^2}\frac{1}{T^2}
\left[1 - \beta^2 \frac{T}{T_{max}} + s \frac{T^2}{2E^2} \right]
* \f]
* and factorized as
* \f[
\difd{\sigma}{T} = C f(T) g(T)
* \f]
* with \f$ T \in [T_{cut}, T_{max}] \f$, where \f$ f(T) = \frac{1}{T^2} \f$,
* \f$ g(T) = 1 - \beta^2 \frac{T}{T_max} + s \frac{T^2}{2 E^2} \f$, \f$ T \f$
* is the kinetic energy of the electron, \f$ E \f$ is the total energy of the
* incident particle, and \f$ s \f$ is 0 for spinless particles and 1
* otherwise. The energy is sampled from \f$ f(T) \f$ and accepted with
* probability \f$ g(T) \f$.
*/
class BetheBlochEnergyDistribution
{
public:
//!@{
//! \name Type aliases
using Energy = units::MevEnergy;
using Mass = units::MevMass;
//!@}

public:
// Construct with incident and exiting particle data
inline CELER_FUNCTION
BetheBlochEnergyDistribution(ParticleTrackView const& particle,
Energy electron_cutoff,
Mass electron_mass);

// Sample the exiting energy
template<class Engine>
inline CELER_FUNCTION Energy operator()(Engine& rng);

//! Minimum energy of the secondary electron [MeV].
CELER_FUNCTION Energy min_secondary_energy() const { return min_energy_; }

//! Maximum energy of the secondary electron [MeV].
CELER_FUNCTION Energy max_secondary_energy() const { return max_energy_; }

private:
// Incident partcle mass
real_type inc_mass_;
// Square of fractional speed of light for incident particle
real_type beta_sq_;
// Minimum energy of the secondary electron [MeV]
Energy min_energy_;
// Maximum energy of the secondary electron [MeV]
Energy max_energy_;
};

//---------------------------------------------------------------------------//
// INLINE DEFINITIONS
//---------------------------------------------------------------------------//
/*!
* Construct with incident and exiting particle data.
*/
CELER_FUNCTION
BetheBlochEnergyDistribution::BetheBlochEnergyDistribution(
ParticleTrackView const& particle,
Energy electron_cutoff,
Mass electron_mass)
: inc_mass_(value_as<Mass>(particle.mass()))
, beta_sq_(particle.beta_sq())
, min_energy_(electron_cutoff)
, max_energy_(detail::calc_max_secondary_energy(particle, electron_mass))
{
}

//---------------------------------------------------------------------------//
/*!
* Sample secondary electron energy.
*/
template<class Engine>
CELER_FUNCTION auto BetheBlochEnergyDistribution::operator()(Engine& rng)
-> Energy
{
InverseSquareDistribution sample_energy(value_as<Energy>(min_energy_),
value_as<Energy>(max_energy_));
real_type energy;
do
{
// Sample 1/E^2 from Emin to Emax
energy = sample_energy(rng);
/*!
* \todo Adjust rejection functions if particle has positive spin
*/
} while (RejectionSampler<>(
1 - (beta_sq_ / value_as<Energy>(max_energy_)) * energy)(rng));

/*!
* \todo For hadrons, suppress high energy delta ray production with the
* projectile form factor
*/

return Energy{energy};
}

//---------------------------------------------------------------------------//
} // namespace celeritas
Loading

0 comments on commit 61e985c

Please sign in to comment.