Beispiel #1
0
    CORE = dict([
        ('composed', True),
        ('name', 'Pin2d'),
        ('nnodes', [1, 1]),
        ('length', [[1.26], [1.26]]),
        ('components', [0]),
        ('boundary', [0, 0, 0, 0]),
        #('boundary', [2, 2, 2, 2]),
    ])
    LATT = dict()
    LATT[0] = dict([
        ('type', 'pin_map'),
        ('name', 'assembly'),
        ('nnodes', [1, 1]),
        ('components', [[0]]),
        ('water_gap', [0., 0., 0., 0.]),
        ('length', [[1.26], [1.26]]),
    ])
    PIN = dict()
    PIN[0] = newpin(ptype='pinnew', mat=[0, 2], fradius=0.54, name='Pin');
    forest.set_geometry(dim=2, core=CORE, lattices=LATT, pins=PIN)
    # Materials ---------------------------------------------------------------
    from get_c5g7_materials import get_c5g7_materials
    MIX = get_c5g7_materials()
    forest.set_materials(ngroups=7, mix=MIX)
    # Running forest ----------------------------------------------------------
    forest.run()
    #forest.clean()


Beispiel #2
0
def test():
    """
    >>> PROB_NAME = "1d1g_heter"
    >>> forest = RunForest(prob_name=PROB_NAME)
    >>> forest_refl = RunForest(prob_name=PROB_NAME+"_refl")
    >>> METHOD = setmethod(mtype='transport', dsa=False, quad=['GaussLegendre', 96])
    >>> ALGEBRA = setalgebra(matfree=True)
    >>> FE_SETTINGS= dict([('degree', 2), ('n_ref', 2)])
    >>> forest.set_settings(method=METHOD, fe_settings=FE_SETTINGS, algebra=ALGEBRA)
    >>> forest_refl.set_settings(method=METHOD, fe_settings=FE_SETTINGS)
    >>> LATT = dict()
    >>> LATT[0] = dict([('type', 'grid'), \
                    ('nnodes', [7]), \
                    ('components', [0, 1, 0, 1, 0, 1, 0]), \
                    ('length', [2.7, 2.4, 2.7, 2.4, 2.7, 2.4, 2.7])])
    >>> CORE = dict([('composed', True), \
                 ('nnodes', [1]), \
                 ('length', [[18.0]]), \
                 ('components', [0]), \
                 ('boundary', [0, 0])]) 
    >>> forest.set_geometry(dim=1, core=CORE, lattices=LATT)
    >>> LATT = dict()
    >>> LATT[0] = dict([('type', 'grid'), \
                    ('nnodes', [4]), \
                    ('components', [1, 0, 1, 0]), \
                    ('length', [1.2, 2.7, 2.4, 2.7])])
    >>> CORE = dict([('composed', True), \
                 ('nnodes', [1]), \
                 ('length', [[9.0]]), \
                 ('components', [0]), \
                 ('boundary', [2, 0])])
    >>> forest_refl.set_geometry(dim=1, core=CORE, lattices=LATT)
    >>> MIX = dict()
    >>> MIX[0] = dict([('name', 'moderator'), \
                   ('SigmaT', [0.37037000]), \
                   ('Chi',    [1.00000000]), \
                   ('SigmaS', [0.33400000]), \
                   ('NuSigF', [0.00000000])])
    >>> MIX[1] = dict([('name', 'fuel'), \
                   ('SigmaT', 0.41666700), \
                   ('Chi',    1.00000000), \
                   ('SigmaS', 0.33400000), \
                   ('NuSigF', 0.17800000)])
    >>> forest.set_materials(ngroups=1, mix=MIX)
    >>> forest_refl.set_materials(ngroups=1, mix=MIX)
    >>> forest.run() # doctest: +ELLIPSIS
    Running: ...
    >>> forest_refl.run() # doctest: +ELLIPSIS
    Running: ...
    >>> keff = forest.get_keff()
    >>> keff_refl = forest_refl.get_keff()
    >>> abs(keff-1.16222540417) < 1.e-6
    True
    >>> abs(keff_refl-1.16222594896) < 1.e-6
    True
    >>> abs(keff - keff_refl)< 1.e-6
    True
    """
    # -------------------------------------------------------------------------
    TESTDIR = "1d1g_heter/"
    PROB_NAME = "1d1g_heter"
    DESCRIPTION = ("Seven Regions Heterogeneous 1D Slab \n \n"
                   "The reference result is keff = 1.16224, and it has \n"
                   "been obtained from ONEDANT, using an angular \n"
                   "quadrature order of S96, with 500 fine mesh cells \n"
                   "in each region and a convergence criterion of \n"
                   "tol = 1.e-6, as it was reported in: \n \n"
                   "M. Capilla,  CF. Talavera,  D. Ginestar,  G. Verdu,  \n"
                   "\"A nodal collocation method for the calculation of \n"
                   "the lambda modes of the P_L equations'; \n"
                   "Annals of Nuclear Energy, 32,  (2005), 1825-1853.")
    forest = RunForest(prob_name=PROB_NAME, description=DESCRIPTION)
    forest_refl = RunForest(prob_name=PROB_NAME + "_refl",
                            description=DESCRIPTION)
    # Settings ----------------------------------------------------------------
    METHOD = setmethod(mtype='transport',
                       dsa=False,
                       quad=['GaussLegendre', 96])
    #METHOD = setmethod(mtype='transport', quad=['GaussLegendre', 96])
    #METHOD = setmethod(mtype='diffusion')
    #ALGEBRA = setalgebra(matfree=True)
    #ALGEBRA = setalgebra(matfree=True, eig=["PI",1.e-7,1000])
    #ALGEBRA = setalgebra(matfree=True, form=,'Standard',eig=["Krylov:1:3",1.e-7,1000], inner=["Krylov",1.e-9,1000,1])
    ALGEBRA = setalgebra(matfree=True,
                         form='Standard',
                         eig=["Krylov:1:3", 1.e-7, 1000],
                         mg=["krylov", 1.e-7, 100],
                         inner=["Krylov", 1.e-9, 1000])
    #ALGEBRA = setalgebra(matfree=True, eig=["PI",1.e-7,1000,'Standard'], inner=["Krylov",1.e-9,1000,1])
    FE_SETTINGS = dict([('degree', 2), ('n_ref', 2)])
    forest.set_settings(method=METHOD,
                        fe_settings=FE_SETTINGS,
                        algebra=ALGEBRA)
    forest_refl.set_settings(method=METHOD,
                             fe_settings=FE_SETTINGS,
                             algebra=ALGEBRA)
    # Geometry ----------------------------------------------------------------
    LATT = dict()
    lenr = 2.7  #1.0/0.371
    lenf = 2.4  #1.0/0.415
    LATT[0] = dict([('type', 'grid'), ('nnodes', [7]),
                    ('components', [0, 1, 0, 1, 0, 1, 0]),
                    ('length', [lenr, lenf, lenr, lenf, lenr, lenf, lenr])])
    CORE = dict([('composed', True), ('nnodes', [1]), ('length', [[18.0]]),
                 ('components', [0]), ('boundary', [0, 0])])
    forest.set_geometry(dim=1, core=CORE, lattices=LATT)

    # Geometry ----------------------------------------------------------------
    LATT = dict()
    lenr = 2.7  #1.0/0.371
    lenf = 2.4  #1.0/0.415
    LATT[0] = dict([('type', 'grid'), ('nnodes', [4]),
                    ('components', [0, 1, 0, 1]),
                    ('length', [lenr, lenf, lenr, lenf / 2])])
    CORE = dict([('composed', True), ('nnodes', [1]), ('length', [[9.0]]),
                 ('components', [0]), ('boundary', [0, 2])])
    forest_refl.set_geometry(dim=1, core=CORE, lattices=LATT)

    # Materials ---------------------------------------------------------------
    MIX = dict()
    MIX[0] = dict([('name', 'moderator'), ('SigmaT', [0.37037000]),
                   ('Chi', [1.00000000]), ('SigmaS', [0.33400000]),
                   ('NuSigF', [0.00000000])])
    MIX[1] = dict([('name', 'fuel'), ('SigmaT', 0.41666700),
                   ('Chi', 1.00000000), ('SigmaS', 0.33400000),
                   ('NuSigF', 0.17800000)])
    forest.set_materials(ngroups=1, mix=MIX)
    forest_refl.set_materials(ngroups=1, mix=MIX)
    # Running forest ----------------------------------------------------------
    forest.run()
    #forest.memory()
    forest_refl.run()
Beispiel #3
0
    probAss1.set_materials(ngroups=7, mix=MIX)
    probAss1.set_geometry(dim=1, core=COREASS1, lattices=LATT, pins=PIN)
    OUTPUT = dict([("homogenize", True)])
    probAss1.set_settings(method=METHOD,
                          fe_settings=FE_SETTINGS,
                          output=OUTPUT)
    # -------------------------------------------------------------------------
    probAss2 = RunForest(prob_name=PROB_ASS2, description=DESCRIPTION)
    probAss2.set_materials(ngroups=7, mix=MIX)
    probAss2.set_geometry(dim=1, core=COREASS2, lattices=LATT, pins=PIN)
    probAss2.set_settings(method=METHOD,
                          fe_settings=FE_SETTINGS,
                          output=OUTPUT)
    # Running forest ----------------------------------------------------------
    # -------------------------------------------------------------------------
    probAss1.run()
    probAss1.clean()
    # -------------------------------------------------------------------------
    probAss2.run()
    probAss2.clean()

    # -------------------------------------------------------------------------
    # Assembly homogenized
    # -------------------------------------------------------------------------
    PROB_HOMASS = '1dg7_c5g7_heter_HOMASS'
    DESCRIPTION = ("Homogenized version of the c5g7.")
    probHomAss = RunForest(prob_name=PROB_HOMASS, description=DESCRIPTION)
    # Geometry ----------------------------------------------------------------
    COREHOM = dict([
        ('composed', True),
        ('name', 'Core'),
Beispiel #4
0
def oneDc5g7_noupscattering(pinSize, method, nev=1, ncv=3):

    # -------------------------------------------------------------------------
    #  TESTDIR = "1d7g_c5g7_noupscattering/"
    pinSize_str = str(pinSize).replace('.', '')

    if method is 'kr':
        method_str = 'Krylov:' + str(nev) + ':' + str(ncv)
        PROB_NAME = ("1dg7_c5g7_" + method + '_' + pinSize_str + "cm" +
                     '_nev' + str(nev) + '_ncv' + str(ncv))
    else:
        method_str = 'PI'
        PROB_NAME = "1dg7_c5g7_" + method + '_' + pinSize_str + "cm"

    # If out file exists do not do anything
    out_file = PROB_NAME + '.out.xml'
    if (os.path.isfile(out_file)):
        return PROB_NAME

    DESCRIPTION = ("One-dimensional heterogeneous version of the c5g7.")
    forest = RunForest(prob_name=PROB_NAME, description=DESCRIPTION)
    # Settings ----------------------------------------------------------------
    METHOD = setmethod(mtype='transport', quad=['GaussLegendre', 16])
    #METHOD = setmethod(mtype='diffusion')
    FE_SETTINGS = dict([('degree', 2), ('n_ref', 1)])

    ALGEBRA = setalgebra(matfree=True,
                         eig=[method_str, 1.e-7, 1000, "Standard"],
                         inner=["Krylov", 1.e-9, 1000])
    forest.set_settings(method=METHOD,
                        fe_settings=FE_SETTINGS,
                        algebra=ALGEBRA)
    # Geometry ----------------------------------------------------------------

    CORE = dict([
        ('composed', True),
        ('name', 'Core'),
        ('nnodes', [3]),
        ('length', [[17 * pinSize, 17 * pinSize, 17 * pinSize]]),
        ('components', [[2, 1, 2]]),
        ('boundary', [2, 2]),
    ])
    LATT = dict()
    LATT[1] = dict([
        ('type', 'pin_map'),
        ('name', 'MOX'),
        ('nnodes', [17]),
        ('components', [[2, 3, 6, 4, 4, 6, 4, 4, 5, 4, 4, 6, 4, 4, 6, 3, 2]]),
        #('components', [[2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]]),
        ('water_gap', [0., 0.]),
        ('length', [[pinSize] * 17]),
    ])
    LATT[2] = dict([
        ('type', 'pin_map'),
        ('name', 'UOX'),
        ('nnodes', [17]),
        ('components', [[1, 1, 6, 1, 1, 6, 1, 1, 5, 1, 1, 6, 1, 1, 6, 1, 1]]),
        #('components', [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]),
        ('water_gap', [0., 0.]),
        ('length', [[pinSize] * 17]),
    ])
    PIN = dict()
    PIN[0] = newpin(ptype='box', mat=[0], name='moderator')
    PIN[1] = newpin(ptype='pin', mat=[0, 1], fradius=0.54, name='UO2')
    PIN[2] = newpin(ptype='pin', mat=[0, 2], fradius=0.54, name='MOX4.3')
    PIN[3] = newpin(ptype='pin', mat=[0, 3], fradius=0.54, name='MOX7.0')
    PIN[4] = newpin(ptype='pin', mat=[0, 4], fradius=0.54, name='MOX8.7')
    PIN[5] = newpin(ptype='pin', mat=[0, 5], fradius=0.54, name='fisschamber')
    PIN[6] = newpin(ptype='pin', mat=[0, 6], fradius=0.54, name='guidetube')
    forest.set_geometry(dim=1, core=CORE, lattices=LATT, pins=PIN)
    # Materials ---------------------------------------------------------------
    from get_c5g7_materials import get_c5g7_materials
    MIX = get_c5g7_materials()
    forest.set_materials(ngroups=7, mix=MIX)
    # Running forest ----------------------------------------------------------
    forest.run()
    forest.clean()
    return PROB_NAME
Beispiel #5
0
def test():
    """Return the keff of the Reactor

    >>> TESTDIR = "2d1g_homog/" 
    >>> PROB_NAME = "3d1g_homog" 
    >>> forest = RunForest(prob_name=PROB_NAME) 
    >>> METHOD = setmethod(mtype='transport', dsa=False, quad=['LevelSymType2', 2]) 
    >>> FE_SETTINGS= dict([('degree', 1), ('n_ref', 2)])
    >>> ALGEBRA = setalgebra(matfree=True)
    >>> forest.set_settings(method=METHOD, fe_settings=FE_SETTINGS, algebra=ALGEBRA)
    >>> CORE = dict([('composed', True),  \
                     ('name', 'mini core'), \
                     ('nnodes', [1, 1, 1]), \
                     ('length', [[2.0], [2.0], [2.0]]), \
                     ('components', [0]), \
                     ('boundary', [0, 0, 2, 2, 2, 2])]) 
    >>> LATT = dict() 
    >>> LATT[0] = dict([('type', 'grid'), \
                        ('name', 'assembly'), \
                        ('nnodes', [5, 5, 1]), \
                        ('components', [[0, 0, 0, 0, 0], \
                                        [0, 0, 0, 0, 0], \
                                        [0, 0, 0, 0, 0], \
                                        [0, 0, 0, 0, 0], \
                                        [0, 0, 0, 0, 0]]), \
                        ('length', [[0.4]*5, [0.4]*5, [2.0]*1])])
    >>> forest.set_geometry(dim=3, core=CORE, lattices=LATT)
    >>> MIX = dict()
    >>> MIX[0] = dict([('name', 'fuel'), \
                       ('SigmaT', 1.0000000000), \
                       ('Chi',    1.0000000000), \
                       ('SigmaS', 0.9000000000), \
                       ('NuSigF', 0.2500000000)]) 
    >>> forest.set_materials(ngroups=1, mix=MIX)
    >>> forest.run() # doctest: +ELLIPSIS
    Running: ...
    >>> print forest.get_keff()
    """

    # -------------------------------------------------------------------------
    PROB_NAME = "3d1g_homog"
    DESCRIPTION = (
        'Homogeneous slab 10.0 cm (it can be a 2.0 cm or 10.0 cm slab) \n'
        'The reference for sn = 96 is keff = 0.662951 (2cm slab) \n'
        'The reference for sn = 96 is keff = 2.00193 (10cm slab) \n'
        'This problem is provided in the following paper: \n \n'
        'M. Capilla,  CF. Talavera,  D. Ginestar,  G. Verdu,  \n'
        '"A nodal collocation method for the calculation of \n'
        'the lambda modes of the P_L equations"; \n'
        'Annals of Nuclear Energy, 32,  (2005), 1825--1853.')
    forest = RunForest(prob_name=PROB_NAME, description=DESCRIPTION)
    # Settings ----------------------------------------------------------------
    #METHOD = setmethod(mtype='transport', dsa=False, quad=['LevelSymType2', 4])
    #METHOD = setmethod(mtype='transport',quad=['LevelSymType2', 2])
    METHOD = setmethod(mtype='diffusion')
    FE_SETTINGS = dict([('degree', 3), ('n_ref', 5)])
    #ALGEBRA = setalgebra(matfree=False)
    ALGEBRA = setalgebra(matfree=True)
    forest.set_settings(method=METHOD,
                        fe_settings=FE_SETTINGS,
                        algebra=ALGEBRA)
    # Geometry ----------------------------------------------------------------
    CORE = dict([('composed', True), ('name', 'mini core'),
                 ('nnodes', [1, 1, 1]), ('length', [[2.0], [2.0], [2.0]]),
                 ('components', [0]), ('boundary', [0, 0, 2, 2, 2, 2])])
    LATT = dict()
    LATT[0] = dict([
        ('type', 'grid'),
        ('name', 'assembly'),
        ('nnodes', [5, 5, 1]),
        ('components', [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0],
                        [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]),
        ('length', [[0.4] * 5, [0.4] * 5, [2.0] * 1]),
    ])
    forest.set_geometry(dim=3, core=CORE, lattices=LATT)
    # Materials ---------------------------------------------------------------
    MIX = dict()
    MIX[0] = dict([('name', 'fuel'), ('SigmaT', 1.0000000000),
                   ('Chi', 1.0000000000), ('SigmaS', 0.9000000000),
                   ('NuSigF', 0.2500000000)])
    forest.set_materials(ngroups=1, mix=MIX)
    # Running forest ----------------------------------------------------------
    forest.run()
    forest.get_keff()
    forest.debug()
Beispiel #6
0
    MIX[0] = dict([('name', 'water'), ('SigmaT', [0.1889751875, 1.4632718759]),
                   ('Chi', [1.0000000000, 0.0000000000]),
                   ('SigmaS', [[0.1506751875, 0.0000000000],
                               [0.0380000000, 1.4535718759]]),
                   ('NuSigF', [0.0000000000, 0.0000000000])])
    MIX[1] = dict([('name', 'FuelI'), ('SigmaT', [0.2262955419, 1.0119409026]),
                   ('Chi', [1.0000000000, 0.0000000000]),
                   ('SigmaS', [[0.2005955419, 0.0000000000],
                               [0.0161000000, 0.9355409026]]),
                   ('NuSigF', [0.0067000000, 0.1241000000])])
    MIX[2] = dict([('name', 'FuelII'), ('SigmaT', [0.2251643699,
                                                   0.9914733293]),
                   ('Chi', [1.0000000000, 0.0000000000]),
                   ('SigmaS', [[0.1994643699, 0.0000000000],
                               [0.0156000000, 0.9013733293]]),
                   ('NuSigF', [0.0078000000, 0.1542000000])])
    MIX[3] = dict([('name', 'FuelIIg'),
                   ('SigmaT', [0.2172685004, 1.0605578534]),
                   ('Chi', [1.0000000000, 0.0000000000]),
                   ('SigmaS', [[0.1901685004, 0.0000000000],
                               [0.0136000000, 0.5732578534]]),
                   ('NuSigF', [0.0056000000, 0.0187000000])])
    forest_hom.set_materials(ngroups=2, mix=MIX)
    forest_het.set_materials(ngroups=2, mix=MIX)
    # Running forest ----------------------------------------------------------
    forest_hom.run()
    forest_hom.clean()

    forest_het.run()
    forest_het.clean()