You are on page 1of 12

Computer Physics Communications 185 (2014) 27302741

Contents lists available at ScienceDirect

Computer Physics Communications


journal homepage: www.elsevier.com/locate/cpc

Implementation of density-based solver for all speeds in the


framework of OpenFOAM
Chun Shen a , Fengxian Sun b , Xinlin Xia a,
a
School of Energy Science and Engineering, Harbin Institute of Technology, Harbin 150001, China
b
School of Power and Energy Engineering, Harbin Engineering University, Harbin 150001, China

article info abstract


Article history: In the framework of open source CFD code OpenFOAM, a density-based solver for all speeds flow field is
Received 16 August 2013 developed. In this solver the preconditioned all speeds AUSM+(P) scheme is adopted and the dual time
Received in revised form scheme is implemented to complete the unsteady process. Parallel computation could be implemented
22 May 2014
to accelerate the solving process. Different interface reconstruction algorithms are implemented, and
Accepted 9 June 2014
Available online 25 June 2014
their accuracy with respect to convection is compared. Three benchmark tests of lid-driven cavity flow,
flow crossing over a bump, and flow over a forward-facing step are presented to show the accuracy
Keywords:
of the AUSM+(P) solver for low-speed incompressible flow, transonic flow, and supersonic/hypersonic
CFD flow. Firstly, for the lid driven cavity flow, the computational results obtained by different interface
OpenFOAM reconstruction algorithms are compared. It is indicated that the one dimensional reconstruction scheme
Density-based adopted in this solver possesses high accuracy and the solver developed in this paper can effectively catch
All speeds the features of low incompressible flow. Then via the test cases regarding the flow crossing over bump and
Incompressible over forward step, the ability to capture characteristics of the transonic and supersonic/hypersonic flows
Preconditioned are confirmed. The forward-facing step proves to be the most challenging for the preconditioned solvers
Unsteady with and without the dual time scheme. Nonetheless, the solvers described in this paper reproduce the
main features of this flow, including the evolution of the initial transient.

Program summary

Program title: allSpeedUnsteadFoam/allSpeedUnsteadFoam_dualtime


Catalogue identifier: AETK_v1_0
Program summary URL: http://cpc.cs.qub.ac.uk/summaries/AETK_v1_0.html
Program obtainable from: CPC Program Library, Queens University, Belfast, N. Ireland
Licensing provisions: GNU General Public License
No. of lines in distributed program, including test data, etc.: 255467
No. of bytes in distributed program, including test data, etc.: 971156
Distribution format: tar.gz
Programming language: C++.
Computer: All capable of running Linux.
Operating system: Linux.
Has the code been vectorized or parallelized?: Yes Parallelized
RAM: 500 MB or more
Classification: 12.

This paper and its associated computer program are available via the Computer Physics Communication homepage on ScienceDirect (http://www.sciencedirect.com/
science/journal/00104655).
Corresponding author. Tel.: +86 0451 86412148.
E-mail addresses: shenchun390@hotmail.com (C. Shen), xiaxl@hit.edu.cn (X. Xia).

http://dx.doi.org/10.1016/j.cpc.2014.06.009
0010-4655/ 2014 Elsevier B.V. All rights reserved.
C. Shen et al. / Computer Physics Communications 185 (2014) 27302741 2731

External routines: OpenFOAM (http://www.openfoam.org)


Nature of problem:
This software provides a library of models for the simulation of steady and unsteady all speeds flow field
(all Mach number flow field including incompressible and compressible flow). Combining this library with
other libraries within OpenFOAM, such as turbulence, radiation, solid conduction, etc., the more complex
multi-physics model including all speeds flow field could be established conveniently.
Solution method:
Standard finite volume method (FVM) is used for solving all the preconditioned conservation governing
equations. The preconditioned all speeds AUSM+(P) scheme is adopted to discretize the convective term
in the governing equations. The total variation diminishing (TVD) scheme with interface reconstruction is
used to improve the accuracy of this solver. The dual time scheme is used to solve the unsteady problem.
Restrictions:
The limiter functions have obvious effect on the accuracy of the numerical result and according to actual
situation, so the selection of limiter functions should be focused on.
Running time:
It can vary from minutes to days to weeks depending on the size of the system, length of time simulated
and number of processors used.
2014 Elsevier B.V. All rights reserved.

1. Introduction scheme [29] and used this solver to analyze the flow and heat
transfer characteristics of all speeds, mixing hot core and cold
bypass flow field in modern propulsion system. However, when
OpenFOAM is a prominent and widespread open source CFD compared with commercial CFD software, the preconditioned
(Computational Fluid Dynamics) library toolbox based on C++ lan- density-based solver in OpenFOAM would benefit from further de-
guage [1]. In this software package, a lot of CFD modules to solve velopment. So in this paper, the main aim is to further develop and
the partial differential equations in parallel have already been as- enrich the preconditioning density-based solver in the framework
sembled [2] and many physical models, such as turbulence, com- of OpenFOAM which can handle the flow problem for all speeds
bustion, particle tracing, radiation, etc., have also been designed like the commercial CFD software.
[3]. The user can utilize these open source codes to implement The solver in this paper is also developed on the basis of density-
their own projects. Generally, in comparison with the commercial BasedTurbo solver. Different from Saegeler and Mundt [31], firstly,
software, such as Fastran [4], Fluent and CFX [5], the primary ad- preconditioned all speeds AUSM+(P) convective scheme [33] is
vantage is that it is convenient for the user to develop their own added and all speeds AUSM+up [27] convective scheme which
physical models, discrete schemes and boundary conditions. For has already been integrated in original densityBasedTurbo solver
example Refs. [611] established the new physical model in the could be used directly. Secondly, another interface reconstruction
framework of OpenFOAM. Refs. [1215] presented new discretiza- scheme [12,19] is adopted, which is different from the form assem-
tion schemes to improve the resolution of the corresponding nu- bled in the original denstiyBasedTurbo solver. Lastly, to provide for
merical model. For existing numerical models within OpenFOAM, efficient, time-accurate solution of the preconditioned equations, a
N.T.P. Le, et al. [16] proposed new boundary slip conditions called dual time stepping scheme, similar to that in Ref. [30], is adopted.
the LangmuirMaxwell and the LangmuirSmoluchowski bound-
ary conditions.
2. Theoretical background
Relative to pressure-based methods, such as SIMPLE [17] and
PISO [18], there are fewer density-based solvers available in Open-
2.1. Governing equation
FOAM. So far, there is only one density-based solver, called rho-
CentralFoam [3] within official version of OpenFOAM, of which
The three-dimensional governing equation system can be
the discrete detail was shown in Ref. [19]. Refs. [11,16] used this
written in Cartesian coordinates as follows:
solver on different applications, and both obtained appropriate re-
sults. Another density-based solver, called densityBasedTurbo, W Ec Fc Gc Ev Fv Gv
+ + + + + + =0 (1)
developed by O. Borm, et al. [2022] is also widely used. In this t x y z x y z
solver, the discrete schemes of the convective term in the gov-
where W is the vector of conservative variable W = [, u, v,
erning equations are the Godunov type schemes, such as Roe
w, E]T , is the density, u, v and w are the velocity components
scheme [23,24], AUSM family schemes [2527] and so on, which
in three directions, respectively and E = e + 21 u2 + v 2 + w 2 is

are the schemes adopted by the prevailing commercial CFD soft-
the total energy. Ec , Fc and Gc are the convective flux vectors and
ware (Fluent, Fastran and CFX). These density-based solvers can
Ev , Fv and Gv are the viscous flux vector, where the subscripts c
obtain accurate results for the transonic, supersonic and hyper-
and v indicate convective and viscous flux, respectively.
sonic flow problem. In the low subsonic Mach number regime,
when the magnitude of the flow velocity becomes small in com-
parison with the acoustic speed, the convective terms of the gov- 2.2. Preconditioning method
erning equations become stiff [28]. In order to solve the stiffness
of the governing equations, without pressure-based methods, the The preconditioning equation system of Eq. (1) can be written
preconditioning method can be employed [29,30]. In the frame- as follows:
work of densityBasedTurbo solver, Saegeler and Mundt [31,32] de- Q Ec Fc Gc Ev Fv Gv
veloped the preconditioned density-based solver based on Pre-Roe + + + + + + =0 (2)
t x y z x y z
2732 C. Shen et al. / Computer Physics Communications 185 (2014) 27302741

where Q is the vector of primitive variable Q = [p, u, v, w, T ]T


and the expression of the preconditioning matrix is [28]:
Nomenclature

0 0 0

a speed of sound T
a1/2 preconditioned speed of sound u
E total energy (J/kg)
u 0 0
T

Ec , Fc , Gc convective flux vectors v

= v 0 0

Ev , Fv , Gv viscous flux vectors
(3)
T
w

f1/2 quantity for preconditioned all speeds AUSM+(P) w

0 0
scheme T
|U |2

H total enthalpy (J/kg)
k index of stage of RungeKutta Scheme/counter of
H 1 u v w
2T
pseudo-time stepping
where the total Enthalpy H, the preconditioning parameter and
K constant for square of the reference velocity 2 p
the square of the reference velocity Uref are given by H = e + +
m split Mach numbers
1
u2 + v 2 + w 2 , = 1 1 1
= min(a2 , max
2
m1/2 mass flux at the interface 2 2
Uref
a2
+ Rg T
and Uref
M speed of sound
|U |2 , K |U |2 ), respectively. In this paper, K = 0.25 and U is

Ml/r preconditioned Mach number at left face or right
the fixed reference velocity. The fixed reference velocity is the ve-
face.
locity of top lid in the cavity test case and it is the inlet velocity in
n index of the physical time
the bump and forward facing step test cases.

n unit normal vector at the interface
= min a2 , max |U |2 , K |U |2 ,
2

According to expression Uref
p pressure (Pa)
if the fixed reference velocity is equal to sound speed (Uref = a),
P transformation matrix
the preconditioning matrix is converted into the transformation
Q vector of primitive variable
matrix P, and 1 the inverse matrix of , is converted into P 1 ,
r limiter factor
where the expression of transformation matrix P is shown in Sec-
Re Reynolds number
tion 2.4. Hence, the preconditioning is turned off for the time con-
R (W ) residual of the discretized governing equation
servative supersonic flow, as described in Ref. [28]. In practice, the
T temperature (K)
parameter, U , is set big enough. In the following text, the physical
u, v, w velocity components
time preconditioned method dictates the condition that the pre-
U velocity vector (m/s)
2 conditioning is turned off.
Uref square of the reference velocity
U fixed reference velocity
W vector of conservative variable 2.3. Discrete schemes
x, y, z Cartesian coordinates
2.3.1. Discrete schemes of transient term
Greek symbols
The governing equation (2) can be discretized as:
density (kg/m3 )
preconditioning matrix Q
= 1 R (W ) (4)
preconditioning parameter t
k coefficient for RungeKutta Scheme
where 1 is the inverse matrix of , which is obtained by
, coefficient of AUSM+ scheme
GaussJordan method and R (W ) is the so-called residual, which
(r ) limit function
denotes the complete spatial discretization including the source
geometric weighting coefficient
term.
convected scalar
The explicit fourth order RungeKutta scheme is adopted to
pseudo time step
solve Eq. (4).
weighting coefficient for interface reconstruction
dynamics viscosity Q0 = Qn
Q k = Q 0 + k t 1 R W k1

(5)
Subscripts
Q n +1 = Q 4
c convective
f interface where the optimum choices k = 0.11, 0.2766, 0.5 and 1.0; the
v viscous index of the stage of RungeKutta scheme k = 1, 2, 3 and 4;
ref reference superscript n represents the physical time level.
infinity
1/2 symbol of interface between cells 2.3.2. Discrete schemes of numerical flux
l/r left or right cell beside interface The discrete scheme adopts preconditioned all speeds AUSM+
scheme, such as AUSM+up [27], AUSM+(P) [33], etc. The AUSM+up
Superscripts method is integrated in the original densityBasedTurbo solver.
1 inverse In this paper, the computational results corresponding to the all
c convective speeds preconditioned AUSM+(P) is mainly discussed about. In
p pressure this paper, we focus on computational results for the all speeds
symbol indicating direction preconditioned AUSM+(P) method.
For arbitrary interface between adjacent grid cells, the convec-
tive flux is [33]:
C. Shen et al. / Computer Physics Communications 185 (2014) 27302741 2733

1 0

p p
F1/2 = F1c/2 + F1/2 , F1c/2 = m1/2 U , F1/2 = pn
H l/r
0 l/ r
(6)

where n is the unit normal vector at the interface, the subscript


1/2, l and r denote the interface, left cell and right cell,
respectively. In OpenFOAM, the left cell and right cell indicate the
owner cell and the neighbor cell and the n directs from owner cell Fig. 1. Schematic diagram of geometric relations of adjacent cells.
to neighbor cell [12]. The mass flux m1/2 is:
The discrete scheme of the diffusive term in the governing
1 (pl pr ) equation (2) utilizes the central-difference method to discretize.
m1/2 = m1/2AUSM + + a1/2 2
1
Mref1/2
pl
+ prr
l
2.3.3. Reconstruct schemes at interface
Like other Godunov type schemes, the AUSM family schemes
m+ +

4 Ml m1 Ml m4 Mr + m1 Mr (7)
only possess first order accuracy. In order to improve the spatial
where the preconditioned Mach number and the preconditioned accuracy to second order, the variable on both sides of interface
speed of sound are written as follows: between grid cells should be reconstructed and the limiter function
(r ) is adopted to provide the total variation diminishing (TVD)
ul / r property. The original limited form of surface interpolation in
Ml/r = , a1/2 = f1/2 a1/2 (8)
a1/2 DensityBasedTurbo solver is shown in Refs. [20,34]. In this paper,
we use the formulation from Refs. [12,19].
with: According to the geometric relations of adjacent cells shown in
2 Fig. 1, the definition of geometric weighting coefficient is [12]:
2
1 Mref M12/2 + 4Mref
2
,1/2
2
Uref

f1/2 = , 2
Mref = . (9) fN
1+ 2
Mref ,1/2 a2 .
f = (15)
PN
The new definitions of the new expressions for the interface When the interface flux is positive, of which the direction is
Mach numbers ML/R and pressure p1/2 are defined as: directed from owner cell to neighbor cell,

f + = P + (1 ) N , = 1 (r ) 1 f ,

1 2 2

ML = 1 + Mref1/2
ML + 1 Mref1/2
MR
2 (10) d ( )P (16)
1 r =2 1
MR = 1+ 2
Mref MR + 1 2
Mref ML (d )f
1/2 1/2
2
otherwise,
(5,) ML pL + p(5,) MR pR .
p1/2 = p+

(11)
f = P + (1 ) N , = (r ) f ,
The interface mass flux of AUSM+ is written as: d ( )N (17)
r =2 1
(d )f
m1/2AUSM + = a1/2 L m+
1/2 + R m1/2

(12)
where is the convected scalar, such as pressure p, density and
with: velocity components u, v , w etc., is the weighting coefficient,
(r ) is the limiter function, and r is the limiter factor for the
m1/2 = m+

(4,) ML + m(4,) MR
unstructured grid [35,36]. In this paper [35],
1 (13)
m
1/2 = m1/2 m1/2
(r + |r |) / (1 + r ) ,

2 Van Leer
(r ) = (18)
where the split Mach numbers and pressure are defined as [26]: max [0, min (1, r )] , Minmod.

1
(1) (M ) =
m (M + |M |) 2.4. Dual time scheme
2
With the preconditioning method, Eq. (2), the matrix affects
(1) (M ) , if |M | 1
m

m
(2) (M ) = 1 the representation of time dependent processes. To improve
(M 1)2 , otherwise accuracy, the dual time stepping method from Ref. [30] introduces
4
a numerical term that depends on an artificial time as follows:
(1) (M ) ,
m

m (M ) = if |M | 1 Q W Ec Fc Gc Ev Fv Gv
= 0.

(4,) (M ) 1 16 m + + + + + + +
m
(2) (2) (M ) , otherwise t x y z x y z
(19)
(5,) (M )
p
The real time term in Eq. (19) is discretized in a second order ac-

1 curate backwards difference in time and by iteration, the pseudo-
(1) (M ) , if |M | 1
m

M time derivative is converged to zero by means of the following
= (14)
algorithm:
m (M ) (2 M ) 16 Mm (M ) ,

otherwise
(2) (2)
3 Q k+1 3W k 4W n + W n1

with = 3/16, = 1/8. + P = R (W ) (20)
2t 2t
2734 C. Shen et al. / Computer Physics Communications 185 (2014) 27302741

where k represents the counter of pseudo-time stepping, n blue background. The discrete scheme of the convective flux is
represents the physical time level and the transformation matrix adopting the AUSM+(P), introduced in Section 2.2. For the unsteady
is [28]: solver with dual time stepping scheme, the sub time cycling should
be looping until the convergent results are obtained and so time
0 0 0 stepping process shown in Fig. 2 is physical time stepping. For the
p T
steady solver, the sub time cycling is useless and the number of
u u



0 0 subcycling could be set to one or other small number.
p T
v v
W
0 0 .

P = = (21) 3.2. Implementation of parallel computation
Q p T
w w


p 0 0 In order to implement parallel computation, the geometrical
T


E
domain should be decomposed into several sub domains. Fig. 3
|U |2
illustrates the principle of geometrical decomposition within
u v w
p 2T OpenFOAM. Before decomposition, the coupled boundary (coupled
face) is a set of ordinary interfaces, so the convective flux and the
When , Q Q k n +1
.
construction of the left/right value on both sides of the coupled
In the absence of preconditioning, the left-hand side of the gov-
face are also the same as ordinary interface inside the domain.
erning equation simplifies to Q i+1 ( 1 + 2
3
t
) and it is a 5 dimen-
i In the program, when the boundary flux needs to be calculated,
sional column vector where the primitive variables p, u, v , w and
the function coupled() which is defined in the fvPatchField class
T are independent of each other. The form of the transient term
should be used to judge whether the corresponding boundary is
is concise, so for the dual time stepping method, the ddtScheme
a coupled face or an ordinary physical boundary. And then if the
backwardDualDdtScheme is directly implemented in the original
boundary is a coupled face, the corresponding convective flux here
densityBasedTurbo lib [20]. For the Eq. (20), the matrix ( + 32 t
P)
should be determined by the geometric and variable information
is a 5 5 block matrix [9,10] and this 5 5 block matrix multi-
of both the left (InternalField) and right (NeighbourField) value
Q k+1
plies
at the right-hand side of Eq. (20). The left-hand side of shown in Fig. 3.
k+1

Eq. (20) is also a 5 dimensional column vector ( + 32 t
P ) Q ,
but the primitive variables p, u, v , w and T are not independent of 3.3. Implementation of interface reconstruction
each other. And so it is complicated to directly implemented a time
scheme as backwardDualDdtScheme time scheme. In general, the As shown in Section 2.3.3, another kind of interface recon-

matrix ( + 32t
P ) could be inverted and Eq. (20) could be changed struction within OpenFOAM which possesses the property of Total
into: Variation Diminishing (TVD) is taken as an alternative. The code
corresponding to interface reconstruction is implemented in file,
3
1
Q k+1

= + P godunovFlux.C. First, two objects, pos and neg , corresponding to
2t class, surfaceScalarField, need to be added into the constructor

3W 4W n + W n1
k
function of class, godunovFlux, as shown in Algorithm 1. The pos-
+ R (W ) . (22) itive and negative scalar units are assigned to these two objects,
2t
pos and neg.
Eq. (21) could be explicitly solved with RungeKutta scheme. So in
this paper, the new ddtScheme corresponding to transient term
in the Eq. (20) is not added in. Instead, the explicit fourth order
RungeKutta scheme is adopted to solve Eq. (21), where the in-

verse matrix of + 32

t
P is obtained by GaussJordan method.
Of course, Eq. (20) could be directly solved with block matrix tool
in Refs. [9,10], but the corresponding content is beyond the scope
of this paper.

3. Code structure

According to the computational theory above, the boundary


conditions are not need to be preconditioned and the code is pri-
marily implemented to compute the corresponding precondition-
ing parameters for the internal field.

3.1. Block diagram

Like other programs within OpenFOAM, the time object of Time


class should be defined firstly, which controls the registration of
mesh, fields and dictionaries, when and what output, magnitude
of time step, etc. Then the mesh object of fvMesh class should
be defined, which provides all the geometrical information for
spatial discretization in the finite volume method. The dual time
looping can be implemented by the definition of sub time cycling
object of subCycleTime class. The primary differences between
this solver and DensityBasedTurbo are the convective scheme,
preconditioning matrix computation and the solving form of
governing equation. These different parts are shown in Fig. 2 with
C. Shen et al. / Computer Physics Communications 185 (2014) 27302741 2735

Fig. 2. Block diagram of program structure.

Fig. 3. Schematic diagram of principle of geometrical decomposition.

The interpolation function fvc::interpolate is implemented in flux, which is direct from neighbor cell to owner cell. The third
order to obtain the reconstructed positive (p_pos, U_pos, rho_pos, arguments within fvc::interpolate, such as reconstruct(p), re-
etc.) and negative (p_neg, U_ neg, rho_ neg, etc.) values, corre- construct(U) and so on, are related to the interpolationSchemes
sponding to the owner cell and neighbor cells on both sides of sub-dictionary term in the file fvScheme and the concrete in-
each interface, as shown in Algorithm 2. The second arguments terpolation schemes are chosen according to the name following
within fvc::interpolate, are pos or neg which are defined in Algo- the name of these arguments, such as vanLeer, Minmod etc.,
rithm 1. Herein, pos represents the positive flux, which is directed which are referred to Eq. (18). In fact, the code shown in Algo-
from owner cell to neighbor cell and neg represents the negative rithm 2 are top level in OpenFOAM, where the pos part, such
2736 C. Shen et al. / Computer Physics Communications 185 (2014) 27302741

(a) Geometric model. (b) Computational grid.

Fig. 4. Computational model of lid driven cavity.

(a) One dimensional reconstruction with vanLeer (b) Multi-dimensional reconstruction in Ref. [20]. (c) One dimensional reconstruction with vanLeer
limiter in Ref. [20]. limiter in Refs. [12,19].

(d) One dimensional reconstruction with QUICK (e) rhoPisoFoam with QUICK limiter.
limiter in Refs. [12,19].

Fig. 5. Streamline with different limiters.

as fvc::interpolate(p_, pos, reconstruct(p)), corresponds to Eq. ary, such as boundary pp in Algorithm 3, is coupled or not. If the
(16) and the neg part, such as fvc::interpolate(p_, neg, recon- boundary is coupled, the function fvPatchField ::patchInternal-
struct(p)) corresponds to Eq. (17). Field() and fvPatchField ::patchNeighbourField() are used to ob-
The function fvPatchField::coupled(), which is defined in the tain the owner cell and neighbor cell on both sides of this coupled
class fvPatchField, could be adopted to judge whether the bound- boundary.
C. Shen et al. / Computer Physics Communications 185 (2014) 27302741 2737

(a) Whole velocity distribution. (b) Locally enlarged 1.

(c) Locally enlarged 2.

Fig. 6. Velocity distribution along the horizontal centerline of the cavity.

3.4. Definition of convergence criteria

In the code, two kinds of convergence residual, res1 and


res2, are defined in the file, UnsteadyFluid.H, as shown in Al-
gorithm 4, where parameter flag1 is the counter of sub cycling
for dual time scheme. In general, there exists reciprocating distur-
The left and right values at the interface between cells are bance nearby the region of shock. Hence the value of res1 is os-
the required arguments in the Flux::evaluateFlux() function cor- cillating and it does not decrease to a satisfactory value. Referring
responding to the AUSM+(P) in Section 2.3.2 or AUSM+up in to the concept of field average (fieldAverageTemplates.C) within
Ref. [20]. After interpolation, these values are determined and the OpenFOAM, parameter res2 is defined. It decreases to a suffi-
Flux::evaluateFlux() function can be implemented. ciently small value, or at least a value small enough, if the amount
2738 C. Shen et al. / Computer Physics Communications 185 (2014) 27302741

(a) Whole velocity distribution. (b) Locally enlarged 1.

(c) Locally enlarged 2.

Fig. 7. Velocity distribution along the vertical centerline of the cavity.

(a) Along the vertical centerline of the cavity. (b) Along the horizontal centerline of the cavity.

Fig. 8. Comparison of effect of grid quality on the computational results (one dimensional reconstruction with vanLeer limiter in Refs. [12,19]).

of sub cycling(inner iteration) is big enough. In practice, res2 is 4. Benchmark test


used to judge whether the numerical results is convergent or not,
especially for the high spatial discretized scheme. We present three benchmark tests to verify our implementation
on lid-driven cavity flow [37], flow over a bump [38], and flow over
a forward-facing step [39].

4.1. Lid driven cavity

Lid-driven cavity flow [37], a typical example for incompress-


ible flow, demonstrates the programs capability to reproduce the
characteristics of low Mach number conditions. The side length of
C. Shen et al. / Computer Physics Communications 185 (2014) 27302741 2739

(a) Ma = 0.675.

(b) Ma = 0.001.

Fig. 9. Comparison of Mach magnitude contours.

cavity is d = 0.1 m and the velocity of the top lid is ux . The compu- accurate of the methods considered here, as also observed from
tational grid is 40 40. Reynolds number Re = ux d = 5000, where Fig. 5. The difference among the lines produced by the other four
is the dynamics viscosity. algorithms is not clear. Among these four lines, the line produced
For the lid driven flow, there are four typical vortex zones, top by the reconstruction in this paper [12,19] with QUICK limiter
left(TL), bottom left(BL), bottom right(BR) and center zones, as is closer to the line from Ref. [37] and the line produced by the
shown in Fig. 4. In this paper, these four vortex zones are divided reconstruction [12,19] with vanLeer limiter is a little farther from
by the streamline 13 in Fig. 5, of which the magnitude is zero. the standard line from Ref. [37].
The capability to resolve these four vortex zones is confirmed, in From Figs. 6 and 7, there are obvious differences between the
order to judge the accuracy corresponding to different numerical computational results in this paper and the data from Ref. [37], es-
methods. pecially for the extreme values at the inflection point. The 40 40
Fig. 5 shows the steady state streamline with different recon- mesh is much coarser than the mesh in Ref. [37], so the refined
struction forms and limiters. The results corresponding to Fig. 5(a) 80 80 mesh is considered to investigate the effect of the grid
and (b) are obtained by preconditioned AUSM+(P) with one di- quality on the computational results. As shown in Fig. 8, the results
mensional and multi-dimensional reconstruction. By comparing corresponding to the refined grid are much closer to the numerical
Fig. 5(a) and (b) for the reconstruction form in densityBasedTurbo results in Ref. [37] than the coarse 40 40 grid. The comparison
solver [20], it is apparently concluded that the multi-dimensional results also indicate the reliability of the program in this paper.
reconstruction form [20,40] can capture the vortex zones more
accurately than the one dimensional reconstruction form. The 4.2. Flow crosses over bump
results corresponding to Fig. 5(c) and (d) are obtained by precondi-
tioned AUSM+(P) with one dimensional reconstruction [12,20] in Computations of flow over a 10% bump are used to verify the
this paper, shown in Section 2.3.3, which is combined with van- solver presented in this paper for transonic conditions. The mesh
Leer limiter. As exhibited in Fig. 5(b) and (c), multi-dimensional (66 18) which is similar as the mesh in Ref. [38] is adopted. The
reconstruction form can resolve streamline 1 but one dimen- interface reconstruction method [12,19], shown in Section 2.3.3
sional reconstruction with vanLeer limiter in this paper cannot. and vanLeer limited function are used. The computational Mach
Besides, the capabilities of these two form to capture the vortex contours corresponding to Ma = 0.675 and Ma = 0.001 are
zones are nearly the same with each other. The areas enclosed compared with numerical results from Refs. [38,33], respectively.
by corresponding streamlines in Fig. 5(d) are the largest among The computational results show good agreement, as shown in
Fig. 5(b)(d) and thereby, the capability to resolve the vortex cor- Fig. 9. The comparison corresponding to the bump benchmark
responding to Fig. 5(d) is the strongest among these three recon- provides another indication that the solver with reconstruction in
struction forms. However, the numerical result with QUICK limiter, Section 2.3.3 can capture the principle features of subsonic and
shown in Fig. 5(d), is not stable and produces oscillations close to incompressible flow with low speeds.
the bottom wall at the bottom left and right vortex zones. Fig. 5(e)
shows the computational result obtained by rhoPisoFoam within 4.3. Flow over forward facing step
OpenFOAM which is one of the most reliable solvers for the in-
compressible lid driven flow. Compared with the distribution of Benchmarking inviscid flow over a forward-facing step provides
streamlines in Fig. 5(e), it is concluded that the reconstruction a verification of our solver for time-dependent supersonic
forms corresponding to Fig. 5(b)(d), except Fig. 5(a), can accu- conditions. Both the dual time scheme described in Section 2.4
rately capture the principle vortex information. and the physical time preconditioned method (turning off the
Figs. 6 and 7 are the velocity distribution along the horizontal preconditioning) described in Section 2.2, are adopted to capture
and vertical centerlines of the cavity. In these two pictures, the the unsteady flow characteristics. In the solver adopted dual time
numerical results from Ref. [37] are used for comparison. As shown scheme, the physical time step is t = 0.1 s and the pseudo-time
in the locally enlarged pictures in Figs. 6 and 7, the line obtained step = 0.001 s. The interface reconstruction method, shown in
by the one dimensional reconstruction form with vanLeer limiter Section 2.3.3 and the vanLeer limited function are used.
in the original densityBasedTurbo solver [20] apparently deviates The computational results are shown in Fig. 10. In Fig. 10, the re-
from the results from Ref. [37]. This phenomena points out that sults marked densityBasedTurbo are obtained by densityBased-
this one dimensional vanLeer reconstruction form is the least Turbo solver with the multidimensional Venkatakrishnan limiter
2740 C. Shen et al. / Computer Physics Communications 185 (2014) 27302741

(a) t = 0.5 s. (b) t = 1 s.

(c) t = 2 s. (d) t = 4 s.

Fig. 10. Comparison of density magnitude contours.

and other computing conditions are the same with Ref. [20]. Note tained by the dual time scheme are smoothed, indicating that the
that the magnitudes of the corresponding the magnitudes of cor- dual time in this paper is more diffusive than the physical time pre-
responding contour lines between the results obtained by the pro- conditioned method and the scheme in Ref. [39]. In Fig. 10(c) and
gram in this paper and the densityBasedTurbo solver are strictly (d), the thickness and location of the incident and reflected shocks
equal to each other, but are not strictly equal with the results from are nearly the same with each other. However, the contour lines
Ref. [39]. In Fig. 10(a) and (b), the contour lines corresponding to obtained by the two solvers in this paper, produce oscillations just
the physical time preconditioned method are nearly the same with downstream of the shock reflected from the step. For both of the
the data from Ref. [39]. In the region near the outlet, the results ob- solver in this paper and densityBasedTurbo solver, there is some
C. Shen et al. / Computer Physics Communications 185 (2014) 27302741 2741

kind of pre shock before the front shock in front of the obstacle, [11] M. Darbandi, E. Roohi, Study of subsonicsupersonic gas flow through mi-
but the pre shock obtained by the program in this paper is much cro/nanoscale nozzles using unstructured DSMC solver, Microfluid Nanofluid
10 (2011) 321335.
lighter than densityBasedTurbo. [12] H. Jasak, H.G. Weller, A.D. Gosman, High resolution NVD differencing scheme
In all, the two solvers in this paper can capture the principle for arbitrarily unstructured meshes, Int. J. Numer. Methods Fluids 31 (1999)
features of forward step flow, including the unsteady characteris- 431449.
[13] V. Vuorinen, M. Larmi, P. Schlatter, L. Fuchs, et al., A low-dissipative, scale-
tics, although the numerical results obtained by these two precon-
selective discretization scheme for the NavierStokes equations, Computers &
ditioned solvers with and without the dual time scheme exhibit Fluids 70 (2012) 195205.
some drawbacks. [14] H. Weller, H.G. Weller, A high-order arbitrarily unstructured finite-volume
model of the global atmosphere: tests solving the shallow-water equations,
Int. J. Numer. Methods Fluids 56 (2008) 15892596.
5. Conclusion [15] H. Weller, H.G. Weller, A. Fournier, Voronoi, Delaunay, and lock-structured
mesh refinement for solution of the shallow-water equations on the sphere,
A density-based solver for all speeds in the framework of Mon. Weather Rev. 137 (2009) 42084224.
OpenFOAM has been developed based on densityBasedTurbo [16] N.T.P. Le, C. White, J.M. Reese, R.S. Myong, LangmuirMaxwell and Lang-
muirSmoluchowski boundary conditions for thermal gas flow simulations in
solver. To complement the existing all speeds convective scheme, hypersonic aerodynamics, Int. J. Heat Mass Transfer 55 (2012) 50325043.
AUSM+up, the preconditioned all speeds AUSM+(P) scheme has [17] S.V. Patankar, Numerical Heat and Mass Transfer and Fluid Flow, McGraw-Hill,
been implemented. Another interface reconstruction algorithm 1980.
[18] R.I. Issa, Solution of the implicitly discretized fluid flow equations by operator-
which is similar as the reconstruction scheme in the solver splitting, J. Comput. Phys. 62 (1986) 4065.
rhoCentralFoam within OpenFOAM has been established to [19] J.G. Christopher, G.W. Henry, G. Luca, et al., Implementation of semi-discrete,
improve the accuracy of the convective scheme. Dual time non-staggered central schemes in a collocated, polyhedral, finite volume
scheme has been implemented for the unsteady problem. Parallel framework, for high-speed viscous flows, Int. J. Numer. Methods Fluid 63
(2010) 121.
computation is implemented to accelerate the solving process. [20] O. Borm, A. Jemcov, H.P. Kau, Density based navier stokes solver for transonic
The consistency of the developed models was checked ver- flows, in: 6th OpenFOAM Workshop, PennState University, USA, 2011. http://
sus established numerical solutions by others for three typical sourceforge.net/projects/openfoam-extend/files/OpenFOAM_Workshops/
OFW6_2011_PennStatP/Presentations/oliver_borm_slides.pdf/download.
benchmark cases. For the first test case, low-speed incompress-
[21] O. Borm, B. Balassa, H.P. Kau, Comparison different numerical approaches
ible lid driven flow, the preconditioned solver with the interface at the centrifugal compressor radiver, in: ISABE-2011-1242, 20th ISABE
reconstruction method, implemented in this paper, could cap- Conference, International Society for Airbreathing Engines, Gothenburg,
ture the vortex zones precisely and the accuracy of this one di- Sweden, 12th16th, September 2011.
mensional reconstruction method was almost equivalent to the [22] O. Borm, H.P. Kau, Unsteady aerodynamics of a centrifugal compressor stage-
validation of two different CFD solvers, in: Proceedings of ASME Turbo Expo
multi-dimensional reconstruction algorithm in the original densi- 2012, GT2012, Copenhagen, Denmark, June 1115, 2012, GT2012-69636.
tyBasedTurbo solver. For the second test case, flow crossing over [23] P.L. Roe, Approximate Riemann solvers, parameter vectors and schemes, J.
bump, the comparison results further proved that the new solver Comput. Phys. 43 (1981) 357372.
[24] P.L. Roe, J. Pike, Efficient Construction and Utilization of Approximate
in this paper can capture the characteristics of low-speed incom-
Riemann Solutions, Symposium on Computing Methods in Applied Science
pressible flow. For the third test case, flow over forward facing step, and Engineering, North-Holland, The Netherlands, 1984.
the computational results showed that the dual time could cap- [25] M.S. Liou, C.J. Steffen Jr., A new flux splitting scheme, J. Comput. Phys. 107
ture the principle features in the unsteady process, although it was (1993) 2339.
[26] M.S. Liou, A sequel to AUSM: AUSM+, J. Comput. Phys. 129 (1996) 364382.
more diffusive than the physical time step scheme.
[27] M.S. Liou, A sequel to AUSM, part II: AUSM+-up for all speeds, J. Comput. Phys.
214 (2006) 137170.
Acknowledgments [28] J. Blazek, Computational Fluid Dynamics: Principles and Applications, second
ed., Elsevier, 2005.
[29] J.M. Weiss, W.A. Smith, Preconditioning applied to variable and constant
This study was supported by the National Natural Science density flows, AIAA J. 33 (1995) 20502057.
Foundation of China (Grant No. 51176038) and the Foundation [30] S.J. Zhang, A. Meganathan, Preconditioning Methods in CFD-FASTRAN, AIAA-
20082701, 2008.
for Innovative Research Groups of the National Natural Science
[31] S. Saegeler, C. Mundt, Implementation of a preconditioner for a density-based
Foundation of China (Grant No. 51121004). NavierStokes solver, in: 7th OpenFOAM Workshop, Technische Universitt
Darmstadt, Germany, 2012. http://sourceforge.net/projects/openfoam-
extend/files/OpenFOAM_Workshops/OFW7_2012_Darmstadt/Workshop-
References
Documents/Presentations-Talks/SaegelerSebastian/Final-
SebastianSaegelerSlidesOFW7.pdf/download.
[1] OpenFOAM, 2012. http://www.openfoam.com. [32] S.F. Saegeler, C. Mundt, Advanced Numerical Simulation of Mixing Hot Core
[2] H.G. Weller, G. Tabor, H. Jasak, et al., A tensorial approach to computational and Cold Bypass Flow in Modern Propulsion Systems with Internal Lobed
continuum mechanics using object-oriented techniques, Comput. Phys. 12
Forced Mixer, AIAA, 2013, pp. 20132424.
(1998) 620631. [33] J.R. Edwards, M.S. Liou, Low-diffusion Flux-splitting Methods for Flows at All
[3] OpenFOAM, The Open Source CFD Toolbox, User Guide, ESI-OpenCFD Ltd,
Speed, AIAA-97-1862, 1997.
2010.
[4] Fastran, 2012. http://www.esi-cfd.com. [34] C. Shen, F.X. Sun, X.L. Xia, Analysis on capability of density based solver within
[5] Ansys, 2012. http://www.ansys.com/. OpenFOAM to distinguish aerothermal variables in diffusion boundary layer,
[6] V. Novaresio, M. Garca-Camprub, S. Izquierdo, P. Asinari, N. Fueyo, An open- Chin. J. Aeronaut. 26 (2014) 13701379.
source library for the numerical modeling of mass-transfer in solid oxide fuel [35] H.K. Versteeg, W. Malalasekera, An Introduction to Computational Fluid
cells, Comput. Phys. Comm. 183 (2012) 125146. Dynamics: The Finite Volume Method, second ed., Pearson Education Ltd,
[7] I.A. Cosden, J.R. Lukes, A hybrid atomisticcontinuum model for fluid flow London, 2007.
using LAMMPS and OpenFOAM, Comput. Phys. Comm. 184 (2013) 19581965. [36] M.S. Darwish, F. Moukalled, TVD schemes for unstructured grids, Int. J. Heat
[8] C. Habchi, S. Russeil, D. Bougeard, et al., Partitioned solver for strongly coupled Mass Transfer 46 (2003) 599611.
fluidstructure interaction, Comput. Fluids 71 (2013) 306319. [37] U. Ghia, K.N. Ghia, C.T. Shin, High-Re solutions for incompressible flow using
[9] K. Kissling, J. Springer, H. Jasak, et al. A coupled pressure based solution the NavierStokes equations and a multigrid method, J. Comput. Phys. 48
algorithm based on the volume-of fluid approach for two or more immiscible (1983) 387411.
fluid, in: V European Conference on Computational Fluid Dynamics, ECCOMAS [38] Ron-HoNi, A multiple-grid scheme for solving the Euler equations, AIAA J. 20
CFD 2010. Lisbon, Portugal, 1417 June 2010. (11) (1983) 15651571.
[10] I. Clifford, H. Jasak, The application of a multi-physics toolkit to spatial reactor [39] P. Woodward, P. Colella, The numerical simulation of two-dimensional fluid
dynamics, in: International Conference on Mathematics, Computational flow with strong shocks, J. Comput. Phys. 54 (1984) 115173.
Methods and Reactor Physics (2009). Saratoga Springs, New York, May 37, [40] V. Venkatakrishman, Convergence to steady of the Euler equations on
2009, on CD-ROM, American Nuclear Society, LaGrange Park, IL (2009). unstructured grids with limiters, J. Comput. Phys. 118 (1995) 120130.