Skip to content

Commit

Permalink
Constant reprocessing simplified test added
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewryh committed Dec 18, 2019
1 parent 2949496 commit 5f43c60
Show file tree
Hide file tree
Showing 7 changed files with 124 additions and 34 deletions.
1 change: 1 addition & 0 deletions saltproc/data/tap
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ set inventory all
%set rfr idx 321 restart
%set seed 46549345296
set seed 7812324546562
%set seed 2358907456230438

% ---- All CR inserted by default - withdrawn
trans CR0 0.0 0.0 400.0
Expand Down
6 changes: 3 additions & 3 deletions saltproc/depcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ def run_depcode(self, cores, nodes):
args = (self.exec_path, '-omp', str(cores), self.input_fname)
print('Running %s' % (self.codename))
try:
subprocess.check_call(args)
# stdout=subprocess.DEVNULL,
# stderr=subprocess.STDOUT)
subprocess.check_call(args,
stdout=subprocess.DEVNULL,
stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as error:
print(error.output, error.returncode)
raise ValueError('\n %s RUN FAILED\n' % (self.codename))
Expand Down
79 changes: 79 additions & 0 deletions saltproc/tests/integration_tests/const_repr/.inp
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
include "/home/andrei2/Desktop/git/saltproc/develop/examples/mats/saltproc_prepr_comp.ini"
include "/home/andrei2/Desktop/git/saltproc/develop/examples/mats/non_burnable_mats.ini"




%include "/home/andrei2/Desktop/git/meitner-task-2/serpent/geometry/various_svf_2/342_base.ini"

%include "/u/sciteam/rykhlevs/meitner/mat_comp/saltproc_prepr_comp.ini"
%include "/u/sciteam/rykhlevs/meitner/mat_comp/non_burnable_mats.ini"
%include "/u/sciteam/rykhlevs/meitner/geometry/core_cr_withdr.ini"

%include "/home/rykhandr/tap/mat_comp/saltproc_prepr_comp.ini"
%include "/home/rykhandr/tap/mat_comp/non_burnable_mats.ini"
%include "/home/rykhandr/tap/geometry/core_cr_withdr.ini"

set title "TAP MSR test 5-d step"

%therm zrh_h 900 hzr05.32t hzr06.32t % 900K H-Zr
%set acelib "/projects/sciteam/bahg/serpent/xsdata/jeff312/sss_jeff312.xsdata"
%set declib "/projects/sciteam/bahg/serpent/xsdata/jeff312/sss_jeff33.dec"
%set nfylib "/projects/sciteam/bahg/serpent/xsdata/jeff312/sss_jeff33.nfy"
%set sfylib "/projects/sciteam/bahg/serpent/xsdata/jeff312/sss_jeff33.sfy"

set acelib "sss_jeff312.xsdata"
set declib "sss_jeff33.dec"
set nfylib "sss_jeff33.nfy"
set sfylib "sss_jeff33.sfy"
% --- Neutron population and criticality cycles:

set pop 15000 500 200
%set gcu -1

% --- Reproducibility off (set value to 1 and define seed to set on):

set repro 1

% --- Reduce unionized energy grid size in order to save some memory
% Use grid thinning with 5e-5 reconstruction tolerance between
% 1e-8 and 15 MeV.

set egrid 5e-5 1e-10 15.0

% --- Cut-offs:

set fpcut 1E-6
set stabcut 1E-12

% --- Geometry and mesh plots:
%plot 33 3100 2100 4.5 0 155.0 0 105.0
%plot 13 2000 2000 16.5

% --- Depletion parameters
% --- Options for burnup calculation:
set bumode 2 % CRAM method
set pcc 2 % Predictor-corrector calculation off (Linear extrapolation)
%set xscalc 2 % Cross sections from spectrum
%set bunorm 2
%set opti 3

set power 1.250E+09 dep daytot 5.0

%set printm 1 0.0

set inventory all

%set rfw 1 restart
%set rfr idx 321 restart
%set seed 46549345296
set seed 7812324546562

% ---- All CR inserted by default - withdrawn
trans CR0 0.0 0.0 400.0
trans CR1 0.0 0.0 400.0
trans CR2 0.0 0.0 400.0
trans CR3 0.0 0.0 400.0
trans CR4 0.0 0.0 400.0
trans CR5 0.0 0.0 400.0
trans CR6 0.0 0.0 400.0
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import sys
import numpy as np
import pytest
import tables as tb

path = os.path.realpath(__file__)
sys.path.append(os.path.dirname(os.path.dirname(path)))
Expand All @@ -14,7 +15,9 @@

sss_file = directory+'/int_test'
iter_matfile = directory+'/int_test_mat'
db_file = directory+'/db_test.h5'

db_exp_file = directory+'/2step_non_ideal.h5'
db_file = directory+'/../../../data/db_saltproc.h5'

serpent = Depcode(codename='SERPENT',
exec_path='/home/andrei2/serpent/serpent2/src_2131/sss2',
Expand All @@ -38,37 +41,44 @@


@pytest.mark.slow
@pytest.mark.skip
# @pytest.mark.skip
def read_keff_h5(file):
db = tb.open_file(file, mode='r')
sim_param = db.root.simulation_parameters
init_param = db.root.initial_depcode_siminfo
# Keff at t=0 depletion step
k_0 = np.array([x['keff_bds'][0] for x in sim_param.iterrows()])
k_0_e = np.array([x['keff_bds'][1] for x in sim_param.iterrows()])
# Keff at t=end depletion step
k_1 = np.array([x['keff_eds'][0] for x in sim_param.iterrows()])
k_1_e = np.array([x['keff_eds'][1] for x in sim_param.iterrows()])
depstep = [x['depletion_timestep'] for x in init_param.iterrows()][0]
db.close()
return k_0, k_1, k_0_e, k_1_e, depstep


def read_iso_m_h5(db_file):
db = tb.open_file(db_file, mode='r')
fuel_before = db.root.materials.fuel.before_reproc.comp
fuel_after = db.root.materials.fuel.after_reproc.comp
isomap = fuel_before.attrs.iso_map

mass_b = {}
mass_a = {}

for iso in isomap:
mass_b[iso] = np.array([row[isomap[iso]] for row in fuel_before])
mass_a[iso] = np.array([row1[isomap[iso]] for row1 in fuel_after])
db.close()
return mass_b, mass_a


def test_integration_2step_constant_ideal_removal_heavy():
for dts in range(simulation.timesteps):
print ("\n\n\nStep #%i has been started" % (dts+1))
if dts == 0: # First step
serpent.write_depcode_input(serpent.template_fname,
serpent.input_fname)
serpent.run_depcode(simulation.core_number, simulation.node_number)
# Read general simulation data which never changes
simulation.store_run_init_info()
# Parse and store data for initial state (beginning of dts
mats = serpent.read_dep_comp(serpent.input_fname, 0) # 0)
simulation.store_mat_data(mats, dts-1, 'before_reproc')
# Finish of First step
# Main sequence
else:
serpent.run_depcode(simulation.core_number, simulation.node_number)
mats = serpent.read_dep_comp(serpent.input_fname, 1)
simulation.store_mat_data(mats, dts, 'before_reproc')
simulation.store_run_step_info()
# Reprocessing here
waste_st, rem_mass = reprocessing(mats)
refill(mats, rem_mass, waste_st)
# Store in DB after reprocessing and refill (right before next depl)
simulation.store_after_repr(mats, waste_st, dts)
serpent.write_mat_file(mats, iter_matfile, dts)
del mats, waste_st, rem_mass
gc.collect()
#np.testing.assert_equal(read_keff_h5(db_file), read_keff_h5(db_exp_file))
np.testing.assert_equal(read_iso_m_h5(db_file), read_iso_m_h5(db_exp_file))

#def test_integration_3step_saltproc_no_reproc_heavy():
# simulation.runsim_no_reproc()
# def test_integration_3step_saltproc_no_reproc_heavy():
# simulation.runsim_constant_reproc()
# saltproc_out = sss_file + '_dep.m'
# dep_ser = serpent.parse_dep(directory+'/serpent_9d_dep.m', make_mats=False)
# dep_sp = serpent.parse_dep(saltproc_out, make_mats=False)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@


@pytest.mark.slow
# @pytest.mark.skip
@pytest.mark.skip
def test_integration_3step_saltproc_no_reproc_heavy():
simulation.runsim_no_reproc()
saltproc_out = sss_file + '_dep.m'
Expand Down

0 comments on commit 5f43c60

Please sign in to comment.