Skip to content

Commit d745b50

Browse files
committed
make keff scaling consistent with keff normalization for kinetic simulations
Kinetic simulations based on an eigenvalue solve need to multiply the prompt and delayed fission sources by the computed keff to bake-in the steady state initial condition. The keff scaling introduced in PR 3595 complicates this by multiplying tallied flux by keff. This is fine, however this new scaling factor is also applied to the final quantities which serve as the final estimate of quantities for each timestep in kinetic simulation. This would effetively undo the keff normalization putting the system out of steady state. In practice this looks like a shap step change in the values of tallied quantities. To address this, this commit introduces control flow to ensure that the keff scaling is applied to tallies at each timestep, but does not apply to the internal quantitities stored in memory until the final timestep, to ensure the keff normalization still bakes in that steady state.
1 parent 85db78b commit d745b50

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

src/random_ray/flat_source_domain.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -666,16 +666,7 @@ double FlatSourceDomain::compute_fixed_source_normalization_factor() const
666666
// such that 1.2 neutrons are generated, so as to be consistent with the
667667
// bookkeeping in MC which is all done per starting source neutron (not per
668668
// neutron produced).
669-
double normalization_factor;
670-
// For a kinetic simulation, the normalization only needs to be performed
671-
// once for the steady state.
672-
if (settings::kinetic_simulation && !settings::is_initial_condition)
673-
normalization_factor = 1.0;
674-
else
675-
normalization_factor = k_eff_ / (fission_rate_ * simulation_volume_);
676-
return normalization_factor;
677-
// TODO: check if a delayed fission rate needed to normalize the precursor
678-
// population... need to run a test problem using mc tallies?
669+
return k_eff_ / (fission_rate_ * simulation_volume_);
679670
}
680671

681672
// If we are in adjoint mode of a fixed source problem, the external
@@ -2137,8 +2128,8 @@ void FlatSourceDomain::compute_single_delayed_fission_source(
21372128
void FlatSourceDomain::compute_single_precursors(SourceRegionHandle& srh)
21382129
{
21392130
// Reset all precursors to zero (important for void regions)
2140-
for (int g = 0; g < negroups_; g++) {
2141-
srh.precursors_new(g) = 0.0;
2131+
for (int dg = 0; dg < ndgroups_; dg++) {
2132+
srh.precursors_new(dg) = 0.0;
21422133
}
21432134

21442135
int material = srh.material();
@@ -2250,8 +2241,16 @@ void FlatSourceDomain::normalize_final_quantities()
22502241
// TODO: add timer
22512242
double normalization_factor =
22522243
1.0 / (settings::n_batches - settings::n_inactive);
2253-
double source_normalization_factor =
2254-
compute_fixed_source_normalization_factor() * normalization_factor;
2244+
double source_normalization_factor;
2245+
if (!settings::kinetic_simulation ||
2246+
settings::kinetic_simulation &&
2247+
settings::current_timestep == settings::n_timesteps)
2248+
source_normalization_factor =
2249+
compute_fixed_source_normalization_factor() * normalization_factor;
2250+
else
2251+
// The source normalization should only be applied to internal quantities at
2252+
// the end of time stepping in preparation for an adjoint solve.
2253+
source_normalization_factor = 1.0 * normalization_factor;
22552254

22562255
#pragma omp parallel for
22572256
for (int64_t sr = 0; sr < n_source_regions(); sr++) {
@@ -2261,7 +2260,8 @@ void FlatSourceDomain::normalize_final_quantities()
22612260
source_regions_.scalar_flux_td_final(sr, g) *=
22622261
source_normalization_factor;
22632262
if (RandomRay::time_method_ == RandomRayTimeMethod::PROPAGATION) {
2264-
source_regions_.source_td_final(sr, g) *= normalization_factor;
2263+
// TODO: double check that this is correct for adjoint SDP
2264+
source_regions_.source_td_final(sr, g) *= source_normalization_factor;
22652265
}
22662266
}
22672267
for (int dg = 0; dg < ndgroups_; dg++) {

0 commit comments

Comments
 (0)