Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
GIDI_delayedNeutron.cc
Go to the documentation of this file.
1/*
2# <<BEGIN-copyright>>
3# Copyright 2019, Lawrence Livermore National Security, LLC.
4# This file is part of the gidiplus package (https://github.com/LLNL/gidiplus).
5# gidiplus is licensed under the MIT license (see https://opensource.org/licenses/MIT).
6# SPDX-License-Identifier: MIT
7# <<END-copyright>>
8*/
9
10#include "GIDI.hpp"
11
12namespace GIDI {
13
14/*! \class DelayedNeutron
15 * This class represents a **GNDS** delayedNeutron.
16*/
17
18/* *********************************************************************************************************//**
19 * Constructed from data in a <**outputChannel**> node.
20 *
21 * @param a_construction [in] Used to pass user options to the constructor.
22 * @param a_node [in] The reaction HAPI::Node to be parsed and used to construct the reaction.
23 * @param a_setupInfo [in] Information create my the Protare constructor to help in parsing.
24 * @param a_pops [in] The *external* PoPI::Database instance used to get particle indices and possibly other particle information.
25 * @param a_internalPoPs [in] The *internal* PoPI::Database instance used to get particle indices and possibly other particle information.
26 * This is the <**PoPs**> node under the <**reactionSuite**> node.
27 * @param a_parent [in] The parent GIDI::Suite.
28 * @param a_styles [in] The <**styles**> node under the <**reactionSuite**> node.
29 ***********************************************************************************************************/
30
31DelayedNeutron::DelayedNeutron( Construction::Settings const &a_construction, HAPI::Node const &a_node, SetupInfo &a_setupInfo,
32 PoPI::Database const &a_pops, PoPI::Database const &a_internalPoPs, Suite *a_parent, Styles::Suite const *a_styles ) :
33 Form( a_node, a_setupInfo, FormType::delayedNeutron, a_parent ),
34 m_delayedNeutronIndex( 0 ),
35 m_rate( a_construction, GIDI_rateChars, GIDI_labelChars, a_node, a_setupInfo, a_pops, a_internalPoPs, parsePhysicalQuantitySuite, a_styles ),
36 m_product( a_construction, a_node.child( GIDI_productChars ), a_setupInfo, a_pops, a_internalPoPs, nullptr, a_styles ) {
37
38 m_rate.setAncestor( this );
39 m_product.setAncestor( this );
40}
41
42/* *********************************************************************************************************//**
43 ***********************************************************************************************************/
44
48
49/* *********************************************************************************************************//**
50 * Used by GUPI::Ancestry to tranverse GNDS nodes. This method returns a pointer to a derived class' a_item member or nullptr if none exists.
51 *
52 * @param a_item [in] The name of the class member whose pointer is to be return.
53 * @return The pointer to the class member or nullptr if class does not have a member named a_item.
54 ***********************************************************************************************************/
55
56GUPI::Ancestry *DelayedNeutron::findInAncestry3( std::string const &a_item ) {
57
58 if( a_item == GIDI_rateChars ) return( &m_rate );
59 if( a_item == GIDI_productChars ) return( &m_product );
60
61 return( nullptr );
62}
63
64/* *********************************************************************************************************//**
65 * Used by GUPI::Ancestry to tranverse GNDS nodes. This method returns a pointer to a derived class' a_item member or nullptr if none exists.
66 *
67 * @param a_item [in] The name of the class member whose pointer is to be return.
68 * @return The pointer to the class member or nullptr if class does not have a member named a_item.
69 ***********************************************************************************************************/
70
71GUPI::Ancestry const *DelayedNeutron::findInAncestry3( std::string const &a_item ) const {
72
73 if( a_item == GIDI_rateChars ) return( &m_rate );
74 if( a_item == GIDI_productChars ) return( &m_product );
75
76 return( nullptr );
77}
78
79/* *********************************************************************************************************//**
80 * Insert a std::set with the products id and any product in in its output channel.
81 * If a_transportablesOnly is true, only transportable product indices are return.
82 *
83 * @param a_indices [out] The unique list of product indices.
84 * @param a_particles [in] The list of particles to be transported.
85 * @param a_transportablesOnly [in] If true, only transportable product indices are added in the list.
86 ***********************************************************************************************************/
87
88void DelayedNeutron::productIDs( std::set<std::string> &a_indices, Transporting::Particles const &a_particles, bool a_transportablesOnly ) const {
89
90 m_product.productIDs( a_indices, a_particles, a_transportablesOnly );
91}
92
93/* *********************************************************************************************************//**
94 * Returns the product multiplicity (e.g., 0, 1, 2, ...) or -1 if energy dependent or not an integer for particle with id *a_productID*.
95 *
96 * @param a_productID; [in] The id of the requested particle.
97 *
98 * @return The multiplicity for the requested particle.
99 ***********************************************************************************************************/
100
101int DelayedNeutron::productMultiplicity( std::string const &a_productID ) const {
102
103 return( m_product.productMultiplicity( a_productID ) );
104}
105
106/* *********************************************************************************************************//**
107 * Determines the maximum Legredre order present in the multi-group transfer matrix for the specified products of this output channel.
108 *
109 * @param a_smr [Out] If errors are not to be thrown, then the error is reported via this instance.
110 * @param a_settings [in] Specifies the requested label.
111 * @param a_temperatureInfo [in] Specifies the temperature and labels use to lookup the requested data.
112 * @param a_productID [in] Particle id of the requested product.
113 *
114 * @return The maximum Legredre order. If no transfer matrix data are present for the requested product, -1 is returned.
115 ***********************************************************************************************************/
116
118 Styles::TemperatureInfo const &a_temperatureInfo, std::string const &a_productID ) const {
119
120 return( m_product.maximumLegendreOrder( a_smr, a_settings, a_temperatureInfo, a_productID ) );
121}
122
123/* *********************************************************************************************************//**
124 * Returns the sum of the multi-group multiplicity for the requested label for the request product of this output channel.
125 * This is a cross section weighted multiplicity.
126 *
127 * @param a_smr [Out] If errors are not to be thrown, then the error is reported via this instance.
128 * @param a_settings [in] Specifies the requested label.
129 * @param a_temperatureInfo [in] Specifies the temperature and labels use to lookup the requested data.
130 * @param a_productID [in] Particle id for the requested product.
131 *
132 * @return The requested multi-group multiplicity as a GIDI::Vector.
133 ***********************************************************************************************************/
134
136 Styles::TemperatureInfo const &a_temperatureInfo, std::string const &a_productID ) const {
137
138 return( m_product.multiGroupMultiplicity( a_smr, a_settings, a_temperatureInfo, a_productID ) );
139}
140
141/* *********************************************************************************************************//**
142 * Returns the multi-group, product matrix for the requested label for the requested product index for the requested Legendre order.
143 * If no data are found, an empty GIDI::Matrix is returned.
144 *
145 * @param a_smr [Out] If errors are not to be thrown, then the error is reported via this instance.
146 * @param a_settings [in] Specifies the requested label and if delayed neutrons should be included.
147 * @param a_temperatureInfo [in] Specifies the temperature and labels use to lookup the requested data.
148 * @param a_particles [in] The list of particles to be transported.
149 * @param a_productID [in] Particle id for the requested product.
150 * @param a_order [in] Requested product matrix, Legendre order.
151 *
152 * @return The requested multi-group product matrix as a GIDI::Matrix.
153 ***********************************************************************************************************/
154
156 Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, std::string const &a_productID,
157 std::size_t a_order ) const {
158
159 return( m_product.multiGroupProductMatrix( a_smr, a_settings, a_temperatureInfo, a_particles, a_productID, a_order ) );
160}
161
162/* *********************************************************************************************************//**
163 * Returns the sum of the multi-group, average energy for the requested label for the requested product. This is a cross section weighted average energy.
164 *
165 * @param a_smr [Out] If errors are not to be thrown, then the error is reported via this instance.
166 * @param a_settings [in] Specifies the requested label.
167 * @param a_temperatureInfo [in] Specifies the temperature and labels use to lookup the requested data.
168 * @param a_productID [in] Particle id for the requested product.
169 *
170 * @return The requested multi-group average energy as a GIDI::Vector.
171 ***********************************************************************************************************/
172
174 Styles::TemperatureInfo const &a_temperatureInfo, std::string const &a_productID ) const {
175
176 return( m_product.multiGroupAverageEnergy( a_smr, a_settings, a_temperatureInfo, a_productID ) );
177}
178
179/* *********************************************************************************************************//**
180 * Returns the sum of the multi-group, average momentum for the requested label for the requested product. This is a cross section weighted average momentum.
181 *
182 * @param a_smr [Out] If errors are not to be thrown, then the error is reported via this instance.
183 * @param a_settings [in] Specifies the requested label.
184 * @param a_temperatureInfo [in] Specifies the temperature and labels use to lookup the requested data.
185 * @param a_productID [in] Particle id for the requested product.
186 *
187 * @return The requested multi-group average momentum as a GIDI::Vector.
188 ***********************************************************************************************************/
189
191 Styles::TemperatureInfo const &a_temperatureInfo, std::string const &a_productID ) const {
192
193 return( m_product.multiGroupAverageMomentum( a_smr, a_settings, a_temperatureInfo, a_productID ) );
194}
195
196/* *********************************************************************************************************//**
197 * Added the product to *a_incompleteParticles* if the product's completeParticle returns *false*.
198 *
199 * @param a_settings [in] Specifies the requested label.
200 * @param a_incompleteParticles [out] The list of particles whose **completeParticle** method returns *false*.
201 ***********************************************************************************************************/
202
203void DelayedNeutron::incompleteParticles( Transporting::Settings const &a_settings, std::set<std::string> &a_incompleteParticles ) const {
204
205 m_product.incompleteParticles( a_settings, a_incompleteParticles );
206}
207
208/* *********************************************************************************************************//**
209 * Returns, via arguments, the average energy and momentum, and gain for product with particle id *a_particleID*.
210 *
211 * @param a_settings [in] Specifies the requested label.
212 * @param a_particleID [in] The particle id of the product.
213 * @param a_energy [in] The energy of the projectile.
214 * @param a_productEnergy [in] The average energy of the product.
215 * @param a_productMomentum [in] The average momentum of the product.
216 * @param a_productGain [in] The gain of the product.
217 * @param a_ignoreIncompleteParticles [in] If *true*, incomplete particles are ignore, otherwise a *throw* is executed.
218 ***********************************************************************************************************/
219
220void DelayedNeutron::continuousEnergyProductData( Transporting::Settings const &a_settings, std::string const &a_particleID, double a_energy,
221 double &a_productEnergy, double &a_productMomentum, double &a_productGain, bool a_ignoreIncompleteParticles ) const {
222
223 m_product.continuousEnergyProductData( a_settings, a_particleID, a_energy, a_productEnergy, a_productMomentum, a_productGain,
224 a_ignoreIncompleteParticles );
225}
226
227/* *********************************************************************************************************//**
228 * Modifies the average product energies, momenta and gains for product with particle id *a_particleID*.
229 *
230 * @param a_settings [in] Specifies user options.
231 * @param a_particleID [in] The particle id of the product.
232 * @param a_energies [in] The vector of energies to map the data to.
233 * @param a_offset [in] The index of the first energy whose data are to be added to the vectors.
234 * @param a_productEnergies [out] The vector of average energies of the product.
235 * @param a_productMomenta [out] The vector of average momenta of the product.
236 * @param a_productGains [out] The vector of gain of the product.
237 * @param a_ignoreIncompleteParticles [in] If *true*, incomplete particles are ignore, otherwise a *throw* is executed.
238 ***********************************************************************************************************/
239
240void DelayedNeutron::mapContinuousEnergyProductData( Transporting::Settings const &a_settings, std::string const &a_particleID,
241 std::vector<double> const &a_energies, std::size_t a_offset, std::vector<double> &a_productEnergies, std::vector<double> &a_productMomenta,
242 std::vector<double> &a_productGains, bool a_ignoreIncompleteParticles ) const {
243
244 m_product.mapContinuousEnergyProductData( a_settings, a_particleID, a_energies, a_offset, a_productEnergies, a_productMomenta,
245 a_productGains, a_ignoreIncompleteParticles );
246}
247
248/* *********************************************************************************************************//**
249 * This methods calculates multi-group data for all needed components and adds each component's multi-group with label *a_heatedMultiGroupLabel*.
250 *
251 * @param a_temperatureInfo [in] Specifies the temperature and labels use to lookup the requested data.
252 * @param a_heatedMultiGroupLabel [in] The label of the style for the multi-group data being added.
253 * @param a_multiGroupCalulationInformation [in] Store multi-group boundary and flux data used for multi-grouping.
254 * @param a_crossSectionXYs1d [in[ The cross section weight.
255 ***********************************************************************************************************/
256
257void DelayedNeutron::calculateMultiGroupData( ProtareSingle const *a_protare, Styles::TemperatureInfo const &a_temperatureInfo,
258 std::string const &a_heatedMultiGroupLabel, MultiGroupCalulationInformation const &a_multiGroupCalulationInformation,
259 Functions::XYs1d const &a_crossSectionXYs1d ) {
260
261 m_product.calculateMultiGroupData( a_protare, a_temperatureInfo, a_heatedMultiGroupLabel, a_multiGroupCalulationInformation, a_crossSectionXYs1d );
262}
263
264/* *********************************************************************************************************//**
265 * Fills the argument *a_writeInfo* with the XML lines that represent *this*. Recursively enters each sub-node.
266 *
267 * @param a_writeInfo [in/out] Instance containing incremental indentation and other information and stores the appended lines.
268 * @param a_indent [in] The amount to indent *this* node.
269 ***********************************************************************************************************/
270
271void DelayedNeutron::toXMLList( GUPI::WriteInfo &a_writeInfo, std::string const &a_indent ) const {
272
273 std::string indent2 = a_writeInfo.incrementalIndent( a_indent );
274
275 a_writeInfo.addNodeStarter( a_indent, moniker( ), a_writeInfo.addAttribute( GIDI_labelChars, label( ) ) );
276 m_rate.toXMLList( a_writeInfo, indent2 );
277 m_product.toXMLList( a_writeInfo, indent2 );
278 a_writeInfo.addNodeEnder( moniker( ) );
279}
280
281}
#define GIDI_productChars
Definition GIDI.hpp:221
#define GIDI_labelChars
Definition GIDI.hpp:438
#define GIDI_rateChars
Definition GIDI.hpp:234
Vector multiGroupMultiplicity(LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings, Styles::TemperatureInfo const &a_temperatureInfo, std::string const &a_productID) const
int maximumLegendreOrder(LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings, Styles::TemperatureInfo const &a_temperatureInfo, std::string const &a_productID) const
int productMultiplicity(std::string const &a_productID) const
void continuousEnergyProductData(Transporting::Settings const &a_settings, std::string const &a_particleID, double a_energy, double &a_productEnergy, double &a_productMomentum, double &a_productGain, bool a_ignoreIncompleteParticles) const
GUPI::Ancestry * findInAncestry3(std::string const &a_item)
Matrix multiGroupProductMatrix(LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings, Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, std::string const &a_productID, std::size_t a_order) const
void productIDs(std::set< std::string > &a_indices, Transporting::Particles const &a_particles, bool a_transportablesOnly) const
void incompleteParticles(Transporting::Settings const &a_settings, std::set< std::string > &a_incompleteParticles) const
Vector multiGroupAverageEnergy(LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings, Styles::TemperatureInfo const &a_temperatureInfo, std::string const &a_productID) const
DelayedNeutron(Construction::Settings const &a_construction, HAPI::Node const &a_node, SetupInfo &a_setupInfo, PoPI::Database const &a_pops, PoPI::Database const &a_internalPoPs, Suite *a_parent, Styles::Suite const *a_styles)
Vector multiGroupAverageMomentum(LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings, Styles::TemperatureInfo const &a_temperatureInfo, std::string const &a_productID) const
void mapContinuousEnergyProductData(Transporting::Settings const &a_settings, std::string const &a_particleID, std::vector< double > const &a_energies, std::size_t a_offset, std::vector< double > &a_productEnergies, std::vector< double > &a_productMomenta, std::vector< double > &a_productGains, bool a_ignoreIncompleteParticles) const
void calculateMultiGroupData(ProtareSingle const *a_protare, Styles::TemperatureInfo const &a_temperatureInfo, std::string const &a_heatedMultiGroupLabel, MultiGroupCalulationInformation const &a_multiGroupCalulationInformation, Functions::XYs1d const &a_crossSectionXYs1d)
void toXMLList(GUPI::WriteInfo &a_writeInfo, std::string const &a_indent="") const
std::string const & label() const
Definition GIDI.hpp:658
Form(FormType a_type)
Definition GIDI_form.cc:25
std::string const & moniker() const
Definition GUPI.hpp:102
void addNodeEnder(std::string const &a_moniker)
Definition GUPI.hpp:59
std::string incrementalIndent(std::string const &indent)
Definition GUPI.hpp:52
void addNodeStarter(std::string const &indent, std::string const &a_moniker, std::string const &a_attributes="")
Definition GUPI.hpp:55
std::string addAttribute(std::string const &a_name, std::string const &a_value) const
Definition GUPI.hpp:60
Definition GIDI.hpp:32
FormType
Definition GIDI.hpp:118
Form * parsePhysicalQuantitySuite(Construction::Settings const &a_construction, Suite *parent, HAPI::Node const &a_node, SetupInfo &a_setupInfo, PoPI::Database const &a_pop, PoPI::Database const &a_internalPoPs, std::string const &a_name, Styles::Suite const *a_styles)