Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <random>
7 : #include <vector>
8 :
9 : #include "DataStructures/DataBox/Tag.hpp"
10 : #include "DataStructures/Tensor/TypeAliases.hpp"
11 : #include "Evolution/Particles/MonteCarlo/MonteCarloOptions.hpp"
12 : #include "Evolution/Particles/MonteCarlo/NeutrinoInteractionTable.hpp"
13 : #include "Evolution/Particles/MonteCarlo/Packet.hpp"
14 :
15 : /// Items related to the evolution of particles
16 : /// Items related to Monte-Carlo radiation transport
17 : /// Tags for MC
18 : namespace Particles::MonteCarlo::Tags {
19 :
20 : /// Simple tag containing the vector of Monte-Carlo
21 : /// packets belonging to an element.
22 1 : struct PacketsOnElement : db::SimpleTag {
23 0 : using type = std::vector<Particles::MonteCarlo::Packet>;
24 : };
25 :
26 : /// Simple tag containing an approximation of the light
27 : /// crossing time for each cell (the shortest time among
28 : /// all coordinate axis directions).
29 : template <typename DataType>
30 1 : struct CellLightCrossingTime : db::SimpleTag {
31 0 : using type = Scalar<DataType>;
32 : };
33 :
34 : /// Simple tag storing the coupling term between
35 : /// MC and tilde_Tau (i.e. the energy variable)
36 : template <typename DataType>
37 1 : struct CouplingTildeTau : db::SimpleTag {
38 0 : using type = Scalar<DataType>;
39 : };
40 :
41 : /// Simple tag storing the coupling term between
42 : /// MC and tilde_RhoYe (i.e. the composition variable)
43 : template <typename DataType>
44 1 : struct CouplingTildeRhoYe : db::SimpleTag {
45 0 : using type = Scalar<DataType>;
46 : };
47 :
48 : /// Simple tag storing the coupling term between
49 : /// MC and tilde_S (i.e. the momentum variable)
50 : template <typename DataType, size_t Dim>
51 1 : struct CouplingTildeS : db::SimpleTag {
52 0 : using type = tnsr::i<DataType, Dim, Frame::Inertial>;
53 : };
54 :
55 : /// Simple tag storing the random number generator
56 : /// used by Monte-Carlo
57 1 : struct RandomNumberGenerator : db::SimpleTag {
58 0 : using type = std::mt19937;
59 : };
60 :
61 : /// Simple tag containing the desired energy of
62 : /// packets in low-density regions. The energy
63 : /// can be different for each neutrino species.
64 : template <size_t NeutrinoSpecies>
65 1 : struct DesiredPacketEnergyAtEmission : db::SimpleTag {
66 0 : using type = std::array<DataVector, NeutrinoSpecies>;
67 : };
68 :
69 : /// Simple tag for the table of neutrino-matter interaction
70 : /// rates (emission, absorption and scattering for each
71 : /// energy bin and neutrino species).
72 : template <size_t EnergyBins, size_t NeutrinoSpecies>
73 1 : struct InteractionRatesTable : db::SimpleTag {
74 0 : using type =
75 : std::unique_ptr<NeutrinoInteractionTable<EnergyBins, NeutrinoSpecies>>;
76 0 : static constexpr bool pass_metavariables = false;
77 0 : using option_tags =
78 : typename NeutrinoInteractionTable<EnergyBins, NeutrinoSpecies>::options;
79 0 : static type create_from_options(const std::string filename) {
80 : std::unique_ptr<Particles::MonteCarlo::NeutrinoInteractionTable<
81 : EnergyBins, NeutrinoSpecies>>
82 : interaction_table_ptr =
83 : std::make_unique<Particles::MonteCarlo::NeutrinoInteractionTable<
84 : EnergyBins, NeutrinoSpecies>>(filename);
85 : return interaction_table_ptr;
86 : ;
87 : }
88 : };
89 :
90 : template <size_t NeutrinoSpecies>
91 0 : struct MonteCarloOptions : db::SimpleTag {
92 0 : using type = std::unique_ptr<
93 : Particles::MonteCarlo::MonteCarloOptions<NeutrinoSpecies>>;
94 0 : static constexpr bool pass_metavariables = false;
95 0 : using option_tags = typename Particles::MonteCarlo::MonteCarloOptions<
96 : NeutrinoSpecies>::options;
97 0 : static type create_from_options(
98 : const std::array<double, NeutrinoSpecies> initial_packet_energy) {
99 : std::unique_ptr<Particles::MonteCarlo::MonteCarloOptions<NeutrinoSpecies>>
100 : mc_options_ptr = std::make_unique<
101 : Particles::MonteCarlo::MonteCarloOptions<NeutrinoSpecies>>(
102 : initial_packet_energy);
103 : return mc_options_ptr;
104 : ;
105 : }
106 : };
107 :
108 : } // namespace Particles::MonteCarlo::Tags
|