Merge pull request #7 from nuclearkevin/modern_openmc
Updating the BEAVRS builder to use OpenMC's 0.15.0 Python API
This commit is contained in:
commit
788401bf24
4 changed files with 45 additions and 22 deletions
|
|
@ -50,7 +50,7 @@ class Assemblies(object):
|
|||
|
||||
# Rectangular prism around the edge of the pinlattice
|
||||
self.lattice_surfs = \
|
||||
openmc.rectangular_prism(17*c.pinPitch, 17*c.pinPitch)
|
||||
openmc.model.RectangularPrism(17*c.pinPitch, 17*c.pinPitch)
|
||||
|
||||
|
||||
def _add_assembly_surfs(self):
|
||||
|
|
@ -58,7 +58,7 @@ class Assemblies(object):
|
|||
|
||||
# Rectangular prism around the edge of the pinlattice
|
||||
self.assem_surfs = \
|
||||
openmc.rectangular_prism(c.latticePitch, c.latticePitch)
|
||||
openmc.model.RectangularPrism(c.latticePitch, c.latticePitch)
|
||||
|
||||
|
||||
def _add_bpra_layouts(self):
|
||||
|
|
@ -265,14 +265,14 @@ class Assemblies(object):
|
|||
|
||||
# Wrap the lattice with the grid sleeve universe
|
||||
u_lattice = InfinitePinCell(name='{0} universe'.format(name))
|
||||
u_lattice.add_ring(lattice, self.lattice_surfs, box=True)
|
||||
u_lattice.add_ring(lattice, -self.lattice_surfs, box=True)
|
||||
u_lattice.add_last_ring(self.pins.u_gridsleeve)
|
||||
self.u_fuel[enr][gt_label][center_label] = u_lattice
|
||||
u_lattice.finalize()
|
||||
|
||||
# Store the lattice without the gridsleeve
|
||||
u_latticePins = InfinitePinCell(name='{0} pins'.format(name))
|
||||
u_latticePins.add_ring(lattice, self.lattice_surfs, box=True)
|
||||
u_latticePins.add_ring(lattice, -self.lattice_surfs, box=True)
|
||||
u_latticePins.add_last_ring(self.mats['Borated Water'])
|
||||
self.u_fuel_no_sleeve[enr][gt_label][center_label] = u_latticePins
|
||||
u_latticePins.finalize()
|
||||
|
|
|
|||
|
|
@ -106,6 +106,9 @@ class BEAVRS(object):
|
|||
nuclides.append(openmc.Nuclide(nuc))
|
||||
self.depletion_nuclides = nuclides
|
||||
|
||||
# The OpenMC model container to be populated.
|
||||
self.model = openmc.Model()
|
||||
|
||||
def set_boron_ppm(self, ppm):
|
||||
self.mats = openmc_materials(ppm=ppm)
|
||||
|
||||
|
|
@ -116,12 +119,15 @@ class BEAVRS(object):
|
|||
materials_file = openmc.Materials(self.mats.values())
|
||||
materials_file.export_to_xml()
|
||||
|
||||
def get_openmc_plots(self):
|
||||
self.plots = Plots(self.mats)
|
||||
return openmc.Plots(self.plots.plots)
|
||||
|
||||
def write_openmc_plots(self):
|
||||
self.plots = Plots(self.mats)
|
||||
plot_file = openmc.Plots(self.plots.plots)
|
||||
plot_file.export_to_xml()
|
||||
self.get_openmc_plots().export_to_xml()
|
||||
|
||||
def write_openmc_settings(self):
|
||||
def get_openmc_settings_file(self):
|
||||
settings_file = openmc.Settings()
|
||||
settings_file.batches = self.settings_batches
|
||||
settings_file.inactive = self.settings_inactive
|
||||
|
|
@ -134,21 +140,41 @@ class BEAVRS(object):
|
|||
settings_file.dd_nodemap = self.dd_nodemap
|
||||
settings_file.dd_allow_leakage = self.dd_truncate
|
||||
settings_file.dd_count_interactions = self.dd_interactions
|
||||
settings_file.source = openmc.Source(space=openmc.stats.Box(
|
||||
settings_file.source = openmc.IndependentSource(space=openmc.stats.Box(
|
||||
self.settings_sourcebox[:3], self.settings_sourcebox[3:]))
|
||||
output = {'tallies': self.settings_output_tallies,
|
||||
'summary': self.settings_summary}
|
||||
settings_file.output = output
|
||||
settings_file.export_to_xml()
|
||||
return settings_file
|
||||
|
||||
def write_openmc_tallies(self):
|
||||
def write_openmc_settings(self):
|
||||
self.get_openmc_settings_file().export_to_xml()
|
||||
|
||||
def get_openmc_tallies_file(self):
|
||||
if len(self.tallies) == 0: return
|
||||
tallies_file = openmc.Tallies()
|
||||
for mesh in self.tally_meshes:
|
||||
tallies_file.add_mesh(mesh)
|
||||
for tally in self.tallies:
|
||||
tallies_file.append(tally)
|
||||
tallies_file.export_to_xml()
|
||||
return tallies_file
|
||||
|
||||
def write_openmc_tallies(self):
|
||||
if len(self.tallies) == 0: return
|
||||
self.get_openmc_tallies_file().export_to_xml()
|
||||
|
||||
def build_openmc_model(self):
|
||||
self.model = openmc.Model()
|
||||
self.model.geometry = self.openmc_geometry
|
||||
self.model.materials = openmc.Materials(self.mats.values())
|
||||
self.model.settings = self.get_openmc_settings_file()
|
||||
if len(self.tallies) != 0:
|
||||
self.model.tallies = self.get_openmc_tallies_file()
|
||||
self.model.plots = self.get_openmc_plots()
|
||||
return self.model
|
||||
|
||||
def write_openmc_model(self):
|
||||
self.build_openmc_model().export_to_model_xml()
|
||||
|
||||
def set_params(self, particles=None, batches=None, inactive=None):
|
||||
if particles: self.settings_particles = particles
|
||||
|
|
|
|||
|
|
@ -49,13 +49,13 @@ class Pincells(object):
|
|||
|
||||
# Rectangular prisms for grid spacers
|
||||
grid_surfs_tb = \
|
||||
openmc.rectangular_prism(c.rodGridSide_tb, c.rodGridSide_tb)
|
||||
openmc.model.RectangularPrism(c.rodGridSide_tb, c.rodGridSide_tb)
|
||||
grid_surfs_i = \
|
||||
openmc.rectangular_prism(c.rodGridSide_i, c.rodGridSide_i)
|
||||
openmc.model.RectangularPrism(c.rodGridSide_i, c.rodGridSide_i)
|
||||
|
||||
# Rectangular prisms for lattice grid sleeves
|
||||
grid_surfs_ass = \
|
||||
openmc.rectangular_prism(c.gridstrapSide, c.gridstrapSide)
|
||||
openmc.model.RectangularPrism(c.gridstrapSide, c.gridstrapSide)
|
||||
|
||||
# Grids axial surfaces
|
||||
|
||||
|
|
@ -79,22 +79,22 @@ class Pincells(object):
|
|||
# Grids pincell universes
|
||||
|
||||
self.u_grid_i = InfinitePinCell(name='Intermediate grid pincell')
|
||||
self.u_grid_i.add_ring(self.mats['Borated Water'], grid_surfs_i, box=True)
|
||||
self.u_grid_i.add_ring(self.mats['Borated Water'], -grid_surfs_i, box=True)
|
||||
self.u_grid_i.add_last_ring(self.mats['Zircaloy 4'])
|
||||
self.u_grid_i.finalize()
|
||||
|
||||
self.u_grid_tb = InfinitePinCell(name='Top/Bottom grid pincell')
|
||||
self.u_grid_tb.add_ring(self.mats['Borated Water'], grid_surfs_tb, box=True)
|
||||
self.u_grid_tb.add_ring(self.mats['Borated Water'], -grid_surfs_tb, box=True)
|
||||
self.u_grid_tb.add_last_ring(self.mats['Inconel 718'])
|
||||
self.u_grid_tb.finalize()
|
||||
|
||||
self.u_grid_sleeve_i = InfinitePinCell(name='Intermediate grid sleeve pincell')
|
||||
self.u_grid_sleeve_i.add_ring(self.mats['Zircaloy 4'], grid_surfs_ass, box=True)
|
||||
self.u_grid_sleeve_i.add_ring(self.mats['Zircaloy 4'], -grid_surfs_ass, box=True)
|
||||
self.u_grid_sleeve_i.add_last_ring(self.mats['Borated Water'])
|
||||
self.u_grid_sleeve_i.finalize()
|
||||
|
||||
self.u_grid_sleeve_tb = InfinitePinCell(name='Top/Bottom grid sleeve pincell')
|
||||
self.u_grid_sleeve_tb.add_ring( self.mats['Inconel 718'], grid_surfs_ass, box=True)
|
||||
self.u_grid_sleeve_tb.add_ring( self.mats['Inconel 718'], -grid_surfs_ass, box=True)
|
||||
self.u_grid_sleeve_tb.add_last_ring(self.mats['Borated Water'])
|
||||
self.u_grid_sleeve_tb.finalize()
|
||||
|
||||
|
|
|
|||
|
|
@ -23,8 +23,5 @@ if not len(args) == 0:
|
|||
p.print_help()
|
||||
|
||||
b = BEAVRS(is_symmetric=options.is_symmetric, is_2d=options.is_2d)
|
||||
b.write_openmc_geometry()
|
||||
b.write_openmc_materials()
|
||||
b.write_openmc_plots()
|
||||
b.write_openmc_settings()
|
||||
b.write_openmc_model()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue