Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-15 08:54:44

0001 //------------------------------- -*- C++ -*- -------------------------------//
0002 // Copyright Celeritas contributors: see top-level COPYRIGHT file for details
0003 // SPDX-License-Identifier: (Apache-2.0 OR MIT)
0004 //---------------------------------------------------------------------------//
0005 //! \file celeritas/inp/Field.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include <variant>
0010 #include <vector>
0011 
0012 #include "geocel/Types.hh"
0013 #include "celeritas/UnitTypes.hh"
0014 #include "celeritas/field/CartMapFieldInput.hh"
0015 #include "celeritas/field/CylMapFieldInput.hh"
0016 #include "celeritas/field/FieldDriverOptions.hh"
0017 #include "celeritas/field/RZMapFieldInput.hh"
0018 
0019 namespace celeritas
0020 {
0021 namespace inp
0022 {
0023 //---------------------------------------------------------------------------//
0024 /*!
0025  * Build a problem without magnetic fields.
0026  */
0027 struct NoField
0028 {
0029 };
0030 
0031 //---------------------------------------------------------------------------//
0032 /*!
0033  * Create a uniform nonzero field.
0034  *
0035  * If volumes are specified, the field will only be present in those volumes.
0036  *
0037  * \todo Field driver options will be separate from the magnetic field. They,
0038  * plus the field type, will be specified in a FieldParams that maps
0039  * region/particle/energy to field setup. NOTE ALSO that \c
0040  * driver_options.max_substeps is redundant with \c
0041  * p.tracking.limits.field_substeps .
0042  */
0043 struct UniformField
0044 {
0045     //! Default field units are tesla
0046     UnitSystem units{UnitSystem::si};
0047 
0048     //! Field strength
0049     Real3 strength{0, 0, 0};
0050 
0051     //! Field driver options
0052     FieldDriverOptions driver_options;
0053 
0054     //! Volumes where the field is present (optional)
0055     std::vector<VolumeId> volumes;
0056 };
0057 
0058 //---------------------------------------------------------------------------//
0059 /*!
0060  * Build a separable R-Z magnetic field from a file.
0061  *
0062  * \todo v0.7 Move field input here
0063  */
0064 using RZMapField = ::celeritas::RZMapFieldInput;
0065 using CylMapField = ::celeritas::CylMapFieldInput;
0066 using CartMapField = ::celeritas::CartMapFieldInput;
0067 
0068 //---------------------------------------------------------------------------//
0069 //! Field type
0070 using Field
0071     = std::variant<NoField, UniformField, RZMapField, CylMapField, CartMapField>;
0072 
0073 //---------------------------------------------------------------------------//
0074 }  // namespace inp
0075 }  // namespace celeritas