Activate need_depletion_rx for reaction rate-based depletion only

This commit is contained in:
Paul Romano 2020-08-24 13:48:21 -05:00
parent 234e09345d
commit 96a66789b1
6 changed files with 7 additions and 19 deletions

View file

@ -119,8 +119,6 @@ public:
int energyout_filter_ {C_NONE};
int delayedgroup_filter_ {C_NONE};
bool depletion_rx_ {false}; //!< Has depletion reactions (e.g. (n,2n))
std::vector<Trigger> triggers_;
int deriv_ {C_NONE}; //!< Index of a TallyDerivative object for diff tallies.

View file

@ -48,6 +48,9 @@ class DirectReactionRateHelper(ReactionRateHelper):
super().__init__(n_nuc, n_react)
self._rate_tally = None
# Automatically pre-calculate reaction rates for depletion
openmc.lib.settings.need_depletion_rx = True
@ReactionRateHelper.nuclides.setter
def nuclides(self, nuclides):
ReactionRateHelper.nuclides.fset(self, nuclides)

View file

@ -27,12 +27,13 @@ class _Settings:
generations_per_batch = _DLLGlobal(c_int32, 'gen_per_batch')
inactive = _DLLGlobal(c_int32, 'n_inactive')
max_lost_particles = _DLLGlobal(c_int32, 'max_lost_particles')
rel_max_lost_particles = _DLLGlobal(c_double, 'rel_max_lost_particles')
need_depletion_rx = _DLLGlobal(c_bool, 'need_depletion_rx')
output_summary = _DLLGlobal(c_bool, 'output_summary')
particles = _DLLGlobal(c_int64, 'n_particles')
rel_max_lost_particles = _DLLGlobal(c_double, 'rel_max_lost_particles')
restart_run = _DLLGlobal(c_bool, 'restart_run')
run_CE = _DLLGlobal(c_bool, 'run_CE')
verbosity = _DLLGlobal(c_int, 'verbosity')
output_summary = _DLLGlobal(c_bool, 'output_summary')
@property
def run_mode(self):

View file

@ -119,6 +119,7 @@ int openmc_finalize()
simulation::keff = 1.0;
simulation::n_lost_particles = 0;
simulation::need_depletion_rx = false;
simulation::satisfy_triggers = false;
simulation::total_gen = 0;

View file

@ -107,7 +107,6 @@ int openmc_simulation_init()
simulation::current_batch = 0;
simulation::k_generation.clear();
simulation::entropy.clear();
simulation::need_depletion_rx = false;
openmc_reset();
// If this is a restart run, load the state point data and binary source
@ -190,7 +189,6 @@ int openmc_simulation_finalize()
if (settings::check_overlaps) print_overlap_check();
// Reset flags
simulation::need_depletion_rx = false;
simulation::initialized = false;
return 0;
}

View file

@ -377,7 +377,6 @@ Tally::set_scores(const std::vector<std::string>& scores)
{
// Reset state and prepare for the new scores.
scores_.clear();
depletion_rx_ = false;
scores_.reserve(scores.size());
// Check for the presence of certain restrictive filters.
@ -449,15 +448,6 @@ Tally::set_scores(const std::vector<std::string>& scores)
}
break;
case N_2N:
case N_3N:
case N_4N:
case N_GAMMA:
case N_P:
case N_A:
depletion_rx_ = true;
break;
case SCORE_CURRENT:
// Check which type of current is desired: mesh or surface currents.
if (surface_present || cell_present || cellfrom_present) {
@ -859,9 +849,6 @@ setup_active_tallies()
case TallyType::SURFACE:
model::active_surface_tallies.push_back(i);
}
// Check if tally contains depletion reactions and if so, set flag
if (tally.depletion_rx_) simulation::need_depletion_rx = true;
}
}
}