diff --git a/smr/assemblies.py b/smr/assemblies.py index b160ee5..bf34625 100644 --- a/smr/assemblies.py +++ b/smr/assemblies.py @@ -2,43 +2,83 @@ import openmc from surfaces import surfs -def make_assembly(name, latts, univs, surfs, mats, universes, - lower_left, width, grid_surfs=None, sleeve_mats=None): +def make_assembly(name, mats, universes, lower_left, width): + + # FIXME: Add a docstring + # FIXME: Make this general with a loop over axial sections # Instantiate the lattice - latts[name] = openmc.RectLattice(name=name) - latts[name].lower_left = [lower_left, lower_left] - latts[name].width = [width, width] - latts[name].universes = univs + lattice = openmc.RectLattice(name=name) + lattice.lower_left = [lower_left, lower_left] + lattice.width = [width, width] + lattice.universes = universes + + # Create rectangular prism cylinder for lattice grid box + lat_grid_box = (surfs['lat grid box outer'] & + openmc.Complement(surfs['lat grid box inner'])) # Add lattice to bounding cell univ_name = name + ' lattice' - univs[univ_name] = openmc.Universe(name=univ_name) + universe = openmc.Universe(name=univ_name) cell = openmc.Cell(name=univ_name) - cell.fill = latts[name] - cell.region = (-surfs['lat box xtop'] & - +surfs['lat box xbot'] & - -surfs['lat box ytop'] & - +surfs['lat box ybot']) + cell.fill = lattice + cell.region = surfs['lat box inner'] + universe.add_cell(cell) - - # Make axial cells for outside of assembly - cell = openmc.Cell(name=univ_name + ' axial 1') + # Make bottom axial cell for outside of assembly (without sleeve) + cell = openmc.Cell(name=univ_name + ' axial (0)') cell.material = mats['H2O'] - cell.region = ((-surfs['lat box ybot'] & -surfs['grid1bot']) ^ - (+surfs['lat box ytop'] & -surfs['grid1bot']) ^ - (+surfs['lat box xtop'] & -surfs['lat box ytop'] & - )) + cell.region = lat_grid_box & -surfs['grid1bot'] + universe.add_cell(cell) + # Make axial cell for outside of assembly (with sleeve) + cell = openmc.Cell(name=univ_name + ' axial (1)') + cell.material = mats['SS'] + cell.region = lat_grid_box & +surfs['grid1bot'] & -surfs['grid1top'] + universe.add_cell(cell) -grid_surfaces = [surfs['grid1bot'], - surfs['grid1top'], - surfs['grid2bot'], - surfs['grid2top'], - surfs['grid3bot'], - surfs['grid3top'], - surfs['grid4bot'], - surfs['grid4top']] + # Make axial cell for outside of assembly (without sleeve) + cell = openmc.Cell(name=univ_name + ' axial (2)') + cell.material = mats['H2O'] + cell.region = lat_grid_box & +surfs['grid1top'] & -surfs['grid2bot'] + universe.add_cell(cell) + + # Make axial cell for outside of assembly (with sleeve) + cell = openmc.Cell(name=univ_name + ' axial (3)') + cell.material = mats['Zr'] + cell.region = lat_grid_box & +surfs['grid2bot'] & -surfs['grid2top'] + universe.add_cell(cell) + + # Make axial cell for outside of assembly (without sleeve) + cell = openmc.Cell(name=univ_name + ' axial (4)') + cell.material = mats['H2O'] + cell.region = lat_grid_box & +surfs['grid2top'] & -surfs['grid3bot'] + universe.add_cell(cell) + + # Make axial cell for outside of assembly (with sleeve) + cell = openmc.Cell(name=univ_name + ' axial (5)') + cell.material = mats['Zr'] + cell.region = lat_grid_box & +surfs['grid3bot'] & -surfs['grid3top'] + universe.add_cell(cell) + + # Make axial cell for outside of assembly (without sleeve) + cell = openmc.Cell(name=univ_name + ' axial (6)') + cell.material = mats['H2O'] + cell.region = lat_grid_box & +surfs['grid3top'] & -surfs['grid4bot'] + universe.add_cell(cell) + + # Make axial cell for outside of assembly (with sleeve) + cell = openmc.Cell(name=univ_name + ' axial (7)') + cell.material = mats['SS'] + cell.region = lat_grid_box & +surfs['grid4bot'] & -surfs['grid4top'] + universe.add_cell(cell) + + # Make top axial cell for outside of assembly (without sleeve) + cell = openmc.Cell(name=univ_name + ' axial (last)') + cell.material = mats['H2O'] + cell.region = lat_grid_box & +surfs['grid4top'] + universe.add_cell(cell) + + return universe -latts = {} diff --git a/smr/grids.py b/smr/grids.py index 6260d27..d43bdef 100644 --- a/smr/grids.py +++ b/smr/grids.py @@ -3,6 +3,7 @@ from surfaces import surfs # FIXME: Add docstring explanation # FIXME: Put this in surface.py?? +# FIXME: Use get_rectangular_prism method instead??? grids = {} diff --git a/smr/smr.py b/smr/smr.py index 3204cf1..a5957b9 100644 --- a/smr/smr.py +++ b/smr/smr.py @@ -662,196 +662,6 @@ J__11 = cells['Fuel 3.1 w/o + instr lattice']['univ'], return mats,surfs,cells,latts,sett,plots,tallies -def make_assembly(latts, cells, surfs, lo, co, univIDs, cellIDs, water, name, - comm=None,sect=None, dim=None,lleft=None,width=None,univs=None, - gridSurfs=None,sleeveMats=None): - """Populates the cells and latts dictionary with an assembly - - The cell universe handle to use will be: cells[name+' lattice']['univ'] - - cells - cells dictionary - surfs - surfs dictionary - lo - latts order dictionary - co - cells order dictionary - univIDs - set of already used universe IDs - cellIDs - set of already used cell IDs - name - string, name of the latt/cell family - water - material to put outside the lattice - comm - optional comment for the lattice and cell family - sect - optional section comment - dim - required lattice dimension - lleft - required lattice lower_left - width - required lattice width - univs - required lattice universe string. Should be made with pinLattice_t - gridSurfs - required list of grid surface ids, from bottom to top - sleeveMats - required materials for grid sleeves as [topbot,intermediate] - - returns list of all the created cell keys - - """ - - # make axial all cells for outside of assembly - - # first bottom part - cells[name+' lattice 4'] = { 'order': inc_order(co), 'comm':"", - 'id': new_id(cellIDs), - 'univ': cells[name+' lattice']['univ'], - 'fill': None, - 'mat': water, - 'surfs': '{0} -{1} {2} -{3}'.format(surfs['lat box xtop']['id'], - surfs['lat box ytop']['id'],surfs['lat box ybot']['id'], - gridSurfs[0])} - outKeys.append(cells[name+' lattice 4']['id']) - cells[name+' lattice 5'] = { 'order': inc_order(co), 'comm':"", - 'id': new_id(cellIDs), - 'univ': cells[name+' lattice']['univ'], - 'fill': None, - 'mat': water, - 'surfs': '-{0} -{1} {2} -{3}'.format(surfs['lat box xbot']['id'], - surfs['lat box ytop']['id'],surfs['lat box ybot']['id'], - gridSurfs[0])} - outKeys.append(cells[name+' lattice 5']['id']) - - gridnum = 0 - - # all middle cells - for i,botGridSurf in enumerate(gridSurfs[:-1]): - - - if i%2 == 0: - # make gridsleeve cells - - gridnum += 1 - - if gridnum == 1 or gridnum == 8: - smat = sleeveMats[0] - else: - smat = sleeveMats[1] - - outSurfsKey = 'lat grid box ' - inSurfsKey = 'lat box ' - - cellKey = name+' lattice grid {0}'.format(6+i*4) - cells[cellKey] = { 'order': inc_order(co), 'comm':"", - 'id': new_id(cellIDs), - 'univ': cells[name+' lattice']['univ'], - 'fill': None, - 'mat': smat, - 'surfs': '-{0} {1} {2} -{3} {4} -{5}'.format(surfs[inSurfsKey+'ybot']['id'],surfs[outSurfsKey+'ybot']['id'], - surfs[outSurfsKey+'xbot']['id'],surfs[outSurfsKey+'xtop']['id'], - botGridSurf,gridSurfs[i+1])} - outKeys.append(cells[cellKey]['id']) - cellKey = name+' lattice grid {0}'.format(7+i*4) - cells[cellKey] = { 'order': inc_order(co), 'comm':"", - 'id': new_id(cellIDs), - 'univ': cells[name+' lattice']['univ'], - 'fill': None, - 'mat': smat, - 'surfs': '-{0} {1} {2} -{3} {4} -{5}'.format(surfs[outSurfsKey+'ytop']['id'],surfs[inSurfsKey+'ytop']['id'], - surfs[outSurfsKey+'xbot']['id'],surfs[outSurfsKey+'xtop']['id'], - botGridSurf,gridSurfs[i+1])} - outKeys.append(cells[cellKey]['id']) - cellKey = name+' lattice grid {0}'.format(8+i*4) - cells[cellKey] = { 'order': inc_order(co), 'comm':"", - 'id': new_id(cellIDs), - 'univ': cells[name+' lattice']['univ'], - 'fill': None, - 'mat': smat, - 'surfs': '-{0} {1} {2} -{3} {4} -{5}'.format(surfs[inSurfsKey+'xbot']['id'],surfs[outSurfsKey+'xbot']['id'], - surfs[inSurfsKey+'ybot']['id'],surfs[inSurfsKey+'ytop']['id'], - botGridSurf,gridSurfs[i+1])} - outKeys.append(cells[cellKey]['id']) - cellKey = name+' lattice grid {0}'.format(9+i*4) - cells[cellKey] = { 'order': inc_order(co), 'comm':"", - 'id': new_id(cellIDs), - 'univ': cells[name+' lattice']['univ'], - 'fill': None, - 'mat': smat, - 'surfs': '-{0} {1} {2} -{3} {4} -{5}'.format(surfs[outSurfsKey+'xtop']['id'],surfs[inSurfsKey+'xtop']['id'], - surfs[inSurfsKey+'ybot']['id'],surfs[inSurfsKey+'ytop']['id'], - botGridSurf,gridSurfs[i+1])} - outKeys.append(cells[cellKey]['id']) - - else: - outSurfsKey = 'lat box ' - - - cellKey = name+' lattice {0}'.format(6+i*4) - cells[cellKey] = { 'order': inc_order(co), 'comm':"", - 'id': new_id(cellIDs), - 'univ': cells[name+' lattice']['univ'], - 'fill': None, - 'mat': water, - 'surfs': '-{0} {1} -{2}'.format(surfs[outSurfsKey+'ybot']['id'],botGridSurf,gridSurfs[i+1])} - outKeys.append(cells[cellKey]['id']) - cellKey = name+' lattice {0}'.format(7+i*4) - cells[cellKey] = { 'order': inc_order(co), 'comm':"", - 'id': new_id(cellIDs), - 'univ': cells[name+' lattice']['univ'], - 'fill': None, - 'mat': water, - 'surfs': '{0} {1} -{2}'.format(surfs[outSurfsKey+'ytop']['id'],botGridSurf,gridSurfs[i+1])} - outKeys.append(cells[cellKey]['id']) - cellKey = name+' lattice {0}'.format(8+i*4) - cells[cellKey] = { 'order': inc_order(co), 'comm':"", - 'id': new_id(cellIDs), - 'univ': cells[name+' lattice']['univ'], - 'fill': None, - 'mat': water, - 'surfs': '{0} -{1} {2} {3} -{4}'.format(surfs[outSurfsKey+'xtop']['id'], - surfs[outSurfsKey+'ytop']['id'],surfs[outSurfsKey+'ybot']['id'], - botGridSurf,gridSurfs[i+1])} - outKeys.append(cells[cellKey]['id']) - cellKey = name+' lattice {0}'.format(9+i*4) - cells[cellKey] = { 'order': inc_order(co), 'comm':"", - 'id': new_id(cellIDs), - 'univ': cells[name+' lattice']['univ'], - 'fill': None, - 'mat': water, - 'surfs': '-{0} -{1} {2} {3} -{4}'.format(surfs[outSurfsKey+'xbot']['id'], - surfs[outSurfsKey+'ytop']['id'],surfs[outSurfsKey+'ybot']['id'], - botGridSurf,gridSurfs[i+1])} - outKeys.append(cells[cellKey]['id']) - - # top part - cells[name+' lat last 1'] = { 'order': inc_order(co), 'comm':"", - 'id': new_id(cellIDs), - 'univ': cells[name+' lattice']['univ'], - 'fill': None, - 'mat': water, - 'surfs': '-{0} {1}'.format(surfs['lat box ybot']['id'],gridSurfs[-1])} - outKeys.append(cells[name+' lat last 1']['id']) - cells[name+' lat last 2'] = { 'order': inc_order(co), 'comm':"", - 'id': new_id(cellIDs), - 'univ': cells[name+' lattice']['univ'], - 'fill': None, - 'mat': water, - 'surfs': '{0} {1}'.format(surfs['lat box ytop']['id'],gridSurfs[-1])} - outKeys.append(cells[name+' lat last 2']['id']) - cells[name+' lat last 3'] = { 'order': inc_order(co), 'comm':"", - 'id': new_id(cellIDs), - 'univ': cells[name+' lattice']['univ'], - 'fill': None, - 'mat': water, - 'surfs': '{0} -{1} {2} {3}'.format(surfs['lat box xtop']['id'], - surfs['lat box ytop']['id'],surfs['lat box ybot']['id'], - gridSurfs[-1])} - outKeys.append(cells[name+' lat last 3']['id']) - cells[name+' lat last 4'] = { 'order': inc_order(co), 'comm':"", - 'id': new_id(cellIDs), - 'univ': cells[name+' lattice']['univ'], - 'fill': None, - 'mat': water, - 'surfs': '-{0} -{1} {2} {3}'.format(surfs['lat box xbot']['id'], - surfs['lat box ytop']['id'],surfs['lat box ybot']['id'], - gridSurfs[-1])} - outKeys.append(cells[name+' lat last 4']['id']) - - - - return outKeys # we only keep track of this to facilitate certain plots/tallies - - def main(): mats,surfs,cells,latts,sett,plots,tallies,cmfd = init_data() diff --git a/smr/surfaces.py b/smr/surfaces.py index e85083f..89eedad 100644 --- a/smr/surfaces.py +++ b/smr/surfaces.py @@ -154,13 +154,14 @@ surfs['rod grid box ytop i'] = openmc.yPlane( surfs['rod grid box ybot i'] = openmc.YPlane( y0=-rod_grid_side_i/2, name='Y min for grid outside FR in intermediate spacers') +# FIXME: Can these be removed??? Use the get_rectangular_prism method instead??? surfs['lat grid box xtop'] = openmc.XPlane( x0=grid_strap_side/2, name='X max for grid outside FA') surfs['lat grid box xbot'] = openmc.XPlane( x0=-grid_strap_side/2, name='Y min for grid outside FA') surfs['lat grid box ytop'] = openmc.YPlane( y0=grid_strap_side/2, name='Y max for grid outside FA') -surfs['lat grid box xbot'] = openmc.YPlane( +surfs['lat grid box ybot'] = openmc.YPlane( y0=-grid_strap_side/2, name='Y min for grid outside FA') surfs['lat box xtop'] = openmc.XPlane( @@ -172,6 +173,12 @@ surfs['lat box ytop'] = openmc.YPlane( surfs['lat box ybot'] = openmc.YPlane( x0=-17.*pin_pitch/2., name='lattice Y min') +# FIXME: rectangular prism for lattice grid sleeves +surfs['lat grid box inner'] = \ + openmc.get_rectangular_prism(17.*pin_pitch, 17.*pin_pitch) +surfs['lat grid box outer'] = \ + openmc.get_rectangular_prism(grid_strap_side, grid_strap_side) + surfs['lowest extent'] = openmc.ZPlane( z0=lowest_extent, name='lowest extent') surfs['bot support plate'] = openmc.ZPlane(