Пример #1
0
                    I = I0
                    flx_tolerance *= 2
                    f = lambda b: b * L - (1 - L / extrap_len) * np.tan(b * L)
                    # info: add a small epsilon to the left bound to avoid
                    #       failure of root-finding algorithm
                    BG = brentq(
                        lambda b: b * L - (1 - L / extrap_len) * np.tan(b * L),
                        .50000001 * np.pi / L, np.pi / L)
                    diffsol_ref = lambda x: np.sin(BG * x) / x
                    # integration of sin(x)/x yields 'sine integral func'
                    # anorm, _ = sici(BG * L)
                    # integration of (sin(BG*r)/r) r**2 dr yields
                    anorm = (np.sin(BG * L) - BG * L * np.cos(BG * L)) / BG**2
                    Dktol, Dftol = 2e-3, 2e-2
            # r = geomprogr_mesh(N=I, L=L, ratio=0.95)
            r = equivolume_mesh(I, 0, L, geo)

            lg.info('Reference critical length (L) is %.6f cm' % L)
            lg.info('Extrapolation distance (zeta*D) is %.3f cm' % extrap_len)
            xs_media, media = set_media(materials[m], L, m)
            data = input_data(xs_media,
                              media,
                              r,
                              geo,
                              LBC=LBC,
                              RBC=0,
                              per_unit_angle=True)

            # *** WARNING ***
            # The extrapolation length is a quite large w.r.t. to the problem
            # width in these problems. Therefore, the numerical solution can be
Пример #2
0
    lg.info("***            UD2O-H2Ox-1-0-x            ***")
    materials = change_H2O(materials)

    # --------------------------------------------------------------------------
    # Problem 25
    m, geo = 'UD2O', 'slab'
    case = "%s-H2O(1)-1-0-%s" % (m, get_geoid(geo))
    I0 = 180  # to get 5 significative digits, i.e. error below 1 pcm.
    L0, L1, L = 9.214139, 1.830563, Lc[case]
    LBC = RBC = 0
    I1 = I0
    I = I1 + I0
    widths_of_buffers = [L1, L + L0, 2 * L]
    xs_media, media = set_media(materials, widths_of_buffers,
                                ['H2O', m, 'H2O'])
    r = equivolume_mesh(I1, 0, widths_of_buffers[0], geo)
    for i in range(2):
        Lb, Le = widths_of_buffers[i], widths_of_buffers[i + 1]
        Ix = I0 if i % 2 == 0 else I1
        r = np.append(r, equivolume_mesh(Ix, Lb, Le, geo)[1:])

    data = input_data(xs_media, media, r, geo, LBC=LBC, RBC=RBC)
    slvr_opts = solver_options(iitmax=5,
                               oitmax=5,
                               ritmax=200,
                               CMFD=True,
                               pCMFD=False,
                               Anderson_depth='auto')
    filename = os.path.join(odir, case + "_LBC%dRBC%d_I%d" % (LBC, RBC, I))
    flx, k = run_calc_with_RM_its(data, slvr_opts, filename)
    np.testing.assert_allclose(k,
Пример #3
0
    import logging as lg
    lg.info("***           Sood's test suite           ***")
    lg.info("*** 1G heterogeneous isotropic scattering ***")
    lg.info("***             Ux-H2Ox-1-0-x             ***")
    
    # --------------------------------------------------------------------------

    # Problem 16 
    m, geo, nks = 'Ub', 'sphere', 4
    case = "%s-H2O(1)-1-0-%s" % (m, get_geoid(geo))
    L0, L1, L = 6.12745, 3.063725, Lc[case]
    LBC, RBC = 2, 0
    I1 = I0 = 20  # to get error on k less than 10 pcm
    I = I1 + I0
    xs_media, media = set_media(materials, [L0, L], [m, 'H2O'])
    r = equivolume_mesh(I0, 0, L0, geo)
    r = np.append(r, equivolume_mesh(I1, L0, L, geo)[1:])
    
    data = input_data(xs_media, media, r, geo, LBC=LBC, RBC=RBC,
                      per_unit_angle=True)
    slvr_opts = solver_options(iitmax=5, oitmax=5, ritmax=200, CMFD=True,
                               pCMFD=False, Anderson_depth='auto',
                               ks=np.full(I, nks))
    filename = os.path.join(odir, case + "_LBC%dRBC%d_I%d" %
                            (LBC, RBC, I))
    flx, k = run_calc_with_RM_its(data, slvr_opts, filename)
    np.testing.assert_allclose(k, 1.0, atol=1.e-4, err_msg=case +
                               ": criticality not verified")
    
    # Problem 18 
    m = 'Uc'
Пример #4
0
                               geometry_type, LBC=2, RBC=2)
 
 # ks is needed anyway when validating the input solver options
 k, flx = solve_cpm1D(Homog2GSlab_data, solver_options(ks=np.full(I, 0)))
 
 flxinf = np.dot(np.linalg.inv(np.diag(st) - ss[:,:,0]), chi)
 kinf = np.dot(nsf, flxinf)  # 1.07838136
 flxinf *= np.linalg.norm(flx[:, 0]) / np.linalg.norm(flxinf)
 np.testing.assert_allclose(flx, np.tile(flxinf, (I, 1)).T,
                            err_msg="flx-inf not verified")
 np.testing.assert_allclose(k, kinf, atol=1.e-7,
                            err_msg="k-inf not verified")
 # solve the MC2011 problem
 lg.info("Solve the MC2011 problem by CPM in the " + geometry_type)
 # L *= 2; media = [['HM', L]]
 I = 100  # number of cells in the spatial mesh
 r = equivolume_mesh(I, 0, L, geometry_type)
 # r = geomprogr_mesh(I, 0, L, ratio=1.005)
 # warning: remind that the solution in half slab use white reflection
 # at the center, introducing some error!
 Homog2GSlab_data = input_data(xs_media, media, r,
                               geometry_type, LBC=0, RBC=2)
 
 # ks is needed anyway when validating the input solver options
 k, flx = solve_cpm1D(Homog2GSlab_data,
                      solver_options(ks=np.full(I, 0)), vrbs=False)
 kref = 0.744417
 np.testing.assert_allclose(k, kref, atol=1.e-3,
                            err_msg="ref k of MC2011 not verified")
 lg.info("k verified up to about three significant digits")
 lg.info("Reference k from S16 is %.6f" % kref)
Пример #5
0
    lg.info("***            PUx-H2Ox-1-0-x             ***")

    # --------------------------------------------------------------------------

    # Problem 3
    m, geo = 'PUa', 'slab'
    LBC, RBC = 0, 0
    case = "%s-H2O(1)-1-0-%s" % (m, get_geoid(geo))
    L0, L1, L = 1.47840, 3.063725, Lc[case]
    I0 = 80  # nb. of cells in the fuel
    I1 = I0 * 2
    I = I0 + I1

    widths_of_buffers = [2 * L0, 2 * L0 + L1]
    xs_media, media = set_media(materials, widths_of_buffers, [m, 'H2O'])
    r = equivolume_mesh(I0, 0, widths_of_buffers[0], geo)
    r = np.append(r, equivolume_mesh(I1, *widths_of_buffers, geo)[1:])

    data = input_data(xs_media, media, r, geo, LBC=LBC, RBC=RBC)
    slvr_opts = solver_options(iitmax=5,
                               oitmax=5,
                               ritmax=200,
                               CMFD=True,
                               pCMFD=False,
                               Anderson_depth='auto')
    filename = os.path.join(odir, case + "_LBC%dRBC%d_I%d" % (LBC, RBC, I))
    flx, k = run_calc_with_RM_its(data, slvr_opts, filename)
    np.testing.assert_allclose(k,
                               1.0,
                               atol=1.e-5,
                               err_msg=case + ": criticality not verified")