Download - where the * denotes a dimensional quantity
CIS888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
0AuP2u
)1(RT
xA1
2u
)1(RT
t
x)T(R
xP
x)Au(
A1
t)u(
0x
)Au(A1
t
***2****
**
2****
*
*
**
*
*
*
*2**
**
**
*
***
**
*
We will apply several numerical methods to find a steady state solution of the unsteady quasi-1D equations of frictionless compressible flow.
For adiabatic, frictionless flow, i.e. isentropic flow, the governing equations in dimensional form are:
where the * denotes a dimensional quantity.
CIS888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Non-dimensionalization of governing equations
Non-dimensionalize using:P = P*/Pref; Pref = 1 Lref = 1 cm.T = T*/Tref; Tref = 1 tref = Lref/uref
/ref; ref = Pref/Rtref = 1/R t = t*/tref
u = u*/uref
RRTu ref2ref
2ref
*
LAA
CIS888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Non-dimensionalized governing equations
Since tref = Lref/uref, this simply reduces to:
Similarly, the momentum and energy equations reduce to:
0xuA
ALu
tt ref
refref
ref
ref
0xuA
A1
t
x
)T(1x
AuA1
t)u( 2
02
Au)1(uATxA
12u)1(T
t
32
CIS888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
MacCormack’s explicit method
Before proceeding with this numerical scheme, it is necessary to introduce artificial dissipation into each of the governing equations for stability:
2
2a
xxuA
A1
t
2
2a
2
xu
x)T(1
xAu
A1
t)u(
2
2a
32
xT
2Au)1(uAT
xA1
2u)1(T
t
CIS888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
MacCormack’s explicit method
Discretize the domain x [0,L] into N interior points and two boundary points labelled 0 and N+1, each spaced x apart:
Next, the predictor and corrector parts of the algorithm are applied at each time step for each governing equation, at all interior points.
… …
0 1 2 i N N+1
CIS888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Predictor equations (MacCormack’s explicit method)
n1i
ni
n1i2
na
ini
ni1i
n1i
n1i
i
ni
1ni
2)x(
)t(
AuAu)x(A
)t(
n
1ini
n1i2
na
ni
ni
n1i
n1i
i2n
ini1i
2n1i
n1i
ini
ni
1ni
1ni
uu2u)x(
)t(
TT)x(
)t(
AuAu)x(A
)t(uu
CIS888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Predictor equations (MacCormack’s explicit method) - contd.
n1i
ni
n1i2
na
i3n
inii
ni
ni
ni
1i3n
1in
1i1in
1in
1in
1ii
2ni
ni
ni
ni
21ni
1ni
1ni
1ni
TT2T)x(
)t(
Au2
)1(ATu
Au2
)1(ATu)x(A
)t(u
2)1(T
u2
)1(T
CIS888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Corrector equations
1n1i
1ni
1n1i2
1na
1i1n
1i1n
1ii1n
i1n
ii
1ni
ni
1ni
2)x(
)t(
AuAu)x(A
)t(21
1n1i
1ni
1n1i2
1na1n
1i1n
1i1n
i1n
i
1i21n
1i1n
1ii21n
i1n
ii
1ni
1ni
ni
ni
1ni
1ni
uu2u)x(
)t(TT
)x()t(
AuAu)x(A
)t(uu21
u
CIS888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Corrector equations - contd.
1n1i
1ni
1n1i2
1na
1i31n
1i1n
1i
1i1n
1i1n
1i1n
1i
i31n
i1n
ii1n
i1n
i1n
ii
21ni
1ni
1ni
1ni
2ni
ni
ni
ni
21ni
1ni
1ni
1ni
TT2T)x(
)t(
Au2
)1(
ATu
Au2
)1(ATu)x(A
)t(
u2
)1(Tu2
)1(T21
u2
)1(T
CIS888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Coefficient of artificial viscosity
One form for the artificial viscosity is as follows:
for the predictor step, and
for the corrector step.)x(uC n
ini
na
)x(uC 1ni
1ni
1na
• C=0.125 is a recommended value for this algorithm, for the non-dimensionalization shown in slide #2 of this lecture.
• Note that there is nothing special about this value of 0.125 - you are encouraged to try different values as well as different expressions for a and explore their effects on the final solution as well as on the convergence to the final steady state solution.
CIS888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Initial Conditions
• For obtaining supersonic solutions in the case study problem, you may prescribe any linearly decreasing pressure distribution p(x) from the inlet (say starting at a non-dimensional value of 1) to (say 0.015 at) the exit.
• Similarly, a linear profile can be prescribed for T(x) varying from 1 (non-dimensional) at the inlet to 0.2 at the exit.
• Linear for u(x) starting from 0.15 at inlet to 1.2 at exit. (x) can be calculated from P(x)/T(x).• None of these initial profiles are unique, but their
judicious specification can accelerate the solution to the desired steady state solution.
CIS888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Boundary Conditions• Inlet: Total pressure Po and Total temperature To are specified.– Implicitly extrapolate for u(i=0):
– Determine T(i=0) from total temperature To and extrapolated value of u(i=0):
)2i(u)1i(u2)0i(u
0)2i(u)1i(u2)0i(u0x
u
inlet2
2
2
)0i(u)1(T)0i(TT2
u)1(T2
oo2
CIS888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Boundary Conditions (contd.)
– Before finding (i=0), first find P(i=0) from assumption that flow is isentropic (i.e. loss-free) from supply to inlet, and from specification of Po and To:
)1(
oo
)1(oo
o
o
TTP)0i(P
TT
PP
TPandPP
– Now determine (i=0) from:
)0i(T)0i(P)0i(
CIS888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Boundary Conditions (contd.)• Exit:
– To find supersonic solution, implicitly extrapolate for all computed variables:
)1Ni(u)Ni(u2)1Ni(u0)1Ni(u)Ni(u2)1Ni(u0
xu
exit2
2
)1Ni()Ni(2)1Ni(0)1Ni()Ni(2)1Ni(0
x exit2
2
)1Ni(T)Ni(T2)1Ni(T0)1Ni(T)Ni(T2)1Ni(T0
xT
exit2
2
CIS888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Boundary Conditions (contd.)– Pressure is determined from the equation of state:
P(i=N+1) = (i=N+1)T(i=N+1)• Note that a supersonic steady state solution can also be
obtained by prescribing a pressure at the exit plane that is low enough. What the exact value of this pressure would be cannot be determined a priori for more complicated problems.
• Specification of a Pexit that is higher than this value for supersonic flow results in the formation of standing normal shock waves in the diverging portion of the C-D nozzle.
• You are encouraged to experiment with these various boundary conditions in your homework assignments.
CIS888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Courant condition• Using Fourier stability analysis, it can be shown
that this scheme is stable provided a(t)/(x) 1.
• The quantity a(t)/(x) is called the Courant number and a(t)/(x) 1 is called the Courant condition, where a is the relevant speed of sound in the problem.
CIS888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
FTBS (Forward in Time, Backward in Space) Scheme
Given equations of the form , we forward difference in time and backward difference in the spatial coordinate:
This is valid for a > 0. For a < 0, a forward difference in space must be used. This FTBS scheme is also called an upwind scheme.
xFa
tG
n1i
ni
ni
1ni
n1i
ni
ni
1ni
FF)x()t(aGG
)x(FF
a)t(GG
CIS888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
FTBS method applied to Quasi-1D flow
•Discretize the domain as before with MacCormack’s method (slide#5).
•Next, apply FTBS to the non-dimensionalized equations, and add artificial dissipation to each equation:
n
1ini
n1i2
na
1in
1in
1iini
ni
ini
1ni
2)x(
)t(
AuAu)x(A
)t(
CIS888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
FTBS method - contd.
n
1ini
n1i2
na
n1i
n1i
ni
ni
i2n
1in
1ii2n
ini
ini
ni
1ni
1ni
uu2u)x(
)t(
TT)x(
)t(
AuAu)x(A
)t(uu
CIS888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
FTBS method - contd.
n1i
ni
n1i2
na
1i3n
1in
1i1in
1in
1in
1i
i3n
inii
ni
ni
ni
i
2ni
ni
ni
ni
21ni
1ni
1ni
1ni
TT2T)x(
)t(
Au2
)1(ATu
Au2
)1(ATu)x(A
)t(u
2)1(T
u2
)1(T
CIS888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Coefficient of artificial viscosity
A form for the artificial viscosity is as follows:)x(uC n
ini
na
• C ranging from 0.125 to 3 is recommended for this algorithm, for the non-dimensionalization shown in slide #2 of this lecture, and may be required to vary with spatial location as well.
• Note that there is nothing special about this range of values for C - you are encouraged to try different values as well as different expressions for a and explore their effects on the final solution as well as on the convergence to the final steady state solution.
CIS888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Stability, ICs and BCs
• As with the MacCormack scheme, a Fourier stability analysis shows that the Courant condition a(t)/(x) 1 must be satisfied for stable time-marching using the FTBS or first order upwind explicit scheme.
• Similar stability analysis for the FTCS (Forward in Time, Central differenced in Space) is always unstable.
• The BTCS or Backward in Time, Central differenced in Space is unconditionally stable.
• Initial conditions are same as described in slide #11.• Boundary conditions are same as described in slides #12-#15.
CIS888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
• There are problems involving multiple time scales, where stiffness of the set of equations forces you to take (t) smaller than the maximum (t) allowed by the Courant condition for explicit methods.
• This makes computational time immense, so that it is necessary to use implicit methods for such multi-time scale problems.
• Note that time steps in implicit methods are not strictly governed by the Courant condition.
CIS888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Detour on StiffnessConsider the initial value problemwith y(0)=1.Suppose we apply a simple explicit method such as Euler’s Forward Method:
The exact solution to this problem is of course
ydtdy
nnn1n
nn
n1n
y)t(1y)t(yy
ydtdy
)t(yy
te)t(y
CIS888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Let us define the error, , as
.tttwherey)t(y)t(
y)t(y)t(
n1n1n1n1n
solutioncomputed
n
solutionexact
nn
)methodnumericalofstabilityondependent(ErroropagationPr
n
)schemenumericalofaccuracyondependent(ErrorTruncation
n)t(
nnn)t(
1n
n)tt(
1n
)t()t(1)t(y)t(1e)t(y)t()t(1)t(ye)t(or
y)t(1e)t( n
CIS888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
Now suppose =106 and tn=2.763x10-5 Suppose the error tolerance is desired to be
and that
we only have to satisfy
provided we do not amplify the previous error (tn). 1263.27n 10~e)t(y
41n 10)t(
4n 10x5.0~)t(
8n
4)t( 10
)t(y10))t(1(e
100tor10)t(or
10))t(1(e8
8)t(
CIS888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering
But this means that• Assuming this yn is only one component of a larger system,
this is unacceptable because the step size for the rest of the equations is determined by the time scale of a component which has decreased by 12 orders of magnitude (from 1 to 10-
12) and is probably of no further physical interest! • Another way to view this is that 1/ is the time constant. The
smaller the time constant, the smaller must be the time step just to maintain stability.
• Thus, for stiff equations, the step size depends almost entirely on the stability of the numerical method and not on the accuracy. This is best resolved by using implicit methods which are unconditionally stable.
!10x1tor210x5.0
10)t(1 64
4