Пример #1
0
def makeDGMXS(G, refXS, dgmstructure, basisType):
    if 'klt' in basisType:
        makeKLT(basisType, dgmstructure)
    else:
        makeDLP(dgmstructure)

    dgmstructure.fname = '{}_{}'.format(basisType, dgmstructure.fname)

    fname = '_homo.'.join(xs_name.split('.'))
    refXS.write_homogenized_XS(fname)

    nPin, fm, cm, mm = buildGEO(pin_map)

    dgm = sph_dgm.DGMSOLVER(G,
                            fname,
                            fm,
                            cm,
                            mm,
                            nPin,
                            dgmstructure,
                            solveFlag=False)
    pydgm.dgmsolver.initialize_dgmsolver()
    dgm.extractInfo()

    pydgm.dgmsolver.finalize_dgmsolver()
    pydgm.control.finalize_control()

    nCellPerPin = dgm.phi.shape[2] // dgm.npin

    return sph_dgm.XS(G, nCellPerPin, dgm.sig_t, dgm.vsig_f, dgm.chi,
                      dgm.sig_s)
Пример #2
0
    task = os.environ['SLURM_ARRAY_TASK_ID']
    task = int(task) - 1

    data_path = 'data'

    parameters = getInfo(task)
    print(parameters)
    G, geo, contig, min_cutoff, ratio_cutoff, group_cutoff, basisType, homogOption, method = parameters

    dgmstructure = computeBounds(G, geo, contig, min_cutoff, ratio_cutoff,
                                 group_cutoff)
    print(dgmstructure)
    if 'klt' in basisType:
        makeKLT(basisType, dgmstructure)
    else:
        makeDLP(dgmstructure)

    dgmstructure.fname = '{}_{}'.format(basisType, dgmstructure.fname)

    xs_name = 'XS/{}gXS.anlxs'.format(G)

    ass_map = [0, 1]
    # Get the homogenized cross sections
    ass1 = runSPH(G, ass_map, xs_name, dgmstructure, method, homogOption)
    pickle.dump(
        ass1,
        open(
            '{}/refXS_dgm_{}_{}_h{}.p'.format(data_path, dgmstructure.fname,
                                              method, homogOption), 'wb'))

    print('complete')
Пример #3
0
def run_dgm_homogenized(G, mmap, xs_name, mapping, order, method, basis,
                        dgmstructure, homogOption):
    print('running the homogenized problem with DGM: order {}'.format(order))
    # Get the coarse group structure
    nCG = mapping.nCG
    xs_name = '_homo.'.join(xs_name.split('.'))

    # Build the basis
    if 'klt' in basis:
        makeKLT(basis, dgmstructure)
    else:
        makeDLP(dgmstructure)

    # Update structure name with basis
    dgmstructure.fname = '{}_{}'.format(basis, dgmstructure.fname)

    # Build the geometry
    nPin, fm, cm, mm = buildGEO(mmap, True)

    # Write the homogenized cross section moments
    ref_XS = pickle.load(
        open(
            '{}/refXS_dgm_{}_{}_h{}.p'.format(data_path, dgmstructure.fname,
                                              method, homogOption), 'rb'))
    print(ref_XS.chi.shape)
    ref_XS.nCellPerPin = sum(fm) // nPin
    print(mm)
    XS_args = ref_XS.write_homogenized_XS(mmap=mm, order=order, method=method)
    # Run the homogenized problem with DGM
    h**o = sph_dgm.DGMSOLVER(nCG,
                             xs_name,
                             fm,
                             cm,
                             mm,
                             nPin,
                             dgmstructure,
                             XS=XS_args,
                             vacuum=False,
                             order=order,
                             homogOption=0)

    # Save the flux and cross sections
    np.save(
        '{}/dgm_phi_{}_{}_{}_o{}_h{}'.format(data_path, G, basis, method,
                                             order, homogOption), h**o.phi)
    np.save(
        '{}/dgm_sig_t_{}_{}_{}_o{}_h{}'.format(data_path, G, basis, method,
                                               order, homogOption), h**o.sig_t)
    np.save(
        '{}/dgm_sig_f_{}_{}_{}_o{}_h{}'.format(data_path, G, basis, method,
                                               order, homogOption),
        h**o.vsig_f)
    np.save(
        '{}/dgm_phi_homo_{}_{}_{}_o{}_h{}'.format(data_path, G, basis, method,
                                                  order, homogOption),
        h**o.phi_homo)
    np.save(
        '{}/dgm_sig_t_homo_{}_{}_{}_o{}_h{}'.format(data_path, G, basis,
                                                    method, order,
                                                    homogOption),
        h**o.sig_t_homo)
    np.save(
        '{}/dgm_sig_f_homo_{}_{}_{}_o{}_h{}'.format(data_path, G, basis,
                                                    method, order,
                                                    homogOption),
        h**o.sig_f_homo)