Download Implementation of Level Set Method Based on OpenFOAM for Capturing the Free Interface in In Compressible Fluid ...
Implementation of the Level Set Method into OpenFOAM for Capturing the Free Interface in Incompressible Fluid Flows Bitan Shu, Frank Dammel, Peter Stephan e-mail:
[email protected] Chair of Technical Thermodynamics, Technische Universit¨at Darmstadt Petersenstr. 30, 64287 Darmstadt, Germany
Abstract The topic of this work is the implementation of the level set method into OpenFOAM for capturing the free interface motion in incompressible fluid flows. The incompressible fluid flow is calculated with mass conservation equation and momentum transport equation. The free interface is indicated with the zero level set of a smooth distance function. The level set method has two important issues: the reinitialisation of the level set function and the mass conservation. During the reinitialisation of the level set function, an upwind scheme and a WENO scheme are applied to calculate the gradient. To avoid the loss of mass, the method which was introduced by Chang et al. [3] is used. As test case, the terminal velocities of rising air bubbles in water are calculated. Additionally, detachment of a bubble from a wall is simulated.
1 Introduction Capturing the motion of a free interface in incompressible multi-phase fluid flows is a challenging research field of computational fluid dynamics. The motion of a free interface is a important physical phenomenon in many physically interesting problems, e.g. combustion and nucleate boiling. The level set method is becoming more and more popular to capture the motion of a free surface since its introduction by Osher and Sethian [9]. In the level set method, the interface is captured implicitly by the level set function embedded in the fluid field. The simplest choice for the level set function is the signed distance from the interface. In this way the level set function is smooth and continuous, its spatial derivatives can be accurately determined for the calculation of the interface curvature. As in the volume of fluid (VOF) method, there is no difficulty to handle the topological change of the interface during its evolution, so that the detachment of a bubble from a wall and the merging of bubbles can be simulated without special efforts. In general, the implementation of the level set
1
method is straightforward, as well as the extension from 2D simulation to 3D simulation. Another advantage of the level set method is the maintenance of the sharp interface which in the VOF method can only be remained by the complicated reconstruction of the interface [16]. The maintenance of the sharp interface is the major motivation for this work. A sharp interface is required, e.g. if the heat transfer has to be calculated during simulation of fluid flows with phase change [15]. Sussman et al. [14] were the first that applied the level set method to incompressible fluid flows. In their work two-phase fluid flow with a large density ratio of about 1000 could be successfully simulated. In this work the level set method is combined with the PISO method [5] for solving the mass conservation equation and the momentum transport equation. This method is then applied to simulate rising air bubble in water, a problem with a large density ratio. The second example, the detachment of a bubble, shows the ability of this method to handle the topological change of the interface.
2 Numerical Formulation 2.1 Governing Equations The mass conservation equation for incompressible fluid flow is ∇ · u = 0.
(1)
Using the continuum surface force model [2], the momentum transport equation for incompressible flow is ∂u + ∇u · u = −∇p + ρg + ∇ · µ∇(u + uT ) + σκδ(φ)∇φ. (2) ρ ∂t The level set function φ is defined as negative in the gas phase, positive in the liquid phase and 0 at the interface. The equation for the advection of the level set function φ with the flow field reads: ∂φ + u · ∇φ = 0 (3) ∂t In equation (2) σ is the surface tension and κ is the interface curvature which can be calculated with the following equation: κ=∇·
∇φ |∇φ|
(4)
δ(φ) depends on the φ-field: δ(φ) =
(
0 1 2 (1
+ cos(πφ/ǫ))/ǫ
2
if |φ| ≥ ǫ if |φ| < ǫ.
(5)
The δ-function is the derivative of the Heaviside-function H: if φ ≤ −ǫ 0 H= 1 if φ ≥ ǫ (φ + ǫ)/(2ǫ) + sin(πφ/ǫ)/(2π) if |φ| < ǫ.
(6)
The H-function is used to smooth the density and the viscosity at the interface over a width of ǫ, which can be chosen to be 1.5 grid width (h). Thus, the density and the viscosity over the whole fluid field are: ρ = ρg + (ρl − ρg )H (7) and µ = µg + (µl − µg )H.
(8)
2.2 Solution of the Governing Equations Equations (1) and (2) in section 2.1 are discretised and solved with the PISO method [5] in the framework of the finite volume method, which is already available in OpenFOAM [1, 6, 10]. The equation for the level set function (3) is modified as follows: ∂φ + ∇ · (uφ) = 0, ∂t
(9)
which holds because of equation (1). This equation is more suitable for discretisation with the finite volume method in OpenFOAM. The level set function φ is defined as a volScalarField in OpenFOAM, and the term ∇ · (uφ) can be discretised with the first order upwind scheme.
2.3 Reinitialisation of the Level Set Function The level set function is defined as the distance function from the interface. However, it will not remain the distance function during the advection because the velocity field is not uniform in general. For this reason it must be reinitialised after some time steps with the following equation: ∂φ = sign(φ0 )(1 − |∇φ|) (10) ∂τ Here, τ is the artificial time. The level set field at the beginning of the iteration is: φ(x, 0) = φ0 (x) The steady state solution of the equation (10) satisfies the condition |∇φ| = 1, so that it is the distance function from the interface. To solve equation (10), the first order upwind scheme can be used to determine the gradient of the φ-field during the iterations. In the upwind scheme the gradient is calculated
3
on both sides of the cells [14]. Therefore, the following variables are defined: a = Dx− φij ≡ ∇x− ≡ (φij − φi−1,j )/h b = Dx+ φij ≡ ∇x+ ≡ (φi+1,j − φi,j )/h c = Dy− φij ≡ ∇y− ≡ (φij − φi,j−1 )/h d = Dy+ φij ≡ ∇y+ ≡ (φi,j+1 − φi,j )/h,
(11)
the smoothed sign function
and
Sǫ (φij,0 ) = q
φij,0 φ2ij,0 + ǫ2
,
p 0 + 2 − 2 + 2 − 2 pmax((a ) , (b ) ) + max((c ) , (d ) ) − 1 if φij > 0 G(φ)ij = max((a− )2 , (b+ )2 ) + max((c− )2 , (d+ )2 ) − 1 if φ0ij < 0 . 0 otherwise
(12)
Everywhere holds x+ = max(x, 0) and x− = min(x, 0). The equations defined above can be extended to the 3D case in similar manner. Equation (10) is updated with the following equation: +1 0 N φN = φN ij − ∆τ Sǫ (φij )G(φij ). ij
(13)
The artificial time step ∆τ must be smaller than one grid width and is chosen to be 0.1 grid width in the test cases. The stop criterion for the iterations is: P +1 |φN − φN ij | |φN ij ij |