14
Free surface handling in FVM - MEK4470/MEK9470 Tormod Landet and Johanna Ridder October 2014 These lecture notes give an overview over what we discussed in class. They are meant to serve as an introduction to the topic, and are hence not very rigorous. Please excuse spelling errors and handmade figures. 1 Physics We will look at a common example for a flow with a free surface, water waves. In addition to the velocity and pressure field in the water, and maybe in the air, we want to calculate how the free surface evolves with time. This problem can be approached in two ways: One can set the compuational domain to the volume covered by water so that the free surface becomes a moving boundary. A disadvantage of this approach is that the boundary conditions must be imposed at an unknown position. Another option is to view the problem as a multi phase flow problem. Then the free surface becomes the interface between the two phases air and water and the boundaries remain fixed. Figure 1: Our example physics: surface gravity waves on the ocean If we assume that the fluids are incompressible, viscous, Newtonian, and immiscible (non-mixable), then the governing equations in each subdomain, as usual, the continuity equation and the Navier- Stokes equations. At the surface, we need to impose boundary or jump conditions (depending on the perspective) for the velocity and the pressure. For the velocity, one can derive that it must be continuous across the surface. To see this, note first that if the normal velocity of the water at the interface was larger than the normal velocity of the interface itself, this would imply a mass flux across the surface. Physically, this can be interpreted as phase change, which is important, for example, when modelling boiling water or cavitation on a ship propeller (low pressure causes gas bubbles to appear and then disappear with a burst that may damage the propeller). However, we will assume that no phase change occurs and hence the normal velocity is continuous across the surface. Second, because we assume the fluids to be viscous, friction at the interface implies that also the tangential velocity must be continuous, in the same manner as at a no-slip boundary. The pressure must satisfy a dynamic surface condition, which is derived from a force balance. The 1

Free surface handling in FVM - MEK4470/MEK9470 · Free surface handling in FVM - MEK4470/MEK9470 Tormod Landet and Johanna Ridder October 2014 These lecture notes give an overview

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Free surface handling in FVM - MEK4470/MEK9470 · Free surface handling in FVM - MEK4470/MEK9470 Tormod Landet and Johanna Ridder October 2014 These lecture notes give an overview

Free surface handling in FVM - MEK4470/MEK9470

Tormod Landet and Johanna Ridder

October 2014

These lecture notes give an overview over what we discussed in class. They are meant to serve as anintroduction to the topic, and are hence not very rigorous. Please excuse spelling errors and handmadefigures.

1 Physics

We will look at a common example for a flow with a free surface, water waves. In addition to thevelocity and pressure field in the water, and maybe in the air, we want to calculate how the free surfaceevolves with time. This problem can be approached in two ways: One can set the compuational domainto the volume covered by water so that the free surface becomes a moving boundary. A disadvantageof this approach is that the boundary conditions must be imposed at an unknown position. Anotheroption is to view the problem as a multi phase flow problem. Then the free surface becomes theinterface between the two phases air and water and the boundaries remain fixed.

Figure 1: Our example physics: surface gravity waves on the ocean

If we assume that the fluids are incompressible, viscous, Newtonian, and immiscible (non-mixable),then the governing equations in each subdomain, as usual, the continuity equation and the Navier-Stokes equations. At the surface, we need to impose boundary or jump conditions (depending on theperspective) for the velocity and the pressure.

For the velocity, one can derive that it must be continuous across the surface. To see this, note firstthat if the normal velocity of the water at the interface was larger than the normal velocity of theinterface itself, this would imply a mass flux across the surface. Physically, this can be interpretedas phase change, which is important, for example, when modelling boiling water or cavitation on aship propeller (low pressure causes gas bubbles to appear and then disappear with a burst that maydamage the propeller). However, we will assume that no phase change occurs and hence the normalvelocity is continuous across the surface. Second, because we assume the fluids to be viscous, frictionat the interface implies that also the tangential velocity must be continuous, in the same manner asat a no-slip boundary.

The pressure must satisfy a dynamic surface condition, which is derived from a force balance. The

1

Page 2: Free surface handling in FVM - MEK4470/MEK9470 · Free surface handling in FVM - MEK4470/MEK9470 Tormod Landet and Johanna Ridder October 2014 These lecture notes give an overview

normal stresses and the surface tension should cancel, leading to

σκn = (T1 − T2) · n ,

where σ is the surface tension coefficient, κ is the curvature of the surface, n is the unit normal vector(pointing out of the water), and T1 and T2 are the stress tensors of water and air, given by

Ti = −piI + µi(∇u + (∇u)T ) .

The surface tension only becomes important if the curvature is of about the same order as the waterdepth or larger, therefore it is negligible in our example. Note also that taking µ1 = µ2 = 0 wouldyield the surface pressure condition p1 = p2 for inviscous flow.

If one views the problem as a two-phase flow, the Navier-Stokes equations need to be solved in bothsubdomains. Since the domain of the water and the air do not overlap, one can instead solve theequations for an imaginary fluid that fills the whole domain and changes its viscosity and densityabruptly at the interface. Then, the governing equations will be

du

dt+ (u · ∇)u =

1

ρ∇ · µ(∇u + (∇u)T )− 1

ρp+ f , and ∇ · u = 0 ,

whereρ(x) = ρ2 + (ρ1 − ρ2)H(x) ,

µ(x) = µ2 + (µ1 − µ2)H(x) ,and H(x) =

1 , if x ∈ Ωwater,

0 , if x ∈ Ωair.

2

Page 3: Free surface handling in FVM - MEK4470/MEK9470 · Free surface handling in FVM - MEK4470/MEK9470 Tormod Landet and Johanna Ridder October 2014 These lecture notes give an overview

2 Overview over available methods

The below table shows the most common methods for handling the free surface in a computer code.Only the Eulerian methods will be discussed in depth. The symbol χ in the Lagrangian methodsrefer to the coordinate of the paricle or mesh node. The symbol C/ φ is the colour function/distancefunction which will be discussed further below.

Surface Capturing Surface Tracking

Eulerian: DCDt = ∂C

∂t + u · ∇C = 0 Lagrangian: ∂χ∂t = u(χ)

Volume Of Fluid(VOF)

Level Set Particle tracking Mesh deformation

Heavyside functionC = 1 in waterC = 0 in air

Distance functionφ > 0 in waterφ = 0 on FSφ < 0 in air

Only vertical movem.⇒ height function

All nodes follow u⇒ Pure Lagrangian

Internal nodes followsurface nodes⇒ ALE (ArbitraryLagrangian Eulerian)

The easiest method is the height function approach on a regular grid. From the fact that h(x, t)−z = 0on the surface and that the surface moves with the fluid velocity, one can derive the kinematic boundarycondition

(∂/∂t+ u · ∇)(h(x, t)− z) = 0 , i.e.,

∂h

∂t+ u

∂h

∂x+ v

∂h

∂y− w = 0 .

This equation is coupled with the Navier-Stokes equations. In each time step, new values of the heightfunction at the grid points are calculated, which then can be used to impose the correct boundaryconditions for the Navier-Stokes solver. The problem with the height function method is that it cannotdeal with overturning waves, since these would result in multivalued functions.

Moving grid methods use grid points that follow the deformation of the surface so that boundaryconditions can be applied more accurately. An example is the ALE (Arbitrary Lagrangian Eulerian)method, where the grid points on the surface follow the fluid velocity (Lagrangian), the grid pointson the bottom are fixed (Eulerian) and the grid points inbetween move such that the grid becomes asregular as possible (“arbitrary” velocity). Also these methods are not suitable for overturning waves.

3

Page 4: Free surface handling in FVM - MEK4470/MEK9470 · Free surface handling in FVM - MEK4470/MEK9470 Tormod Landet and Johanna Ridder October 2014 These lecture notes give an overview

Figure 2: ALE mesh — the nodes move with the free surface, linearly interpolated to 0 movement at the bottom

The first type of methods that was developed to compute more general waves were the “particlemethods”. These can be divided into interface tracking and volume tracking methods. Both use alarge number of massless particles which is distributed on the interface or within the fluid volumeand then convected with the fluid velocity by solving a simple ODE for each particle. This is aLagrangian approach, i.e., the frame of reference moves with the particles. From time to time, itmight be necessary to redistribute the particles to ensure that the interface or fluid volume is evenlycovered. In case of the interface tracking methods, complicated waves can make this redistributionprocess difficult. Especially changes in the topology (e.g., a drop seperating into two), which requirea new parametrization of the interface, are difficult to compute without manual adjustments. Thevolume tracking particle methods can handle such situations better, but are computationally morecostly, since a larger number of particles must be tracked.

Figure 3: Particle tracking method

The Eulerian methods use a fixed grid and a function that is defined on the whole domain to capturethe position of the interface, instead of tracking it directly. The most prominent examples for suchmethods are the VOF (Volume of Fluid) method and the Level Set method. The VOF method usesthe Heaviside function, which is 1 on the subdomain covered by water and 0 in the air, which is called“color function” in this context. On each grid cell, the integral of the color function is approximated,which corresponds to the fraction of the cell that is covered by water. The level set method usesinstead an implicit representation of the interface through functions with zero level set equal to the

4

Page 5: Free surface handling in FVM - MEK4470/MEK9470 · Free surface handling in FVM - MEK4470/MEK9470 Tormod Landet and Johanna Ridder October 2014 These lecture notes give an overview

interface. The value of such a “level set function” is approximated at each grid point and the interfacecan be constructed from these by interpolation. Since the interface is moving with the fluid velocity,both the color function and the level set function need to satisfy the standard transport equation.

Figure 4: VOF with SLIC method

Figure 5: Level Set method

5

Page 6: Free surface handling in FVM - MEK4470/MEK9470 · Free surface handling in FVM - MEK4470/MEK9470 Tormod Landet and Johanna Ridder October 2014 These lecture notes give an overview

3 Level set

The basic idea of the level set method is to describe the interface between the two phases, in our casewater and air, implicitly in terms of a level set function φ that is negative in one phase, positive inthe other, and zero on the interface, i.e., the interface is the zero level set of φ. This description of theboundary has the advantage that complicated shapes and topological changes like merging or pinchingcan be represented by the level set of smooth level set functions, see, e.g., Figure 6.

Figure 6: Interface seperation represented by a smooth implicit function

A common choice for φ is the signed distance function, given by

φ(x) =

−d(x, ∂Ω) if x ∈ Ωair ,

d(x, ∂Ω) if x ∈ Ωwater ,where d(x, ∂Ω) = min

xs∈∂Ω|x− xs| .

The signed distance function has the property that it satisfies |∇φ| = 1 (the Eikonal equation) almosteverywhere in the domain (except for points that have the same distance to more than one point onthe boundary), which is useful also because it simplifies the formulas for the local unit normal ton = ∇φ and for the curvature to κ = ∆φ. Moreover, the fact that it has neither very steep nor flatgradients, reduces errors and oscillations when applying numerical methods.

To recover the interface from the function values of φ at the grid points, one can interpolate φ andthen calculate the zero level set of the interpolant. This will result in a sharp interface, which is anadvantage of the level set method over the VOF method, which, as we will see below, needs moresophisticated methods to reconstruct a sharp interface from the approximated discrete values. Alsoother information that depends on the shape of the interface can be obtained relatively easily. Thisbecomes important, for example, when taking into account surface tension, which depends on thecurvature of the interface.

To calculate the evolution of the interface over time, one applies standard, preferably higher order,finite volume methods to

φt + u · ∇φ = 0 , (1)

where u is the velocity of the water and the air at the interface. This equation is solved wherever φis defined, i.e., generally on the whole domain, or in case of local level set methods, within a bandabout the interface. In order to apply a numerical scheme, the velocity u must be known throughoutthe computational domain. One straight-forward option is to use the real velocity of the fluids withinthe subdomains. However, here only the velocity on the interface itself is important and unnessecaryvariations in normal direction can lead to inaccuracies in the numerical scheme. Hence, another optionis to use an artificial velocity which corresponds to the velocity at the nearest point on the interface.

6

Page 7: Free surface handling in FVM - MEK4470/MEK9470 · Free surface handling in FVM - MEK4470/MEK9470 Tormod Landet and Johanna Ridder October 2014 These lecture notes give an overview

Depending on the flow field, the level set function can become strongly distorted. Since very steepor flat gradients of φ can render the numerical methods less accurate, one needs to adjust the levelset function in such situations. This can be done, for example, by setting φ back to a signed distancefunction. Computationally, this requires calculating the interface and then calulating all distancesat the grid points, which can be expensive. Methods like the “fast marching methods” optimize theupdating procedure. Local level set methods reduce the cost of the reinitialization step by calculatingonly values on the grid points close to the interface and instead reinitialize more often.

A serious problem when applying level set methods to fluid mechanics is that they do not conservemass. Even if a conservative scheme is used to discretize the transport equation for the level setfunction, only the integral over the distances within each subdomain is conserved, not the volume.The reinitialization step can lead to additional errors. Therefore, several adaptions of the level setmethod have been suggested. One can, for example, couple it with a volume conserving method like theparticle volume tracking methods or the VOF method. More specifically, one can distribute masslessparticles near the interface and then convect them with the fluid velocity just like in the classicalparticle methods. When a particle crosses the interface that is computed by the level set method,mass loss is detected and the level set function adapted correspondingly. Many other variants of thelevel set method exist, see for example the books [1] and [2].

7

Page 8: Free surface handling in FVM - MEK4470/MEK9470 · Free surface handling in FVM - MEK4470/MEK9470 Tormod Landet and Johanna Ridder October 2014 These lecture notes give an overview

4 Volume of Fluid (VOF)

We can try to solve the transport equation for the colour function, DCDt = 0, with a normal finite

volume discretization scheme. It will do something like this close to the interface:

Figure 7: Example of numerical problems related to the sharp jump in the colour function

Here the low order schemes cause the surface to become overly diffusive while the higher order schemescauses the colour function C to take on unphysical values. Overall mass conservation can be kept, butsome cells may get negative amounts of water or more water that the cell volume allows.

4.1 Geometrical reconstruction

We may use pure geometrical means to flux the surface. As an example, consider the fact that a cellin 1D must fully fill up before the next cell can get any fluid:

Figure 8: Geometric reconstruction in 1D

In 2D and 3D there are two popular choices:

• SLIC: Simple Line Interface Calculation

• PLIC: Piecewise Linear Interface Construction

In the SLIC method the direction of the surface normal is established first, typically based on thevalue of the colour function in the neighbouring cells. There are 4 options for the configuration in 2Dif we round the normal direction to the closest 90 degrees on a rectangle cell:

Figure 9: SLIC configurations with a four face cell

8

Page 9: Free surface handling in FVM - MEK4470/MEK9470 · Free surface handling in FVM - MEK4470/MEK9470 Tormod Landet and Johanna Ridder October 2014 These lecture notes give an overview

If we take the normal direction into account when we advect the colour function field C then we canavoid numerical diffusion in many cases, since we can avoid fluxing through faces that are not wetted.

Figure 10: Example of 2D flux of C using SLIC. Figures a and b shows the real position of the interface in twosubsequent time steps. The gray fields in figures c and d are two possible discretisations of the figure a. Thegreen fields in figures c and d shows the volumes that will be fluxed right between the two time steps. Figured will cause numerical difusion, a ”drop” wil break away from the surface.

In the SLIC method the free surface will be staircased, this is the price we pay for simplicity. Themore advanced PLIC method identifies the most wetted corner. For a quadrilateral element we canidentify four cases for each corner, examplified for the lower right corner here:

We can then flux based on the surface angle and a bit of trigonometry (this can get a bit messy in 3Dwith irregular meshes as you can imagine):

Example of 2D flux of C using PLIC. The dark area is the volume that will be advected.

The geometrical reconstruction methods are not perfect. First of all the surface is not really staircasedor piecewice linear. It is also a problem to advect in multiple directions at once. With a regular gridthis can be solved by advecting and reconstructing twice, one time in each coordinate direction, theso called direction split scheme. With unstructured meshes this is harder. Typical problems are lackof mass conservation, numerical diffusion and drops that tear free from the surface.

9

Page 10: Free surface handling in FVM - MEK4470/MEK9470 · Free surface handling in FVM - MEK4470/MEK9470 Tormod Landet and Johanna Ridder October 2014 These lecture notes give an overview

4.2 Algebraic reconstruction

Geometrical reconstruction becomes difficult on unstructured meshes and especially in 3D. Ensuringmass conservation and obtaining a smooth interface may be hard. The geometrical schemes must alsobe explicit which causes small time steps and slow simulations.

If instead we can solve an equation for the C-field just like for the velocity and pressure then it becomesmuch easier to implement, but we need a special compressive scheme to make sure the interface stayssharp. The following schemes are most used:

• HRIC: High Resolution Interface Capturing

• CICSAM: Compressive Interface Capturing Scheme for Arbitrary Meshes

• MULES: MUlti-dimensionsal Limiter for Explicit Solution

The MULES algorithm is badly documented in literature and will not be described here. It is onlyused in OpenFOAM as far as the authors are aware. CICSAM and HRIC are similar algorithms andbetter documentation of these can be found in litterature. See for example the comparison paper:

Wac lawcyk and Koronowicz, 2008, Comparison of CICSAM and HRIC high-resolution schemesfor interface capturing, Theoretical and Applied Mechanics, Warsaw, http://www.ptmts.org.pl/Waclaw-Koron-2-08.pdf

Both CICSAM and HRIC uses a combination of the first order upwind differencing scheme (UDS) andthe first order downwind differencing scheme (DDS). UDS is diffusive and smears the interface, butis unconditionally stable. DDS is compressive, but unstable. Both the CICSAM and HRIC schemesuses a normalised variable diagram for the value of the colour function at centre of the cell, CP , andthe colour function at the downwind face, Cf , to decide the blending factor between UDS and DDSto use on each face.

Normalised variable diagram used to select the blending of UDS and DDS in CICSAM/HRIC.The line CP = Cf corresponds to UDS, while Cf = 1 corresponds to DDS.

The normalization used in the diagram is C = (C − CD)/(CD − CU ). The yellow line is HRIC forthe case where the interface aligns with the flow direction. In general the DDS will tend to align theinterface with the gridlines. This is not wanted, so the blendning between UDS and DDS used inCICSAM and HRIC is dependent on the interface angle.

Common for all the algebraic reconstruction schemes is that there is some smearing of the interface,but typically not more than 2–3 cells. For many applications this is good enough to get realistic resultsand good agreements with model tests and analytical solutions.

It should be noted that the MULES algorithm in OpenFOAM was explicit until recently (with strictrequirements to keep the CFL number well below 1.0). In version 2.3.0 a semi-implicit version ofMULES was introduced which allows for significantly larger time steps making OpenFOAM competi-tive in terms of CPU usage. For some types of free surface flow problems it now performs approximatelyas good as typical commercial programs. This semi implicit mode must be turned on to be active, seethe release notes for version 2.3.0 for details.

10

Page 11: Free surface handling in FVM - MEK4470/MEK9470 · Free surface handling in FVM - MEK4470/MEK9470 Tormod Landet and Johanna Ridder October 2014 These lecture notes give an overview

4.3 What methods are used in practice?

It may be interesting to know what the most common CFD programs use in practice for interfacecapturing. The major comercial codes support a wealth of specialized models (like special particlesfor thin films on walls), but they also support VOF and many of the schemes mentioned above. Someexample programs are:

• OpenFOAM: uses MULES by default, but both CICSAM and HRIC have been implementedby various people, but not in the main source code repository. The OpenFOAM extend projecthas a CICSAM implementation.

• Fluent: implements CICSAM in an explicit scheme and a modified HRIC in an implict scheme.Also implements geometrical reconstruction.

• Ansys CFX: implements CICSAM in an explicit scheme and a modified HRIC in both implicitand explicit schemes. Also implements geometrical reconstruction.

• Star CCM+: uses HRIC

Selecting a scheme

As an example the Fluent version 6.3 Users’s Guide gives some guidance in selecting a scheme (Choos-ing a VOF Formulation, http://aerojet.engr.ucdavis.edu/fluenthelp/html/ug/node935.htm):

• jet breakup — Use the explicit scheme (time-dependent with the geometric reconstruction schemeor the donor-acceptor) if problems occur with the geometric reconstruction scheme.

• shape of the liquid interface in a centrifuge – Use the time-dependent with the implicit interpo-lation scheme.

• flow around a ship’s hull – Use the steady-state with the implicit interpolation scheme.

The implicit scheme in Fluent is HRIC. For ocean waves it is normally recommended to use an implicitalgebraic scheme and not PLIC or similar. It is also possible to test other schemes, some people havemade a geometric reconstruction using splines for example.

11

Page 12: Free surface handling in FVM - MEK4470/MEK9470 · Free surface handling in FVM - MEK4470/MEK9470 Tormod Landet and Johanna Ridder October 2014 These lecture notes give an overview

5 Some common problems in one-fluid formulations

The Eulerian methods described above are typically one-fluid methods. We only solve one set ofNavier-Stokes equations per cell. The density and viscosity of water and air are weighted with thecolour function. There also exists other methods where in each cell two Navier-Stokes equations aresolved, one for each fluid. We will then need some interaction equations. This is called an Euler-Eulertype method.

In a normal one-fluid formulation a typical challenge can be that a half-full cell will have a densitythat is halfway between water and air and a viscosity that is also halfway between. Since the viscosityof water is much less than that of air it can introduce artefacts related to the half-full cells where amedium high viscosity is coupled to a medium high density. This can cause more viscous effects inthe free surface than what is actually present.

Any scheme that discretises across the free surface will have issues related to the fact that highvelocities in the air due to the low density can increase the velocities in the water due to coupling ofthe velocities accross the interface in the numerical scheme. Idealy no differentiation should happenacross the interface and the density of all components should be considered when the components aretaken into the discretised equations. In reality there will be errors made here in most programs.

Some topics, such as wave generation by wind, requires good handling of the physics and momentumtransfer in the free surface region. Good results can be had if the wetted fraction of each face is takeninto account in the discretisation. An example can be found in:

Wen, 2013, Wet/dry areas method for interfacial (free surface) flow, Numerical Methods in Fluids,http://onlinelibrary.wiley.com/doi/10.1002/fld.3661/abstract

12

Page 13: Free surface handling in FVM - MEK4470/MEK9470 · Free surface handling in FVM - MEK4470/MEK9470 Tormod Landet and Johanna Ridder October 2014 These lecture notes give an overview

Appendix: Domain decomposition

This topic is not directly related to free surface capturing/tracking, but more on challenges caused byhaving gravity waves in a finite numerical domain.

If we want to study a ship in a storm we need a huge domain to avoid reflected waves from theboundaries. With a sufficiently large wave damping zone, a so called numerical beach, we can limitthe size of the domain, but still it will be large since we have to damp the waves all the way to flatwater before the outlet to avoid reflections.

One way coupling

If we try to damp only the disturbances caused by the presence of the ship and not the incoming wavesthemselves we can have a much smaller domain and damping zone. This is a domain decompositionapproach with one way coupling.

We assume that we have a fast way to calculate the undisturbed wave field variables and we usethis near the inlet and outlet. This could be a potential theory solver or analytical expressions fromlinearised wave theories for example. If we define a local distance ξ as 1 at the end of the couplingzone close to the ship and 0 at the near the inlet/outlet we can define a weighting factor:

χ(ξ) = 1− exp(ξβ)− 1

exp(1)− 1(2)

Weighting factor for a 2D domain by Paulsen et al. 2014

This choice of weighting function comes from the following paper where they use β = 3.5.

Paulsen, Bredmose, Bingham, 2014, An efficient domain decomposition strategy for wave loadson surface piercing circular cylinders, Coastal Engineering, http://www.sciencedirect.com/

science/article/pii/S0378383914000155

Now we can weight our calculated variables inside the FVM solver time loop:

Tu = χuouter + (1− χ)uFVM (3)

The solver for the finite volume method, FVM, runs in the inner domain and the fast undisturbedwave solver runs in the outer domain. Since the disturbances can be much smaller than the incomingwaves themselves this method can be much faster since the FVM domain can be quite small.

Two way coupling

Two way coupling can for example done by coupling the pressure in Navier-Stokes directly to thevelocity potential in a potential flow solver. This is done without a weighting factor zone and is quitea bit more involved, but can very useful for cases where it is hard to predict the main wave fieldwithout knowing what goes on in the inner domain.

13

Page 14: Free surface handling in FVM - MEK4470/MEK9470 · Free surface handling in FVM - MEK4470/MEK9470 Tormod Landet and Johanna Ridder October 2014 These lecture notes give an overview

References

[1] S. Osher, R. Fedkiw, Level Set Methods and Dynamic Implicit Surfaces. Springer, 2003.

[2] J.A. Sethian, Level Set Methods and Fast Marching Methods. Cambridge University Press, 1999.

14