# Example of level set method

I am looking for easily to understand example of level set method used to track phases interfaces. I would like to solve it using FEM because my solution is based on the FEM solution of second Fick law. Initialization step is straight forward - it just distance of each node from the interface. But I have problem with second step - solution of the interface velocity equation:

$$\frac{\partial \phi }{\partial t}+F\left| \nabla \phi \right|=0$$

If I understand correctly I need a weak formulation of that differential equation, where F is linear velocity of the interface. Solution will give me a new position of the interface. Is it correct?

TL;DR: Yes, $\phi=0$ always locates the interface even at later times. See below for more details:

A level set function, $\phi(x,y,t)$, in two dimensions, describes a function whose zero-level set describes your interface. To be precise, a level-set function $\phi$ divides your domain $\Omega$ into three disjoint subdomains:

$$\left\{ \begin{array}{lcr} \Omega^- &:(x,y,t) \:&|\: & \phi(x,y,t) < 0 \\ \Gamma &:(x,y,t) \:&|\: & \phi(x,y,t) = 0 \\ \Omega^+ &:(x,y,t) \:&|\: & \phi(x,y,t) > 0 \\ \end{array} \right.$$

Assuming that $\phi(x,y,t) = 0$ always denotes the interface $\Gamma$, it is clear that the the interface must satisfy: $$\frac{D \phi}{D t} = \frac{\partial \phi}{\partial t} + \mathbf{V} \cdot \nabla \phi = 0$$

Furthermore, since $\phi(x,y,t) = 0$ on $\Gamma$, this equation may be written to only involve the velocity in the normal direction $$\frac{\partial \phi}{\partial t} + v_n \frac{\partial \phi}{\partial n} = 0$$ However, since $\Gamma$ is a level-set, we have the following relation for the unit normal: $$\hat{\mathbf{n}} = \frac{\nabla \phi}{\left|\nabla \phi\right|}$$ Thus, the evolution equation simplifies to: $$\frac{\partial \phi}{\partial t} + v_n \left|\nabla \phi\right| = 0$$

This is your version of the equation with $F = v_n$. It is sometimes referred to as motion in the normal direction.

To summarize, the zero level-set of $\phi(x,y,t)$ always locates the interface when you solve the level-set equation (either in its original form or normal motion form). I suggest you consult the following two standard texts for more details and actual implementation:

Sethian's book

Osher & Fedkiw's book

The first one includes a chapter on weak formulation and FEM methods for the solution whereas the second is mainly involved with FDM methods.

For the level set equation, $\phi=0$ denotes your interface and which you initialize suitably. Then based on your convection equation, you move $\phi$ (depends on how you want to solve it, if using FEM, then you need the weak formulation etc.) and again find $\phi=0$ which would give you the location of your convected interface. However, the level set function gets smeared out after some iterations. Hence, you may have to re-initialize it.

I find this tutorial to be relatively easier to understand: http://persson.berkeley.edu/pub/persson05levelset.pdf Hope it helps.

For the FEM framework, Chapter 5 of this thesis should be helpful.

• This doesn't really seem to answer the question. @KrzysztofBzowski is asking how to evolve the level set equation in time within an FEM framework, whereas the tutorial only covers finite difference discretizations. – Ben Jun 3 '13 at 6:46
• @Ben: I thought the question was more focussed on the way LSM works. I have included a reference for FEM formulation of LSM. – Sidhha Jun 3 '13 at 8:48