The Filtered Level Set Equation Spencer Patty March 9, 2015 Contents 1 Level Set Filters 1.1 Simple Examples of Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2 A More Useful Type of Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3 Convenient Notations for Level Set Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 The Level Set Method 2.1 Reinitialization of Level Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2 Time Integration Schemes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2.1 Explicit Strong Stability Preserving Runge-Kutta 2 scheme . . . . . . . 2.2.2 Explicit Strong Stability Preserving Runge-Kutta 3 scheme . . . . . . . 2.2.3 Strong Stability Preserving Property . . . . . . . . . . . . . . . . . . . . 2.3 Adaptive Time Stepping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.4 Artificial Viscosity as an Efficient Stabilization Method . . . . . . . . . . . . . 2.4.1 General Explicit Entropy Viscosity Method . . . . . . . . . . . . . . . . 2.4.2 Entropy Viscosity Method for Level Set Method . . . . . . . . . . . . . 2.5 Semi-Discrete Galerkin Approximation to Level Set Equation . . . . . . . . . . 2.6 Fully-Discrete Galerkin Approximation to Level Set Equation . . . . . . . . . . 2.6.1 Fully Discrete Level Set Method with Artificial Viscosity and SSP RK2 2.6.2 Fully Discrete Level Set Method with Artificial Viscosity and SSP RK3 2.6.3 Artificial Viscosity ”On The Fly” . . . . . . . . . . . . . . . . . . . . . . 2.7 Choosing Parameters for Level Set Method . . . . . . . . . . . . . . . . . . . . 2.8 Numerical Results for Level Set Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 2 3 5 5 6 7 8 8 9 9 10 10 11 12 12 12 13 13 14 14 List of Figures 1 2 3 4 5 1 Distance Function and Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The tanh filter profile, ϕtanh (x), described in equation (1) plotted with it’s derivative. . . . . Sin filter profile, Eqn (3), plotted with it’s derivative. . . . . . . . . . . . . . . . . . . . . . . . The basic thresholding filter, ϕd (x), described in equation (4) plotted with it’s derivative. . . The thresholiding filter, ϕtanh (x), smoothed with hyperbolic tangent described in equation (5), d plotted with it’s derivative. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 3 4 4 5 Level Set Filters There are many excellent papers that discuss the level set method and the use of continuous compactly supported approximations to the Dirac delta function when we have a distance function available. However, there are cases where having something other than a distance function is ideal. In the following, we will 1 describe how to do the same things when we have such a case. We represent the signed distance function for the boundary Γ as d(x) with d(x) > 0 inside of Γ and d(x) < 0 outside. We will transform this Λ Γ = ∂Ω = {x | d(x) = 0} Ω = {x | d(x) > 0} n ∂Λ ν Figure 1: Distance Function and Notation distance function into another function that has the same zero level set and preserves other useful properties. Specifically we will consider an increasing continuous function, ϕ : R → R, that preserves ϕ(0) = 0 and is differentiable at 0 with ϕ0 (0) = 1. We will refer to such a function as a filter. Then we will deal with ϕ(d(x)) as our level set function where x ∈ Rd . While there are many examples of such a filter, we will give two useful examples. The reason why these can be useful is that while the distance function requires |∇d| = 1 everywhere in the whole domain and thus provides information equally to all level set, these examples only require accuracy near the zero level set. There are cases where it is relevant to have all the level sets accurately determined, but for most applications only the zero level set is relevant. These filters play on that relevancy to simplify the problem to only deal with a narrow band around the zero level set, as will be seen. 1.1 Simple Examples of Filters The filters are scaled by a parameter, cϕ > 0, which represents essentially the filter’s effective radius. We will discuss later how this parameter can be chosen. The first example is the tanh filter with width essentially 2cϕ , x x ϕtanh (x) = cϕ tanh , ϕ0tanh (x) = sech2 . (1) cϕ cϕ We say this is the essential filter width because on that range, the level set is ”close” to a distance function. Outside that range it quickly falls away to nearly flat. It is common to choose the parameter cϕ to scale with the mesh size, thus cϕ = chs for s > 0. Ideally we would use s = 1 but it turns out that the tanh filter is very stiff and this levels out too fast away from 0 leading to bad or no convergence of our approximation to δΓ . We have found that s = 21 gives a good balance between scaling with the mesh size and maintaining good convergence properties of our approximations to δΓ , an approximate dirac measure which restricts a full integral to be along the boundary Γ. So if we were to use this filter, we would use √ x x √ , ϕ0tanh (x) = sech2 (2) ϕtanh (x) = c h tanh √ c h c h 2 1 Cϕ −3Cϕ −2Cϕ −Cϕ Cϕ Cϕ −Cϕ 2Cϕ 3Cϕ −Cϕ Figure 2: The tanh filter profile, ϕtanh (x), described in equation (1) plotted with it’s derivative. Remark. In addition to being useful for the level set method, the tanh filter shape is what the phase field models converge to as well. However, in the phase field models, the width of the filter is typically constant independent of the mesh size. In our case the width changes with the mesh size. This creates some interesting dilemmas for how to compute convergence rates since the solution is actually different on each refinement. Another common filter is the sine Cϕ ϕsin (x) = Cϕ sin Cxϕ −C ϕ filter with transform width Cϕ π, Cϕ π 2 C π |x| ≤ ϕ2 C π x < − ϕ2 x> ϕ0sin (x) , = ( 0 |x| > x cos Cϕ |x| ≤ Cϕ π 2 Cϕ π 2 . (3) 0 Note that we have scaled it in such a way that (φsin ) (0) = 1. Thus we preserve locally the distance function but away from the zero level set we eventually just cut the function off to a constant. There are countless other varieties and the only real requirement is that the norm of the gradient near 0 is bounded away from 0. 1.2 A More Useful Type of Filter We can also combine the above filters with the distance function so that in a neighborhood around Γ it maintains the signed distance function and then outside that, it levels off to a constant using the filters. There are many useful geometric properties that the signed distance functions gives us and so prepserving locally those properties can be to our advantage. Thus we have two parameters, Cd and Cf standing for d =distance and f =filter that can scale with our mesh size. To be specific, we choose a parameter, Cd = cd hβ on which the signed distance will be maintained. We also choose a parameter Cf = cf hβ to be the other filter width. So the active part of the filter occurs in domain [−(Cd + Cf ), Cd + Cf ], outside that domain it tends to constant. This can be thought of as thresholding filter. It cuts off the signed distance function beyond a certain value. The most basic case would be to have it be constant outside [−Cd , Cd ] but this is only a C 0 function. We can choose better filters to bridge from the active region to the constant region that give us a C k filter for higher values of k > 0. 3 1 Cϕ −Cϕ Cϕ Cϕ −Cϕ −Cϕ Figure 3: Sin filter profile, Eqn (3), plotted with it’s derivative. The basic thresholding distance function results in a C 0 (R) function. Cd < x 0, Cd < x Cd , 0 (ϕd ) (x) = 1, |x| < Cd ϕd (x) = x, |x| < Cd , −Cd , x < −Cd 0, x < −Cd 1 Cd −Cd Cd −Cd Figure 4: The basic thresholding filter, ϕd (x), described in equation (4) plotted with it’s derivative. 4 (4) When we use the tanh filter to smooth x−Cd , C + C tanh f d Cf tanh ϕd (x) = x, −C + C tanh x+Cd , d f Cf out the thresholding, we end up with a C 2 (R) function. 2 x−Cd Cd < x , Cd < x sech Cf tanh 0 ϕd (x) = 1, |x| < Cd |x| < Cd 2 x+Cd sech x < −C , x < −C d Cf (5) d 1 Cd + Cf Cd Cd −(Cd + Cf ) −Cd Cd + Cf −Cd −(Cd + Cf ) Figure 5: The thresholiding filter, ϕtanh (x), smoothed with hyperbolic tangent described in equation (5), d plotted with it’s derivative. Finally, notice that the thresholding with tanh filter limits to the tanh filter when Cd = 0. So we can view the so called thresholding tanh filter as a generalization of the tanh filter. We will use the tanh thresholding filter in practice as it provides us a wide range of flexibility and maintains the smoothness we want. 1.3 Convenient Notations for Level Set Filters We can modify the right hand side of the standard level set evolution equation to converge to ϕ(d(x)) instead of d(x). Out of convenience, we will overload our use of ϕ() to use interchangeably ϕ(x) = ϕ(d(x)). (6) We will describe our process of modifying the level set equation elsewhere but will subsequently consider the output of numerical evolution as Ih (ϕ)(x) and the exact function is ϕ(x). 2 The Level Set Method Now that we understand what we want to do, we will describe the level set advection equations which will accomplish this. The well known basic level set equation for transporting the boundary Γ = {x ∈ 5 Λ | ϕ(x) = 0} with a velocity v(x, t) ∈ Rd × R+ is ∂ϕ ∂t + v · ∇ϕ = f (x, t), x ∈ Λ, t ∈ [0, T ] ϕ(x, t = 0) = ϕinit (x), x ∈ Λ ϕ(x, t) = ϕinflow (x, t), {x ∈ ∂Λ | ν(x) · v(x, t) < 0} (7) Here, ν(x) denotes the outer unit normal vector for x ∈ ∂Λ and f (x, t) represents any additional forces acting on the boundary. For basic advection, f (x, t) = 0 but there are many useful applications where it could be nonzero and can create some very interesting flows. There is a large volume of literature that treats these types of applications from mean curvature flows to modelling crystalline growth, finding minimal surfaces and many applications in image processing. 2.1 Reinitialization of Level Set We choose to have ϕ > 0 for x inside Γ and ϕ < 0 for x outside Γ and as discussed above, most level set methods choose to maintain |∇ϕ| = 1 so that ϕ is a signed distance function. As ϕ advects numerically, it tends to drift away from being a distance function which affects the accuracy of transport. In our case we will be using a filtered distance function, but the same problem exists. It is recommended to stop and reinitialize the level set ϕ(x) every couple steps of advection which is done by solving the following reinitialization equation to τ = ∞ (or big enough) ( ∂φ ∂τ + sign(ϕ) (|∇φ| − S) = 0 (8) φ(x, τ = 0) = ϕ(x, t). The sign function is defined as ϕ > εS 1, sign(ϕ) := 0, |ϕ| < εS −1, ϕ < −εS (9) where εS = ϕ(xS ) is the filter applied to xS and xS is the distance around the the zero level set we don’t want to be reinitialized. Keeping this value small but positive ensures we don’t accidentally move the zero level set in the reinitialization process so we will have it dependent on the minimal mesh size, xS = O(hmin ). We denote by S = S(ϕ) the target slope we want ϕ to have, ie |∇ϕ| = S. We call S the level set filter cut-off function. This uniquely determines the filter shape since we assume that the zero level set always represents Γ. For example, the distance function wants |∇ϕ| = 1, so we let Sdist (ϕ) = 1. (10) For the tanh filter cut-off function, we want ϕ to limit to cϕ tanh d(x) so ∇ϕ should limit to sech2 d(x) ∇d(x). cϕ cϕ 2 Thus |∇ϕ| = sech2 d(x) |∇d(x)| = sech2 d(x) = 1 − tanh2 d(x) = 1 − cϕϕ . So we let cϕ cϕ cϕ Stanh (ϕ) = 1 − ϕ cϕ 2 . The thresholding with tanh filter cut-off function is likewise defined as 2 ϕ−Cd 1 − Cd ≤ ϕ Cf thresh Stanh (ϕ) = 1 2 1 − ϕ+Cd Cf 6 |ϕ| < Cd ϕ < −Cd (11) (12) Instead of stopping every few steps to reinitialize, we follow the suggestions of Coupez in [3] and build the reinitialization forces into our transport equation. To do so, we introduce a unit-less lagrange multiplier, λ which represents the relative rates of time t versus reinitialization time τ λ := ∂τ . ∂t (13) Thus we have ∂φ ∂φ =λ . (14) ∂t ∂τ The parameter λ will be scaled by a user given parameter to specify how quickly to reinitialize relative to time flow and we will come back to specifying exactly what λ will be after we describe the new transport equation. Finally we also define the reinitialization velocity U := sign(ϕ) ∇ϕ . |∇ϕ| (15) Then ϕ satisfies the following transport equation with reinitialization ∂ϕ + (v + λU) · ∇ϕ = f (x, t) + λ sign(ϕ)S. ∂t (16) with the same initial and inflow conditions above except that our transport velocity has actually changed from v to v + λU and this new quantity must be used for any CFL condition. However, when checking the inflow conditions, we will only use the actual velocity, v. (discuss why). 2.2 Time Integration Schemes We choose to implement the time integration using an explicit Runge Kutta scheme. The general explicit Runge Kutta of order s solving the equation y 0 = L(t, y) (17) a21 a31 .. . a32 .. . (18) as1 b1 as2 b2 is typically described by a Butcher tableau. c1 c2 c3 .. . cs .. . ... ... as(s−1) bs−1 bs The approximate solutions yn+1 = y(tn+1 ) are given by y n+1 = y n + ∆t s X bi Li (19) i=1 where the intermediate steps y (1) , . . . , y (s) and intermediate derivatives L1 , . . . , Ls are given by y (k) = y n + ∆t k−1 X akj Lj (20) j=1 Lk = L tn + ck ∆t, y (k) . 7 (21) 2.2.1 Explicit Strong Stability Preserving Runge-Kutta 2 scheme We have implemented the explicit strong stability preserving Runge-Kutta 2 and 3 methods for respectively second and third order time integration. They are both simple to describe and implement and provide sufficient accuracy for our applications. The Butcher tableau for the SSP RK2 scheme is given by 0 1 1 1/2 (22) 1/2 So that we compute the following to transport from time tn to tn+1 , y (1) = y n L1 = L tn , y (1) y (2) = y n + ∆tn L1 L2 = L tn+1 , y (2) 1 1 y n+1 = y n + ∆tn L1 + L2 . 2 2 We then apply any inflow boundary conditions to the new solution y n+1 . If there are any time dependent forces in L(t, y), we must take care to evaluate at the correct times for the Lk , which are respectively tn and tn+1 . 2.2.2 Explicit Strong Stability Preserving Runge-Kutta 3 scheme The explicit Strong Stability Preserving Runge-Kutta 3 (SSP RK3) scheme, sometimes called the Shu-Osher Method, has Butcher tableau 0 1 1/2 1 1/4 1/6 1/4 1/6 (23) 2/3 So we will compute in the following order to transport from time tn to tn+1 y (1) = y n L1 = L tn , y (1) y (2) = y n + ∆tn L1 L2 = L tn+1 , y (2) 1 (3) n n L1 + y = y + ∆t 4 L3 = L tn+1/2 , y (3) 1 y n+1 = y n + ∆tn L1 + 6 1 L2 4 1 2 L2 + L3 . 6 3 The inflow boundary conditions will only be applied at the very end to our new solution y n+1 instead of to each intermediate step. Note that each Lk is evaluated at a different time value, so if there are any time dependent forces in L(t, y), we must make sure to evaluate at the appropriate times for the Lk , which are respectively tn , tn+1 , and tn+1/2 . 8 2.2.3 Strong Stability Preserving Property As described in [2], when we say strong stability preserving (SSP), we mean that given some norm k · k under which the first order explicit Euler scheme is stongly stable, kun+1 k ≤ kun k under a condition ∆t ≤ ∆tF E , then this SSP scheme preserves that same stability for the higher order multistep, in our case RK3, scheme under a possibly more stringent condition ∆t ≤ c∆tF E . In the SSP RK2 and SSP RK3 schemes, it is found that c = 1, so we can use the same time step in both cases that we would for the forward Euler scheme. 2.3 Adaptive Time Stepping We will apply the standard Courant-Friedrichs-Lewy (CFL) condition to our adaptive time stepping system. Given a constant 0 < cCFL , and our previous velocity un (note that we have not yet solved for un+1 yet), choose minK∈T (hK /p) dtn+1 ≤ cCFL (24) kun+1 kL∞ (Λ) where hK is mesh diameter for cell K and p is the polynomial degree of the level set finite element space. Typically we will use p = 2 in practice, but it could be any positive integer. When we use the navier stokes to specify the velocity, we will choose the finite element spaces for velocity and level set to have the same degree. For stability purposes, is often needful to choose cCFL < 1. A common value used is cCFL = 0.3 although this needs to be adjusted based on how well the system performs under it. Remark. The SSP RK3 time integrator scheme is stable under this CFL condition, however the SSP RK2 and first order Forward Euler schemes need a more stringent relationship between mesh size and time step size. For code testing purposes we may use these other schemes and so understanding that for forward euler, we need dt = O(h2 ) and RK2 we need dt = O(h3/2 ) is important. Now that we have disussed the CFL condition, we can specify exactly what we mean by our lagrange multiplier, λ, from the reinitialization scheme. Recall that we defined λ = ∂τ ∂t . We will approximate this with our time discretization as ∆τ ∂τ ≈ (25) λ= ∂t ∆t where ∆τ and ∆t are the reinitialization and real time steps respectively. Adapting our CFL condition to both types of time steps, CF L = ∆t|v| h and CF Lreinit = ∆τ |U| h (26) ∇ϕ we can compute (using |U| = sign(ϕ) |∇ϕ| =1) λ≈ ∆τ CF Lreinit · h |v| CF Lreinit = = |v| = cλ |v| ∆t |U| CF L · h CF L (27) Lreinit > 0 be a user given which is a unitless quantity because of the hidden |U| = 1. We will let cλ := CFCF L parameter representing the relative rates of reinitialization vs actual time flow. For instance, if cλ = 0.1, it essentially says for every ten time steps we take one reinitialization step. While it is happening continuously, we get roughly the same effect. 9 Finally, the velocities of our level set can vary quite a bit but we only really care about what is happening near the zero level set. We are free to choose what we mean by |v| in the above definition. We could choose |v| = k|v|kL∞ (Λ) , but this could be quite excessive if the velocities far from the zero level set are much larger than near it. Similarly, we could choose a band Bh around the zero level set and let |v| = k|v|kL∞ (Bh ) which is a perfectly acceptable solution. Another option would be to let λ be defined locally and use for each cell K ∈ T , |v||K = k|v|kL∞ (K) . This will be our choice, so our λ will be piecewise constant, λ|K := cλ k|v|kL∞ (K) . 2.4 (28) Artificial Viscosity as an Efficient Stabilization Method A very efficient methods for stabilizing a hyperbolic equation (we have the transport equation) to minimize oscillations is to add an artificial viscosity, ν, to our equation. ∂ϕ + (v + λU) · ∇ϕ − ∇ · (ν∇ϕ) = f (x, t) + λ sign(ϕ)S. ∂t (29) We choose the artificial viscosity term to apply larger diffusion where it is needed to smooth oscillations and smaller where it is not. To this end, we use the explicit entropy/residual viscosity method analysed in [1] which we will describe here. We will first introduce the method for a hyperbolic conservation equation ( ∂t u + ∇ · k(u) = g(x, t) (30) u(t = 0, x) = u0 (x) for x ∈ Λ ⊂ Rd where k ∈ C 1 (R; R), and g ∈ C 1 Rd × R+ ; R . Then we will interpret the theory into our specific level set advection problem. 2.4.1 General Explicit Entropy Viscosity Method To begin with, we must choose an entropy - entropy flux pair (E, F), where the entropy E(u) ∈ C 1 (R; R) is a strictly convex function and the entropy flux F(u) ∈ C 1 R; Rd is related to E by Z F0 (u) := E 0 (u)k0 (u) or F(u) := E 0 (u)k0 (u)du (31) To be clear, we are sweeping many of the technical parts of this problem under the rug, specifically dealing with the boundary conditions and applying appropriate restrictions on the flux and entropy to guarantee a solution, u, physically exists and is well behaved in the subsequent. These are discussed in detail in [1]. Now given our entropy solution, u, this entropy - entropy flux pair satisfies the inequality condition ∂t E(u) + ∇ · F(u) − E 0 (u)g ≤ 0 (32) with equality if u ∈ C 1 . What follows assumes we are now dealing with a continuous Galerkin finite element approximation, U n ≈ u(tn ), with cell size hK for cells K ∈ T , our triangulation. The viscosity will be defined piecewise as constant on each cell, K. Remark. We pause to note that for pth order Lagrange finite elements, Qp (T ), the important quantity is not the cell size, hK , but the distance between degrees of freedom on cell, hK /p. This quantity scales properly with both mesh size and finite element degree p. So everywhere in the subsequent we will use hK /p to reflect this. We define our entropy residual, R(u) to be R(u) = ∂t E(u) + ∇ · F(u) − E 0 (u)g 10 (33) or in our case, overloading the definition by using the finite element approximation and approximating the ∂t by a first order discretization, E(U n ) − E(U n−1 ) + ∇ · F(U n ) − E 0 (U n )g. (34) ∆tn Then our entropy viscosity is defined using the entropy residual over on each cell, K, 2 cE hpK k|R(U n )|kL∞ (K) νE |K = (35) kE(U n ) − ave (E(U n )) kL∞ (Λ) R 1 where cE > 0 is a user defined coefficient and ave (E(U n )) = |Λ| E(U n )dx. We will describe the method Λ of choosing this coefficient as well as the coefficient for linear viscosity, cL > 0, later on. Thus for a u ∈ C 1 , we have R(u) = 0 but R(U n ) → 0 with order O(∆t). We define the linear viscosity in the standard manner based on the maximum local wave speed, βK = k|k0 (u)|kL∞ (K) . hK hK βK = cL k|k0 (u)|kL∞ (K) (36) νL |K = cL p p Now with linear and entropy viscosity defined, we can compute our artificial viscosity or stabilizing viscosity, ν as ν|K = min ( νE |K , νL |K ) . (37) R(U n ) = So in the end, given a finite element approximation space Vh , the Galerkin + entropy viscosity approximation for our hyperbolic conservation equation is: Find Uh ∈ Vh such that Z Z XZ (∂t Uh + ∇ · k(Uh )) Vh dx + νh ∇Uh · ∇Vh dx = gVh dx, ∀Vh ∈ Vh . (38) Λ 2.4.2 K∈T K Λ Entropy Viscosity Method for Level Set Method Now that we have introduced the theory and method for a general hyperbolic equation, we will focus in on our level set method with reinitialization. In fact, now that we have described the Runge-Kutta algorithms, we will implement the artifical viscosity within that time integration framework. Fist we will describe the entropy residual for the level set method with reinitialization, then we will explicitly break it down into the various RK schemes. We will choose our entropy, E(u), to be 1 k u , E 0 (u) = uk−1 (39) k for k an even integer. Most papers use a value of k = 2 or k = 4, but we could use k = 20 for simulations. In the case of our level set method, our flux and rhs forces are in fact linear and given by E(u) = ∇ · k(ϕ) = k0 (ϕ) · ∇ϕ = (v + λU) · ∇ϕ (40) g(x, t) = f (x, t) + λ sign(ϕ)S. (41) and So that ∇ · F(ϕ) = F0 (ϕ) · ∇ϕ = E 0 (ϕ)k0 (ϕ) · ∇ϕ 0 = E (ϕ) (v + λU) · ∇ϕ (42) (43) (44) Thus, the entropy residual for the level set method with reinitialization is given by R(ϕ) = ∂t E(ϕ) + E 0 (ϕ) (v + λU) · ∇ϕ − E 0 (ϕ) (f + λ sign(ϕ)S) 11 (45) 2.5 Semi-Discrete Galerkin Approximation to Level Set Equation Given a family of triangulations of Λ, {T (t)}t∈[T0 ,T1 ] , on our time domain [T0 , T1 ] we choose the continuous pth order Lagrange finite element space Vh (t) = Qp (T (t)) . (46) This will allow for our eventual adaptive refinement schemes or a simple uniform mesh. Then our semidiscrete Galerkin approximation to the level set method is: Find ϕh (t) ∈ Vh (T (t)) for t ∈ [T0 , T1 ] such that Z Z Z XZ ∂ ϕh vh dx + (vh + λU) · ∇ϕh vh dx + νK ∇ϕh · ∇vh dx = (f + λ sign(ϕ)S) vh dx (47) Λ K Λ Λ ∂t K for all vh ∈ Vh (T (t)). 2.6 Fully-Discrete Galerkin Approximation to Level Set Equation As we will be using an adaptive time stepping algorithm, we discretize our time domain [T0 , T1 ] into N possibly non-uniform time increments, t0 = T0 < t1 < · · · < tN = T1 with ∆tn = tn − tn−1 for n = 1, . . . , N . Then we have a sequence of triangulations {T n }N n=0 of Λ and again choose our finite element approximation space as Vnh = Qp (T n ) . (48) We are now prepared to describe the various fully-discrete runge kutta approximations to the level set method with reinitilization and artifial viscosity. 2.6.1 Fully Discrete Level Set Method with Artificial Viscosity and SSP RK2 Since the SSP RK2 step from time tn to tn+1 has two stages at times tn and tn+1 , we must decide what the entropy residual will be at each stage. Here we are assuming as well that v(1) = vn and we are constructing v(2) ≈ vn+1 from ϕn , vn and vn−1 . This requires us to use an extrapolation from vn and vn−1 to get the velocity v(2) at time tn+1 . Then after constructing the new level set, ϕn+1 , we use it to construct our new velocity, vn+1 . It is possible to switch that order but then our velocity vn+1 = vn+1 (ϕn , ϕn−1 ) requires a form of extrapolation as well. We choose a second order extrapolation for v(2) at time tn+1 , thus Table 1: SSP stage time, t(i) 1 tn 2 tn+1 RK2 Extrapolated Velocities extrapolated velocity v(1) = vn n+1 v(2) = vn + ∆t vn − vn−1 ∆tn As the stages proceed we construct the intermediate level set functions ϕ(i) and intermediate velocities ∇ϕ(i) (i) v(i) so we use them to compute U(i) = sign(ϕ(i) ) |∇ϕ = λ(v(i) ) and S (i) = S(ϕ(i) ). Likewise we will (i) | , λ use f (i) = f n = f (tn ) and f (2) = f n+1 = f (tn+1 ) interchangeable. Once we have all of the above elements in each stage, we construct our entropy residual, R(ϕ(i) ) as the sum of the following three components. Table 2: SSP RK2 Entropy Residuals stage time, t(i) 1 tn 2 tn+1 ∂t E(φ) E(ϕ(1) ) − E(ϕn−1 ) h 1 (2) ) − E(ϕnh ) ∆tn+1 E(ϕ 1 ∆tn 0 0 E (ϕ)k (ϕ) · ∇ϕ E 0 ϕ(1) v(1) + λ(1) U(1) · ∇ϕ(1) E 0 ϕ(2) v(2) + λ(2) U(2) · ∇ϕ(2) 12 −E 0 (ϕ)g −E 0 (ϕ(1) ) f n + λ(1) sign(ϕ(1) )S (1) −E 0 (ϕ(2) ) f n+1 + λ(2) sign(ϕ(2) )S (2) Finally the viscosities can be defined and our right hand side, L(t(i) , ϕ(i) ) for the Runge-Kutta algorithm can be written down. On a cell K ∈ T n , 2 hK |R(ϕ(i) )| ∞ c E p L (K) (i) (49) νE = (i) (i) K kE(ϕ ) − ave E(ϕ ) kL∞ (Λ) hK (i) (i) . (50) νL = cL v + λ(i) U(i) · ∇ϕ(i) ∞ p K L (K) Then we have our intermediate viscosity (i) (i) . (51) ν (i) = min νE , νL K K K So our right hand side functional for the level set method with reinitialization and stabilizing artificial viscosity is Z Z XZ ν (i) ∇ϕ(i) ·∇vh dx+ L t(i) , ϕ(i) = − v(i) + λ(i) U(i) ·∇ϕ(i) vh dx− f (i) + λ(i) sign ϕ(i) S (i) vh dx. Λ K K Λ (52) Then we follow the above sequence for computing our intermediate time steps and updates for Runge-Kutta time integration. 2.6.2 Fully Discrete Level Set Method with Artificial Viscosity and SSP RK3 As in the SSP RK2 description, we have multiple stages of SSP RK3. The three stages are evaluated at times tn , tn+1 and tn+1/2 respectively. We construct all of the intermediate quantities as before. The only difference is our extrapolation of velocities. Table 3: SSP stage time, t(i) 1 tn 2 tn+1 n+1/2 3 t RK3 Extrapolated Velocities extrapolated velocity v(1) = vn n+1 v(2) = vn + ∆t vn − vn−1 n ∆t n+1 n n−1 v(3) = vn + ∆t 2∆tn v − v Once we have all those quantities defined, we can likewise construct each entropy residual, R(ϕ(i) ) as the sum of the following three components: Table 4: SSP RK3 Entropy Residuals stage time, t(i) 1 tn 2 tn+1 3 tn+1/2 ∂t E(φ) E(ϕ(1) ) − E(ϕn−1 ) h 1 (2) n ) − E(ϕh ) ∆tn+1 E(ϕ 2 (3) ) − E(ϕnh ) ∆tn+1 E(ϕ 1 ∆tn 0 0 E (ϕ)k (ϕ) · ∇ϕ E 0 ϕ(1) v(1) + λ(1) U(1) · ∇ϕ(1) E 0 ϕ(2) v(2) + λ(2) U(2) · ∇ϕ(2) E 0 ϕ(3) v(3) + λ(3) U(3) · ∇ϕ(3) −E 0 (ϕ)g −E 0 (ϕ(1) ) f n + λ(1) sign(ϕ(1) )S (1) −E 0 (ϕ(2) ) f n+1 + λ(2) sign(ϕ(2) )S (2) Artificial Viscosity ”On The Fly” We have described above a technique for stabilization that requires storing the previous time step’s entropy function, solved for with the previous level set function, for applying stabilization to the first stage of a runge-kutta scheme. A modification of the artificial viscosity technique is to drop the stabilization from the first stage and then add it as usual on any subsequent stages. This so called ”on-the-fly” method, mentioned in [1] works well and localizes the information needed to only the set of information generated in a runge-kutta step. It also reduces the number of calculations and memory required for each step. 13 −E 0 (ϕ(3) ) f n+1/2 + λ(3) sign(ϕ(3) )S (3) The rest is exactly as above in SSP RK2. 2.6.3 2.7 Choosing Parameters for Level Set Method 2.8 Numerical Results for Level Set Method References [1] Andrea Bonito, Jean-Luc Guermond, and Bojan Popov. Stability analysis of explicit entropy viscosity methods for non-linear scalar conservation equations. Mathematics of Computation, 83(287):1039–1062, 2014. [2] Sigal Gottlieb, David I Ketcheson, and Chi-Wang Shu. High order strong stability preserving time discretizations. Journal of Scientific Computing, 38(3):251–289, 2009. [3] Laurence Ville, Luisa Silva, and Thierry Coupez. Convected level set method for the numerical simulation of fluid buckling. International Journal for numerical methods in fluids, 66(3):324–344, 2011. 14 Index Butcher tableau, 7 cλ , 9 cCFL , CFL constant, 9 cE , 11 CFL, Courant-Friedrichs-Lewy condition, 9 cL , 11 cϕ , 2 d(x), signed distance function, 1 E(u), entropy, 10, 11 εS , comparable sign width, 6 explicit RK(s), 7 explicit SSP RK2, 7 explicit SSP RK3, 8 F(u), entropy flux, 10 inflow boundary conditions, 8 λ, reinitialization lagrange multiplier, 6, 9 Li , intermediate derivatives, 7 ν, artificial viscosity, 10, 11 νE , entropy viscosity, 10 νL , linear viscosity, 11 ϕ, level set filter, 2 ϕsine , sine level set filter, 3 ϕtanh , tanh level set filters, 2 phase field models, 2 R(u), entropy residual, 10–13 reinitialization equation, 6 thresh Stanh , thresholding tanh filter cut-off function, 6 Stanh , tanh filter cut-off function, 6 S(ϕ), level set filter cutoff function, 6 semi-discrete Galerkin, 12 Shu-Osher Method, 8 sign function, 6 SSP, strong stability preserving property, 8 U, reinitialization velocity, 7 xS , sign width, 6 y (i) , runge-kutta intermediate steps, 7 15