예제 #1
0
 # 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))
 lg.info('kinf = {:.6}, k_DIFF = {:.6f}, BG2 = {:.6f}'.format(
     materials[m]['kinf'], diffk_ref(BG**2, materials[m]), BG**2))
 lg.info(' -o-' * 15)
 # diffusion problem
 slvr_opts = solver_options(iitmax=5,
                            oitmax=5,
                            ritmax=0,
                            ks=np.full(I, nks))
 filename = os.path.join(
     odir, case + "_LBC%dRBC%d_I%d_diff" % (LBC, 0, I))
 flx, k = run_calc_with_RM_its(data, slvr_opts, filename)
 flx *= anorm / np.sum(flx) / data.Vi
 np.save(
     filename.replace('_diff', '_andf') + '.npy',
     (DFkref, BG, (1 - flx[0, :] / ansol) * 100))
 np.testing.assert_allclose(
     k,
     DFkref,
     atol=Dktol,
     err_msg=case +
     ": criticality against diffusion analytically solved not " +
     "verified")
예제 #2
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)
예제 #3
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")