Content uploaded by Johan Heyns

Author content

All content in this area was uploaded by Johan Heyns on Oct 31, 2015

Content may be subject to copyright.

9th OpenFOAM Workshop

23-26 June 2014 in Zagreb, Croatia

Modelling high-speed ﬂow using a matrix-free

coupled solver

Johan A Heyns∗1, Oliver F Oxtoby1and Adriaan Steenkamp2

1Aeronautic Systems, Council for Scientiﬁc and Industrial Research (CSIR), Meiring Naude

Road, Pretoria, South Africa, jheyns@csir.co.za and ooxtoby@csir.co.za

2Flamengro a division of Armscor Research and Development SOC Ltd., Armscor Building,

Nossob Street, Pretoria, South Africa, adriaans@armscor.co.za

Key words: Density-based, Compressible ﬂow, Coupled solver, Matrix-free

This work considers the development and implementation of a matrix-free, implicit solver for the

analysis of high speed compressible ﬂow using the density based approach. The work can broadly

divided into two parts: First, the HLLC and AUSM+up ﬂux interpolation schemes are imple-

mented and compared with the Central-Upwind scheme currently employed in rhoCentralFoam.

The second part of the work considers the temporal discretisation of the governing equations.

With the aim of improving eﬃciency a matrix-free implicit solver is implemented and evaluated

against segregated and multi-stage temporal schemes.

1 Introduction

This study considers the development of the compressible density based solver for im-

proved accuracy and eﬃciency when modelling high-speed viscous ﬂow. When considering

high-speed external aerodynamics, density based solvers are typically preferred as they

allow for the eﬃcient modelling of sharp numerical discontinuities as encountered with

propagating shock waves. These solvers usually employ central schemes with artiﬁcial

dissipation or ﬂux splitting schemes to resolve the shock waves [2].

As part of this study diﬀerent spatial discretisation or ﬂux interpolation schemes are

implemented in the OpenFOAMrﬁnite volume tool set and evaluated. With the aim of

improving the stability and eﬃciency of the solver, explicit multi-stage schemes as well

as matrix-free implicit methods are investigated to discretise the system of equations in

time.

Modelling high-speed ﬂow using a matrix-free coupled solver

2 Numerical implementation

The conservative continuity, momentum and energy equations governing unsteady com-

pressible viscous ﬂow read [14]

∂(ρ)

∂t +∂(ρuj)

∂xj

= 0 (1)

∂(ρui)

∂t +∂(ρuiuj)

∂xj

+∂p

∂xi

=σij (2)

∂(ρE)

∂t +∂(ρujE)

∂xj

+∂(ujp)

∂xj

=ulσlj +k∂T

∂xj

(3)

where ρis the density; uithe velocity in the Cartesian direction i;pis the pressure;

E=e+|u|2/2 denotes total energy and ethe speciﬁc energy. The set of equations are

closed using the equation of state for a perfect gas

p= (γ−1)ρe, T =e/Cv(4)

where Cvdenotes the speciﬁc heat at constant volume and γis the speciﬁc heat ratio,

Cp/Cv. The components of the viscous stress tensor are given by

σij =µ∂ui

∂xj

+∂uj

∂xi+λ∂uk

∂xk

δij (5)

with µand kbeing the viscosity coeﬃcient and thermal conductivity. If Stokes hypothesis

can be assumed the following relation can be employed, λ=−2µ/3.

The governing equations provided above can be described using a single uniﬁed equa-

tion. Applying the ﬁnite volume approach the equation can be cast into weak form by

integrating over the control volume, V, and from Gauss’ divergence theorem it follows

∂

∂t ZV

WdV+ZS

Fj

cnjdS=ZS

Fj

vnjdS(6)

where Wis the conservative variable vector and contains the components

W= [ρ;ρui;ρE] (7)

and the vector of convective ﬂuxes reads

Fc= [ρuj;ρujui+δijp;ρHuj] (8)

with the total enthalpy is deﬁned as H=E+p/ρ.

If the eﬀect of viscosity and thermal diﬀusivity are neglected, Fv= 0, the Euler equations

are obtained. For the initial evaluation of the numerical discretisation the Euler equations

will be used as it will allow for a more direct evaluation of the interpolation schemes,

without the introduction of additional numerical diﬀusion stemming from the viscous and

diﬀusive terms.

2

Modelling high-speed ﬂow using a matrix-free coupled solver

3 Spatial discretisation

Additional to the Central-Upwind scheme of Kurganov and Tadmor [5] used in rhoCen-

tralFoam [4], AUSM+up [6] and HLLC [1] are implemented to compute the face ﬂuxes. As

a detailed account of these schemes have been presented in literature only a brief overview

of them are given here. In the presentation of the various formulations it is attempted to

relate it as closely as possible to the numerical implementation of the respective solvers.

3.1 AUSM+up

Liou [6] extended the AUSM scheme for improved solutions on a wider range of speed

regimes. It employs a ﬂux splitting method where the inviscid ﬂux is split into convective

and pressure parts

F=ρujψ+P(9)

where

ψ= [1, ui, H]; P= [0, p δij,0]

The convective ﬂux, ψis simply interpolated using a non-linear higher-order scheme

ψf=(ψlif Mf>0

ψrif Mf≤0(10)

where land ris is the left and right hand states which are computed using the non-linear

slope limiting scheme MUSCL [13]. Above, Mdenotes the Mach number.

Liou [6] notes that the interpolated mass ﬂux can be computed as follows

(ρuj)f=cfMf(ρlif Mf>0

ρrif Mf≤0(11)

For the AUSM+up scheme, Liou [6] recommends the following deﬁnition for the acoustic

velocity face value

cf= min(˜cl,˜cr) (12)

where

˜cl/r =c∗

l/rc∗

l/r

max(c∗

l/r,|u|)(13)

3

Modelling high-speed ﬂow using a matrix-free coupled solver

and c∗is the critical speed of sound and in the case of a perfect gas reads

c∗=s2(γ−1)

γ+ 1 H(14)

The Mach number ﬂux can be computed based on the left and right hand states

Mf=M+

(m)(Ml) + M−

(m)(Mr) + Mp(15)

where Ml/r =ul/r/cfand the split Mach numbers are polynomial functions of degree

m= 1,2,4

M±

(1)(M) = 1

2(M± |M|),(16)

M±

(2)(M) = ±1

4(M±1)2(17)

and

M±

(4)(M) = (M±

(1) if M > 1

M±

(2)(1 ∓16βM∓

(2)) if M≤0(18)

To improve the solution for low Mach number ﬂows a pressure diﬀusion term is introduced

Mp=−Kpmax(1 −σM, 0)pr−pl

ρ∗

fc2

f

, σ ≤1, ρ∗

f= 1/2(ρl+ρr) (19)

The general pressure ﬂux formulation reads

pf=P+

(n)(Ml)pl+P−

(m)(Mr)pr+pu(20)

where Liou [6] recommends a ﬁfth degree polynomial which is also expressed in terms of

the split Mach number functions

P±

(5)(M) = (1

MM±

(1) if M > 1

M±

(2)[(±2−M)∓16αM M∓

(2)] if M≤0(21)

and the following velocity diﬀerence or diﬀusion term is suggested

pu=−kuP+

(5)(Ml)P−

(5)(Mr)(ρl+ρr)cf(ur−ul) (22)

with the coeﬃcient 0 ≤Ku≤1.

4

Modelling high-speed ﬂow using a matrix-free coupled solver

3.2 HLLC

Toro et al. [12] proposed an extension of the HLL scheme [9] to restore the contact

surface. Batten et al. [1] evaluated an implicit version of the HLLC scheme which is

positivity-preserving. It is suggested that the computational cost of the scheme is similar

to the Roe scheme and that it resolves both shock and contact angles. With HLLC the

convective ﬂux is deﬁned as [1]

Fj

c=

Fj

lif Sl>0

Fj(U?

l) if Sl≤0< Sm

Fj(U?

r) if Sm≤0≤Sr

Fj

rif Sr<0

(23)

where

Fj(U?

l/r) =

Smρ?

l/r

Sm(ρui)?

l/r +p?δij

Sm((ρE)?

l/r +p?)

(24)

U?

l/r =

ρ?

l/r

(ρui)?

l/r

(ρE)?

l/r

= Ωl/r

(Sl/r −ul/r)ρl/r

(Sl/r −ul/r)(ρui)l/r + (p?−pl/r)δij

(Sl/r −ul/r)(ρE)l/r −ul/r pl/r +Smp?

(25)

Ωl/r = (Sl/r −Sm)−1(26)

p?

l/r =ρl/r(ul/r −Sl/r)(ul/r −Sm) + pl/r (27)

In these equations the velocity magnitude is computed using the relation ul/r = (ui)l/r ni

where niis the outward facing unit vector normal to the cell face. Batten et al. [1] suggest

the following relation for signal velocity

Sm=ρrur(Sr−ur)−ρlul(Sl−ul) + pl−pr

ρr(Sr−ur)−ρl(Sl−ul)(28)

and Toro et al. [?] recommends

Sl= min[ul−cl,˜u−˜c] (29)

Sr= max[ur−cr,˜u+ ˜c] (30)

where ˜uand ˜care the Roe averages for the ﬂow velocity and acoustic velocity.

5

Modelling high-speed ﬂow using a matrix-free coupled solver

The Roe-averaged variables are computed based on the density ratio

˜

R=rρr

ρl

(31)

from which the Roe-averaged velocity, speciﬁc enthalpy and acoustic velocity then follows

˜uj=˜

Ruj

r+uj

l

˜

R+ 1 (32)

˜

H=˜

RHr+Hl

˜

R+ 1 (33)

˜c=q(γ−1)( ˜

H−1/2|˜u2

i|(34)

4 Temporal discretisation

The general form of the governing equations can be expressed as a system of coupled

diﬀerential equations, of which the semi-discrete form reads

Wn+1 −Wn

∆tV=βRn+1 + (1 −β)Rn(35)

were Rdenotes the right-hand side of the equations. First order implicit and explicit

formulations are obtained for βvalues of respectively unity and zero. The well known

second-order Crank-Nicolson scheme is recovered for β= 1/2.

4.1 Stability

Implicit time stepping methods have no stability constraints and the time-step size is

only governed by accuracy. These are, however, subjected to large computational and

memory overheads. Explicit methods, despite being computationally eﬃcient and easy

to implement, are restricted by stability constraints. For a stable explicit solution the

time-step size is restricted by the CFL number, for which the follow expression can be

used

∆t=CF L∆χ

λ(36)

where the CFL number must be smaller than unity for β= 0. λrefers to the eigenvalues

associated with the system and the length scale is computed using the relation ∆χ=

√∆xi∆xi.

6

Modelling high-speed ﬂow using a matrix-free coupled solver

4.2 Multi-stage Runge-Kutta

To evaluate the possible improvement in both stability and accuracy a multistage Runge-

Kutta scheme is implemented. With this multistage time-stepping scheme the residual is

evaluated at intermediate stages and weighted as the solution is advanced. The coeﬃcients

used to weight the residual can be optimised based on the required stability and accuracy.

For the purpose of describing the Runge-Kutta temporal discretisation the semi-discrete

system of governing equations may be written as

∆W

∆t=−1

VZS

Fj

cnjdS=R(W) (37)

The generalised form of the multistage Runge-Kutta then reads [7]

Wn+1 =Wn+ ∆tbiri(38)

ri=R(tn+ci∆t, Wn+ ∆taij rj), i = 1, s;j= 0, s −1 (39)

with sbeing the stage of the scheme and the coeﬃcients aij, 1 ≤j < i ≤s,bi,i= 1, s

and ci,i= 2, s. These coeﬃcients are typically derived using the Butcher table [7].

4.3 Matrix-free implicit solver

If an implicit approach is employed to discretise the ﬂow equations, a sparse non-symmetric

system is recovered. As direct solvers are not practical for large systems, iterative solu-

tion methods and approximate factorization methods are typically employed to solve

such a system. To reduce the memory overhead typically associated with implicit solvers

a matrix-free approach [8] is implemented. The semi-discrete form of the Euler implicit

scheme reads

Wn+1 −Wn

∆tV=Rn+1 (40)

which can be linearised in time as

∆Wn

p

∆tVp=Rn

p+∂Rn

∂W∆Wp(41)

where W=Wn+1 −Wn. The equation can be written for all nodes as a function of the

Jacobian matrix

V

∆tI−∂Rn

∂W∆W=Rn(42)

It is noted that the left-hand side coeﬃcient matrix, A, contains a diagonal contribution

from the temporal discretisation, V/∆t, as well as the Jacobian matrix, ∂Rn/∂W.

7

Modelling high-speed ﬂow using a matrix-free coupled solver

The Jacobian matrix involves the linearisation of both the convective and viscous ﬂux

vectors. As an explicit formulation of the ﬂux Jacobian is not always feasible, a simpliﬁed

ﬁrst-order approximation of ﬂuxes is linearised. This implies that the quadratic conver-

gence of Newton’s method would not be achieved, but it reduces storage requirements

and improves computational eﬃciency. It then follows that the number of non-zeros in

each matrix row is related to the number edges associated with each node. To simplify

the computation of the left-hand side matrix the Jacobian ﬂuxes are approximated using

Lax-Friedrich

R(Wp,Wn,nf) = 1

2(F(Wp,nf) + F(Wn,nf)) −1

2|λf|(Wn−Wp) (43)

where ndenotes the neighbouring nodes of node p. The largest wave speed is computed

as

|λf|=|uj

fnj

f|+cf(44)

with cfbeing the speed of sound and nbeing the unit vector normal to the cell face f.

The left-hand side coeﬃcient matrix, A, can be stored as strictly upper, lower and diagonal

matrices so that for a node pthe following holds

L∆W|p=−X

n:n<p

∂Rp

∂Wn

∆Wn=−X

n:n<p

1

2(J(Wn)− |λf|I) ∆Wn

U∆W|p=−X

n:n>p

∂Rp

∂Wn

∆Wn=−X

n:n>p

1

2(J(Wn)− |λf|I) ∆Wn

D="Vp

∆t−X

n

∂Rp

∂Wp#="Vp

∆t−X

n

1

2(J(Wp)− |λf|I)#

where J=∂F/Wrepresents the Jacobian of the inviscid ﬂux vector.

Luo et al. [8] suggested a matrix-free implicit method to solve the system of equations

given above. This method consisted of solving a system of approximated linear equa-

tions through the use of a Generalised Minimum Residual (GMRES) method [11] with

Lower-Upper Symmetric Gauss-Seidel (LU-SGS) preconditioning [16]. It is suggested

that the LU-SGS preconditioning provides good stability properties and compared to ex-

plicit methods is competitive in term of computational cost, while the iterative GMRES

solver improves the convergence of the solution. The GMRES method is a generalisa-

tion of the conjugate gradient method and allows for the solution of linear systems with

a non-symmetric and/or positive deﬁnite coeﬃcient matrix, as commonly found when

considering the ﬂow equations.

5 Results

To evaluate the implemented ﬂux splitting schemes and the matrix-free implicit solver a

number of benchmark test cases are considered. These include the forward facing step

8

Modelling high-speed ﬂow using a matrix-free coupled solver

(a) Cockburn and Shu (b) Central-Upwind

(c) AUSM+up (d) HLLC

Figure 1: Forward facing step

[15], the NACA0012 airfoil at 2 degrees angle-of-attack and the RAE plane test problem

[10]. Based on availability these test cases the numerical predicted results are compared

to experimental and simulation results.

The ﬁrst test case considers the forward facing step as discussed in the work of Woodward

and Collella [15]. Uniform ﬂow at Mach 3 enters a rectangular channel and is obstructed

by a forward facing step. The ﬂow structure at t = 4 s are evaluated and the ability of the

discretisation schemes to capture the shock formations are investigated. The numerical

predicted results for the Central-Upwind, AUSM+up and HLLC schemes are shown and

compared to the results of Cockburn and Shu [3] in Figure 1. It is found that there

is good agreement between the Central-Upwind scheme and AUSM+up, but that the

accuracy deteriorates if HLLC is used. On structure meshes AUSM+up is able to pick

up higher-order ﬂow features like the Kelvin–Helmholtz instability forming at the shear

layer.

To evaluate the analysis of ﬂow over a 3D geometry the RAE plane as discussed in the work

of Romanelli [10] is considered. In Figure 2 a comparison of the numerically predicted

pressure coeﬃcients and experimental measurements are shown. These include results

along the fuselage as well as the wing chord at diﬀerent span positions. It is noted that

the implemented fourth-order Runge-Kutta solver with high-resolution with AUSM+up

scheme provides a reasonably accurate approximation of the experimental measurements

and agrees with numerical results obtained from the commercial code Fluent [10].

Lastly, to evaluate the implemented multi-stage explicit and matrix-free implicit solvers

the NACA0012 airfoil at a 2 degree angle-of-attack is simulated. In Figure 3 the simulation

9

Modelling high-speed ﬂow using a matrix-free coupled solver

(a) Pressure contour (b) Fuselage, φ= 15·

(c) Wing, Y/B = 0.6 (d) Wing, Y/B = 0.85

Figure 2: RAE plane

time for the respective temporal discretisation schemes are compared. It is shown that the

matrix-free implicit approach provides a notable improvement in stability and eﬃciency

over its explicit and multi-stage counterparts. For this case it is found that the matrix-free

LU-SGS solver and GMRES solver with LU-SGS preconditioning provides respectively a

15 and 95 time speed-up when compared to the segregated explicit solver.

6 Conclusion

In conclusion, it is found that the OpenFOAMrtoolset easily allows for the development

of customised CFD solutions. Furthermore, it is shown that it can be used to eﬃciently

obtain accurate solutions for high-speed compressible ﬂows.

REFERENCES

[1] P. Batten, M.A. Leschziner, and U.C. Goldberg: Average-state Jacobians and im-

plicit methods for compressible viscous and turbulent ﬂows, Journal of Computa-

10

Modelling high-speed ﬂow using a matrix-free coupled solver

(a) Pressure contour (b) Cut-cell Cartesian Mesh

(c) CPU time (Explicit and Implicit) (d) CPU time (Implicit)

Figure 3: NACA 0012: Comparison of CPU times for the explicit, multi-stage and implicit

coupled solvers

tional Physics, Vol. 137/1, pp. 33–78, (1997)

[2] J. Blazek: Computational Fluid Dynamics: Principles and Applications, Elsevier

Science (2001)

[3] B. Cockburn and C. Shu: The Runge–Kutta discontinuous Galerkin method for

conservation laws V: multidimensional systems, Journal of Computational Physics,

Vol. 114/2, pp. 199–224, (1998)

[4] C.J. Greenshields, H.G. Weller, L. Gasparini and J.M. Reese,: Implementation of

semi- discrete, nonstaggered central schemes in a colocated, polyhedral, ﬁnite volume

framework, for highspeed viscous ﬂows, International journal for numerical methods

in ﬂuids, Vol. 63/1, pp. 1–21, (2010)

[5] A. Kurganov and E. Tadmor: High-resolution central schemes for non–linear conser-

vation laws and convection–diﬀusion equations, Journal of Computational Physics,

Vol. 160/1, pp. 241–282, (2000)

[6] M.S. Liou: A sequel to AUSM: AUSM+ up for all speeds, Journal of Computational

Physics, Vol. 214/1, pp. 137-170, (2006)

[7] R. L¨ohner: Numerical Heat Transfer and Fluid Flow, Wiley (2008)

[8] H. Luo, J.D. Baum and R. Lohner: A fast, matrix-free implicit method for compress-

ible ﬂows on unstructured grids, Journal of Computational Physics, Vol. 146/1, pp.

664–690, (1998)

[9] A. Harten, P.D. Lax and B van Leer: On upstream diﬀerencing and Godunov-type

schemes for hyperbolic conservation laws, SIAM review, Vol. 25/1, pp. 35–61, (1983)

11

Modelling high-speed ﬂow using a matrix-free coupled solver

[10] G. Romanelli, E. Serioli and P. Mantegazza: A new accurate compressible inviscid

solver for aerodynamic applications, 3rd OpenFOAM Workshop by Dipartimento di

Energetica, Politecnico di Milano (2008)

[11] Y. Saad and M.H. Schultz: GMRES: A generalized minimal residual algorithm for

solving nonsymmetric linear systems, SIAM Journal on scientiﬁc and statistical com-

puting, Vol. 7/3, pp. 856–869, (1986)

[12] E. Toro, M. Spruce and W. Speares: Restoration of the contact surface in the HLL–

rieman solver, Shock Waves, Vol. 4/1, pp. 25–34, (1994)

[13] N.P. Waterson and H. Deconinck: Design principles for bounded higher-order con-

vection schemes–a uniﬁed approach, Journal of Computational Physics, Vol. 224/1,

pp. 182–207, (2007)

[14] F.M. White: Viscous ﬂuid ﬂow, McGraw-Hill Higher Education, New York (2006)

[15] P. Woodward and P. Colella: The numerical simulation of two-dimensional ﬂuid ﬂow

with strong shocks, Journal of Computational Physics, Vol. 54/1, pp. 115–173, (1984)

[16] S. Yoon and A. Jameson: Lower-upper symmetric-Gauss-Seidel method for the Euler

and Navier-Stokes equations, AIAA Journal, Vol. 26/9, pp. 1025–1026, (1988)

12