Exemplo n.º 1
0
def read_res(inp_filename, moment):             # moment=0 for BOC and moment=1 for EOC
    res_filename = os.path.join(inp_filename + "_res.m")
    res = serpent.parse_res(res_filename)
    keff_analytical = res['IMP_KEFF']
    # Value Keff and uncertantly for the moment (two values in list: BOS and
    # EOS)
    return keff_analytical[moment, :]
Exemplo n.º 2
0
def test_parse_res2():
    res = serpent.parse_res('serp2_res.m')
    rank0 = res['IDX']
    assert_equal(res['idx'] + 1, rank0)
    for key in res:
        if isinstance(res[key], np.ndarray):
            assert_equal(res[key].shape[0], rank0)

    # Check values
    assert_array_equal(res['MEAN_POP_SIZE'][0], [1.00140E+02, 0.00359])
Exemplo n.º 3
0
def test_parse_res2():
    res = serpent.parse_res("serp2_res.m")
    rank0 = res["IDX"]
    assert_equal(res["idx"] + 1, rank0)
    for key in res:
        if isinstance(res[key], np.ndarray):
            assert_equal(res[key].shape[0], rank0)

    # Check values
    assert_array_equal(res["MEAN_POP_SIZE"][0], [1.00140e02, 0.00359])
Exemplo n.º 4
0
def test_parse_res2():
    res = serpent.parse_res("serp2_res.m")
    rank0 = res["IDX"]
    assert_equal(res["idx"] + 1, rank0)
    for key in res:
        if isinstance(res[key], np.ndarray):
            assert_equal(res[key].shape[0], rank0)

    # Check values
    assert_array_equal(res["MEAN_POP_SIZE"][0], [1.00140e02, 0.00359])
Exemplo n.º 5
0
def test_parse_res1():
    res = serpent.parse_res("sample_res.m")
    rank0 = res["IDX"]
    assert_equal(res["idx"] + 1, rank0)
    for key in res:
        if isinstance(res[key], np.ndarray):
            assert_equal(res[key].shape[0], rank0)

    # Check values
    assert_array_equal(res["SIX_FF_ETA"][1], [1.16446e00, 0.00186])
    assert_array_equal(res["PEAKF10"][rank0 - 1], [12, 11, 1.09824e00, 0.01768])
Exemplo n.º 6
0
def test_parse_res1():
    res = serpent.parse_res('sample_res.m')
    rank0 = res['IDX']
    assert_equal(res['idx']+1, rank0)
    for key in res:
        if isinstance(res[key], np.ndarray):
            assert_equal(res[key].shape[0], rank0)

    # Check values
    assert_array_equal(res['SIX_FF_ETA'][1],  [1.16446E+00, 0.00186])
    assert_array_equal(res['PEAKF10'][rank0-1], [12, 11, 1.09824E+00, 0.01768])
Exemplo n.º 7
0
def test_parse_res1():
    res = serpent.parse_res('sample_res.m')
    rank0 = res['IDX']
    assert_equal(res['idx']+1, rank0)
    for key in res:
        if isinstance(res[key], np.ndarray):
            assert_equal(res[key].shape[0], rank0)

    # Check values
    assert_array_equal(res['SIX_FF_ETA'][1],  [1.16446E+00, 0.00186])
    assert_array_equal(res['PEAKF10'][rank0-1], [12, 11, 1.09824E+00, 0.01768])
Exemplo n.º 8
0
def test_parse_res1():
    res = serpent.parse_res("sample_res.m")
    rank0 = res["IDX"]
    assert_equal(res["idx"] + 1, rank0)
    for key in res:
        if isinstance(res[key], np.ndarray):
            assert_equal(res[key].shape[0], rank0)

    # Check values
    assert_array_equal(res["SIX_FF_ETA"][1], [1.16446e00, 0.00186])
    assert_array_equal(res["PEAKF10"][rank0 - 1],
                       [12, 11, 1.09824e00, 0.01768])
Exemplo n.º 9
0
 def read_depcode_step_param(self):
     """Parses data from Serpent output for each step and stores it in
     `Depcode` object ``param`` attributes.
     """
     res = serpent.parse_res(self.input_fname + "_res.m")
     self.param['keff_bds'] = res['IMP_KEFF'][0]
     self.param['keff_eds'] = res['IMP_KEFF'][1]
     self.param['breeding_ratio'] = res['CONVERSION_RATIO'][1]
     self.param['execution_time'] = res['RUNNING_TIME'][1]
     self.param['burn_days'] = res['BURN_DAYS'][1][0]
     self.param['power_level'] = res['TOT_POWER'][1][0]
     self.param['memory_usage'] = res['MEMSIZE'][0]
     b_l = int(.5 * len(res['FWD_ANA_BETA_ZERO'][1]))
     self.param['beta_eff'] = res['FWD_ANA_BETA_ZERO'][1].reshape((b_l, 2))
     self.param['delayed_neutrons_lambda'] = \
         res['FWD_ANA_LAMBDA'][1].reshape((b_l, 2))
     self.param['fission_mass_bds'] = res['INI_FMASS'][1]
     self.param['fission_mass_eds'] = res['TOT_FMASS'][1]
Exemplo n.º 10
0
 def read_depcode_info(self):
     """Parses initial simulation info data from Serpent output and stores
     it in `Depcode` object ``sim_info`` attributes.
     """
     res = serpent.parse_res(self.input_fname + "_res.m")
     self.sim_info['serpent_version'] = \
         res['VERSION'][0].decode('utf-8')
     self.sim_info['title'] = res['TITLE'][0].decode('utf-8')
     self.sim_info['serpent_input_filename'] = \
         res['INPUT_FILE_NAME'][0].decode('utf-8')
     self.sim_info['serpent_working_dir'] = \
         res['WORKING_DIRECTORY'][0].decode('utf-8')
     self.sim_info['xs_data_path'] = \
         res['XS_DATA_FILE_PATH'][0].decode('utf-8')
     self.sim_info['OMP_threads'] = res['OMP_THREADS'][0]
     self.sim_info['MPI_tasks'] = res['MPI_TASKS'][0]
     self.sim_info['memory_optimization_mode'] = res['OPTIMIZATION_MODE'][0]
     self.sim_info['depletion_timestep'] = res['BURN_DAYS'][1][0]
     self.sim_info['depletion_timestep'] = res['BURN_DAYS'][1][0]
Exemplo n.º 11
0
 def __init__(self, xs_filename):
     data = serpent.parse_res(xs_filename)
     try:
         num_burn = len(np.unique(data['BURNUP'][:][0]))
     except (KeyError):
         num_burn = 1
     num_uni = len(np.unique(data['GC_UNIVERSE_NAME']))
     num_temps = int(len(data['GC_UNIVERSE_NAME']) / (num_uni * num_burn))
     self.xs_lib = {}
     for i in range(num_burn):
         self.xs_lib[i] = {}
         for j in range(num_uni):
             self.xs_lib[i][j] = {}
             for k in range(num_temps):
                 self.xs_lib[i][j][k] = {}
                 index = i * (num_uni) + k * (num_burn * num_uni) + j
                 self.xs_lib[i][j][k]["REMXS"] = list(
                     data['INF_REMXS'][index][::2])
                 self.xs_lib[i][j][k]["FISSXS"] = list(
                     data['INF_FISS'][index][::2])
                 self.xs_lib[i][j][k]["NSF"] = list(
                     data['INF_NSF'][index][::2])
                 self.xs_lib[i][j][k]["FISSE"] = list(
                     data['INF_KAPPA'][index][::2])
                 self.xs_lib[i][j][k]["DIFFCOEF"] = list(
                     data['INF_DIFFCOEF'][index][::2])
                 self.xs_lib[i][j][k]["RECIPVEL"] = list(
                     data['INF_INVV'][index][::2])
                 self.xs_lib[i][j][k]["CHI_T"] = list(
                     data['INF_CHIT'][index][::2])
                 self.xs_lib[i][j][k]["CHI_P"] = list(
                     data['INF_CHIP'][index][::2])
                 self.xs_lib[i][j][k]["CHI_D"] = list(
                     data['INF_CHID'][index][::2])
                 self.xs_lib[i][j][k]["BETA_EFF"] = list(
                     data['BETA_EFF'][index][2::2])
                 self.xs_lib[i][j][k]["DECAY_CONSTANT"] = list(
                     data['LAMBDA'][index][2::2])
                 self.xs_lib[i][j][k]["GTRANSFXS"] = list(
                     data['INF_SP0'][index][::2])