import scipy.optimize as opt file_root = 'flow_' # Linear flow profile fit print("[densmap] Fitting LINEAR flow profile") FP = dm.fitting_parameters(par_file='parameters_shear.txt') # FP = dm.fitting_parameters( par_file='parameters_viscosity.txt' ) folder_name = FP.folder_name Lx = FP.lenght_x Lz = FP.lenght_z vel_x, vel_z = dm.read_velocity_file(folder_name + '/' + file_root + '00001.dat') Nx = vel_x.shape[0] Nz = vel_x.shape[1] hx = Lx / Nx hz = Lz / Nz x = hx * np.arange(0.0, Nx, 1.0, dtype=float) + 0.5 * hx z = hz * np.arange(0.0, Nz, 1.0, dtype=float) + 0.5 * hz X, Z = np.meshgrid(x, z, sparse=False, indexing='ij') profile_velocity_x = np.zeros(len(z), dtype=float) profile_velocity_z = np.zeros(len(z), dtype=float) profile_kinetic_energy = np.zeros(len(z), dtype=float) spin_up_steps = 0 n_init = FP.first_stamp + spin_up_steps n_fin = FP.last_stamp
file_name = 'flow_00150.dat' base_name = 'flow_' # folder_name = '100nm/third_run' # file_name = 'flow_00900.dat' # folder_name = 'RawFlowData' # file_name = 'flow_SOL_00100.dat' # PARAMETERS TO TUNE Lx = 60.00000 Lz = 35.37240 # Lx = 300.00000 # Lz = 200.44360 # Lx = 75.60000 # Lz = 28.00000 vel_x, vel_z = dm.read_velocity_file(folder_name + '/' + file_name) rho = dm.read_density_file(folder_name + '/' + file_name, bin='y') # p_x = np.multiply(rho, vel_x) # p_z = np.multiply(rho, vel_z) Nx = vel_x.shape[0] Nz = vel_x.shape[1] hx = Lx / Nx # [nm] hz = Lz / Nz # [nm] x = hx * np.arange(0.0, Nx, 1.0, dtype=float) z = hz * np.arange(0.0, Nz, 1.0, dtype=float) X, Z = np.meshgrid(x, z, sparse=False, indexing='ij') kin_ener = 0.5 * np.multiply( rho, np.multiply(vel_x, vel_x) + np.multiply(vel_z, vel_z))
import densmap as dm import numpy as np FP = dm.fitting_parameters(par_file='parameters_shear.txt') folder_name = FP.folder_name file_root = 'flow_' Lx = FP.lenght_x Lz = FP.lenght_z # CREATING MESHGRID print("Creating meshgrid") dummy_dens = dm.read_density_file(folder_name + '/' + file_root + '00500.dat', bin='y') dummy_vel_x, dummy_vel_z = dm.read_velocity_file(folder_name + '/' + file_root + '00500.dat') Nx = dummy_dens.shape[0] Nz = dummy_dens.shape[1] hx = Lx / Nx hz = Lz / Nz x = hx * np.arange(0.0, Nx, 1.0, dtype=float) z = hz * np.arange(0.0, Nz, 1.0, dtype=float) X, Z = np.meshgrid(x, z, sparse=False, indexing='ij') # Manually tune, crop window [nm] x0_crop = 87.00 x1_crop = 100.0 z0_crop = 0.000 z1_crop = 6.000 # Ny need to be strictly larger than 1 Ny = 2
from matplotlib import cm import pandas as pd ## ## ### # ## ### # INITIALIZATION # # #### ## # # ## # FP = dm.fitting_parameters( par_file='parameters_shear.txt' ) folder_name = FP.folder_name file_root = 'flow_' Lx = FP.lenght_x Lz = FP.lenght_z vel_x, vel_z = dm.read_velocity_file(folder_name+'/'+file_root+'00001.dat') Nx = vel_x.shape[0] Nz = vel_x.shape[1] hx = Lx/Nx hz = Lz/Nz x = hx*np.arange(0.0,Nx,1.0, dtype=float)+0.5*hx z = hz*np.arange(0.0,Nz,1.0, dtype=float)+0.5*hz X, Z = np.meshgrid(x, z, sparse=False, indexing='ij') n_init = FP.first_stamp n_fin = FP.last_stamp dt = FP.time_step delta_th = 2.0 z0 = 0.80 i0 = np.abs(z-z0).argmin() n_transient = int(max(1, n_fin-1000)) n_dump = 10
import densmap as dm import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt from matplotlib import cm folder_name = 'RawFlowData' file_name = 'combined_00100.dat' # PARAMETERS TO TUNE Lx = 75.60000 Lz = 28.00000 vel_x, vel_z = dm.read_velocity_file(folder_name + '/' + file_name) kin_ener = 0.5 * (np.multiply(vel_x, vel_x) + np.multiply(vel_z, vel_z)) Nx = vel_x.shape[0] Nz = vel_x.shape[1] hx = Lx / Nx # [nm] hz = Lz / Nz # [nm] x = hx * np.arange(0.0, Nx, 1.0, dtype=float) z = hz * np.arange(0.0, Nz, 1.0, dtype=float) X, Z = np.meshgrid(x, z, sparse=False, indexing='ij') # Try to average with values at previous steps n_hist = 10 n_step = 100 n_hist = min(n_hist, n_step) w = np.exp(-np.linspace(0.0, 5.0, n_hist))
import matplotlib.pyplot as plt import scipy.optimize as opt file_root = 'flow_' FP = dm.fitting_parameters(par_file='parameters_test.txt') # folder_poiseuille = FP.folder_name+'LJPoiseuille/Flow_epsilon03_f6' # folder_couette = FP.folder_name+'LJCouette/Flow_epsilon03' folder_poiseuille = FP.folder_name + 'ConfinedPoiseuille_Q1_match/Flow' folder_couette = FP.folder_name + 'ConfinedCouette_Q1/Flow' Lx = FP.lenght_x Lz = FP.lenght_z vel_x, vel_z = dm.read_velocity_file(folder_poiseuille + '/' + file_root + '00001.dat') Nx = vel_x.shape[0] Nz = vel_x.shape[1] hx = Lx / Nx hz = Lz / Nz x = hx * np.arange(0.0, Nx, 1.0, dtype=float) + 0.5 * hx z = (hz * np.arange(0.0, Nz, 1.0, dtype=float) + 0.5 * hz) z_s = 1.2 z_f = 1.8 n_exclude = np.argmin(np.abs(z - z_f)) n_data = len(z) - n_exclude print("# exclude = " + str(n_exclude)) z = (hz * np.arange(0.0, Nz, 1.0, dtype=float) + 0.5 * hz) - 0.5 * Lz X, Z = np.meshgrid(x, z, sparse=False, indexing='ij') n_init = FP.first_stamp