You are on page 1of 17

Session 2366

Using MathCad for Generalized One-Dimensional Compressible Flow in


An Introductory Compressible Flow Course
B. K. Hodge
Department of Mechanical Engineering
Mississippi State University
Abstract
The use of MathCad as the arithmetic engine in a generalized one-dimensional compressible
flow segment in an introductory compressible flow course is examined. Traditional approaches
to the topic are discussed, the course description is presented, and details of the MathCad
formulation are delineated. The impact on the students mastery of generalized one-dimensional
compressible flow is assessed. Anecdotally, the use of MathCad in this topic was considered to
be a success since student mastery was enhanced over the previously-used code
development/modification approach.
I. Introduction
Introductory compressible flow courses are often offered as technical electives in mechanical
engineering (ME) programs. Most introductory compressible flow courses treat in detail the
simple compressible flows [isentropic (area change only), Fanno (friction only), and Rayleigh
(heat addition or rejection only)] as well as normal and oblique shock waves and Prandtl-Meyer
flow. The classic textbook by Shapiro (1), which has influenced several generations of students
and teachers, is organized in this manner as are other more contemporary offerings such as
Oosthuizen and Carscallen (2). Combinations of area change, friction, heat transfer, and/or mass
addition are usually called generalized one-dimensional flows and are covered in introductory
courses after the individual simple flows have been presented. Since most generalized flows
require numerical solutions, code development in higher languages (Basic, Fortran, C++,.) is
usually required. In an era when the typical ME undergraduate is becoming less proficient at
code development and more proficient at software utilization, porting the procedures to an
arithmetic system such as MathCad results in enhanced application opportunities while taking
advantage of the students software skills.
This paper examines the use of MathCad in the generalized one-dimensional flow segment in an
introductory compressible flow course at Mississippi State University. For a number of years
this segment has been based on code development and code modification. Students understood
the generalized flow concepts, but tended to spend excessive time with code development/
modifications. As a result the students efforts were devoted more to getting answers than to
understanding results. Anecdotally, the use of MathCad has resulted in a more focussed
presentation of generalized flow concepts and in better understanding of the nuances by the
students.
II. Background
Generally, Shapiro and many other compressible flow textbooks proceed from the particular to
the general in their treatment of one-dimensional compressible flow. In such a treatment,
simple isentropic flow (area change in the absence of friction, heat transfer, and mass
addition), simple Fanno flow (friction in the absence of area change, heat transfer, and mass
addition), simple diabatic flow (heat transfer in the absence of area change, friction, and mass
addition) are each treated by applying the conservation equations to a control volume featuring
only a single effect (area change or friction or heat transfer). Each of these simple flows is then
examined in detail and the characteristics and behavior explored. At some point in this approach
to simple flows, normal and oblique shock waves and Prandtl-Meyer processes are introduced
and their behavior likewise explored in conjunction with the already-established simple flows.
In the aforementioned approach of Shapiro (1) and others, generalized one-dimensional flow is
then developed and applications are previewed. As part of this process the relationships of
generalized flow to the simple flows are then explored. While traditional, this particular-to-
general methodology can result in the student not really comprehending the complementary
relationship that exists between the simple and generalized flows. Additionally, considerable
effort can be spent in individual derivations related to each of the simple flows, and much of that
effort must be repeated for the generalized flows.
An alternative to this approach is to proceed from the general to the particular. Hodge and
Koenig (3) utilize this procedure. A synergistic result of the order is that generalized one-
dimensional compressible flow has already been introduced so that applications can be examined
without any additional background. Generalized one-dimensional compressible flow is not a
new idea; Shapiro (1), from 1953, gives a quite lucid presentation. However, relatively complete
treatment of such flows is generally not included in introductory courses. The mathematics are
not particularly daunting, but most solutions are numerical in nature. The numerical details can
quickly subsume much of the students time with the results that full utility of one-dimensional
compressible flow can be obscured. Hodge and Koenig (3) present several computer programs
that treat various problems in generalized flow. However, with the advent of arithmetic systems
such as MathCad, Matlab, and Mathematica, the arithmetic details are handled by software, and
the student is able to devote more time to understanding and meaningful applications of one-
dimensional compressible flow. This paper explores the use of MathCad as the solution engine
for generalized one-dimensional compressible flow in an introductory compressible flow course
in the Mechanical Engineering Department at Mississippi State University.
III. Course Description
ME 4823/6823 Compressible Flow and Turbomachinery is the introductory compressible flow
course in the Mechanical Engineering Department at Mississippi State University. Except for
about three weeks coverage on turbomachinery, the course is a conventional introductory
compressible flow course. ME 4823/6823 is offered as a technical elective for undergraduates
and as a beginning graduate course for graduate students. Topics covered and the order of
coverage and the number of lecture periods devoted to each topic is presented in Table 1.
This is a somewhat unconventional order of coverage, but it follows the order of Hodge and
Koenig (3). The wave aspects are presented first for three reasons: (1) to illustrate unique
aspects of compressible flow, (2) to be available when needed for nozzle and internal flow
topics, and (3) to demonstrate the importance of wave concepts in compressible flow. The initial
two lectures on generalized compressible flow essentially start with a control volume, similar to
Fig. 1, and progress to a table of influence coefficients. The influence coefficient table becomes
the basis for all subsequent generalized and simple equation development. The concept of a
simple compressible flow as well as all necessary equations comes directly from the influence
coefficient table. Hence, the relationship of the simple flows to generalized flow is present from
the start of the development. After the simple flows are covered in detail, applications of
generalized one-dimensional compressible flow are presented and discussed in the context of
MathCad solutions. Details of generalized one-dimensional compressible flow are presented in
the next section.
Table 1. Topics and Lecture Periods
___________________________________________
Topic Lecture Periods
___________________________________________
Introductory Concepts 5
Normal Shock Waves 4
Oblique Shock Waves 2
Conical Shock Waves 1
Prandtl-Meyer Processes 3
Generalized 1-D Flow 2
Simple Flow Processes 1
Isentropic Flow 5
Fanno Flow 3
Rayleigh Flow 2
Simple Mass Addition 1
Generalized 1-D Solutions 3
Turbomachinery Topics 10
Tests 3
Total 45
____________________________________________
IV. Generalized One-Dimensional Compressible Flow
Generalized one-dimensional compressible flow of a calorically-perfect gas is developed in a
number of textbooks, Shapiro (1), Oosthuizen and Carscallen (2), Hodge and Koenig (3), and
Zucrow and Hoffmann (4), for example. The usual starting point is a control volume, similar to
the one in Fig. 1, with area change, mass addition, heat transfer, and friction schematically
indicated. Application of conservation of mass, momentum, and energy as well as the thermal
equation of state and definitions of Mach number, stagnation pressure, and entropy leads to a set
of differential equations for Mach number and properties such as density, entropy, and pressure.
All of the differential equations are cast in terms of the defined (known) driving potentials area
change [A(x)], friction [4f/D(x)], heat transfer [T
o
(x)], and mass addition [ ) ( x m& ]. The
differential equation for Mach number for generalized one-dimensional flow is as follows:

,
`

.
|
+ +
+
+ +

dx
x m d
x m
M
dx
x dT
x T
M
x D
f M
dx
x dA
x A M
M M
dx
dM
o
o
) (
) (
1
) 1 (
) (
) (
1
2
) 1 (
) (
4
2
) (
) (
1
1
) (
2
2 2
2
&
&


(1)
where
2
2
1
1 ) ( M M

+

.
The general procedure is to integrate the above differential equation for Mach number as a
function of x and then to use the integral relations to find the remaining physical properties.
With M(x) and the defined driving potentials A(x), 4f/D(x), T
o
(x), and ) ( x m& known, the
following integral relations, applied in the order shown, yield the x-variations of the indicated
physical properties.
) (
2
1
1
) 0 (
2
1
1
) 0 (
) (
) 0 (
) (
2
2
x M
M
T
x T
T
x T
o
o

(2a)
) 0 (
) (
) ( ) ( ) 0 (
) 0 ( ) 0 ( ) (
) 0 (
) (
T
x T
x M x A m
M A x m
P
x P
&
&
(2b)
) 0 (
) (
) 0 (
) (
) 0 (
) (
T
x T
M
x M
V
x V
(2c)
) (
) 0 (
) 0 (
) (
) 0 (
) (
x T
T
P
x P x

(2d)
1
) (
) 0 (
) 0 (
) (
) 0 (
) (
) 0 (
) (

,
`

.
|

x T
T
T
x T
P
x P
P
x P
o
o
o
o
(2e)
) 0 (
) (
ln
1
) 0 (
) (
ln
P
x P
T
x T
c
s
p


(2f)
where 0 as an argument indicates an initial condition (value at x = 0).
The sequence is straightforward so long as M is not near unity: solve Eq. (1), the differential
equation, for M(x) and then use the integral relations to compute the various property ratios.
Since a singular point of the differential equation is at the sonic point, generalized one-
dimensional flow solutions with Mach numbers near unity require special procedures in the
neighborhood of the sonic point. Beans (5) pointed out that if Eq. (1) is viewed as
) , , (
1
) (
2
M x G
M
M M
dx
dM

(3)
where

,
`

.
|
+ +
+
+ +

dx
x m d
x m
M
dx
x dT
x T
M
x D
f M
dx
x dA
x A
M x G
o
o
) (
) (
1
) 1 (
) (
) (
1
2
) 1 (
) (
4
2
) (
) (
1
) , , (
2
2 2
&
&


(4)
then at the sonic (M = 1) location a bounded dM/dx occurs only if G(x,,1) = 0. The sonic
location is determined as the root of G(x,,1) = 0. If G(x,,1) = 0 at the sonic location, Eq. (1)
reduces to the indeterminate form 0/0 and lHospitals rule can be applied to give
( ) ( )
1
1
1
2
1
1
4
1
2
4
2
8
1
1
1 2
1
1
4 1
2
8
1

]
]
]

,
`

.
|
+

,
`

.
|
+

,
`

.
|

,
`

.
|
+

]
]
]

,
`

.
|
+ +

,
`

.
|
+ +

,
`

.
|
+

,
`

.
|

,
`

.
|
M
o
o M
M
o
o M
dx
m d
m dx
dT
T D
f
dx
dM
dx
m d
m dx
d
dx
dT
T dx
d
D
f
dx
d
dx
dA
A dx
d
dx
dM
&
&
&
&

(5)
In the neighborhood of the sonic location, say |1 M| < 0.05, Eq. 1 is replaced by the limiting
value of dM/dx from Equation 5. Equation 5 has two rootsone positive and one negative. If
the positive root is used, the solution traverses the M = 1 location and supersonic Mach numbers
will result. If the negative root is used, subsonic flow will result.
The sequence of calculations for a generalized one-dimensional flow with a sonic location is as
follows:
1. Solve Eq. 4 in the form of G(x,,1) = 0 for the sonic location, x
sp
.
2. Use Eq. 5 to compute the limiting value of dM/dx at M = 1, located at x
sp
.
3. Integrate Eq. 1, with the limiting value of dM/dx used in the neighborhood of M = 1,
backwards from x
sp
to x = 0. This establishes the Mach number at the inlet location,
x = 0.
4. Using the inlet Mach number from step 3, integrate in the forward direction to find
M(x) for the entire domain and use the integral relations, Eqs. 2, to find the various
properties.
The procedure for treating generalized one-dimensional flows with Mach numbers near unity is
more complicated than for situations when the Mach numbers are not near unity. Thus, a natural
division for generalized one-dimensional flow computations is without and with a sonic
point (or location). MathCad examples are explored in the next section.
V. Examples
Computer solutions for generalized one-dimensional flow have long been used; Hodge and
Koenig (3) contain several examples in well-commented Q-basic of both divisions, with and
without sonic points. Since the general logic is present, translation to other higher-order
languages is straightforward. Generally, the MathCad implementation of the procedures is
simpler and more congruent with problem formulation than Q-basic examples of Hodge and
Koenig. This simplicity translates into a less time consuming and more effective presentation in
the classroom environment. Consider the following examples.
Example 1:
Air enters a tapered channel at T
o
= 1400 R, P
o
= 335 psia, and M = 0.2. Heat is added to the
flow such that the exit stagnation temperature is 2200 R. The channel is 2-ft long and tapers
from a diameter of 1 ft to a diameter of 10 inches. The friction factor is 0.005. Neglect the
effects of fuel addition and assume the properties are those of air. Solve for M, T, T
o
, P, and P
o
as functions of x.
If the stagnation temperature change is taken as linear then
400
dx
dT
o
and x x T
o
400 1400 ) ( + (6)
The diameter variation is D(x) = 1 x/12, which leads to
2
)
12
1 (
4
) (
x
x A

(7)
A schematic is presented in Figure 2, and the MathCad implementation for this example is
shown in Figure 3. The driving potentials and the differential equation are defined, the initial
condition on Mach number is stated, and the MathCad Runge-Kutta fixed-step procedure,
rkfixed, is called. Rkfixed returns the array Z with the first column being the independent
variable x and the second column being the Mach number M. M(x) versus x is shown in the
plot. The remaining properties are then computed using the integral relations. Plots of static and
stagnation temperature and pressure are presented. Table 2 contains a tabular listing of x and M
and the pressures and temperatures.
This is a good introductory example that illustrates most of what is needed to work without
sonic point problems. With driving potentials of area change, heat addition, and friction, this is a
true generalized flow example. Yet the MathCad implementation is easy, and more importantly,
easily understood by students.
Table 2. Tabular Output for Example 1
x
i
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
1.1
1.2
1.3
1.4
1.5
1.6
1.7
1.8
1.9
2
Mach
i
0.2
0.207
0.214
0.221
0.228
0.236
0.244
0.252
0.261
0.27
0.279
0.289
0.299
0.309
0.32
0.331
0.343
0.356
0.369
0.383
0.398
P
i
335
334.707
334.403
334.085
333.755
333.41
333.05
332.673
332.28
331.869
331.438
330.987
330.514
330.017
329.495
328.946
328.368
327.757
327.113
326.431
325.709
p
i
325.786
324.879
323.922
322.912
321.846
320.718
319.525
318.262
316.924
315.504
313.997
312.395
310.69
308.873
306.935
304.863
302.647
300.27
297.718
294.969
292.003
t
i
1388.889
1427.79
1466.596
1505.299
1543.889
1582.357
1620.69
1658.877
1696.904
1734.754
1772.412
1809.857
1847.067
1884.018
1920.68
1957.023
1993.008
2028.592
2063.726
2098.35
2132.396
T x
i
1400
1440
1480
1520
1560
1600
1640
1680
1720
1760
1800
1840
1880
1920
1960
2000
2040
2080
2120
2160
2200
Example 2:
Air enters a duct with an initial Mach number of 2.0 and stagnation conditions of 1000 K and
200 kPa. The 2-m long duct is composed of a constant diameter section for 1 m followed by a
sine-wave shaped diameter distribution for 1 m. The initial diameter is 0.2 m, and the final
diameter is 0.4 m. The friction factor is taken to be 0.005. The stagnation temperature varies in
a linear fashion from 1000 K at the entrance to 600 K at the exit. The mass flow rate at the exit
is 1.15 times the entrance mass flow rate; the injection is uniform. A normal shock wave stands
1.5 m from the entrance. Determine the distribution of Mach number for this arrangement. A
schematic of the duct arrangement is presented in Figure 4, and part of the MathCad worksheet is
given in Figure 5. The diameter distribution is as follows:
D(x) = 0.2 0 < x < 1
= 0.3 0.1 cos[(x 1)] 1 < x < 2 (8)
The other driving potentials are generated in a fashion similar to that of Example 1 and are given
as part of the MathCad worksheet, Figure 5. The capability to define piece-wise continuous
functions in MathCad greatly simplifies the area driving potential specification. The same
integration procedure for determination of the Mach numbers is followed in this example as in
Example 1, except that the integration is stopped at x = 1.5 (the location of the shock wave). The
first call to rkfixed integrates from x = 0 to x = 1.5. At x = 1.5, the Mach number is 3.005. The
conditions across the stationary normal shock wave are computed using the jump conditions
[see references (1) - (4)]. In this instance only the Mach number is needed, but other required
properties would be obtained using similar expressions. The Mach number downstream of the
normal shock is 0.475. Since the normal shock results in the Mach number discontinuously
changing from 3.005 to 0.475, without going through a sonic point, the singular point at M = 1 is
avoided and no special procedures are necessary. Hence, the without sonic point procedure
can be used. Rkfixed is invoked again, with the initial Mach number of 0.475, starting at x = 1.5
and ending at x = 2. The variation in Mach number with x is shown in Figure 5. Were other
properties required, they would be calculated using the integral relations as in Example 1. This
is a relatively complex example, but MathCad is again congruent with problem formulation, and
the solution proceeds in an orderly, serial fashion with little energy devoted to the arithmetic.
Example 3:
A converging-diverging nozzle with the hyperbolic diameter distribution
2
) 3 ( 25 . 0 1 ) ( + x x D (9)
is connected to a reservoir with stagnation conditions of 100 psia and 1000 R. Find the Mach
number distribution if the nozzle is flowing supersonically.
The nozzle shape is illustrated in Figure 6. The MathCad worksheet for this example is given in
Figure 7. The procedure follows that outlined in the previous section for solutions with sonic
locations present. The driving potentials are defined, however, the MathCad symbolic
manipulation capability is used to find dA/dx. The sonic point is next located by extracting the
root of Eq. 4 in the form of G(x,,1) = 0. The sonic location is at x
sp
= 3.148, although the
minimum area is located at x = 3. After the sonic point is located, the limiting value of dM/dx at
M = 1 is calculated using Eq. 5. Since Eq. 5 requires terms such as
]
]
]

) (
) (
1
x A
dx
d
x A dx
d
(10)
MathCads symbolic manipulation capability is used to avoid the tedious differentiations
required, and Eq. 5 is solved to obtain dM/dx = 0.512 as the limiting value for this problem.
Rkfixed is used to solve the differential equation from x = x
sp
to x = 0 to obtain the inlet Mach
number. For integrations involving Mach numbers in the neighborhood of unity, the limiting
value of dM/dx must be invoked, otherwise Eq. 1 is used. MathCad permits the piecewise
definition of the Eq. 1 and the limiting value of dM/dx as F(x,M) and greatly simplifies the
piecewise nature of the differential equation. The inlet Mach number which results is 0.164.
Once the inlet Mach number is determined, rkfixed is used to integrate from x = 0 to x = 10 for
M(x). Although not shown in the figure, other properties could be calculated as in Example 1.
This is a complex problem, yet the MathCad approach is logical and straightforward and readily
assimilated by students.
These three examples were presented in class in the same order as given herein. Students readily
grasped the procedures and successfully completed assignments involving generalized one-
dimensional flow. Two assignments were made: (1) a simple exercise with the channel
geometry specified and several combined effects and (2) a combustor design with injection along
the combustor barrel.
VI. Assessment and Conclusions
After more than a decade of presenting generalized compressible flow concepts in an
introductory compressible flow course, students reactions to the MathCad version were
astonishing in their uniformity. Virtually all students, including off-campus participants via
video tape, clearly understood the generalized flow concepts. Moreover, students familiar with
MathCad readily adapted to the use of MathCad for generalized flow applications. However,
several off-campus graduate students not familiar with MathCad opted to work the two
generalized flow assignments using a programming language such as Basic or Fortran.
Generally, the off-campus students who did not use MathCad experienced significant difficulties
with the assignments. The non-MathCad-worked generalized compressible flow assignments
were clearly inferior to those worked with MathCad. Part of the reasons could have been the
lack of class presentations on programming-language based approaches.
As a result of using MathCad, primarily due to its congruence to problem formulation, more
homework was assigned than in the pre-MathCad days and the level of difficulty of the
homework was also increased over the pre-MathCad days. Students also readily discovered the
advantages of MathCads symbolic manipulation capability in generating driving potential
expressions. Although all of these observations are anecdotal, the advantages of using MathCad
in this topic seem unambiguous.
Bibliography
1. Shapiro, A. H. (1953). The Dynamics and Thermodynamics of Compressible Fluid Flow. Ronald Press, New
York.
2. Oosthuizen, P. H., and Carscallen, W. E., (1997). Compressible Fluid Flow, McGraw-Hill, New York.
3. Hodge, B. K., and Koenig, K. (1995). Compressible Fluid Dynamics with Personal Computer Applications.
Prentice-Hall, Englewood Cliffs, NJ.
4. Zucrow, M. J., and Hoffman, J. D. (1976). Gas Dynamics. John Wiley, New York.
5. Beans, E. W. (1970). Computer Solutions to Generalized One-Dimensional Flow. J. Spacecraft and Rockets,
Vol. 7, No. 12, pp. 1460-1464.
KEITH HODGE
Dr. Hodge received his aerospace engineering BS and MS degrees from Mississippi State University (MSU) and his
mechanical engineering MS and Ph.D. degrees from the University of Alabama. Currently he is a Giles
Distinguished Professor, a Hearin-Hess Professor of Engineering, and Professor of Mechanical Engineering at MSU
where he teaches graduate and undergraduate courses in the thermal sciences and conducts related research. He is
the President of the ASEE Southeastern Section for the 1999-2000 Academic Year.
Figure 1. Generalized Flow Control Volume
Figure 2. Tapered Channel Schematic
Example 1. Tapered Channel Flow
Set the constant values: f 0.005

1.4
Define the driving potentials:
T( ) x 1400.0
.
400 x dTdx( ) x 400.0
D( ) x 1
x
12

A( ) x
.

4
1
x
12
2
dAdx( ) x
.

24
1
x
12
mdot( ) x 1.0 dmdotdx( ) x 0
Define and the differential equation:
( ) M 1
.
1
2
M
2
F( ) , x M
.
.
M ( ) M
1 M
2
dAdx( ) x
A( ) x
.
.
M
2
2
.
4 f
D( ) x
.
1
.
M
2
2
dTdx( ) x
T( ) x
.
1
.
M
2
dmdotdx( ) x
mdot( ) x
Set the initial condition: M
0
0.2
Solve the differential equation with the fixed-step Runge-Kutta:
Z rkfixed( ) , , , , M 0 2 20 F
Extract x and M from the return matrix Z:
x
< >
Z
0

Mach
< >
Z
1
i .. 0 last( ) x = Mach
last ( ) x
0.398 Exit Mach number
0 0.5 1 1.5 2
0.2
0.3
0.4
Mach
i
x
i
Use the integral relations to recover the remaining property ratios:
Static temperature tr
i
.
T x
i
T x
0
Mach
0
Mach
i
t
i
T x
i
Mach
i
Static pressure pr
i
. . .
mdot x
i
mdot x
0
A x
0
A x
i
Mach
0
Mach
i
tr
i
p0
335
Mach
0

1
= p0 325.786 Inlet static pressure
Figure 3. MathCad Worksheet for Example 1
p
i
.
p0 pr
i
Stagnation pressure P
i
.
p
i
Mach
i

1
= P
last ( ) x
325.709 Exit stagnation pressure
= p
last( ) x
292.003 Exit static pressure
0 0.5 1 1.5 2
1000
1500
2000
2500
T x
i
t
i
x
i
0 0.5 1 1.5 2
280
300
320
340
P
i
p
i
x
i
Figure 3. Concluded
Figure 4. Example 2 Channel Geometry
Example 2. Variable Area Channel with Shock Wave
Set the constant values: f 0.005 1.4
Define the driving potentials:
T( ) x 1000.0
.
200 x dTdx( ) x 200.0
D( ) x if 0.2 x 1
otherwise ( ) 0.3
.
0.1 cos( )
.
( ) x 1
A( ) x if
.

4
0.2
2
x 1
otherwise
.

4
( ) 0.3
.
0.1 cos( )
.
( ) x 1
2
dAdx( ) x if 0 x 1
otherwise
d
dx
.

4
( ) 0.3
.
0.1 cos( )
.
( ) x 1
2
mdot( ) x 1
.
0.075 x dmdotdx( ) x 0.0750
Define and the differential equation:
( ) M 1
.
1
2
M
2
F( ) , x M
.
.
M ( ) M
1 M
2
dAdx( ) x
A( ) x
.
.
M
2
2
.
4 f
D( ) x
.
1
.
M
2
2
dTdx( ) x
T( ) x
.
1
.
M
2
dmdotdx( ) x
mdot( ) x
Set the initial condition: M
0
2.0
Solve the differential equation with the fixed-step Runge-Kutta:
Z rkfixed( ) , , , , M 0 1.5 30 F
Extract x and M from the return matrix Z:
x
< >
Z
0
Mach
< >
Z
1
i .. 0 last( ) x = Mach
last ( ) x
3.005
Mu Mach
last( ) x
Mach number upstream of shock
Md
Mu
2
2
1
.
.
2
1
Mu
2
1
= Md 0.475 Mach number downstream of shock
M
0
Md Initial condition for integration downstream of shock wave
Solve the differential equation with the fixed-step Runge-Kutta:
Z rkfixed( ) , , , , M 1.5 2.0 10 F
Extract x and M from the return matrix Z:
y
< >
Z
0
Mac
< >
Z
1
j .. 0 last( ) y = Mac
last( ) y
0.23 Exit Mach number
Figure 5. MathCad Worksheet for Example 2
0 0.5 1 1.5 2
0
1
2
3
4
Mach
i
Mac
j
, x
i
y
j
Figure 5. Concluded
Figure 6. Example 3 Nozzle Geometry
Example 3. Converging-Diverging Nozzle Solution
Set the constant values: f 0.01 1.4
Define the driving potentials:
T( ) x 1000
.
20 x dTdx( ) x 20.0
D( ) x 1
.
0.25 ( ) x 3
2
A( ) x
.

4
1
.
0.25 ( ) x 3
2
dAdx( ) x
d
dx
A( ) x
mdot( ) x 1
.
0.01 x dmdotdx( ) x 0.01
Determine the sonic point location:
The sonic point is defined by the vanishing of the function G(x,,M) at M = 1.
The MathCad solve block, which requires an initial guess on the unknown, will be used to
find the sonic point location, x
sp
.
x 3 Initial guess on the location of the sonic point.
Given
0
dAdx( ) x
A( ) x
.

2
.
4 f
D( ) x
.
( ) 1
2
dTdx( ) x
T( ) x
.
( ) 1
dmdotdx( ) x
mdot( ) x
Eq. 4 at M = 1
x
sp
Find( ) x = x
sp
3.148 Sonic point location
The value of dM/dx at the sonic point is then evaluated using Eq. 5. The sonic point location is known
from the previous calculation.
assume x Specifies x as a variable.
Aterm( ) x
d
dx
.
1
A( ) x
d
dx
A( ) x = Aterm x
sp
0.492
fterm( ) x
d
dx
.
4 f
D( ) x
= fterm x
sp
0.001
Tterm( ) x
d
dx
.
1
T( ) x
d
dx
T( ) x = Tterm x
sp
3.54 10
4
mdotterm( ) x
d
dx
.
1
mdot( ) x
d
dx
mdot( ) x = mdotterm x
sp
9.399 10
5
Compute dM/dx at the sonic point by using Eq. 5 in a Solve block. The sonic point location is x
sp
.
dMdx 0.0 Initial guess on dM/dx and M = 1 for Solve block.
Given
dMdx
2
+
...
.
1
8
.
2 Aterm x
sp
.
fterm x
sp
.
( ) 1 Tterm x
sp
. .
2 ( ) 1 mdotterm x
sp
. . . .
2
1
8
dMdx
.
4 f
D x
sp
.
1
T x
sp
dTdx x
sp
. .
2
1
mdot x
sp
dmdotdx x
sp
dMdx Find( ) dMdx = dMdx 0.512 Limiting value of dM/dx near M = 1.
Figure 7. MathCad Worksheet for Example 3
Define and the differential equation:
( ) M 1
.
1
2
M
2
F( ) , x M if dMdx M 1 0.05
otherwise
.
.
M ( ) M
1 M
2
dAdx( ) x
A( ) x
.
.
M
2
2
.
4 f
D( ) x
.
1
.
M
2
2
dTdx( ) x
T( ) x
.
1
.
M
2
dmdotdx( ) x
mdot( ) x
Solve the differential equation from x
sp
to 0 to find the inlet Mach number.
Set the initial condition: M
0
1.0
Solve the differential equation with the fixed-step Runge-Kutta:
Z rkfixed , , , , M x
sp
0 15 F
Extract x and M from the return matrix Z:
x
< >
Z
0
Mach
< >
Z
1
i .. 0 last( ) x = Mach
last ( ) x
0.164

Inlet Mach number
Solve the differential equation from x=0 to x= x
max
.
M
0
Mach
last ( ) x
Set the inlet Mach number to start the forward integration.
Z rkfixed( ) , , , , M 0 10 40 F
Extract x and M from the return matrix Z:
x
< >
Z
0
Mach
< >
Z
1
i .. 0 last( ) x = Mach
last ( ) x
2.681 Exit Mach number
0 2.5 5 7.5 10
0
0.5
1
1.5
2
2.5
3
Mach
i
x
i
Figure 7. Concluded

You might also like