Difference between revisions of "Sensitivity calculations"
|Line 362:||Line 362:|
== Output ==
== Output ==
The output of the sensitivity calculations is written into a MATLAB/OCTAVE readable file <tt>[input]_sens[time].m</tt> (dynamic/time-dependent calculations), <tt>[input]_sens[bu].m</tt> (burnup calculations) or <tt>[input]_sens[bu]b[
The output of the sensitivity calculations is written into a MATLAB/OCTAVE readable file <tt>[input]_sens[time].m</tt> (dynamic/time-dependent calculations), <tt>[input]_sens[bu].m</tt> (burnup calculations) or <tt>[input]_sens[bu]b.m</tt> (branch calculations), where "<tt>time</tt>" is the time-interval, "<tt>bu</tt>" is the burnup step, and "<tt></tt> is the branch index.
=== General parameters ===
=== General parameters ===
Revision as of 15:26, 24 May 2022
Serpent relies on the collision history based first order GPT equivalent implementation  to calculate sensitivities of various responses to various perturbations. As a simple example, the sensitivity of the effective multiplication factor to the different nuclear cross sections can be calculated. In the future these capabilities may be used for uncertainty propagation to Serpent results .
- 1 Input
- 1.1 Adding a response
- 1.2 Adding a perturbation
- 1.3 Additional options
- 2 Output
- 3 Notes
- 4 Examples
- 5 References
Adding a response
Basic responses can be set up with the syntax
sens resp NAME FLAG
Where the different response names and flags are as follows
|NAME||explanation of NAME||FLAG||explanation of FLAG|
|keff||sensitivity of effective multiplication factor to perturbation||0/1||OFF/ON|
|beff||sensitivity of effective delayed neutron fraction to perturbation||0/1||OFF/ON|
|leff||sensitivity of effective prompt generation time to perturbation||0/1||OFF/ON|
|lambda||sensitivity of delayed neutron precursor decay constants to perturbation||0 0/1 1||OFF (total) OFF (group wise) / ON (total) ON (group wise)|
Omitting (or forgetting) the flag from the definition, will turn the response on by default.
Reaction rate ratios
Sensitivities of reaction rate ratios to perturbations can be set up to be calculated with
sens resp detratio NAME DET1 DET2 [FRAC1 FRAC2]
Where the parameters are:
|NAME||: the name of the response. Will be used in output.|
|DET1||: Name of the numerator detector, i.e. the one whose reaction rate is being divided.|
|DET2||: Name of the denominator detector, i.e. the one whose reaction rate is the dividing value.|
|FRAC1||: Fraction of contributions to DET1 to include in the sensitivity evaluation. Higher fraction yields better statistics but increases runtime. Default is 1 (all detector score contribute to the sensitivity).|
|FRAC2||: Fraction of contributions to DET2 to include in the sensitivity evaluation. Higher fraction yields better statistics but increases runtime. Default is 1 (all detector score contribute to the sensitivity).|
The two detectors have to be set up separately in normal Serpent fashion.
- Currently, the detectors must have the same number of bins and at most one response bin.
- Currently, the indirect effect of the perturbation is always calculated and the direct effect is calculated for the following detector responses:
- dr -1 (macroscopic total XS)
- dr -2 (macroscopic total capture XS)
- dr -3 (macroscopic total elastic scattering XS)
- dr -6 (macroscopic total fission XS)
- dr -7 (macroscopic total fission neutron production XS)
- Positive MT-numbers, however the sum reaction modes (e.g. MT=4) are not summed up from the partial reaction modes.
Void reactivity coefficient sensitivity
The sensitivity of the void reactivity coefficient to perturbations can be set up to be calculated with
sens resp void MATERIAL
Where the parameters are:
|MATERIAL||: the name of the material corresponding to the void coefficient.|
Adding a perturbation
sens pert NAME FLAG
Where the different perturbation names and flags are as follows
|NAME||explanation of NAME||FLAG||explanation of FLAG|
|xs||perturbation of basic cross sections||0/all/allmt/|| OFF/sum reaction modes/partial (MT) reaction modes|
See below for only including some specific reaction modes.
|chi||perturbation of fission spectrum||0/1||OFF/ON|
|nubar||perturbation of fission nubar||0/1||OFF/ON|
|elamu||perturbation of elastic scattering cosine||0/1||OFF/ON|
|inlmu||perturbation of inelastic scattering cosine||0/1||OFF/ON|
|eleg|| perturbation of Legendre moments of
elastic scattering angular distribution
|0/1/2/3/4/5/6/7||Number of Legendre moments to perturb.|
|temperature||perturbation of temperature||0/1||OFF/ON|
Omitting (or forgetting) the flag from the definition will turn the perturbation on by default. The default number of Legendre moments to include is 3.
Choosing specific reaction modes to perturb
Instead of including all sum reactions with sens pert xs all a subset of them can be included using
sens pert xs realist REA1 REA2 ...
where the allowed names for the sum reactions REAn are
- ela: Sum elastic scattering (excluding thermal scattering).
- sab: Sum thermal scattering.
- inl: Sum inelastic scattering (MTs 51-90).
- capt: Sum neutron capture (all reactions with no outgoing neutrons).
- fiss: Sum fission (MTs 18-21 and 38).
- nxn: Sum scattering production (non fission reactions with more than one outgoing neutron).
sens pert xs realist capt fiss
will only include the capture and fission reaction modes for perturbation.
Similarly, it is possible to choose only certain partial (MT) reaction modes to perturb with
sens pert xs mtlist MT1 MT2 ...
sens pert xs mtlist 19 102
will only include the first-chance fission (MT 19) and radiative capture (MT 102) for perturbation.
- Sum reaction modes and partial reaction modes cannot currently be perturbed at the same time (in the same input). For inputs containing both perturbations (e.g. a sens pert xs realist card and a sens pert xs mtlist card) only the latter perturbation is used.
- Legendre moments can be listed within the xs mtlist using the non-official ENDF MT numbers 5001-5007.
Choosing nuclides to perturb
The perturbed nuclides can be specified by giving a list of the ZAI-numbers to include
sens pert zailist ZAI1 ZAI2 ...
sens pert zailist 922350 922380
for perturbations affecting 235U and 238U. By giving the control words total and/or sum in the list of ZAI-numbers, the total sensitivity over all ZAIs present in the calculation and the sum sensitivity of the listed ZAIs will be calculated, respectively.
All nuclides present in the calculation can be included with
sens pert zailist all
this will automatically include the calculation of the total sensitivity.
Choosing materials to perturb
The materials, where the perturbations are applied can similarly be specified by giving a list of the material names
sens pert matlist MAT1 MAT2 ...
sens pert matlist fuel coolant
for perturbations affecting interactions in materials fuel and coolant. By giving the control words total and/or sum in the list of material names, the total sensitivity over all materials present in the calculation and the sum sensitivity of the listed materials will be calculated, respectively.
All materials present in the calculation can be included with
sens pert matlist all
this will automatically include the calculation of the total sensitivity.
Custom perturbations (xGPT)
Instead of adding or subtracting 1 in each accepted or rejected event, there is the possibility to, instead, add or subtract a user defined energy dependent value. This allows applying continuous energy perturbations such as the ones used in .
The syntax for adding custom perturbations is
sens pert custom NAME [efunc FILE] [zailist ZAI1 ZAI2 ...] [matlist MAT1 MAT2 ...] [mtlist MT1 MT2 ...] [realist REA1 REA2 ...]
where NAME is simply a user-given name used for identification of the custom perturbation. By default, the value added or subtracted for the perturbation is 1, but an energy dependent function can be given with the efunc command, where FILE is the name of the file containing the energy dependent function in the following format:
INTERP_MODE Npts E1 VAL1 E2 VAL2 ... ENpts VALNpts
Accepted interpolation modes are lin-lin, lin-log, log-lin and log-log.
If the perturbation is only applied to certain nuclides (ZAIs) or materials, they can be given using the zailist and matlist options respectively. By default the perturbation is applied at each collision with the target nuclide(s). If the perturbation only affects certain reaction MT numbers, they can be given using the mtlist option. Certain sum-reactions can be flagged for the perturbation using the realist option, where the different sum reaction names are as follows:
|ela||: Elastic scattering.|
|inl||: Inelastic scattering.|
|sab||: Thermal S(α,β) scattering.|
|capt||: Neutron capture (reaction neutron yield is zero).|
|nxn||: Neutron multiplying (n, xn) reactions.|
- The custom perturbations will only produce the total effect of the perturbation over all materials, nuclides and reaction modes that have not been excluded from the custom perturbation.
- The output for the custom perturbations can be obtained from the energy integrated (_E_INT) arrays printed to [input]_sens.m. The only nonzero value for the custom perturbations will be that with the lowest material and ZAI index.
The options for sensitivity calculations can be set using the
sens opt ...
Energy grid for scoring
The energy grid used for scoring the sensitivities can be set using
sens opt egrid ENAME
where ENAME is a name of an energy grid definition.
Spatial data mesh for scoring
The spatial data mesh used for scoring the sensitivities can be set using
sens opt dmesh DNAME
where DNAME is a name of a spatial data mesh definition.
- The number of bins defining the energy grid and the spatial data mesh should match
Number of latent generations
The number of latent generations used for k-effective sensitivity calculations can be set with
sens opt latgen NGEN
where NGEN is the number of generations to use. The number of summation generations for reaction rate ratios and bilinear-ratios will be NGEN+1
Effect of number of latent generations
sens opt history yes/1
will calculate and output the sensitivities with every number of latent generations up to the one indicated with sens opt latgen. This option can be used to estimate the required number of latent generations.
Direct scoring instead of event based scoring
There are two ways to go about calculating the net number of accepted collisions in the collision history of a particle.
- The default way used by Serpent is to create so-called event-objects during each accepted or rejected event of interest (e.g. collision, sampled fission neutron energy or sampled scattering angle). Then, when the net number of accepted collisions is needed, this list of events is traversed and the net number is calculated. The memory requirement of this method is dependent on the number of interesting events in Ngen generations of particle history, where Ngen is the total number of generations stored for the collision history. In order to save memory, the events are shared by each particle that has the event in their collision history. Traversing through the event tree in order to calculate the net number of a certain event in the collision history can be costly.
- There is the option to update the net number of a certain event on-the-fly, every time that event is sampled. Event objects are no longer stored. Instead the net number of accepted collisions is either incremented (accepted collision) or decremented (rejected collision) directly. This way each generation in the collision history is associated with a score matrix representing the net number of scores for each of the different events of interest. Again, to save memory each generational score matrix is shared by all neutrons that have that neutron history in their collision history. Looping over this score matrix can also be costly.
Generally, direct scoring is the better option if the length of the collision history is large and the number of perturbations (number of materials X number of nuclides X number of reactions X number of energy groups) is small.
Conversely in systems with a short collision history length (fast systems) and a large number of total perturbations, the default event based scoring should fare better.
It is usually beneficial to test both methods in order to find the faster (or more memory efficient) one for the specific application.
In order to use the direct scoring (option 2), the input is
sens opt direct F
where F indicates the number of score matrices to be allocated per source particle per generation. If the score matrices would not be shared across multiple source particles F would need to be set to 1.0. However, in reality fewer score matrices are needed and the F can be set to be smaller than unity (e.g. 0.2-0.5).
The score matrices require some additional processing after each cycle, which means that it is a good idea to try and make the F parameter as small as possible in order to avoid having to process an excess number of score matrices. If Serpent notices that the allocated score matrices are running out, it will automatically try and allocate more score matrices:
***** Warning: Adjusting event score matrix bank size for thread 5...
Even so, the score matrices can sometimes run out by surprise leading to an error:
Fatal error in function EBlockFromBank: Event score matrix bank is empty. Increase the bank size with "sens opt direct <sz>". Simulation aborted.
Event bank size
In a similar manner to the score matrices described in the previous section, Serpent also preallocates memory for the event objects used to store information about the accepted and rejected collisions. The event objects are also processed after each cycle, which means that setting a too large value for the event bank size will waste processing time.
The event bank size can be set using
set nbuf NBUF EBANK
where NBUF is the neutron buffer size (default is 5) and EBANK is the event bank size (default is 100). The event bank size is given by source particle, which means that if the events would not be shared between multiple particles, a reasonable value for the event bank size would be Nevent × Ngen, where Nevent is the mean number of events of interest in each generation and Ngen is the number of generations stored for the collision history. Due to the sharing of the events across multiple particles, much smaller values can typically be used (e.g. size of 20 for light water system with 16 stored generations with cross section and nubar perturbations for coolant and fuel nuclides).
If Serpent notices that the allocated score matrices are running out, it will automatically try and allocate more score matrices:
***** Warning: Adjusting event bank size for thread 2...
If the event banks run out completely the following error is given:
Fatal error in function EventFromBank: Event bank is empty Simulation aborted.
The output of the sensitivity calculations is written into a MATLAB/OCTAVE readable file [input]_sens[time].m (dynamic/time-dependent calculations), [input]_sens[bu].m (burnup calculations) or [input]_sens[bu]b[idx].m (branch calculations), where "time" is the time-interval, "bu" is the burnup step, and "idx is the branch index.
|SENS_N_MAT||1||Number of perturbed materials.|
|SENS_N_ZAI||1||Number of perturbed nuclides (ZAIs).|
|SENS_N_PERT||1||Number of different perturbation types (cross sections, fission spectra etc.).|
|SENS_N_ENE||1||Number of energy bins used for tallying the sensitivities.|
|SENS_MAT_LIST||SENS_N_MAT strings||Array of names for the perturbed materials.|
|SENS_ZAI_LIST||SENS_N_ZAI||Array of ZAI numbers for the perturbed nuclides.|
|SENS_PERT_LIST||SENS_N_PERT strings||Array of names for the perturbation types.|
|SENS_E||SENS_N_ENE + 1||Grid points for the energy grid used for tallying the sensitivities.|
|SENS_LETHARGY_WIDTHS||SENS_N_ENE||Lethargy widths of the energy bins. Lethargy at the maximum energy bin boundary is 0.|
The calculated sensitivities are printed out both in an energy dependent format (integrated to the energy grid defined by sens opt egrid) and an energy integrated format (integrated over all energies).
The standard sensitivity responses include:
|ADJ_PERT_KEFF_SENS||SENS_N_MAT × SENS_N_ZAI × SENS_N_PERT × SENS_N_ENE × 2||The energy dependent sensitivity of the multiplication factor and the associated statistical error.|
|ADJ_PERT_KEFF_SENS_E_INT||SENS_N_MAT × SENS_N_ZAI × SENS_N_PERT × 2||The energy integrated sensitivity of the multiplication factor and the associated statistical error.|
|ADJ_PERT_BEFF_SENS||SENS_N_MAT × SENS_N_ZAI × SENS_N_PERT × SENS_N_ENE × 2||The energy dependent sensitivity of the delayed neutron fraction and the associated statistical error.|
|ADJ_PERT_BEFF_SENS_E_INT||SENS_N_MAT × SENS_N_ZAI × SENS_N_PERT × 2||The energy integrated sensitivity of the delayed neutron fraction and the associated statistical error.|
|ADJ_PERT_LEFF_SENS||SENS_N_MAT × SENS_N_ZAI × SENS_N_PERT × SENS_N_ENE × 2||The energy dependent sensitivity of the prompt neutron generation time and the associated statistical error.|
|ADJ_PERT_LEFF_SENS_E_INT||SENS_N_MAT × SENS_N_ZAI × SENS_N_PERT × 2||The energy integrated sensitivity of the prompt neutron generation time and the associated statistical error.|
|ADJ_PERT_VOID_SENS||SENS_N_MAT × SENS_N_ZAI × SENS_N_PERT × SENS_N_ENE × 2||The energy dependent sensitivity of the void reactivity coefficient and the associated statistical error.|
|ADJ_PERT_VOID_SENS_E_INT||SENS_N_MAT × SENS_N_ZAI × SENS_N_PERT × 2||The energy integrated sensitivity of the void reactivity coefficient and the associated statistical error.|
The reaction rate sensitivities defined using sens resp detratio are output as:
|ADJ_PERT_NAME_SENS||SENS_N_MAT × SENS_N_ZAI × SENS_N_PERT × SENS_N_ENE × 2||The energy dependent sensitivity of the reaction rate ratio NAME and the associated statistical error.|
|ADJ_PERT_NAME_SENS_E_INT||SENS_N_MAT × SENS_N_ZAI × SENS_N_PERT × 2||The energy integrated sensitivity of the reaction rate ratio NAME and the associated statistical error.|
The indices for different materials, ZAIs and perturbations are also included as separate variables of the following format
|iSENS_MAT_NAME||1||Index corresponding to material NAME.|
|iSENS_ZAI_NUMBER||1||Index corresponding to the nuclide with ZAI NUMBER.|
|iSENS_PERT_NAME||1||Index corresponding to the perturbation NAME.|
These indices can be used to refer to the different materials, nuclides and perturbations in data processing without the need to manually figure out the indices. For example,
ADJ_PERT_KEFF_SENS(iSENS_MAT_fuel, iSENS_ZAI_922380, iSENS_PERT_CAPT_XS, :, 1)
will refer to the energy dependent sensitivity of the multiplication factor to the perturbation of the capture cross section of uranium 238 in the material fuel.
It should be noted that the indices for certain materials, ZAIs and perturbations only exist if they have been included in the sensitivity calculation using sens pert.
- The energy dependent sensitivities are integrated over the energy bins and not divided by the bin energy- or lethargy-width.
- The sensitivity output is mostly written as 1D arrays and reshaped and permuted using the appropriate MATLAB/OCTAVE commands (included in the .m file).
- ^ Aufiero, M. et al. "A collision history-based approach to sensitivity/perturbation calculations in the continuous energy Monte Carlo code SERPENT", Ann. Nucl. Energy, 152 (2015) 245-258.
- ^ Valtavirta, V., Aufiero, M. and Leppänen, J. "Collision-history based sensitivity/perturbation calculation capabilities in Serpent 2.1.30", In Proc. BEPU 2018, Lucca, Italy, May 13-19, 2018.
- ^ Valtavirta, V. "Nuclear data uncertainty propagation to Serpent generated group and time constants", Research report VTT-R-04681-18 (link to report) (2018).
- ^ Aufiero, M., Martin, M. and Fratoni, M. "XGPT: Extending Monte Carlo Generalized Perturbation Theory capabilities to continuous-energy sensitivity functions." Ann. Nucl. Energy, 96 (2016) 295-306.