CARVER, Pseudo Characteristic Method of Lines Solution of First Order Hyperbolic Equation

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Mathematicsand computers in Simulation XXII (1980) 30-35

North-HollandPublishing Company

PSEUDO-CHARACTERISTIC METHOD OF LINES SOLUTION OF


FIRST-ORDER HYPERBOLIC EQUATION SYSTEMS *

M.B. CARVER
Atomic hnerg? o/Canada I.td., Chalk River Nuclear Laboratories. Chalk River, Otltario KOJ IJO, Canada

SUMMARY directionally weighted methods. In fact the correct,


or upwind direction is dictated by the method of
First-order hyperbolic partial differential equations characteristics7, but is normally obvious from the
are difficult to solve numerically because of their physical situation.
ability to transmit steep waves. It is well known
that the method of characteristics is the natural However, in conservation equations, variables are
method for such equations, as it precisely follows usually coupled in a nonlinear fashion, and waves may
wave interactions. HOWeVer, a characteristic solution propagate in both directions, thus directional strat-
is expensive, as it requires repeated solution of non- egy is not made obvious by physics, or by the appear-
linear algebraic equations. This gives considerable ance of the equations in conservation law form.
motivation to the development of fixed grid numerical Furthermore, non-rigourous application of upwind
schemes. techniques is known to give poor results". In con-
trast, the characteristic form of stating the same
Unfortunately any attempt to use a finite fixed grid equations explicitly defines the governing directions,
generates spurious numerical oscillation and disper- and it has only recently been pointed out that these
sion, which must be minimized by artificial damping or may be utilized to guide the rational formulation of a
directional differentiation. For sets of hyperbolic directional finite difference scheme"". Suc.h d
equations, the appropriate assignment of damping or characteristic finite difference scheme has been
direction is difficult to determine, as variables are successfully incorporated in a production code for
coupled in non-linear form. HOWeVer, a clear defini- transient two-phase flow simulation'.
tion of directionality is given in the characteristic
form of the equations, and may be used to develop a On further investigation it becomes apparent that the
pseudo characteristic fixed grid statement of the characteristic form may be used in a similar manner to
equations, which is readily solved by the method of formulate a characteristic method of lines scheme
lines, is simple to implement, and produces stable which eliminates the necessity of the matrix inversion
accurate solutions. required by the characteristic finite difference
scheme, and also introduces the possibility of "sing
Applications are illustrated for the solution of higher-order methods in time and space'.
equations describing shallow water flow, and compres-
sible gaseous flow. The method of lines is used collectively to refer to a
class of methods in which piecewise approximation
INTRODUCTION functions are used to represent spatial variation and
to transform partial differential equations, PDEs into
First-order hyperbolic partial differential equations coupled sets of ordinary differential equations, ODES.
(PDEs) are an extremely important class, as they arise
inevitably in the modelling of any transient flow sit- A general one-dimensional PDE set may be written
uation, and are deceptively difficult to solve numeri- .
cally. This difficulty is principally due to their ~i(x,t,","t'"x,"tt,"~~,"~t,...'v."t'...) = 0 (1)
inherent ability to transmit spatial discontinuities
without dissipation. The method of characteristics is
recognized as the natural procedure for solving such i=l,NPDE
equations as it is formulated to precisely follow wave
This requires repeated expensive Conversion to ODE form is accomplished by representing
interactions&.
nonlinear algebraic equation solutions or iterations, the spatial variation of u, v, etc., in terms of
but does permit the propagation of steep fronted spatial basis functions B(x) and discrete values of u.
1
waves. at nx points:

In contrast, fixed grid schemes are inexpensive and


simple to implement. However, symmetric fixed grid u,(x,t) = F Bi(x)ui(t) (2)
finite difference and finite element schemes develop i=m
spurious numerical oscillations in the neighbourhood
of steep fronted wa~es~~, and may be used successfully where l'm 5 n 5 nx and (n-m) is the order of coup-
only for systems in which response is slow and spatial ling in space. The approximation (2) is substituted
gradients are not severe6. Numerical oscillation may in (l), and algebraic manipulation produces a set of
be reduced either by using directional differentia- k=nx*NPDE coupled ODES.
tion, or adding artificial damping terms to the equa-
tions, in fact these alternatives are equivalent, as [AIWtl = [Bl WI + [Cl (3)
directional differentiation is dissipative. A multi-
tude of such schemes have been proposed, and the mnre where A, B and C are k square matrices and u, u and k
popular are summarized in references 3 and 11. column vectors containing the values of the spa E,
la1
variable and its time derivative at each point.
A single first order hyperbolic equation, such as the
advective equation discussed in reference 3, or loosely The choice of the spatial approximation polynomial B
coupled equation sets such as those describing flow in and its subsequent handling defines the particular
linear heat exchangers', may be solved efficiently by method. If (2) is applied in an explicit sense a

l This paper was presented at the 3rd IMACS International Symposium on Computer Methods for Partial Differential
Equations held at Lehigh University, Bethlehem, Pennsylvania, USA, on tune 20-22, 1979.

30
MB. Carver i Pseudo-charactrristic method of iincs 31

finite difference method of lines evolves with However, by transformation, equations (5) may be
[Al=[Il, otherwise, if (2) is applied in an implicit written in a form to which the application of (6)
weighted residual sense, a finite element method of gives entirely stable results.
lines evolves, and [Al is banded and symmetric except
for the particular case of upwind weighting'. It is convenient to change variables to s = gh and
c = /s such that the matrices now become
In either case, the resulting ODES may be integrated
by an efficient digital algorithm which will normally
vary the time step as integration progresses to obtain $ = [j, Al = E ;], G1 = [;x] (7)
optimal compliance with an imposed tolerable error
-1
limit. Performing a similarity transform BA B to extract the
diagonal eigenvectors gives:
The method of lines is extremely flexible as it com-
prises an infinite number of combinations of spatial
approximation functions and integrators, any of which
may be applied to the same equation system. The (8)
equations are programmed in general form, and the
appropriate combinations are selected to operate on
the equations to produce the solution.
Expanding (8) gives the characteristic form
In particular, for hyperbolic equations, a number of
directionally weighted schemes may be developed.
c e + 2 + ("+c)(c g + E) + gcyx = 0 (94
Several of these, including upwind Lagrangian, Hermite,
spline, and weighted residual are reviewed for "se
with the advective equation in reference 3.
c g - g + (u-c)(c $ - E) + gcyx = 0 (9b)
This paper extends the same approach to coupled PDE
systems by identifying the characteristic directions The requisite directional weighting for equations (9a)
and transforming the resulting matrix equations into and (9b) is now dictated by the sign of (u+c) and
an explicit form. (u-c) respectively. Following Hancox et al' one can
assign a directional difference scheme for the spatial
THE PSEUDO-CHARACTERISTIC METHOD OF LINES derivatives of each equation, invert the B matrix and
integrate the equations
(a) Incompressible Fluid Flow
Gt = -B-?J?B@~ - G} (10)
For simplicity, the method is first illustrated for
two equations describing the flow of fluid over an
It is a simple matter, however, to obtain an explicit
isolated ridgelo. If m is the mass flux, h, the
definition of $I which is fully equivalent to (10) by
depth, and y is the local slope of the ridge, these
performing the katrix inversion analytically. When
equations ma? be written in conservation law form as
derivatives originating from (9a) and (9b) are des-
ignated + and -, to show differentiation will be in
g [@I + 2 [F($)l = D(0) the direction dictated by the component along (u+c) or
(u-c) respectively, this gives
where
~+;(~+~,+*(&+&)+
+ - + -
$+],Fz [f+'],D=[-p]

+~(~-~)++&+)+ghyx=O
- - + -
the primitive form follows directly,

g+? (s+$)
au +g+c,
+ - + -
(5) +z$&_&, +$(&-$) =o (11)
ah+h&+"ah=, + - + -
at ax ax
Using both symmetric and assymmetric differentiation Note that only terms involving (u+c) and (u-c) have
formulae, Heydweiler and Sincovecg were unable tn been directionally differentiated, y, is not a depend-
obtain stable solutions to equations (5) until they ent variable.
added an arbitrarily large second derivative artificial
dissipation term to each of the equations (5). One may now solve equations (11) directly by the
Principally this is because it is impossible to method of lines, incorporating any suitable direc-
develop a rationale for assigning a directional bias tional approximation to the derivatives, such as (6)
to any spatial derivative term in the primitive form or the higher order methods reviewed by Carver and
of equation (5). In fact, waves propagate in both Hinds3.
directions and the obvious upwind difference scheme
used for single equations. the simplest form of which It is instructive first to apply the simplest first-
expresses terms such as order formula (6) to equations (11). Thus if

aw (w~-wi_l)
Q =s uipi - P~_~~)/Ax (6) -= and a~
&J
=
(wi+l-wi)
(12)
ax+
ax
AX AX

where s is the sign of ui, also gives unstable re-


sults"!
and E is volumetric energy, p pressure and Q,f repre-
(13)
sent heat transfer and friction and Xx is the eleva-
tion gradient.
wi+~-20i+wi-~ 2
= -2Ax(+ Introducing the speed of sound and the equation of
AX
ax2 state produces the primitive formulation:
2
where (adax) and (a dax2) are three-point symmetric
$$+A&=D
first and xc&d derivative formulae.
(18)
Inserting these formulae into (11) gives:

2 2
2 + " $ + $- + cAx q + ++ = ghyx
c ax c ax The similarity transform again produces the character-
c istic form. D=O is now used merely for brevity.
(14)
2 2
g + c2 +- + u & + ucAx 2 + cAx Q = 0
a a
ax Bz$+"Bx@=BD
c c ax axf
Note that equations (14) are now the primitive form of
the equations (5) plus explicitly defined dissipative (19)
terms, all expressed to second-order accuracy.
Similar expressions may be derived starting with
or
higher-order expressions in place of equations (13).
In particular, the two most accurate explicit formu-
au ap au ap
lations reviewed in reference 3 may be used readily (r x + s + (u+c)( P x + jy) = 0
with equations (14). They are the four-point upwind
Lagrange form
=2 ap _ g
at + (C 2 zap - ix,
ax = 0 (20)
&"(I)) = SI(U(I-2SI) - 6U(I-SI)
-p-+-+ au ap (-c)(-pg+g) = 0
+ 3U(I) + 2U(I+SI))/6Ax (15) at at
and the three-point upwind Hermite expression Explicit equations for au/at, etc. may now be obtained
by inverting the B matrix and assigning the subscripts
&J(I)) = sI(u(I+sI) + 4U(I) +, ., - to derivatives to be computed according to the
directions dictated by the (u+c), u, (u-c) vectors
respectively.
- SU(I-SI))/4Ax - + 2 (U(I-SI)) (16)
2
. Houghton
The example used by - and Kasahara. and Heydweiler g + ;(g + g) + %(& + $-)
and Sincovec will be used. This is equations (5) with + - + -

y(x) = max[0,10-10(x/40)2] +~(g-?L)+!A$E(~_&)=o


+ - + -
"(0,x) = 60, h(O,x) = 20-y(x),
g+y(&+&, +gp(g+g) (21)
u(t,-400) = u(t,+400) = 60, + - + -
h(t-400) = h(t,+400) = 20. +&+_&, +2&-g) =0
+ - + -
The solution develops a major stationary shock down-
stream of the ridge, and smaller fronts move both up-
stream and downstream.

Figure 1 shows the solution at t=2, obtained using the


formulae (12), (15) and (16) respectively in equations
(14), and clearly illustrates the discontinuities
developed. Figure 2 shows a typical unstable solution
Once again, having chosen any suitable formula to
obtained by using symmetric differencing of the prim-
compute the directional derivatives, it may be shown
itive equations and progressive stabilization by the
that equations transform into a higher-order symmetric
addition of arbitrary dissipative terms.
approximation to the primitive form (18) with specifi-
cally defined second derivative dissipative terms
(b) Equations of Compressible Flow
added. Reference 2 develops this, and shows tests
illustrating that the pseudo characteristic formula-
Following similar principles, the Eulerian equations
tion (21) caters for flow reversals and choking flow,
governing one-dimensional compressible flow may be
as these automatically influence the difference scheme
expressed in conservation law form similar to equation
through the characteristic directions. Here we quote
(4), where now only one example, the standard shock tube problem
discussed by Sod", who considers a tube of unit
length with initial conditions:
(17)
e < x < 0.5: p = p = 1.0, u = 0
0.7 < x 5 1.0: p = 0.1, p = 0.125, u = 0
M.B. Carver 1 Arudo-characteristic mctLml of lines 33

Fig. 1. HYDRAULIC JUMP PROBLEM Fig. 2. HYDRAULIC JUfiPPROBLEM


Pseudo Characteristic Methods Central Difference Methods

CENT?IRL OIFFERENCE METHOD QLPHQ = 75.


o IICCC_IIE
~ lhLmzlTI
. npr*

CENTRUL OIFFERENCE METHOD RL3HR = 160.

100

CENTRAL DIFFERENCE METHOD RLPHR = 200.0


34 M.B. Carver / ~sl,seudo-characteristic rnrthod of lines

Fig. 3. SHOCK TUBE PROBLEM Fig. 4. SHOCK TUBE PROBLEM

PSEUDO CHARRCTERISTIC SIMPLE 2PT


.mcss
L UuxlTI
. oEI6liT

CENTRRL 01 F-F-EKENCE METHOD IJLPHA ,001

X COOROINRTE X COOROINRTE

PSEUDO CHARACTERISTIC HERMITE UW

CENTRDL DIFFERENCE METHOU liLPHD = .ooE;


M.B. Carver f Pseudo-characteristic method oflines 35

This problem does not involve flow reversals or the REFERENCES


associated change in boundary conditions, but the
large pressure ratio generates shock and rarefaction 1 F.W. Barclay, D. Bean and R.W. Niemann, "RAMA: A
waves resulting in four slope discontinuities in the Computer Code for Analysis of Transient Two-Phase
pressure profile. Figure 3 shows the pressure pro- Flow in Pipe Networks", Proceedings, IASTED
files obtained from the three pseudo characteristic Conference on Simulation and Modelling in Energy
methods (12, 15, and 16) and results obtained by Systems, M.B. Carver, Editor, Acta Press, Calgary
symmetric differentiation. These may be compared to a (1978).
number of popular schemes for the conservation equa-
tions reviewed by Sod", and it will be noted that the 2 M.B. Carver, "Pseudo Characteristic Method of
simple PC method appears more accurate than the popu- Lines Solution of the Conservation Equations"
lar Lax-Wendroff, MacCormack and Rusanov methods, and submitted to J. Comp. Phys. (1978).
that the higher-order PC methods compare very favour-
ably to the more complicated methods reviewed. The PC 3 M.B. Carver and H.W. Hinds, "The Method of Lines
method achieves comparable accuracy, is considerably and the Advective Equation", Simulation 31
easier to implement, even simpler to switch from one (1978) 59.
form to another, and has its foundation squarely in
the physics, not relying on numerical stabilization 4 R. Courant, E. Isaccson and M. Rees, "On the
artifacts. Solution of Non-linear Hyperbolic Equations by
Finite Differences", Comm. Pure & Appl. Math., 1,
Finally, it is of interest to review what happens to (1952) 243.
the example problem when symmetric differencing with
arbitrary artificial dissipation terms are added. 5 D. Firth, M. West, D.J. Poole & F. Walkden, "High
Figure 4 shows results obtained for the same problem Intensity Sound in a Lined Duct", Journal Sound &
from the conservation statement of the equations with Vibration, 34 (1974) 261.
an artificial dissipation term cx(a'/ax*)@ added. It
becomes obvious that the dissipation required to 6 R.L. Gorton, "Application of Finite Difference
stabilize causes excessive attenuation. Methods to Transient Steam Flow in Power Plant
Piping", Fluid Transients and Acoustics in the
BOUNDARY CONDITIONS Power Industry, ASME publication, 1978.

The correct formulation of boundary conditions in W.T. Hancox and S. Banerjee, "Numerical Standards
systems of conservation equations causes considerable for Flow Boiling Analysis", Nucl. Sci. & Eng. 64
concern, as the number, location, and form of boundary (1977) 106.
restraint is not always apparent from the physics or
the mathematics, and an incorrect formulation will D.H. Herron and D.U. Von Rosenberg, "An Efficient
obviously destroy the solution. One recourse is to Numerical Method for Solution of Convective
avoid the problem altogether by banishing the bound- Transport Problems with Split Boundary Condi-
aries to infinity, and while this has been done in tions", Chem. Eng. Sci. -21 (1966) 337.
references 9 and 11 for the two examples quoted here,
such an approach is not helpful for applied problems. J.C. Heydweiler and R.F. Sincovec, "A Stable
Difference Scheme for the Solution of Hyperbolic
Although the presence of three first-order equations Equations Using the Method of Lines", J. Comp.
in three variables suggests that three boundary Phys. z (1976) 377.
restraints are required, in fact this is not so. The
number and nature of the boundary conditions is dic- D.D. Houghton and A. Kasahara, "Nonlinear Shallow
tated by the flow configuration at any given instant, Fluid Flow Over an Isolated Ridge", Comm. Pure &
or more particularly the number and direction of the Appl. Math. -XXI (1968) 1.
characteristics at each boundary. Thus, a straight
flow through situation in a pipe requires two boundary G.A. Sod, "A Survey of Finite Difference Methods
conditions at the inlet, and one at the outlet, a for Systems of Nonlinear Hyperbolic Conservation
closed pipe with outflow requires one at each end, and Laws", J. Camp. Phys. 11, 1 (1978) 1.
a pipe experiencing inflow through both ends at any
given instant requires four conditions, these numbers R. Vichnevetsky et al., "Mean Square Measure of
being the number of outward pointing characteristics the Effect of Artificial Viscosity", Advances in
at each boundary for each situation, or equally the Computer Methods for Partial Differential Equa-
number of simple directional difference analogs(l2) tions II, R. Vichnevetsky, Editor, IMACS Press,
which are not satisfied within the pipe. It is thus Rutgers Univ. (1977) 119.
obvious that any scheme which is to cater for possible
flow reversal must not only represent this adequately
in the differencing scheme, but must also permit
dynamic change in the number and type of boundary
conditions. The pseudo characteristic method permits
both these operations to be performed automatically.

CONCLUSION

The pseudo-characteristic method of lines is one of


the few available methods which completely automates
integration time step selection, spatial differentia-
tion weighting and the handling of flow reversal and
choking flow. It is easy to implement in a general
fashion which permits selection between alternative
approximation functions, and derives its stability
directly from physical rather than numerical consider-
ations.

You might also like