# for different settings of Sct and Sc path_name_pre = 'flt_chi_7_inlet_' path_name_mid = 'map' path_name_second = '/postProcessing/' xD_name = [] xD_value = [] case_name = [] data = {} for folder_name in glob.glob('{0}*{1}*'.format(path_name_pre, path_name_mid)): case = folder_name[len(path_name_pre):folder_name.find(path_name_mid)] case_name.append(case) for file_name in glob.glob('{0}{1}mean_xD*.csv'.format( folder_name, path_name_second)): xD = file_name[file_name.find('_xD') + 3:-4] z = fr.z_str_to_num(xD) xD_name.append(xD) xD_value.append(z) data.update({ (case, z): np.genfromtxt(file_name, delimiter=',', names=True) }) xD_name = list(set(xD_name)) xD_value = sorted(list(set(xD_value))) expr = {} for xD in xD_name: file_name = '../pmCDEFarchives/pmD.stat/D{0}.Yave'.format(xD) expr.update({fr.z_str_to_num(xD): fr.sf_expr_read(file_name)}) for z in xD_value:
import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt # data to plot # two vars at least, because axes would be 1D vector for one var var = ['Z', 'T', 'CO'] # import data xD_value = [] data = {} expr = {} for filename in glob.glob('mean_xD*.csv'): pos = filename.find('.csv') xD = filename[7:pos] z = fr.z_str_to_num(xD) if z >= 7.5 and z <= 45.0: xD_value.append(z) data.update({z: np.genfromtxt(filename, delimiter=',', names=True)}) exp_name = '../../../pmCDEFarchives/pmD.stat/D{}.Yave'.format(xD) expr.update({z: fr.sf_expr_read(exp_name)}) xD_value.sort() for z in xD_value: data[z]['r'] /= z expr[z]['r'] /= z # plot # use TEX for interpreter plt.rc('text', usetex=True) # use serif font plt.rc('font', family='serif')
data[:, 1:3] /= U_REF simu.update({case: data}) # experiment scalar folder_exp = '../pmCDEFarchives/pmD.stat/D' scalar_name = ['T', 'Z'] expr = {'z': []} for name in scalar_name: expr.update({name: []}) expr.update({name + 'rms': []}) for file_name in glob.glob('{}*.Yave'.format(folder_exp)): data_tmp = fr.sf_expr_read(file_name) if file_name[len(folder_exp):-5].isdigit(): if 0.0 in data_tmp['r']: expr['z'].append(fr.z_str_to_num(file_name[len(folder_exp):-5])) i = np.where(data_tmp['r'] == 0.0)[0] """ elif -0.04 in data_tmp['r']: i = np.where(data_tmp['r'] == -0.04)[0] """ for name in scalar_name: expr[name].append(data_tmp[name][i]) expr[name + 'rms'].append(data_tmp[name + 'rms'][i]) # experiment velocity file_name = '../TUD_LDV_DEF/TUD_LDV_D.axial' expu = np.genfromtxt(file_name, skip_header=13) expu[:, 2] = np.sqrt(expu[:, 2]) expu[:, 1:3] /= U_REF