# Diff of /trunk/doc/user/levelsetmodel.tex

revision 2138 by lgraham, Mon Dec 8 02:27:07 2008 UTC revision 2148 by lgraham, Wed Dec 10 04:57:35 2008 UTC
# Line 1  Line 1
1  \subsection{Level Set Method}  \section{Level Set Method}
2
3    The Level Set Method is used for tracking interfaces between two different types of fluids, which may have different physical parameter values for density or viscosity. The interface is represented by a signed distance function, $\phi(x)$, where the isocontour at $\phi(x)=0$ is used to defined the interface. A point in the domain can then be determined on which side of the interface it resides, based on the local sign of $\phi(x)$; for example positive $\phi(x)$ on one side of the interface and negative $\phi(x)$ on the other. Parameters values such as density and viscosity can then be defined for the two different mediums. The Level Set Method consists of two procedures, the advection and reinitialization of the signed distance function, $\phi$. The LevelSet class can be used in conjunction with the StokesProblemCartesian class for solving computational fluid dynamics problems involving the tracking of the interface. The advantage of the Level Set Method is that it can be used to track surfaces that break apart or intersect. Also, the Level Set Method avoids the need for remeshing, which is required by the Lagrangian-Eulerian (ALE) method. An example of using the Level Set Method is described in the tutorial Chapter, Section \ref{LEVELSET CHAP}.
4
5  \subsection{Solution Method}  \subsection{Solution Method}
6
7    The displacement of the interface at the zero isocontour of $\phi(x)$ is calculated each time-step by using the velocity field. This is achieved my solving the advection equation:
8    %
9
10    \frac{\partial \phi}{\partial t} + \vec{v} \cdot \nabla \phi = 0,
12
13    %
14    where $\vec{v}$ is the velocity field. The advection equation is solved using a Taylor-Galerkin scheme with the presence of diffusion; by expanding $\phi$ into a Taylor series:
15    %
16
17    \phi^{+} \simeq \phi^{-} + dt\frac{\partial \phi^{-}}{\partial t} + \frac{dt^2}{2}\frac{\partial^{2}\phi^{-}}{\partial t^{2}},
18    \label{TAYLOR EXPANSION MODELS}
19
20    %
21    then by inserting
22    %
23
24    \frac{\partial \phi^{-}}{\partial t} = - \vec{v} \cdot \nabla \phi^{-},
26
27    %
28    and
29    %
30
31    \frac{\partial^{2} \phi^{-}}{\partial t^{2}} = \frac{\partial}{\partial t}(-\vec{v} \cdot \nabla \phi^{-}) = \vec{v}\cdot \nabla (\vec{v}\cdot \nabla \phi^{-}),
32    \label{SECOND ORDER MODELS}
33
34    %
35    into Equation (\ref{TAYLOR EXPANSION MODELS}), the calculation of the level set function is given by:
36    %
37
38    \phi^{+} = \phi^{-} - dt\vec{v}\cdot \nabla \phi^{-} + \frac{dt^2}{2}\vec{v}\cdot \nabla (\vec{v}\cdot \nabla \phi^{-}).
39    \label{TAYLOR GALERKIN MODELS}
40
41
42    If $\nabla \cdot \vec{v}=0$ is assumed, then the calculation of the second order derivatives in Equation (\ref{TAYLOR GALERKIN MODELS}) can be avoided.
43
44    As the computation of the distance function progresses, it becomes distorted, and so it needs to be updated in order to stay regular \cite{SUSSMAN1994}. This process is known as the reinitialization procedure. The aim is to iteratively find a solution to the reinitialization equation:
45    %
46
47    \frac{\partial \psi}{\partial \tau} + sign(\phi)(1 - \nabla \psi) = 0.
48    \label{REINITIALISATION MODELS}
49
50    %
51    where $\psi$ shares the same level set with $\phi$, $\tau$ is pseudo time, and $sign(\phi)$ is the smoothed sign function. This equation is solved to meet the definition of the level set function, $\lvert \nabla \psi \rvert = 1$; the normalization condition. Equation (\ref{REINITIALISATION MODELS}) can be rewritten in a similar form to the advection equation:
52    %
53
54    \frac{\partial \psi}{\partial \tau} + \vec{w} \cdot \nabla \psi = sign(\phi),
55    \label{REINITIALISATION2 MODELS}
56
57    %
58    where
59    %
60
61    \vec{w} = sign(\phi)\frac{\nabla \psi}{|\nabla \psi|}.
62    \label{REINITIALISATION3 MODELS}
63
64    %
65    $\vec{w}$ is the characteristic velocity pointing outward from the free surface. Equation (\ref{REINITIALISATION2 MODELS}) can be solved by a similar technique to what was used in the advection step, using the Taylor-Galerkin procedure.
66    When the distance function, $\phi$, is calculated, the physical parameters, density and viscosity, are updated using the sign of $\phi$. The region along the interface is assumed to be of finite thickness of $\alpha h$, where $h$ is the size of the elements in the computational mesh and $\alpha$ is a smoothing parameter. The parameters are updated by the following expression:
67    %
68
69    P =
70    \left \{ \begin{array}{l}
71    P\hackscore{1} \hspace{5cm}  where \ \ \psi < - \alpha h \\
72    P\hackscore{2} \hspace{5cm}  where \ \ \psi > \alpha h \\
73    (P\hackscore{2} - P\hackscore{1}) \psi/2\alpha h + (P\hackscore{1} + P\hackscore{2})/2 \ \ \ \ \ \ where \ \ |\psi| < \alpha h.
74    \end{array}
75    \right.
76    \label{UPDATE PARAMETERS MODELS}
77
78    %
79    where the subscripts $1$ and $2$ denote the different fluids.
80
81
82  \subsection{Functions}  \subsection{Functions}
83
84  \begin{classdesc}{LevelSet}{domain, func, reinit\_max, reinit\_each, tolerance, smooth}  \begin{classdesc}{LevelSet}{domain, func, reinit\_max, reinit\_each, tolerance, smooth}
85  opens the LevelSet \index{Level Set} on the \Domain domain. \var{func} defines the initial Level Set function representing the interface between two fluids. \var{reinit\_max} sets the maximum number of interations to satisfy the normal condition, $|\nabla \phi|=1$, during the reinitilization of the Level Set function. \var{reinit\_each} sets the frequency of reinitialization for a number of time-steps. \var{tolerance} sets the convergence tolerance of the error to satisfy the normal condition during the reinitilization of the Level Set function. \var{smooth} sets the bandwidth of size 2$\alpha h$ along the interface to smooth the physical parameters of density and viscosity; $h$ is the size of the elements in the mesh and $\alpha$ is the smoothing parameter, usually set to 1.  opens the LevelSet \index{Level Set} on the \Domain domain. \var{func} defines the initial Level Set function representing the interface between two fluids. \var{reinit\_max} sets the maximum number of iterations to satisfy the normal condition, $|\nabla \phi|=1$, during the reinitialization of the Level Set function. \var{reinit\_each} sets the frequency of reinitialization for a number of time-steps. \var{tolerance} sets the convergence tolerance to satisfy the normal condition during the reinitialization of the Level Set function. \var{smooth} sets the bandwidth of size 2$\alpha h$ along the interface to smooth the physical parameters of density and viscosity; $h$ is the size of the elements in the mesh and $\alpha$ is the smoothing parameter, usually set to 1.
86  \end{classdesc}  \end{classdesc}
87
88  \begin{methoddesc}[LevelSet]{update\_parameter}{par1, par2}  \begin{methoddesc}[LevelSet]{update\_parameter}{par1, par2}
89  updates the physical parameters using the sign of $\phi$. \var{par1} and \var{par2} are the physical parameter values for the two different fluids, for example, the densities of the two fluids. Usually this method is called twice during each time-step to update the density and viscosity of the two fluids.  updates the physical parameters using the sign of $\phi$. \var{par1} and \var{par2} are the physical parameter values for fluid1 and fluid2 respectively. Usually this method is called twice during each time-step to update the density and viscosity of the two fluids.
90  \end{methoddesc}  \end{methoddesc}
91
92  \begin{methoddesc}[LevelSet]{update\_phi}{vel,  dt, t\_step}  \begin{methoddesc}[LevelSet]{update\_phi}{vel,  dt, t\_step}
93  updates the Level Set function. It performs the advection and reinitialization procedures. \var{vel} is the velocity field of the fluids, \var{dt} is the time-step size, and \var{t\_step} is the current time-step to determine when to reinitialize.  updates the Level Set function. It performs the advection and reinitialization procedures. \var{vel} is the velocity field of the fluid domain, \var{dt} is the time-step size, and \var{t\_step} is the current time-step to determine when to reinitialize.
94  \end{methoddesc}  \end{methoddesc}

%\begin{methoddesc}[StokesProblemCartesian]{update\_phi}{v,p,
%\optional{max_iter=20, \optional{verbose=False, \optional{useUzawa=True}}}}
%solves the problem and return approximations for velocity and pressure.
%The arguments \var{v} and \var{p} define initial guess. The values of \var{v} marked
%If \var{useUzawa} is set to \True
%the Uzawa\index{Uszwa} scheme is used. Otherwise the problem is solved in coupled form. In most cases
%the Uzawa scheme is more efficient.
%\var{max_iter} defines the maximum number of iteration steps.
%If \var{verbose} is set to \True informations on the progress of of the solver are printed.
%\end{methoddesc}

Legend:
 Removed from v.2138 changed lines Added in v.2148