A GENERAL GALERKIN FINITE ELEMENT METHOD ... - CSC - KTH

3 downloads 188 Views 506KB Size Report
of a flow is defined as Re = UL/ν, with U and L being characteristic velocity and .... Re(eh,ve n) + SDe(eh; ve n)=0,. (3.9) with. Rρ(ρh; vρ n)=(˙ρn,vρ n) − (un ¯ρn ...
A GENERAL GALERKIN FINITE ELEMENT METHOD FOR TURBULENT COMPRESSIBLE FLOW JOHAN HOFFMAN∗ Abstract. In this paper we present a General Galerkin (G2) method for the compressible Euler equations, including turbulent flow. The G2 method presented in this paper is a finite element method with linear approximation in space and time, with componentwise stabilization in the form of streamline diffusion and shock-capturing modifications. The method conserves mass, momentum and energy, and we prove an a posteriori version of the 2nd Law of thermodynamics for the method. We illustrate the method for a laminar shock tube problem for which there exists an exact analytical solution, and also for a turbulent flow problem. Key words. General Galerkin G2 method, stabilized finite element method, turbulent compressible flow, second law of thermodynamics AMS subject classifications. 65M60

1. Introduction. The computational simulation of turbulent flow is an open problem of major importance, where available computational methods are characterized by a high computational cost and a lack of error control. The Reynolds number of a flow is defined as Re = U L/ν, with U and L being characteristic velocity and length scales, respectively, and ν is the viscosity of the fluid. In general, for Re larger than a few hundred we expect partly turbulent flow. The Reynolds number is a measure of the relative importance of convective and viscous effects in the flow, and for very high Reynolds numbers we may use the approximation Re = ∞, corresponding to fully inviscid flow. Inviscid flow is described by the Euler equations, whereas the Navier-Stokes equations describe viscous flow. In this paper we consider the Euler equations, but all methods and results in this paper generalizes to the case of the Navier-Stokes equations. To resolve all the physical scales in a turbulent flow, we may estimate the number of degrees of freedom needed in space-time to be of the order Re3 [1]. In many applications Re > 106 , and thus we would need > 1018 degrees of freedom in spacetime to resolve all scales in a Direct numerical simulation (DNS), which is impossible on any computer of today or tomorrow. To handle the impossibility of DNS, various approaches of filtering the Euler/Navier-Stokes equations have been proposed, such as LES and RANS [10], which result in new equations for the filtered variables including a correction term, the Reynolds stresses, which represents the influence of unresolved scales on resolved scales. The modeling of the Reynolds stresses in a turbulence (or subgrid) model is still considered to be an open problem, see e.g. [10]. In [6, 2] an alternative approach is suggested in the case of incompressible flow, where approximate weak solutions to the Euler/Navier-Stokes equations are computed using a stabilized finite element method which we refer to as General Galerkin (G2), where the mesh is adaptively refined with respect to the error in a chosen (mean value) output. The mesh refinement criterion is based on a posteriori error estimates, with computational solution of an associated dual problem. This note represents a first step towards extending these methods to turbulent compressible flow, where we present a stabilized Galerkin finite element method for the compressible Euler equations. The method is a generalization of the cG(1)cG(1) ∗ School of Computer Science and Communication, KTH, SE-10044 Stockholm, Sweden ([email protected]).

1

2

J. HOFFMAN

method of incompressible flow, which has been shown to be very robust, accurate and efficient when used within an adaptive algorithm [2, 3, 4]. In future work we plan to use the cG(1)cG(1) method for compressible turbulent flow within an adaptive algorithm as well. The method investigated in this paper is of the same family as the SUPG method, see e.g. [7, 12], and the streamline diffusion method, see e.g. [8, 9]. In this paper we first introduce the Euler equations in Section 2, and we then present the cG(1)cG(1) method in Section 3, for which we derive an a posteriori version of the 2nd Law in Section 4, and we show numerical results in Section 5. 2. The Euler equations. The compressible Euler equations expresses conservation of mass, momentum and total energy for an inviscid fluid enclosed in a fixed (open) domain Ω in three-dimensional space R3 with boundary Γ over a time interval [0, tˆ] with initial time zero and final time tˆ. We seek the density ρ, momentum m = ρu, with u = (u1 , u2 , u3 ) the velocity, and the total energy e as functions of (x, t) ∈ Ω ∪ Γ × [0, ˆt ], where x = (x1 , x2 , x3 ) denotes the coordinates in R3 and ui is the velocity in the xi -direction. The Euler equations for u ˆ ≡ (ρ, m, e) read with Q = Ω × I and I = (0, tˆ]: ρ˙ + ∇ · (ρu) m ˙ i + ∇ · (mi u) + p,i e˙ + ∇ · (eu + pu) u·n u ˆ(·, 0)

= = = = =

0 fi 0 0 u ˆ0

in Q, in Q, i = 1, 2, 3, in Q, on Γ × I, in Ω,

(2.1)

where p = p(x, t) is the pressure of the fluid, p,i = ∂p/∂xi is the partial derivative with respect to xi , the dot indicates differentiation with respect to time, n denotes the outward unit normal to Γ and f = (f1 , f2 , f3 ) is a given volume force (like gravity) acting on the fluid, and u ˆ0 = u ˆ0 (x) represents initial conditions. Further, the total energy e = k +θ, where k = ρ|u|2 /2 is the kinetic energy, with |u|2 ≡ u21 +u22 +u23 , and θ = ρT is the internal energy with T the temperature scaled so that cv = 1, where cv is the heat capacity under constant volume. The boundary condition u·n = 0 is a slip boundary condition requiring the normal velocity u · n to vanish corresponding to an impenetrable boundary with zero friction. The number of unknowns including the pressure is six but there are only five equations in the Euler system (2.1), and so we need one more equation. Here we close the system by the state equation of a perfect gas; p = (γ − 1)ρT,

(2.2)

expressing the pressure p as a function of density ρ and temperature T , where γ = c p is the adiabatic index with cp the heat capacity under constant pressure, and (γ − 1) is the gas constant. For a perfect gas, the speed of sound c is given by c2 = γ(γ − 1)T , and the Mach number is defined as M = |u|/c, with u the velocity of the gas. 3. cG(1)cG(1) for the Euler equations. cG(1)cG(1) is a G2 method using the continuous Galerkin method cG(1) in space and time. With cG(1) in time the trial functions are continuous piecewise linear and the test functions piecewise constant. cG(1) in space corresponds to both test functions and trial functions being continuous piecewise linear. Let 0 = t0 < t1 < ... < tN = tˆ, be a sequence of discrete time steps with associated time intervals In = (tn−1 , tn ] of length ∆tn = tn − tn−1 and spacetime slabs Sn = Ω × In , and let Wh ⊂ H 1 (Ω) be a finite element space consisting of

G2 FOR TURBULENT COMPRESSIBLE FLOW

3

continuous piecewise linear functions on a fixed mesh Th = {K} of mesh size h(x), with elements K. We now seek functions u ˆh = (ρh , mh , eh ), continuous piecewise linear in space and time. The cG(1)cG(1) method for the compressible Euler equations, here without source terms for simplicity, reads: For n = 1, ..., N , find u ˆ nh = (ρn , mn , en ) ≡ n 3 (ρh (tn ), mh (tn ), eh (tn )) with u ˆh ∈ Vh ≡ Wh × Wh × Wh , such that (ρ˙ n , vnρ ) − (un ρ¯n , ∇vnρ )

+(δun · ∇¯ ρn , un · ∇vnρ ) + (ˆ νρ ∇¯ ρn , ∇vnρ ) = 0, (m ˙ n , vnm ) − (un m ¯ n , ∇vnm ) − (pn , ∇ · vnm )

(3.1)

+(δun · ∇¯ en , un · ∇vne ) + (ˆ νe ∇¯ en , ∇vne ) = 0,

(3.3)

+(δun · ∇m ¯ n , un · ∇vnm ) + (ˆ νm ∇m ¯ n , ∇vnm ) = 0, (e˙ n , vne ) − (un e¯n , ∇vne ) + (∇ · (un pn ), vne )

(3.2)

for all test functions vˆn = (vnρ , vnm , vne ) ∈ Vh , where X Z (v, w) = v · w dx, K∈Th

K

and ρ˙ n =

ρ¯n =

ρn − ρn−1 , ∆tn

1 (ρn + ρn−1 ), 2

m ˙n=

m ¯n =

mn − mn−1 , ∆tn

e˙ n =

1 (mn + mn−1 ), 2

en − en−1 , ∆tn

e¯n =

1 (en + en−1 ), 2

where we define un and pn to be finite element functions in Wh3 and Wh respectively, which are defined by their nodal values given by un (Ni ) = mn (Ni )/ρn (Ni ), for all nodes Ni in the mesh Th , and similar for pn . We use the stabilization parameters 2 −2 −1/2 δ = Cδ (∆t−2 ) and νˆα = Cα |Rα (ˆ u)|h2 (α = ρ, m, e), with constants Cδ n + |un | h and Cα , where we define the strong residuals by Rρ (ˆ uh ) = ρ˙ n + ∇ · (¯ ρn un ),

Rm (ˆ uh ) = m ˙ n + ∇ · (m ¯ n un ) + ∇pn , Re (ˆ uh ) = e˙ n + ∇ · (¯ en un + pn un ),

(3.4) (3.5) (3.6)

for t ∈ In , and we let the time step ∆tn be given by the smallest element diameter hmin in the mesh Th , with typically ∆tn ∼ hmin . For t ∈ In we may also write cG(1)cG(1) as Rρ (ρh ; vnρ ) + SDρ (ρh ; vnρ ) = 0, Rm (mh ; vnm ) + SDm (mh ; vnm ) = 0,

(3.7) (3.8)

Re (eh , vne ) + SDe (eh ; vne ) = 0,

(3.9)

with Rρ (ρh ; vnρ ) = (ρ˙ n , vnρ ) − (un ρ¯n , ∇vnρ ), Rm (mh ; vnm ) = (m ˙ n , vnm ) − (un m ¯ n , ∇vnm ) − (pn , ∇ · vnm ),

Re (eh ; vne ) = (e˙ n , vne ) − (un e¯n , ∇vne ) + (∇ · (un pn ), vne ),

(3.10) (3.11) (3.12)

4

J. HOFFMAN

and SDρ (ρh ; vnρ ) = (δun · ∇¯ ρn , un · ∇vnρ ) + (ˆ νρ ∇¯ ρn , ∇vnρ ), m m SDm (mh ; vn ) = (δun · ∇m ¯ n , un · ∇vn ) + (ˆ νm ∇m ¯ n , ∇vnm ), SDe (eh ; vne ) = (δun · ∇¯ en , un · ∇vne ) + (ˆ νe ∇¯ en , ∇vne ).

(3.13) (3.14) (3.15)

3.1. Componentwise stabilization. We note that we here stabilize each equation of (2.1) individually, rather than stabilizing the complete system (2.1) using a stabilization matrix, which is a common approach, see e.g. [12]. Our approach here is very simple to implement, and shows stable results for both laminar and turbulent flow. 3.2. Conservation of mass, momentum and total energy. The form of the stabilization, with the test functions only appearing in the form of derivatives, assures conservation of total mass, momentum and energy, which is obtained by choosing each testfunction equal to 1. 3.3. Solution of the discrete system. To solve the system (3.1)-(3.3) we use an outer fixpoint iteration with an inner GMRES solver for the linearized problem. With this method the maximum time step length is determined by a CFL condition with a CFL number of the order 0.1. This solution strategy is probably not the most efficient, and alternative approaches will be investigated in future work, including explicit methods. 4. The 2nd Law for cG(1)cG(1). Assuming that there exists an exact solution u ˆ to the Euler equations (2.1), we would have that K˙ + W = 0,

(4.1)

with the total kinetic energy K≡

Z

W ≡

Z

k dx,

k = ρ|u|2 /2,

w dx,

w ≡ ∇p · u,



and the total work Ω

which is obtained by scalar multiplication of the momentum equation by u and intergration over Ω. But since we do not know that there exists an exact solution, we cannot say that K˙ + W = 0. By an argument of vanishing viscosity, see [5], we may formally derive the following version of the 2nd Law of thermodynamics for the Euler equations: K˙ + W + D = 0,

(4.2)

where D represents loss of kinetic energy due to turbulence and shocks. Let us now derive a 2nd Law for the cG(1)cG(1) solution u ˆ h , corresponding to (4.2), using the following notation kn ≡ ρn |un |2 /2,

k¯n ≡ ρ¯n |un |2 /2,

wn ≡ ∇pn · un .

In the analysis below we assume that νˆα = νˆ for all α. We let w h denote the interpolant of the function w in the finite element space of test functions of cG(1)cG(1),

5

G2 FOR TURBULENT COMPRESSIBLE FLOW

and we let φ ∈ C0∞ (Q) be a positive test function with local support on a subdomain of Q. We then have that for t ∈ In : 0 = Rm (mh ; (un φ)h ) + SDm (mh ; (un φ)h ) = Rm (mh ; un φ) + SDm (mh ; un φ) −(Rm (mh ; un φ − (un φ)h ) + SDm (mh ; un φ − (un φ)h )) = (k˙ n + ∇ · (k¯n un ) + wn , φ) + Rρ (ρh ; |un |2 /2φ) + SDm (mh ; un φ)

−(Rm (mh ; un φ − (un φ)h ) + SDm (mh ; un φ − (un φ)h )) = (k˙ n + ∇ · (k¯n un ) + wn , φ) + SDm (mh ; un φ) − SDρ (ρh ; |un |2 /2φ)

−(Rm (mh ; un φ − (un φ)h ) + SDm (mh ; un φ − (un φ)h )) +Rρ (ρh ; |un |2 /2φ − (|un |2 /2φ)h ) + SDρ (ρh ; |un |2 /2φ − (|un |2 /2φ)h ).

We further have that SDm (mh ; un φ) − SDρ (ρh ; |un |2 /2φ) = (δ ρ¯n un · ∇un , un · ∇un φ) +(ˆ ν ρ¯n ∇un , ∇un φ) + (δun · ∇φ, un · ∇k¯n ) + (ˆ ν ∇φ, ∇k¯n ), so that using the notation dn ≡ (δ ρ¯n un · ∇un ) · (un · ∇un ) + (ˆ ν ρ¯n ∇un ) · ∇un , we have, by integration in time over all time intervals In , that N Z X

n=1

In

(k˙ n + ∇ · (k¯n un ) + wn + dn , φ) dt = E,

(4.3)

with E≡

N Z X

n=1

In

(−(Rm (mh ; un φ − (un φ)h ) + SDm (mh ; un φ − (un φ)h ))

+Rρ (ρh ; |un |2 /2φ − (|un |2 /2φ)h ) + SDρ (ρh ; |un |2 /2φ − (|un |2 /2φ)h )

+(δun · ∇φ, un · ∇kn ) + (ˆ ν ∇φ, ∇kn )) dt.

(4.4)

With suitable stability estimates available for the cG(1)cG(1) discretization of the equations for mass and momentum conservation, E can be bounded by a constant, independent of the mesh size h, times the square root of the largest element diameter of the mesh. For incompressible flow we have this type of stability estimates, see e.g. [5], but for compressible flow this result is not available a priori. On the other hand, since E is function of u ˆh it can be evaluated a posteriori. That is, we may formulate the following a posteriori version of a 2nd Law for cG(1)cG(1): Theorem 4.1. Assume that √ there exists a constant C > 0, independent of the mesh size h, such that |E| ≤ C hmax , with hmax the largest element diameter of the mesh. We then have the following 2nd Law for the cG(1)cG(1) solution u ˆh: |

N Z X

n=1

In

(k˙ n + ∇ · (k¯n un ) + wn + dn , φ) dt| ≤ C

p

hmax .

(4.5)

6

J. HOFFMAN

√ uh )k ≤ To bound |E| a priori, we would need stability estimates of the type k hRα (ˆ C, connected to the streamline diffusion stabilization, together with corresponding stability estimates connected to the shock-capturing terms. We would then be able to use super approximation√[8] and standard interpolation error estimates to derive a bound of the type |E| ≤ C hmax . In an a posteriori setting, where cG(1)cG(1) is used within an adaptive mesh refinement algorithm, we could monitor the condition of Theorem 4.1 as we refine the mesh. If we find that this condition is satisfied, then we would also know that the solution satisfies a 2nd Law of the form (4.5). In future work we will investigate how this is best implemented, including alternative expressions of the condition in Theorem 4.1. 5. Numerical results. We now present numerical results for the cG(1)cG(1) method of this paper. We first test the method for a laminar shock tube problem, to be able to compare our results with the available exact analytical solution. In the next section we test the method for a turbulent flow case, where we find that the method is stable and produces reasonable results. 5.1. Laminar flow: shocktube. We consider the shocktube problem [11] for a 3d rectangular domain Ω of dimension 2 × 1 × 1. The domain is divided into two subdomains of equal volume. To the left a gas is at rest at high pressure, and to the right at low pressure. At time t = 0 the divider is removed and the gases in the two domains are allowed to move. We assume an ideal gas with gas constant γ = 1.4, and with initial conditions u ˆ = (1, 0, 2.5) and u ˆ = (0.125, 0, 0.25) to the left and right, respectively; or equivalently (ρ, u, p) = (1, 0, 1) and (ρ, u, p) = (0.125, 0, 0.1). This is a 1d problem for which we can obtain an exact analytical solution. We now compare this solution with cG(1)cG(1) solutions on 3 different uniform meshes Th1 , Th2 and Th3 , with 33 × 17 × 17, 65 × 33 × 33, and 129 × 65 × 65 mesh points, respectively. We note that even though the problem is a 1d problem we solve the problem in 3d, since our aim is to use this method for 3d turbulent flow problems, which imposes a severe constraint on the maximum number of mesh points that we can afford. The three computational meshes correspond to 1d uniform discretizations using 33, 65 and 129 mesh points respectively. In Fig. 5.1 we plot the exact density, velocity and pressure, together with the corresponding approximations using cG(1)cG(1). We find that the cG(1)cG(1) solutions approximate the exact solution reasonably well considering the meshes are uniform and very coarse, and we can see a clear improvement as the mesh is refined. The shock is resolved using 3 mesh points, the contact discontinuity using about 8 mesh points, and the intermediate piecewise constant values are well captured. In the velocity we have a small undershoot downstream the shock which is reduced when the mesh is refined, and also the approximation of the expansion wave is improving when refining the mesh. 5.2. Conservation of momentum. The basic form of G2 is a least squares stabilized finite element method, in which we add a term corresponding to a weghted least squares method for the residual. Although, in various situations it may be more natural to add a least squares modification of just a part of the residual. For example, in cG(1)cG(1) for incompressible flow, we do not include the time derivative of the residual due to the test functions being piecewise constant in time [2]. A straight forward extension of cG(1)cG(1) to compressible flow may be considered to consist of a least squares stabilization of the term ∇ · (um) = u · ∇m + m∇ · u,

7

G2 FOR TURBULENT COMPRESSIBLE FLOW

1.1

1

0.9

0.8

0.7

0.6

0.5

0.4

0.3

0.2

0.1

0

0.2

0.4

0.6

0.8

1

1.2

1.4

1.6

1.8

2

1

1.2

1.4

1.6

1.8

2

1

1.2

1.4

1.6

1.8

2

1.2

1

0.8

0.6

0.4

0.2

0

−0.2

0

0.2

0.4

0.6

0.8

1

0.8

0.6

0.4

0.2

0

0.2

0.4

0.6

0.8

Fig. 5.1. The density (upper), velocity (middle) and pressure (lower), comparing the exact solution with cG(1)cG(1) solutions on 3 uniformly refined meshes, with ’x’ the finest mesh Th3 and ’o’ the coarsest mesh Th1 .

8

J. HOFFMAN

which would be non conservative. Although, here we choose to only stabilize the convective part u · ∇m, corresponding to a streamline diffusion stabilization, which is conservative. In Fig. 5.2 we compare the two approaches for the finest mesh T h3 , where we find that conservation of momentum (and also mass and energy) is very important in this problem. 5.3. Turbulent flow. We now turn to a test problem of turbulent flow, which is our main goal with developing the method of this paper. We consider two containers of equal volume 1 × 1 × 1, connected by a channel of dimension 0.25 × 0.25 × 0.25. Initially the gas is at rest with density ρ = 1 in the left container and ρ = 0.1 in the right container, with the temperature T = 1 in both containers. At time t = 0 the channel is opened allowing the gas to flow from the left to the right container, driven by the pressure difference. Results from the computation are displayed in Fig. 5.3-5.4, where we find that gas is flowing into the right container developing shocks and turbulence. As the pressure difference between the two containers is reduced, the kinetic energy is dropping. When the pressure is equal in both containers the kinetic energy will drop to zero. Although we do not have any reference data for this problem, the basic features of the solution appear correct, and the numerical method is stable. In future work we will compare the results of an adaptive version of the cG(1)cG(1) method with available benchmark results. REFERENCES [1] U. Frisch, Turbulence - The Legacy of A. N. Kolmogorov, Cambridge University Press, 1995. [2] J. Hoffman, Computation of mean drag for bluff body problems using adaptive dns/les, SIAM J. Sci. Comput., 27(1) (2005), pp. 184–207. , Adaptive simulation of the turbulent flow past a sphere, J. Fluid Mech., 568 (2006), [3] pp. 77–88. [4] , Efficient computation of mean drag for the subcritical flow past a circular cylinder using general galerkin g2, Int. J. Numer. Meth. Fluids, (accepted). [5] J. Hoffman and C. Johnson, Computational Turbulent Incompressible Flow: Applied Mathematics Body and Soul Vol 4, Springer-Verlag Publishing, 2006. [6] , A new approach to computational turbulence modeling, Comput. Methods Appl. Mech. Engrg., 195 (2006), pp. 2865–2880. [7] T. Hughes and T. Tezduyar, Finite element methods for first-order hyperbolic systems with particular emphasis on the compressible euler equations, Computer methods in applied mechanics and engineering, 45 (1984), pp. 217–284. [8] C. Johnson and A. Szepessy, Shock-capturing streamline diffusion finite element methods for nonlinear conservation laws, Recent Developments in Computatioonal Fluid Dynamics, edited by T. J. R. Hughes and T. Tezduyar, AMD-Vol 95, 1988. [9] C. Johnson, A. Szepessy, and P. Hansbo, On the convergence of shock-capturing streamline diffusion finite element methods for hyperbolic conservation laws, Mathematics of Computation, 54(189) (1990), pp. 107–129. [10] P. Sagaut, Large Eddy Simulation for Incompressible Flows, Springer-Verlag, Berlin, Heidelberg, New York, 2001. [11] G. Sod, Numerical methods in fluid dynamics, Cmabridge University Press, 1984. [12] T. E. Tezduyar and M. Senga, Stabilization and shock-capturing parameters in supg formulation of compressible flows, Computer Methods in Applied Mechanics and Engineering, 195 (2006), pp. 1621–1632.

9

G2 FOR TURBULENT COMPRESSIBLE FLOW

1.1

1

0.9

0.8

0.7

0.6

0.5

0.4

0.3

0.2

0.1

0

0.2

0.4

0.6

0.8

1

1.2

1.4

1.6

1.8

2

1

1.2

1.4

1.6

1.8

2

1

1.2

1.4

1.6

1.8

2

1.2

1

0.8

0.6

0.4

0.2

0

−0.2

0

0.2

0.4

0.6

0.8

1

0.8

0.6

0.4

0.2

0

0.2

0.4

0.6

0.8

Fig. 5.2. The density (upper), velocity (middle) and pressure (lower), on a fine mesh with a least squares (’o’) and streamline diffusion stabilization (’x’) of the momentum equation, respectively.

10

J. HOFFMAN

1

0.9

0.8

0.7

0.6

0.5

0.4

0.3

0.2

0.1

0

0

5

10

15

20

25

30

35

30

35

30

35

0.018

0.016

0.014

0.012

0.01

0.008

0.006

0.004

0.002

0

0

5

10

15

20

25

1

0.9

0.8

0.7

0.6

0.5

0.4

0.3

0.2

0.1

0

0

5

10

15

20

25

Fig. 5.3. The total density (upper), total kinetic energy (middle) and total pressure (lower), of the left and right containers, with increasing density and pressure, and high kinetic energy, for the right container.

G2 FOR TURBULENT COMPRESSIBLE FLOW

11

Fig. 5.4. Density (left) and magnitude of momentum (right), for time t = 0.7, 1.8, 2.8, 5.0, 22.1.