Line data Source code
1 0 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : #pragma once 5 : 6 : #include <vector> 7 : 8 : #include "DataStructures/DataVector.hpp" 9 : #include "DataStructures/Tensor/Tensor.hpp" 10 : #include "Utilities/Gsl.hpp" 11 : 12 : /// Items related to the evolution of particles 13 : /// Items related to Monte-Carlo radiation transport 14 : namespace Particles::MonteCarlo { 15 : 16 : /// Struct representing a single Monte Carlo packet of neutrinos 17 1 : struct Packet { 18 : /// Constructor 19 1 : Packet(const size_t& species_, 20 : const double& number_of_neutrinos_, 21 : const size_t& index_of_closest_grid_point_, const double& time_, 22 : const double& coord_x_, const double& coord_y_, const double& coord_z_, 23 : const double& p_upper_t_, const double& p_x_, const double& p_y_, 24 : const double& p_z_) 25 : : species(species_), 26 : number_of_neutrinos(number_of_neutrinos_), 27 : index_of_closest_grid_point(index_of_closest_grid_point_), 28 : time(time_), 29 : momentum_upper_t(p_upper_t_) { 30 : coordinates[0] = coord_x_; 31 : coordinates[1] = coord_y_; 32 : coordinates[2] = coord_z_; 33 : momentum[0] = p_x_; 34 : momentum[1] = p_y_; 35 : momentum[2] = p_z_; 36 : } 37 : 38 : /// Species of neutrinos (in the code, just an index used to access the 39 : /// right interaction rates; typically \f$0=\nu_e, 1=\nu_a, 2=\nu_x\f$) 40 1 : size_t species; 41 : 42 : /// Number of neutrinos represented by current packet 43 : /// Note that this number is rescaled so that 44 : /// `Energy_of_packet = N * Energy_of_neutrinos` 45 : /// with the packet energy in G=Msun=c=1 units but 46 : /// the neutrino energy in MeV! 47 1 : double number_of_neutrinos; 48 : 49 : /// Index of the closest point on the FD grid. 50 1 : size_t index_of_closest_grid_point; 51 : 52 : /// Current time 53 1 : double time; 54 : 55 : /// Stores \f$p^t\f$ 56 1 : double momentum_upper_t; 57 : 58 : /// Coordinates of the packet, in element logical coordinates 59 1 : tnsr::I<double, 3, Frame::ElementLogical> coordinates; 60 : 61 : /// Spatial components of the 4-momentum \f$p_i\f$, in Inertial coordinates 62 1 : tnsr::i<double, 3, Frame::Inertial> momentum; 63 : 64 : /*! 65 : * Recalculte \f$p^t\f$ using the fact that the 4-momentum is a null vector 66 : * \f{align}{ 67 : * p^t = \sqrt{\gamma^{ij} p_i p_j}/\alpha 68 : * \f} 69 : */ 70 1 : void renormalize_momentum( 71 : const tnsr::II<DataVector, 3, Frame::Inertial>& inv_spatial_metric, 72 : const Scalar<DataVector>& lapse); 73 : }; 74 : 75 : /*! 76 : * Calculate energy of neutrinos in a frame comoving with the fluid 77 : * 78 : * \f{align}{ 79 : * E = W \alpha p^t - \gamma^{ij} u_i p_j 80 : * \f} 81 : */ 82 1 : double compute_fluid_frame_energy( 83 : const Packet& packet, const Scalar<DataVector>& lorentz_factor, 84 : const tnsr::i<DataVector, 3, Frame::Inertial>& lower_spatial_four_velocity, 85 : const Scalar<DataVector>& lapse, 86 : const tnsr::II<DataVector, 3, Frame::Inertial>& inv_spatial_metric); 87 : 88 : } // namespace Particles::MonteCarlo