From cf85c2bb05b3e4263a13aba31390c6ceacc6e2bb Mon Sep 17 00:00:00 2001 From: guillaume Date: Tue, 29 May 2018 18:03:37 -0400 Subject: [PATCH] skipping first step if already ran, not checking if power is the same though --- openmc/deplete/integrator/predictor.py | 30 +++++++++++++------------- openmc/deplete/operator.py | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/openmc/deplete/integrator/predictor.py b/openmc/deplete/integrator/predictor.py index d3b38aa3a..7bc6b9546 100644 --- a/openmc/deplete/integrator/predictor.py +++ b/openmc/deplete/integrator/predictor.py @@ -48,35 +48,35 @@ def predictor(operator, timesteps, power, print_out=True): t = 0.0 else: t = operator.prev_res.get_eigenvalue()[0][-1] - print("Time", t/24/60/60) # Initialize starting index for saving results if operator.prev_res == None: i_res = 0 else: i_res = len(operator.prev_res.get_eigenvalue()[0]) - print(i_res) + + #TODO : Get last time step power from previous results, and run a + # new calculation if different from power at the first time step + # If no TH coupling, just re-scale rates by ratio of power for i, (dt, p) in enumerate(zip(timesteps, power)): - # Avoid doing first run if already done in previous calculation - if i > 0 or operator.prev_res == None or p != p_end: - # Get beginning-of-timestep reaction rates - x = [copy.deepcopy(vec)] - op_results = [operator(x[0], p)] + # Get beginning-of-timestep concentrations + x = [copy.deepcopy(vec)] - # Create results, write to disk - Results.save(operator, x, op_results, [t, t + dt], i + i_res) + # Get beginning-of-timestep reaction rates + # Avoid doing first run if already done in previous calculation + if i > 0 or operator.prev_res == None: + op_results = [operator(x[0], p)] else: - x = [copy.deepcopy(vec)] - op_results = operator.prev_res[0] - print(op_results) - op_results = [operator(x[0], p)] - print(op_results) + op_results = [operator.prev_res[-1]] + op_results[0].rates = op_results[0].rates[0] + + # Create results, write to disk + Results.save(operator, x, op_results, [t, t + dt], i + i_res) # Deplete for full timestep - #print(x[0], op_results[0]) x_end = deplete(chain, x[0], op_results[0], dt, print_out) print("Time", t/24/60/60) print("Step", i + i_res) diff --git a/openmc/deplete/operator.py b/openmc/deplete/operator.py index ebd025f94..44c57f160 100644 --- a/openmc/deplete/operator.py +++ b/openmc/deplete/operator.py @@ -319,7 +319,7 @@ class Operator(TransportOperator): densities.append(val) else: # Only output warnings if values are significantly - # negative. CRAM does not guarantee positive values. + # negative. CRAM does not guarantee positive values. if val < -1.0e-21: print("WARNING: nuclide ", nuc, " in material ", mat, " is negative (density = ", val, " at/barn-cm)")