Esempio n. 1
0
 def test_specifyTargetComponent(self):
     # build a test block
     b = HexBlock("fuel", height=10.0)
     fuelDims = {
         "Tinput": 25.0,
         "Thot": 25.0,
         "od": 0.76,
         "id": 0.00,
         "mult": 127.0
     }
     cladDims = {
         "Tinput": 25.0,
         "Thot": 25.0,
         "od": 0.80,
         "id": 0.77,
         "mult": 127.0
     }
     fuel = Circle("fuel", "FakeMat", **fuelDims)
     clad = Circle("clad", "FakeMat", **cladDims)
     b.add(fuel)
     b.add(clad)
     # call method, and check that target component is correct
     self.obj.expansionData.specifyTargetComponent(b)
     self.assertTrue(
         self.obj.expansionData.isTargetComponent(fuel),
         msg=
         "specifyTargetComponent failed to recognize intended component: {}"
         .format(fuel),
     )
Esempio n. 2
0
    def test_specifyTargetComponentRuntimeErrorSecond(self):
        # build block for testing
        b = HexBlock("test", height=10.0)
        fuelDims = {
            "Tinput": 25.0,
            "Thot": 25.0,
            "od": 0.76,
            "id": 0.00,
            "mult": 127.0
        }
        cladDims = {
            "Tinput": 25.0,
            "Thot": 25.0,
            "od": 0.80,
            "id": 0.77,
            "mult": 127.0
        }
        mainType = Circle("test", "FakeMat", **fuelDims)
        clad = Circle("test", "FakeMat", **cladDims)
        b.add(mainType)
        b.add(clad)
        b.setType("test")
        b.getVolumeFractions()
        # do test
        with self.assertRaises(RuntimeError) as cm:
            self.obj.expansionData.specifyTargetComponent(b)

            the_exception = cm.exception
            self.assertEqual(the_exception.error_code, 3)
Esempio n. 3
0
def _createHexBlockMesh(b: blocks.HexBlock) -> VtkMesh:
    assert b.spatialLocator is not None

    zMin = b.p.zbottom
    zMax = b.p.ztop

    gridOffset = b.spatialLocator.getGlobalCoordinates()[:2]
    gridOffset = numpy.tile(gridOffset, (6, 1))

    pitch = b.getPitch()
    hexVerts2d = numpy.array(hexagon.corners(rotation=0)) * pitch
    hexVerts2d += gridOffset

    # we need a top and bottom hex
    hexVerts2d = numpy.vstack((hexVerts2d, hexVerts2d))

    # fold in z locations to get 3d coordinates
    hexVerts = numpy.hstack(
        (hexVerts2d, numpy.array([[zMin] * 6 + [zMax] * 6]).transpose()))

    return VtkMesh(
        hexVerts,
        numpy.array(list(range(12))),
        numpy.array([12]),
        numpy.array([_HEX_PRISM_TID]),
    )
Esempio n. 4
0
 def test_specifyTargetComponentBlockWithMultipleFlags(self):
     # build a block that has two flags as well as a component matching each
     # flag
     b = HexBlock("fuel poison", height=10.0)
     fuelDims = {
         "Tinput": 25.0,
         "Thot": 600.0,
         "od": 0.9,
         "id": 0.5,
         "mult": 200.0
     }
     poisonDims = {
         "Tinput": 25.0,
         "Thot": 400.0,
         "od": 0.5,
         "id": 0.0,
         "mult": 10.0
     }
     fuel = Circle("fuel", "FakeMat", **fuelDims)
     poison = Circle("poison", "FakeMat", **poisonDims)
     b.add(fuel)
     b.add(poison)
     # call method, and check that target component is correct
     self.obj.expansionData.specifyTargetComponent(b)
     self.assertTrue(
         self.obj.expansionData.isTargetComponent(fuel),
         msg=
         "specifyTargetComponent failed to recognize intended component: {}"
         .format(fuel),
     )
Esempio n. 5
0
def _buildDummySodium():
    """Build a dummy sodium block."""
    b = HexBlock("dummy", height=10.0)

    sodiumDims = {
        "Tinput": 25.0,
        "Thot": 25.0,
        "op": 17,
        "ip": 0.0,
        "mult": 1.0
    }
    dummy = Hexagon("dummy coolant", "Sodium", **sodiumDims)

    b.add(dummy)
    b.getVolumeFractions()
    b.setType("dummy")

    return b
Esempio n. 6
0
 def __init__(self, name=None, cs=None):
     self.density = {}
     HexBlock.__init__(self, name or "MockBlock", cs
                       or settings.getMasterCs())
     self.r = MockReactor()
Esempio n. 7
0
    def test_isFuelLocked(self):
        b_TwoFuel = HexBlock("fuel", height=10.0)
        fuelDims = {
            "Tinput": 25.0,
            "Thot": 25.0,
            "od": 0.76,
            "id": 0.00,
            "mult": 127.0
        }
        fuel2Dims = {
            "Tinput": 25.0,
            "Thot": 25.0,
            "od": 0.80,
            "id": 0.77,
            "mult": 127.0,
        }
        fuel = Circle("fuel", "FakeMat", **fuelDims)
        fuel2 = Circle("fuel", "FakeMat", **fuel2Dims)
        b_TwoFuel.add(fuel)
        b_TwoFuel.add(fuel2)
        b_TwoFuel.setType("test")
        expdata = ExpansionData(HexAssembly("testAssemblyType"), setFuel=True)
        # do test
        with self.assertRaises(RuntimeError) as cm:
            expdata._isFuelLocked(b_TwoFuel)

            the_exception = cm.exception
            self.assertEqual(the_exception.error_code, 3)

        b_NoFuel = HexBlock("fuel", height=10.0)
        shield = Circle("shield", "FakeMat", **fuelDims)
        b_NoFuel.add(shield)
        with self.assertRaises(RuntimeError) as cm:
            expdata._isFuelLocked(b_NoFuel)

            the_exception = cm.exception
            self.assertEqual(the_exception.error_code, 3)
Esempio n. 8
0
def _buildTestBlock(blockType, name):
    """Return a simple pin type block filled with coolant and surrounded by duct.

    Parameters
    ----------
    blockType : string
        determines which type of block you're building

    name : string
        determines which fake material to use
    """
    b = HexBlock(blockType, height=10.0)

    fuelDims = {
        "Tinput": 25.0,
        "Thot": 25.0,
        "od": 0.76,
        "id": 0.00,
        "mult": 127.0
    }
    cladDims = {
        "Tinput": 25.0,
        "Thot": 25.0,
        "od": 0.80,
        "id": 0.77,
        "mult": 127.0
    }
    ductDims = {
        "Tinput": 25.0,
        "Thot": 25.0,
        "op": 16,
        "ip": 15.3,
        "mult": 1.0
    }
    intercoolantDims = {
        "Tinput": 25.0,
        "Thot": 25.0,
        "op": 17.0,
        "ip": ductDims["op"],
        "mult": 1.0,
    }
    coolDims = {"Tinput": 25.0, "Thot": 25.0}
    mainType = Circle(blockType, name, **fuelDims)
    clad = Circle("clad", name, **cladDims)
    duct = Hexagon("duct", name, **ductDims)

    coolant = DerivedShape("coolant", "Sodium", **coolDims)
    intercoolant = Hexagon("intercoolant", "Sodium", **intercoolantDims)

    b.add(mainType)
    b.add(clad)
    b.add(duct)
    b.add(coolant)
    b.add(intercoolant)
    b.setType(blockType)

    b.getVolumeFractions()

    return b