コード例 #1
0
ファイル: test_2x2deplete.py プロジェクト: drewejohnson/hydep
def depletionModel():
    # Roughly one-fourth volume of fuel in PWR
    VOLUME = math.pi * 0.49**2 * 360 * 264 / 4
    fuel1 = hydep.BurnableMaterial("partially burned PWR fuel",
                                   adens=2.6858e-2,
                                   temperature=900,
                                   volume=VOLUME)

    ISO_THRESH = 1e-10
    CONC_FILE = pathlib.Path(__file__).parent / "partial_burned.dat"
    with CONC_FILE.open("r") as stream:
        for line in stream:
            za, adens = line.split()
            adens = float(adens)
            if adens < ISO_THRESH:
                continue
            z, a = divmod(int(za), 1000)
            fuel1[(z, a, 0)] = adens

    water = hydep.Material("water", mdens=0.7, H1=2, O16=1)
    clad = hydep.Material("clad", mdens=6.6, Zr96=1)

    fuel2 = fuel1.copy()
    fuel3 = fuel1.copy()
    fuel4 = hydep.BurnableMaterial(
        "other fuel",
        adens=fuel1.adens,
        temperature=fuel1.temperature,
        volume=VOLUME,
        O16=4.643355421e-4,
        U234=4.742255584e-9,
        U235=7.403701961e-4,
        U236=1.090905903e-5,
        U238=2.550365361e-2,
    )

    pin1 = hydep.Pin([0.39, 0.42], [fuel1, clad], outer=water)
    pin2 = hydep.Pin([0.39, 0.42], [fuel2, clad], outer=water)
    pin3 = hydep.Pin([0.39, 0.42], [fuel3, clad], outer=water)
    pin4 = hydep.Pin([0.39, 0.42], [fuel4, clad], outer=water)

    PITCH = 1.2

    cart = hydep.CartesianLattice(nx=2,
                                  ny=2,
                                  pitch=1.2,
                                  array=[[pin1, pin2], [pin3, pin4]],
                                  outer=water)

    assembly = hydep.LatticeStack(1, [0, 360], [cart])
    assembly.bounds = ((-PITCH, PITCH), (-PITCH, PITCH), (0, 360))

    # TODO Retrieve boundaries from model if given
    model = hydep.Model(assembly)
    model.bounds = assembly.bounds

    yield model
コード例 #2
0
def toy2x2lattice():
    """A simple 2x2 model with 4 UO2 fuel pins"""
    fuel = hydep.BurnableMaterial("fuel", mdens=10.4, U235=8e-4, U238=2e-2, O16=4e-4)
    clad = hydep.Material("clad", mdens=6, Zr91=4e-2)
    water = hydep.Material("water", mdens=1, H1=5e-2, O16=2e-2)

    pin = hydep.Pin([0.42, 0.45], [fuel, clad], outer=water)

    return hydep.CartesianLattice(2, 2, 1.23, [[pin, pin], [pin, pin]])
コード例 #3
0
ファイル: test_geometry.py プロジェクト: drewejohnson/hydep
def materials():
    # TODO Global fixture?
    fuel = hydep.BurnableMaterial("fuel",
                                  mdens=10.4,
                                  U235=8.0e-4,
                                  U238=2.5e-2,
                                  O16=4.6e-4)
    water = hydep.Material("water", mdens=1.0, H1=4.7e-2, O16=2.4e-2)

    clad = hydep.Material("clad", mdens=6.5, Zr90=4.32e-2)

    return {mat.name: mat for mat in [fuel, water, clad]}
コード例 #4
0
ファイル: test_model.py プロジェクト: drewejohnson/hydep
def test_boundsCheck(root):
    dummy = hydep.Material("dummy", adens=1)
    model = hydep.Model(hydep.InfiniteMaterial(dummy))

    assert model.bounds is None
    assert model.root.bounds is None
    assert not model.isBounded()

    if root:

        def setbounds(x=None, y=None, z=None):
            model.root.bounds = x, y, z

    else:

        def setbounds(x=None, y=None, z=None):
            model.bounds = x, y, z

    setbounds(None, None, None)
    assert not model.isBounded()
    for dim in {"x", "y", "z", "X", "Y", "Z", "all", "AlL"}:
        assert not model.isBounded(dim)

    for dim in {"x", "y", "z"}:
        setbounds(**{dim: (-1, 1)})
        assert model.isBounded(dim)
        setbounds(**{dim: None})

    for bounds in [
        (0, math.inf),
        (-math.inf, math.inf),
        (0, numpy.inf),
        (-math.inf, numpy.inf),
    ]:
        for dim in {"x", "y", "z"}:
            setbounds(**{dim: bounds})
            assert not model.isBounded(dim)
            assert not model.isBounded("all")
            setbounds(**{dim: None})

        setbounds(x=bounds, y=(1, 2), z=None)
        assert not model.isBounded()
        setbounds(x=(1, 2), y=bounds, z=None)
        assert not model.isBounded()

    # Check validity of 2D unbounded Z problems

    setbounds(x=(-1, 1), y=(-1, 1), z=None)
    assert model.isBounded()

    setbounds(x=numpy.arange(2), y=[-0.6, 0.6], z=[0, 360])
    assert model.isBounded()
    assert model.isBounded("x")
    assert model.isBounded("y")
    assert model.isBounded("z")
コード例 #5
0
def pincell():
    fuel = hydep.BurnableMaterial("fuel", mdens=10.4, volume=math.pi * 0.39 * 0.39)
    fuel["O16"] = 4.6391716e-2
    fuel["U234"] = 9.3422610e-6
    fuel["U235"] = 1.0452130e-3
    fuel["U236"] = 4.7875776e-6
    fuel["U238"] = 2.2145310e-2

    water = hydep.Material("water", mdens=1, temperature=600)
    water["H1"] = 5.01543e-2
    water["O16"] = 2.50771e-2
    water.addSAlphaBeta("HinH2O")

    clad = hydep.Material("clad", mdens=6.6, temperature=600)
    clad["Fe56"] = 1.24985e-2
    clad["H1"] = 3.34334e-2
    clad["O16"] = 1.66170e-2

    pin = hydep.Pin([0.39, 0.402], [fuel, clad], outer=water)

    HPITCH = 0.63
    model = hydep.Model(pin)
    model.bounds = pin.bounds = ((-HPITCH, HPITCH), (-HPITCH, HPITCH), None)
    return model
コード例 #6
0
ファイル: conftest.py プロジェクト: drewejohnson/hydep
def simpleSfvProblem(endfChain):
    PIN_RAD = 0.39
    PIN_HEIGHT = 10
    PITCH = 1.2

    volume = math.pi * PIN_RAD**2 * PIN_HEIGHT

    fuel1 = hydep.BurnableMaterial("partial burned PWR fuel",
                                   adens=2.6856e-2,
                                   temperature=900,
                                   volume=volume)

    fuel1[80160] = 4.643e-04
    fuel1[922340] = 4.742e-9
    fuel1[922350] = 7.404e-4
    fuel1[922360] = 1.091e-5
    fuel1[922380] = 2.550e-5
    fuel1[942390] = 2.569e-05
    fuel1[942400] = 1.099e-06
    fuel1[942410] = 1.225e-07
    fuel1[942420] = 1.866e-09

    fuel2 = fuel1.copy()
    fuel3 = fuel1.copy()

    fuel4 = hydep.BurnableMaterial(
        "other fuel",
        adens=fuel1.adens,
        temperature=fuel1.temperature,
        volume=volume,
        O16=4.6433e-4,
        U234=4.742e-9,
        U235=7.403e-4,
        U236=1.091e-5,
        U238=2.55e-2,
    )

    water = hydep.Material("water", mdens=0.7, H1=2, O16=1)
    clad = hydep.Material("clad", mdens=6.6, Zr96=1)

    pin1 = hydep.Pin([PIN_RAD, 0.42], [fuel1, clad], outer=water)
    pin2 = hydep.Pin([PIN_RAD, 0.42], [fuel2, clad], outer=water)
    pin3 = hydep.Pin([PIN_RAD, 0.42], [fuel3, clad], outer=water)
    pin4 = hydep.Pin([PIN_RAD, 0.42], [fuel4, clad], outer=water)

    cart = hydep.CartesianLattice(nx=2,
                                  ny=2,
                                  pitch=1.2,
                                  array=[[pin1, pin2], [pin3, pin4]],
                                  outer=water)

    assembly = hydep.LatticeStack(2, [0, PIN_HEIGHT, 2 * PIN_HEIGHT],
                                  [cart, cart])
    assembly.bounds = ((-PITCH, PITCH), (-PITCH, PITCH), (0, 2 * PIN_HEIGHT))

    model = hydep.Model(assembly)
    model.bounds = assembly.bounds
    model.root.differentiateBurnableMaterials()

    problem = Mock()
    problem.model = model
    problem.dep.burnable = tuple(model.root.findBurnableMaterials())
    problem.dep.chain = endfChain

    settings = hydep.settings.Settings(fittingOrder=1, numFittingPoints=2)
    settings.sfv.densityCutoff = 0.0
    settings.sfv.modes = len(problem.dep.burnable) - 2
    problem.settings = settings

    yield problem
コード例 #7
0
ファイル: test_model.py プロジェクト: drewejohnson/hydep
def simpleModel():
    univ = hydep.InfiniteMaterial(hydep.Material("inf", adens=1))
    return hydep.Model(univ)
コード例 #8
0
def beavrsMaterials():
    """Dictionary of materials from the BEAVRS specification

    Currently provides:

        fuel32 -> 3.2 wt% enriched UO2
        air -> air
        zirc4 -> zircaloy 4 cladding
        water -> unborated water
        helium -> helium
        bglass -> boroscillicate glass
        ss304 -> stainless steel 304

    """
    fuel3_2 = hydep.BurnableMaterial("fuel32",
                                     mdens=10.34,
                                     temperature=900,
                                     O16=4.6026E-2,
                                     O17=1.7533E-5,
                                     U234=5.9959E-6,
                                     U235=7.4629E-4,
                                     U238=2.2317E-2)
    air = hydep.Material("air",
                         mdens=0.000616,
                         O16=5.2863E-6,
                         O17=2.0137E-9,
                         N14=1.9681E-5,
                         N15=7.1899E-8,
                         Ar36=7.8729E-10,
                         Ar38=1.4844E-10,
                         Ar40=2.3506E-7,
                         C12=6.7564E-9)
    zirc4 = hydep.Material(
        "zirc4",
        mdens=6.55,
        O16=3.0743E-04,
        O17=1.1711E-07,
        Cr50=3.2962E-06,
        Cr52=6.3564E-05,
        Cr53=7.2076E-06,
        Cr54=1.7941E-06,
        Fe54=8.6699E-06,
        Fe56=1.3610E-04,
        Fe57=3.1431E-06,
        Fe58=4.1829E-07,
        Zr90=2.1827E-02,
        Zr91=4.7600E-03,
        Zr92=7.2758E-03,
        Zr94=7.3734E-03,
        Zr96=1.1879E-03,
        Sn112=4.6735E-06,
        Sn114=3.1799E-06,
        Sn115=1.6381E-06,
        Sn116=7.0055E-05,
        Sn117=3.7003E-05,
        Sn118=1.1669E-04,
        Sn119=4.1387E-05,
        Sn120=1.5697E-04,
        Sn122=2.2308E-05,
        Sn124=2.7897E-05,
    )
    water = hydep.Material("water",
                           mdens=0.7405,
                           temperature=600,
                           B11=3.2210E-5,
                           H1=4.9458E-2,
                           H2=5.6883E-6,
                           O16=2.4672E-2,
                           O17=9.3981E-06)
    water.addSAlphaBeta("HinH2O")

    helium = hydep.Material("helium",
                            mdens=0.0015981,
                            He3=3.2219E-10,
                            He4=2.4044E-4)

    bglass = hydep.BurnableMaterial("bglass", mdens=2.26)
    for za, adens in (
        (130270, 1.74520e-03),
        (140280, 1.69250e-02),
        (140290, 8.59790e-04),
        (140300, 5.67440e-04),
        (50100, 9.65060e-04),
        (50110, 3.91890e-03),
        (80160, 4.65110e-02),
        (80170, 1.77170e-05),
    ):
        bglass[za] = adens

    ss304 = hydep.Material("ss304", mdens=8.03)
    for za, adens in (
        (140280, 9.52760e-04),
        (140290, 4.84010e-05),
        (140300, 3.19440e-05),
        (240500, 7.67780e-03),
        (240520, 1.48060e-02),
        (240530, 1.67890e-03),
        (240540, 4.17910e-04),
        (250550, 1.76040e-03),
        (260540, 3.46200e-03),
        (260560, 5.43450e-02),
        (260570, 1.23310e-03),
        (260580, 1.67030e-04),
        (280580, 5.60890e-03),
        (280600, 2.16050e-03),
        (280610, 9.39170e-05),
        (280620, 2.99460e-04),
        (280640, 7.62520e-05),
    ):
        ss304[za] = adens

    return {
        m.name: m
        for m in [ss304, bglass, fuel3_2, air, zirc4, water, helium]
    }