Simulation of Fluid Flow
Simulation of Fluid Flow
by
A THESIS
IN
MECHANICAL ENGINEERING
MASTER OF SCIENCE
IN
MECHANICAL ENGINEERING
Approved
May, 2004
ACKNOWLEDGMENTS
11
TABLE OF CONTENTS
ACKNOWLEDGMENTS ii
ABSTRACT v
LIST OF TABLES vi
LIST OF HGURES vii
NOMENCLATURE viii
CHAPTER
1. INTRODUCTION 1
2. LITERATURE SURVEY 5
3. GOVERNING EQUATIONS 9
3.1 One-Dimensional Inviscid Flow 10
3.2 The Continuity Equation 10
3.3 Momentum Equation 11
3.4 Energy Equation 13
3.5 Conservative Form of the Governing Equations 15
3.6 Numerical Methods 17
3.6.1 Method of Characteristics 17
3.6.2 Courant, Isaacson, and Rees Method (CIR) 17
3.6.3 Lax-Wendroff Schemes 18
4. METHOD OF CHARACTERISTICS 19
4.1 Conservation Equations 19
4.2 The Characteristic Equations 21
4.3 Non-Dimensional Characteristics Equations
and Riemann Variables 27
4.4 Numerical Solution of Non-Steady Flow Problems 29
4.5 Formulation of Characteristic
Equations for Numerical Solution 30
4.6 Generalized Characteristics 30
111
4.7 Representation of Generalized
Riemann Variables at Boundaries 33
4.8 Simple Boundary Conditions 34
4.8.1 Closed End 34
4.8.2 Open End 35
4.8.3 Inflow into a System 35
4.9 Numerical Solution of the
Characteristics Equations 36
4.10 Zone of Dependence and Grid Structure 37
4.11 Stability Criterion 37
4.12 Evaluation of Riemann Variables 38
4.13 Computation Procedure 40
4.14 Partially Open-End Boundary Equations 40
4.15 Flows through a Valve 45
4.16 Cylinder Boundary Conditions 55
5. RESULTS 61
6. CONCLUSIONS AND FUTURE WORK 83
6.1 Conclusions 83
6.2 Future Work Required 83
REFERENCES 85
APPENDIX 88
IV
ABSTRACT
Engine design is a long and costly process due to the large number of variables
that have an effect on the design. Engine Simulation plays a very important role in the
development of engines. It helps in analyzing the various engine configurations without
actually building the engine. Thus, Engine Simulation helps in reducing the cost and time
involved in developing a new engine. Many commercial codes are available in the market
to simulate engines. In recent years. Wave Action Models to simulate engines are
becoming popular due to their accuracy and robustness and are replacing the old Quasi-
Steady and Filling and Emptying Models. There are two parts in engine simulation, fluid
flow Simulation and Combustion and Heat Transfer Simulation.
In this thesis an attempt has been made to simulate the fluid flow in Internal
Combustion Engines and Engine manifolds using Wave Action Simulation. The Non-
Linear, Hyperbolic, Partial Differential Equations are solved using the Method of
Characteristics (MOC) which is the oldest and the most powerful method to formulate the
boundary conditions. A FORTRAN code is developed for obtaining the pressure and
velocity of the gas for various boundary conditions. Using the code the pressure and
velocity at any point in the manifolds can be obtained. The compression pressure of the
cylinder can also be estimated using the code. Pressure and Velocity distributions are
obtained from the results obtained from the code clearly show the Wave Action
Phenomenon.
The results obtained using the Code developed are in excellent agreement with
results obtained by other researchers.
LIST OF TABLES
VI
LIST OF HGURES
vii
NOMENCLATURE
a Speed of sound
a^ Speed of sound at reference pressure
a^ Stagnation speed of sound
A Non-Dimensional Speed of sound (aIa^^j.)
AQ Non-Dimensional speed of sound
\ Partially Open End Parameter A^ IA^^
C Velocity of Gas
C Specific heat at constant pressure
C„ Specific heat at constant volume
D Diameter
/ Friction factor
F Cross Section Area of pipe
m Mass flow rate
M Mach Number
p Pressure
Pg Stagnation Pressure
n , Reference Pressure
r ref
q Heat Transfer rate per unit mass
Q Heat transfer rate per unit time
r Cylinder pressure/Reference Pressure
r Pressure Ratio
m
T Temperature
TQ Stagnation Temperature
u Gas Velocity
U Non-Dimensional Velocity i//a^^^
[/„ Non-Dimensional velocity M/flip
X Non-Dimensional distance .v/L^^^
Z Non- Dimensional Time
K Ratio of Specific Heats
;^/iij Generalized Characteristics
;i^ fi Riemann variable of characteristic
^ Non-Dimensional Mass flow parameter
Vlll
/f-i
IX
CHAPTER 1
INTRODUCTION
The first intemal combustion engine was developed by Otto way back in 1876.
After so many years of development it might be thought that the IC engine would have
been perfected. The contrary is the case as every decade seems to produce new
challenges. Even today a lot of money is spent on engine research to make the design
better, more reliable and more fuel efficient.
The design of engines remains a major challenge even today because the gas flow
in engine cylinders is unsteady. The scavenging process and the unsteady combustion
process add to the complexity of engine design. The shear number of variables which
have an influence on the intemal combustion engine make the development process a
long and costly procedure. Considerable capital is expended on the design, prototype
models and testing before the manufacturer can release an engine to the general public.
It probably requires little effort to convince the engine builder of the benefits of
engine simulation. A technique which would help engineers and researchers analyze
various engine designs without the expense and time of producing one off prototypes
would be an invaluable asset. This "asset" is the computer simulation and its use in
industry has become a mainstay over the past 30 years.
The essential elements involved in the prediction engine performance can be
classified as:
1. Air (Fluid) Flow Modeling,
2. Combustion and Heat Transfer in Engine Cylinders.
Air flow Modeling: It has long been realized that the performance of any
reciprocating engine is a function of the air and fuel flow through it. A naturally aspirated
diesel engine cannot produce a brake mean effective pressure of much in excess of 7 bar
simply because there is insufficient air to bum any more fuel. However, this power output
can be increased by supercharging, which effectively increases the air flow through the
engine and the fuel input can be increased roughly in proportion. Thus air flow plays an
important role in the power output of the engine.
I
engine and the fuel input can be increased roughly in proportion. Thus air flow plays an
important role in the power output of the engine.
The objective of this thesis is to discuss the various methods to simulate the air
(fluid) flow, advantages and disadvantages of each of the methods and to develop a
simulation model which will accurately predict the pressure and velocity of the gas in the
engine cylinder and in the inlet and exhaust manifolds. A FORTRAN code is developed
for the simulation of homentropic flow through constant area ducts using the equations
developed by Benson [1]. The various boundary conditions that have been considered for
the flow are given below:
1. Pipe with Open End,
2. Pipe with Closed End,
3. Pipe with Inflow,
4. Pipe with partially Open End,
5. Cylinder Boundary Condition,
6. Flow through Valves.
There has been and will always be a continuous effort by engine researchers to
develop computer models which are more efficient and accurate in representing the actual
physical processes occurring inside the intemal combustion engine. The knowledge of the
thermodynamic and fluid mechanics processes has increased and this leads to the
development of better simulation models which are sufficiently accurate to help with
design optimization. The models vary in their complexity and their ability to incorporate
critical phenomenon.
In general there are three types of engine simulation models that incorporate
varying levels of accuracy and completeness. The three types are:
1. Quasi-Steady Flow models,
2. Filling and Emptying models,
3. Wave Action models.
The level of complexity increases from the Quasi-Steady models to the Wave
Action models. Each model has its own advantages and disadvantages. The simulation
method that is adopted in this thesis is the Wave Action simulation which is the most
recent and the best method to simulate the flow as it takes into consideration the wave
motion inside the cylinder and the manifolds. The filling and emptying models and
Quasi-Steady models are primitive models and they do not consider the wave action in
the IC engine
Quasi-Steady models are relatively simple models that consider the engine and
turbocharger as a series of interconnected components. The performance of each of these
components is represented by its steady state characteristics, often obtained
experimentally. These components are connected by the air flow passing through them
and by the pressure ratios across them. This method is easily recognized by the fact that it
cannot predict power levels at various engine speeds. It can only predict the maximum
power potential. It also completely ignores the important wave tuning effect created by
intake and exhaust ducting dimension and cannot calculate the inertia ram effects of the
gas particles which occur before the intake valve closes. Quasi-Steady models provide
quick, cheap simulations but care has to be taken when extrapolating the data beyond the
valid range.
Filling and Emptying models are next in sophistication. These models use the
finite volume of the manifold sections and then calculate the mass flow rates across these
sections. The result is a set of first order non-linear ordinary differential equations. The
conditions in the cylinder and the manifolds are obtained by solving the differential
equations. These models are more realistic then the Quasi-Steady ones and require less
empirical data. However the computer time needed for their solution is greater than
Quasi-Steady. Filling and Emptying models are capable of predicting power levels across
differing engine speeds. However, like the Quasi-Steady models they also ignore the
wave tuning phenomenon and cannot calculate the inertia ram effect of the gas particles
which occur before the intake valve closes.
The significant influence of "tuning effects" created by intake and exhaust
ducting dimensions has been know to engine builders for many years. The Wave Action
Models were developed to take these effects into account. Wave action simulators are the
most sophisticated of the simulation models available for analysis of the gas exchange
processi They are extensively used in the industry for engine research and development
and should likewise be of extreme value to the high performance engine builder. Many of
the simulation programs available in the market use the "Wave Action Simulation
Method." This thesis will also be based on Wave Action Simulation to model the
pressure and velocity variations inside the engine cylinder and manifolds.
Waves occur in the manifolds of engines because of the periodic nature of the
induction and exhaust process. These processes act upon the compressible fluid in the
manifold, viz the air or exhaust gas, and pressure waves are transmitted through it. The
pressure waves travel at the local velocity of sound in all directions relative to the fluid.
The gas flow which operates inside the intemal combustion engine is very unsteady
because of the gases constant change of pressure, temperature and velocity throughout
the engine cycle. For example, when an intake valve is closed the gas velocity is zero.
When the valve opens the pressure differential begins to accelerate the gas particles into
the cylinder. This motion never occurs in a steady flow manner hence the discipline of
Unsteady Gas Dynamics is used to model the motion of gas particles inside the IC
engine.
CHAPTER 2
LITERATURE SURVEY
In this chapter the equations used to evaluate the unsteady flow of gas in engine
manifold are derived. The equations that are obtained are partial differential equations
which can be solved by using a variety of methods which will be outHned in this chapter.
The advantages and disadvantages of these methods are also discussed.
The flow paths in internal-combustion engines can be extremely complex. These
paths are often simplified by considering the flow to be one-dimensional. In general, the
gas is highly turbulent and fluid frictional forces are present within the fluids and at the
walls. In this analysis the fluid is assumed to be inviscid (that the gas is sufficiently
dilute for intemal stresses to be ignored) and wall friction is also neglected. The gas is
assumed to be perfect. The gas flows in intemal combustion engines are non-steady and
changes in the fluid properties take place in space, x and time, t. However, under some
conditions the spatial rates of change of fluid properties are far greater than the temporal
one. These conditions are called quasi-steady flow conditions and steady flow gas
dynamic relations are used.
The entropy levels in the various parts of the flow may have significant effects. If
the entropy level is uniform everywhere and does not vary with space or time the flow is
called homentropic flow. If the entropy levels are not uniform, the flow is non-
homentropic. It is sometimes possible to subdivide parts of the flow in non-homentropic
flow, enabling homentropic relations to be used for each region. Suitable arrangements
must be made to patch together the regions at the interfaces. In this simulation, the flow is
homentropic and code is developed based on the homentropic flow equations. It is not
realistic to assume homentropic flow in the exhaust systems of intemal combustion
engines and non-homentropic models must be employed.
3.1 One-Dimensional Inviscid Flow
The fundamental equations of fluid mechanics are mathematical statements that
define the conservation of mass, momentum, and energy for a control volume. A
conservation law states that the rate of change of conserved flow property in a fixed
volume is the result of the net effect of the flux of the property across the boundary of the
volume and the change in that property due to intemal sources.
Consider the flow of a compressible fluid through an infinitesimal section of the
pipe in which the area of the cross-section perpendicular to the axis of the pipe varies, as
shown in the Figure 3.1. The area variation is gradual and the fluid properties are
approximately uniform across any cross-section and are taken as functions of 'x' and '/'
only. All these assumptions make the flow quasi-one-dimensional.
P dp.
dx
P
u U+ 5 AC
F dx
10
The rate of mass flow entering the control surface is
—r-ipFdx). (3.3)
11
Shear Forces
2
T^nDdx---f^^nDdx. (3.8)
Where D is the equivalent diameter and the wall shear stress r„, is related to the friction
factor by the expression
/=-p^. (3.9)
-^P^r
— (pFudx). (3.10)
dt
The net efflux of momentum from the control surface is
The term u/|u| or u\u\ is introduces to ensure that the wall friction always acts in opposite
CT + ^ + ^ . (3.16)
2 p
The specific internal energy is given by the expression
2
C7 +y . (3.17)
^ ^ l + u^, (3.23)
Dt dt dx
13
The energy equation becomes
^ ( C J +^ ) =, - i ^ ^ - ^ ^ . (3.24)
Dt ' 2 pdx pF dx
D jr ^ 1 du' u du'
T;:M=T^r- +T^^, (3.25)
Dt 2 2 dt 2 a;c '
du -, du
= u^-
— ++ ir
u-—-.
— (3.26)
dt dx
From the momentum equation (3.14)
// dp du T du ^
- ^ = M^- + »-^—+ (<G. (3.27)
p dx dt dx
Using equation (3.26) the above equation becomes
u dp D M' ^ ^
— - ^ = — ( — ) + MG. (3.28
pdx Dt 2
-—(C^T) = q + uG - ^ - — . (3.30)
Dt pF dx
|^(C.n = | ^ ( - i - ^ ) . (3.31)
Dt Dt K-1 p
- 1 .(1J^_4J^). (3.32)
K-1 p Dt p' Dt
_Li,(|l+„|l)-P(|l+„|l)). (3.33)
K-1 p dt dx p dt dx
From the continuity equation (3.6)
14
d(Fu) F ^dp dp,
ax p dt dx
Further ,
p a~
- =— , (3.35)
P K
15
dp ^ d(pu) ^ pudF _^
(3.41)
dt dx F dx
d(pu) , d(pu- + p) , pu- dF ,
r I 1 h pu = U . (3.42)
dt dx F dx
d(pe^ d(puh^ pu\ dF
•+- --I-- -pq = 0. (3.43)
dt dx F dx
Where G = / — — —
2 IMI D
Equations (3.5.5) (3.5.6) and (3.5.7) can be written in symbolic form as
dW dF(W)
(3.44)
dt' ox
where
p ' pu pu ' 0
W = pu ,F(W) = pu^ + p ,C(W) = pu^ d(\nF) ^ pG (3.45)
pu\ puh^ dx
P^o pq
When there is no pipe area variation, wall friction, or heat transfer the equation
reduce to
dW dF(W)
•+- = 0. (3.46)
dt dx
The presentation of equations in the above form is called the conservation law form [27]
since it is obtained from the integral conservation equations of mass, momentum, and
energy applied to the fixed control volume.
In general, it is not possible to obtain the analytical solutions for the hyperbolic
partial differential equations derived above and thus numerical techniques have to be
developed. Basically it is necessary to discretize the governing equations to form a set of
algebraic relationships which can then be solved on a computer. The goveming equations
define the propagation of information through the fluid in the manifolds as pressure
waves, which has a major effect on the engine performance and noise levels. It is
essential, therefore, to employ numerical methods that have the ability to resolve the
wave-action phenomenon if successful simulations of engines are to be performed.
16
3.6 Numerical Methods
3.6.1 Method of Characteristics
The theory of characteristics is a tool for handling general systems of partial
differential equations. The method was initially developed by Riemann [3]. This method
became the foundation for future studies in propagation of non-linear waves. This method
was used by Jenny [4] as a graphical technique to calculate flows in engine manifolds.
Benson [1] was the first person to use the technique as a numerical method in a computer
program for the simulation of flows in engine manifolds. He called it the Mesh Method of
Characteristics. This method was the dominant technique till the 1990's and even today is
used in many commercial engine simulation codes. The advantage of this method is that
it gives excellent insight into the propagation of waves in fluids. Even today it is the most
powerful approach to formulating boundary conditions in many modem engine
simulation codes. In recent days, this method has been replaced by the modern finite
difference schemes due to their accuracy and robustness. In this thesis, the mesh method
of characteristics will be developed for homentropic flow as this simplified approach
allows the clearest exposition of the significant features of this theory. The homentropic
approach itself can form an acceptable approximation of the flow in intake manifold,
where the energy and entropy levels of the gas do not vary greatly. However, the full
non-homentropic equations must be used for reliable predictions in exhaust systems.
17
speed. LeVeque [29] showed that any numerical scheme which is not based on the
conservation law form of the governing equations will not converge to a physically
consistent solution when discontinuities are present. CIR method and MOC also present
considerable problems when the variations in the gas properties are to be modeled
consistently.
18
CHAPTER 4
METHOD OF CHARACTERISTICS
In this chapter, the Method of Characteristics is described and the equations used
in homentropic constant area ducts are derived. The boundary conditions that are
considered are given below:
1. Pipe with Open End,
2. Pipe with Closed End,
3. Pipe with Inflow,
4. Pipe with Partially open End,
5. Cylinder Boundary Condition,
6. Flow through Valves.
±=n£l (4.2)
dx Dt
£l = ^ + u^, (4.3)
Dt dt dx
19
Expansion of Equation (4.1) yields
1 dp u dp du ^
—^ + - + — = 0, (4.4)
p dt p dx dx
Expansion of equation (4.2) gives
1 dp du du ^
—T7- + — + u — = 0. (4.5)
p dx dt dx
The speed of sound is related to the pressure, p and density, p and entropy, s by the
relation given below
2 .3p
a - (-^) (4.6)
dp'
For an ideal gas
2 Kp
(4.7)
a =
a gas at some reference pressure P^^^^to which the gas is insentropically expanded or
( \K-\
(4.9)
or
'ref v^^;
where K is the ratio of specific heats for a perfect gas
For isentropic flow p,,f,p,,f and a^ are constant. Equations (4.1.8) and (4.1.9) are written
in differential form as
dp _ 2K da (4.10)
p K-1 a
dp _ 2 da (4.11)
p K-1 a
20
Equations (4.4), (4.5), (4.10) and (4.11) are the conservative equations for homentropic
flow. Expressing equations (4.10) and (4.11) in terms of partial derivates and time'r' and
space ' .V ' gives the following equations
1 dp 2K 1 da
p dx K-ladx (4.12)
Substitute for — — and —^ from (4.13) and (4.14) into (4.4) gives the continuity
Two conservative equation (4.15) and (4.16) in terms of the local speed of sound 'a ' and
the particle velocity ' ; / ' are obtained. The objective now is to evaluate ' a' and ' ;<' at
each point ' x ' is the system at time 'r'.
21
reduces the volume of algebraic manipulations generally involved with characteristic
theory is used to solve the equations.
The two separate equations of the solution, namely a = a(x,t) and u = u(x,t) are
transformed to another grouping c = c(x,t) andc = c(u,a). After transformation, a unique
relationship between ' c ' , '/<', ' a ' is sought such that the solution c = c(x,t) will give
numerical values for '//' and ' a ' at ' x ' and 'r'. If such a relationship can be
estabUshed, then it follows that the solution c = c(x,t) will represent a three-dimensional
surface. Special lines on this surface have the property that when projected onto the x -t
surface at c=0 the slope of the projected line has a numerical value equal to the value of c
at that point. Changes in the fluid properties (in this case 'a' and 'M') along the projected
line can then be examined. If a solution to a particular problem is obtained, a combination
of the substantive derivatives of the fluid properties along the projected line, together
with the slope of the line at a point, will be equivalent to the original equations. The set of
partial differential equations have been transformed to a set of ordinary differential
equations along the projected lines. These projected lines are called characteristics.
To obtain the characteristics solutions the original equations (4.15) and (4.16) are
K-1
transformed using linear combinations. Equation (4.15) is first multiplied by to
22
Direct solution of Equation (4.18) and (4.19) would lead to the form
a = a(x, t), (4.20)
" = u(x t). (4.21)
In order to obtain a characteristic solution it is assumed that 'a' and 'u' are uniquely
related by the expression
c = c(a, u). (4.22)
Then the solution to equations (4.18) and (4.19) will be of the form
c = c(x, t). (4.23)
This solution is represented by the curved surface bounded by the edge PQRS as shown
in Figure.4.1. In this solution the numerical value of c is represented by the height of the
surface above the x-t plane at c= 0. The surface projected on the x-t plane at c= 0 is
represented by the broken line bounded by the edges P'Q'R'S'
Consider a line AB on the surface bounded by PQRS and its projection on the x-t
plane at c=0, A'B'. The line A'B' is defined as a characteristic if at any point x, t the
slope of a line in the x-t plane at c = 0 is given by the numerical value c at that point. This
definition can be illustrated by reference to Figure 4.1 and Figure 4.2. Along the line AB
in the surface bounded by PQRS there is a point m. This point, when projected onto the x-
t plane at c=0 will he on the line A'B' at m'. The slope of A'B' at the point m' is given
hy(^y\) . If A'B' is a characteristic then this slope will be equal to the numerical
height mm'
23
.J>-*--' B' IY
I
Distance
langent lo /).'_,•
Time t
( ^ P ^ , = mm'. (4.24)
The fluid properties 'a' and 'M' along a characteristic are now examined. Since 'a' and
'M' are functions of 'x and 'r' throughout the flow field, there will exist some
functions a = |a(x,OL;^,, M = |M(X,OL;,„, along a characteristic.
24
Along a characteristic
/ , X ,da da , ,
(^«)....=(3^^^ + ;^^^),,,„ (4.26)
(^")..«.=(-^^? + - ^ ^ ) , , „ , . (4.27)
and
,du
,UM _duuu duuu dx
,ux,
(—dt W
'''""'= —
dt + —
dx (—)c.«.;
dt (4.29)
or
,^a, da da
( dt'"^'
- r X w =dt
^ + ^dx^ - (4.30)
and
,du, du du
{^\har=-^ + -:rC- (4.31)
rfr ""^ dt dx
The following three conditions then hold along a characteristic
(f)c.„.=c; (4.32)
,(ia, 3a da
{—)c,ar=—
• )char = +
+ — C- (4.33)
dt """^ dt dx
,du, du du
{—\^r=— + — c- (4.34)
dt "^"' dt dx
These equations represent the change in 'a' and 'M' with x and t along specially defined
curves called characteristics. The function c = c (a, u) now must be determined to satisfy,
along characteristics, the equations (4.32),(4.33) and (4.34) as well as the basic equations
(4.18) and (4.19) valid throughout the field.
If the function c is taken as c = M -i- a, then it follows from equations (4.25),(4.32)
,(4.33) and (4.34)
25
(—) = c = ;, + «. (4.35)
dt
and
( ^ ) + ^ ^ ^ = 0. (4.36)
dt 2 dt
or
(-) =- ^ ^ . (4.37)
du 2
Equation (4.25) is replaced by a set of two characteristic equations. The first equation
(4.35) is called the direction-condition equation and gives the slope of the characteristic
in the x-t plane. The second equation relates 'a' and 'M' along a characteristic and is
called the compatibility condition.
If the function is taken as c = a-u, then from equations (4.25),(4.32),(4.33) and
(4.34) the direction condition is
{^) = c^u-a. (4.38)
dt
and the compatibility equation is
^ /£-l^ (4.39)
dt 2 dt
or
,da_ 1^ (4.40)
du 2
Equation (4.25) has been replaced by the two characteristic equations (4.38) and (4.40).
The complete solution is represented by the characteristic equations
26
4.3 Non-Dimensional Characteristic Equations and Riemann Variables
A direct representation of pressure can be obtained for homentropic flow if the
velocities are divided by a reference speed of sound a ,,which is defined as the speed of
sound corresponding to the isentropic expansion or compression from the local pressure p
and the speed of sound a to a reference pressure p^^^. This non-dimensionalizing
procedure is also extended to the distance x and time t by the introduction of a reference
length L^^^
A = ^ - ( P \(«--l)/2>c- (4.48)
^ref Pref
dA, K-1
Consider the expression (—7) = r"'
du 2
On integrating the above expression the following relation is obtained
K-1 (4.49)
A = — -U + C.
27
At [/=01et A = A^C = A^A = A-i-^^U (4.50)
2
Thus, for the A characteristic
'dX]
= U + A. (4.51)
ydZ,
K-1
{^) = - (4.52)
dU 2
A= A+^^U (4.53)
The equation (—-) = -}-—— on following a similar approach and assuming that the
(4.54)
.dz)
dA K-1
= +- (4.55)
dU
J3 = A-^^U (4.56)
K-1
For the /i characteristic
(4.57)
dZ 2(K-iy 2(K-1)
For the y^ characteristic
(4.58)
dZ 2(K-1) 2(K-1) '^
These equations give the slopes of the A and /? characteristic.
28
Along a A characteristic, A is constant and hence the slope is a simple expression in the
form
( ^ ) A = "'-'Jy^. (4.59)
Similarly, along a /? characteristic yS is a constant and hence the slope is again a simple
expression of the form
,dX,
(-—)p = nA-m. (4.61)
dZ
, 3-K , K-\-l , ^
where 7? = ,m={ ]B (4.62)
2(K-1) 2(K-iy^
Here the only variable is A. These new equations give a reduction in the number of
variables from two to one. The equations (4.59) and (4.61) lead to the development of a
method for direct numerical computation of the characteristic equation.
29
^^^^^^^^^^^^^^^^Q^^^lChmctc^^ Numerical Solution
The Riemann variables from equations (4.53) and (4.56) are A = A-^^^U
2
K—1
md/3 = A—^U. The slopes of the characteristics are given by (—),=U +A
dZ ^
,,dX
'dZ ^ - f/ - A. The value of A is obtained by adding equations (4.53) and (4.56)
dX 3-K .. ^ K-\-l ,_
Assume,
2>-K _, , K+1
a= and b = (4 61)
2(K-1) 2(K-1) ^ ^
Equations (4.65) and (4.66) become
(-^)i=^^-«^- (4.68)
(—)p=aA-bl3. (4.69)
Equations (4.68) and (4.69) have a symmetry which leads to the possibility of replacing
the two equations by a single equation, with suitable adjustment of either the constants
( a'
_ > and 'b\ or the Riemann variables A andy^.
30
Positive X Positive X
System A System B
(Ap),=aA,-bP,=-^ (4.71)
dZ tan^o
tan^« = - t a n O , (4.73)
({^h)«=H-«)^«=-^ (4.74)
dZ tan O^
({^},),=ai,-Z,^,=-^ (4.75)
1 (4.77)
tan dp tan <I)^
Hence
(4.78)
aA, -bP, = - ( H -aPB) = ^PB -H •
31
The equation is satisfied if A^ = J3^ and P^ = A^
^ = K^P = PA (4.79)
This equation gives the slope of the y5 characteristic in system A, the conventional
system. This leads to the replacement of two equations (4.68) and (4.69) by a single
equation and a new definition for the /land P characteristics. If a /icharacteristic is
defined as one with nominal slope in the same direction as the positive X-direction and a
P characteristic is one whose nominal slope is in the opposite direction, then
{^],=bA-aP. (4.87)
dZ
32
The generalized characteristics A^andA,, as shown in Figure 4.4 are now introduced.
A /I, characteristic is a characteristic whose nominal slope is from left to right in a duct. A
/^i characteristic is one whose nominal slope is from right to left in a duct.
u =A- - ^ , (4.88)
K -1
A -
A,, - ^
->
(4.89)
33
Left hand end: .V Riglit liand end:
odd end (a) even end
^4 (
-^oul
Positive U Positive U
towards boundary towards boundary
U_ K~Kui
(4.90)
K-1
\ A.„+/l„
m out
9
(4.91)
Kut - K • (4.92)
34
The above relations are used in the subroutine call for Closed End.
Let A = a where p^. is the Pressure at the open end. Since at the
ref
V P-f J
open end the pressure is atmospheric pressure A = 1
^A=A^li^=i (4.93)
2
^„.=2-4. (4.94)
(aoPQ)to a, p as shown in Figure 4.6. Application of the steady flow energy equation
/f;
I Pipe end
Entropy s
a,0 _ a •-t--
w (4.95)
K-1 K-1 2
T 2 ^ 1 0
=> ar," -a + u~.
(4.96)
In non-dimensional form.
35
A 2 A'' tC — 1 ^ ,n
\ =A--^ U\ (4.97)
^3-K^ K-1
Where a = and b= 4 (4.101)
K+1 K+ 1
36
4.10 Zone of Dependence and Grid Structure
In Figure 4.7, the region 2, 3, 4 is called the Zone of dependence of the point 4.
The line 3, 2 is called the domain of dependence of point 4. These properties of
characteristics will be used in selecting the grid stmcture as shown in Figure 4.8 in the Z-
X field. The grid or mesh points are numbered in the sequence shown. The first number
represents the time step Z, the second number the X-step. The grid proportions are fixed
by the stability criterion.
N. D. distance A"
points r+1, s from the conditions at r, s-1, and r, s+1 the mesh proportions must be
37
AZ 1
(4.102)
AX A + \U\
The mesh proportion will therefore vary throughout the flow field (Z-X diagram). The
standard procedure is to fix the length AX and let AZ vary in each time step so that all the
points at that time step lie in the zone of dependence of the previous time step. This
implies that the values of A and U should be evaluated at each mesh point and
AZ selected from the minimum value of
^
1. 'A
AX. (4.103)
A + \U\
V
In practice the pipe length, L, is subdivided into equal grid portions. If m is the number of
meshes in a pipe, then the actual length AL of a mesh will be
(4.104)
m
4.12 Evaluation of Riemann Variables
A relation is to be developed between the values of X and P at time Z, and the
new value of X at time Z+AZ, at any mesh point (R). This will then be extended to cover
the whole grid system. Consider the grid PQRS shown in Figure 4.9
38
The slope of PT is then given by
,rfX,
^~J^h=bA-aP = bA^-aP^, (4.105)
5Z,= ^ (4.107)
^ r ^dX^
vA
dZ J^
AX
^^T=-r] ^- (4.108)
Substituting the value of SZ^ from equation (4.108) the following expression is obtained
By using all the relations developed above, a code in FORTRAN is developed tofindthe
Pressure and Velocity at any point in a Simple Pipe with Constant area of cross section
and entropy.
Given below, are the salient steps involved in the development of the code. The
boundary conditions discussed in this program are the (1) closed end, (2) open end, and
(3) Inflow into a pipe from a reservoir. The first step is to collect all the input data
required for the program. The input data required are the length of the pipe, the initial
pressure, initial temperature, Reference Pressure, Boundary conditions at Z =0 along the
pipe length, the boundary condition at X = 0 and X = L for all time Z, Number of Mesh
Points required (the more the mesh points the more accurate the calculation and more
time the program takes to run!), and the value of gamma (ratio of specific heats). Based
on this data the grid system is chosen by ensuring that AZ satisfies the stability criteria. It
is important to ensure that AZ satisfies the criterion for all mesh points.
39
Next the nodes where the output is required and the simulation time in seconds
are determined. After entering the required input, the calculations are carried out
according to the relations developed above and the output at the required points is given.
The data is collected and exported to an Excel file from where the pressure and velocity
distribution graphs are obtained. The various boundary conditions are included in the
program as separate sub-routines.
5. Starting from r =2, s=l, evaluate values of /I,, at all mesh points s =1 lo s = m.
6. Enter the boundary equations for (A^),Jxom the known value oi(\^)^^.
8. Repeat Steps (2) to (7) for next value of r until time Z, is equal to required time
for calculations.
9. Export the output file to Excel.
10. Plot the Pressure, Velocity profiles as a function of simulation time.
40
constant static pressure. For subsonic flow, this will be equal to the throat pressure/^,
The processes are shown in Figure 4.10
Speed of
sound a
y'"
y / y P
"o
a y^---,
a,
"rer
Entropy j
Energy Equation
Continuity Equation
puF^p,u,F,. (4.112)
A,'=A'+^U'-=A'-*^Ur (4.114)
a -1 JL^
— \K-\ (4.115)
'ref
41
In the above equations, the following convention is used
FT"
0 = ^,A=—andf/=-^
'•ref 4, r
ref
(A:--A\)
2_ K-1
U'^ (4.117)
-1
o-
For subsonic flow
P, 1.0.
P.^Pref ' A=^- = (4.118)
aref
(A^-1)
(/• _ K-1
(4.119)
/ / i \ 'K--1
-1
O^ v i y
( ^ \ ( . \ '/.-I ( . \ '%^-i
a (4.121)
KP'J vA.
{- (4.122)
42
K+1
-I- (4.125)
K-1 K-1
K+1 r .\ - ^ A \ —,
<D^- = (4.126)
K-1 K-1
vA; \ A^ J
Equations (4.119) and (4.126) relate the critical ratio to the area ratio O for sub-
sonic and sonic flow. To make the equations compatible for the computer calculation the
following algebraic manipulations are made
Cross multiplication of Equation (4.119) gives the following
but,
A=A+^^U. (4.128)
2 (4.129)
(A„-A)^
K-1
' 2 ^ f 2 ^
(A -A)HA^''-''-^')= - ^ (A'-l)^\ (4.130)
K-1 ^K-1^
K-1
(4.131)
./(A) = (4-A)^(A/^'^-'^-0^)-V-(^'-l)^'-
Equation (4.131) cannot be solved analytically and numerical methods must be
employed. Let suffix 'n' be the first estimate and n+1 the next estimate. Then the first
2 1 /I — 1
estimate is taken as (A)„ = -^ and the step is (AA)„ = - ^ ^ •
43
If/(A)>0,(A)„,,=(A)„+(AA)„ (4.133)
_(AA)„
Set(AA)„„ = - ^ ^ , Equation (4.132) is now recalculated with (A)„ = (A)„,, and with
(AA)„ = (AA)„,, and tested as before. The iterative procedure is repeated until the required
accuracy is reached. When A is known then A„„, will be found out by using the relation
^««,=2A-/l,„. (4.134)
The same procedure is used for sonic flow to find out the value of A. The test for sonic
flow is the Mach number in the throat.
(4.135)
If the velocity (f/,) in the throat is greater than 1.0, then the flow is sonic.
For sonic flow
'•V
—=o • U = ^CA where C = (4.136)
A \ ^ Jcr
The goveming equation for the sonic flow is given by the expression
fA} = 02_
K+1 f A \
'A' K-l
.f Q. (4.137)
K-1 K-1
K^J A
V, ^ Jcr
For the solution of this equation again numerical methods are used and the first estimate
1+. 1
'K + 1 ^K + 1
is taken as (\ )„ = and(AA„)„=- The iterative procedure is
The relation between A and U in Riemann Variables is given by the following expression
U_ (4.138)
A K+Kut J K-1
This on cross multipHcation and rearranging gives the following expression
44
^^ K-1U\
A„„, = 2 A A„ (4.139)
1 +K-IU
2 ~A
K+U
Substituting U/A= <t>C = ^(\) ^"-^ gives
' l - ^ * C ^
Kut = A„. (4.140)
l+ ^ ^ O C
v
K-1 K+V
1-~^^(A,/A\^ /.-I
(4.141)
i+^4)(A/A),.;'>'-i
K-1 f+1/
l-^-0(A/A)„ /-'
A,. ={ K —1 «•+!/
)A„ (4.142)
1+-^0(A/A)„ /-•
Using all the relation derived above a subroutine is developed in FORTRAN for the flow
through a partially open end.
The main program is same as the one for simple boundary conditions. The only change is
that one more input condition which is the area ratio (O) is also added.
The program is included in appendix. The pressure variations as a function of the
simulation time is obtained and are plotted in Microsoft excel.
45
considered to expand adiabatically, but irreversibily at constant pressure, to fill the pipe
cross-sectional area, when the flow is subsonic in the throat, but with a drop in pressure
when it is choked in the throat. The processes are represented in Figure.4.11
^ . . . . ^
N\\s\\s\sN
^H
0
^"^
1 ^^-^y^P,ti
y^
y^A,
^ ^1
Entropy s Entropy 5
Subsonic flow Sonic (clioked) flow
The conditions upstream of the valve (0) are related to the conditions at the throat
(1) and the pipe (2), where the flow runs full. The basic equations are given by
Energy Equation:
K I T T K V 1
«o = « i " + ^ - " i ' = « 2 " + - 2 (4.143)
Continuity Equation:
yOjMlFi = P2M2F2 . (4.144)
/ _ ^-^ /" -o V2
a,0 _ £0 (4.145)
a, KP^J
46
2 P
a =K—
(4.146)
F,
W = ^ ,7t =^ P 2 ^ - ,f/ = u. (4.147)
F, PoJ
A relationship between ;rand U for various values of \i/\s required.
For subsonic flow the pressure Pi= p,- Applying this to the continuity equation derived
above following relationship is obtained.
1 p2
M, = -U., . (4.148)
W P
From the relationship for the speed of sound,
/ A
(4.149)
A P^ v«^-y
But Pi = P2' applying all this to the continuity equation the following relation is obtained
r ^\
M, = — (4.150)
¥ V 'J
The energy equation is rearranged to give
K-1 T
« l ' = «0 (4.151)
Substituting the value of u^ derived above in the energy equation leads to the following
expression
K-1 1 ( \
«o^- u^ (4.152)
2 w
V ^y
Rearranging the above equation the following expression is obtained
-1I/2
( \
-1 (4.153)
¥ f \
2 "
K-1
\ ' J
V °y
47
From the energy equation on rearrangement
a2 K-1
= 1- (4.154)
/ „ ^
a.
Substitute for and t / = ^ - in equation (4.153) the following expression is
V °y v ^ y
obtained
1/2
2 1
V-1 v (4.156)
n K-1 \n'
V 2
When the flow is just choked at the valve throat, u^=a^. The energy equation between
(0) and (1) is now
2 K+ 1 .
(4.157)
/ 1 \"2
a„ (4.158)
V 2 ,
obtained
48
U
¥•• (4.161)
K+1
l-'^U'
When the pressure downstream of the valve is below the critical pressure, p, will
( \
": ^¥ ^2
«i (4.162)
a, \P-]
V ' y
Rearranging the above equation leads to the following expression
f \ f ^ \ f .. \ f \
U-, a. Po_ (4.163)
<3n Ch) Poj yP2j
a. K-1 Uj
1- (4.164)
(3„
K+1
*0 _ (4.165)
V 2 ,
V.-
(4.166)
y_P0j
K+1
f \ / A f \
a^
Substitute the values of andf/ = ^ - , the above equation becomes
V °y Ch] yP.j On
K-1 ^ ^ ^
f r, \
1-
z' „ ^ % 2(/r-l)l
(4.167)
vPoy
^w ^K + lj u^
( \ /l":
Also 7t - El (4.168)
v^°y
49
/ O \ /[2(/f-l)]
l_^^(/3
•n = { V (4.169)
K+1 f/
, K+1
«o =• u^. (4.170)
2 '
( 9 V
^ t / = ^ = (4.171)
K+1
V
In the derivation of the equations for flow through a valve one fundamental
assumption that the entropy is constant through out the flow is made, but in reality there
is an increase in entropy as gas flows from the cylinder to the pipe. The magnitude of the
entropy change depends on the area ratio of the valve to the pipe^//, and the overall
pressure ratio expressed as n. Hence even if it assumed that the entropy variation is small
enough to be neglected, it is still necessary to select a level at which to maintain the
entropy throughout the calculation.
Benson [1] derived the expression for taking care of the entropy variation and is
given by the following expression.
K-1 \
7r„ = •
"•AC
{^8).+^^- (4.172)
Where m is any arbitrary point where the entropy level is desired, a^^, a^p are two
Fref
Tto^P (4.173)
Pc
The next step is to modify the above equations so that they can be adopted for solving in
a digital computer. If outflow from a cylinder to a pipe is considered, then A,„,>;i,„,
which means that U is negative.
50
Let A = P
,Ug-ulaf. , 71 =
' _PY ,LJ =u/ a
ref
"ref
V P-^ J
K-1 f \
7r = • (f/fi) + ^„ (4.174)
v"-y
also, A«=A + ^ f /
Let C = —^represent the entropy change across the valve, then equation (4.174) on
1/2
(4.176)
-u.
71 K-1 W i-'^u.
V
2£_ (7t-7l„)
K-1
71 K-1
' \7t^
4-il ^ K-1\2C ,
0. (4.177)
Let5 = C ( ; r - ; ^ „ ) , then
( 2
1/2 (B)
' -L-. K-1 = 0. (4.178)
/i(^) = -
7t /C-lU 1 ^(Bf
K-1
Equation (4.169) becomes
51
2K
,/f+l/
/[2(A--1|| l-^(/'
7t = { ¥ (4.179)
,/c- + l ,
-u.
Substitute the value of (-Ug) the following expression is obtained
1 ' ^ - l / 2C ,
7T = •(
f 9 ^ /|2(/r-l)| l--^^(^-^J
V^ (4.180)
v'^ + ly 2C
(7z--^„)
K--1
(^ O ^'^/|2(ft:-
Let F = ^ and 5 is assumed above
,/f + l ,
Then the above equation simpHfies to
1 ?-5^
• t,n-\ _.2/f//f-l
/ K-1 = 0. (4.181)
2(71) =7t
B
K-1
The expression for the entropy change is derived by Benson [1] and is given by the
following expression
{^-^Uif-
C= (4.182)
71
(1-^B'r-
K-1 (4.183)
71
Neither equation (4.178) nor equation (4.181) can be solved analytically and numerical
methods must be employed as was employed for the flow through a partially open end.
For each value of (^there is a critical value ol7t = 7i^^. If 7i:^>7r^^then the flow is
52
The equation giving the relationship between Tt^^andy/is given by Benson [1]
[30] .The relation is given below and is used to determine weather the flow is subsonic or
sonic.
The above expression is used to determine whether the flow is subsonic or sonic and then
solve equation (4.178) or equation (4.181).
If the flow is subsonic, the initial value will be
1+5 . „. . . . . r 2 T
7r = - where S is given by the expression and the
v'^ + ly
1-S
increment will be taken as A;r =
S +7t
If the flow is sonic, then the initial value is given by ;r = ^and the increment is
2
5 -7t 1
ts.7Z = -. The first estimate for C is taken a s — .
4 71^
Now,
X ^(K-\)/2K: \(K-\)/2K , x(K--l)/2/f
P Pref ' Pref ^
TT = A (4.182)
P^) Pref Pc yP^ J
Pc (4.183)
A = 7l = 4+^../2.
yP-fj
^ ^(.K-\)I2K
Pc (4.184)
A =27t -A.-
^Pref,
Hence the value of /l„„, is determined from the known values of p^, 4 and calculated
value ol7i. For inflow, the boundary equations corresponding to the partially open end
are used. The equations (4.131) and (4.142) are used but with A.„ multiplied by the
53
( Y/r-l)/2/f
t^ref
expression •To obtain A^^Jox inflow through the valve the following
Pc
transformation is used
/ \XK-\)I2K
A =(Aout ')PartiallyopenEnci P''f (4.185)
\ Pc
re J
dm,e . . , Pref ^ . U
ct, -'•'t''^''- '*'"'
A FORTRAN subroutine is developed using all the above equations. The input
din
parameters to the code are A^^andi//. The output is /l„,„and—'-. The results obtained
dt
from the code are given in the next chapter. The calculation procedure is given below
1. First the valve area ^^is tested.
2. If it is Zero, the valve is closed, if it greater than 1.0 then it is set
equal to unity, since the flow is controlled by pipe and not the valve.
3. The constants are then evaluated including;r^ , basing on the value of
4. If the flow direction is inflow then the partially open End Subroutine
is used. The input is changed accordingly as discussed above.
5. If the flow direction is outflow then the valve equations are used.
6. Next the flow is checked for Subsonic or Sonic flow.
54
The relevant equations are used basing on the flow.
dm,
8. Finally A and are obtained from the code.
dt
4.16 Cylinder Boundary Conditions
In the cylinder boundary condition the logic control for the valve or port timings
must be included. The calculation of flow rates through the valve or ports will be
discussed below and then the evaluation of cylinder pressure will be considered. There
are a number of ways of evaluating the mass flow rate through valves and ports. Here
only the simplest form of calculation proposed by Benson [1]. In flow between a cylinder
and receiver the steady flow equations and isentropic pressure drop equations are
assumed to be valid. Let p^j be the pressure upstream and p.^ be the pressure downstream.
The mass flow rate is given by the expression
m = P2U2F-
2^2 2 '
(4.188)
\lK \\IK
A ^Po,
P2 (4.190)
P2 = .'oi
\ Poi Poi 01
The expression for ^^ is computed directly from the pressure ratio p^Jp^acro^s the
. = J ^ l . (4.192)
Equations (4.191) and (4.192) are used mamly for engine intake where the manifold
55
To calculate the cylinder pressure the following assumptions are made in the calculation
of cylinder pressure
1. The pressure in the cylinder at any instant is almost uniform
2. As the flow is homentropic it is also assumed that the temperature in the
cylinder is uniform and equal to the stagnation temperature upstream of
valve.
3. The heat losses are assumed to be negligible
By making the above assumptions the lengthwise wave action in the cylinder is
effectively neglected. Since the cylinder volume will vary with time a control surface
must be defined round the cylinder. Figure 4.12 shows the engine cylinder with air
entering and gas leaving the cylinder.
Control surface
/
Cylinder
Air in Exhaust out
'nc'^'c'''c./'c.ec
'",,-''oa'''oa '"e.^o
Applying the generalized first law of thermodynamics to the variable volume open
system gives the following equations.
3(^)rv • +, ... rum„ut(\)„^,-m.^(\).
^ _ ^ /u \ (4.193)
Q-W^-W^ =
dt
There is no shaft power so W, =0; there is no heat transfer (2=0 and the work done to
change the control volume is W^ =pX- Hence the first law is reduced to
56
The terms in the above equation can be expressed with reference to the system shown in
Figure 4.12 as
(E)^=,ne,. = P^ (4.195)
K-1
d{El Pcdy,_^y dp ^
(4.196)
dt K-1 dt dt
Ka- (4.197)
A--1
r ^
dm
m„ = (4.198)
dt
V y
a^
K. = K = (4.199)
K-1
( dm\
m„ = (4.200)
ydt J
dm
( dm\ Ofl
dt
PcdV, PcdVc , ,. dp^ dt
+K + - (4.201)
dt K-1 dt dt K-1 K-1
On rearranging the expression in the required form is obtained
dp c_ dm ^ dm^ PcdK
Oa
•K (4.202)
dt ~ K dt
v^y dt
V y
This expression relates the rate of change of pressure to the flow rates, the stagnation
speed of sound, the cylinder pressure, the volume and the rate of change of volume.
'^ dm^
The mass flow rate is obtained directly from the valve calculation where the
dt
following expression was derived
U_ (4.203)
dt «„/ A'
57
f \
dm
The mass flow rate of may be obtained from the valve calculation if there is an
dt
V y
intake pipe. The equation is given below
f \
dm ( dm\
(4.204)
dt ^dt J valve
\ y
The cylinder mass balance equation is
f \
dm^ dm dm\
(4.205)
dt dt y~^)e
\ y
dm
If there is a receiver then the value of is calculated from the receiver equations
dt
\ J
derived above.
for r. >
AT-1-1
and
K+X
/ n \ 12(K--1)]
(4.206)
.f{0-^^K + lj
KiK-X
( 2 \
for r <
If the flow is outflow from the cylinder then the mass flow rate is given by the expression
58
dm„ _-p,F2
f{rj- (4.208)
dt a^
Where p^ is the air pressure, a„ is the stagnation speed of sound, p,. is the cylinder
dV. sin 2^
^ = Fr sin^-i-- 271N, (4.210)
dt 9 yj(n~ - s i n " ^
Valve subroutine. The cyUnder volume and the rate of change of cylinder volume is
determined from the equations derived above. Finally, the cylinder gas temperature and
the rate of change of cylinder pressure are determined.
59
To run the program the user must input the following required data
1. Initial Pipe pressure
2. Cylinder Pressure at E.V.O
3. Cylinder Temperature at E.V.O
4. Reference Pressure
5. Pipe Length
6. Pipe Diameter
7. Number of Mesh Points
8. Ratio of specific Heats
9. E.V.O from T.D.C
10. Two-Stroke or Four-Stroke
11. Engine Speed
12. Number of points where output is required
13. Location of the output points
14. Duration of time in crank angle the code is to be run
15. Cylinder Diameter
16. Stroke
17. Connecting Rod Length
18. Compression Ratio
19. Air Pressure and Temperature if Air Valve is Fitted
20. From the Valve Opening Diagram [1], the number of input points are to be
specified
21. Angle from the opening of the valve
22. The corresponding valve areas
23. The above data is repeated for the Exhaust Valve also
24. Nozzle Area Ratio in case we use the partially open end routine.
60
CHAPTERS
RESULTS
In this chapter, the results obtained by mnning the code developed using all the
equations derived in the previous chapter are discussed. The first code that is tested is the
code for a simple pipe with three boundary conditions which are the open end, closed end
and inflow. The input conditions are given in Table 5.1
Condition Value
Initial Pressure in the reservoir 1.5 bar
Initial temperature in the reservoir 300 K
Reference Pressure 1.0 bar
Length of the pipe 1.0 meter
Mesh size 10 nodes
Ratio of specific heats 1.4
Output Locations 1,5,11
Simulation time 0.05 seconds
Node 1 corresponds to the first point in the pipe, i.e., the pipe entry. Node 5
corresponds to the mid-point in the pipe. Node 11 corresponds to the open end of the pipe
.In this case it is assumed that one end of the pipe is open to a receiver and the other end
is the open end. The initial pressure in the reservoir is 1.5 bar. The result obtained on the
running the code is given below. Table 5.2 given below shows the simulation time in
seconds, and pressure at the three node points. As an example only the first 20 points are
shown.
Table 5.2: Sample Results Obtained from Simple Pipe Code (10 Nodes)
61
Table 5.2: Sample Results Obtained from Simple Pipe Code (10 Nodes)
The pressure distribution obtained when the results are plotted is shown in Figure
5.1. The pressure at the open end of the pipe is a constant and is equal to 1.0 bar. Since
the pipe end is open to atmosphere, the pressure does not change through out the
simulation time. At the pipe entry, the pressure decreases at first and then remains
constant for a certain period of time and then decreases as the simulation time increases.
At the mid point, the wave action phenomenon can be felt with increased vigor because
the waves are reflected at the open end and come back because of this the pressure first
decreases and then increases and after certain point of time the effect becomes smaller
and smaller and the pressure gradually falls and reaches a constant value.
62
Pressurf at
1 4 • ,__-^ ' pipe entry
Pressure at Mid-Point
1 ?
1-
\
0 8- \ Pressure at
Xopen end.
1
1
0-
0.01 0.02 0.03 0.04 0.05 0.06
Time(seconds)
Next the same code with the same input conditions is mn, but the number of nodes
is increased from 10 to 30. Here the output locations are Node 1, Node 15, and Node 31.
Node 1 corresponds to pipe entry. Node 15 corresponds to mid-point of the pipe, and
Node 31 corresponds to the open end of the pipe. The output obtained is given in Table
5.3. Only the first 20 points are given. On increasing the number of nodes from 10 to 30,
the accuracy increases and the simulation time also increases. The number of points
where the pressure is obtained is increased. The data is exported to excel sheet and the
pressure distribution obtained is shown in Figure 5.3. The wave action can be more
clearly seen in this case, then the previous case when only 10 nodes were considered.
When 10 nodes were considered, the second pulse was not completely visible where as in
this case it is cleariy seen. There is no change in the pressure at the open end. The results
63
at the mid-point and pipe entry are much more accurate then those obtained when the
code was run with 10 nodes.
Table 5.3: Sample Results Obtained from Simple Pipe Code (30 Nodes)
64
1.6
t \ ^ ^ Pressure at Mid-point
1.4
0.8
\ i Rressur
e at open
0.6
0.4
0.2
Next the number of Nodes is increased to 50. The output locations this time are
Node 1, Node 25 and Node 51. The output is now given for 30 locations because there is
no change in the pressure for the first 20 locations because the simulation time is short as
we increased the mesh size. From the pressure distribution, it is seen that there is not
much difference between the 30 nodes distribution and 50 nodes distribution. Increasing
the mesh size does increase the accuracy but the code takes more time and is not
desirable. Increasing the mesh size further will increase the simulation time further but
there will not be any appreciable changes in pressure values obtained.
65
Table 5.4: Sample Results Obtained from Simple Pipe Code (50 Nodes)
The plot given below gives the pressure distribution for the entire simulation time.
From the graph once again the second pulses are seen clearly as was the case with 30
nodes. The pressure obtained is more accurate then obtained from the previous two cases.
The results are in excellent agreement with the values obtained by Benson [1].
66
1.6
Pressure at
1.4 open end
1.2 N^
Pressure at Open ^u^ ^ ^
2 0.8
«
£
0.
0.6
0.4
0.2
A comparative study of pressure at the pipe entry is done. The output obtained
from the above three programs at the pipe entry is plotted on a single sheet. A fair idea is
obtained as when to stop increasing the mesh size. When there is not much change in the
shape of the distribution it is safe to say that increasing the mesh size does not have an
appreciable effect on the accuracy of the output.
67
1.6
1
- ^
1.4
^V- 10 Nodes
1.2 /
50 Nodes
30Nodes
5 0.8
0.6
0.4
<
0.2
The pressure distribution at the midpoint of the pipe for 10, 30 and 50 nodes is
given in Figure 5.5. From the graph, it is observed that there is difference in the shape of
the graph for 10 nodes and 30 and 50 nodes. The distribution is more accurate for the 30
and 50 nodes and is less accurate for 10 nodes. It can be observed that even the amplitude
for the second and third pulses are different for 10 nodes. In this case the effect of
increasing the mesh size is very apparent. A completely different shape is obtained for 10
nodes and a different shape for 30 nodes and 50 nodes. There is not much difference
between the 30 nodes distribution and the 50 nodes distribution.
68
1.6
1.4
ION odes
1.2
^ ^
30 Nodes
0.8 50 Nodes
0.6
0.4
0.2
The code which gives the velocity of the gas in the pipe in run for the same set of
input conditions. The code for this program is given in appendix. The velocity output is
obtained at Node 1, Node 25, and Node 51. The sample output is given in Table 5.5 and
the velocity distribution is given in Figure 5.6. From the plot, it can be seen that after
about 30 milliseconds the velocity reaches a constant value. The open end has an initial
velocity whereas the velocity at the pipe entry and mid point of the pipe is zero at the
start of the simulation. Once steady state is reached the velocity becomes almost equal at
all the three points.
69
Table 5.5: Sample Results Obtained from Velocity Code
70
300
Time (Seconds)
The next code that is developed is for a pipe with a partially open end. This code
is given in appendix. The conditions that are assumed are given in Table 5.6. The
cylinder has a partially open end at one end and is closed at the other end. The output
obtained from the code is plotted and the pressure distribution in given in Figure 5.7.
From the graph it is seen that sudden opening of the partially open end causes a point
centered expansion wave to be generated. This wave is reflected at the closed end and
return back to the open end when a nonual expansion wave is reflected back into the
cylinder. The process continues until the cylinder is empty. The nature of discharge is
cleariy seen which is stepped. The constant pressure regions are the regions of steady
flow.
71
Table 5.6: Input Condition to a Partially Open End Program
Condition Value
Initial Pressure 3.041
Initial Temperature 300K
Reference Pressure 1.0 bar
Length of the pipe 1.219 meter
Output Locations 1/12L and 11/12L (L is length of pipe)
Mesh Size 50
Ratio of Specific Heats 1.4
Node location of Output 5,45
Simulation time 50 Milliseconds
Opening Area 0.25 sq. meter
Table 5.7: Sample Results Obtained from the Partially Open End Code
72
3-
X
2.5 -
Fjessure at Node 45
•=• 2 -
>sure(ba
Pressure at Node 5
£
a 1 5 -
0 -
O01 0.02 0.03 0.04 0.05 0.06
Time (Seconds)
Figure 5.7 Pressure versus Time for a Partially Open End Boundary (0.25)
73
The nozzle area ratio is changed to 0.5 and 0.10 and the pressure distribution is
obtained for the same set of input conditions. The Pressure distribution obtained is shown
in Figures 5.8 and Figure 5.9. The distribution obtained from the three nozzle area ratios
is plotted in a single sheet and is given in Figure 5.10. From the plot it is seen that the
discharge is a function of the nozzle area ratio and is independent of the initial conditions.
The larger the nozzle area ratio the larger is the fall in pressure. The results obtained
verify the results obtained by Benson [32].
3.5
^Pressure at Node
5
1 •
2.5
Pressure at N irifi
_^^'-'45
1.5
0.5
Figure 5.8 Pressure versus Time for a Partially Open End (0.50)
74
3.5
'ressure at Node 5
„ ^ ^
Pressure a Node 45
2.5
1.5
0.5
Figure 5.9 Pressure versus Time for a Partially Open End (0.10)
75
0.01 0.02 0.03 0.04 0.05 0.06
Simulation Time (Seconds)
Figure 5.10 Pressure versus Time for Different Nozzle Area Ratios
76
Next the valve and cylinder sub routines and used to find the pressure in the
cylinder. The code is given in appendix. For the cylinder, the input conditions are given
in Table 5.8.
Condition Value
Initial Pressure in the Pipe 1.0 bar
Cylinder pressure at E.V.O 3.593 bar
Cylinder Temperature at E.V.O 762K
Reference Pressure 1.0 bar
Pipe Length 0.609 meter
Pipe Diameter 0.0508 meter
Mesh Size 12
Ratio of Specific Heats 1.4
EVO 136
Number of Cycles 4
Engine Speed 33.33 rev/sec
Output locations 1,13
Simulation Time 500 degrees
Cylinder bore 0.125 meter
Cylinder Stroke 0.130
Connecting Rod Length 0.273
Compression Ratio 14.0
Air Pressure 1.65 bar
Air Temperature 360 K
Opening Area 0.5
77
The variation of valve area with crank angle is given in Table 5.9 [3].
78
The output from the program is the cylinder pressure and the exhaust pipe
pressure at the cylinder end and the exhaust pipe pressure at the partially open end pipe.
The sample output and the pressure distribution are given in Table 5.10 and Figures 5.11,
5.12, and 5.13
From the graphs, it is seen that the cylinder pressure reaches a maximum value at
around 330 degrees. Cylinder residual waves can be seen in the exhaust pressure
diagram. These residual waves also appear in the partially open end of the exhaust pipe
but are very weak. The residual waves help in the scavenging of the cylinder.
79
Figure 5.11 Variation of Cylinder Pressure with Crank Angle.
80
1.4 -|
1.32 •
•
1.24 •
\
1 16 •
• •
1 - lBii^ft% ^^Sm
0.92 -
0.B4
130 170 210 250 290 330 370 410 450 490 530 570 610 650 690
Crank Angle (Degree)
Figure 5.12 Exhaust Pipe Pressure (Partially Open End) versus Crank Angle
81
1.4
' •
•
1.32
' •
•
1.24
•£ 1.16
0.92
0.84
130 170 210 250 290 330 370 410 450 490 530 570 610 650 690
CrankAngle{Degree)
Using the codes developed the pressure distribution of fluid for any type of engine
can be easily simulated. The only input that needs to be derived from experimental stage
is the valve data. Hence by using the codes given in the appendix the fluid flow in
engines can be simulated to a reasonable extent. A lot of assumptions have been made
and the results are only a rough estimate. In the next chapter work required to make the
code better and further improvements to simulate the flow in a much more efficient way
are described.
82
CHAPTER 6
CONCLUSIONS AND FUTURE WORK
6.1 Conclusions
The following conclusions can be drawn from this thesis
1. The results obtained are in agreement with the results obtained by other
researchers. Similar results were obtained by Benson [1] and Winterbone [27].
The results obtained are only an approximation as the entropy change, friction and
heat transfer have been neglected.
2. A combustion model must be added to the code for predicting the exact cylinder
pressure developed. Without the combustion model the code only gives a rough
estimate of the pressure developed and is not close to actual pressure developed in
an operating cylinder.
3. The wave action phenomenon is clearly seen in the simple pipe, partially open
ended pipe and the exhaust pipes of IC engines.
4. Simulation time will become a question of concern as more complex boundary
conditions are added to the code
5. Higher order methods like the Lax-Wendroff method and TVD schemes should
be used to obtain higher accuracy and to shorten the simulation time. However at
the boundaries the MOC can only be used.
83
mput conditions for the second cylinder. Another important thing to take care is the
junction boundary conditions and pipe branches.
The next big step would be to consider the entropy and cross section changes in
the engine and pipe systems. This would lead to additional complexity and some more
equations. In the code that is developed in this thesis we assumed constant entropy and
cross-section area.
After simulating the flow for varying entropy the code can then be modified to
include complex boundary conditions within pipe systems. Some of the complex
boundary conditions are throttle, compressor, supercharger, turbocharger, sudden
enlargement and contraction of pipes.
If all the above recommendations are implemented, then the code will work
satisfactorily for any type of engine with complex boundary conditions. The next step
would be to deal with issues hke speed and accuracy. To increase the speed and accuracy,
the author suggests the use of conservative methods which are more accurate and faster
than the traditional method of characteristics. The ultimate goal will be to simulate the
entire engine, so one should also look at the combustion modeling at some stage or the
other which is altogether a new topic.
84
REFERENCES
1. Benson, R.S. (1982) The thermodynamics and gas dynamics of intemal combustion
engines (edited by J.H Horlock and D.E. Winterbone) Vol. 1 Clarendon Press,
Oxford.
2. Eamshaw, S. (1860) On the mathematical theory of sound, Phil. Trans. R. Soc, 150,
133-148.
6. Benson, R.S., Garg, R.D., and Woollatt, D.1964. A numerical solution to the
unsteady flow problem, Int.J.Mech.Sci., 6, 117-144
8. Low, S.C. and Baruah, P.C. A generalized computer aided design package for I.C
engine manifold system. SAE paper in SP-487 on Engine Control Modeling. Feb 23-
27, 1981, Detroit, Michigan.
9. Blair, G.P., and Gouldbum, J.R., 1967, The pressure time history in the exhaust
system of a high-speed reciprocating intemal combustion engine. SAE paper 670477.
12. Ledger, D. Computational methods for unsteady compressible gas flows. Ph.D.
Thesis, April 1974, University of Manchester.
85
13. Pearson, R.J., and Winterbone, D.E., 1990. A rapid wave action simulation technique
for intake manifold design, SAE paper 900676.
14. Lax, P.D., and Wendroff, B., 1960. Systems of Conservation laws. Commun. Pure
Appl. Math., 13, pp. 217-237.
15. Richtymyer, R.D., and Morton, K.W., 1967. Difference Methods for initial value
problems, Wiley, New York.
16. Richtymyer, R.D. 1962. A survey of difference methods for non-steady fluid
dynamics, NCAR Technical Notes 63-2. National Center for atmospheric research,
Colorado
17. MacCormack, R.W. 1969 The effect of viscosity in hypervelocity and impact
cratering, AIAA paper 69-354.
18. MacCormack, R.W. 1971. Numerical solution of the interaction of a shock wave with
a laminar boundary layer. Proceedings of the second intemational conference on
Numerical Methods in fluid dynamics. Lecture notes in physics,8 Springer Verlag,
New York.
20. Poloni, M., Winterbone, D. E. and Nichols, J.R. Calculation of pressure and
temperature discontinuity in a pipe by the method of characteristics and the two-step
differential Lax-Wendroff method. In international symposium on flows in internal
combustion engines, FED 62, ASME Annual Winter Meeting, Boston, 13-18
December 1987.
21. Winterbone, D.E., Pearson, R.J. and Zhao, Y. Numerical Simulation of intake and
exhaust flows in a high- speed multi-cylinder petrol engine using Lax-Wendroff
Method. IMechE Intemational Conference on computers in engine technology,
Cambridge, 10-12 September 1991 (Mechanical Engineering Publications, London).
22. Ferrari, G. and Onorati, A. Determination of silencer performance and radiated noise
spectrum by 1-D gas dynamic modeling. In Proceedings of FISITA Congress,
Beijing, China, 17-22 October 1994.
23. Lin, J., Schom, N. , Schemus, C. and Peng, L. Comparison studies on the method of
characteristics and finite difference methods one one-dimensional gas flows through
IC engine manifolds. SAE paper 960078, 1996.
86
24. Pearson, R.J., and Winterbone, D.E. 1998. The simulation of gas dynamics in engine
manifolds using non-linear symmetric difference schemes. Proc Instn. Mech. Engrs.
Vol 211 PartC.
25. Pearson, R.J., Bassett, M.D., Batten, P., Winterbone D.E. Two-dimensional
simulation of wave propagation in a three-pipe junction. Joumal of Engineering for
Gas Turbines and Power, October 2000, Vol 122/549-555.
26. Zhu, Y, Reitz, R.D. A 1-D gas dynamics code for subsonic and supersonic flows
applied to predict EGR levels in a heavy duty diesel engine. Intemational Joumal of
Vehicle Design, Volume 22 Issue3/4,1999,pp 227-252
27. Pearson, R.J., Winterbone, D.E. 2000. Theory of Engine manifold design-Wave
Action Methods for IC Engines. Professional engineering publication limited.
28. Roe, P.L. 1986. Characteristics -based schemes for Euler equations, Ann. Rev. Fluid
Mech., 18, 337-365.
29. LeVeque, R.J. 1992. Numerical Methods for conservation laws. Lectures in
mathematics ETH, Zurich.
30. Benson,R.S. 1972. Numerical solution of one dimensional non- steady flow with
supersonic and subsonic flows and heat transfer. Int.J.Mech.Sci, 14, 635-642.
32. Benson, R.S. 1955. Discharge of gas from cylinder to atmosphere. The Engineer, 199,
546-548, 582-584, and 618-620.
87
APPENDIX
88
Given below is the code for a simple pipe with three possible boundary conditions
(1) Inflow into the pipe, (2) Open End, and (3) Closed End.
Program code
INTEGER S,SS,R
REAL GAMMA
DIMENSION CL1(2,51),CL2(2,51 ),N0UT(51 ),Z(2),PRESSUREOUT(2,51)
DIMENSION ZOUT (2)
c Input and Output to a File
OPEN (5, FILE='SAMPLE.TXT')
OPEN (6, FILE='S AMPLEOUT.TXT')
c READ the Initial Conditions
c PI: Initial Pressure
c Tl: Initial Temperature
c PR: Reference Pressure
c LPIPE: length of the Pipe
c M: Number of Mesh Points
c GAMMA: Ratio of Specific Heats,
c NODE: No. of Nodes
c TMAX: Simulaiton Time in Seconds.
READ (5,*) PI
READ (5,*) Tl
READ (5,*) PR
READ (5,*) LPIPE
READ (5,*) M
READ (5,*) GAMMA
READ (5,*) NODE
READ (5,*) (N0UT(N),N=1.N0DE)
READ (5,*) TMAX
ZOUT(1)=0.0
D 0 2 N = 1,N0DE
2 PRESSUREOUT(l,N) = PI
Write (6,*) ZOUT(l),(PRESSUREOUT(l,N),N = l.NODE)
PI =3.14159
Q =(GAMMA-1)/(2.0*GAMMA)
Ql = 1.0/Q
AA = (3.0-GAMMA)/(2.0*(GAMMA-1.0))
BB = (GAMMA+1.0)/(2.0*(GAMMA-1.0))
SS = 1+M
CL = (PI/PR)** Q
TR =T1/(P1/PR)** (2.0*0)
AREF = SQRT (GAMMA * 287.0 * TR)
XMESH = LPIPE/FLOAT(M)
XREF = LPIPE/FLOAT( M)
DELX = XMESH/XREF
DO 1 N= 1 ,SS
CL1(1,N) = CL
1 CL2(1,N) = CL
S= 1
READ(5,*) PO
AO = (PO/PR)**Q
S = SS
89
R=l
Z(1) = 0.0
14 D 0 15S = 1,SS
DELZl=DELX/((CLl(R,S)+CL2(R,S))/2.0
4 +ABS(CL1 (R,S)-CL2(R,S))/(GAMMA-1))
IF (S.EQ. 1) DELZ = DELZl
IF(S.EQ.1)G0T0 15
IF (DELZl LT.DELZ) DELZ = DELZl
C Calculations for Next Time Step
15 CONTINUE
Z(R+1) = Z(R)+DELZ
DO 11 S=2,SS
11 CL1(R+1,S)=CL1(R,S)+(BB*CL1(R,S-1)-AA*CL2(R,S-1))
8*(CL1(R,S-1)-CL1(R,S))*DELZ/DELX
DO 12S = 1,M
12 CL2(R+1,S)=CL2(R.S)+(BB*CL2(R,S+1)-AA*CL1(R,S+1))
7 * (CL2(R,S+1)- CL2(R,S))*DELZ/DELX
S= 1
QQ = CL2(R+1,S)
c BOUNDARY CONDITIONS
CALL INFLOW(PP,QQ,A0,G)
CL1(R+1,S) = PP
S = SS
QQ = CL1(R+I,S)
CALL OPENEND(PP,QQ)
CL2(R+1,S) = PP
D0 29N = l,NODE
S = NOUT(N)
29 PRESSUREOUT(R+l,N)= (((CL1(R+1,S)+CL2(R+1,S))/2.0)**Q1)*PR
Z0UT(R+1)= Z(R+1)*XREF/AREF
WRITE (6,*) ZOUT(R+l),(PRESSUREOUT(R+I,N),N = l.NODE)
IF (ZOUT(R+l) GT.TMAX)GO TO 30
Z(R) = Z(R+1)
DO 31 S = 1,SS
CL1(R,S) = CL1(R+1,S)
31 CL2(R,S) = CL2(R+1,S)
GO TO 14
30 STOP
END
SUBROUTINE CLOSEDEND(PP,QQ)
PP =QQ
RETURN
END
SUBROUTINE OPENEND(PP,QQ)
PP = 2.0 - QQ
RETURN
END
SUBROUTINE INFLOW(PP,QQ,A0,G)
G = 1.4
A = (3.0-G)/(G+1.0)
B = 40*(G-1.0)/(G+1.0)
C = ((1.4+1.0)/(3.0-G))*QQ
IF (QQ.GE. AO) GO TO 1
PP = A * QQ+ SQRT(B*A0**2-(1.0-A**2)*QQ**2)
IF (PP.GT.C) PP= C
GO TO 2
90
PP= 2.0*A0-QQ
RETURN
END
2) Given below is the code for calculating the velocity of the fluid at any point in a
simple pipe with three possible boundary conditions
1) Inflow into the pipe 2) Open End 3) Closed End.
Program code
INTEGER S,SS,R
REAL GAMMA
DIMENSION CLl(2,51 ),CL2(2,51 ),N0UT(51 ),Z(2)
DIMENSION ZOUT(2),VELOCITYOUT(2,51)
c Input and Output to a File
OPEN(5,FILE=S AMPLE.TXT')
0PEN(6, F1LE=:SAMPLEOUT.TXT)
c READ the Initial Conditions
c PI: Initial Pressure
c Tl: Initial Temperature
c PR: Reference Pressure
c LPIPE: length of the Pipe
c M: Number of Mesh Points
c GAMMA: GAMMA
c NODE: No. of Nodes
c TMAX: Simulaiton Time in Seconds.
READ (5,*) PI
READ (5,*) Tl
READ (5,*) PR
READ (5,*) LPIPE
READ (5,*) M
READ (5,*) GAMMA
READ (5,*) NODE
READ (5,*) (NOUT(N),N=l,NODE)
READ (5,*) TMAX
ZOUT(1)=0.0
D02N=1,N0DE
2
Write (6,*) ZOUT(l),(VELOCITYOUT(l,N),N = l.NODE)
PI =3.14159
Q =(GAMMA-1)/(2.0*GAMMA)
Ql = 1.0/Q
AA = (3.0-GAMMA)/(2.0*(GAMMA-1.0))
BB = (GAMMA+1.0)/(2.0*(GAMMA-1.0))
SS = 1+M
CL = (PI/PR)** Q
TR =T1/(P1/PR)**(2.0*Q)
AREF = SQRT (GAMMA * 287.0 * TR)
XMESH = LPIPE/FLOAT(M)
XREF = LPIPE/FLOAT( M)
DELX = XMESH/XREF
DO 1 N= 1 ,SS
CL1(1,N) = CL
1 CL2(1,N) = CL
S=l
READ(5,*) PO
AO = (PO/PR)**Q
S = SS
91
R=l
Z(1) = 0.0
14 D 0 15S=1,SS
DELZl=DELX/((CLl(R,S)+CL2(R,S))/2.0
4+ABS(CLl(R,S)-CL2(R,S))/(GAMMA-l))
IF (S.EQ. 1) DELZ = DELZl
IF (S.EQ, 1) GO TO 15
IF (DELZl.LT.DELZ) DELZ = DELZl
C Calculations for Next Time Step
15 CONTINUE
Z(R+1) = Z(R)+DELZ
DO 11 S = 2,SS
11 CL1(R+1,S)=CL1(R,S)+(BB*CL1(R,S-1)-AA*CL2(R,S-1))
8*(CL1(R,S-1)-CL1(R,S))*DELZ/DELX
DO 12S = 1,M
12 CL2(R+1,S)=CL2(R,S)+(BB*CL2(R,S+1)-AA*CL1(R,S+1))
7 * (CL2(R,S+1)- CL2(R,S))*DELZ/DELX
S= 1
QQ = CL2(R+1,S)
c BOUNDARY CONDITIONS
CALL INFLOW(PP,QQ,A0,G)
CL1(R+1,S) = PP
S = SS
QQ = CL1(R+1,S)
CALL OPENEND(PP,QQ)
CL2(R+1,S) = PP
DO 28 N = 1,N0DE
S = NOUT(N)
28 VELOCITYOUT(R+l,N) = ((CLl(R+1,S)-CL2(R+1,S))/(K-1.0))*AREF
ZOUT(R+l)= Z(R+1)*XREF/AREF
IF (ZOUT(R+l).GT.TMAX)GO TO 30
Z(R) = Z(R+1)
DO 31 S = LSS
CL1(R,S) = CL1(R+1,S)
31 CL2(R,S) = CL2(R+1,S)
GO TO 14
30 STOP
END
SUBROUTINE CLOSEDEND(PP,QQ)
PP =QQ
RETURN
END
SUBROUTINE OPENEND(PP,QQ)
PP = 2.0 - QQ
RETURN
END
SUBROUTINE INFLOW(PP,QQ,A0,G)
G = 1.4
A = (3.0-G)/(G+1.0)
B = 4.0*(G-1.0)/(G+1.0)
C = ((1.4+1.0)/(3.0-G))*QQ
92
IF (QQ.GE. AO) GO TO 1
PP = A * QQ+ SQRT(B*A0**2-(1.0-A**2)*QQ**2)
IF (PP.GT.C) PP= C
GO TO 2
1 PP= 2.0*A0-QQ
2 RETURN
END
3) Program to calculate the pressure in a pipe with a partially open end boundary
condition
Program PARTIAL
INTEGER S,SS,R,T1,PR,LPIPE,MESH,NODE
REALGAMMA.Pl
DIMENSION CLl(2,51),CL2(2,51 ),N0UT(51 ),Z(2),PRESSUREOUT(2,51 ),ZOUT(2)
0PEN(5,F1LE=SAMPLE.TXT')
OPEN(6, FILE=SAMPLEOUT.TXT)
READ (5,*) PI
READ(5,*)T1
READ (5,*) PR
READ(5,*) LPIPE
READ(5,*) MESH
READ(5,*)GAMMA
READ (5,*) NODE
READ (5,*) (NOUT(N),N=l,NODE)
READ (5,*) ZMAX
ZOUT(1)=0.0
D 0 2 N = LNODE
2 PRESSUREOUT(l,N) = Pl
Write (6,*) ZOUT(l),(PRESSUREOUT(l,N),N = LNODE)
PI =3.14159
Q = (GAMMA-1)/(2.0*GAMMA)
Ql = 1.0/Q
AA = (3.0-GAMMA)/(2.0*(GAMMA-1.0))
BB = (GAMMA+1.0)/(2.0*(GAMMA-1.0))
M = MESH
SS = 1+M
CL= (PI/PR)** Q
TR = T1/(P1/PR)** (2.0*Q)
AR = SQRT (GAMMA * 287.0 * TR)
XMESH = LPIPE/FLOAT(M)
XREF = LPIPE/FLOAT( M)
DELX = XMESH/XREF
DO 1 N= 1 ,SS
CL1(1,N) = CL
1 CL2(1,N) = CL
S=l
c INPUT THE NOZZLE AREA RATIO
READ(5,*) PHI
AO = (PO/PR)**Q
S = SS
R=l
Z(1) = 0.0
14 D 0 15S=1,SS
DELZl=DELX/((CLl(R,S)+CL2(R.S))/2.0+
4 ABS(CL1 (R,S)-CL2(R,S))/(GAMMA-1))
IF (S.EQ. 1) DELZ = DELZl
1F(S.EQ.1)G0T0 15
93
IF (DELZl.LT.DELZ) DELZ = DELZl
15 CONTINUE
Z(R+1) = Z(R)+DELZ
DO 11 S = 2,SS
11 CL1(R+1,S)=CL1(R,S)+(BB*CL1(R,S-1)-AA*CL2(R,S-1))
8*(CL1(R,S-1)-CL1(R,S))*DELZ/DELX
DO 12S = 1,M
12 CL2(R+1,S)=CL2(R,S)+(BB*CL2(R,S+1)-AA*CL1(R,S+1))
7 * (CL2(R,S+1)- CL2(R,S))*DELZ/DELX
S= 1
QQ = CL2(R+1,S)
CALL CLOSEDEND(PP,QQ)
CL1(R+1,S) = PP
S = SS
QQ = CL1(R+1,S)
CALL POE(PP,QQ,PHI,GAMMA)
CL2(R+1,S) = PP
D 0 2 9 N = l.NODE
S = NOUT(N)
29 PRESSURE0UT(R+1,N)= (((CL1(R+1,S)+CL2(R+1,S))/2.0)**Q1)*PR
Z0UT(R+1) = Z(R+1)*XREF/AR
WRITE (6,*) ZOUT(R+l),(PRESSUREOUT(R+l,N).N = l.NODE)
IF (ZOUT(R+l).GT.ZMAX)GO TO 30
Z(R) = Z(R+1)
D 0 31 S = l.SS
CL1(R,S) = CL1(R+1,S)
31 CL2(R,S) = CL2(R+1,S)
GOTO 14
30 STOP
END
SUBROUTINE CLOSEDEND(PP,QQ)
PP =QQ
RETURN
END
SUBROUTINE OPEEND(PP,QQ)
PP = 2.0 - QQ
RETURN
END
SUBROUTINE INFLOW(PP,QQ,A0)
A = (3.0-1.4)/(1.4+1.0)
B = 4 0 * (1.4-1.0)/(1.4+1.0)
C = ((1.4+1.0)/(3.0-1.4))*QQ
IF (QQ.GE. AO) GO TO 1
PP = A * QQ + SQRT(B*A0**2-(1.0-A**2)*QQ**2)
IF (PP.GT.C) PP = C
GO TO 2
1 PP = 2.0*A0-QQ
2 RETURN
END
SUBROUTINE POE(CLOUT,CLIN.PHIN.G)
C PHIN = NOZZLE AREA RATIO
DIMENSION A(6)
C CALCULATE CONSTANTS
A(1) = (G+1.0)/(G-1.0)
A(2) = 2.0/(G-1.0)
A(3) = 2.0*A(2)
A(4) = 2.0/(G+1.0)
A(5) = 1.0/A(2)
IF(CLIN.GT.1.0)GOTO10
94
CLOUT = 2.0 - CLIN
GO TO 5
C INITIAL ESTIMATE TO SOLVE THE EQUATION USING NUMERICAL METHOD
10 AN = 0.5*(CLIN+1.0)
C NEXT ESTIMATE
DAN = 0.25*(CLIN-1.0)
C EQUATION FOR SONIC FLOW
1 FA = ((CLIN-AN)**2)*(AN**A(3)-PHIN**2)
5-(A(5)*PHIN**2)*(AN**2-1.0)
IF(ABS(FA).LT.0.0001) GO TO 2
IF(FA.LT.0.0)GOTO3
AN = AN +DAN
GO TO 4
3 AN = AN -DAN
4 DAN = 0.5 *DAN
IF(DAN .GT.0.0001) GO TO 1
2 CLOUT = 2.0 * AN - CLIN
U = (CLIN-CLOUT)/(G-1.0)
V = AN**A(2)*U/PHIN
IF( V.LE.1.0)GOTO5
AT = 0.5 +0.5 *SQRT(A(4))
DAT = 0.25 -0.25*SQRT(A(4))
6 X = 1.0/AT
FA = PHIN**2-(Y**A(3))*(A(1)-A(2)*Y**2)
IF(ABS(FA).LT.0.0001) GO TO 7
IF(FA.LT.0.0)GOTO8
AT = AT + DAT
GO TO 9
8 AT = AT -DAT
9 DAT = 0.5 * DAT
IF ( DAT.GT.0.0001) GO TO 6
7 A(6) = AT**A(1)
CON = A(5) *PHIN*A(6)
SKS = (1.0-CON)/(1.0+CON)
CLOUT = SKS*CLIN
5 RETURN
END
4) Program to calculate the pressure in the cylinder and in the exhaust pipe
PROGRAM CYLINDER
INTEGER R.S.SS
REAL GAMMA.MC
DIMENSION CLl(2.51),CL2(2,51 ),N0UT(51 ).Z(2),POUT(2,51 ).ZOUT(2)
COMMON AAIR.AREF,AVO,AZA(50).N1,CR.CYCLE1,DELZ
COMMON DPCDT,EVO,FAIR(50),ACYL,FEXH(50),FP,LAIR.1REV
COMMON IVOL,GAMMA,MC.NA.PA,PC,PI.PR.REV,RPM.STROKE.TA.THETA
COMMON TRAD,VC,XREF,ZCALC.ZREV,NE.AZE(50)
! DATA INPUT
OPEN(5.FILE =S AMPLE.TXT')
0PEN(6, FILE=SAMPLEOUT.TXT')
READ(5,*) P1.PC,TC,PR,LPIPE,DP
READ(5,*)MESH,GAMMA.EV0,AV0,CYCLE1,RPM
THETA = EVO
ZOUT(l) = THETA
ZCALC = 0.0
ZREV =0.0
REV = 1.0
95
DATA OUTPUT
NO. OF LOCATIONS (NODE)
LOCATION(NOUT(N))
LENGTH OF RUN IN DEGREE CRANK ANGLE
READ(5.*) NODE
READ (5,*)(N0UT(N), N= l.NODE)
READ (5,*) ZMAX
! PRINT OUT THE INITIAL VALUES AT OUTPUT LOCATIONS
D 0 2N= l.NODE
2 P0UT(1.N)= PI
c PRINT out Initial Values
WRITE(6.*) ZOUT(l),PC.(POUT(l.N). N = 1 .NODE)
PI = 3.14159
! CALCULATE CONSTANTS
Q = (GAMMA-1)/(2.0*GAMMA)
Ql = 1.0/Q
AA = (3.0-GAMMA)/(2.0*(GAMMA-1.0))
BB = (GAMMA+1.0)/(2.0*(GAMMA-1.0))
M = MESH
SS = 1+M
CL = (PI/PR)** Q
! SET UP REFRENCE CONDITIONS
TREE = TC*(PR/PC)**(2.0*Q)
TRI = TREE
AREF = SQRT(GAMMA*287.0*TREF)
XMESH = LPIPE/FLOAT(M)
XREF = LPIPE/FLOAT(M)
! SETUPDMITIALCONDITIONS ATZ = 0
DELX = XMESH/XREF
DO 1 N= l.SS
CL1(1.N) = CL
1 CL2(1.N) = CL
! READ BOUNDARY CONDITONS
S=l
BOUNDARY CONDITION AT S = 1 , CYLINDER
READ DATA
Pv'OL = 1 CONSTANT VOLUME
LMR = 0 NO AIR INLET TO CYLINDER
IVOL=2 VARL\BLE VOLUME
lAIR = 1 AIR INLET TO CYLINDER
READ(5.*) rVOL. lAIR
GOTO(41.42),IVOL
41 READ(5.*) VC.PC.TC
AC = SQRT(GAMMA*287.0*TC)
GO TO 43
42 READ (5,*) DLA.STROKE.LROD.CR
Nl = 2.0*LROD/STROKE
TRAD =THETA*PI/180.0
FNN =SQRT(N1**2-SIN(TRAD)**2)
96
DPCDT = -GAMMA*DVCDT*PC/VC
IF(lAIR.EQ.0)GOTO43
READ(5.*) PA.TA
AAIR = SQRT(GAMMA*287.0*TA)
43 READ(5,*) NE
READ (5.*) (AZE(I),FEXH(I). I = l.NE)
FP = 0.25*PI*DP*DP
DO 44 1 = 1 . NE
44 FEXH(I) =FEXH(I)/FP
IF(IAIR.EQ.0)GOTO45
READ(5.*) NA
READ(5.*) (AZA(I).FAIR(I), 1 = l.NA)
45 S = SS
READ(5.*) PHI
R =1
Z(1) = 0.0
14 DO 15 S = l.SS
DELZl=DELX/((CLl(R.S)+CL2(R.S))/2.0
5+ABS(CLl(R,S)-CL2(R.S))/(GAMMA-l))
IF (S.EQ. 1) DELZ = DELZl
IF(S.EQ.1)G0T0 15
IF (DELZl.LT.DELZ) DELZ = DELZl
15 CONTINUE
Z(R+1) = Z(R)+DELZ
DO 11 S = 2,SS
11 CL1(R+1,S)=CL1(R.S)+(BB*CL1(R.S-1)-AA*CL2(R.S-1))
M*(CL1(R.S-1)-CL1(R.S))*DELZ/DELX
D 0 12S = 1.M
12 CL2(R+1,S)=CL2(R.S)+(BB*CL2(R.S+1)-AA*CL1(R.S+1))
Z* (CL2(R,S+1)- CL2(R.S))*DELZ/DELX
S=l
QQ = CL2(R+1.S)
c Boundary Conditions
CALL CYLNDR(PP.QQ)
CL1(R+1.S) = PP
S = SS
QQ = CLl (R+1.S)
CALL POE(PP,QQ.PHI.GAMMA)
CL2(R+1,S)= QQ
DO 29 N = l.NODE
S = NOUT(N)
29 P0UT(R+1.N) = (((CL1(R+1.S)+CL2(R+1.S))/2.0)**Q1)*PR
Z0UT(R+1) = THETA
WRITE(6.*) ZOUT(R+l).PC.(POUT(R+l.N).N= l.NODE)
IF (ZCALC.GT.ZMAX) GO TO 30
Z(R) =Z(R+1)
DO 31 S = l.SS
CL1(R,S) = CL1(R+1.S)
31 CL2(R.S) = CL2(R+1.S)
GO TO 14
30 STOP
END PROGRAM CYLINDER
SUBROUTINE POE(CLOUT.CLIN.PHIN.G)
C PHIN = NOZZLE AREA RATIO
DIMENSION A(6)
C CALCULATE CONSTANTS
A(1) = (G+1.0)/(G-1.0)
97
A(2) = 2.0/(G-1.0)
A(3) = 2.0* A(2)
A(4) = 2.0/(G+1.0)
A(5)= 1.0/A(2)
IF (CLIN.GT. 1.0) GO TO 10
CLOUT = 2.0 - CLIN
GO TO 5
C INITIAL ESTIMATE TO SOLVE THE EQUATION USING NUMERICAL METHOD
10 AN = 0.5*(CL1N+1.0)
C NEXT ESTIMATE
DAN = 0.25*(CLIN-1.0)
C EQUATION FOR SONIC FLOW
1 FA = ((CLIN-AN)**2)*(AN**A(3)-PHIN**2)
5-(A(5)*PHIN**2)*(AN**2-1.0)
IF(ABS(FA).LT.0.0001) GO TO 2
IF (FA.LT.0.0) GO TO 3
AN = AN +DAN
GO TO 4
3 AN = AN -DAN
4 DAN = 0.5 *DAN
IF(DAN .GT.0.0001) GO TO 1
2 CLOUT = 2.0 * AN - CLIN
U = (CLIN-CLOUT)/(G-1.0)
V = AN**A(2)*U/PHIN
IF( V.LE.1.0)GOTO5
AT = 0.5 +0.5 *SQRT(A(4))
DAT = 0.25 -0.25*SQRT(A(4))
6 X=1.0/AT
FA = PHIN**2-(Y**A(3))*(A(1)-A(2)*Y**2)
IF(ABS(FA).LT.0.0001)GOTO7
IF (FA.LT.0.0) GO TO 8
AT = AT + DAT
GO TO 9
8 AT = AT -DAT
9 DAT = 0.5 * DAT
IF ( DAT.GT.0.0001) GO TO 6
7 A(6) = AT**A(1)
CON = A(5) *PHIN*A(6)
SKS = (1.0-CON)/(1.0+CON)
CLOUT = SKS*CLIN
5 RETURN
END
SUBROUTINE CYLNDR(CLOUT.CLIN)
REAL GAMMA.MC
DIMENSION TH(2).VCC(2)
COMMON AAIR.AREF.AVO.AZA(50),N 1 .CR.CYCLE 1 .DELZ
COMMON DPCDT,EVO.FAIR(50).ACYL,FEXH(50),FP,L^IR.IREV
COMMON IVOL.GAMMA.MC.NA.PA,PC,PI,PR,REV.RPM,STROKE.TA.THETA
COMMON TRAD,VC.XREF,ZCALC.ZREV.NE,AZE(50),A
DT = DELZ*XREF/AREF
DTHR = 2.0*PI*RPM*DT
TRAD= TRAD+DTHR
THETA = TRAD*180.0/PI
IF(THETA.GT. 180*CYCLE1) THETA = THETA-180.0*CYCLE1
ZCALC =ZCALC+DTHR*180.0/PI
ZREV = ZREV +DTHR * 180.0/PI
IREV =0.0
IF (ZREV.LE. 180.0 * CYCLE1*REV) GO TO 5
98
IREV = 1
REV = REV+1.0
5 ALPHAE = THETA - EVO
IF (ALPHAE.LT.0.0) ALPHAE = 0.0
1=1
6 1 = 1+1
IF(ALPHAE.GT.AZE(I)) GO TO 6
PSI = FEXH(1-1)+(FEXH(I)-FEXH(M))*(ALPHAE-AZE(1-1))/
3(AZE(I)-AZE(I-1))
7 IF(IAIR.EQ.0)GOTO4
ALPHAA = THETA-AVO
IF(ALPHAA.LT.O.O) ALPHAA= 0.0
1= 1
8 1=1+1
EF (ALPHAA.GT.AZA(I)) GO TO 8
F2 = FAIR(1-1)+(FAIR(I)-FAIR(I-1))*(ALPHAA-AZA(1-1))/
C(AZA(I)-AZA(1-1))
IF (F2.LE.0.0) DMADT = 0.0
4 PC = PC+DPCDT*DT
IF(lREV.NE.l)GOTO10
TH(1) = EVO* PI/180
TH(2) = (AVO+AZA(NA-1))*PI/180
DO 11 N = 1.2
FNN = SQRT(N1**2-SIN(TH(N))**2)
X = 0.5* STROKE*(1.0+N1-FNN-COS(TH(N)))
11 VCC(N) = ACYL*(X+STROKE/(CR-1.0))
TC = PC * VCC(l) *TC /(PC*VCC(2))
PC = PC
IREV = 0
10 CALL VALVE(CLOUT.DMEDT.CLIN.PSI)
IF(IAIR.EQ.O) DMADT = 0.0
IF(IAIR.EQ.0)GOTO3
IF(F2.LE.0.0)GOTO3
CALLAIRFL(DMADT,PA.PC.AAIR,AC.GAMMA.F2)
3 MC = MC +(DMADT-DMEDT)*DT
GOTO(1.2).rVOL
1 DVCDT = 0.0
GO TO 9
2 FNN = SQRT(N1**2-SIN(TRAD)**2)
X = 0.5 *STROKE*(1.0+N1-FNN-COS(TRAD))
VC = ACYL*(X+STROKE/(CR-1.0))
DXDTH = 0.5 * STROKE*SIN(TRAD)*(1.0 +COS(TRAD)/FNN)
DTHDT = 2.0 * PI* RPM
DVCDT = ACYL*DXDTH*DTHDT
9 TC = 1.0E5 *PC * VC /(287.0*MC)
AC = SQRT(GAMMA*287*TC)
IF(DMADT.LT.O.O) A = AC
IF(DMADT .GT.0.0) A = AAIR
IF(DMADT.EQ.O.O) A = 0.0
DPCDT=-GAMMA*DVCDT*PC/VC-DMEDT*AC**2/(VC*1.0E5)+DMADT*A**2/(VC*1.0E5)
RETURN
END
SUBROUTINE VALVE(CLOUT.DMEDT.CLIN.PSI)
REAL GAMMA.Kl .K2.K3.MC,N,P1A
COMMON AAIR.AREF.AVO.AZA(50),AZE(50).N1,CR,CYCLE1.DELZ.DPCDT
COMMON EVO.FAIR(50).ACYL.FEXH(50).FP,IA1R,IREV
COMMONIVOL.GAMMA.MC,NA.NE.PA,PC,PI.REV,RPM,STROKE,TA.P
COMMON THETA.TRAD.VC.XREF.ZCALC.ZREV
PP = CLIN
99
QQ = CLOUT
IF (PSLGT.0.0) GO TO 1
50 PP = QQ
DMEDT = 0.0
RETURN
1 IF(PSLGT.1.0)PSI= 1.0
GAMMA = 1.4
Kl = (GAMMA-1.0)/(2.0*GAMMA)
K2 = 2.0/(GAMMA-1.0)
K3 = 1.0/K1
S = SQRT(2.0/(GAMMA+1.0))
PIA = CLIN*(PR/PC)**K1
IF( PIA EQ. 1.0) GO TO 50
C = 1.0/PIA
D = PL^
4 IF(PlA.LT.1.0)GOTO2
CLIN = PIA
CALL POE(CLOUT.CLIN.PHI.GAMMA)
CLIN = PP *(PC7PR)**K1
CLIN = PIA * (PC/PR)**K1
GO TO 11
2 U = S*(SQRT(1.0+(GAMMA**2-1.0)*PSI*PSI)-1.0)/(PS1*(GAMMA-1.0))
C = SQRT(1.0-U**2/K2)/S
PICR = S - U/(K2*C)
C = 1.0/PIA
IF(PIA.LE.PICR) GO TO 3
XPI = 0.5*(1.0+S)
DXPI = 0.25*(1.0-S)
30 B = (XPI-PIA)*C
FNPl = (PSI/XPI)*SQRT(K2*(1.0/XPI**2-1.0))-(B*K2/(1.0-B*B*K2))
C = SQRT(1.0 - K2*B*B)/XPI
D = 1.0/C
IF(ABS(FNPD.LT.0.00001)GOTO 8
IF (DXPl.LT.0.000001) GO TO 8
IF(FNPI.GT.O.O) XPI = XPI +DXPI
IF(FNPI.LT.O.O) XPI = XPI -DXPI
DXPI = 0.5*DXPI
GO TO 30
3 XPI = 0.5 *(PLA+S)
DXPI = 0.25 *(S-PIA)
E = PSI*(2/(GAMMA+1.0))**((GAMMA+1.0)/(2.0*(GAMMA-1.0)))
40 B = (XPI - PIA)*C
FNPI = XPI**K3-E*((1.0-K2*B*B)/(K2*B))
C = SQRT(1.0-K2*B*B)/XPI
D = 1.0/C
IF(ABS(FNPD. LT.0.00001) GO TO 8
IF (DXPI.LT.0.000001) GO TO 8
IF (FNPI.GT.0.0) XPI = XPI-DXPI
IF(FNPLLT.O.O)XPI = XPI+DXPI
DXPI = 0.5 *DXPI
GO TO 40
8 CLOUT = 2.0* XPI*(PC/PR)**K1- CLIN
11 A = 0.5 *(CLOUT+CLIN)
U = (CLIN-CLOUT)/(GAMMA-1.0)
RP = A**(2.0*GAMMA/GAMMA-1.0)
DMEDT = -GAMMA*(PR/AREF)*FP*(U/A**2)*RP*1.0E5
RETURN
END
SUBROUTINE AIRFL(DMADT.PA,PC,AA1R,ACYL.G,F2)
100
RM = PC/PA
IF(RM.GT.1.0)RM= 1.0/RM
IF(RM.EQ.l.O) DMADT =0.0
1F(RM.EQ.1.0)GOT0 1
D = G/(G-1.0)
RCR = (2.0/(G+1.0))**D
IF(RM.GT.RCR) GO TO 2
B = (G+1.0)/(2.0*(G-1.0))
FRM = G*(2.0/(G+1.0))**B
GO TO 3
2 R = 2.0/G
C = (G-1.0)/G
D = (2.0*G**2)/(G-1.0)
FRM = SQRT(D*(RM**R)*(1.0-RM**C))
3 IF(PC.GT.PA)GOT0 4
DMADT = PA*F2*FRM*1.0E5/AA1R
GOTO 1
4 DMADT = -PC*F2*FRM*1.0E5/ACYL
1 RETURN
END
101
PERMISSION TO COPY
degree at Texas Tech University or Texas Tech University Health Sciences Center, I
agree that the Library and my major department shall make it freely available for
research purposes. Permission to copy this thesis for scholarly purposes may be
granted by the Director of the Library or my major professor. It is understood that any
copying or publication of this thesis for financial gain shall not be allowed without my
further written permission and that any user may be liable for copyright infringement.
-I r
Student Signature Date