def test_componentInteractionsLinkingBySubtraction(self): r"""Tests linking of components by subtraction.""" nPins = 217 gapDims = { "Tinput": 25.0, "Thot": 430.0, "od": 1.0, "id": 0.9, "mult": nPins } gap = Circle("gap", "Void", **gapDims) fuelDims = { "Tinput": 25.0, "Thot": 430.0, "od": 0.9, "id": 0.0, "mult": nPins, "modArea": "gap.sub", } fuel = Circle("fuel", "UZr", components={"gap": gap}, **fuelDims) gapArea = (gap.getDimension("mult") * math.pi * ((gap.getDimension("od") / 2.0)**2 - (gap.getDimension("id") / 2.0)**2)) fuelArea = (fuel.getDimension("mult") * math.pi * ((fuel.getDimension("od") / 2.0)**2 - (fuel.getDimension("id") / 2.0)**2)) ref = fuelArea - gapArea cur = fuel.getArea() self.assertAlmostEqual(cur, ref)
def test_componentInteractionsLinkingByDimensions(self): r"""Tests linking of components by dimensions.""" nPins = 217 fuelDims = { "Tinput": 25.0, "Thot": 430.0, "od": 0.9, "id": 0.0, "mult": nPins } cladDims = { "Tinput": 25.0, "Thot": 430.0, "od": 1.1, "id": 1.0, "mult": nPins } fuel = Circle("fuel", "UZr", **fuelDims) clad = Circle("clad", "HT9", **cladDims) gapDims = { "Tinput": 25.0, "Thot": 430.0, "od": "clad.id", "id": "fuel.od", "mult": nPins, } gapDims["components"] = {"clad": clad, "fuel": fuel} gap = Circle("gap", "Void", **gapDims) mult = gap.getDimension("mult") od = gap.getDimension("od") id = gap.getDimension("id") ref = mult * math.pi * ((od / 2.0)**2 - (id / 2.0)**2) cur = gap.getArea() self.assertAlmostEqual(cur, ref)