Esempio n. 1
0
    }
}

if (core_config < 1) or (core_config > 3):
    raise TypeError('Invalid core configuration no. [1-3].')
else:
    core = np.ones(nfa, dtype=np.int)
    core[1::2] += core_config

cum_sum_list = lambda l1: l1[0] + cum_sum_list(l1[1:]) if len(l1) != 1 else l1[
    0]
media = cum_sum_list([get_fa(core[i], i, Lmat) for i in range(nfa)])

# set b.c.
LBC, RBC = 0, 0

Heter2GSlab_data = input_data(xs_media, media, xi, geometry_type, LBC, RBC)

if __name__ == "__main__":

    import logging as lg
    lg.info("*** Solve the Rahnema 1997 problem ***")
    from FDsDiff1D import run_calc_with_RM_its, solver_options

    ritmax = 10
    CMFD, pCMFD = True, False
    slvr_opts = solver_options(ritmax=ritmax, CMFD=CMFD, pCMFD=pCMFD)
    filename = "../output/kflx_Rahnema1997_C%d_LBC%dRBC%d_I%d_itr%d" % \
               (core_config, LBC, RBC, I, ritmax)
    flx, k = run_calc_with_RM_its(Heter2GSlab_data, slvr_opts, filename)
Esempio n. 2
0
    for I0 in [40]:

        m = 'PUa'  # only one case in the test suite
        L = rc = 1.853722 * 2  # cm, critical length
        # L = rc = 0.605055  # mfp
        xs_media, media = set_media(materials[m], L, m)

        geo = "slab"
        case = "%s-1-0-%s" % (m, get_geoid(geo))  # + 'h'
        lg.info("Test case: " + case)

        # I = I0 #* 2 # number of cells in the spatial mesh
        I = 25
        r = equivolume_mesh(I, 0, L, geo)
        # r = np.array([0, 1 / 8., 1 / 6., 0.9, 1]) * L
        data = input_data(xs_media, media, r, geo, LBC=0, RBC=0)

        # ks is needed anyway when validating the input solver options
        k, flx = solve_cpm1D(data, solver_options(ks=np.full(I, 0)), False)
        np.testing.assert_allclose(k,
                                   1,
                                   atol=1.e-3,
                                   err_msg=case + ": criticality not verified")
        np.save(os.path.join(odir, case + '_ref_I%d.npy' % I), [k, flx, None])

        m = 'PUb'  # only one case in the test suite
        # critical lengths
        rc_dict = {'slab': 2.256751, 'cylinder': 4.279960, 'sphere': 6.082547}

        for geo in geoms:
            case = "%s-1-0-%s" % (m, get_geoid(geo))
Esempio n. 3
0
                    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
            # very different from the analytical one (still an extrapolation
            # length is considered).
            lg.info(' -o-' * 15)
            lg.info('analytical solution of the diffusion equation')
            ansol, DFkref = diffsol_ref(data.xim), \
                            diffk_ref(BG**2, materials[m])
            # lg.info('fund. flx\n' +
            #         str(ansol / np.sum(ansol * data.Vi) * G * I))
Esempio n. 4
0
 materials = change_H2O(materials)
 
 # --------------------------------------------------------------------------
 # Problem 30
 m, geo = 'Ue', 'slab'
 case = "%s-Fe-Na-1-0-%s" % (m, get_geoid(geo))
 L0, L1, L2, L = 0.317337461, 5.437057544, 5.754395005, Lc[case]
 LBC = RBC = 0
 I0 = 65 # within clad - Fe
 I1 = 180 # fuel
 I2 = 100 # within moderator - Na
 I = [I0, I1, I0, I2]
 
 widths_of_buffers = [L0, L1, L2, L]
 xs_media, media = set_media(materials,
     widths_of_buffers, ['Fe', m, 'Fe', 'Na'])
 r = equivolume_mesh(I0, 0, widths_of_buffers[0], geo)
 for i in range(3):
     Lb, Le = widths_of_buffers[i], widths_of_buffers[i+1]
     Ix = I[i] #[i] = 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, sum(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")