Skip to content
Open
Show file tree
Hide file tree
Changes from 15 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
24 changes: 24 additions & 0 deletions openmc_models/bcc_phys/corewise/0days/bcc_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import openmc
import openmc.deplete
import numpy as np

ucot = openmc.Material(name='UCO_TRACKED', material_id=14)
ucot.set_density('g/cm3', 10.4)
ucot.add_nuclide("U235", 0.1386, percent_type='wo')
ucot.add_nuclide("U238",0.7559, percent_type='wo')
ucot.add_element("O", 0.06025, percent_type='wo')
ucot.add_element('C', 0.04523, percent_type='wo')
ucot.add_s_alpha_beta('c_Graphite')
ucot.depletable = True
ucot.temperature = 1159.15 #K

materials = openmc.Materials.from_xml('../materials.xml')
materials.append(ucot)
geometry = openmc.Geometry.from_xml("../geometry.xml", materials)
settings = openmc.Settings.from_xml('../settings.xml')
tallies = openmc.Tallies.from_xml('../tallies.xml')

model = openmc.model.Model(geometry, materials, settings, tallies)
model.export_to_model_xml()

openmc.run()
34 changes: 34 additions & 0 deletions openmc_models/bcc_phys/corewise/1249days/bcc_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import openmc
import openmc.deplete
import numpy as np

dep_file = '../i4-dep-res.h5'
mat_file = '../i4-mats.xml'
res = openmc.deplete.Results(dep_file)
dep_t = res.get_times()
step_comps = [res.export_to_materials(i,
path=mat_file)[0].get_nuclide_densities()
for i in range(len(dep_t))]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this indentation right?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes - the second line is still part of the 'export_to_materials' term


comp1249days = {}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the name of this variable the only thing that's different between these various bcc_model.py files?
If so, maybe the number of days can be a input variable for this script and we could instead have many fewer bcc_model.py files in the repo ... Maybe that's not helpful, but it's always worth thinking about how to avoid replicated code (because replicated code replicates bugs -- see Robert C. Martin, Clean Code).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the depletion step the compositions are based on are different each time, which is why I redefine that single material each time. Materials that all the bcc models share are made by the gen_inputs script one level up, then pulled in here. That way, the full list of materials can be used by the openmc model when the geometry information is read in.

for k, v in step_comps[40].items():
comp1249days[k] = {}
comp1249days[k] = v[1]

ucot = openmc.Material(name='UCO_TRACKED', material_id=14)
ucot.set_density('g/cm3', 10.4)
ucot.add_components(comp1249days, percent_type = 'ao')
ucot.add_s_alpha_beta('c_Graphite')
ucot.depletable = True
ucot.temperature = 1159.15 #K

materials = openmc.Materials.from_xml('../materials.xml')
materials.append(ucot)
geometry = openmc.Geometry.from_xml("../geometry.xml", materials)
settings = openmc.Settings.from_xml('../settings.xml')
tallies = openmc.Tallies.from_xml('../tallies.xml')

model = openmc.model.Model(geometry, materials, settings, tallies)
model.export_to_model_xml()

openmc.run()
34 changes: 34 additions & 0 deletions openmc_models/bcc_phys/corewise/1549days/bcc_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import openmc
import openmc.deplete
import numpy as np

dep_file = '../i4-dep-res.h5'
mat_file = '../i4-mats.xml'
res = openmc.deplete.Results(dep_file)
dep_t = res.get_times()
step_comps = [res.export_to_materials(i,
path=mat_file)[0].get_nuclide_densities()
for i in range(len(dep_t))]

comp1549days = {}
for k, v in step_comps[-1].items():
comp1549days[k] = {}
comp1549days[k] = v[1]

ucot = openmc.Material(name='UCO_TRACKED', material_id=14)
ucot.set_density('g/cm3', 10.4)
ucot.add_components(comp1549days, percent_type = 'ao')
ucot.add_s_alpha_beta('c_Graphite')
ucot.depletable = True
ucot.temperature = 1159.15 #K

materials = openmc.Materials.from_xml('../materials.xml')
materials.append(ucot)
geometry = openmc.Geometry.from_xml("../geometry.xml", materials)
settings = openmc.Settings.from_xml('../settings.xml')
tallies = openmc.Tallies.from_xml('../tallies.xml')

model = openmc.model.Model(geometry, materials, settings, tallies)
model.export_to_model_xml()

openmc.run()
34 changes: 34 additions & 0 deletions openmc_models/bcc_phys/corewise/249days/bcc_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import openmc
import openmc.deplete
import numpy as np

dep_file = '../i4-dep-res.h5'
mat_file = '../i4-mats.xml'
res = openmc.deplete.Results(dep_file)
dep_t = res.get_times()
step_comps = [res.export_to_materials(i,
path=mat_file)[0].get_nuclide_densities()
for i in range(len(dep_t))]

comp249days = {}
for k, v in step_comps[18].items():
comp249days[k] = {}
comp249days[k] = v[1]

ucot = openmc.Material(name='UCO_TRACKED', material_id=14)
ucot.set_density('g/cm3', 10.4)
ucot.add_components(comp249days, percent_type = 'ao')
ucot.add_s_alpha_beta('c_Graphite')
ucot.depletable = True
ucot.temperature = 1159.15 #K

materials = openmc.Materials.from_xml('../materials.xml')
materials.append(ucot)
geometry = openmc.Geometry.from_xml("../geometry.xml", materials)
settings = openmc.Settings.from_xml('../settings.xml')
tallies = openmc.Tallies.from_xml('../tallies.xml')

model = openmc.model.Model(geometry, materials, settings, tallies)
model.export_to_model_xml()

openmc.run()
36 changes: 36 additions & 0 deletions openmc_models/bcc_phys/corewise/499days/bcc_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import openmc
import openmc.deplete
import numpy as np

dep_file = '../i4-dep-res.h5'
mat_file = '../i4-mats.xml'
res = openmc.deplete.Results(dep_file)
dep_t = res.get_times()
step_comps = [res.export_to_materials(i,
path=mat_file)[0].get_nuclide_densities()
for i in range(len(dep_t))]

comp499days = {}
for k, v in step_comps[25].items():
comp499days[k] = {}
comp499days[k] = v[1]

ucot = openmc.Material(name='UCO_TRACKED', material_id=14)
ucot.set_density('g/cm3', 10.4)
ucot.add_components(comp499days, percent_type = 'ao')
ucot.add_s_alpha_beta('c_Graphite')
ucot.depletable = True
ucot.temperature = 1159.15 #K

materials = openmc.Materials.from_xml('../materials.xml')
materials.append(ucot)
geometry = openmc.Geometry.from_xml("../geometry.xml", materials)
settings = openmc.Settings.from_xml('../settings.xml')
tallies = openmc.Tallies.from_xml('../tallies.xml')

model = openmc.model.Model(geometry, materials, settings, tallies)
model.export_to_model_xml()

openmc.run()


34 changes: 34 additions & 0 deletions openmc_models/bcc_phys/corewise/749days/bcc_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import openmc
import openmc.deplete
import numpy as np

dep_file = '../i4-dep-res.h5'
mat_file = '../i4-mats.xml'
res = openmc.deplete.Results(dep_file)
dep_t = res.get_times()
step_comps = [res.export_to_materials(i,
path=mat_file)[0].get_nuclide_densities()
for i in range(len(dep_t))]

comp749days = {}
for k, v in step_comps[30].items():
comp749days[k] = {}
comp749days[k] = v[1]

ucot = openmc.Material(name='UCO_TRACKED', material_id=14)
ucot.set_density('g/cm3', 10.4)
ucot.add_components(comp749days, percent_type = 'ao')
ucot.add_s_alpha_beta('c_Graphite')
ucot.depletable = True
ucot.temperature = 1159.15 #K

materials = openmc.Materials.from_xml('../materials.xml')
materials.append(ucot)
geometry = openmc.Geometry.from_xml("../geometry.xml", materials)
settings = openmc.Settings.from_xml('../settings.xml')
tallies = openmc.Tallies.from_xml('../tallies.xml')

model = openmc.model.Model(geometry, materials, settings, tallies)
model.export_to_model_xml()

openmc.run()
34 changes: 34 additions & 0 deletions openmc_models/bcc_phys/corewise/999days/bcc_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import openmc
import openmc.deplete
import numpy as np

dep_file = '../i4-dep-res.h5'
mat_file = '../i4-mats.xml'
res = openmc.deplete.Results(dep_file)
dep_t = res.get_times()
step_comps = [res.export_to_materials(i,
path=mat_file)[0].get_nuclide_densities()
for i in range(len(dep_t))]

comp999days = {}
for k, v in step_comps[35].items():
comp999days[k] = {}
comp999days[k] = v[1]

ucot = openmc.Material(name='UCO_TRACKED', material_id=14)
ucot.set_density('g/cm3', 10.4)
ucot.add_components(comp999days, percent_type = 'ao')
ucot.add_s_alpha_beta('c_Graphite')
ucot.depletable = True
ucot.temperature = 1159.15 #K

materials = openmc.Materials.from_xml('../materials.xml')
materials.append(ucot)
geometry = openmc.Geometry.from_xml("../geometry.xml", materials)
settings = openmc.Settings.from_xml('../settings.xml')
tallies = openmc.Tallies.from_xml('../tallies.xml')

model = openmc.model.Model(geometry, materials, settings, tallies)
model.export_to_model_xml()

openmc.run()
Loading