diff --git a/smr/assemblies.py b/smr/assemblies.py new file mode 100644 index 0000000..b160ee5 --- /dev/null +++ b/smr/assemblies.py @@ -0,0 +1,44 @@ +import openmc + +from surfaces import surfs + +def make_assembly(name, latts, univs, surfs, mats, universes, + lower_left, width, grid_surfs=None, sleeve_mats=None): + + + # 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 + + # Add lattice to bounding cell + univ_name = name + ' lattice' + univs[univ_name] = 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']) + + + # Make axial cells for outside of assembly + cell = openmc.Cell(name=univ_name + ' axial 1') + 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'] & + )) + + +grid_surfaces = [surfs['grid1bot'], + surfs['grid1top'], + surfs['grid2bot'], + surfs['grid2top'], + surfs['grid3bot'], + surfs['grid3top'], + surfs['grid4bot'], + surfs['grid4top']] + +latts = {} diff --git a/smr/smr.py b/smr/smr.py index eeae9b4..3204cf1 100644 --- a/smr/smr.py +++ b/smr/smr.py @@ -690,61 +690,9 @@ def make_assembly(latts, cells, surfs, lo, co, univIDs, cellIDs, water, name, """ - name = str(name) - - # first make the lattice - - latts[name] = { 'order': inc_order(lo), - 'id': new_id(univIDs), - 'type': 'rectangular'} - if comm: - latts[name]['comm'] = comm_t.format(comm) - else: - latts[name]['comm'] = "" - if sect: - latts[name]['section'] = comm_t.format(sect) - - for key in ['dim','lleft','width','univs']: - if not locals()[key]: - raise Exception('make_assembly requires {0}'.format(key)) - else: - latts[name][key] = locals()[key] - - # add lattice to bounding cell - cells[name+' lattice'] = { 'order': inc_order(co), - 'id': new_id(cellIDs), - 'univ': new_id(univIDs), - 'fill': latts[name]['id'], - 'surfs': '-{0} {1} -{2} {3}'.format(surfs['lat box xtop']['id'],surfs['lat box xbot']['id'],surfs['lat box ytop']['id'],surfs['lat box ybot']['id'])} - if comm: - cells[name+' lattice']['comm'] = comm_t.format(comm) - else: - cells[name+' lattice']['comm'] = "" - if sect: - cells[name+' lattice']['section'] = comm_t.format(sect) - - # make axial all cells for outside of assembly - # !! all of this would be greatly simplified if box-type surfaces were implemented in openmc !! - - outKeys = [] # we only keep track of this to facilitate certain plots/tallies - # first bottom part - cells[name+' lattice 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 ybot']['id'],gridSurfs[0])} - outKeys.append(cells[name+' lattice 2']['id']) - cells[name+' lattice 3'] = { '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[0])} - outKeys.append(cells[name+' lattice 3']['id']) cells[name+' lattice 4'] = { 'order': inc_order(co), 'comm':"", 'id': new_id(cellIDs), 'univ': cells[name+' lattice']['univ'],