def C(g): """ Ratio of density.viscosity product at points in the boundary layer. """ T = g * h_e / C_p T = max(T, 100.0) # to avoid difficult values rho = p_e / (R * T) mu = sutherland.mu(T, 'Air') return rho * mu / (rho_e * mu_e)
print "tindx=", tindx print "Begin: Pick up data for tindx=", tindx from libprep3 import Vector, cross, dot, vabs from e3_flow import read_all_blocks from math import sqrt # nb = 28 pick_list = [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26] # surface rho_inf = 6.081e-4 # kg/m**3 p_inf = 18.55 # Pa u_inf = 2576.0 # m/s T_inf = 102.2 # K T_wall = 295.8 # K from cfpylib.gasdyn import sutherland mu_inf = sutherland.mu(T_inf, 'N2') mm = 0.001 # metres corner1 = Vector(92.08, 42.94) * mm corner2 = Vector(153.69, 130.925) * mm # grid, flow, dim = read_all_blocks(job, nb, tindx, zipFiles=True) print "Compute properties for cell-centres along the surface" outfile = open("surface.data", "w") outfile.write( "# x(m) s(m) tau_w(Pa) Cf Cf_blasius y_plus p(Pa) Cp q(W/m**2) Ch\n") for ib in pick_list: j = 0 # surface is along the South boundary k = 0 # of a 2D grid print "# start of block" for i in range(flow[ib].ni): # Cell closest to surface
# compute_viscous_data_simple.py # inspired by PJ's compute_y_plus.py script # Updated 27 October 2008 - Wilson Chan # Refined 01 November 2010 - PJ import sys, os sys.path.append(os.path.expandvars("$HOME/e3bin")) # installation directory from cfpylib.gasdyn import sutherland # Freestream and test conditions (user input) wall_y = 0.0 # Location of wall, m T_w = 316.2 # Temperature at wall, K rho_inf = 0.457 # free stream density, kg/m^3 u_inf = 707.0 # free stream velocity, m/s mu = sutherland.mu(T_w, "Air") # fluid viscosity at wall print "Begin compute_viscous_data_simple.py" infile = open("./tc2update-y-wall.dat", "r") line = infile.readline() # read away the first (comment) line containing notes on format # Assuming .dat format is ... # Variables: pos.x pos.y pos.z volume rho vel.x vel.y vel.z p a mu k[0] mu_t k_t S tke omega massf[0] e[0] T[0] outfile = open("viscous_data.dat", "w") outfile.write("# x(m) du(m/s) dy(m) tau_w(N/m^2) c_f y_plus \n") # Process every data line. while True: line = infile.readline().strip() if len(line) == 0: break data_array = [float(word) for word in line.split()]
#Assume ideal gas, use properties for air select_gas_model(model='ideal gas', species=['air']) # Define flow conditions to match Mabey's data set 74021802 p_inf = 3.16e3 # Pa u_inf = 712.9 # m/s T_inf = 62.16 # degrees K rho_inf = p_inf / (287.1 * T_inf) # Estimate turbulence quantities for free stream by specifying turbulence # intensity and the ratio of turbulent-to-laminar viscosity. turbulence_intensity = 0.01 turb_lam_viscosity_ratio = 1.0 tke_inf = 1.5 * (turbulence_intensity * u_inf)**2 mu_t_inf = turb_lam_viscosity_ratio * sutherland.mu(T_inf, "Air") omega_inf = rho_inf * tke_inf / mu_t_inf print "Inflow turbulence: tke=", tke_inf, "omega=", omega_inf inflow = FlowCondition(p=p_inf, u=u_inf, v=0.0, T=T_inf, massf=[1.0,], tke=tke_inf, omega=omega_inf ) initial = inflow def toRadians(degrees): import math return degrees * math.pi / 180.0 def simpleBoxCorners(xPos=0.0, yPos=0.0, zPos=0.0, xSize=1.0, ySize=1.0, zSize=1.0): """\brief Creates a corner coordinate list for a simple box.""" p0 = Node(xPos, yPos, zPos) p1 = Node(xPos+xSize, yPos, zPos)
u1 = flow[ib].data['vel.x'][i][j] # Compute distance from centre to interface (2D only for now) c = Vector(x[0], y[0]) # cell centre # north-west vertex temp_x = grid[ib].x[i, j + 1] temp_y = grid[ib].y[i, j + 1] s0 = Vector(temp_x[0], temp_y[0]) # north-east vertex temp_x = grid[ib].x[i + 1, j + 1] temp_y = grid[ib].y[i + 1, j + 1] s1 = Vector(temp_x[0], temp_y[0]) tangent = unit(s1 - s0) s0c = c - s0 # d1 is distance from centre to interface d1 = vabs(s0c - dot(s0c, tangent) * tangent) # Compute viscous parameters dudy = (u1 - 0.0) / d1 # du/dy for no-slip wall mu = sutherland.mu(T_w, "Air") # Wall shear stress .. tau_w = mu_w * du/dy tau_w = mu * dudy # Friction velocity .. u_tau = (tau_w / rho_w)**0.5 u_tau = sqrt(tau_w / rho) # Non-dimensionalised y .. y_plus = u_tau * dy * rho_w / mu_w y_plus = u_tau * d1 * rho / mu # Skin friction coefficient .. c_f = tau_w / (0.5 * rho * u**2) c_f = tau_w / (0.5 * rho_inf * u_inf**2) outfile.write("%f %f %f %f %f %f \n" % (x, u1, d1, tau_w, c_f, y_plus)) outfile.close() print "Done."
# Freestream conditions T_e = 300.0 # degrees K p_e = 1.013e3 # static pressure in Pa u_e = 1390.0 # u-velocity in m/s rho_e = p_e / (287.1 * T_e) # density in kg/m**3 M_e = 4.0 # u_e / sqrt(1.4 * 287.1 * T_e) T_w = 300.0 # Wall temperature in K outfile = open("cf-ref-temp.data", "w") outfile.write("# 1.x(m) 2.c_f \n") x = 0.001 # start just downstream of the leading edge x_stop = 1.0 x_step = 0.001 while 1: # Reference temperature Eq. 7-42 T_star = T_e * (0.5 + 0.039 * M_e**2 + 0.5 * T_w / T_e) # White # T_star = T_e * (0.42 + 0.032 * M_e**2 + 0.58 * T_w / T_e) # Anderson c_star = (T_star / T_e)**(-1.0 / 3.0) # Eq. 7-40 # Viscosity by Sutherland's law mu_e = sutherland.mu(T_e, "Air") Re_xe = rho_e * u_e * x / mu_e # Eq. 1-1 c_f = 0.664 * sqrt(c_star) / sqrt(Re_xe) # Eq. 7-41b # c_f = 0.584 / sqrt(Re_xe) x += x_step outfile.write("%f %f \n" % (x, c_f)) if x > x_stop: break outfile.close() print "Done."
Pr = 0.71 # to match Schetz' boundary-layer code print "R=", R, "gamma=", gamma, "C_p=", C_p, "Pr=", Pr print "Conditions just outside of boundary layer to match Schetz's worked example 5-1" p_e = 1.013e3 # Pa u_e = 1390.0 # m/s T_e = 300.0 # degrees K h_e = C_p * T_e T_wall = 300.0 h_wall = C_p * T_wall print "p_e=", p_e, "u_e=", u_e, "T_e=", T_e, "h_e=", h_e print "Condition at wall" print "T_wall=", T_wall, "h_wall=", h_wall rho_e = p_e / (R * T_e) # ideal equation of state mu_e = sutherland.mu(T_e, 'Air') k_e = mu_e * C_p / Pr print "rho_e=", rho_e, "mu_e=", mu_e, "k_e=", k_e # Choose a position along the plate x = 0.1 # metres xi = rho_e * u_e * mu_e * x print "x=", x, "xi=", xi def C(g): """ Ratio of density.viscosity product at points in the boundary layer. """ T = g * h_e / C_p T = max(T, 100.0) # to avoid difficult values
print "Begin: Pick up data for tindx=", tindx from libprep3 import Vector, cross, dot, vabs from e3_flow import read_all_blocks from math import sqrt # nb = 22 pick_list = [0, 2, 4, 6, 8, 10, 12, 14, 16, 18] # blocks against cubic surface rho_inf = 5.521e-3 # kg/m**3 p_inf = 66.43 # Pa u_inf = 1589.8 # m/s T_inf = 41.92 # K T_wall = 296.0 # K T_0 = 1300.0 # K specific_heat = 1004.5 # J/kg.K from cfpylib.gasdyn import sutherland mu_inf = sutherland.mu(T_inf, 'Air') mm = 0.001 # metres # grid, flow, dim = read_all_blocks(job, nb, tindx, zipFiles=True) print "Compute shear stress for cell-centres along the surface" outfile = open("surface.data", "w") outfile.write("# x(m) tau_w(Pa) Cf Cf_blasius y_plus p(Pa) Cp q(W/m**2) St.Re^0.5\n") for ib in pick_list: j = 0 # surface is along the South boundary k = 0 # of a 2D grid print "# start of block" for i in range(flow[ib].ni): # Cell closest to surface x = flow[ib].data['pos.x'][i,j,k] y = flow[ib].data['pos.y'][i,j,k] ctr = Vector(x, y)
print gdata.title gdata.axisymmetric_flag = 1 # Conditions to match the TUSQ operating condition. p_inf = 701.5 # Pa u_inf = 989.8 # m/s T_inf = 72.46 # degree K p_init = 1000.0 # Pa, DRB estimate T_wall = 300.0 # degree K # Estimate turbulence quantities for free stream # by specifying the intensity as 0.01 and estimating the # turbulence viscosity as 10 times the laminar viscosity. tke_inf = 1.5 * (u_inf * 0.01)**2 rho_inf = p_inf / (287.0 * T_inf) from cfpylib.gasdyn.sutherland import mu mu_t_inf = 10.0 * mu(T_inf, 'Air') omega_inf = rho_inf * tke_inf / mu_t_inf gdata.turbulence_model = "k_omega" print "Inflow turbulence: tke=", tke_inf, "omega=", omega_inf select_gas_model(model='ideal gas', species=['air']) inflow = FlowCondition(p=p_inf, u=u_inf, T=T_inf, tke=tke_inf, omega=omega_inf) initial = FlowCondition(p=p_init, u=0, T=T_wall, tke=0.0, omega=1.0) mm = 1.0e-3 # metres per mm # Conical forebody a0 = Vector(0.0, 0.0) a1 = Vector(0.0, 10.0) * mm # leading edge of domain y_outer = 130.0 # mm outer radius of simulated domain a2 = Vector(0.0, y_outer) * mm
u_cj_th = 759.8 # m/s T_cj_th = 236.5 # degrees K rho_cj_th = p_cj_th / (1537.3 * T_cj_th) # Uses R from He-O2 # Ambient conditions p_amb = 101300 # Pa u_amb = 0.0 # m/s T_amb = 300.0 # degrees K rho_amb = p_amb / (287.1 * T_amb) # Uses R from Air # Estimate turbulence quantities for free stream by specifying turbulence # intensity and the ratio of turbulent-to-laminar viscosity # for coflow jet tke_coflow = 1.5 * (0.01 * u_coflow)**2 mu_t_coflow = 1.0 * sutherland.mu(T_coflow, "Air") omega_coflow = rho_coflow * tke_coflow / mu_t_coflow # for centrejet tke_cj = 0.0 # 1.5 * (0.005 * u_cj)**2 mu_t_cj = 1.0 * sutherland.mu(T_cj, "Air") omega_cj = rho_cj * tke_cj / mu_t_cj # for coflow jet at throat tke_coflow_th = 1.5 * (0.035 * u_coflow_th)**2 mu_t_coflow_th = 5000.0 * sutherland.mu(T_coflow_th, "Air") omega_coflow_th = rho_coflow_th * tke_coflow_th / mu_t_coflow_th # for centrejet at throat tke_cj_th = 1.5 * (0.020 * u_cj_th)**2 mu_t_cj_th = 5000.0 * sutherland.mu(T_cj_th, "Air")