Skip to content

Commit

Permalink
Rayleigh
Browse files Browse the repository at this point in the history
- Shock wave: syntax of comment fix
- add inverse Mach from Ti ratio
- example: Rayleigh heating
- example: Ramjet working line, full supersonic and conventional working line
  • Loading branch information
jgressier committed Jun 16, 2014
1 parent 581c46f commit a56321b
Show file tree
Hide file tree
Showing 5 changed files with 151 additions and 3 deletions.
12 changes: 12 additions & 0 deletions aero/Rayleigh.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,15 @@ def NormdS(Mach, gamma=1.4):
m2 = np.square(Mach)
return np.log(m2*((gamma+1)/(1+gamma*m2))**((gamma+1)/gamma))

def SubMach_TiTicri(Tiratio, gamma=1.4):
""" computes Mach number from Ti/Ti_cri ratio (<1)
"""
alpha = np.sqrt(1.-Tiratio)
return np.sqrt((1.-alpha)/(alpha*gamma+1))

def SupMach_TiTicri(Tiratio, gamma=1.4):
""" computes Mach number from Ti/Ti_cri ratio (<1)
"""
alpha = np.sqrt(1.-Tiratio)
return np.sqrt((1.+alpha)/(1.-alpha*gamma))

6 changes: 4 additions & 2 deletions aero/ShockWave.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,16 @@ def local_f(sig):
return IterativeSolve.secant_solve(local_f, deflection, degree.asin(1./Mach)+deflection)

def sigmaMax(Mach, gamma=1.4):
" computes the MAXIMUM shock angle (always subsonic downstream flow)
""" computes the MAXIMUM shock angle (always subsonic downstream flow)
"""
M2 = np.square(Mach)
ka = (M2-1.)*(1.+.5*(gamma-1.)*M2)
kb = .25*((gamma+1.)*M2-(3.-gamma))*M2 + 1.
return degree.atan(np.sqrt((kb+np.sqrt(kb**2+ka))/ka))

def sigmaSonic(Mach, gamma=1.4):
" computes the shock angle for a downstream SONIC Mach number
""" computes the shock angle for a downstream SONIC Mach number
"""
M2 = np.square(Mach)
ka = gamma-3+M2*(gamma+1)
kb = (gamma+1)*(np.square(M2-3)+gamma*np.square(M2+1))
Expand Down
2 changes: 1 addition & 1 deletion doxygen.conf
Original file line number Diff line number Diff line change
Expand Up @@ -1397,7 +1397,7 @@ FORMULA_TRANSPARENT = YES
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.

USE_MATHJAX = NO
USE_MATHJAX = YES

# When MathJax is enabled you can set the default output format to be used for
# the MathJax output. See the MathJax site (see:
Expand Down
101 changes: 101 additions & 0 deletions examples/ramjet-working.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# -*- coding: utf-8 -*-
"""
Design of Ramjet
@author: j.gressier
all sections are normalized by A0, section of upstream flow
- 1 is flow section in inlet (possibly decelerated by external compression)
- 2 is the inlet throat
- 21 or 22 are the upstream and downstream sections at the normal shock in the inlet
- 3 is the beginning of the combustor
- 4 is the end of the combustor (A3=A4)
- 8 is the throat of the nozzle
- 9 is the nozzle exit
"""

import numpy as np
import matplotlib.pyplot as plt
import aero.Isentropic as isent
import aero.MassFlow as mf
import aero.ShockWave as sw
import aero.Rayleigh as ray

gam = 1.4 # assumed constant
npts = 50
M0 = 3.
M2 = 1.5
A2A0 = mf.Sigma_Mach(M2, gam)/mf.Sigma_Mach(M0, gam)
print "A0/A2 for isentropic compression from Mach %4.2f to %4.2f : %6.3f"%(M0, M2, 1./A2A0)
A3A2 = 1./A2A0
A8A2 = .6*A3A2

fig=plt.figure(1, figsize=(10,12))
fig.suptitle('Flow features on RAMJET, $M_2=%.2f$, $A_8/A_2=%.2f$, $\gamma = %.1f$'
%(M2, A8A2, gam), fontsize=12, y=0.93)

plt.subplot(311)
plt.ylabel('$p_{i3}/p_{i0}$', fontsize=10)
plt.grid(which='major', linestyle=':', alpha=0.5)

plt.subplot(312)
plt.ylabel('$p_{i4}/p_{i0}$', fontsize=10)
plt.grid(which='major', linestyle=':', alpha=0.5)

plt.subplot(313)
plt.ylabel('$M_{4}$', fontsize=10)
plt.grid(which='major', linestyle=':', alpha=0.5)

# --- (FS) fully supersonic flow (not expected on design)

M3sup = mf.Mach_Sigma(A3A2*mf.Sigma_Mach(M2, gam), gam)
M4max = mf.Mach_Sigma(A3A2/A8A2, 2., gam) # look for supersonic value
alphamax = ray.Ti_Ticri(M4max, gam)/ray.Ti_Ticri(M3sup, gam)
print "unchoking of fully supersonic flow for Ti4/Ti0 = %6.3f"%(alphamax)

FSalpha = np.log10(np.logspace(1., alphamax, npts+1))
FSm4 = ray.SupMach_TiTicri(FSalpha/alphamax*ray.Ti_Ticri(M4max, gam), gam)
FSpi4 = ray.Pi_Picri(FSm4, gam)/ray.Pi_Picri(M3sup, gam)
FSpi3 = np.ones(npts+1)
plt.subplot(311)
plt.ylabel('$p_{i3}/p_{i0}$', fontsize=10)
plt.plot(FSalpha, FSpi3, '-', color='#ff0000')
plt.subplot(312)
plt.ylabel('$p_{i4}/p_{i0}$', fontsize=10)
plt.plot(FSalpha, FSpi4, '-', color='#ff0000')
plt.subplot(313)
plt.ylabel('$M_{4}$', fontsize=10)
plt.plot(FSalpha, FSm4, '-', color='#ff0000')

# --- (CW) conventional working state

# M8 is sonic so M4 is known
CWm4 = mf.Mach_Sigma(A3A2/A8A2, .1, gam) # look for subsonic value

CWm3low = sw.downstream_Mn(M3sup, gam)
alphamin = ray.Ti_Ticri(CWm4, gam)/ray.Ti_Ticri(CWm3low, gam)
CWm3high = mf.Mach_Sigma(A3A2*mf.Sigma_Mach(sw.downstream_Mn(M2, gam), gam), .1, gam)
alphamax = ray.Ti_Ticri(CWm4, gam)/ray.Ti_Ticri(CWm3high, gam)
print " unchoking of inlet throat for Ti4/Ti0 = %6.3f"%(alphamax)
print " fully supersonic flow for Ti4/Ti0 = %6.3f"%(alphamin)

CWalpha = np.log10(np.logspace(alphamin, alphamax, npts+1))
CWm3 = ray.SubMach_TiTicri(ray.Ti_Ticri(CWm4, gam)/CWalpha, gam)
CWpi3 = mf.Sigma_Mach(CWm3, gam)/mf.Sigma_Mach(M2, gam)/A3A2
CWpi4 = CWpi3*ray.Pi_Picri(CWm4, gam)/ray.Pi_Picri(CWm3, gam)
CWm4 = np.ones(npts+1)*CWm4

plt.subplot(311)
plt.plot(CWalpha, CWpi3, '-', color='#bb0000')
plt.subplot(312)
plt.plot(CWalpha, CWpi4, '-', color='#bb0000')
plt.subplot(313)
plt.plot(CWalpha, CWm4, '-', color='#bb0000')
plt.show

# --- unchoked channel


#plt.minorticks_on()
plt.grid(which='major', linestyle=':', alpha=0.5)
#plt.grid(which='minor', linestyle=':', alpha=0.5)
fig.savefig('Rayleigh-TS.pdf', bbox_inches='tight')
#show()
33 changes: 33 additions & 0 deletions examples/rayleigh-heating.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# -*- coding: utf-8 -*-
"""
Plot of Rayleigh curves in several diagrams
@author: j.gressier
"""

import numpy as np
import matplotlib.pyplot as plt
import aero.Rayleigh as ray

npoints = 100
gam = 1.4

fig=plt.figure(1, figsize=(10,8))
fig.suptitle('Mach number evolution when heating, $\gamma = %.1f$'%gam, fontsize=12, y=0.93)

for M0 in [.1, .2, .3, .4, .5, .6, .7, .8, .9, 1.2, 1.5, 2., 3., 4., 6., 10., 20.]:
#for M0 in [.1, .5]:
Timax = ray.maxTiratio_Mach(M0, gam)
Ti = np.log10(np.logspace(1., Timax, npoints+1))
Mach = ray.SubMach_TiTicri(Ti/Timax, gam) if M0 < 1 else ray.SupMach_TiTicri(Ti/Timax, gam)
plt.plot(Ti, Mach, '-', color='#ff0000')

plt.axis([1., 10, .1, 10.])
plt.ylabel('Mach number', fontsize=10)
plt.xlabel('$T_i/T_{i0}$', fontsize=10)
plt.loglog()
#plt.ticklabel_format(axis='both', style='plain')
#plt.minorticks_on()
plt.grid(which='major', linestyle=':', alpha=0.5)
plt.grid(which='minor', linestyle=':', alpha=0.5)
fig.savefig('Rayleigh-heating.pdf', bbox_inches='tight')
#plt.show()

0 comments on commit a56321b

Please sign in to comment.