예제 #1
0
def get_result_4d(src_out_path, config):

    result_4d = {}
    result_4d['u_inst_c'] = fctlib.load_4d('ts_u', config['ts_ns'],
                                           config['nx'], config['ny'],
                                           config['nz'],
                                           src_out_path)[:, :, :, :-1]
    result_4d['v_inst_c'] = fctlib.load_4d('ts_v', config['ts_ns'],
                                           config['nx'], config['ny'],
                                           config['nz'],
                                           src_out_path)[:, :, :, :-1]
    result_4d['w_inst_c'] = node2center_4d(
        fctlib.load_4d('ts_w', config['ts_ns'], config['nx'], config['ny'],
                       config['nz'], src_out_path))

    return result_4d
예제 #2
0
def post_prec(prec_path, config, var_name, i):
    print(' * proc_id: ' + str(i))
    print(' * var_id : ' + var_name)
    print('   read...')
    inflow_u = fctlib.load_4d('p' + str(i).zfill(3) + '_inflow_' + var_name,
                              config['nsteps'] // config['inflow_count'],
                              config['inflow_nx'], config['ny'], config['nzb'],
                              config['double_flag'],
                              os.path.join(prec_path, 'inflow_data'))
    # os.system('rm ' +os.path.join(prec_data_path,'p'+ str(i).zfill(2) + '_inflow_' + var_name + '.bin'))
    print('   compute...')
    ta_u = np.mean(inflow_u, axis=0)
    tvar_u = np.mean((inflow_u - ta_u)**2, axis=0)
    xya_ta_u = np.mean(ta_u, axis=(0, 1))
    xya_tvar_u = np.mean(tvar_u, axis=(0, 1))
    scale = (xya_tvar_u / tvar_u)**0.5
    if var_name == 'w' and i == 0:
        scale[:, :, 0] = 1
    if var_name == 'w' and i == config['job_np'] - 1:
        scale[:, :, -1] = 1
    inflow_u = (inflow_u - ta_u) * scale + xya_ta_u
    inflow_u = np.ravel(np.transpose(inflow_u, (1, 2, 3, 0)), order='F')
    print('   write...')
    inflow_u.tofile(
        os.path.join(prec_path, 'inflow_data_bis',
                     'p' + str(i).zfill(3) + '_inflow_' + var_name + '.bin'))
예제 #3
0
def get_turb(src_out_path, config):

    turb = {}
    # turb['thrust'] = fctlib.load_1d('turb_thrust', config['ts_ns']*config['turb_nb'], config['double_flag'], src_out_path).reshape(config['ts_ns'],config['turb_nb'])
    turb['dt'] = config['dtr'] * config['c_count']
    turb['Omega'] = fctlib.load_1d(
        'turb_omega', config['ts_ns'] * config['turb_nb'],
        config['double_flag'], src_out_path).reshape(config['ts_ns'],
                                                     config['turb_nb'])
    turb['CTFx'] = fctlib.load_4d('turb_fx', config['ts_ns'], 40, 30,
                                  config['turb_nb'], config['double_flag'],
                                  src_out_path)
    turb['CTFt'] = fctlib.load_4d('turb_ft', config['ts_ns'], 40, 30,
                                  config['turb_nb'], config['double_flag'],
                                  src_out_path)

    return turb
예제 #4
0
def get_result_4d(src_out_path, config):

    result_4d = {}
    result_4d['u_inst_c'] = fctlib.load_4d('ts_u', config['ts_ns'],
                                           config['nx'], config['ny'],
                                           config['nz'], config['double_flag'],
                                           src_out_path)[:, :, :, :-1]
    result_4d['v_inst_c'] = fctlib.load_4d('ts_v', config['ts_ns'],
                                           config['nx'], config['ny'],
                                           config['nz'], config['double_flag'],
                                           src_out_path)[:, :, :, :-1]
    result_4d['w_inst_c'] = node2center_4d(
        fctlib.load_4d('ts_w', config['ts_ns'], config['nx'], config['ny'],
                       config['nz'], config['double_flag'], src_out_path))
    # result_4d['fx_inst_c'] = fctlib.load_4d('ts_fx', config['ts_ns'], config['nx'], config['ny'], config['nz'], config['double_flag'], src_out_path)[:,:,:,:-1]
    # result_4d['fy_inst_c'] = fctlib.load_4d('ts_fy', config['ts_ns'], config['nx'], config['ny'], config['nz'], config['double_flag'], src_out_path)[:,:,:,:-1]
    # result_4d['fz_inst_c'] = fctlib.load_4d('ts_fz', config['ts_ns'], config['nx'], config['ny'], config['nz'], config['double_flag'], src_out_path)[:,:,:,:-1]

    return result_4d
예제 #5
0
def get_result_3d(src_inp_path, src_out_path, config):

    result_3d = {}

    # avg

    ta_u = fctlib.load_4d('ta_u', config['ta_ns'], config['nx'], config['ny'],
                          config['nz'], src_out_path)
    ta_v = fctlib.load_4d('ta_v', config['ta_ns'], config['nx'], config['ny'],
                          config['nz'], src_out_path)
    ta_w = fctlib.load_4d('ta_w', config['ta_ns'], config['nx'], config['ny'],
                          config['nz'], src_out_path)

    ta_uu = fctlib.load_4d('ta_u2', config['ta_ns'], config['nx'],
                           config['ny'], config['nz'], src_out_path)
    ta_vv = fctlib.load_4d('ta_v2', config['ta_ns'], config['nx'],
                           config['ny'], config['nz'], src_out_path)
    ta_ww = fctlib.load_4d('ta_w2', config['ta_ns'], config['nx'],
                           config['ny'], config['nz'], src_out_path)
    ta_uw = fctlib.load_4d('ta_uw', config['ta_ns'], config['nx'],
                           config['ny'], config['nz'], src_out_path)

    ta_txz = fctlib.load_4d('ta_txz', config['ta_ns'], config['nx'],
                            config['ny'], config['nz'], src_out_path)

    ta_dudz = fctlib.load_4d('ta_dudz', config['ta_ns'], config['nx'],
                             config['ny'], config['nz'], src_out_path)

    result_3d['u_avg_c'] = ta_u[-1, :, :, :-1]
    result_3d['u_avg_n'] = center2node_3d(ta_u[-1, :, :, :])
    result_3d['v_avg_c'] = ta_v[-1, :, :, :-1]
    result_3d['v_avg_n'] = center2node_3d(ta_v[-1, :, :, :])
    result_3d['w_avg_c'] = node2center_3d(ta_w[-1, :, :, :])
    result_3d['w_avg_n'] = ta_w[-1, :, :, :]

    result_3d['u_std_c'] = np.sqrt(ta_uu[-1, :, :, :-1] -
                                   ta_u[-1, :, :, :-1] * ta_u[-1, :, :, :-1])
    result_3d['u_std_n'] = center2node_3d(
        np.sqrt(ta_uu[-1, :, :, :] - ta_u[-1, :, :, :] * ta_u[-1, :, :, :]))
    result_3d['v_std_c'] = np.sqrt(ta_vv[-1, :, :, :-1] -
                                   ta_v[-1, :, :, :-1] * ta_v[-1, :, :, :-1])
    result_3d['v_std_n'] = center2node_3d(
        np.sqrt(ta_vv[-1, :, :, :] - ta_v[-1, :, :, :] * ta_v[-1, :, :, :]))
    result_3d['w_std_c'] = node2center_3d(
        np.sqrt(ta_ww[-1, :, :, :] - ta_w[-1, :, :, :] * ta_w[-1, :, :, :]))
    result_3d['w_std_n'] = np.sqrt(ta_ww[-1, :, :, :] -
                                   ta_w[-1, :, :, :] * ta_w[-1, :, :, :])

    result_3d['uw_cov_c'] = node2center_3d(ta_uw[-1, :, :, :] -
                                           result_3d['u_avg_n'] *
                                           result_3d['w_avg_n'])
    result_3d['uw_cov_n'] = ta_uw[
        -1, :, :, :] - result_3d['u_avg_n'] * result_3d['w_avg_n']

    result_3d['txz_avg_c'] = node2center_3d(ta_txz[-1, :, :, :])
    result_3d['txz_avg_n'] = ta_txz[-1, :, :, :]

    result_3d['dudz_avg_c'] = node2center_3d(ta_dudz[-1, :, :, :])
    result_3d['dudz_avg_n'] = ta_dudz[-1, :, :, :]

    # INST

    u = fctlib.load_3d('u', config['nx'], config['ny'], config['nz'],
                       src_inp_path)
    v = fctlib.load_3d('v', config['nx'], config['ny'], config['nz'],
                       src_inp_path)
    w = fctlib.load_3d('w', config['nx'], config['ny'], config['nz'],
                       src_inp_path)

    result_3d['u_inst_c'] = u[:, :, :-1]
    result_3d['u_inst_n'] = center2node_3d(u)

    result_3d['v_inst_c'] = v[:, :, :-1]
    result_3d['v_inst_n'] = center2node_3d(v)

    result_3d['w_inst_c'] = node2center_3d(w)
    result_3d['w_inst_n'] = w

    return result_3d