Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Avatar for JFM-2024-1227.
Download
3482 views
unlisted
ubuntu2204
Kernel: Python 3 (system-wide)

import os import numpy as np import matplotlib.pyplot as plt plt.style.use('../jfm.mplstyle') data = np.loadtxt(f"../Experimental_Dataset/with_flow/5cm_water_depth/flow_profile_combined.csv",delimiter=',') z = data[:,0].copy() u = data[:,1:].copy()
mm_to_inch = 1/25.4 fig, axes = plt.subplots(ncols=3,nrows=2,sharex='all',sharey='all',figsize=(5,3),layout='constrained') indices = range(len(axes.flat)) #possible x_vals = [-2000,-1500,-1000,-500,-50,0,500,1000] x_vals = [-2000,-1500,-1000,-500,0,500] h = 50 b0 = 229 for idx, ax, x in zip(indices[::-1],axes.flat,x_vals[::-1]): ax.plot(u[:,idx],z,'k.-') z_rng = np.append(np.linspace(0,0.1),np.linspace(0.1,1)) u_s = u[z==1,idx] # replace nan values with the outlet values u_s = -0.10791514 if np.isnan(u_s).all() else u_s u_fit = u_s*(z_rng**(1/7)) ax.plot(u_fit,z_rng,'k--') ax.title.set_text(fr"$x={x/h:.0f}$") ax.set(xlabel=r'$u$',ylabel=r'$z$') ax.label_outer() plt.ylim(0,1.05) plt.xlim(-0.12,0) plt.xticks([-0.1, -0.05, 0]) plt.savefig(f"Fig_05.pdf") plt.show()
Image in a Jupyter notebook