Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hardcoded material temperatures #154

Closed
wants to merge 6 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions saltproc/depcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@ def __init__(self,
active_cycles,
inactive_cycles)

self.fix_dict = {}

def change_sim_par(self, template_data):
"""Finds simulation parameters (neutron population, cycles) in the
Serpent2 template file and change them to the parameters from the
Expand Down Expand Up @@ -246,6 +248,20 @@ def change_sim_par(self, template_data):
self.inactive_cycles)
return [s.replace(sim_param[0], args) for s in template_data]

def create_fix_dict(self):
""" Creates dictionary of material names to the value of their 'fix' card as well as
library information for decay-only nuclides"""
mat_data = self.read_plaintext_file(self.iter_matfile)
mat_cards = [s for s in mat_data if s.startswith("mat ")]
for mat_card in mat_cards:
mat_name = mat_card.split()[1]
fix_regex = "\s+fix\s+[a-zA-Z0-9]+\s+[0-9]+(\.[0-9]+)?"
fix_match = re.search(fix_regex, mat_card)
if bool(fix_match):
fix_params = fix_match.group(0).split()[1:]
fix_params[1] = float(fix_params[1])
self.fix_dict.update({mat_name: fix_params})

def create_iter_matfile(self, template_data):
"""Finds ``include`` line with path to material file, copies content of
this file to iteration material file, changes path in ``include`` line
Expand Down Expand Up @@ -441,6 +457,7 @@ def read_dep_comp(self, read_at_end=False):
mats[m].density = dep['MAT_' + m + '_MDENS'][-1, moment]
mats[m].mass = mats[m].density * volume
mats[m].vol = volume
mats[m].temp = self.fix_dict[m][1]
mats[m].burnup = dep['MAT_' + m + '_BURNUP'][moment]
self.create_nuclide_name_map_zam_to_serpent()
return mats
Expand Down Expand Up @@ -670,6 +687,7 @@ def write_depcode_input(
data = self.insert_path_to_geometry(data)
data = self.change_sim_par(data)
data = self.create_iter_matfile(data)
self.create_fix_dict()
else:
data = self.read_plaintext_file(self.iter_inputfile)
data = self.replace_burnup_parameters(data, reactor, dep_step)
Expand Down Expand Up @@ -705,8 +723,8 @@ def write_mat_file(self, dep_dict, dep_end_time):
matf.write('mat %s %5.9E burn 1 fix %3s %4i vol %7.5E\n' %
(key,
-dep_dict[key].density,
'09c',
dep_dict[key].temp,
self.fix_dict[key][0],
self.fix_dict[key][1],
dep_dict[key].vol))
for nuc_code, wt_frac in dep_dict[key].comp.items():
# Transforms iso name from zas to zzaaam and then to SERPENT
Expand Down