0% found this document useful (0 votes)
86 views16 pages

Aerospace 312 Proj 2

The document describes an iterative method to determine the location of a shock in a converging-diverging nozzle by calculating the ratio of exit pressure to upstream total pressure. The method involves making initial guesses for the ratio of the area at the shock to the throat area and the upstream Mach number. Equations are then used to iteratively calculate downstream conditions and compare the exit pressure ratio to the given value, refining the guesses until the values match within tolerance. The goal is to determine the shock location using conservation laws and normal shock relationships solved with MATLAB.

Uploaded by

nke5001
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
86 views16 pages

Aerospace 312 Proj 2

The document describes an iterative method to determine the location of a shock in a converging-diverging nozzle by calculating the ratio of exit pressure to upstream total pressure. The method involves making initial guesses for the ratio of the area at the shock to the throat area and the upstream Mach number. Equations are then used to iteratively calculate downstream conditions and compare the exit pressure ratio to the given value, refining the guesses until the values match within tolerance. The goal is to determine the shock location using conservation laws and normal shock relationships solved with MATLAB.

Uploaded by

nke5001
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 16

Aerospace 312: Computer Project II

Converging-
Diverging Flow With
a Shock
Utilizing Iterative Methods to Determine Shock Location

Nathan Keith Empson


I. Problem Statement

a. Abstract
The primary objective of the project is to resolve the position of a shock in a converging-
diverging nozzle. In the solution, the gas inside the nozzle will be assumed as frictionless, and
with no heat transfer. Relative theory will encompass energy conservation and normal shock
relationships. The software package MatLab will be used to first iteratively solve for the
position of the shock via both normal shock and isentropic relations. After the location of the
shock is determined all other desirable values: pressure, temperature, and velocity may be
determined and a full understanding of flow in the nozzle will be acquired. The most relevant
data will portray the relationships between flow pressure, temperature, and velocity
throughout the length of the nozzle.

b. Introduction

M>1 M <1

Shock

Figure 1. Converging-Diverging Nozzle

As stated, the first and primary objective is to determine the location of the shock. The
only known information about the nozzle is presented below.

pe
=0.5(2)
pt 1
pe
=0.5(2)
pt 1

The length of the nozzle is assumed to be one unit. The area of the exit is also taken as a single
square unit. The area, A, is taken to be proportional to longitudinal displacement down the
nozzle, x. The area of the throat is given as one fourth the area at the exit of the nozzle.

A α x (3)

0 ≤ x ≤ 1(4)

Ae =1(5)

Flow is taken to be calorically perfect, steady, frictionless, and with no heat transfer. Thus:

1
( )
ρ h+ u2 uA=constant ( 6)
2

The flow will begin in the chamber and proceed until it arrives at the throat. Throat conditions
imply that the Mach number, M, will be identically one. As the flow proceeds down the nozzle
it continues supersonically until it reaches the shock location. The shock is taken to occur in an
infinitesimally small change in x. The Mach number will undergo a discontinuous change and
become subsonic downstream of the shock.

Table 1. Subscript Clarification

Subscript Meaning

e Exit

t Chamber or
Reservoir

1 Upstream of
Shock

2 Downstream
of Shock

s Shock

* Throat
II. Analysis
With the general trends of the flow in the nozzle described, a more in depth understanding
may be attained. Beginning with the conservation of mass:

ρuA=ρ¿ u¿ A ¿ (7)

a=√ γRT (8)

u
M = (9)
a

Utilizing that the flow is isentropic: the temperature and density of the flow in the reservoir
are constant and that the Mach number at the throat is one:
γ +1
A 1 2 γ −1 2
¿=
A M γ +1{ [
1+
2
M ]} 2(γ −1)
(10)

1 1
A
{(
M i+1=5 1.728
A ¿ M 3
) }
2
j −1 (11)

In order to proceed from this point, two guesses must be taken for a value of the ratio of area
at the shock to the area of the throat and a Mach number. This initial area ratio guess will
allow the code to proceed, iterating until a value for the Mach number just ahead of the shock
is found, corresponding to this initial guess. The resulting Mach number just ahead of the shock
will allow several other values to be tabulated. The end result, and goal of the string of
calculations that follow will be to find the ratio of the exit pressure to the total pressure in the
section of the nozzle ahead of the shock. Note that this value is given, in equation two, is given
to be one half. The two guessed area ratios will ultimately yield two errors, or two pressure
ratios that vary from the given value of one half. The following equations describe the steps
taken to deduce a value of exit pressure to total pressure upstream of the shock given values
for the ratio on the left hand side of equation ten.

p1 γ −1 −γ

pt 1 (
= 1+
2
M1
2
) γ−1
(12)

p2 2γ
=1+ ( M 12−1 ) (13)
p1 γ +1

2+(γ −1) M 12
M 2=

2 γ M 12−(γ −1)
(14)
p2 γ −1 −γ

pt 2 (
= 1+
2
M2
2
) γ−1
(15)

Equations (12) and (13) may be combined in order to find the relationship of the total pressure
behind the shock. Note that this value for the total pressures on each side of the shock will not
change, and that equation (16) is independent of the x location of interest.

pt2
∗p2
p2
∗p 1
pt 2 p1
= (16)
pt 1 pt 1

With the Mach number just downstream of the shock found from equation (14) we may return
to equation (10) and tabulate the ratio of the area downstream of the shock to the area of the
throat. At last we are finally developing equations that relate downstream of the shock
conditions to the exit conditions.

As
¿ ∗A¿1
A A¿2
1
= (17)
A ¿
2 As

Ae ¿
¿ ∗A 1
A e A1
= (18)
A ¿2 A ¿2

Given a result of equation (18), we can obtain a value for the exit Mach number, as follows.
The iterative process for this step is identical to that for equation (11) where we utilized the
guessed area ratio. Note that the velocities at this point, behind the shock, will be subsonic;
this explains the variance between equations (19) and (11).
3
(1+.2 M e ( i )2 )
M e ( i+1 )= ( 19 )
A
1.728 e¿
A2

We are approaching the culmination of the first section of the code and the primary goal of the
project: calculating the location of the shock. All that is left now is to finally calculate the ratio
of the exit pressure to the total upstream of the shock to the given value in equation (2).

pe 2 −3.5
=(1+.2 M 2 ) (20)
pt 2
pe
∗p
pe pt 2 t 2
= (21)
pt 1 pt 1

Recall that initially we took two guesses for the area ratio of equation (10). We have then
followed a progression through both normal shock and isentropic relations that have allowed
us to juxtapose the results of our guessed values with a known quantity. It is apparent now
that we can assume a relationship between the guess and corresponding error, and formulate a
new guess, resulting in less error. Linear interpolation should be completed, and the guess that
resulted in the largest absolute value of error replaced. The entire process may then be
repeated until both guesses have resulted in an error less than the desired tolerance.

pe pe
ε= − given(22)
p t 1 pt 1

ε 2−ε 1
slope= (23)
guess 2−guess 1
III. Code Structure
Input two guesses for
As/A*
Find the ratio of
downstream Calculate ratio of
pressure to pressure upstream
upstream of shock to Pt1
pressure.
Iterate to find
Mach number
upstream of shock.

Calculate M2,
Resolve ratio of P2 Mach number
to Pt2. downstream of
shock.

Calculate relation
of Pt2 to Pt1.

Compute Ae over
A2t.

Replace worst
Iterate to calculate current guess with
the Mach number interpolated guess.
of the exit.

Find the ratio of


exit pressure to
total pressure No
downstream of
shock. Output relevant
data

Relate the exit


pressure to total
pressure
upstream.

Is the error caused by each of the Calculate ratio of Calculate ratio of


guesses less than the tolerance? pressure to total temperature to
pressure reservoir
upstream. temperature.
Determine the
error caused
by the current
guesses.

Iterate Mach
Yes number as
function of X

IV. Results and Discussion


a. Pressure vs. Position
P/P t1 vs X
0.7

0.6

0.5

0.4
P/Pt1

0.3

0.2

0.1

0
0 0.2 0.4 0.6 0.8 1 1.2 1.4
Dimensionless Distance Downstream of Throat (X)

The first of the above graphs is the graphical representation of the results of the MatLab
code. The ratio of the pressures accurately begins at one half, which corresponds to the input
value. This shows that our error loops were indeed effective at resolving the ratio of exit area
to throat area to an accurate number. The final computed ratio for the area of the shock to the
area of the throat was 2.46. This, as shown above, corresponds to an X position of .486.

AS
=2.46
At
X s=0.486

The resultant figure of the MatLab code very closely resembles the plot made available by
Professor William Davenport of The Virginia Polytechnic Institute and State University. Both
graphs accurately depict the decay in pressure we would expect as a result of isentropic
relations. Keeping in mind that the total pressure remains the same and recalling from the
problem statement that the area varies linearly with X, it is inherent that the static pressure
must drop. The pressure then drastically increases via a discontinuity at the shock in order to
be able to meet the static pressure at the exit.

b. Temperature vs. Position


T/Tt1 vs X
1

0.9

0.8
T/Tt1

0.7

0.6

0.5

0.4
0 0.2 0.4 0.6 0.8 1 1.2 1.4
Dimensionless Distance Downstream of Throat (X)

With the pressure distribution throughout the X domain behind us, analyzing the
temperature data is relatively simple. The two variables are related linearly via the ideal gas
law. The temperature begins at a value of approximately 0.8, appropriately decays so that the
ratio is less than one half by the time the flow reaches the shock point. At this location the
temperature abruptly increases, just as the pressure did. As the flow approaches the end of the
tunnel, and X values closer and closer to one, the temperature also increases to nearly one.

c. Mach Number vs. Position


Mach Number vs X
2.5

2
Mach Number (M)

1.5

0.5

0
0 0.2 0.4 0.6 0.8 1 1.2 1.4
Dimensionless Distance Downstream of Throat (X)

The Mach number vs X plot accurately begins at a Mach number equal to one where X is
zero, at the throat. The Mach number then begins to increase, as demonstrated in the
conservation of energy in equation (6). Due to the total enthalpy being conserved across a
shock, the total temperature is constant. The shock also converts some of the flow’s kinetic
energy into thermal energy; this may be noted in both the large jump in temperature at the
shock and inversely the decrease of Mach number at the shock.

V. Code Appendix
VI. % Nathan Empson
VII. %Aerospace 312- Project II
VIII. %Converging-Diverging Nozzle Flow with a Shock
IX. %Due: Friday April 24, 2009
X.
XI. clc
XII. clear
XIII.
XIV. gamma = 1.4;
XV. Ae=1;
XVI. i=1;
XVII. j=1;
XVIII. At=0.25;
XIX. As=.25;
XX. As2=1;
XXI. M1(i) = 2;
XXII. M1_2(i) = 2;
XXIII. Prat=0.5;
XXIV. ErrTol=0.00001;
XXV. Err2=1;
XXVI. Err1=1;
XXVII. Me(j)=2;
XXVIII. Me_2(j)=2;
XXIX.
XXX. %Large while loop, encompassing all normal shock and isentropic
equations
XXXI. % that bring me to the pressure ratio.
XXXII. while (abs(Err2)>ErrTol)
XXXIII.
XXXIV. i=1;
XXXV. %Iterating to find the first M1, given each of the two guesses.
XXXVI. while(i<100)
XXXVII. M1(i+1) = (5 * ((1.728* As/At* M1(i))^(1/3) - 1)) ^ (1/2);
XXXVIII. M1_2(i+1) = (5 * ((1.728* As2/At* M1_2(i))^(1/3) - 1)) ^ (1/2);
XXXIX. i=i+1;
XL. end
XLI.
XLII.
XLIII. P1_Pt1 = ((1 + (gamma - 1)/2 * M1(i)^2))^(-gamma/(gamma-1));
XLIV. P1_Pt1_2 = ((1 + (gamma - 1)/2 * M1_2(i)^2))^(-gamma/(gamma-1));
XLV.
XLVI. P2_P1 = 1 + 2*gamma/(gamma+1)* (M1(i)^2-1);
XLVII. P2_P1_2 = 1 + 2*gamma/(gamma+1)* (M1_2(i)^2-1);
XLVIII.
XLIX. M2 = sqrt((1 + ((gamma - 1) /2 * M1(i)^2)) / ((gamma * M1(i)^2) -
(gamma - 1)/2));
L. M2_2 = sqrt((1 + ((gamma - 1) /2 * M1_2(i)^2)) / ((gamma *
M1_2(i)^2) - (gamma - 1)/2));
LI.
LII. P2_Pt2 = ( 1 + (gamma-1)/2 * M2^2)^ (-gamma/(gamma-1));
LIII. P2_Pt2_2 = ( 1 + (gamma-1)/2 * M2_2^2)^ (-gamma/(gamma-1));
LIV.
LV. Pt2_Pt1 = P2_P1 * P1_Pt1 / P2_Pt2;
LVI. Pt2_Pt1_2 = P2_P1_2 * P1_Pt1_2 / P2_Pt2_2;
LVII.
LVIII. A2_A2t = 1/M2* ((1+0.2*M2^2))^3/ 1.728;
LIX. A2_A2t_2 = 1/M2_2* ((1+0.2*M2_2^2))^3/ 1.728;
LX.
LXI. A2t_A1t = 2/ A2_A2t;
LXII. A2t_A1t_2 = 2/A2_A2t_2;
LXIII.
LXIV. Ae_A2t = Ae/At / A2t_A1t;
LXV. Ae_A2t_2 = Ae/At / A2t_A1t_2;
LXVI. j=1;
LXVII. %Iterating to find Me given the quatites calculted via the two
LXVIII. %current guesses.
LXIX. while(j<100)
LXX. Me(j+1) = (1 + 0.2 * Me(j)^2)^3/(1.728 * Ae_A2t);
LXXI. Me_2(j+1) = (1 + 0.2 * Me_2(j)^2)^3/(1.728 * Ae_A2t_2);
LXXII. j=j+1;
LXXIII. end
LXXIV.
LXXV. Pe_Pt2 = (1 + 0.2 * Me(j)^2) ^(-3.5);
LXXVI. Pe_Pt2_2 = (1 + 0.2 * Me_2(j)^2) ^(-3.5);
LXXVII.
LXXVIII. Pe_Pt1 = Pe_Pt2* Pt2_Pt1;
LXXIX. Pe_Pt1_2 = Pe_Pt2_2* Pt2_Pt1_2;
LXXX. %The pressure ratios of exit to total are found. Compare this to
the
LXXXI. %given value, tabulate error, interpolate.
LXXXII. Err1 = Pe_Pt1 - Prat;
LXXXIII. Err2 = Pe_Pt1_2 - Prat;
LXXXIV.
LXXXV. slope = (Err2-Err1)/(As2-As);
LXXXVI. yint= -slope* As + Err1;
LXXXVII. NewAs = -yint/slope;
LXXXVIII. %Following if loops replace the guess that causes the largest error.
LXXXIX. %The loops are formulated so that only one error needs be checked in
the
XC. %total error loop.
XCI. if (abs(Err2) < abs(Err1))
XCII. As = As2;
XCIII. As2=NewAs;
XCIV. end
XCV. if (abs(Err2) > abs (Err1))
XCVI.
XCVII. As2=NewAs;
XCVIII. end
XCIX. end
C.
CI. k=1;
CII. X(k)=0;
CIII. M(k) = 1;
CIV. PPtot(k) = (1+(gamma-1)/2 *M(k)^2)^(-gamma/(gamma-1));
CV. T(k) = 1/(1+ (gamma-1)/2 * M(k)^2);
CVI. A(k)=At;
CVII. Xs = (As/At-1)/3;
CVIII. inc=Xs/1000;
CIX. Mitt(1)=2;
CX.
CXI. while (X(k)<Xs)
CXII. X(k+1)=X(k)+inc; %Getting arrays: 1 each for X pos. and Area.
CXIII. A(k+1)= 3/4*X(k)+ At;
CXIV. p=1;
CXV.
CXVI. %Iterates, finding a correct Mach number for each X or area ratio.
CXVII. while(p<100)
CXVIII. Mitt(p+1) = (5 * ((1.728* A(k)/At* Mitt(p))^(1/3) - 1)) ^ (1/2);
CXIX. p=p+1;
CXX. end
CXXI. PPtot(k+1) = (1+(gamma-1)/2 *M(k)^2)^(-gamma/(gamma-1));
CXXII. M(k+1)=Mitt(p); %Plucks each of the M numbers after being iterated.
CXXIII. T(k+1) = 1/(1+ (gamma-1)/2 * M(k)^2);
CXXIV.
CXXV. k=k+1;
CXXVI.
CXXVII. end
CXXVIII. X(k+1)=X(k);
CXXIX. M(k+1)=M2;
CXXX. A(k+1)=A(k);
CXXXI. PPtot(k+1) = PPtot(k);
CXXXII. T(k+1) = T(k);
CXXXIII.
CXXXIV. while (X(k)<1)
CXXXV. X(k+1)=X(k)+inc;
CXXXVI. A(k+1)= 3/4*X(k)+ At;
CXXXVII. p=1;
CXXXVIII.
CXXXIX. while(p<100)
CXL. Mitt(p+1) = (1 + 0.2 * Mitt(p) ^2 )^3/(1.728*(A(k)/At));
CXLI. p=p+1;
CXLII. end
CXLIII.
CXLIV. PPtot(k+1) = (1+(gamma-1)/2 *M(k)^2)^(-gamma/(gamma-1))*Pt2_Pt1;
CXLV. M(k+1)=Mitt(p);
CXLVI. k=k+1;
CXLVII. T(k) = 1/(1+ (gamma-1)/2 * M(k)^2);
CXLVIII.
CXLIX.
CL. end
CLI.
CLII. plot(X,M)
CLIII. xlabel ('Dimensionless Distance Downstream of Throat (X)')
CLIV. ylabel ('Mach Number (M)')
CLV. title ('Mach Number vs X')
CLVI.
CLVII. % plot(X,PPtot)
CLVIII. % xlabel ('Dimensionless Distance Downstream of Throat (X)')
CLIX. % ylabel ('P/P_t_1')
CLX. % title ('P/P_t_1 vs X')
CLXI.
CLXII. % plot(X,T)
CLXIII. % xlabel ('Dimensionless Distance Downstream of Throat (X)')
CLXIV. % ylabel ('T/T_t_1')
CLXV. % title ('T/T_t_1 vs X')
CLXVI.
CLXVII.
CLXVIII.
CLXIX.
CLXX.
CLXXI.
CLXXII.

You might also like