def read_data_from_LBM(case_folder):
    if solver == 'walberla':
        oldest = find_oldest_iteration(case_folder,
                                       extension='.vti')  # walberla
        filename_vtk = get_vti_from_iteration(
            case_folder, oldest, extension='.vti',
            prefix='simulation_step_')  # walberla
        filepath_vtk = os.path.join(case_folder, filename_vtk)
        vti_reader = VTIFile(filepath_vtk, parallel=False)  # walberla
    elif solver == 'TCLB':
        oldest = find_oldest_iteration(case_folder)  # TCLB
        filename_vtk = get_vti_from_iteration(case_folder,
                                              oldest,
                                              extension='.pvti')  # TCLB
        filepath_vtk = os.path.join(case_folder, filename_vtk)
        vti_reader = VTIFile(filepath_vtk, parallel=True)  # TCLB
    else:
        raise Exception("Choose solver [\'TCLB\' or \'walberla\'] ")

    T_num = vti_reader.get("T")
    T_num_slice = T_num[:, :, 1]
    #[ux_num, uy_num, uz_num] = vti_reader.get("U", is_vector=True)
    # ny, nx, nz = T_num.shape
    # uz_num_slice = uz_num[:, :, 1]
    # y = np.linspace(start=0, stop=1, num=ny, endpoint=False)
    return T_num_slice
def read_ux(folder):
    folder = strip_folder_name(folder)
    case_folder = os.path.join(main_folder, folder)
    oldest = find_oldest_iteration(case_folder)
    filename_vtk = get_vti_from_iteration(case_folder, oldest)
    filepath_vtk = os.path.join(case_folder, filename_vtk)
    vti_reader = VTIFile(filepath_vtk)

    (u_num_x, _, _) = vti_reader.get("U", is_vector=True)
    ux_slice = u_num_x[:, 1, 1]
    return ux_slice
def read_data_from_LBM(case_folder):
    oldest = find_oldest_iteration(case_folder)
    filename_vtk = get_vti_from_iteration(case_folder, oldest, extension='.pvti')
    filepath_vtk = os.path.join(case_folder, filename_vtk)
    vti_reader = VTIFile(filepath_vtk, parallel=True)
    # match = re.search(r'Pr_?(\d{1,4})_', file, re.IGNORECASE)
    # Pr = float(match.group(1))
    T_num = vti_reader.get("T")

    name_for_plot = re.sub(r"VTK_P00_", '', filename_vtk)
    name_for_plot = re.sub(r".pvti", '', filename_vtk)
    return T_num, name_for_plot
示例#4
0
def read_data_from_LBM(case_folder, iteration_of_interest):
    # iteration_of_interest = find_oldest_iteration(case_folder)
    filename_vtk = get_vti_from_iteration(case_folder, iteration_of_interest, extension='.vti')
    filepath_vtk = os.path.join(case_folder, filename_vtk)
    vti_reader = VTIFile(filepath_vtk, parallel=False)
    fs_num = vti_reader.get("FractionSuspected")
    # [ux_num, uy_num, uz_num] = vti_reader.get("U", is_vector=True)
    # ny, nx, nz = T_num.shape
    # uz_num_slice = uz_num[:, :, 1]

    fs_num_slice = fs_num[int(fs_num.shape[0]/2), :]
    # y = np.linspace(start=0, stop=1, num=ny, endpoint=False)
    return fs_num_slice
def read_data_from_lbm(_case_folder):
    oldest = find_oldest_iteration(_case_folder)
    filename_vtk = get_vti_from_iteration(_case_folder, oldest, extension='.pvti')
    filepath_vtk = os.path.join(_case_folder, filename_vtk)
    vti_reader = VTIFile(filepath_vtk, parallel=True)
    T_num = vti_reader.get("T")
    T_num_slice = T_num[:, :, 1]

    # [ux_num, uy_num, uz_num] = vti_reader.get("U", is_vector=True)
    # ny, nx, nz = T_num.shape
    # uz_num_slice = uz_num[:, :, 1]
    # y = np.linspace(start=0, stop=1, num=ny, endpoint=False)
    return T_num_slice