Пример #1
0
def buildOperatorOfEmptyCartesianBlocks(customSettings=None):
    """
    Builds a operator w/ a reactor object with some Cartesian 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

    if customSettings is None:
        customSettings = {}

    customSettings["db"] = False  # stop use of database
    cs = cs.modified(newSettings=customSettings)
    settings.setMasterCs(cs)  # reset

    r = tests.getEmptyCartesianReactor()
    r.core.setOptionsFromCs(cs)
    o = operators.Operator(cs)
    o.initializeInterfaces(r)

    a = assemblies.CartesianAssembly("fuel")
    a.spatialGrid = grids.axialUnitGrid(1)
    b = blocks.CartesianBlock("TestBlock")
    b.setType("fuel")
    dims = {
        "Tinput": 600,
        "Thot": 600,
        "widthOuter": 16.0,
        "lengthOuter": 10.0,
        "widthInner": 1,
        "lengthInner": 1,
        "mult": 1,
    }
    c = Rectangle("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
Пример #2
0
 def test_negativeArea(self):
     dims = {
         "Tinput": 25.0,
         "Thot": 430.0,
         "lengthOuter": 1.0,
         "lengthInner": 2.0,
         "widthOuter": 5.0,
         "widthInner": 6.0,
         "mult": 2,
     }
     refArea = dims["mult"] * (dims["lengthOuter"] * dims["widthOuter"] -
                               dims["lengthInner"] * dims["widthInner"])
     negativeRectangle = Rectangle("test", "Void", **dims)
     self.assertAlmostEqual(negativeRectangle.getArea(), refArea)
     with self.assertRaises(exceptions.NegativeComponentArea):
         negativeRectangle = Rectangle("test", "UZr", **dims)
         negativeRectangle.getArea()