forked from crp/ecp-benchmarks
Merge pull request #11 from mit-crpg/shallow-clone
Shallow clone and bug fix
This commit is contained in:
commit
b7eeb8e96e
4 changed files with 40 additions and 33 deletions
|
|
@ -15,6 +15,13 @@ from smr.surfaces import lattice_pitch, bottom_fuel_stack, top_active_core
|
|||
from smr.core import core_geometry
|
||||
|
||||
|
||||
def clone(mat):
|
||||
"""Make a shallow copy of a material (sharing compositions)."""
|
||||
mat_copy = copy.copy(mat)
|
||||
mat_copy.id = None
|
||||
return mat_copy
|
||||
|
||||
|
||||
# Define command-line options
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('-m', '--multipole', action='store_true',
|
||||
|
|
@ -53,7 +60,7 @@ if args.tallies == 'mat':
|
|||
for cell in geometry.get_all_cells().values():
|
||||
if cell.fill in fuel_mats:
|
||||
# Fill cell with list of "differentiated" materials
|
||||
cell.fill = [cell.fill.clone() for i in range(cell.num_instances)]
|
||||
cell.fill = [clone(cell.fill) for i in range(cell.num_instances)]
|
||||
|
||||
#### Create OpenMC "materials.xml" file
|
||||
all_materials = geometry.get_all_materials()
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import openmc
|
|||
from openmc.model import subdivide
|
||||
|
||||
from .materials import mats
|
||||
from .surfaces import surfs, pellet_OR, bottom_fuel_rod, top_active_core
|
||||
from .surfaces import surfs, pellet_OR, bottom_fuel_stack, top_active_core
|
||||
|
||||
|
||||
def make_pin(name, surfaces, materials, grid=None):
|
||||
|
|
@ -703,7 +703,7 @@ def pin_universes(num_rings=10, num_axial=196, depleted=False):
|
|||
if num_axial > 1:
|
||||
# Determine z position between each fuel pellet, omitting the surfaces
|
||||
# corresponding to the very bottom and top of the active fuel length
|
||||
axial_splits = np.linspace(bottom_fuel_rod, top_active_core, num_axial + 1)[1:-1]
|
||||
axial_splits = np.linspace(bottom_fuel_stack, top_active_core, num_axial + 1)[1:-1]
|
||||
axial_surfs = [openmc.ZPlane(z0=z) for z in axial_splits]
|
||||
|
||||
if num_rings > 1:
|
||||
|
|
@ -711,7 +711,7 @@ def pin_universes(num_rings=10, num_axial=196, depleted=False):
|
|||
rings = []
|
||||
for i in range(1, num_rings):
|
||||
R = sqrt(i*pellet_OR**2/num_rings)
|
||||
cyl = openmc.ZCylinder(R=R, name='fuel ring {}'.format(i))
|
||||
cyl = openmc.ZCylinder(r=R, name='fuel ring {}'.format(i))
|
||||
rings.append(cyl)
|
||||
|
||||
def subdivided_fuel(fill):
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ def make_reflector(name, parameters):
|
|||
"""
|
||||
water_holes = []
|
||||
for x, y, r in parameters:
|
||||
zcyl = openmc.ZCylinder(x0=x, y0=y, R=r)
|
||||
zcyl = openmc.ZCylinder(x0=x, y0=y, r=r)
|
||||
hole = openmc.Cell(fill=mats['H2O'], region=-zcyl)
|
||||
water_holes.append(hole)
|
||||
|
||||
|
|
|
|||
|
|
@ -128,43 +128,43 @@ neutron_shield_NEtop_SWbot = tan(-pi/6)
|
|||
surfs = {}
|
||||
|
||||
surfs['pellet OR'] = openmc.ZCylinder(
|
||||
R=pellet_OR, name='Pellet OR')
|
||||
r=pellet_OR, name='Pellet OR')
|
||||
surfs['plenum spring OR'] = openmc.ZCylinder(
|
||||
R=plenum_spring_OR, name='FR Plenum Spring OR')
|
||||
r=plenum_spring_OR, name='FR Plenum Spring OR')
|
||||
surfs['clad IR'] = openmc.ZCylinder(
|
||||
R=clad_IR, name='Clad IR')
|
||||
r=clad_IR, name='Clad IR')
|
||||
surfs['clad OR'] = openmc.ZCylinder(
|
||||
R=clad_OR, name='Clad OR')
|
||||
r=clad_OR, name='Clad OR')
|
||||
surfs['GT IR'] = openmc.ZCylinder(
|
||||
R=guide_tube_IR, name='GT IR (above dashpot)')
|
||||
r=guide_tube_IR, name='GT IR (above dashpot)')
|
||||
surfs['GT OR'] = openmc.ZCylinder(
|
||||
R=guide_tube_OR, name='GT OR (above dashpot)')
|
||||
r=guide_tube_OR, name='GT OR (above dashpot)')
|
||||
surfs['GT dashpot IR'] = openmc.ZCylinder(
|
||||
R=guide_tube_dash_IR, name='GT IR (at dashpot)')
|
||||
r=guide_tube_dash_IR, name='GT IR (at dashpot)')
|
||||
surfs['GT dashpot OR'] = openmc.ZCylinder(
|
||||
R=guide_tube_dash_OR, name='GT OR (at dashpot)')
|
||||
r=guide_tube_dash_OR, name='GT OR (at dashpot)')
|
||||
surfs['CP OR'] = openmc.ZCylinder(
|
||||
R=boron_carbide_OR, name='Control Poison OR')
|
||||
r=boron_carbide_OR, name='Control Poison OR')
|
||||
surfs['CR IR'] = openmc.ZCylinder(
|
||||
R=control_rod_IR, name='CR Clad IR')
|
||||
r=control_rod_IR, name='CR Clad IR')
|
||||
surfs['CR OR'] = openmc.ZCylinder(
|
||||
R=control_rod_OR, name='CR Clad OR')
|
||||
r=control_rod_OR, name='CR Clad OR')
|
||||
surfs['BA IR 1'] = openmc.ZCylinder(
|
||||
R=burn_abs_r1, name='BA IR 1')
|
||||
r=burn_abs_r1, name='BA IR 1')
|
||||
surfs['BA IR 2'] = openmc.ZCylinder(
|
||||
R=burn_abs_r2, name='BA IR 2')
|
||||
r=burn_abs_r2, name='BA IR 2')
|
||||
surfs['BA IR 3'] = openmc.ZCylinder(
|
||||
R=burn_abs_r3, name='BA IR 3')
|
||||
r=burn_abs_r3, name='BA IR 3')
|
||||
surfs['BA IR 4'] = openmc.ZCylinder(
|
||||
R=burn_abs_r4, name='BA IR 4')
|
||||
r=burn_abs_r4, name='BA IR 4')
|
||||
surfs['BA IR 5'] = openmc.ZCylinder(
|
||||
R=burn_abs_r5, name='BA IR 5')
|
||||
r=burn_abs_r5, name='BA IR 5')
|
||||
surfs['BA IR 6'] = openmc.ZCylinder(
|
||||
R=burn_abs_r6, name='BA IR 6')
|
||||
r=burn_abs_r6, name='BA IR 6')
|
||||
surfs['BA IR 7'] = openmc.ZCylinder(
|
||||
R=burn_abs_r7, name='BA IR 7')
|
||||
r=burn_abs_r7, name='BA IR 7')
|
||||
surfs['BA IR 8'] = openmc.ZCylinder(
|
||||
R=burn_abs_r8, name='BA IR 8')
|
||||
r=burn_abs_r8, name='BA IR 8')
|
||||
surfs['IT IR'] = copy.deepcopy(surfs['BA IR 5'])
|
||||
surfs['IT OR'] = copy.deepcopy(surfs['BA IR 6'])
|
||||
|
||||
|
|
@ -245,31 +245,31 @@ surfs['bankD bot'] = openmc.ZPlane(
|
|||
|
||||
# outer radial surfaces
|
||||
surfs['core barrel IR'] = openmc.ZCylinder(
|
||||
R=core_barrel_IR, name='core barrel IR')
|
||||
r=core_barrel_IR, name='core barrel IR')
|
||||
surfs['core barrel OR'] = openmc.ZCylinder(
|
||||
R=core_barrel_OR, name='core barrel OR')
|
||||
r=core_barrel_OR, name='core barrel OR')
|
||||
surfs['neutron shield OR'] = openmc.ZCylinder(
|
||||
R=neutron_shield_OR, name='neutron shield OR')
|
||||
r=neutron_shield_OR, name='neutron shield OR')
|
||||
|
||||
# neutron shield planes
|
||||
surfs['neutron shield NWbot SEtop'] = openmc.Plane(
|
||||
A=1., B=neutron_shield_NWbot_SEtop, C=0., D=0.,
|
||||
a=1., b=neutron_shield_NWbot_SEtop, c=0., d=0.,
|
||||
name='neutron shield NWbot SEtop')
|
||||
surfs['neutron shield NWtop SEbot'] = openmc.Plane(
|
||||
A=1., B=neutron_shield_NWtop_SEbot, C=0., D=0.,
|
||||
a=1., b=neutron_shield_NWtop_SEbot, c=0., d=0.,
|
||||
name='neutron shield NWtop SEbot')
|
||||
surfs['neutron shield NEbot SWtop'] = openmc.Plane(
|
||||
A=1., B=neutron_shield_NEbot_SWtop, C=0., D=0.,
|
||||
a=1., b=neutron_shield_NEbot_SWtop, c=0., d=0.,
|
||||
name='neutron shield NEbot SWtop')
|
||||
surfs['neutron shield NEtop SWbot'] = openmc.Plane(
|
||||
A=1., B=neutron_shield_NEtop_SWbot, C=0., D=0.,
|
||||
a=1., b=neutron_shield_NEtop_SWbot, c=0., d=0.,
|
||||
name='neutron shield NEtop SWbot')
|
||||
|
||||
# outer radial surfaces
|
||||
surfs['RPV IR'] = openmc.ZCylinder(
|
||||
R=rpv_IR, name='RPV IR')
|
||||
r=rpv_IR, name='RPV IR')
|
||||
surfs['RPV OR'] = openmc.ZCylinder(
|
||||
R=rpv_OR, name='RPV OR', boundary_type='vacuum')
|
||||
r=rpv_OR, name='RPV OR', boundary_type='vacuum')
|
||||
|
||||
# outer axial surfaces
|
||||
surfs['upper bound'] = openmc.ZPlane(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue