Java gas turbine simulator numerical solversr by john a. reed
1. Java Gas Turbine Simulator Documentation
Java Gas Turbine Simulator: Numerical Solvers
Preface
This document describes the numerical algorithms
used to simulate the operation of the gas turbine engine
in the Java Gas Turbine Simulator. A description of the
Component Engine Models is provided in the document
"Java Gas Turbine Simulator: Engine Components
Mathematical Models".
Introduction
As seen in the document "Java Gas Turbine
Simulator: Engine Components Mathematical Models",
differential equations are used to describe the rate of
change
of temperature
and
mass
in
the
AeroMixingVolume components, rate of change of
rotational speed in the RotorShaft, and rate of change of
momentum in the StoredMassDucts. These differential
equations are integrated numerically in time to determine
the state variables at a given time in the component.
The system of equations being solved is dependent
on the engine model which has been constructed, as the
number of equations will be defined by the number of
AeroMixingVolumes, StoredMassDucts and RotorShafts
in the model. The system of equations can be expressed
as
(2)
subject to initial conditions. Xj(t=O)
= gj.
Multivariable Newton-Raphson Method
One method of solving the system of equations given
by Eq. (2) is the Newton-Raphson method. The Newton
Raphson method is an iterative numerical scheme used
to solve non-linear systems of equations. The following
section describes the development of the Newton
Raphson scheme through the use of a simple system of
equations. The implementation of the Newton-Raphson
scheme within the Java Gas Turbine Simulator is then
discussed.
Development - Consider the following simple system
of equations
11 (X,y)
0
12 (x,y)
0
(3)
Let x r, y = s, be the solution (a root) of the system.
Expanding each function as a Taylor series about a point
(X01 Yo) near the root in terms of (r - xo), (s -Yo), gives:
II(xO'yo)
+
alI (Xo' Yo)
ax
(r-xo)
(1 )
subject to initial conditions. Xj(t=O)
=
gj.
+
all (Xo,Yo)
ay
(r-yo)
Steady-state Simulation
The Java Gas Turbine Simulator attempts to determine
the steady-state conditions at the initial operating point
before proceeding to the transient analysis. For steady
state conditions, there are no changes in the x values
with respect to time. Thus, the derivative terms of Eq. (1)
are zero, and Eq. (1) can be written as
+
a/2 (x o,Yo)
ay
(r - Yo)
(4)
{Note: the subscript 0 for the point (xo, Yo) indicates that
this is the zeroeth estimate of the root. Subsequent esti
mates will be indicated with subscripts 1, 2, 3,.. etc.}.
The Java Gas Turbine Simulator Applet and Documentation was developed by John A. Reed. All rights reserved.
2. rearranging
All terms after the first derivative can be dropped if (xo,
YO) is sufficiently near to the root. From Eq. (3). the
functions fl' andh are equal to zero. Thus, Eq. (4) can
be written as
-fl(xo,yo) =
af1(xo'Yo)
ax
(r-x o )+
(14)
Din Eq. (14) can be replaced by its equivalent given
in Eq. (11), to give
afl(xo,Yo)
)
ay
(r-yo
(15)
-f2 (xo'yo)
=
af2 (xo, Yo)
ax
'
af2 (x O Yo)
(r-xo)+
ay
(r-yo)
The right hand side of Eq. (15) represent the
improvement in the estimate of the root R. Thus, an
improved point, VI' can be written as
(5)
Letting Al
rewritten as
=r - Xo,
=s - YO.
Eq. (5) can be
(16)
af1(xo'Yo) A}
ax
and A 2
Ll
afj(xo,Yo) A2
+
ay
Ll
=
-f (
)
I xo,Yo
af2 (xo,Yo) Al + af2(x O' Yo) A2
ay
ax
The system can then be evaluated based on VI and
the values of FI be determined. The system is solved
when each term in F is zero. In most cases this criteria is
relaxed so that convergence is achieved when
(6)
The two equations in Eq. (6) can now be solved
simultaneously for A 1 and A2. To aid in doing this, the
equations will be placed in matrix form. Let
(17)
where E is a tolerance value. If Eq. (17) is not satisfied.
VI and FI can be inserted into Eq. (16) for Vo and Fo.
respectively and another improved estimate of R (this
point would be designated as V2 ) as follows
(7)
(18)
(8)
This process is repeated until convergence is achieved.
As the point defined by the vector V begins to move
away from the initial point Vo. the Jacobian matrix, J, may
no longer give a good approximation of the changes in
the functions if]> h) with respect to the change in
dependent variables (x, y). When this occurs, a new
Jacobian matrix is calculated to be used in Eq. (16).
The partial derivatives used to generate the Jacobian
matrix are approximated by perturbating each of the
independent variables in turn by some value, 0:
The coefficient matrix containing the partial derivative
terms is
af1(XO'YO)
ax
afl(XO'YO)~
ay
(9)
[ af2 (x o'Yo) af2 (x o,Yo)
ay
ax
which is known as the Jacobian matrix, J. Eq. (6) then
becomes
fl (x+ o,y) -
(10)
fl(x,y)
o
The system can be solved by inverting the Jacobian
matrix and solving for D
afl(x,y)
fl (x,y+ 0) - fl (x, y)
dy
o
(11 )
af2 (x,y)
ax
The values of rand s can be determined from the
definition of A given above:
o
f 2 (x, y + 0) - f 2 (x, y)
AI=r-xo
A2=s-yo
f 2 (x + 0, y) - f 2 (x,y)
o
(12)
(19)
The Newton-Raphson method developed above for
the simple two-equation system can be applied to a
system with any number of equations.
Eq. (12) can then be written in matrix form as
(13)
2
The Java Gas Turbine Simulator Applet and Documentation was developed by John A. Reed. All rights reserved.
3. of the previous iteration. The ratio is
Implementation in the Java Gas Turbine Simulator
The Netwon-Raphson method implemented in the Java
Gas Turbine Simulator follows the same methodology as
was developed above. The computer algorithm
implements additional parameters which are used to
provide better control over the balancing operation. In
the Java Gas Turbine Simulator the independent
variables are denoted by VS and the dependent variables
by VDOT, and Eq.(2) may be written as
VDOTi(VS j )
0 i
=
n
TOLPCG
=G
=
~j_=~l_________________
(27)
n
:L [E(i)new - E(i)old] previous
j=
I
When TOLPCG is less than a user-defined value, a
new Jacobian matrix is calculated.
Jacobian matrix Calculations - Since the Jacobian
matrix is generated using finite differences. the
perturbation size is important: too large of perturbations
introduce errors due to the non-linearities of the system,
and too small perturbations introduce numerical error. A
tuning mechanism is used to attempt to optimize the
sizes of. the perturbations. The "goodness" of the partial
derivative is determined by calculating
1.2.3 ..... n; j = 1,2,3•...• n
subject to initial condilions: VSj(t=O)
:L [E(i)new - E(i)old]current
(20)
j•
In the Java Gas Turbine Simulator implementation of
the Newton-Raphson method. the dependent term
(VD01) are normalized by the corresponding
independent variable (VS), to form the error term, E.
which is then used in place of the dependent variable in
the Newton-Raphson scheme.
(28)
Ei
VDOT j
--
(21)
VS j
for each of the state variables (VS) and then checking if
Thus, Eq.(20) is
Ej(VSj )
0 i
TOLl SXXXS TOL2
=
1.2.3•...• n; j = 1.2.3,.... n
where TOLl and TOL2 are user-defined values defining
the tolerance band. If all of the X:XXs fall within the toler
ance band, the matrix is considered "good". If a pertur
bation does not fall within the tolerance band, the
perturbation is scaled to try to force the X:XXs within the
tolerance band. by the following
The Jacobian matrix is then
As above the Jacobian is computed using a finite
difference perturbation,
Ei(VS + b)j-Ej(VS)j
b
(29)
(22)
yyy
(24)
(TOLl + TOL2)/2
XXX
(30)
Additionally, a second scaling factor. FRAC, is used to
give control over the size of the perturbation. FRAC is a
user-defined constant. The new perturbation is then
Once the Jacobian matrix has been computed, the
solution of the system at the current point is improved
using Eq.(16)
b(i)new
b(i)old' YYY . FRA C
(31)
User Control Panel for Newton-Raphson Method
The user-defineable parameters described above are
presented to the user through a Steady-state Solver
Dialog in the Java Gas Turbine Simulator. This provides
the user with complete interactive control over the
operation of the Newton-Raphson steady-state solver.
These parameters are shown in Table 1.
(25)
VSnew is then used to generate a new error vector,
Enew Convergence is satisfied when the magnitude of all
of the error vector terms is less than some user-defined
tolerance, e.
(26)
During an attempt to solve the system, the Jacobian
matrix is used unlil it no longer gives a good
approximation of the changes in E with respect to the
changes in VS. The decision to compute a new Jacobian
matrix is based on the ratio of the the sum-squared error
of the current iteration divided by the sum-squared error
3
The Java Gas Turbine Simulator Applet and Documentation was developed by John A. Reed. All rights reserved.
4. (33)
Table 1: Newton Raphson Steady-state Solver
Control Parameters
convergence
tolerance
£
lower partial
limit
TOL1
upper partial
limit
TOL2
(34)
A floating-point
values used to test
convergence of the
system to steadystate
User Control Panel for Steady-state Fourth-order
Runge-Kutta - The user-defineable parameters for the
steady-state fourth-order Runge-Kutta method are
presented to the user through a Steady-state Solver
Dialog in the Java Gas Turbine Simulator. The user
defineable parameters are shown in Table 2.
Lower band tolerance
value used in scaling
perturbations
Table 2: Fourth-order Runge-Kutta Steady-state
Solver Control Parameters
Upper band tolerance
limitvalue used in
scaling perturbations
time step
convergence
rate
TOLPCG
Floating point value
used to control when
a new Jacobian
matrix is calculated
fraction
FRAC
A floating-point value
used to scale the
perturbations used to
compute the partial
derivatives in the
Jacobian matrix
Floating point value
of time step
convergence
tolerance
Maiximum number of
iterations allowed in
attempting to
balance system to
steady-state
maximum
iterations
Lt
£
A floating-point
values used to test
convergence of the
system to steadystate
maximum
iterations
Maiximum number of
iterations allowed in
attempting to
balance system to
steady-state
Transient Simulation
Four numerical methods are currently included in the
Java Gas Turbine Simulator to provide transient analysis
capability: Improved Euler, Fourth-order Runge-Kutta,
Adams, and Gear.
Fourth-order Runge-Kutta Method
A fourth-order Runge-Kutta method is available in the
Java Gas Turbine Simulator to balance the engine at
steady-state. This method was provided for the cases
where the Newton-Raphson method failed to converge.
The fourth-order Runge-Kutta method is also used as a
transient
solver,
and
the
development
and
implementation of the method in the Java Gas Turbine
Simulator is discussed in a later section. For use in
determing the steady-state solution to the system of
equations, the Runge-Kutta method is run essentially as
transient, with the exception that the time-dependent
engine variables (fuel flow rate, variable geometry, etc)
are held constant at their inital operating points.
Convergence is satisfied when the magnitude of all of
the error vector terms is less than some user-defined
tolerance, £.
Improved Euler Method (Huen's Method)
Development - Before discussing the development of
The Improved Euler, or Heun's method, it is beneficial to
discuss Euler's Method. Euler'S Method is used to solve
the first-order, ordinary differential equation:
dx
dt
=
(35)
f(x, t)
subject to initial conditions Xj(t=O) = gj.
One method to
approximating the solution of
Eq.(34) is to use a Taylor's series expansion about the
point ti:
(32)
Xi+ 1 =
Xi + f(ti' Xi)Lt +
df(t;, Xi) (Lt)
dt
2f
where
(36)
where Xi denotes x(tJ, xi+l denotes x(ti+l)' and Lt
4
The Java Gas Turbine Simulator Applet and Documentation was developed by John A. Reed. All rights reserved.
=
5. x
x
--f(x,t)
.J"""
...........
I
I
av=~ L. att
i
I
I
~--~----------~----~~t
~--~------------~----~t
~
t·1
~+l
Figure 1 -Graphical Representation of Euler's Method
Figure 3 - Graphical Representation of Euler's Method
(Ii+) - IJ. If the derivative terms are ignored, the resulting
terms are the algorithm for Euler's method.
predictor equation. Graphically, this is shown in Figure 2.
The slopes at the beginning and the end of the
interval can now be averaged and used to extrapolate
the value xi+}'
(37)
This can be illustrated graphically in Figure 1.
As can be seen from the figure, considerable error
can result from the combination of taking a large time
step in the area where the change in the derivative is
high. To provide accuracy and numerical stability, the
time step must be small. This requirement can
significantly increase the computing time of a simulation.
The source of error in Euler's Method is that the slope
at the beginning of the interval is used across the entire
interval. To improve the estimate of the slope over the
interval, the derivatives at initial and end pOints are
evaluated. These two values are then averaged and
used as the slope across the entire interval. This is the
Improved Euler or Heun's Method. The method begins
by utilizing Euler's Method as given in Eq. (36) to
determine the slope at the end of the interval.
(39)
Eq. (38) is called the cOffectorequation. As a result of
averaging the slope across the interval, the error in Xi+}
is reduced as can be seen in Figure 3. Summarizing the
above:
(40)
(41)
Because xi+} appears on both sides of Eq. (40), it can
be applied iteratively to improve the estimate of Xi+}- This
process will not necessarily converge on the true value
of Xi+}> but rather on an estimate with a finite truncation
error.
(38)
The slope at Ii+} can now be evaluated. Because the
slope at the end of the interval is based on an estimated,
or predicted value of Xi+ j. Eq. (37) is known as the
Implementation in the Java Gas Turbine Simulator
The Improved Euler method implemented in the Java
Gas Turbine Simulator follows the same methodology as
was developed above with one exception. In the Java
Gas Turbine Simulator implementation of the Improved
Euler method, the error term is re-defined by using the
improved Euler approximation given in Eq. (38):
x
xl+.
t__ --------
[VS(t+M)-VS(t)]
W[VDOT(t+At) + VDOT(t)]
E = --------------~----------------
vS(t)
(42)
where theVSt + M term is updated by the following until
convergence is reached
~----~----------~----~~t
~+1
Figure 2 -Graphical Representation of Predictor
5
The Java Gas Turbine Simulator Applet and Documentation was developed by John A. Reed. All rights reserved.
6. Fourth-order Runge-Kutta Method
(43)
Development - The accuracy of a solution to a
differential equation obtained by a Taylor's series
expansion of the object function is determined by the
number of higher-derivative terms which are retained in
the expansion. For all but the simplest equations, the
higher-order derivatives become quite complicated and
no simple algorithm such as Euler'S method can be
developed.
However, the German mathematicians Runge and
Kutta developed one-step procedures which use only
first-order derivatives, but produce accuracy's equivalent
to higher-order Taylor's series expansions. Runge-Kutta
methods vary but all are of the form:
As above, convergence is satisfied when the
magnitude of all of the error vector terms is less than
some user-defined tolerance, £.
(44)
Since the Java Gas Turbine Simulator implementation
of the Improved Euler method utilizes a Jacobian matrix,
the discussion on the Jacobian matrix calculations given
in the Newton-Raphson method is also applicable here.
User Control Panel for Improved Euler Method
The user-defineable parameters for the Improved Euler
method are presented to the user through a Transient
Solver Dialog in the Java Gas Turbine Simulator. The
user-defineable parameters are shown in Table 3.
(45)
where ~(xi' ti' 81) is called the increment function,
which can be thought of as an average slope over the
interval. The increment function can be written as
Table 3: Improved Euler Transient Solver
Control Parameters
time step
8t
Floating point value
oftime step
convergence
tolerance
£
A floating-point
values used to test
convergence of the
system to steadystate
lower partial
limit
TOL1
Lower band tolerance
value used in scaling
perturbations
upper partial
limit
TOL2
Upper band tolerance
limitvalue used in
scaling perturbations
(46)
where the a's are constants and the k's are defined as:
Maiximum number of
iterations allowed in
attempting to
balance system to
steady-state
maximum
iterations
convergence
rate
fraction
The recurrence of the k terms make Runge-Kutta
methods ideal for computer calculations. The order of
the Runge-Kutta method is specified by the value of n.
Thus, for a fourth-order Runge-Kutta method, n=4. The
derivation of the fourth-order method is algebraically
complex and is not include here.
Implementation in the Java Gas Turbine Simulator
The fourth-order Runge-Kutta method used in the Java
Gas Turbine Simulator is the classical fourth-order
method, where
TOLPCG
Floating point value
used to control when
a new Jacobian
matrix is calculated
a}
a2
FRAC
A floating-point value
used to scale the
perturbations used to
compute the partial
derivatives in the
Jacobian matrix
= 1/6,
=1/3,
a3 = 1/3,
a4=
p}
P2
= 1/2,
=1/2,
P3 = 1,
qll = 1/2
q2} = 0
q3} = 0
,q22
,Q32
= 1/2
=0,
Q33
=1
1
The increment function is
~
1
=
1
1
tiki + 3k2 + 3 k3 + k4
(47)
Substituting this into Eq.(44) gives
(48)
6
The Java Gas Turbine Simulator Applet and Documentation was developed by John A. Reed. All rights reserved.
7. where
k2 =
!(ti+~6t'Xi+~klM)
k3 =
!(ti+~6t'Xi+~k26t)
k3 = !(ti + 6t, Xi + k3 M )
User Control Panel for Transient Fourth-order
Runge-Kutta - The user-defineable parameters for the
Improved 4th-order Runge-Kutaa method are presented
to the user through a Transient Solver Dialog in the Java
Gas Turbine Simulator. The user-defineable parameters
are shown in Table 4. 2.
Table 4: Fourth-order Runge-Kutta Transient
Solver Control Parameters
time step
6t
Floating point value
of time step
Adams and Gear Methods
A ordinary differential equation solver package
developed by A.C Hindmarsh is also used to provide
transient analysis of the system. Two solver options from
the solver package, Livermore Solver for Ordinary
Differential Equations (LSODE), was included with the
current version of the Java Gas Turbine Simulator. The
LSODE code uses multi-step methods with varying time
step size, thus no user defined time step is required.
Additionally, the convergence tolerances are defined
interally and not by the user.
User Control Panel for Adams and Gear Methods
There are no user-defineable parameters for the implict
Adams and the Gear methods.
7
The Java Gas Turbine Simulator Applet and Documentation was developed by John A. Reed. All rights reserved.