* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Flux-based level set method on rectangular grids and computation
Survey
Document related concepts
Generalized linear model wikipedia , lookup
Corecursion wikipedia , lookup
Inverse problem wikipedia , lookup
Perturbation theory wikipedia , lookup
Simplex algorithm wikipedia , lookup
Computational chemistry wikipedia , lookup
Least squares wikipedia , lookup
Data assimilation wikipedia , lookup
Mathematical optimization wikipedia , lookup
Numerical continuation wikipedia , lookup
Newton's method wikipedia , lookup
Multiple-criteria decision analysis wikipedia , lookup
Root-finding algorithm wikipedia , lookup
Computational electromagnetics wikipedia , lookup
Transcript
Computing and Visualization in Science manuscript No. (will be inserted by the editor) Peter Frolkovič · Christian Wehner Flux-based level set method on rectangular grids and computation of first arrival time functions Received: March 12, 2007/ Accepted: date Abstract Flux-based level set method is a finite volume method for the numerical solution of advective level set equation which describes the transport of level lines by an external velocity field and by a speed in normal direction. The method is introduced for rectangular grids without using any dimensional splitting. The second order accurate discretization scheme is derived with one free parameter in the definition of piecewise linear reconstruction. A significant improvement of the accuracy can be obtained by special choices of this parameter for two benchmark examples of linear conservation laws. Moreover, the flux-based level set method can be used for computation of first arrival time functions in the class of problems such as “boat sailing” or “fire spread” where some external velocity field (e.g., a water or wind flow) must be considered additionally to the speed of boat or fire. Numerical experiments confirm very good performance of the method for this type of problems. 1 Introduction An implicit treatment of interfaces can simplify many numerical methods that would otherwise become too complicated if some complex interfaces have to be described in an explicit manner [19, 16]. This is true especially for three-dimensional problems in which a surface divides the computational domain into subdomains with different physical properties and introduces some interface conditions and nontrivial coupling of processes in each part of the domain. If the surface is moreover evolving in time and can exhibit topological changes, an explicit Peter Frolkovič Ruprecht-Karls-Universität Heidelberg Im Neuenheimer Feld 368, 69120 Heidelberg, Germany E-mail: [email protected] Christian Wehner Ruprecht-Karls-Universität Heidelberg Im Neuenheimer Feld 368, 69120 Heidelberg, Germany E-mail: christian [email protected] Fig. 1 An implicit representation of a circle in the plane z = 0 by a level set function in R3 . numerical modeling of the surface can be the most difficult and expensive part of practical realizations. The representation of an interface in an implicit manner as the zero level set of some level set function, see Figure 1 for an illustration, avoids these difficulties. Because the computational grid needs not to be adapted and fit to the evolving interface, fixed structured grids can be used in numerical realizations. The use of such grids (like rectangular grids) does not only give a simplification of the used algorithm but can also enhance the accuracy of numerical solutions. Another advantage of the implicit description of an interface is the possibility to describe the movement of interface by solving the so-called level set equation, ∂t φ(t, x) + V · ∇φ(t, x) = 0 , x ∈ D ⊂ Rd , (1) with some appropriate initial condition for t = 0 and appropriate boundary conditions. In this case, the zero level set φ(0, x) = 0 of the initial function describes the initial position of the interface, all level lines of the level set function φ are transported with velocity V, and the evolution of the interface is given implicitly by φ(t, x) = 0. 2 Peter Frolkovič, Christian Wehner The velocity V can not only describe some external velocity field, i.e., V = v(x), but can also depend on some geometric properties of the interface. In fact, if only an evolution of the interface is of concern, the tangential transport of particles along the interface can be ignored and only the speed δ in normal direction N to the interface needs to be given, i.e., V = δN in (1). If the gradient ∇φ(0, x) is well defined almost everywhere, to describe the evolution of the interface in this manner, one has to search for a viscosity solution of the equation ∂t φ(t, x) + δ |∇φ(t, x)| = 0 , 2 Flux-based level set method In what follows, we introduce the flux-based level set method for linear advection equation of the form (1) where V is some given external velocity field. Afterwards, an extension of the method for the advection in normal direction given by (2) will be introduced. 2.1 Linear advection equation (2) because N = ∇φ/|∇φ|; see, e.g., [19, 16]. The development of level set methods to solve (2) has experienced a tremendous progress after the initial impulse given by the paper [17] of Osher and Sethian in 1988. Nevertheless, many of such methods experience difficulties when applied to (1) with some external velocity having the property ∇ · V = 0; see, e.g., [11]. Only for this special case, several authors rewrite (1) into conservation form to apply standard numerical schemes for this type of problems such as finite volume methods [15] or discontinuous Galerkin methods [18,25, 12]. The flux-based level set method was introduced in [5] to treat both classes of problems, represented by (1) and (2), using a single method. The idea is to reformulate (1) to conservation form with a source term: ∂t φ + ∇ · (φ V) = φ∇ · V and use flux-based finite volume methods. In this paper, among others, we apply the flux-based level set method for computation of first arrival time functions for problems of boat sailing and/or fire spread. In such settings the initial position of the interface can describe a border between the land and water (a shore) or a border between the burnt and unburnt area. The first arrival time function T (x) shall describe for each position x in water (or in unburnt area) the time T in which this point can be reached by the boat (or the fire) starting from any point on the initial interface. In presence of a flow caused by water or wind, under some assumptions T can be obtained by solving (1) where V is the sum of the velocity v of water (or wind) and the speed δ of boat (or fire) in presence of no external flow by using T (x) = t if φ(t, x) = 0. The paper is organized as follows. In Section 2 we describe the flux-based level set method using rectangular grids. Without introducing any additional complexity in the method (such as larger stencil of the discrete scheme), one can significantly improve the accuracy of the flux-based level set method for rectangular grids when compared to unstructured grids as described in [7], see Table 1 later. Mathematical models for computation of first arrival time functions are described in Section 3. In Section 4 we document the advantages of the flux-based level set method for problems of linear conservation laws and computation of first arrival time functions. In this section we describe the flux-based level set method for the solution of linear advective level set equation: ∂t φ(t, x) + V(x) · ∇φ(t, x) = 0 . (3) The problem is solved on an open subset D of the ddimensional space Rd with a given continuous velocity function V. The level set function φ is known at t = 0. Some standard boundary conditions are required. We describe the method for the two-dimensional case (d = 2) using a uniform grid. Let D = (0, L)2 , L ∈ R. We introduce grid points xij = (xi , yj ) = (ih, jh), i, j = 0, 1, . . . , I with h = L/I. Our aim is to derive an explicit one-step method of the form: ∆t X n+1 kl n αij φi+k j+l . (4) φij = φnij − h |k|+|l|≤2 n+1 Here, ∆t = t − tn > 0 is the time step, the values φnij are given for n = 0 by φ0ij = φ(0, xi , yj ) or from the n-th time step, and the values φn+1 ≈ φ(tn+1 , xi , yj ) have to ij kl define a particular be determined. The coefficients αij form of (4) and in general some of them become zero. Although the flux-based level set method can be defined using (4), we will present it later in a more convenient form. To avoid a technical description of boundary conditions treatment, we will suppose that some auxiliary values of φ(tn , x, y) and V(x, y) are available for points (x0 − kh, yj ), (xI + kh, yj ), (xi , y0 − kh) and (xi , yI + kh), i, j = 1, 2, . . . , I, and k = 1, 2, so (4) is valid also for boundary points from ∂D. Our basic tool to derive a particular form of the general discretization scheme is a finite volume discretization. To that purpose we reformulate (3) as a conservation law with source term: ∂t φ(t, x, y) + ∇ · (φ(t, x, y)V) = φ(t, x, y)∇ · V , n and integrate (5) over (t , t Ωij = (xi − n+1 (5) ) and control volume Ωij : h h h h , xi + ) × (yj − , yj + ) , 2 2 2 2 to obtain Z Ωij φ(tn+1 , x) = Z Ωij φ(tn , x) − (6) Flux-based level set method on rectangular grids and computation of first arrival time functions n+1 tZ n+1 tZ Z Z φ(t, γ)ni (γ) · V(γ) + tn ∂Ωij φ(t, x)∇ · V(x) , tn Ωij where ni (γ), γ ∈ ∂Ωij is the outward normal vector with respect to Ωij . In fact, this vector can only assume four different values, (1, 0), (0, 1), (−1, 0), and (0, −1). We apply midpoint quadrature rules to approximate 1 (6) using tn+ 2 = tn + 21 ∆t and four integration points (xi ± h2 , yj ± h2 ) to obtain h2 φn+1 ij = h2 φnij − (7) n+ 1 n+ 1 ∆t h ui+ 21 j φi+ 12 j + vi j+ 21 φi j+21 − 2 2 n+ 12 n+ 12 n+ 12 ui− 12 j φi− 1 j − vi j− 12 φi j− 1 + h φij ∇ · Vij , 2 2 where Vij = V(xi , yj ) = ((u(xi , yj ), v(xi , yj )) = (uij , vij ) and similarly for other integration points. The divergence operator in the last term of (7) will be approximated by 1 ui+ 12 j + vi j+ 12 − ui− 12 j − vi j− 12 . (8) ∇ · Vij ≈ h If V is known only in grid points, one can use linear interpolation to compute 1 1 ui+ 21 j = (uij + ui+1 j ) , ui− 12 j = (uij + ui−1 j ) , 2 2 and so on. Using (8), one can rewrite (7) to the form: ∆t φn+1 = φnij − ( (9) ij h n+ 1 n+ 12 ui+ 21 j (φi+ 12 j − φij 2 n+ 12 i− 12 j ui− 12 j (φ n+ 21 − φij n+ 1 n+ 21 2 n+ 21 i j− 12 n+ 12 ) + vi j+ 21 (φi j+21 − φij ) − vi j− 21 (φ − φij )− ) . In fact, (9) describes our general numerical scheme (4) in a concise form. To define the values of φ in (9) that are associated with integration points, we use standard upwind arguments and finite Taylor series. First, depending on signs of velocity components, we define n+1/2 φ(i)+ 1 j , ui+1/2 j > 0 , 2 n+1/2 (10) φi+ 1 j = 2 φn+1/2 , u < 0 , 1 i+1/2 j (i+1)− 2 j n+1/2 φi (j)+ 1 , vi j+1/2 > 0 , 2 n+1/2 φi j+ 1 = (11) 2 φn+1/2 , vi j+1/2 < 0 . i (j+1)− 1 2 To define the values in the right hand sides of (10) and (11), we introduce ∇φnij ≈ ∇φ(tn , xi , yj ): ! ∂x φnij = (12) ∂y φnij φn −φn φn −φn κ(uij ) i+1 hj ij + (1 − κ(uij )) ij h i−1 j φn −φn φn −φn κ(vij ) i j+1h ij + (1 − κ(vij )) ij h i j−1 3 where the parameter function κ(s) ∈ [0, 1], s ∈ R has to be specified. Next, we apply the finite Taylor expansions: n+1/2 φ(i)+ 1 j = φnij + 2 n+1/2 φ(i)− 1 j = φnij − 2 n+1/2 φi (j)+ 1 = φnij + 2 ∆t h ∂x φnij − Vij · ∇φnij , 2 2 (13) h ∆t ∂x φnij − Vij · ∇φnij . 2 2 (14) h ∆t ∂y φnij − Vij · ∇φnij , 2 2 (15) h ∆t ∂y φnij − Vij · ∇φnij . (16) 2 2 In all cases, (3) was used to replace ∂t φnij with −Vij · ∇φnij . Finally, n+1/2 φi (j)− 1 = φnij − 2 ∆t Vij · ∇φnij . (17) 2 Using (10) - (17) in (9), the second order accurate fluxbased level set method is defined. It is important to note that also the first order upwind scheme can be viewed in the form (9) by replacing (12) with ∇φnij ≡ 0 in (13) - (17) resulting in n+1/2 φi j = φnij − ∆t ( h u− (φni+1 j − φnij ) + vi−j+ 1 (φnij+1 − φnij ) − i+ 12 j 2 + + n n ui− 1 j (φi−1 j − φij ) − vi j− 1 (φnij−1 − φnij ) , φn+1 = φnij − ij 2 (18) 2 where u+ = max{0, u} and u− = min{0, u}. The first order scheme (18) fulfills for the valid CFL condition: −1 + − − ∆t ≤ u+ h, (19) + v − v 1 1 − u 1 1 i− j i j− i+ j i j+ 2 2 2 2 that φn+1 is a convex combination of (at most) five values ij n φi+k j+l , |k|+|l| ≤ 1, so the value φn+1 fulfills a local disij crete minimum and maximum principle. Moreover, using a simple recursive procedure, one can generalize (18) for an arbitrary time step ∆t without the CFL restriction (19); see [6]. Note that if all components of the velocity in (19) are zero, there is no stability restriction on the time step, and (18) takes the trivial form φn+1 = φnij . ij As a consequence of the fact that the first order “positive coefficient” [2] scheme (18) can be viewed as a special case of the general scheme (9) by limiting numerical gradients ∇φnij to zero, one can use any standard limiter techniques to obtain the so-called “high-resolution” [10] form of (9). Such “limiters” can prevent unrealistic oscillations in numerical solutions by reducing locally the accuracy of (9). Nevertheless, using a good choice of initial level set function φ(0, x, y), e.g., a signed distance function, one can very often omit the limiters in practice, see later our numerical experiments where no limiter was applied. 4 Peter Frolkovič, Christian Wehner Remark 1 For one-dimensional problems and v(x) ≡ v = const, (9) represents the well-know class of discretization methods [21] called κ-scheme in [9, 24]. Special choices of κ lead to Lax–Wendroff scheme (κ(v) = 1, if v > 0), Fromm scheme (κ ≡ 1/2), and Beam–Warming scheme (κ(v) = 0, if v > 0). In fact, one can easily show; see, e.g., [21, 9,24, 23], that for ∆tv 1 2− , if v > 0 , κ(v) = 3 h the scheme becomes third order accurate. For the two-dimensional case, we will consider in numerical experiments the following choices: Let some interface Γ ⊂ D divide the domain D into two regions, say, “outside” Dout and “inside” Din . In what follows, we consider only (x, y) ∈ Dout . The distance function d = dΓ (x, y) is defined by p d = min (x̃ − x)2 + (ỹ − y)2 , (x, y) ∈ Dout , (27) (x̃,ỹ)∈Γ it means as the minimal Euclidian distance of (x, y) to some point (x̃, ỹ) on the interface Γ . Of course, dΓ (x, y) = 0, (x, y) ∈ Γ . Moreover, one can show; see, e.g., [19], that d can be found as a viscosity solution of the so-called Eikonal equation: |∇dΓ (x, y)| = 1 (28) if some appropriate boundary value problem is associated with (28). Another approach how to find all points (x, y) ∈ Dout such that dΓ (x, y) = h, is to move Γ in normal direction N with constant speed δ for time interval (0, T ) such that (23) T = T (x, y) = h/δ. This gives us also the notion of first arrival time function T (x, y) which can be again found (24) as a viscosity solution of an analogous Eikonal equation. Formally, one can extend dΓ (x, y) also for problems Moreover, we always choose κ(0) = 1/2. where some external movement of the medium (water or air) changes our vision of the distance; see, e.g., the sailboat distance in [13, 14]. Here we prefer to extend the 2.2 Advection in normal direction notion of first arrival time function for this type of problems. Particularly, we explain the concept using simple To apply the flux-based level set method for (2), i.e., models of boat sailing and/or fire spread. In the first case, the initial position of Γ can represent ∂t φ(t, x, y) + δ |∇φ(t, x, y)| = 0 , (25) a shore and D can describe a part of the sea. The path out one has to reformulate (25) for t ∈ (tn , tn+1 ) to the (for- of a boat which starts to sail from any point at Γ can be determined from the velocity v of water flow and the mal) form (if ∇φ 6= 0): speed δ of boat. The first arrival time T for (x, y) ∈ Dout ∇φ(tn , x, y) denotes the shortest time for the boat to reach (x, y) · ∇φ(t, x, y) = 0 , ∂t φ(t, x, y) + δ |∇φ(tn , x, y)| starting at T = 0 from some position (x̃, ỹ) ∈ Γ . Of course, to be able to reach all (x, y) ∈ Dout , one has to that can be viewed as a special case of (3) with V = require that |v| < δ. n ∇φ(t ) δ |∇φ(t n )| . Similarly for problems of fire spread, Γ can represent To apply (9), the velocity Vij has to be known in the border of unburnt area Dout , δ can describe the speed grid points (xi , yj ). Such numerical representation of V of fire in presence of no wind, and v can characterize the can be computed using (12) to define wind flow. Analogously to (28); see [14], the first arrival time n δij ∇φij , |∇φnij | = 6 0, function T can be found as a viscosity solution of an |∇φn | ij Vij = (26) appropriate boundary value problem associated with the 0, n |∇φij | = 0 . equation: To approximate V in integration points (xi±1/2 , yj±1/2 ), ∇T v + δ · ∇T = 1 . (29) we interpolate the gradients given by (12) and evaluate |∇T | V similarly to (26). Several direct numerical methods exist to solve (28), resp. (29), such as fast marching methods [19, 13] or fast sweeping methods [20]. In a different approach, T can be 3 First arrival time function found as a stationary solution of one of the following two level set equations with non-zero right hand side: One of the most straightforward application of advection (30) in normal direction is the computation of distance func- ∂t Φ(t, x, y) + V · ∇Φ(t, x, y) = 1 , tions and first arrival time functions. We describe these notions briefly. ∂t Φ(t, x, y) − V · ∇Φ(t, x, y) = −1 , (31) κ(s) = 1/2, κ(s) = 1, s > 0 , κ(s) = 0 , s < 0, κ(s) = 0, s > 0 , κ(s) = 1 , s < 0, s∆t s∆t κ(s) = 1 − , s > 0 , κ(s) = − , s < 0, h h 2 s∆t 1 s∆t κ(s) = − , s > 0 , κ(s) = − , s < 0. 3 3h 3 3h (20) (21) (22) Flux-based level set method on rectangular grids and computation of first arrival time functions 5 Table 1 Numerical results for the rotation of Gaussian function for κ from (21), (20), and (24). The 3rd column presents the error (34) in the first line, afterwards the EOC is given in the 2nd and 3rd line. The 4th column presents the minimum, the 5th column the maximum of numerical solution. Consecutive columns present analogous results for other choices of κ. We note that for N = 512 and κ from (24), the EOC equals 2.69, E = 8.5E-6, the minimum 5.7E-9 and the maximum 0.9992. κ ≡ 1/2 (21) (24) I N EOC min max EOC min max EOC min max 64 128 256 320 640 1280 (1.1E-2) 1.65 2.00 -1.1E-1 -4.6E-2 -3.3E-4 .639 .892 .984 (2.8E-3) 2.30 2.29 -1.5E-2 -5.3E-4 -1.5E-8 .770 .949 .993 (2.4E-3) 2.61 2.84 -1.0E-2 -1.4E-4 -1.3E-8 .788 .956 .994 t=1 t=1 1 t=1 0.25 0.25 0.9 0.2 0.2 0.15 0.15 0.1 0.1 0.05 0.05 0 0 −0.05 −0.05 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0.5 0.4 0.3 0.2 0.1 0 −0.1 −0.2 −0.3 −0.4 0.5 0 −0.5 −0.1 0.5 0.4 0.3 0.2 0.1 0 −0.1 −0.2 −0.3 −0.4 −0.1 0.5 0 −0.5 0.5 0.4 0.3 0.2 0.1 0 −0.1 −0.2 −0.3 −0.4 0.5 0 −0.5 Fig. 2 The plot of exact solution for the rotation of Gaussian function at t = 1 on the grid with h = 1/64 (left), the error (a difference between the exact and numerical solution at t = 1) for κ = 1/2 (middle) and for κ from (24) (right). where V = v + δN . (32) Which equation is used depends on the form of chosen boundary value problem. Particularly, let Γ be given implicitly by some level set function φ0 (x, y). We suppose that φ0 (x, y) > 0 for (x, y) ∈ Dout , φ0 (x, y) < 0 for (x, y) ∈ Din , and that ∇φ0 (x, y) is well defined for almost all (x, y) ∈ D. Having such settings, if T (x, y) is known for points on Γ , e.g., T (x, y) = 0, (x, y) ∈ Γ , one can solve (30) using Dirichlet boundary conditions Φ(t, x, y) = T (x, y) for (x, y) ∈ Γ , and no boundary conditions are required for (x, y) ∈ ∂D. Analogously, if T (x, y) is known for (x, y) ∈ ∂D, one can solve (31) using Dirichlet boundary conditions Φ(t, x, y) = T (x, y), (x, y) ∈ ∂D, and no boundary conditions are required for (x, y) ∈ Γ . The initial condition is always Φ(0, x, y) = φ0 (x, y). Opposite to direct methods which are the most efficient if the solution of (29) is searched, the methods based on numerical solution of (30), resp. (31), are often used for problems of reinitialization or redistancing of numerical level set functions; see. e.g., [16]. In our numerical experiments we apply the flux-based level set method to solve (30) and (31). Note that these equations are well defined only if |v| < δ. To treat a general situation without the last restriction, one can search for all points (x, y) ∈ Dout which can be reached by the boat in some time t by moving the interface Γ with the velocity V from (32). Consequently, T (x, y) = t, , if φ(t, x, y) = 0 , (33) 0 where φ is the solution of (1) with φ(0, x, y) = φ (x, y). Again, the flux-based level set method can be applied in this case. 4 Applications In this section we present two different applications of the flux-based level set method (9). All computations were realized using Matlab and the corresponding source codes are available for free from the second author by request; see [23]. 4.1 Linear conservation laws In this section we illustrate the properties of the fluxbased level set method for two examples of conservation laws described by linear advection equation with divergence free velocity. 6 Peter Frolkovič, Christian Wehner Table 2 The error (34) for the single-vortex example using five different choices of κ in (12) are presented. The last line presents the EOC for I = 400. κ in (21) κ in (24) −3 κ in (23) −3 κ in (22) I N E · 10 E · 10 E · 10 E · 10 E · 10−3 100 200 400 1000 2000 4000 EOC: 14.380 5.193 1.594 1.70 10.619 3.842 1.099 1.81 9.383 3.355 0.874 1.94 5.978 2.033 0.492 2.05 4.431 1.433 0.335 2.10 t=0 1 κ = 1/2 −3 −3 t=4 1 0.9 0.9 0.9 0.8 0.8 0.8 0.7 0.7 0.7 0.6 0.6 0.6 0.5 0.5 0.5 0.4 0.4 0.4 0.3 0.3 0.3 0.2 0.2 0.2 0.1 0.1 0.1 0 0 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 0.1 0.2 0.3 0.4 0.5 t=8 1 0.6 0.7 0.8 0.9 1 0 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Fig. 3 The contour plot (values -0.1, 0.0, 0.2, 0.4, and 0.6) of numerical solution for the single-vortex example at t = 0 (left), at t = 4 (middle), and t = 8 (right). The method with κ from (22) was used on the grid with h = 1/400. The first example is the rotation of Gaussian func- The worst results are obtained by the choice (21), nevertion. This benchmark is often used to test numerical theless all choices give the EOC (experimental order of methods for convection-dominated transport; see, e.g., convergence) around 2. Some non-physical oscillations [22]. Here we compute the example with zero diffusion, occur in all experiments, but they are negligible for the for a proper numerical treatment of the diffusive trans- finest grid. To suppress them, one could use some limitport we refer to [4]. ing procedure. The problem is solved on the unit square D = (−0.5, 0.5)2 . The second example is the single vortex benchmark By defining V = (−2πy , 2πx), the velocity describes a which is often used to test numerical methods for a trackconstant angular speed. The exact solution is given by ing of interfaces with complex behavior; see, e.g., [3, φ(t, x, y) = exp(−((x̃ + 0.25)2 + ỹ 2 )/0.004), where x̃ = 8, 12, 25,7]. The problem is solved on the unit square x cos(2πt) + y sin(2πt) and ỹ = y cos(2πt) − x sin(2πt). D = (0, 1)2 . The initial interface is a circle that is given The initial condition is given by the exact solution at by φ(0, x, y) = (x − 0.5)2 + (y − 0.75)2 − 0.152 = 0. t = 0, zero Dirichlet boundary conditions are used that The time-dependant velocity is given by V(t, x, y) = differ very slightly from the exact case. cos( πt 8 ) (u(x, y), v(x, y)) such that ∇ · V(t, x, y) = 0: The following simple discrete error E is used to evaluate the results of numerical experiments: u(x, y) = − sin2 (πx) sin(πy) cos(πy) , I X 0 E = E(I, N ) = h2 |φN (34) v(x, y) = sin2 (πy) sin(πx) cos(πx) . ij − φij | , i,j=0 i.e., the initial numerical solution and the numerical solution after one rotation at t = tN = 1 are compared. Table 1 presents the results for three different choices of κ in (12) and for three different grid sizes h = 1/I and time steps ∆t = 1/N . Moreover, the minimal and the maximal values of numerical solution are given with the exact values being 0 and 1. The choice (24) which gives the third order accurate method in the one-dimensional case, exhibits the smallest error among all considered values of κ in (20) - (24). The circle is stretched during advection with the maximal deformation at t = 4 when it begins to return to its initial position which is reached at t = 8, see Figure 3 for analogous numerical results. In Table 2, the error (34) is presented for different choices of κ, different grid steps h = 1/I, and time steps ∆t = 8/N . The best results are obtained by the choice of κ from (22). Note that in all examples the time dependancy of V(t, x, y) has to be resolved by choosing Vij = V(tn+1/2 , xi , yj ) in each time step. Flux-based level set method on rectangular grids and computation of first arrival time functions 7 Table 3 Results for three different boundary value problems associated with the exact stationary solution (36) with (37). Variant A is obtained by solving (30), variant B by solving (31), and variant C by solving (30) for (x, y) 6∈ S 0 and (31) for (x, y) ∈ S 0 , where S 0 is a circle with the radius 0.1δ and the centre (xc + 0.1vx , yc + 0.1vy ), see the green circle in the left picture of Figure 4. The errors (38) - (39) are presented in columns. For E1 , the EOC is given in the 2nd and 3rd line. A B C I N E1 E2 E3 E1 E2 E3 E1 E2 E3 16 32 64 30 60 120 (7.0E-3) 1.13 1.06 0 0 0 5.4E-3 4.5E-3 2.1E-3 (4.1E-4) 1.84 1.92 2.1E-2 1.1E-2 5.4E-3 0 0 0 (7.2E-4) 1.85 1.87 8.9E-3 4.5E-3 2.3E-3 -4.8E-3 -1.6E-3 -4.7E-4 t = 0.5 t = 0.5 t = 0.5 0.5 0.5 0.5 0.375 0.375 0.375 0.25 0.25 0.25 0.125 0.125 0.125 0 0 0 −0.125 −0.125 −0.125 −0.25 −0.25 −0.25 −0.375 −0.375 −0.375 −0.5 −0.5 −0.375 −0.25 −0.125 0 0.125 0.25 0.375 0.5 −0.5 −0.5 −0.375 −0.25 −0.125 0 0.125 0.25 0.375 0.5 −0.5 −0.5 −0.375 −0.25 −0.125 0 0.125 0.25 0.375 0.5 Fig. 4 The contour plot (uniformly distributed values from 0.05 to 0.4) of the exact solution (36) given by (37) on the grid with h = 1/16 (left). Analogously, the plot of numerical solution of (30), i.e., variant A (middle), and (31), i.e., variant B (right). Note that using variant B, very good agreement of the numerical and exact solution can be obtained even for a relatively coarse grid. 4.2 First arrival time function The most important advantage of the flux-based level set method is the possibility to use it for transport problems where the velocity of an interface is prescribed by the sum of an externally given velocity and a speed in the normal direction. We illustrate this property of the method for equations of first arrival time function where an exact solution is known. The domain is the square D := (−0.5, 0.5)2 . The velocity is given as the sum of a constant external velocity and a constant positive speed in normal direction, i.e., q V = (vx , vy ) + δN , δ = β vx2 + vy2 , (35) 1 The parameters are chosen in such a way that T (− 18 , − 16 )= 1 0.05, T (0, 0) = 0.1, T ( 81 , 16 ) = 0.15 (and so on) that can be easily checked in pictures later. The exact solution is plotted in the left picture of Figure 4. We construct three different boundary value problems using (30) and (31) where the exact solution is always given by (36) and (37). We refer them as variant A, B, and C. For all variants, three consecutive grids with h = 1/I and ∆t = 0.5/N are used. As initial condition the exact stationary solution (36) is chosen by using Φ0ij = T (xi , yj ). For each computation the following errors are evaluated: I 1 X N E1 = 2 |Φ − T (xi , yj )| (38) I i,j=0 ij where β > 0 is a parameter to be chosen. First, we compute the first arrival time function T (x, y) by searching the stationary solution of (30) and (31). The 1 1 (39) E2 = ΦN E3 = ΦN exact solution of (29), if β > 1, is given by, ic jc − T (xc , yc ), 00 − T (− , − ) 2 2 √ D − (x − xc )vx − (y − yc )vy where (x c , yjc ) = (xc , yc ). All computations are realized T (x, y) = , D= (36) with the iflux-based level set method using κ = 1/2 that δ 2 − vx2 − vy2 gives the best results among choices (20) - (24). Variant A is the most natural for this kind of prob= δ 2 (x − xc )2 + δ 2 (y − yc )2 − ((y − yc )vx − (x − xc )vy )2 . lem: the single value Φ(t, xc , yc ) = T (xc , yc ) = 0 is fixed In the first example we choose and (30) is solved. The numerical solution is plotted in the middle picture of Figure 4, the errors (38) and (39) 1 1 5 5 (xc , yc ) = (− , − ), (vx , vy ) = ( , ), β = 2. (37) are presented in Table 3. Trivially, E2 = 0. 4 8 6 12 8 Peter Frolkovič, Christian Wehner To do so, one has to control that the overall speed Clearly, the flux-based level set method for examples with this type of singularity (diverging characteristics δ + v · N in normal direction N will not become negative. from a single point) is only first order accurate, see also If this is to happen for some values of v, the normal component of V must be set to zero. analogous experiments in [7]. To demonstrate the second order accuracy of the method From numerical point of view, the following modififor examples without this kind of singularity, we con- cation of (32) has appeared to be appropriate: struct an “unrealistic” boundary value problem (variant V = v − min{−δ, v · N}N . (40) B): the exact values Φ(t, x, y) = T (x, y) are fixed for The results using (40) are presented in Figure 6. The (x, y) ∈ ∂D and (31) is solved. Consequently, all characteristics are converging from ∂D to the single point numerical solution was obtained by the flux-based level set method (9) using additionally the inequality (xc , yc ). Trivially, E3 = 0. Although the local error E2 exhibits the EOC approximately 1, see Table 3, this single point does not destroy the EOC of global error E1 which is approximately 2. Finally, we describe some “realistic” boundary value problem when some initial interface Γ ⊂ D is chosen and T is fixed for all points from this interface. To illustrate this type of problems, variant C is chosen such that Φ(t, x, y) = T (x, y) = 0.1 are fixed for (x, y) ∈ S 0 (r, x), where S 0 is a circle with radius r = 0.1 and centre x = (xc + 0.1vx , yc + 0.1vy ), see the green circle in left picture of Figure 4. Outside of S 0 , one has to solve (30), inside of S 0 , one solves (31). This way, variant C can be viewed formally as two boundary value problems. In general, it is not a trivial task to construct a discrete version of these boundary value problems, because the grid points near the interface have to be initiated by some procedure; see e.g., [1]. As our aim is only to document the second order accuracy for this type of problem, we simply fix the exact values Φ(t, xi , xj ) = T (xi , yj ) for all grid points belonging to grid cells that are intersected by S 0 . Table 3 documents that the EOC of E1 and E3 is approaching 2 for this problem. Finally, we illustrate the advantages of searching for the first arrival time function T by solving (1) and using (33). Figure 5 shows the positions of an interface in different times for three different settings of the problem, see description there. The initial interface is always the smallest circle S(t0 δ, (xc + t0 vx , yc + t0 vy ) for some t0 > 0. This circle is described implicitly by φ0 (x, y) which is chosen to be a signed distance function. The exact position of the interface at some time t is always a circle S((t0 + t)δ, (xc + (t0 + t)vx , yc + (t0 + t)vy )). The picture on the right of Figure 5 illustrates the case when there exists no solution of (30) or (31), because the evolving circles do not pass through all points of the domain, and (33) can not be used for all (x, y) ∈ D. Nevertheless, (1) with velocity (32) is well defined problem for arbitrary (vx , vy ) and β, see the picture on the left of Figure 6 for which β = 1/2, i.e., |v| > δ. The evolving circles not only do not pass through all (x, y) ∈ D, but they cross each other. Nevertheless, one can modify (32) in such a way that realistic settings are obtained for an arbitrary speed of boat and water (or fire and wind). δij + vij · ∇φnij <0 |∇φnij | (41) for each n to apply φn+1 = φnij if (41) is valid. ij Note that using this approach, one could construct the first arrival times also for problems when the water flow is faster than the speed of boat (or the the wind velocity is stronger than the speed of fire). 5 Conclusions The flux-based level set method can be successfully applied for the numerical solution of general advection equation which describes not only the transport given by some external velocity field, but also the evolution of level lines or surfaces in normal direction. Applying the method on rectangular grids, we have introduced a oneparameter family of the method similarly to the κ-scheme in the one-dimensional case, see [21, 9, 24]. For two wellknown benchmark examples of linear conservation laws it was shown that other choices than the simplest one κ = 1/2 (that was used in [7] for unstructured grids) can significantly improve the accuracy of numerical results. For both benchmark examples the (sharp) second order convergence of the method was observed. Finally, the flux-based level set method was applied for the computation of first arrival time functions for problems of boat sailing or fire spread. As for this type of problems the external velocity and the speed in normal direction are in general of the same importance, the flux-based level set method (that is well defined for both types of problem) can produce very satisfactory numerical results. References 1. D. Adalsteinsson and J. Sethian. The fast construction of extension velocities in level set methods. J. Comput. Phys., 148:2–22, 1999. 2. T. Barth and M. Ohlberger. Finite volume methods: foundation and analysis. In E. Stein, R. de Borst, and T.J.R. Hughes, editors, Encyclopedia of Computational Mechanics, volume 1, pages 439–474. John Wiley & Sons, 2004. 3. D. Enright, F. Losasso, and R. Fedkiw. A fast and accurate semi-Lagrangian particle level set method. Computers and Structures, 83:479–490, 2005. Flux-based level set method on rectangular grids and computation of first arrival time functions t = 0.5 0.5 t = 0.5 0.5 0.375 0.375 0.25 0.25 0.25 0.125 0.125 0.125 0 0 0 −0.125 −0.125 −0.125 −0.25 −0.25 −0.25 −0.375 −0.375 −0.375 −0.5 −0.5 −0.375 −0.25 −0.125 0 0.125 0.25 0.375 0.5 −0.5 −0.5 −0.375 −0.25 −0.125 t = 0.5 0.5 0.375 0 0.125 0.25 0.375 0.5 −0.5 −0.5 9 −0.375 −0.25 −0.125 0 0.125 0.25 0.375 0.5 Fig. 5 The plot of evolving zero level lines of the numerical solution of (1) with V given by (35) for the grid with h = 1/16. The smallest circle represents always the initial (given) position, other expanding circles represent the position for 5 consecutive times. The picture on left shows the results in the presence of no water flow, i.e., (vx , vy ) = 0 and δ = 1, the picture in middle the results analogous to Figure 4, and the picture on right the results for (vx , vy ) = ( 45 , 58 ) and β = 1. In the last case not all points of the domain are crossed by evolving circles, and, consequently, (30) and (31) are not well defined problems. t = 0.35 t = 0.35 0.5 0.5 0.375 0.375 0.375 0.25 0.25 0.25 0.125 0.125 0.125 0 0 0 −0.125 −0.125 −0.125 −0.25 −0.25 −0.25 −0.375 −0.375 −0.375 −0.5 −0.5 −0.375 −0.25 −0.125 0 0.125 0.25 0.375 0.5 −0.5 −0.5 −0.375 −0.25 −0.125 0 t = 0.35 0.5 0.125 0.25 0.375 0.5 −0.5 −0.5 −0.375 −0.25 −0.125 0 0.125 0.25 0.375 0.5 Fig. 6 The plot of evolving zero level lines analogously to Figure 5 using parameters (vx , vy ) = ( 54 , 85 ) and β = 1/2 in (35). The picture on left presents the results for unmodified velocity as given in (32) for the grid with h = 1/64, the picture in middle presents the analogous results for modified velocity as given in (40), the picture on right presents the results with (40) for the grid with h = 1/16. 4. P. Frolkovič. Flux-based method of characteristics for contaminant transport in flowing groundwater. Computing and Visualization in Science, 5(2):73–83, 2002. 5. P. Frolkovič and K. Mikula. Flux-based level set method: A finite volume method for evolving interfaces. Preprint 15, IWR, Universität Heidelberg, http://www.iwr.uni-heidelberg.de/services/, September 2003. 6. P. Frolkovič and K. Mikula. Flux-based level set method: A finite volume method for evolving interfaces. Applied Numerical Mathematics, 57(4):436–454, 2007. 7. P. Frolkovič and K. Mikula. High-resolution flux-based level set method. SIAM J. Sci. Comp., accepted, September 2006. 8. S. E. Hieber and P. Koumoutsakos. A Lagrangian particle level set method. J. Comput. Phys., 210:342–367, 2005. 9. D. Kröner. Numerical Schemes for Conservation Laws. Wiley and Teubner, Chichester, Stuttgart, 1997. 10. R. J. LeVeque. Finite Volume Methods for Hyperbolic Problems. Cambridge Texts in Applied Mathematics. Cambridge University Press, 2002. 11. F. Losasso, R. Fedkiw, and S. Osher. Spatially adaptive techniques for level set methods and incompressible flow. Computers and Fluids, 35:995–1010, 2006. 12. E. Marchandise, J.-F. Remacle, and N. Chevaugeon. A quadrature-free discontinuous Galerkin method for the level set equation. J. Comput. Phys., 212:338–357, 2006. 13. T. Nishida and K. Sugihara. Approximation of the boatsail Voronoi diagram and its application. In A. Laganà and et. al., editors, ICCSA (3), pages 227–236. Springer, 2004. 14. T. Nishida, K. Sugihara, and M. Kimura. Stable markerparticle method for the Voronoi diagram in a flow 10 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. Peter Frolkovič, Christian Wehner field. Journal of Computational and Applied Mathematics, doi:10.1016/j.cam.2006.01.035, 2006. E. Olsson and G. Kreiss. A conservative level set method for two phase flow. J. Comput. Phys., 210:225–246, 2005. S. Osher and R. Fedkiw. Level Set Methods and Dynamic Implicit Surfaces. Springer, 2003. S. Osher and J.A. Sethian. Fronts propagating with curvature-dependent speed: Algorithms based on Hamilton-Jacobi formulations. J. Comput. Phys., 79:12– 49, 1988. D. A. Di Pietro, S. Lo Forte, and N. Parolini. Mass preserving finite element implementations of the level set method. Applied Numerical Mathematics, 56(9):1179– 1195, 2006. J. Sethian. Level Set Methods and Fast Marching Methods. Cambridge University Press, 1999. Y. Tsai, Li-Tien Ch., S. Osher, and Hong-Kai Z. Fast sweeping algorithms for a class of Hamilton-Jacobi equations. SIAM J. Numer. Anal., 41(2):673–695, 2003. B. van Leer. Towards the ultimate conservative difference scheme iii. upstream-centered finite difference schemes for ideal compressible flow. J. Comput. Phys., 23:263– 275, 1977. H. Wang, H.K. Dahle, R.E. Ewing, M.S. Espedal, R.C. Sharpley, and S. Man. An ELLAM scheme for advectiondiffusion equations in two dimensions. SIAM J. Sci. Comput., 20(6):2160–2194, 1999. C. Wehner. In preparation. Master’s thesis, University of Heidelberg, 2007. P. Wesseling. Principles of Computational Fluid Dynamics. Springer, Berlin, Heidelberg, 2001. X. Yang, A. J. James, J. Lowengrub, X. Zheng, and V. Cristini. An adaptive coupled level-set/volume-offluid interface capturing method for unstructured triangular grids. J. Comput. Phys., 217(2):364–394, 2006.