Skip to content

Commit

Permalink
Rename Wentzel model to CoulombScattering and add em/params subdi…
Browse files Browse the repository at this point in the history
…rectory (#1154)

* Rename Wentzel model classes to CoulombScattering

* Move em params to subdirectory

* Move MscParamsHelper to params/detail and fix namespace
  • Loading branch information
amandalund committed Mar 18, 2024
1 parent edc9be8 commit 7f3b53a
Show file tree
Hide file tree
Showing 42 changed files with 215 additions and 203 deletions.
2 changes: 1 addition & 1 deletion app/celer-sim/Runner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include "corecel/sys/ScopedProfiling.hh"
#include "celeritas/Types.hh"
#include "celeritas/Units.hh"
#include "celeritas/em/UrbanMscParams.hh"
#include "celeritas/em/params/UrbanMscParams.hh"
#include "celeritas/ext/GeantImporter.hh"
#include "celeritas/ext/GeantSetup.hh"
#include "celeritas/ext/RootFileManager.hh"
Expand Down
2 changes: 1 addition & 1 deletion src/accel/AlongStepFactory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "corecel/math/ArrayUtils.hh"
#include "corecel/math/QuantityIO.hh"
#include "geocel/g4/Convert.geant.hh"
#include "celeritas/em/UrbanMscParams.hh"
#include "celeritas/em/params/UrbanMscParams.hh"
#include "celeritas/ext/GeantUnits.hh"
#include "celeritas/field/RZMapFieldInput.hh"
#include "celeritas/field/UniformFieldData.hh"
Expand Down
12 changes: 6 additions & 6 deletions src/celeritas/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ set(PUBLIC_DEPS Celeritas::corecel Celeritas::geocel)

list(APPEND SOURCES
Types.cc
em/AtomicRelaxationParams.cc
em/FluctuationParams.cc
em/UrbanMscParams.cc
em/WentzelVIMscParams.cc
em/detail/MscParamsHelper.cc
em/detail/Utils.cc
em/params/AtomicRelaxationParams.cc
em/params/FluctuationParams.cc
em/params/UrbanMscParams.cc
em/params/WentzelVIMscParams.cc
em/params/detail/MscParamsHelper.cc
em/process/BremsstrahlungProcess.cc
em/process/ComptonProcess.cc
em/process/CoulombScatteringProcess.cc
Expand Down Expand Up @@ -247,7 +247,7 @@ celeritas_polysource(em/model/MuBremsstrahlungModel)
celeritas_polysource(em/model/RayleighModel)
celeritas_polysource(em/model/RelativisticBremModel)
celeritas_polysource(em/model/SeltzerBergerModel)
celeritas_polysource(em/model/WentzelModel)
celeritas_polysource(em/model/CoulombScatteringModel)
celeritas_polysource(geo/detail/BoundaryAction)
celeritas_polysource(global/alongstep/AlongStepGeneralLinearAction)
celeritas_polysource(global/alongstep/AlongStepNeutralAction)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// See the top-level COPYRIGHT file for details.
// SPDX-License-Identifier: (Apache-2.0 OR MIT)
//---------------------------------------------------------------------------//
//! \file celeritas/em/data/WentzelData.hh
//! \file celeritas/em/data/CoulombScatteringData.hh
//---------------------------------------------------------------------------//
#pragma once

Expand All @@ -17,9 +17,9 @@ namespace celeritas
{
//---------------------------------------------------------------------------//
/*!
* Particle and action ids used by WentzelModel.
* Particle and action ids used by CoulombScatteringModel.
*/
struct WentzelIds
struct CoulombScatteringIds
{
ActionId action;
ParticleId electron;
Expand All @@ -35,7 +35,7 @@ struct WentzelIds

//---------------------------------------------------------------------------//
/*!
* Per-element data used by the WentzelModel.
* Per-element data used by the CoulombScatteringModel.
*
* The matrix of coefficients used to approximate the ratio of the Mott to
* Rutherford cross sections was developed in
Expand All @@ -44,7 +44,7 @@ struct WentzelIds
* and
* M. J. Boschini et al. arXiv:1111.4042
*/
struct WentzelElementData
struct CoulombScatteringElementData
{
//!@{
//! \name Dimensions for Mott coefficient matrices
Expand Down Expand Up @@ -75,24 +75,24 @@ enum class NuclearFormFactorType

//---------------------------------------------------------------------------//
/*!
* Constant shared data used by the WentzelModel.
* Constant shared data used by the CoulombScatteringModel.
*/
template<Ownership W, MemSpace M>
struct WentzelData
struct CoulombScatteringData
{
template<class T>
using ElementItems = celeritas::Collection<T, W, M, ElementId>;
template<class T>
using IsotopeItems = celeritas::Collection<T, W, M, IsotopeId>;

// Ids
WentzelIds ids;
CoulombScatteringIds ids;

//! Constant prefactor for the squared momentum transfer [(MeV/c)^-2]
IsotopeItems<real_type> nuclear_form_prefactor;

// Per element form factors
ElementItems<WentzelElementData> elem_data;
ElementItems<CoulombScatteringElementData> elem_data;

// User-defined factor for the screening coefficient
real_type screening_factor;
Expand All @@ -106,9 +106,9 @@ struct WentzelData
return ids && !nuclear_form_prefactor.empty() && !elem_data.empty();
}

// Copy initialize from an existing WentzelData
// Copy initialize from an existing CoulombScatteringData
template<Ownership W2, MemSpace M2>
WentzelData& operator=(WentzelData<W2, M2> const& other)
CoulombScatteringData& operator=(CoulombScatteringData<W2, M2> const& other)
{
CELER_EXPECT(other);
ids = other.ids;
Expand All @@ -120,9 +120,9 @@ struct WentzelData
}
};

using WentzelDeviceRef = DeviceCRef<WentzelData>;
using WentzelHostRef = HostCRef<WentzelData>;
using WentzelRef = NativeCRef<WentzelData>;
using CoulombScatteringDeviceRef = DeviceCRef<CoulombScatteringData>;
using CoulombScatteringHostRef = HostCRef<CoulombScatteringData>;
using CoulombScatteringRef = NativeCRef<CoulombScatteringData>;

//---------------------------------------------------------------------------//
} // namespace celeritas
29 changes: 15 additions & 14 deletions src/celeritas/em/distribution/WentzelDistribution.hh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "corecel/Macros.hh"
#include "corecel/Types.hh"
#include "corecel/math/Algorithms.hh"
#include "celeritas/em/data/WentzelData.hh"
#include "celeritas/em/data/CoulombScatteringData.hh"
#include "celeritas/em/interactor/detail/PhysicsConstants.hh"
#include "celeritas/em/xs/MottRatioCalculator.hh"
#include "celeritas/em/xs/WentzelHelper.hh"
Expand All @@ -26,7 +26,7 @@ namespace celeritas
{
//---------------------------------------------------------------------------//
/*!
* Helper class for \c WentzelInteractor .
* Helper class for \c CoulombScatteringInteractor .
*
* Samples the polar scattering angle for the Wentzel Coulomb scattering model.
*
Expand All @@ -51,13 +51,13 @@ class WentzelDistribution
//!@}

public:
// Construct with state and date from WentzelInteractor
// Construct with state and model data
inline CELER_FUNCTION
WentzelDistribution(ParticleTrackView const& particle,
IsotopeView const& target,
WentzelElementData const& element_data,
CoulombScatteringElementData const& element_data,
Energy cutoff,
WentzelRef const& data);
CoulombScatteringRef const& data);

// Sample the polar scattering angle
template<class Engine>
Expand All @@ -66,8 +66,8 @@ class WentzelDistribution
private:
//// DATA ////

// Shared WentzelModel data
WentzelRef const& data_;
// Shared model data
CoulombScatteringRef const& data_;

// Incident particle
ParticleTrackView const& particle_;
Expand All @@ -76,7 +76,7 @@ class WentzelDistribution
IsotopeView const& target_;

// Mott coefficients for the target element
WentzelElementData const& element_data_;
CoulombScatteringElementData const& element_data_;

// Helper for calculating xs ratio and other quantities
WentzelHelper const helper_;
Expand Down Expand Up @@ -109,14 +109,15 @@ class WentzelDistribution
// INLINE DEFINITIONS
//---------------------------------------------------------------------------//
/*!
* Construct with state and data from WentzelInteractor.
* Construct with state and model data.
*/
CELER_FUNCTION
WentzelDistribution::WentzelDistribution(ParticleTrackView const& particle,
IsotopeView const& target,
WentzelElementData const& element_data,
Energy cutoff,
WentzelRef const& data)
WentzelDistribution::WentzelDistribution(
ParticleTrackView const& particle,
IsotopeView const& target,
CoulombScatteringElementData const& element_data,
Energy cutoff,
CoulombScatteringRef const& data)
: data_(data)
, particle_(particle)
, target_(target)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
// See the top-level COPYRIGHT file for details.
// SPDX-License-Identifier: (Apache-2.0 OR MIT)
//---------------------------------------------------------------------------//
//! \file celeritas/em/executor/WentzelExecutor.hh
//! \file celeritas/em/executor/CoulombScatteringExecutor.hh
//---------------------------------------------------------------------------//
#pragma once

#include "corecel/Assert.hh"
#include "corecel/Macros.hh"
#include "celeritas/em/data/WentzelData.hh"
#include "celeritas/em/interactor/WentzelInteractor.hh"
#include "celeritas/em/data/CoulombScatteringData.hh"
#include "celeritas/em/interactor/CoulombScatteringInteractor.hh"
#include "celeritas/global/CoreTrackView.hh"
#include "celeritas/mat/IsotopeSelector.hh"
#include "celeritas/mat/MaterialTrackView.hh"
Expand All @@ -22,19 +22,20 @@
namespace celeritas
{
//---------------------------------------------------------------------------//
struct WentzelExecutor
struct CoulombScatteringExecutor
{
inline CELER_FUNCTION Interaction
operator()(celeritas::CoreTrackView const& track);

WentzelRef params;
CoulombScatteringRef params;
};

//---------------------------------------------------------------------------//
/*!
* Sample Wentzel's model of elastic Coulomb scattering from the current track.
*/
CELER_FUNCTION Interaction WentzelExecutor::operator()(CoreTrackView const& track)
CELER_FUNCTION Interaction
CoulombScatteringExecutor::operator()(CoreTrackView const& track)
{
// Incident particle quantities
auto particle = track.make_particle_view();
Expand All @@ -54,7 +55,7 @@ CELER_FUNCTION Interaction WentzelExecutor::operator()(CoreTrackView const& trac
IsotopeView target = element.make_isotope_view(iso_select(rng));

// Construct the interactor
WentzelInteractor interact(
CoulombScatteringInteractor interact(
params, particle, dir, target, element_id, cutoffs);

// Execute the interactor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// See the top-level COPYRIGHT file for details.
// SPDX-License-Identifier: (Apache-2.0 OR MIT)
//---------------------------------------------------------------------------//
//! \file celeritas/em/interactor/WentzelInteractor.hh
//! \file celeritas/em/interactor/CoulombScatteringInteractor.hh
//---------------------------------------------------------------------------//
#pragma once

Expand All @@ -12,7 +12,7 @@
#include "celeritas/Constants.hh"
#include "celeritas/Quantities.hh"
#include "celeritas/Types.hh"
#include "celeritas/em/data/WentzelData.hh"
#include "celeritas/em/data/CoulombScatteringData.hh"
#include "celeritas/em/distribution/WentzelDistribution.hh"
#include "celeritas/mat/ElementView.hh"
#include "celeritas/mat/MaterialView.hh"
Expand All @@ -39,7 +39,7 @@ namespace celeritas
* G4eCoulombScatteringModel, as documented in section 8.2 of the Geant4
* Physics Reference Manual (release 11.1).
*/
class WentzelInteractor
class CoulombScatteringInteractor
{
public:
//!@{
Expand All @@ -51,12 +51,13 @@ class WentzelInteractor

public:
//! Construct with shared and state data
inline CELER_FUNCTION WentzelInteractor(WentzelRef const& shared,
ParticleTrackView const& particle,
Real3 const& inc_direction,
IsotopeView const& target,
ElementId const& el_id,
CutoffView const& cutoffs);
inline CELER_FUNCTION
CoulombScatteringInteractor(CoulombScatteringRef const& shared,
ParticleTrackView const& particle,
Real3 const& inc_direction,
IsotopeView const& target,
ElementId const& el_id,
CutoffView const& cutoffs);

//! Sample an interaction with the given RNG
template<class Engine>
Expand Down Expand Up @@ -90,12 +91,13 @@ class WentzelInteractor
* Construct from shared and state data.
*/
CELER_FUNCTION
WentzelInteractor::WentzelInteractor(WentzelRef const& shared,
ParticleTrackView const& particle,
Real3 const& inc_direction,
IsotopeView const& target,
ElementId const& el_id,
CutoffView const& cutoffs)
CoulombScatteringInteractor::CoulombScatteringInteractor(
CoulombScatteringRef const& shared,
ParticleTrackView const& particle,
Real3 const& inc_direction,
IsotopeView const& target,
ElementId const& el_id,
CutoffView const& cutoffs)
: inc_direction_(inc_direction)
, particle_(particle)
, target_(target)
Expand All @@ -117,7 +119,7 @@ WentzelInteractor::WentzelInteractor(WentzelRef const& shared,
* Sample the Coulomb scattering of the incident particle.
*/
template<class Engine>
CELER_FUNCTION Interaction WentzelInteractor::operator()(Engine& rng)
CELER_FUNCTION Interaction CoulombScatteringInteractor::operator()(Engine& rng)
{
// Incident particle scatters
Interaction result;
Expand Down Expand Up @@ -147,7 +149,7 @@ CELER_FUNCTION Interaction WentzelInteractor::operator()(Engine& rng)
* by WentzelDistribution.
*/
CELER_FUNCTION real_type
WentzelInteractor::calc_recoil_energy(real_type cos_theta) const
CoulombScatteringInteractor::calc_recoil_energy(real_type cos_theta) const
{
real_type one_minus_cos_theta = 1 - cos_theta;
return value_as<MomentumSq>(particle_.momentum_sq()) * one_minus_cos_theta
Expand Down

0 comments on commit 7f3b53a

Please sign in to comment.