mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 13:45:36 -04:00
fix restart bug for LE/QI methods
This commit is contained in:
parent
6f3aeed89a
commit
d65bdaac49
4 changed files with 25 additions and 14 deletions
|
|
@ -28,7 +28,6 @@ RUN git clone https://github.com/njoy/NJOY2016 /opt/NJOY2016 && \
|
|||
cmake -Dstatic=on .. && make 2>/dev/null && make install
|
||||
|
||||
# Clone and install OpenMC
|
||||
RUN pip3 install --no-binary=mpi4py mpi4py
|
||||
RUN git clone https://github.com/openmc-dev/openmc.git /opt/openmc && \
|
||||
cd /opt/openmc && mkdir -p build && cd build && \
|
||||
cmake -Doptimize=on -DHDF5_PREFER_PARALLEL=on .. && \
|
||||
|
|
|
|||
|
|
@ -113,13 +113,19 @@ def leqi(operator, timesteps, power=None, power_density=None, print_out=True):
|
|||
chain = operator.chain
|
||||
|
||||
for i, (dt, p) in enumerate(zip(timesteps, power)):
|
||||
# Perform SI-CE/LI CFQ4 for the first step
|
||||
# LE/QI needs the last step results to start
|
||||
# Perform CE/LI CFQ4 or restore results for the first step
|
||||
if i == 0:
|
||||
# Save results for the last step
|
||||
dt_l = dt
|
||||
x_new, t, op_res_last = celi_inner(operator, vec, p, i, i_res,
|
||||
t, dt, print_out)
|
||||
continue
|
||||
if i_res <= 1:
|
||||
dt_l = dt
|
||||
x_new, t, op_res_last = celi_inner(operator, vec, p, i,
|
||||
i_res, t, dt, print_out)
|
||||
continue
|
||||
else:
|
||||
dt_l = t - operator.prev_res[-2].time[0]
|
||||
op_res_last = operator.prev_res[-2]
|
||||
op_res_last.rates = op_res_last.rates[0]
|
||||
x_new = operator.prev_res[-1].data[0]
|
||||
|
||||
# Perform remaining LE/QI
|
||||
x = [copy.deepcopy(x_new)]
|
||||
|
|
|
|||
|
|
@ -113,14 +113,20 @@ def si_leqi(operator, timesteps, power=None, power_density=None,
|
|||
chain = operator.chain
|
||||
|
||||
for i, (dt, p) in enumerate(zip(timesteps, power)):
|
||||
# Perform SI-CE/LI CFQ4 for the first step
|
||||
# LE/QI needs the last step results to start
|
||||
# Perform SI-CE/LI CFQ4 or restore results for the first step
|
||||
if i == 0:
|
||||
# Save results for the last step
|
||||
op_res_last = copy.deepcopy(op_results[0])
|
||||
dt_l = dt
|
||||
x, t, op_results = si_celi_inner(operator, x, op_results, p,
|
||||
i, i_res, t, dt, print_out)
|
||||
continue
|
||||
if i_res <= 1:
|
||||
op_res_last = copy.deepcopy(op_results[0])
|
||||
x, t, op_results = si_celi_inner(operator, x, op_results, p,
|
||||
i, i_res, t, dt, print_out)
|
||||
continue
|
||||
else:
|
||||
dt_l = t - operator.prev_res[-2].time[0]
|
||||
op_res_last = operator.prev_res[-2]
|
||||
op_res_last.rates = op_res_last.rates[0]
|
||||
x = [operator.prev_res[-1].data[0]]
|
||||
|
||||
# Perform remaining LE/QI
|
||||
inputs = list(zip(op_res_last.rates, op_results[0].rates,
|
||||
|
|
|
|||
|
|
@ -392,7 +392,7 @@ def test_restart_si_leqi(run_in_tmpdir):
|
|||
|
||||
# Reference solution
|
||||
s1 = [2.03325094, 1.16826254]
|
||||
s2 = [2.69291933, 0.37907772]
|
||||
s2 = [2.92711288, 0.53753236]
|
||||
|
||||
assert y1[1] == approx(s1[0])
|
||||
assert y2[1] == approx(s1[1])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue