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

revision 1966 by jfenwick, Wed Nov 5 04:59:22 2008 UTC revision 2138 by lgraham, Mon Dec 8 02:27:07 2008 UTC
# Line 13  Line 13
13
14
15  \chapter{Models}  \chapter{Models}
16    \label{MODELS CHAPTER}
17
18  The following sections give a breif overview of the model classes and their corresponding methods.  The following sections give a breif overview of the model classes and their corresponding methods.
19
20  \section{Stokes Problem}  \section{Stokes Problem}
21  The velocity field $v$ and pressure $p$ of an incompressible fluid is given as the solution of their  The velocity \index{velocity} field $v$ and pressure $p$ of an incompressible fluid \index{incompressible fluid} is given as the solution of the Stokes problem\index{Stokes problem}
Stokes problem
22  \begin{equation}\label{Stokes 1}  \begin{equation}\label{Stokes 1}
23  -\left(\eta(v\hackscore{i,j}+ v\hackscore{i,j})\right)\hackscore{,j}+p\hackscore{,i}=F\hackscore{i}  -\left(\eta(v\hackscore{i,j}+ v\hackscore{i,j})\right)\hackscore{,j}+p\hackscore{,i}=f\hackscore{i}-\sigma\hackscore{ij,j}
24  \end{equation}  \end{equation}
25  where $\eta$ is the viscosity and $F_i$ defines an internal force. We assume an incompressible media:  where $\eta$ is the viscosity, $F\hackscore{i}$ defines an internal force \index{force, internal} and $\sigma\hackscore{ij}$ is an intial stress \index{stress, initial}. We assume an incompressible media:
26  \begin{equation}\label{Stokes 2}  \begin{equation}\label{Stokes 2}
27  -v\hackscore{i,i}=0  -v\hackscore{i,i}=0
28  \end{equation}  \end{equation}
29  Natural boundary conditions are taken in the form  Natural boundary conditions are taken in the form
30  \begin{equation}\label{Stokes Boundary}  \begin{equation}\label{Stokes Boundary}
31  \left(\eta(v\hackscore{i,j}+ v\hackscore{i,j})\right)n\hackscore{j}-n\hackscore{i}p=f  \left(\eta(v\hackscore{i,j}+ v\hackscore{i,j})\right)n\hackscore{j}-n\hackscore{i}p=s\hackscore{i}+\sigma\hackscore{ij} n\hackscore{i}
32  \end{equation}  \end{equation}
33  which can be overwritten by a constraint  which can be overwritten by constraints of the form
34  \begin{equation}\label{Stokes Boundary0}  \begin{equation}\label{Stokes Boundary0}
35  v\hackscore{i}(x)=0  v\hackscore{i}(x)=v^D\hackscore{i}(x)
36  \end{equation}  \end{equation}
37  where the index $i$ may depend on the location $x$ on the bondary.  at some locations $x$ at the boundary of the domain. The index $i$ may depend on the location $x$ on the boundary.
38    $v^D$ is a given function on the domain.
39
40  \subsection{Solution Method \label{STOKES SOLVE}}  \subsection{Solution Method \label{STOKES SOLVE}}
41  In block form equation equations~\ref{Stokes 1} and~\ref{Stokes 2} takes the form of a saddle point problem  In block form equation equations~\ref{Stokes 1} and~\ref{Stokes 2} takes the form of a saddle point problem
43  \begin{equation}  \begin{equation}
44  \left[ \begin{array}{cc}  \left[ \begin{array}{cc}
45  A     & B^{*} \\  A     & B^{*} \\
46  B & 0 \\  B & 0 \\
47  \end{array} \right]  \end{array} \right]
48  \left[ \begin{array}{c}  \left[ \begin{array}{c}
49  u \\  v \\
50  p \\  p \\
51  \end{array} \right]  \end{array} \right]
52  =\left[ \begin{array}{c}  =\left[ \begin{array}{c}
53  F \\  G \\
54  0 \\  0 \\
55  \end{array} \right]  \end{array} \right]
57  \end{equation}  \end{equation}
58  where $A$ is coercive, self-adjoint linear operator in $V$, $B$ is a divergence operator and $B^{*}$ is it adjoint operator (=gradient operator)). For more details on the mathematics see references \cite{AAMIRBERKYAN2008,MBENZI2005}.  where $A$ is coercive, self-adjoint linear operator in a suitable Hilbert space, $B$ is the $(-1) \cdot$ divergence operator and $B^{*}$ is it adjoint operator (=gradient operator). For more details on the mathematics see references \cite{AAMIRBERKYAN2008,MBENZI2005}.
59  We apply the preconditioner matrix  We use iterative techniques to solve this problem. To make sure that the incomressibilty condition holds
60    with sufficient accuracy we check for
61    \begin{equation}
62    \|v\hackscore{k,k}\| \hackscore \le  \epsilon
63    \|\sqrt{v\hackscore{j,k}v\hackscore{j,k}}\|
64    \end{equation}
65    where $\epsilon$ is the desired relative accuracy and
66    \begin{equation}
67    \|p\|^2= \int\hackscore{\Omega} p^2 \; dx
68    \label{PRESSURE NORM}
69    \end{equation}
70    defines the $L^2$-norm.
71    There are two approaches to solve this problem. The first approach, called the Uzawa scheme \index{Uzawa scheme}
72    eliminates the velocity $v$ from the problem. The second approach solves the equation in coupled form after the application of a preconditioner.
73
74    \subsubsection{Uzawa scheme}
75    The first eqution in~\ref{SADDLEPOINT} gives $v=A^{-1}(G-B^{*}p)$ assuming $p$ is known. This is inserted into the
76    second eqution which leads to
77    \begin{equation}
78    S p =  B A^{-1} G
79    \end{equation}
80    with the Schur complement \index{Schur complement} $S=BA^{-1}B^{*}$. This problem can be solved iteratively using the reconditioned Conjugate Gradient Method (PCG)~\index{PCG!Preconditioned Conjugate Gradient Method}
81    with the preconditioner $\hat{S}$ defined as $q=\hat{S}^{-1}p$ by solving
82    \begin{equation}
83    \frac{1}{\eta}q = p
84    \end{equation}
85    see~\cite{ELMAN} for more details. The evaluation of $w=Sp$ is done in the form
86    \begin{equation}
87    \begin{array}{rcl}
88    A v & = & B^{*}p \\
89    w & = & Bv \\
90    \end{array}
91    \label{EVAL PCG}
92    \end{equation}
93    The residual \index{residual}  $r=B A^{-1} G - S p$ is given as
94    \begin{equation}
95    r=B A^{-1} (G - B^* p) = Bv \mbox{ with } v = A^{-1}(G-B^{*}p)
96    \end{equation}
97    Therefore one uses the tuple $(v,Bv)$ to represent the residual of the current pressure $p$. Notice that before the iteration is started the right hand side $B A^{-1} G$ needs to be calculated. The bilinear form $(.,.)$ used is defined as
98    \begin{equation}
99    (p,(v,Bv))=\int\hackscore{\Omega} p \cdot Bv \; dx
100    \end{equation}
101    where $p$ is the pressure increment and $(v,Bv)$ represents an increment in the residual.
102
103    \subsubsection{Coupled Solver}
104    An alternative approach to solve the saddle point problem~\ref{SADDLEPOINT} directly using an iterative such as
105    the generalized minimal residual method (GMRES) \index{generalized minimal residual method!GMRES} with a suitable
106    preconditioner. Here we use the operator
107  \begin{equation}  \begin{equation}
108  \left[ \begin{array}{cc}  \left[ \begin{array}{cc}
109  A^{-1}     & 0 \\  A^{-1}     & 0 \\
# Line 63  S^{-1} B A^{-1}  & -S^{-1} \\ Line 111  S^{-1} B A^{-1}  & -S^{-1} \\
111  \end{array} \right]  \end{array} \right]
113  \end{equation}  \end{equation}
114  with the Schur complement $S=BA^{-1}B^{*}$ to solve the problem iteratively. The updates $dv$ and $dp$ for  where again $S$ is the Schur complement~\cite{ELMAN}. In partice we will use an approximation $\hat{S}$ for $S$. The evaluation $(w,q)$ of the iteration operator for a given $(v,p)$ is done as
given velocity $v$ and pressure $p$ is given as
115  \begin{equation}  \begin{equation}
116  \begin{array}{rcl}  \begin{array}{rcl}
117  A dv & = & F-Av-B^{*}p \\  A w & = & Av+B^{*}p \\
118  S dp & = & B(v+dv) \\  \hat{S} q & = & B(w-v) \\
119  \end{array}  \end{array}
121  \end{equation}  \end{equation}
122  This scheme is called the Uzawa scheme.  We use the inner product induced by the norm
123    \begin{equation}
124  In the case of the Stokes problem it can be shown that $S$ can be approximated by $\frac{1}{\eta}$. With this the iteration scheme can be implemented as  \|(v,p)\|^2= \int\hackscore{\Omega}  v\hackscore{i,j}  v\hackscore{i,j} + \left( \frac{p}{\eta}\right)^2\; dx
125    \label{COUPLES NORM}
126    \end{equation}
127    In PDE form~\ref{COUPLES SADDLEPOINT iteration} takes the form
128  \begin{equation}  \begin{equation}
129  \begin{array}{rcl}  \begin{array}{rcl}
130  -\left(\eta(dv\hackscore{i,j}+ dv\hackscore{i,j})\right)\hackscore{,j} & = & F\hackscore{i}+\left(\eta(v\hackscore{i,j}+ v\hackscore{i,j})\right)\hackscore{,j}-p\hackscore{,i} \\  -\left(\eta(w\hackscore{i,j}+ w\hackscore{i,j})\right)\hackscore{,j} & = & -\left(\eta(v\hackscore{i,j}+ v\hackscore{i,j})\right)\hackscore{,j}+p\hackscore{,i} \\
131  \frac{1}{\eta} dp & = & - \left(v\hackscore{,i}+dv\hackscore{,i} \right)\hackscore{,i} \\  \frac{1}{\eta}  q & = & - (w-v)\hackscore{i,i} \\
132  \end{array}  \end{array}
134  \end{equation}  \end{equation}
To accelerate the convergence we are using the restarted $GMRES$ method using the norm
\begin{equation}
\|(v,p)\|^2= \int\hackscore{\Omega} \eta^2 v\hackscore{i,j}^2 + p^2 \; dx
\end{equation}
or alternatively the $PCG$ method on the pressure only using the norm
\begin{equation}
\|p\|^2= \int\hackscore{\Omega} \frac{1}{\eta^2} p^2 \; dx
\end{equation}
135
136
137    \subsection{Functions}
138
139    \begin{classdesc}{StokesProblemCartesian}{domain}
140    opens the Stokes problem\index{Stokes problem} on the \Domain domain. The approximation
141    order needs to be two.
142    \end{classdesc}
143
144    \begin{methoddesc}[StokesProblemCartesian]{initialize}{\optional{f=Data(), \optional{fixed_u_mask=Data(), \optional{eta=1, \optional{surface_stress=Data(), \optional{stress=Data()}}}}}}
145    assigns values to the model parameters. In any call all values must be set.
146    \var{f} defines the external force $f$, \var{eta} the viscosity $\eta$,
147    \var{surface_stress} the surface stress $s$ and \var{stress} the initial stress $\sigma$.
148    The locations and compontents where the velocity is fixed are set by
149    the values of \var{fixed_u_mask}. The method will try to cast the given values to appropriate
150    \Data class objects.
151    \end{methoddesc}
152
153  \begin{classdesc}{StokesProblemCartesian}{domain,debug}  \begin{methoddesc}[StokesProblemCartesian]{solve}{v,p,
154  opens the stokes equations on the \Domain domain. Setting debug=True switches the debug mode to on.  \optional{max_iter=20, \optional{verbose=False, \optional{useUzawa=True}}}}
155  \end{classdesc}  solves the problem and return approximations for velocity and pressure.
156    The arguments \var{v} and \var{p} define initial guess. The values of \var{v} marked
158    If \var{useUzawa} is set to \True
159    the Uzawa\index{Uszwa} scheme is used. Otherwise the problem is solved in coupled form. In most cases
160    the Uzawa scheme is more efficient.
161    \var{max_iter} defines the maximum number of iteration steps.
162    If \var{verbose} is set to \True informations on the progress of of the solver are printed.
163    \end{methoddesc}
164
165
166    \begin{methoddesc}[StokesProblemCartesian]{setTolerance}{\optional{tolerance=1.e-8}}
167    sets the tolerance in an appropriate norm relative to the right hand side. The tolerance must be non-negative and less than 1.
168    \end{methoddesc}
169    \begin{methoddesc}[StokesProblemCartesian]{getTolerance}{}
170    returns the current relative tolerance.
171    \end{methoddesc}
172    \begin{methoddesc}[StokesProblemCartesian]{setAbsoluteTolerance}{\optional{tolerance=0.}}
173    sets the absolute tolerance for the error in the relevant norm. The tolerance must be non-negative. Typically the
174    absolute talerance is set to 0.
175    \end{methoddesc}
176    \begin{methoddesc}[StokesProblemCartesian]{getAbsoluteTolerance}{}
177    sreturns the current absolute tolerance.
178    \end{methoddesc}
179    \begin{methoddesc}[StokesProblemCartesian]{setSubToleranceReductionFactor}{\optional{reduction=None}}
180    sets the reduction factor for the tolerance used to solve the PDEs. A reduction factor
181    in the order of one will minimize compute time per iteration step but my slow down convergence or even lead to
182    divergency. On the other hand a very small value for the PDE tolerance could result in a wast of compute time.
183    If \var{reduction} is set to \var{None} the sub-tolerance is solved adaptively but
184    in cases a very small tolerance is set ($<10^{-6}$) it is recommended to set the
185    reduction factor by hand. This may require some experiments.
186    \end{methoddesc}
187    \begin{methoddesc}[StokesProblemCartesian]{getSubToleranceReductionFactor}{}
188    return the current reduction factor for the sub-problem tolerance.
189    \end{methoddesc}
190
191    \subsection{Example: Lit Driven Cavity}
192     The following script \file{lit\hackscore driven\hackscore cavity.py}
193    \index{scripts!\file{helmholtz.py}} which is available in the \ExampleDirectory
194    illustrates the usage of the \class{StokesProblemCartesian} class to solve
195    the lit driven cavity problem~\cite{LITDRIVENCAVITY}:
196    \begin{python}
197    from esys.escript import *
198    from esys.finley import Rectangle
199    from esys.escript.models import StokesProblemCartesian
200    NE=25
201    dom = Rectangle(NE,NE,order=2)
202    x = dom.getX()
203    sc=StokesProblemCartesian(dom)
205          (whereZero(x)*[0.,1.]+whereZero(x-1))*[1.,1]
207    v=Vector(0.,Solution(dom))
208    v+=whereZero(x-1.)
209    p=Scalar(0.,ReducedSolution(dom))
210    v,p=sc.solve(v,p, verbose=True)
211    saveVTK("u.xml",velocity=v,pressure=p)
212    \end{python}
213
214    \section{Darcy Flux}
215    We want to calculate the velocity $u$ and pressure $p$ on a domain $\Omega$ solving
216    the Darcy flux problem \index{Darcy flux}\index{Darcy flow}
217    \begin{equation}\label{DARCY PROBLEM}
218    \begin{array}{rcl}
219    u\hackscore{i} + \kappa\hackscore{ij} p\hackscore{,j} & = & g\hackscore{i} \\
220    u\hackscore{k,k} & = & f
221    \end{array}
222    \end{equation}
223    with the boundary conditions
224    \begin{equation}\label{DARCY BOUNDARY}
225    \begin{array}{rcl}
226    u\hackscore{i} \; n\hackscore{i}  = u^{N}\hackscore{i}  \; n\hackscore{i} & \mbox{ on } & \Gamma\hackscore{N} \\
227    p = p^{D} &  \mbox{ on } & \Gamma\hackscore{D} \\
228    \end{array}
229    \end{equation}
230    where $\Gamma\hackscore{N}$ and $\Gamma\hackscore{D}$ are a partition of the boundary of $\Omega$ with $\Gamma\hackscore{D}$ non empty, $n\hackscore{i}$ is the outer normal field of the boundary of $\Omega$, $u^{N}\hackscore{i}$ and $p^{D}$ are given functions on $\Omega$, $g\hackscore{i}$ and $f$ are given source terms and $\kappa\hackscore{ij}$ is the given permability. We assume that $\kappa\hackscore{ij}$ is symmetric (which is not really required) and positive definite, i.e there are positive constants $\alpha\hackscore{0}$ and $\alpha\hackscore{1}$ wich are independent from the location in $\Omega$ such that
231    \begin{equation}
232    \alpha\hackscore{0} \; x\hackscore{i} x\hackscore{i} \le \kappa\hackscore{ij} x\hackscore{i} x\hackscore{j} \le \alpha\hackscore{1} \; x\hackscore{i} x\hackscore{i}
233    \end{equation}
234    for all $x\hackscore{i}$.
235
example usage:
236
237  solution=StokesProblemCartesian(mesh) \\  \subsection{Solution Method \label{DARCY SOLVE}}
238  solution.setTolerance(TOL) \\  Without loss of generality we can assume that $u^{N}\hackscore{i} \; n\hackscore{i}=0$ and
239  solution.initialize(fixed\_u\_mask=b\_c,eta=eta,f=Y) \\  $p^{D}$. Otherewise one solves for $u-u^{N}$ and $p-p^{D}$ and sets
240  velocity,pressure=solution.solve(velocity,pressure,max\_iter=max\_iter,solver=solver) \\  \begin{equation}
241    \begin{array}{rcl}
242    g\hackscore{i} & \leftarrow & g\hackscore{i} - u^{N}\hackscore{i} -  \kappa\hackscore{ij} p^{D}\hackscore{,j }\\
243    f & \leftarrow & f - u^{N}\hackscore{k,k}
244    \end{array}
245    \end{equation}
246    We set
247    \begin{equation}
248    V = \{ q \in H^{1}(\Omega) : q=0 \mbox{ on } \Gamma\hackscore{D} \}
249    \end{equation}
250    and
251    \begin{equation}
252    W = \{ v \in (L^2(\Omega))^{d} : v\hackscore{k,k} \in L^2(\Omega) \mbox{ and } u\hackscore{i} \; n\hackscore{i} =0  \mbox{ on } \Gamma\hackscore{N} \}
253    \end{equation}
254    and define the operator $Q: V \rightarrow (L^2(\Omega))^{d}$ defined by
255    \begin{equation}
256    (Qp)\hackscore{i} = \kappa\hackscore{ij} p\hackscore{,j}
257    \end{equation}
258    and the operator $D: W \rightarrow L^2(\Omega)$ defined by
259    \begin{equation}
260    Dv = v\hackscore{k,k}
261    \end{equation}
262    In operator notation the Darcy problem~\ref{DARCY PROBLEM} is written in the form
263    \begin{equation}
264    \begin{array}{rcl}
265    u + Qp & = & g \\
266    Du & = & f
267    \end{array}
268    \end{equation}
269    We solve this equation by minimising the functional
270    \begin{equation}
271    J(u,p):=\|u + Qp - g\|^2\hackscore{0} + \|Du-f\|\hackscore{0}^2
272    \end{equation}
273    over $W \times V$ where $\|.\|\hackscore{0}$ denotes the norm in $L^2(\Omega)$. A simple calculation shows that
274    one has to solve
275    \begin{equation}
276    ( v + Qq , u + Qp - g) + (Dv,Du-f) =0
277    \end{equation}
278    for all $v\in W$ and $q \in V$.which translates back into operator notation
279    \begin{equation}
280    \begin{array}{rcl}
281    (I+D^*D)u + Qp & = & D^*f + g \\
282    Q^*u  + Q^*Q p & = & Q^* g \\
283    \end{array}
284    \end{equation}
285    where $D^*$ and $Q^*$ denote the adjoint operators.
286    In~\cite{XXX} it has been shown that this problem is continuous and coercive in $W \times V$ and therefore has a unique solution. Also standart FEM methods can be used for discretization. It is also possible
287    to solve the problem is coupled form, however this approach leads in some cases to a very ill-conditioned stiffness matrix in particular in the case of a very small or large permability ($\alpha\hackscore{1} \ll 1$ or $\alpha\hackscore{0} \gg 1$)
288
289  % \subsection{Benchmark Problem}  The approach we are taking is to eliminate the velocity $u$ from the problem. Assuming that $p$ is known we have
290  %  \begin{equation}
291  % Convection problem  v= (I+D^*D)^{-1} (D^*f + g - Qp)
292    \end{equation}
293    (notice that $(I+D^*D)$ is coercive in $W$) which is inserted into the second equation
294    \begin{equation}
295    Q^* (I+D^*D)^{-1} (D^*f + g - Qp) + Q^* Q p = Q^* g
296    \end{equation}
297    which is
298    \begin{equation}
299    Q^* ( I - (I+D^*D)^{-1} ) Q p = Q^* ( g -(I+D^*D)^{-1} (D^*f + g) )
300    \end{equation}
301    We use the PCG method to solve this. The residual $r$ ($\in V^*$) is given as
302    \begin{equation}
303    \begin{array}{rcl}
304    r & = & Q^* ( g -(I+D^*D)^{-1} (D^*f + g) - Qp + (I+D^*D)^{-1}Q p \\
305    & =&  Q^* \left( (g-Qp) - (I+D^*D)^{-1} (D^*f + g - Qp) \right) \\
306    & =&  Q^* \left( (g-Qp) - v \right)
307    \end{array}
308    \end{equation}
309    So in a partical implementation we use the pair $(g-Qp,v)$ to represent the residual. This will save the
310    reconstruction of the velocity $v$. In this notation the right hand side is given as
311    $(g,(I+D^*D)^{-1} (D^*f + g))$. The evaluation of the iteration operator for a given $p$ is then
312    returning $(Qp,w)$ where $w$ is the solution of
313    \begin{equation}\label{UPDATE W}
314    (I+D^*D)w = Qp
315    \end{equation}
316    We use $Q^*Q$ as a a preconditioner for the iteration operator $Q^* ( I - (I+D^*D)^{-1} ) Q$.
317
318    \subsection{Functions}
319    \begin{classdesc}{DarcyFlow}{domain}
320    opens the Darcy flux problem\index{Darcy flux} on the \Domain domain.
321    \end{classdesc}
322
323    \begin{methoddesc}[DarcyFlow]{initialize}{\optional{f=Data(), \optional{fixed_u_mask=Data(), \optional{eta=1, \optional{surface_stress=Data(), \optional{stress=Data()}}}}}}
324    assigns values to the model parameters. In any call all values must be set.
325    \var{f} defines the external force $f$, \var{eta} the viscosity $\eta$,
326    \var{surface_stress} the surface stress $s$ and \var{stress} the initial stress $\sigma$.
327    The locations and compontents where the velocity is fixed are set by
328    the values of \var{fixed_u_mask}. The method will try to cast the given values to appropriate
329    \Data class objects.
330    \end{methoddesc}
331
332  \section{Temperature Cartesian}
333    \subsection{Example: Gravity Flow}
334
335    %================================================
337
338  \begin{equation}  \begin{equation}
339  \rho c\hackscore{p} \left (\frac{\partial T}{\partial t} + \vec{v} \cdot \nabla T \right ) = k \nabla^{2}T  \rho c\hackscore{p} \left (\frac{\partial T}{\partial t} + \vec{v} \cdot \nabla T \right ) = k \nabla^{2}T
# Line 130  where $\vec{v}$ is the velocity vector, Line 350  where $\vec{v}$ is the velocity vector,
350  \end{classdesc}  \end{classdesc}
351
352  \subsection{Benchmark Problem}  \subsection{Benchmark Problem}
353    %===============================================================================================================
354
355    %=========================================================
356    \input{levelsetmodel}
357    % \section{Level Set Method}
358
359  \section{Level Set Method}  %\subsection{Description}
360
361  \subsection{Description}  %\subsection{Method}

\subsection{Method}
362
364
365  \begin{classdesc}{LevelSet}{mesh, func\_new, reinit\_max, reinit\_each, tolerance, smooth}  %\begin{classdesc}{LevelSet}{mesh, func\_new, reinit\_max, reinit\_each, tolerance, smooth}
366  \end{classdesc}  %\end{classdesc}
367
368  %example usage:  %example usage:
369
370  %levelset = LevelSet(mesh, func\_new, reinit\_max, reinit\_each, tolerance, smooth)  %levelset = LevelSet(mesh, func\_new, reinit\_max, reinit\_each, tolerance, smooth)
371
372  \begin{methoddesc}[LevelSet]{update\_parameter}{parameter}  %\begin{methoddesc}[LevelSet]{update\_parameter}{parameter}
373  Update the parameter.  %Update the parameter.
374  \end{methoddesc}  %\end{methoddesc}
375
376  \begin{methoddesc}[LevelSet]{update\_phi}{paramter}{velocity}{dt}{t\_step}  %\begin{methoddesc}[LevelSet]{update\_phi}{paramter}{velocity}{dt}{t\_step}
377  Update level set function; advection and reinitialization  %Update level set function; advection and reinitialization
378  \end{methoddesc}  %\end{methoddesc}
379
380  \subsection{Benchmark Problem}  %\subsection{Benchmark Problem}
381
382  Rayleigh-Taylor instability problem  %Rayleigh-Taylor instability problem
383
384
385  % \section{Drucker Prager Model}  % \section{Drucker Prager Model}
# Line 191  for a given power law coefficients $n^{q Line 413 for a given power law coefficients$n^{q
413  Notice that $n^{q}=1$ gives a constant viscosity.  Notice that $n^{q}=1$ gives a constant viscosity.
414  After inserting equation~\ref{IKM-EQU-5} into equation \ref{IKM-EQU-4} one gets:  After inserting equation~\ref{IKM-EQU-5} into equation \ref{IKM-EQU-4} one gets:
415  \begin{equation}\label{IKM-EQU-6}  \begin{equation}\label{IKM-EQU-6}
416  D\hackscore{ij}'^{vp}=\frac{1}{2 \eta^{vp}} \sigma'\hackscore{ij} \mbox{ with } \frac{1}{\eta^{vp}} \sum\hackscore{q} \frac{1}{\eta^{q}} \;.  D\hackscore{ij}'^{vp}=\frac{1}{2 \eta^{vp}} \sigma'\hackscore{ij} \mbox{ with } \frac{1}{\eta^{vp}} = \sum\hackscore{q} \frac{1}{\eta^{q}} \;.
417  \end{equation}  \end{equation}
418  With  With
419  \begin{equation}\label{IKM-EQU-8}  \begin{equation}\label{IKM-EQU-8}
# Line 239  D\hackscore{ij}'^{el}=\frac{1}{2 \mu dt Line 461  D\hackscore{ij}'^{el}=\frac{1}{2 \mu dt
461  where $\sigma\hackscore{ij}^{'-}$ is the deviatoric stress at the precious time step.  where $\sigma\hackscore{ij}^{'-}$ is the deviatoric stress at the precious time step.
462  Now we can combine equations~\ref{IKM-EQU-2}, \ref{IKM-EQU-3b} and~\ref{IKM-EQU-6b} to get  Now we can combine equations~\ref{IKM-EQU-2}, \ref{IKM-EQU-3b} and~\ref{IKM-EQU-6b} to get
463  \begin{equation}\label{IKM-EQU-10}  \begin{equation}\label{IKM-EQU-10}
464  \sigma\hackscore{ij}' =  2 \eta\hackscore{eff} D\hackscore{ij}' +  \sigma\hackscore{ij}' =  2 \eta\hackscore{eff}  \left( D\hackscore{ij}' +
465  \frac{\eta\hackscore{eff}}{\mu \; dt}  \frac{1}{  2 \mu \; dt} \sigma\hackscore{ij}^{'-}\right)  \mbox{ with }
\sigma\hackscore{ij}^{'-} \mbox{ with }
466  \frac{1}{\eta\hackscore{eff}}=\frac{1}{\mu \; dt}+\frac{1}{\eta^{vp}}  \frac{1}{\eta\hackscore{eff}}=\frac{1}{\mu \; dt}+\frac{1}{\eta^{vp}}
467  \end{equation}  \end{equation}
468  Notice that $\eta\hackscore{eff}$ is a function of stress.  Notice that $\eta\hackscore{eff}$ is a function of diatoric stress $\sigma\hackscore{ij}'$.
469  After inserting~\ref{IKM-EQU-10} into~\ref{IKM-EQU-1} we get  After inserting~\ref{IKM-EQU-10} into~\ref{IKM-EQU-1} we get
470  \begin{equation}\label{IKM-EQU-1ib}  \begin{equation}\label{IKM-EQU-1ib}
471  -\left(\eta\hackscore{eff} (v\hackscore{i,j}+ v\hackscore{i,j})\right)\hackscore{,j}+p\hackscore{,i}=F\hackscore{i}+  -\left(\eta\hackscore{eff} (v\hackscore{i,j}+ v\hackscore{i,j})
472    \right)\hackscore{,j}+p\hackscore{,i}=F\hackscore{i}+
473  \frac{\eta\hackscore{eff}}{\mu dt } \sigma\hackscore{ij,j}^{'-}  \frac{\eta\hackscore{eff}}{\mu dt } \sigma\hackscore{ij,j}^{'-}
474  \end{equation}  \end{equation}
475  Together with the incomressibilty condition~\ref{IKM-EQU-2} we need to solve a problem with a form almost identical  Together with the incomressibilty condition~\ref{IKM-EQU-2} we need to solve a problem with a form almost identical
476  to the Stokes problem discussed in section~\ref{STOKES SOLVE} but with the difference that $\eta\hackscore{eff}$ is depending on the solution. Analog to the iteration scheme~\ref{SADDLEPOINT iteration 2} we can run  to the Stokes problem discussed in section~\ref{STOKES SOLVE} but with the difference that $\eta\hackscore{eff}$ is depending on the solution. Analog to the iteration scheme~\ref{SADDLEPOINT iteration 2} we can run
477  \begin{equation}  \begin{equation}
478  \begin{array}{rcl}  \begin{array}{rcl}
479  -\left(\eta\hackscore{eff}(dv\hackscore{i,j}+ dv\hackscore{i,j})\right)\hackscore{,j} & = & F\hackscore{i}+ \sigma\hackscore{ij,j}' \\  -\left(\eta\hackscore{eff}(dv\hackscore{i,j}+ dv\hackscore{i,j}
480  \frac{1}{\eta\hackscore{eff}} dp & = & - v\hackscore{i,i}^+ \\  )\right)\hackscore{,j} & = & F\hackscore{i}+ \sigma\hackscore{ij,j}'-p\hackscore{,i} \\
481  d\sigma\hackscore{ij}' & = & 2 \eta\hackscore{eff} D\hackscore{ij}^{+'} + \frac{\eta\hackscore{eff}}{\mu \; dt} \sigma\hackscore{ij}' -  \sigma\hackscore{ij}\\  \frac{1}{\eta\hackscore{eff}} dp & = & - v\hackscore{i,i}^+
482  \end{array}  \end{array}
483  \label{IKM iteration 2}  \label{IKM iteration 2}
484  \end{equation}  \end{equation}
485  where $v^+=v+dv$. As this problem is non-linear the Jacobi-free Newton-GMRES method is used with the norm  where $v^+=v+dv$. As this problem is non-linear the Jacobi-free Newton-GMRES method is used with the norm
486  \begin{equation}  \begin{equation}
487  \|(\sigma, p)\|^2= \int\hackscore{\Omega} \sigma\hackscore{i,j}^2 + p^2 \; dx  \|(v, p)\|^2= \int\hackscore{\Omega} v\hackscore{i,j}^2 + \frac{1}{\bar{\eta}^2\hackscore{eff}} p^2 \; dx
488  \label{IKM iteration 3}  \label{IKM iteration 3}
489  \end{equation}  \end{equation}
490    where  $\bar{\eta}\hackscore{eff}$ is the caracteristic viscosity, for instance:
491    \begin{equation}
492    \frac{1}{\bar{\eta}\hackscore{eff}} = \frac{1}{\tau^{-}}+\sum\hackscore{q}  \frac{1}{\eta^{q}\hackscore{N}}
493    \label{IKM iteration 4}
494    \end{equation}
495    In oder to perform step~\ref{IKM iteration 2} we need to calculate the $\eta\hackscore{eff}$ as well as $\sigma\hackscore{ij}'$ while via $\tau$ the first is a function of the latter. The priority is the
496    calculation of $\eta\hackscore{eff}$ with the Newton-Raphson scheme. This value can then be used to calculate
497    $\sigma\hackscore{ij}'$ via~\ref{IKM-EQU-10}. We need to solve
498    \begin{equation}
499    \tau = \eta\hackscore{eff} \cdot \epsilon \mbox{ with }
500    \epsilon = \sqrt{ 2 \left( D\hackscore{ij}' +
501    \frac{1}{  2 \mu \; dt} \sigma\hackscore{ij}^{'-}\right)^2}
502    \label{IKM iteration 5}
503    \end{equation}
504    The Newton scheme takes the form
505    \begin{equation}
506    \tau\hackscore{n+1} = \min(\tau\hackscore{n} - \frac{\tau\hackscore{n} - \eta\hackscore{eff}  \cdot \epsilon}{1 - \eta\hackscore{eff}'  \cdot  \epsilon}, \tau\hackscore{Y} + \beta \; p)
507    = \min(\frac{\eta\hackscore{eff} - \tau\hackscore{n}  \eta\hackscore{eff}'}
508    {1 - \eta\hackscore{eff}'  \cdot  \epsilon}, \frac{\tau\hackscore{Y} + \beta \; p}{\epsilon}) \epsilon
509    \label{IKM iteration 6}
510    \end{equation}
511    where $\eta\hackscore{eff}'$ denotes the derivative of $\eta\hackscore{eff}$ with respect of $\tau$. The second term in $\min$ is droped of $\tau\hackscore{Y} + \beta \; p<0$ or $\epsilon=0$. In fact we have
512    \begin{equation}
513    \eta\hackscore{eff}' = - \eta\hackscore{eff}^2 \left(\frac{1}{\eta\hackscore{eff}}\right)'
514    \mbox{ with }
515    \left(\frac{1}{\eta\hackscore{eff}}\right)' = \sum\hackscore{q} \left(\frac{1}{\eta^{q}} \right)'
516    \label{IKM iteration 7}
517    \end{equation}
518    \begin{equation}\label{IKM-EQU-5XX}
519    \left(\frac{1}{\eta^{q}} \right)'
520    = \frac{1-\frac{1}{n^{q}}}{\eta^{q}\hackscore{N}} \frac{\tau^{-\frac{1}{n^{q}}}}{(\tau\hackscore{t}^q)^{1-\frac{1}{n^{q}}}}
521    = \frac{1-\frac{1}{n^{q}}}{ \tau \eta^{q}}
522    \end{equation}
523    Notice that allways $\eta\hackscore{eff}'\le 0$ which makes the denomionator in~\ref{IKM iteration 6}
524    positive.
525
526
527

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