def buildOperatorOfEmptyHexBlocks(customSettings=None): """ Builds a operator w/ a reactor object with some hex assemblies and blocks, but all are empty Doesn't depend on inputs and loads quickly. Params ------ customSettings : dict Dictionary of off-default settings to update """ settings.setMasterCs(None) # clear cs = settings.getMasterCs() # fetch new cs["db"] = False # stop use of database if customSettings is not None: cs.update(customSettings) r = tests.getEmptyHexReactor() r.core.setOptionsFromCs(cs) o = operators.Operator(cs) o.initializeInterfaces(r) a = assemblies.HexAssembly("fuel") a.spatialGrid = grids.axialUnitGrid(1) b = blocks.HexBlock("TestBlock") b.setType("fuel") dims = {"Tinput": 600, "Thot": 600, "op": 16.0, "ip": 1, "mult": 1} c = Hexagon("fuel", uZr.UZr(), **dims) b.add(c) a.add(b) a.spatialLocator = r.core.spatialGrid[1, 0, 0] o.r.core.add(a) return o
def test_blockName(self): block = blocks.HexBlock("blockName") block.spatialLocator = grids.IndexLocation(0, 0, 7, None) self.assertEqual( self.history._getBlockHistoryFileName(block), # pylint:disable=protected-access "{}-blockName7-bHist.txt".format(self.history.cs.caseTitle), )
def buildBlockWithTSL(): """Return a simple block containing something with a TSL (graphite).""" b = blocks.HexBlock("fuel", height=10.0) fuelDims = { "Tinput": 25.0, "Thot": 600, "od": 0.76, "id": 0.00, "mult": 127.0 } cladDims = { "Tinput": 25.0, "Thot": 450, "od": 0.80, "id": 0.77, "mult": 127.0 } coolDims = {"Tinput": 25.0, "Thot": 400} fuel = components.Circle("fuel", "UZr", **fuelDims) clad = components.Circle("clad", "Graphite", **cladDims) coolant = components.DerivedShape("coolant", "Sodium", **coolDims) b.add(fuel) b.add(clad) b.add(coolant) return b
def setUp(self): r""" Build a dummy reactor without using input files. There are some igniters and feeds but none of these have any number densities. """ self.o, self.r = test_reactors.loadTestReactor( self.directoryChanger.destination ) blockList = self.r.core.getBlocks() for bi, b in enumerate(blockList): b.p.flux = 5e10 if b.isFuel(): b.p.percentBu = 30.0 * bi / len(blockList) self.nfeed = len(self.r.core.getAssemblies(Flags.FEED)) self.nigniter = len(self.r.core.getAssemblies(Flags.IGNITER)) self.nSfp = len(self.r.core.sfp) # generate a reactor with assemblies # generate components with materials nPins = 271 fuelDims = {"Tinput": 273.0, "Thot": 273.0, "od": 1.0, "id": 0.0, "mult": nPins} fuel = components.Circle("fuel", "UZr", **fuelDims) cladDims = {"Tinput": 273.0, "Thot": 273.0, "od": 1.1, "id": 1.0, "mult": nPins} clad = components.Circle("clad", "HT9", **cladDims) interDims = { "Tinput": 273.0, "Thot": 273.0, "op": 16.8, "ip": 16.0, "mult": 1.0, } interSodium = components.Hexagon("interCoolant", "Sodium", **interDims) # generate a block self.block = blocks.HexBlock("TestHexBlock", self.o.cs) self.block.setType("fuel") self.block.setHeight(10.0) self.block.add(fuel) self.block.add(clad) self.block.add(interSodium) # generate an assembly self.assembly = assemblies.HexAssembly("TestAssemblyType") self.assembly.spatialGrid = grids.axialUnitGrid(1) for _ in range(1): self.assembly.add(copy.deepcopy(self.block)) # copy the assembly to make a list of assemblies and have a reference assembly self.aList = [] for _ in range(6): self.aList.append(copy.deepcopy(self.assembly)) self.refAssembly = copy.deepcopy(self.assembly) self.directoryChanger.open()
def createDummyReactor(): """ Create a dummy reactor with a single fuel assembly and a single fuel block. Often, a reactor model like this is built directly from input files rather than from code as done here. """ bp = blueprints.Blueprints() cs = settings.Settings() r = reactors.Reactor("Reactor", bp) r.add(reactors.Core("Core")) r.core.spatialGrid = grids.HexGrid.fromPitch(1.0) r.core.spatialGrid.symmetry = geometry.SymmetryType( geometry.DomainType.THIRD_CORE, geometry.BoundaryType.PERIODIC) r.core.spatialGrid.geomType = geometry.GeomType.HEX r.core.spatialGrid.armiObject = r.core r.core.setOptionsFromCs(cs) # Create a single fuel assembly a = assemblies.HexAssembly("fuel assembly") a.spatialGrid = grids.axialUnitGrid(1) a.spatialLocator = r.core.spatialGrid[1, 0, 0] # Create a single fuel block b = blocks.HexBlock("fuel block") b.setType("fuel") # Create a single fuel component with UZr fuel. dims = {"Tinput": 20, "Thot": 900, "id": 0.0, "od": 2.9, "mult": 7} c = Circle("fuel", uZr.UZr(), **dims) b.add(c) # Create a single structure component with HT9. dims = {"Tinput": 20, "Thot": 600, "op": 16.0, "ip": 15.0, "mult": 1} c = Hexagon("structure", ht9.HT9(), **dims) b.add(c) # Fill in the rest of the block with sodium coolant. dims = {"Tinput": 600, "Thot": 600} c = DerivedShape("coolant", sodium.Sodium(), **dims) b.add(c) a.add(b) r.core.add(a) _addFlux(b) return r