Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

Notebooks supporting the J. Fluid Mech. submission "Turbulent mixed convection in vertical and horizontal channels"

206 views
unlisted
ubuntu2204
Kernel: Python 3 (system-wide)

import numpy as np import sys, os, h5py import matplotlib.pyplot as plt import seaborn as sns import cmocean # Aesthetics sns.set_theme() sns.set_style('ticks') sns.set_context('paper') plt.rc('mathtext', fontset='stix') plt.rc('font', family='serif') cspeed = cmocean.tools.crop_by_percent(cmocean.cm.tempo, 30, which='both', N=None) import pandas as pd

Load sheared VC data

df = pd.read_csv('../data/P-VC_global_response.csv') df.head()

Load sheared RB data

PRB_df = pd.read_csv('../data/P-RB_global_response.csv') PRB_df.head()

Add Grashof number to datasets Gr=Ra/PrGr=Ra/Pr

# P-VC df['Gr'] = df.Ra/df.Pr # P-RB PRB_df['Gr'] = PRB_df.Rayleigh/PRB_df.Prandtl

Write function to solve Prandtl friction law prediction

from scipy.optimize import newton def Cfunc(Reb): Cf = np.zeros(Reb.size) for i in range(Reb.size): def f(x): # k = 0.41 # B = 5 k = 0.384 B = 4.27 return (2/x)**0.5 - 1/k*np.log(Reb[i]/2*(x/2)**0.5) - B Cf[i] = newton(f, 2.5e-3) return Cf
fig, axs = plt.subplots(1,2, figsize=(5.2,2.2), layout='constrained', dpi=200) cmap = cspeed ax = axs[0] # P-RB sc = ax.scatter(PRB_df['Bulk Reynolds'], PRB_df['Nusselt (stafield)']/PRB_df['Prandtl']**0.5, c=np.log10(PRB_df.Gr), cmap=cmap, s=5, label='Mixed RB') # P-VC ax.scatter(df.Re*(df.Pr==1), df.Nu*(df.Pr==1)/df.Pr**0.5, c=np.log10(df.Gr), cmap=cmap, ec='k', s=25, label='Mixed VC') ax.scatter(df.Re*(df.Pr==4), df.Nu*(df.Pr==4)/df.Pr**0.5, c=np.log10(df.Gr), cmap=cmap, ec='k', s=25, marker='^') ax.scatter(df.Re*(df.Pr==10), df.Nu*(df.Pr==10)/df.Pr**0.5, c=np.log10(df.Gr), cmap=cmap, ec='k', s=25, marker='v') fig.colorbar(sc, ax=axs, label='$\log_{10} Gr$') # Add theoretical comparison R = 10**np.linspace(1.5,4.5,101) ax.loglog(R, 0.25*Cfunc(R)*R, 'k--') ax.annotate('Prandtl', (2e2, 1.25e-2), ha='center', va='center', rotation=-17) # Labels and aesthetics ax.grid(True) ax.set( xlabel='$Re$', ylabel='$Nu/Pr^{1/2}$', xlim = [8e1,2e4], ylim=[2,50] ) ax.annotate('$(a)$', (-0.05, 1.05), xycoords='axes fraction', ha='right', va='bottom') ax = axs[1] # P-RB ax.scatter(PRB_df['Bulk Reynolds']/PRB_df['Re0'], PRB_df['Nusselt (stafield)']/PRB_df['Nu0'], c=np.log10(PRB_df.Gr), cmap=cmap, s=5) # P-VC ax.scatter(df.Re*(df.Pr==1)/df.Re0, df.Nu/df.Nu0, c=np.log10(df.Gr), cmap=cmap, ec='k', s=25, label='$Pr=1$') ax.scatter(df.Re*(df.Pr==4)/df.Re0, df.Nu/df.Nu0, c=np.log10(df.Gr), cmap=cmap, ec='k', s=25, marker='^', label='$Pr=4$') ax.scatter(df.Re*(df.Pr==10)/df.Re0, df.Nu/df.Nu0, c=np.log10(df.Gr), cmap=cmap, ec='k', s=25, marker='v', label='$Pr=10$') # Add theoretical comparison R = 10**np.linspace(-1,1,101) ax.loglog(R, (1 + R**2)**-0.1, 'k--') # Labels and aesthetics ax.grid(True) ax.legend() ax.set( xlabel='$Re/Re_0$', ylabel='$Nu/Nu_0$', xlim=[1e-1, 1e2], ylim=[0.6,2] ) ax.annotate('$(b)$', (-0.05, 1.05), xycoords='axes fraction', ha='right', va='bottom') # fig.savefig('Nusselt_numbers.pdf') plt.show()
Image in a Jupyter notebook