def _create_geometry(self): """Instantiate materials and a pin cell Geometry.""" self.input_set.create_materials() zcylinder = openmoc.ZCylinder(x=0.0, y=0.0, radius=1.0, name='pin') xmin = openmoc.XPlane(x=-2.0, name='xmin') xmax = openmoc.XPlane(x=+2.0, name='xmax') ymin = openmoc.YPlane(y=-2.0, name='ymin') ymax = openmoc.YPlane(y=+2.0, name='ymax') xmin.setBoundaryType(openmoc.VACUUM) xmax.setBoundaryType(openmoc.VACUUM) ymin.setBoundaryType(openmoc.VACUUM) ymax.setBoundaryType(openmoc.VACUUM) fuel = openmoc.Cell(name='fuel') fuel.setFill(self.input_set.materials['UO2']) fuel.addSurface(halfspace=-1, surface=zcylinder) moderator = openmoc.Cell(name='moderator') moderator.setFill(self.input_set.materials['Water']) moderator.addSurface(halfspace=+1, surface=zcylinder) moderator.addSurface(halfspace=+1, surface=xmin) moderator.addSurface(halfspace=-1, surface=xmax) moderator.addSurface(halfspace=+1, surface=ymin) moderator.addSurface(halfspace=-1, surface=ymax) root_universe = openmoc.Universe(name='root universe') root_universe.addCell(fuel) root_universe.addCell(moderator) self.input_set.geometry = openmoc.Geometry() self.input_set.geometry.setRootUniverse(root_universe)
def test_ids(self): openmoc.reset_material_id() material_2 = openmoc.Cell() self.assertEqual(material_2.getId(), 1000000) openmoc.maximize_material_id(10000000) material_3 = openmoc.Cell() self.assertEqual(material_3.getId(), 1000001) self.test_material.printString()
def test_ids(self): openmoc.reset_cell_id() cell_2 = openmoc.Cell() self.assertEqual(cell_2.getId(), 1000000) openmoc.maximize_cell_id(10000000) cell_3 = openmoc.Cell() self.assertEqual(cell_3.getId(), 10000000) self.cell.printString()
def _create_geometry(self): """Put a box source in the cube.""" self.input_set.create_materials() self.input_set.create_geometry() # Get the root Cell cells = self.input_set.geometry.getAllCells() for cell_id in cells: cell = cells[cell_id] if cell.getName() == 'root cell': root_cell = cell # Apply VACUUM BCs on all bounding surfaces surfaces = root_cell.getSurfaces() for surface_id in surfaces: surface = surfaces[surface_id]._surface surface.setBoundaryType(openmoc.VACUUM) # Replace fissionable infinite medium material with C5G7 water self.materials = \ openmoc.materialize.load_from_hdf5(filename='c5g7-mgxs.h5', directory='../../sample-input/') lattice = openmoc.castUniverseToLattice(root_cell.getFillUniverse()) num_x = lattice.getNumX() num_y = lattice.getNumY() width_x = lattice.getWidthX() width_y = lattice.getWidthY() # Create cells filled with water to put in Lattice water_cell = openmoc.Cell(name='water') water_cell.setFill(self.materials['Water']) water_univ = openmoc.Universe(name='water') water_univ.addCell(water_cell) self.source_cell = openmoc.Cell(name='source') self.source_cell.setFill(self.materials['Water']) source_univ = openmoc.Universe(name='source') source_univ.addCell(self.source_cell) # Create 2D array of Universes in each lattice cell universes = [[[water_univ]*num_x for _ in range(num_y)]] # Place fixed source Universe at (x=0.5, y=0.5) source_x = 0.5 source_y = 0.5 lat_x = (root_cell.getMaxX() - source_x) / width_x lat_y = (root_cell.getMaxY() - source_y) / width_y universes[0][int(lat_x)][int(lat_y)] = source_univ # Create a new Lattice for the Universes lattice = openmoc.Lattice(name='{0}x{1} lattice'.format(num_x, num_y)) lattice.setWidth(width_x=width_x, width_y=width_y) lattice.setUniverses(universes) root_cell.setFill(lattice)
def create_geometry(self): """Instantiate a 3x2 grid Geometry by making a lattice""" # Create the planes bounding the geometry xmin = openmoc.XPlane(x=-3.0, name='xmin') xmax = openmoc.XPlane(x=3.0, name='xmax') ymin = openmoc.YPlane(y=-2.0, name='ymin') ymax = openmoc.YPlane(y=2.0, name='ymax') xmin.setBoundaryType(openmoc.REFLECTIVE) xmax.setBoundaryType(openmoc.REFLECTIVE) ymin.setBoundaryType(openmoc.REFLECTIVE) ymax.setBoundaryType(openmoc.REFLECTIVE) # Create the root cell, bounded by the geometry bounds root_cell = openmoc.Cell(name='root cell') root_cell.addSurface(halfspace=+1, surface=xmin) root_cell.addSurface(halfspace=-1, surface=xmax) root_cell.addSurface(halfspace=+1, surface=ymin) root_cell.addSurface(halfspace=-1, surface=ymax) # Create UO2, water, and tube cells uo2_cell = openmoc.Cell(name='UO2 Cell') uo2_cell.setFill(self.materials['UO2']) water_cell = openmoc.Cell(name='Water Cell') water_cell.setFill(self.materials['Water']) tube_cell = openmoc.Cell(name='Tube Cell') tube_cell.setFill(self.materials['Guide Tube']) # Create universes and fill with the associated cell root_universe = openmoc.Universe(name='root universe') root_universe.addCell(root_cell) uo2 = openmoc.Universe(name='uo2 universe') uo2.addCell(uo2_cell) water = openmoc.Universe(name='water universe') water.addCell(water_cell) tube = openmoc.Universe(name='tube universe') tube.addCell(tube_cell) # Create the lattice and fill it with the appropriate universes lattice = openmoc.Lattice(name='3x2 lattice') lattice.setWidth(width_x=2.0, width_y=2.0) lattice.setUniverses([[[uo2, tube, water], [water, uo2, tube]]]) root_cell.setFill(lattice) self.geometry = openmoc.Geometry() self.geometry.setRootUniverse(root_universe) super(OblongLatticeGridInput, self).create_geometry()
def __init__(self): # define fuel assembly basic parameters # CellFills for the assembly self.assembly1_cell = openmoc.Cell(name='Fuel Assembly') self.assembly1 = openmoc.Universe(name='Fuel Assembly') self.assembly1.addCell(self.assembly1_cell) # A mixed enrichment PWR MOX fuel assembly self.assembly = openmoc.Lattice(name='UOX Assembly') self.assembly.setWidth(width_x=1.26, width_y=1.26) # Create a template to map to pin cell types self.template = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 4, 1, 1, 4, 1, 1, 4, 1, 1, 1, 1, 1], [1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 4, 1, 1, 4, 1, 1, 4, 1, 1, 4, 1, 1, 4, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 4, 1, 1, 4, 1, 1, 1, 1, 1, 4, 1, 1, 4, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 4, 1, 1, 4, 1, 1, 4, 1, 1, 4, 1, 1, 4, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1], [1, 1, 1, 1, 1, 4, 1, 1, 4, 1, 1, 4, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]] self.root_cell = [] self.root_universe = []
def setRootUniverse(self, boundary): # Root Cell self.root_cell = openmoc.Cell(name='Full Geometry') self.root_cell.setFill(self.assembly) self.root_cell.setRegion(boundary) # Root Universe self.root_universe = openmoc.Universe(name='Root Universe') self.root_universe.addCell(self.root_cell)
def get_openmoc_cell(opencg_cell): """Return an OpenMOC cell corresponding to an OpenCG cell. Parameters ---------- opencg_cell : opencg.Cell OpenCG cell Returns ------- openmoc_cell : openmoc.Cell Equivalent OpenMOC cell """ cv.check_type('openmoc_cell', opencg_cell, opencg.Cell) global OPENMOC_CELLS cell_id = opencg_cell.id # If this Cell was already created, use it if cell_id in OPENMOC_CELLS: return OPENMOC_CELLS[cell_id] # Create an OpenMOC Cell to represent this OpenCG Cell name = str(opencg_cell.name) openmoc_cell = openmoc.Cell(cell_id, name) fill = opencg_cell.fill if opencg_cell.type == 'universe': openmoc_cell.setFill(get_openmoc_universe(fill)) elif opencg_cell.type == 'lattice': openmoc_cell.setFill(get_openmoc_lattice(fill)) else: openmoc_cell.setFill(get_openmoc_material(fill)) if opencg_cell.rotation is not None: rotation = np.asarray(opencg_cell.rotation, dtype=np.float64) openmoc_cell.setRotation(rotation) if opencg_cell.translation is not None: translation = np.asarray(opencg_cell.translation, dtype=np.float64) openmoc_cell.setTranslation(translation) surfaces = opencg_cell.surfaces for surface_id in surfaces: surface = surfaces[surface_id][0] halfspace = int(surfaces[surface_id][1]) openmoc_cell.addSurface(halfspace, get_openmoc_surface(surface)) # Add the OpenMOC Cell to the global collection of all OpenMOC Cells OPENMOC_CELLS[cell_id] = openmoc_cell # Add the OpenCG Cell to the global collection of all OpenCG Cells OPENCG_CELLS[cell_id] = opencg_cell return openmoc_cell
def _to_openmoc_universe(self, name=""): if name: mesh_name = "x".join(np.array(self.division, dtype=str)) name += " (subdivided " + mesh_name + ")" uout = openmoc.Universe(name=name) cout = openmoc.Cell() cout.setFill(self) uout.addCell(cout) return uout
def create_geometry(self): """Instantiate a 4x4 pin cell lattice Geometry.""" xmin = openmoc.XPlane(x=-2.0, name='xmin') xmax = openmoc.XPlane(x=+2.0, name='xmax') ymin = openmoc.YPlane(y=-2.0, name='ymin') ymax = openmoc.YPlane(y=+2.0, name='ymax') boundaries = [xmin, xmax, ymin, ymax] if (self.dimensions == 3): zmin = openmoc.ZPlane(z=-2.0, name='zmin') zmax = openmoc.ZPlane(z=+2.0, name='zmax') boundaries = [xmin, xmax, ymin, ymax, zmin, zmax] for boundary in boundaries: boundary.setBoundaryType(openmoc.REFLECTIVE) if (self.dimensions == 3): boundaries[-1].setBoundaryType(openmoc.VACUUM) lat = self.create_lattice() root_cell = openmoc.Cell(name='root cell') root_cell.addSurface(halfspace=+1, surface=boundaries[0]) root_cell.addSurface(halfspace=-1, surface=boundaries[1]) root_cell.addSurface(halfspace=+1, surface=boundaries[2]) root_cell.addSurface(halfspace=-1, surface=boundaries[3]) if (self.dimensions == 3): root_cell.addSurface(halfspace=+1, surface=boundaries[4]) root_cell.addSurface(halfspace=-1, surface=boundaries[5]) lattice_cell = openmoc.Cell(name='lattice cell') assembly = openmoc.Universe(name='2x2 lattice') root_universe = openmoc.Universe(name='root universe') assembly.addCell(lattice_cell) root_universe.addCell(root_cell) lattice_cell.setFill(lat) # 2x2 core core = openmoc.Lattice(name='2x2 core') core.setWidth(width_x=2.0, width_y=2.0) core.setUniverses([[[assembly, assembly], [assembly, assembly]]]) root_cell.setFill(core) self.geometry = openmoc.Geometry() self.geometry.setRootUniverse(root_universe) super(SimplerLatticeInput, self).create_geometry()
def create_geometry(self): """Instantiate an infinite medium lattice Geometry.""" length = 2.5 num_cells_x = 10 num_cells_y = 10 xmin = openmoc.XPlane(x=-length / 2., name='xmin') xmax = openmoc.XPlane(x=+length / 2., name='xmax') ymin = openmoc.YPlane(y=-length / 2., name='ymin') ymax = openmoc.YPlane(y=+length / 2., name='ymax') xmax.setBoundaryType(openmoc.REFLECTIVE) xmin.setBoundaryType(openmoc.REFLECTIVE) ymin.setBoundaryType(openmoc.REFLECTIVE) ymax.setBoundaryType(openmoc.REFLECTIVE) fill = openmoc.Cell(name='fill') fill.setFill(self.materials['infinite medium']) root_cell = openmoc.Cell(name='root cell') root_cell.addSurface(halfspace=+1, surface=xmin) root_cell.addSurface(halfspace=-1, surface=xmax) root_cell.addSurface(halfspace=+1, surface=ymin) root_cell.addSurface(halfspace=-1, surface=ymax) fill_universe = openmoc.Universe(name='homogeneous fill cell') fill_universe.addCell(fill) root_universe = openmoc.Universe(name='root universe') root_universe.addCell(root_cell) lattice = openmoc.Lattice(name='MxN lattice') lattice.setWidth(width_x=length / num_cells_x, width_y=length / num_cells_y) lattice.setUniverses([[[fill_universe] * num_cells_x] * num_cells_y]) root_cell.setFill(lattice) self.geometry = openmoc.Geometry() self.geometry.setRootUniverse(root_universe) super(HomInfMedInput, self).create_geometry()
def get_openmoc_cell(openmc_cell): """Return an OpenMOC cell corresponding to an OpenMC cell. Parameters ---------- openmc_cell : openmc.Cell OpenMC cell Returns ------- openmoc_cell : openmoc.Cell Equivalent OpenMOC cell """ cv.check_type('openmc_cell', openmc_cell, openmc.Cell) cell_id = openmc_cell.id # If this Cell was already created, use it if cell_id in OPENMOC_CELLS: return OPENMOC_CELLS[cell_id] # Create an OpenMOC Cell to represent this OpenMC Cell name = openmc_cell.name openmoc_cell = openmoc.Cell(cell_id, name) fill = openmc_cell.fill if openmc_cell.fill_type == 'material': openmoc_cell.setFill(get_openmoc_material(fill)) elif openmc_cell.fill_type == 'universe': openmoc_cell.setFill(get_openmoc_universe(fill)) else: openmoc_cell.setFill(get_openmoc_lattice(fill)) if openmc_cell.rotation is not None: rotation = np.asarray(openmc_cell.rotation, dtype=np.float64) openmoc_cell.setRotation(rotation) if openmc_cell.translation is not None: translation = np.asarray(openmc_cell.translation, dtype=np.float64) openmoc_cell.setTranslation(translation) # Convert OpenMC's cell region to an equivalent OpenMOC region if openmc_cell.region is not None: openmoc_cell.setRegion(get_openmoc_region(openmc_cell.region)) # Add the OpenMC Cell to the global collection of all OpenMC Cells OPENMC_CELLS[cell_id] = openmc_cell # Add the OpenMOC Cell to the global collection of all OpenMOC Cells OPENMOC_CELLS[cell_id] = openmoc_cell return openmoc_cell
def setUp(self): self.lattice = openmoc.Lattice(id=12, name="test lattice") u1 = openmoc.Universe(name='Universe 1') self.universe = u1 u2 = openmoc.Universe(name='Universe 2') u3 = openmoc.Universe(name='Universe 3') self.lattice.setUniverses([[[u1, u2, u1, u2], [u2, u3, u2, u3], [u1, u2, u1, u2], [u2, u3, u2, u3]], [[u1, u2, u1, u2], [u2, u3, u2, u3], [u1, u2, u1, u2], [u2, u3, u2, u3]]]) self.cell = openmoc.Cell(name="test cell") self.lattice.addCell(self.cell)
def get_openmoc_cell(opencg_cell): if not isinstance(opencg_cell, opencg.Cell): msg = 'Unable to create an OpenMOC Cell from {0} which ' \ 'is not an OpenCG Cell'.format(opencg_cell) raise ValueError(msg) global OPENMOC_CELLS cell_id = opencg_cell._id # If this Cell was already created, use it if cell_id in OPENMOC_CELLS: return OPENMOC_CELLS[cell_id] # Create an OpenMOC Cell to represent this OpenCG Cell name = opencg_cell._name fill = opencg_cell._fill openmoc_cell = openmoc.Cell(cell_id, name) if opencg_cell._type == 'universe': openmoc_cell.setFill(get_openmoc_universe(fill)) elif opencg_cell._type == 'lattice': openmoc_cell.setFill(get_openmoc_lattice(fill)) else: openmoc_cell.setFill(get_openmoc_material(fill)) surfaces = opencg_cell._surfaces for surface_id in surfaces: surface = surfaces[surface_id][0] halfspace = int(surfaces[surface_id][1]) openmoc_cell.addSurface(halfspace, get_openmoc_surface(surface)) # Add the OpenMOC Cell to the global collection of all OpenMOC Cells OPENMOC_CELLS[cell_id] = openmoc_cell # Add the OpenCG Cell to the global collection of all OpenCG Cells OPENCG_CELLS[cell_id] = opencg_cell # FIXME openmoc_cell.thisown = 0 return openmoc_cell
def create_geometry(self): """Instantiate a 3x3 grid Geometry.""" # Create the planes that bound the cell and geometry xplanes = [None] * 4 yplanes = [None] * 4 for i in range(4): val = -3.0 + 6.0/3 * i xplanes[i] = openmoc.XPlane(x=val, name='xplane' + str(i)) yplanes[i] = openmoc.YPlane(y=val, name='yplane' + str(i)) xplanes[0].setBoundaryType(openmoc.REFLECTIVE) xplanes[-1].setBoundaryType(openmoc.REFLECTIVE) yplanes[0].setBoundaryType(openmoc.REFLECTIVE) yplanes[-1].setBoundaryType(openmoc.REFLECTIVE) # Create the cells and set the central cell to UO2, the rest as water cells = [[None]*3 for i in range(3)] for i in range(3): for j in range(3): cells[i][j] = openmoc.Cell(name='Cell ' + str(3*i+j)) if i == 1 and j == 1: cells[i][j].setFill(self.materials['UO2']) else: cells[i][j].setFill(self.materials['Water']) cells[i][j].addSurface(halfspace=+1, surface=xplanes[i]) cells[i][j].addSurface(halfspace=-1, surface=xplanes[i+1]) cells[i][j].addSurface(halfspace=+1, surface=yplanes[j]) cells[i][j].addSurface(halfspace=-1, surface=yplanes[j+1]) # Add the cells to the universe root_universe = openmoc.Universe(name='root universe') for i in range(3): for j in range(3): root_universe.addCell(cells[i][j]) self.geometry = openmoc.Geometry() self.geometry.setRootUniverse(root_universe) super(GridInput, self).create_geometry()
def _subdivide2d(self, target): nx, ny = self.division dx, dy = self.deltas x0 = nx * dx / 2 y0 = -ny * dy / 2 universes = [[None for _ in range(nx)] for _ in range(ny)] # for 2D, no translation in z tz = 0 for j in range(ny): # translation in y ty = y0 + dy * (j + .5) for i in range(nx): # translation in x tx = x0 - dx * (i + .5) t_vector = np.array([tx, ty, tz]) cell = openmoc.Cell() cell.setFill(target) cell.setTranslation(t_vector) univ = openmoc.Universe() univ.addCell(cell) universes[j][i] = univ self.setUniverses([universes]) return self._to_openmoc_universe(name=target.getName())
zmax.setBoundaryType(openmoc.REFLECTIVE) large_zcylinder = openmoc.ZCylinder(x=0.0, y=0.0, radius=0.4, name='large pin') medium_zcylinder = openmoc.ZCylinder(x=0.0, y=0.0, radius=0.3, name='medium pin') small_zcylinder = openmoc.ZCylinder(x=0.0, y=0.0, radius=0.2, name='small pin') ############################################################################### ############################# Creating Cells ############################## ############################################################################### log.py_printf('NORMAL', 'Creating cells...') large_fuel = openmoc.Cell() large_fuel.setFill(materials['UO2']) large_fuel.addSurface(halfspace=-1, surface=large_zcylinder) large_moderator = openmoc.Cell() large_moderator.setFill(materials['Water']) large_moderator.addSurface(halfspace=+1, surface=large_zcylinder) medium_fuel = openmoc.Cell() medium_fuel.setFill(materials['UO2']) medium_fuel.addSurface(halfspace=-1, surface=medium_zcylinder) medium_moderator = openmoc.Cell() medium_moderator.setFill(materials['Water']) medium_moderator.addSurface(halfspace=+1, surface=medium_zcylinder)
def setUp(self): self.cell = openmoc.Cell(id=12, name="test cell")
num_sectors = 4 ############################################################################### ########################### Creating Materials ############################ ############################################################################### materials = materialize.load_from_hdf5('c5g7-mgxs.h5', '../../') ############################################################################### ###################### Creating Cells and Universes ####################### ############################################################################### cells = {} # Instantiate Cells cells['Root'] = openmoc.Cell() cells['Gap Root'] = openmoc.Cell() cells['UO2'] = openmoc.Cell() cells['MOX 4.3%'] = openmoc.Cell() cells['MOX 7.0%'] = openmoc.Cell() cells['MOX 8.7%'] = openmoc.Cell() cells['Guide Tube'] = openmoc.Cell() cells['Fission Chamber'] = openmoc.Cell() cells['Control Rod'] = openmoc.Cell() cells['Moderator'] = openmoc.Cell() cells['Reflector'] = openmoc.Cell() cells['Moderator in Pin'] = openmoc.Cell() cells['Refined Reflector Pin'] = openmoc.Cell() cells['Refined Reflector Mesh'] = openmoc.Cell() cells['UO2 Unrodded Assembly'] = openmoc.Cell() cells['UO2 Rodded Assembly'] = openmoc.Cell()
right = openmoc.XPlane(x=2.0, name='right') top = openmoc.YPlane(y=2.0, name='top') bottom = openmoc.YPlane(y=-2.0, name='bottom') left.setBoundaryType(openmoc.REFLECTIVE) right.setBoundaryType(openmoc.REFLECTIVE) top.setBoundaryType(openmoc.REFLECTIVE) bottom.setBoundaryType(openmoc.REFLECTIVE) ############################################################################### # Creating Cells ############################################################################### openmoc.log.py_printf('NORMAL', 'Creating cells...') fuel = openmoc.Cell(name='fuel') fuel.setFill(materials['UO2']) fuel.addSurface(halfspace=-1, surface=zcylinder) moderator = openmoc.Cell(name='moderator') moderator.setFill(materials['Water']) moderator.addSurface(halfspace=+1, surface=zcylinder) moderator.addSurface(halfspace=+1, surface=left) moderator.addSurface(halfspace=-1, surface=right) moderator.addSurface(halfspace=+1, surface=bottom) moderator.addSurface(halfspace=-1, surface=top) ############################################################################### # Creating Universes ###############################################################################
left = openmoc.XPlane(x=-20.0, name='left') right = openmoc.XPlane(x=20.0, name='right') top = openmoc.YPlane(y=20.0, name='top') bottom = openmoc.YPlane(y=-20.0, name='bottom') boundaries = [left, right, top, bottom] for boundary in boundaries: boundary.setBoundaryType(openmoc.VACUUM) ############################################################################### # Creating Cells ############################################################################### openmoc.log.py_printf('NORMAL', 'Creating cells...') water_cell = openmoc.Cell(name='water') water_cell.setFill(materials['Water']) source_cell = openmoc.Cell(name='source') source_cell.setFill(materials['Water']) root_cell = openmoc.Cell(name='root cell') root_cell.addSurface(halfspace=+1, surface=left) root_cell.addSurface(halfspace=-1, surface=right) root_cell.addSurface(halfspace=+1, surface=bottom) root_cell.addSurface(halfspace=-1, surface=top) ############################################################################### # Creating Universes ###############################################################################
boundaries = [left, right, top, bottom] for boundary in boundaries: boundary.setBoundaryType(openmoc.REFLECTIVE) zcylinders = list() radii = [0.15, 0.2, 0.25, 0.3, 0.35, 0.4] for r in radii: zcylinders.append(openmoc.ZCylinder(x=0.0, y=0.0, radius=r)) ############################################################################### # Creating Cells ############################################################################### openmoc.log.py_printf('NORMAL', 'Creating cells...') # Create a list of 12 Cell instances cells = [openmoc.Cell() for i in range(12)] # Append 3 CellFills for the assemblies and full core assembly1 = openmoc.Cell(name='assembly 1') assembly2 = openmoc.Cell(name='assembly 2') root_cell = openmoc.Cell(name='full core') # Create fuel/moderator by adding the appropriate Surfaces and Materials cells[0].addSurface(halfspace=-1, surface=zcylinders[0]) cells[1].addSurface(halfspace=+1, surface=zcylinders[0]) cells[2].addSurface(halfspace=-1, surface=zcylinders[1]) cells[3].addSurface(halfspace=+1, surface=zcylinders[1]) cells[4].addSurface(halfspace=-1, surface=zcylinders[2]) cells[5].addSurface(halfspace=+1, surface=zcylinders[2]) cells[6].addSurface(halfspace=-1, surface=zcylinders[3]) cells[7].addSurface(halfspace=+1, surface=zcylinders[3])
def create_geometry(self): """Instantiate a 17x17 pin cell lattice Geometry.""" # Create ZCylinder for the fuel and moderator fuel_radius = openmoc.ZCylinder(x=0.0, y=0.0, radius=0.54) # Create planes to bound the entire geometry xmin = openmoc.XPlane(x=-10.71, name='xmin') xmax = openmoc.XPlane(x=+10.71, name='xmax') ymin = openmoc.YPlane(y=-10.71, name='ymin') ymax = openmoc.YPlane(y=+10.71, name='xmax') xmin.setBoundaryType(openmoc.REFLECTIVE) xmax.setBoundaryType(openmoc.REFLECTIVE) ymin.setBoundaryType(openmoc.REFLECTIVE) ymax.setBoundaryType(openmoc.REFLECTIVE) # 4.3% MOX pin cell mox43_cell = openmoc.Cell() mox43_cell.setFill(self.materials['MOX-4.3%']) mox43_cell.setNumRings(3) mox43_cell.setNumSectors(8) mox43_cell.addSurface(-1, fuel_radius) mox43 = openmoc.Universe(name='MOX-4.3%') mox43.addCell(mox43_cell) # 7% MOX pin cell mox7_cell = openmoc.Cell() mox7_cell.setFill(self.materials['MOX-7%']) mox7_cell.setNumRings(3) mox7_cell.setNumSectors(8) mox7_cell.addSurface(-1, fuel_radius) mox7 = openmoc.Universe(name='MOX-7%') mox7.addCell(mox7_cell) # 8.7% MOX pin cell mox87_cell = openmoc.Cell() mox87_cell.setFill(self.materials['MOX-8.7%']) mox87_cell.setNumRings(3) mox87_cell.setNumSectors(8) mox87_cell.addSurface(-1, fuel_radius) mox87 = openmoc.Universe(name='MOX-8.7%') mox87.addCell(mox87_cell) # Fission chamber pin cell fission_chamber_cell = openmoc.Cell() fission_chamber_cell.setFill(self.materials['Fission Chamber']) fission_chamber_cell.setNumRings(3) fission_chamber_cell.setNumSectors(8) fission_chamber_cell.addSurface(-1, fuel_radius) fission_chamber = openmoc.Universe(name='Fission Chamber') fission_chamber.addCell(fission_chamber_cell) # Guide tube pin cell guide_tube_cell = openmoc.Cell() guide_tube_cell.setFill(self.materials['Guide Tube']) guide_tube_cell.setNumRings(3) guide_tube_cell.setNumSectors(8) guide_tube_cell.addSurface(-1, fuel_radius) guide_tube = openmoc.Universe(name='Guide Tube') guide_tube.addCell(guide_tube_cell) # Moderator cell moderator = openmoc.Cell() moderator.setFill(self.materials['Water']) moderator.addSurface(+1, fuel_radius) moderator.setNumRings(3) moderator.setNumSectors(8) # Add moderator to each pin cell pins = [mox43, mox7, mox87, fission_chamber, guide_tube] for pin in pins: pin.addCell(moderator) # CellFills for the assembly assembly1_cell = openmoc.Cell(name='Assembly 1') assembly1 = openmoc.Universe(name='Assembly 1') assembly1.addCell(assembly1_cell) # A mixed enrichment PWR MOX fuel assembly assembly = openmoc.Lattice(name='MOX Assembly') assembly.setWidth(width_x=1.26, width_y=1.26) # Create a template to map to pin cell types template = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1], [1, 2, 2, 2, 2, 4, 2, 2, 4, 2, 2, 4, 2, 2, 2, 2, 1], [1, 2, 2, 4, 2, 3, 3, 3, 3, 3, 3, 3, 2, 4, 2, 2, 1], [1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 1], [1, 2, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 2, 1], [1, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 1], [1, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 1], [1, 2, 4, 3, 3, 4, 3, 3, 5, 3, 3, 4, 3, 3, 4, 2, 1], [1, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 1], [1, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 1], [1, 2, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 2, 1], [1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 1], [1, 2, 2, 4, 2, 3, 3, 3, 3, 3, 3, 3, 2, 4, 2, 2, 1], [1, 2, 2, 2, 2, 4, 2, 2, 4, 2, 2, 4, 2, 2, 2, 2, 1], [1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]] universes = {1 : mox43, 2 : mox7, 3 : mox87, 4 : guide_tube, 5 : fission_chamber} for i in range(17): for j in range(17): template[i][j] = universes[template[i][j]] assembly.setUniverses([template]) # Root Cell/Universe root_cell = openmoc.Cell(name='Full Geometry') root_cell.setFill(assembly) root_cell.addSurface(+1, xmin) root_cell.addSurface(-1, xmax) root_cell.addSurface(+1, ymin) root_cell.addSurface(-1, ymax) root_universe = openmoc.Universe(name='Root Universe') root_universe.addCell(root_cell) self.geometry = openmoc.Geometry() self.geometry.setRootUniverse(root_universe) super(PwrAssemblyInput, self).create_geometry()
import openmoc.materialize as materialize ############################################################################### # Creating Materials ############################################################################### materials = openmoc.materialize.load_from_hdf5('LRA-mgxs.h5', './') ############################################################################### # Create dictionary of all cells ############################################################################### cells = {} # Instantiate Cells cells['Region 1'] = openmoc.Cell(name='Region 1') cells['Region 2'] = openmoc.Cell(name='Region 2') cells['Region 3'] = openmoc.Cell(name='Region 3') cells['Region 4'] = openmoc.Cell(name='Region 4') cells['Region 5'] = openmoc.Cell(name='Region 5') cells['Region 1 Assembly'] = openmoc.Cell(name='Region 1 Assembly') cells['Region 2 Assembly'] = openmoc.Cell(name='Region 2 Assembly') cells['Region 3 Assembly'] = openmoc.Cell(name='Region 3 Assembly') cells['Region 4 Assembly'] = openmoc.Cell(name='Region 4 Assembly') cells['Region 5 Assembly'] = openmoc.Cell(name='Region 5 Assembly') cells['Root'] = openmoc.Cell(name='Root') # Register Materials with Cells cells['Region 1'].setFill(materials['Region 1']) cells['Region 2'].setFill(materials['Region 2']) cells['Region 3'].setFill(materials['Region 3'])
right = openmoc.XPlane(x=100.0, name='right') top = openmoc.YPlane(y=100.0, name='top') bottom = openmoc.YPlane(y=-100.0, name='bottom') left.setBoundaryType(openmoc.REFLECTIVE) right.setBoundaryType(openmoc.REFLECTIVE) top.setBoundaryType(openmoc.REFLECTIVE) bottom.setBoundaryType(openmoc.REFLECTIVE) ############################################################################### # Creating Cells ############################################################################### openmoc.log.py_printf('NORMAL', 'Creating cells...') cell = openmoc.Cell() cell.setFill(infinite_medium) cell.addSurface(halfspace=+1, surface=left) cell.addSurface(halfspace=-1, surface=right) cell.addSurface(halfspace=+1, surface=bottom) cell.addSurface(halfspace=-1, surface=top) ############################################################################### # Creating Universes ############################################################################### openmoc.log.py_printf('NORMAL', 'Creating universes...') root_universe = openmoc.Universe(name='root universe') root_universe.addCell(cell)
def _run_openmoc(self): """Instantiate a complex region Geometry.""" root_universe = openmoc.Universe(name='root universe') root_cell = openmoc.Cell(name='root cell') root_universe.addCell(root_cell) u1 = openmoc.Universe(name='universe 1') u2 = openmoc.Universe(name='universe 2 in c2') root_cell.setFill(u1) # Z-bounds at root level p1 = openmoc.ZPlane(z=-2.0, name='zmin') p1.setBoundaryType(openmoc.REFLECTIVE) p2 = openmoc.ZPlane(z=+2.0, name='zmax') p2.setBoundaryType(openmoc.INTERFACE) root_cell.addSurface(halfspace=+1, surface=p1) root_cell.addSurface(halfspace=-1, surface=p2) # Cells in the root cell c1 = openmoc.Cell(name='intersection cell') c2 = openmoc.Cell(name='union cell') c2a = openmoc.Cell(name='union cell 2') c3 = openmoc.Cell(name='unbound cell') u1.addCell(c1) u1.addCell(c2) u1.addCell(c3) # Setting the parent cell helps to find boundaries (in Z here) c3.setParent(root_cell) # Cell c2a in c2, to further test arborescence c2.setFill(u2) u2.addCell(c2a) c2.setParent(root_cell) c2a.setParent(c2) # to test transitivity # Bounds for cell 1 : intersection region cell p11 = openmoc.XPlane(x=-2.0, name='xmin') p11.setBoundaryType(openmoc.REFLECTIVE) p12 = openmoc.YPlane(y=-2.0, name='ymin') p12.setBoundaryType(openmoc.VACUUM) p13 = openmoc.ZCylinder(x=0, y=0, radius=2.5, name='cylinder') p13.setBoundaryType(openmoc.INTERFACE) # addSurface assumes an intersection, which is what we want here c1.addSurface(halfspace=+1, surface=p11) c1.addSurface(halfspace=+1, surface=p12) c1.addSurface(halfspace=-1, surface=p13) # Bounds for cell 2 : union region cell p22 = openmoc.ZCylinder(x=4, y=4, radius=2.5, name='cylinder') p22.setBoundaryType(openmoc.INTERFACE) p23 = openmoc.ZCylinder(x=-2, y=-8, radius=3, name='cylinder') p23.setBoundaryType(openmoc.VACUUM) # To have a union, we need to use addLogicalNode and addSurfaceInRegion c2.addLogicalNode(1) c2.addSurfaceInRegion(halfspace=-1, surface=p22) c2.addSurfaceInRegion(halfspace=-1, surface=p23) # Plane limits area even more c2a.addLogicalNode(1) c2a.addSurfaceInRegion(halfspace=+1, surface=p11) # Add a material to a cell to know the number of groups c1.setFill(self.materials['UO2']) self.geometry = openmoc.Geometry() self.geometry.setRootUniverse(root_universe) # Dump geometry self.geometry.dumpToFile("geometry_file.geo") # Get rid of the geometry self.geometry = None # Reload the geometry self.geometry = openmoc.Geometry() self.geometry.loadFromFile("geometry_file.geo") # Dump geometry again self.geometry.dumpToFile("geometry_file_second.geo")
medium_zcylinder = openmoc.ZCylinder(x=0.0, y=0.0, radius=0.3, name='medium pin') small_zcylinder = openmoc.ZCylinder(x=0.0, y=0.0, radius=0.2, name='small pin') for boundary in boundaries: boundary.setBoundaryType(openmoc.REFLECTIVE) ############################################################################### # Creating Cells ############################################################################### openmoc.log.py_printf('NORMAL', 'Creating cells...') large_fuel = openmoc.Cell(name='large pin fuel') large_fuel.setNumRings(3) large_fuel.setNumSectors(8) large_fuel.setFill(materials['UO2']) large_fuel.addSurface(halfspace=-1, surface=large_zcylinder) large_moderator = openmoc.Cell(name='large pin moderator') large_moderator.setNumSectors(8) large_moderator.setFill(materials['Water']) large_moderator.addSurface(halfspace=+1, surface=large_zcylinder) medium_fuel = openmoc.Cell(name='medium pin fuel') medium_fuel.setNumRings(3) medium_fuel.setNumSectors(8) medium_fuel.setFill(materials['UO2']) medium_fuel.addSurface(halfspace=-1, surface=medium_zcylinder)
right = openmoc.XPlane(x=82.5) bottom = openmoc.YPlane(y=-82.5) top = openmoc.YPlane(y=82.5) left.setBoundaryType(openmoc.REFLECTIVE) right.setBoundaryType(openmoc.VACUUM) bottom.setBoundaryType(openmoc.REFLECTIVE) top.setBoundaryType(openmoc.VACUUM) ############################################################################### # Creating Cells and Universes ############################################################################### openmoc.log.py_printf('NORMAL', 'Creating cells...') # Region 1 region1_cell = openmoc.Cell(name='region 1') region1_cell.setFill(materials['region_1']) region1 = openmoc.Universe(name='region 1') region1.addCell(region1_cell) # Region 2 region2_cell = openmoc.Cell(name='region 2') region2_cell.setFill(materials['region_2']) region2 = openmoc.Universe(name='region 2') region2.addCell(region2_cell) # Region 3 region3_cell = openmoc.Cell(name='region 3') region3_cell.setFill(materials['region_3']) region3 = openmoc.Universe(name='region 3') region3.addCell(region3_cell)
def _run_openmoc(self): openmoc.set_log_level('NORMAL') c1 = openmoc.Cell() c2 = openmoc.Cell() s1 = openmoc.XPlane(-40.) s2 = openmoc.XPlane(-50.) s3 = openmoc.XPlane(-60.) s1.setBoundaryType(openmoc.VACUUM) s2.setBoundaryType(openmoc.PERIODIC) s3.setBoundaryType(openmoc.REFLECTIVE) c1.addSurface(+1, s1) c2.addSurface(+1, s2) c2.addSurface(+1, s3) u = openmoc.Universe() u.addCell(c1) u.addCell(c2) boundary = u.getMinXBoundaryType() if boundary == 0: boundary = 'VACUUM' elif boundary == 1: boundary = 'REFLECTIVE' elif boundary == 2: boundary = 'PERIODIC' else: boundary = 'BOUNDARY_NONE' py_printf('NORMAL', 'MinX: %f', u.getMinX()) py_printf('NORMAL', 'MinXBoundaryType: %s', boundary) py_printf('SEPARATOR', '') c1 = openmoc.Cell() c2 = openmoc.Cell() s1 = openmoc.YPlane(-40.) s2 = openmoc.YPlane(-50.) s3 = openmoc.YPlane(-60.) s1.setBoundaryType(openmoc.VACUUM) s2.setBoundaryType(openmoc.PERIODIC) s3.setBoundaryType(openmoc.REFLECTIVE) c1.addSurface(+1, s1) c2.addSurface(+1, s2) c2.addSurface(+1, s3) u = openmoc.Universe() u.addCell(c1) u.addCell(c2) boundary = u.getMinYBoundaryType() if boundary == 0: boundary = 'VACUUM' elif boundary == 1: boundary = 'REFLECTIVE' elif boundary == 2: boundary = 'PERIODIC' else: boundary = 'BOUNDARY_NONE' py_printf('NORMAL', 'MinY: %f', u.getMinY()) py_printf('NORMAL', 'MinYBoundaryType: %s', boundary) py_printf('SEPARATOR', '') c1 = openmoc.Cell() c2 = openmoc.Cell() s1 = openmoc.ZPlane(-40.) s2 = openmoc.ZPlane(-50.) s3 = openmoc.ZPlane(-60.) s1.setBoundaryType(openmoc.VACUUM) s2.setBoundaryType(openmoc.PERIODIC) s3.setBoundaryType(openmoc.REFLECTIVE) c1.addSurface(+1, s1) c2.addSurface(+1, s2) c2.addSurface(+1, s3) u = openmoc.Universe() u.addCell(c1) u.addCell(c2) boundary = u.getMinZBoundaryType() if boundary == 0: boundary = 'VACUUM' elif boundary == 1: boundary = 'REFLECTIVE' elif boundary == 2: boundary = 'PERIODIC' else: boundary = 'BOUNDARY_NONE' py_printf('NORMAL', 'MinZ: %f', u.getMinZ()) py_printf('NORMAL', 'MinZBoundaryType: %s', boundary) py_printf('SEPARATOR', '') c1 = openmoc.Cell() c2 = openmoc.Cell() s1 = openmoc.XPlane(40.) s2 = openmoc.XPlane(50.) s3 = openmoc.XPlane(60.) s1.setBoundaryType(openmoc.VACUUM) s2.setBoundaryType(openmoc.PERIODIC) s3.setBoundaryType(openmoc.REFLECTIVE) c1.addSurface(-1, s1) c2.addSurface(-1, s2) c2.addSurface(-1, s3) u = openmoc.Universe() u.addCell(c1) u.addCell(c2) boundary = u.getMaxXBoundaryType() if boundary == 0: boundary = 'VACUUM' elif boundary == 1: boundary = 'REFLECTIVE' elif boundary == 2: boundary = 'PERIODIC' else: boundary = 'BOUNDARY_NONE' py_printf('NORMAL', 'MaxX: %f', u.getMaxX()) py_printf('NORMAL', 'MaxXBoundaryType: %s', boundary) py_printf('SEPARATOR', '') c1 = openmoc.Cell() c2 = openmoc.Cell() s1 = openmoc.YPlane(40.) s2 = openmoc.YPlane(50.) s3 = openmoc.YPlane(60.) s1.setBoundaryType(openmoc.VACUUM) s2.setBoundaryType(openmoc.PERIODIC) s3.setBoundaryType(openmoc.REFLECTIVE) c1.addSurface(-1, s1) c2.addSurface(-1, s2) c2.addSurface(-1, s3) u = openmoc.Universe() u.addCell(c1) u.addCell(c2) boundary = u.getMaxYBoundaryType() if boundary == 0: boundary = 'VACUUM' elif boundary == 1: boundary = 'REFLECTIVE' elif boundary == 2: boundary = 'PERIODIC' else: boundary = 'BOUNDARY_NONE' py_printf('NORMAL', 'MaxY: %f', u.getMaxY()) py_printf('NORMAL', 'MaxYBoundaryType: %s', boundary) py_printf('SEPARATOR', '') c1 = openmoc.Cell() c2 = openmoc.Cell() s1 = openmoc.ZPlane(40.) s2 = openmoc.ZPlane(50.) s3 = openmoc.ZPlane(60.) s1.setBoundaryType(openmoc.VACUUM) s2.setBoundaryType(openmoc.PERIODIC) s3.setBoundaryType(openmoc.REFLECTIVE) c1.addSurface(-1, s1) c2.addSurface(-1, s2) c2.addSurface(-1, s3) u = openmoc.Universe() u.addCell(c1) u.addCell(c2) boundary = u.getMaxZBoundaryType() if boundary == 0: boundary = 'VACUUM' elif boundary == 1: boundary = 'REFLECTIVE' elif boundary == 2: boundary = 'PERIODIC' else: boundary = 'BOUNDARY_NONE' py_printf('NORMAL', 'MaxZ: %f', u.getMaxZ()) py_printf('NORMAL', 'MaxZBoundaryType: %s', boundary) py_printf('SEPARATOR', '') sW = openmoc.XPlane(10) sE = openmoc.XPlane(20) sS = openmoc.YPlane(30) sN = openmoc.YPlane(40) sB = openmoc.ZPlane(50) sT = openmoc.ZPlane(60) sW.setBoundaryType(openmoc.VACUUM) sE.setBoundaryType(openmoc.REFLECTIVE) sS.setBoundaryType(openmoc.VACUUM) sN.setBoundaryType(openmoc.REFLECTIVE) sB.setBoundaryType(openmoc.PERIODIC) sT.setBoundaryType(openmoc.REFLECTIVE) sX_mid = openmoc.XPlane(15) sY_mid = openmoc.YPlane(35) sZ_mid = openmoc.ZPlane(55) sX_mid.setBoundaryType(openmoc.BOUNDARY_NONE) sY_mid.setBoundaryType(openmoc.BOUNDARY_NONE) sZ_mid.setBoundaryType(openmoc.BOUNDARY_NONE) cell = openmoc.Cell() cell.addSurface(+1, sW) cell.addSurface(-1, sE) cell.addSurface(+1, sS) cell.addSurface(-1, sN) cell.addSurface(+1, sB) cell.addSurface(-1, sT) cell.addSurface(+1, sX_mid) cell.addSurface(-1, sX_mid) cell.addSurface(+1, sY_mid) cell.addSurface(-1, sY_mid) cell.addSurface(+1, sZ_mid) cell.addSurface(-1, sZ_mid) univ = openmoc.Universe() univ.addCell(cell) py_printf('NORMAL', 'MinX: %f', univ.getMinX()) py_printf('NORMAL', 'MinXBoundaryType: %s', univ.getMinXBoundaryType()) py_printf('NORMAL', 'MinY: %f', univ.getMinY()) py_printf('NORMAL', 'MinYBoundaryType: %s', univ.getMinYBoundaryType()) py_printf('NORMAL', 'MinZ: %f', univ.getMinZ()) py_printf('NORMAL', 'MinZBoundaryType: %s', univ.getMinZBoundaryType()) py_printf('NORMAL', 'MaxX: %f', univ.getMaxX()) py_printf('NORMAL', 'MaxXBoundaryType: %s', univ.getMaxXBoundaryType()) py_printf('NORMAL', 'MaxY: %f', univ.getMaxY()) py_printf('NORMAL', 'MaxYBoundaryType: %s', univ.getMaxYBoundaryType()) py_printf('NORMAL', 'MaxZ: %f', univ.getMaxZ()) py_printf('NORMAL', 'MaxZBoundaryType: %s', univ.getMaxZBoundaryType())
def _create_geometry(self): """Inspired from SimpleLattice""" self.materials = \ openmoc.materialize.load_from_hdf5(filename='c5g7-mgxs.h5', directory='../../sample-input/') xmin = openmoc.XPlane(x=-2.0, name='xmin') xmax = openmoc.XPlane(x=+2.0, name='xmax') ymin = openmoc.YPlane(y=-2.0, name='ymin') ymax = openmoc.YPlane(y=+2.0, name='ymax') boundaries = [xmin, xmax, ymin, ymax] if (self.dimensions == 3): zmin = openmoc.ZPlane(z=-5.0, name='zmin') zmax = openmoc.ZPlane(z=+5.0, name='zmax') boundaries = [xmin, xmax, ymin, ymax, zmin, zmax] large_zcylinder = openmoc.ZCylinder(x=0.0, y=0.0, radius=0.4, name='large pin') medium_zcylinder = openmoc.ZCylinder(x=0.0, y=0.0, radius=0.3, name='medium pin') small_zcylinder = openmoc.ZCylinder(x=0.0, y=0.0, radius=0.2, name='small pin') xplane = openmoc.XPlane(x=0, name='mid-cell') yplane = openmoc.YPlane(y=0, name='mid-cell') for boundary in boundaries: boundary.setBoundaryType(openmoc.REFLECTIVE) if (self.dimensions == 3): boundaries[-1].setBoundaryType(openmoc.VACUUM) large_fuel = openmoc.Cell(name='large pin fuel') large_fuel.setNumRings(3) large_fuel.setNumSectors(8) large_fuel.setFill(self.materials['UO2']) large_fuel.addSurface(halfspace=-1, surface=large_zcylinder) large_moderator = openmoc.Cell(name='large pin moderator') large_moderator.setNumSectors(8) large_moderator.setFill(self.materials['Water']) large_moderator.addSurface(halfspace=+1, surface=large_zcylinder) medium_fuel = openmoc.Cell(name='medium pin fuel') medium_fuel.setNumRings(3) medium_fuel.setNumSectors(8) medium_fuel.setFill(self.materials['UO2']) medium_fuel.addSurface(halfspace=-1, surface=medium_zcylinder) medium_moderator = openmoc.Cell(name='medium pin moderator') medium_moderator.setNumSectors(8) medium_moderator.setFill(self.materials['Water']) medium_moderator.addSurface(halfspace=+1, surface=medium_zcylinder) small_fuel = openmoc.Cell(name='small pin fuel') small_fuel.setNumRings(3) # test may fail if fsrs are initialized small_fuel.setNumSectors(8) small_fuel.setFill(self.materials['UO2']) small_fuel.addSurface(halfspace=-1, surface=small_zcylinder) small_clad_q1 = openmoc.Cell(name='small pin cladding quarter') small_clad_q1.setFill(self.materials['Clad']) small_clad_q1.addSurface(halfspace=+1, surface=small_zcylinder) small_clad_q1.addSurface(halfspace=-1, surface=medium_zcylinder) small_clad_q1.addSurface(halfspace=+1, surface=xplane) small_clad_q1.addSurface(halfspace=-1, surface=yplane) small_moderator = openmoc.Cell(name='small pin moderator') small_moderator.setNumSectors(8) small_moderator.setFill(self.materials['Water']) small_moderator.addSurface(halfspace=+1, surface=medium_zcylinder) lattice_cell = openmoc.Cell(name='lattice cell') root_cell = openmoc.Cell(name='root cell') root_cell.addSurface(halfspace=+1, surface=boundaries[0]) root_cell.addSurface(halfspace=-1, surface=boundaries[1]) root_cell.addSurface(halfspace=+1, surface=boundaries[2]) root_cell.addSurface(halfspace=-1, surface=boundaries[3]) if (self.dimensions == 3): root_cell.addSurface(halfspace=+1, surface=boundaries[4]) root_cell.addSurface(halfspace=-1, surface=boundaries[5]) pin1 = openmoc.Universe(name='large pin cell') pin2 = openmoc.Universe(name='medium pin cell') pin3 = openmoc.Universe(name='small pin cell') assembly = openmoc.Universe(name='2x2 lattice') root_universe = openmoc.Universe(name='root universe') pin1.addCell(large_fuel) pin1.addCell(large_moderator) pin2.addCell(medium_fuel) pin2.addCell(medium_moderator) pin3.addCell(small_fuel) pin3.addCell(small_clad_q1) pin3.addCell(small_moderator) assembly.addCell(lattice_cell) root_universe.addCell(root_cell) # 2x2 assembly lattice = openmoc.Lattice(name='2x2 lattice') lattice.setWidth(width_x=1.0, width_y=1.0) lattice.setUniverses([[[pin1, pin2], [pin1, pin3]]]) lattice_cell.setFill(lattice) # Rotate a lattice to test rotation of a fill cell assembly_c = openmoc.Cell(name='rotated cell containing a lattice') assembly_c.setFill(assembly) assembly_c.setRotation((0,0,90), 'degrees') assembly_r = openmoc.Universe(name='rotated lattice') assembly_r.addCell(assembly_c) # Translate a lattice to test translation of a fill cell assembly_c = openmoc.Cell(name='rotated cell containing a lattice') assembly_c.setFill(assembly) assembly_c.setTranslation((0.05,0,0)) assembly_t = openmoc.Universe(name='translated lattice') assembly_t.addCell(assembly_c) # Rotate a lattice to test rotation of a fill cell assembly_c = openmoc.Cell(name='translated cell containing a lattice') assembly_c.setFill(assembly) assembly_c.setRotation((0,0,-90), 'degrees') assembly_c.setTranslation((-0.05,0,0)) assembly_rt = openmoc.Universe(name='translate and rotated lattice') assembly_rt.addCell(assembly_c) # 2x2 core core = openmoc.Lattice(name='2x2 core') core.setWidth(width_x=2.0, width_y=2.0) core.setUniverses([[[assembly, assembly_rt], [assembly_t, assembly_r]]]) root_cell.setFill(core) self.geometry = openmoc.Geometry() self.geometry.setRootUniverse(root_universe)