/[escript]/trunk/doc/user/Models.tex
ViewVC logotype

Annotation of /trunk/doc/user/Models.tex

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2208 - (hide annotations)
Mon Jan 12 06:37:07 2009 UTC (11 years, 1 month ago) by gross
File MIME type: application/x-tex
File size: 27299 byte(s)
more work on the dary solver 


1 ksteube 1811
2     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 lgraham 1702 %
4 ksteube 1811 % Copyright (c) 2003-2008 by University of Queensland
5     % Earth Systems Science Computational Center (ESSCC)
6     % http://www.uq.edu.au/esscc
7 lgraham 1702 %
8 ksteube 1811 % Primary Business: Queensland, Australia
9     % Licensed under the Open Software License version 3.0
10     % http://www.opensource.org/licenses/osl-3.0.php
11 lgraham 1702 %
12 ksteube 1811 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13 lgraham 1702
14 ksteube 1811
15 lgraham 1702 \chapter{Models}
16 lgraham 2128 \label{MODELS CHAPTER}
17 lgraham 1702
18     The following sections give a breif overview of the model classes and their corresponding methods.
19    
20 gross 1878 \section{Stokes Problem}
21 gross 2100 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}
22 gross 1878 \begin{equation}\label{Stokes 1}
23 gross 2100 -\left(\eta(v\hackscore{i,j}+ v\hackscore{i,j})\right)\hackscore{,j}+p\hackscore{,i}=f\hackscore{i}-\sigma\hackscore{ij,j}
24 gross 1878 \end{equation}
25 gross 2100 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 gross 1878 \begin{equation}\label{Stokes 2}
27     -v\hackscore{i,i}=0
28     \end{equation}
29     Natural boundary conditions are taken in the form
30     \begin{equation}\label{Stokes Boundary}
31 gross 2100 \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 gross 1878 \end{equation}
33 gross 2100 which can be overwritten by constraints of the form
34 gross 1878 \begin{equation}\label{Stokes Boundary0}
35 gross 2100 v\hackscore{i}(x)=v^D\hackscore{i}(x)
36 gross 1878 \end{equation}
37 gross 2100 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 lgraham 1702
40 gross 1878 \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
42 gross 2100 \index{saddle point problem}
43 lgraham 1702 \begin{equation}
44     \left[ \begin{array}{cc}
45 gross 1878 A & B^{*} \\
46     B & 0 \\
47 lgraham 1702 \end{array} \right]
48     \left[ \begin{array}{c}
49 gross 2100 v \\
50 lgraham 1702 p \\
51     \end{array} \right]
52     =\left[ \begin{array}{c}
53 gross 2100 G \\
54 gross 1878 0 \\
55 lgraham 1702 \end{array} \right]
56     \label{SADDLEPOINT}
57     \end{equation}
58 gross 2100 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 use iterative techniques to solve this problem. To make sure that the incomressibilty condition holds
60     with sufficient accuracy we check for
61 gross 1878 \begin{equation}
62 gross 2100 \|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}
108 gross 1878 \left[ \begin{array}{cc}
109     A^{-1} & 0 \\
110     S^{-1} B A^{-1} & -S^{-1} \\
111     \end{array} \right]
112     \label{SADDLEPOINT PRECODITIONER}
113     \end{equation}
114 gross 2100 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
115 gross 1878 \begin{equation}
116     \begin{array}{rcl}
117 gross 2100 A w & = & Av+B^{*}p \\
118     \hat{S} q & = & B(w-v) \\
119 gross 1878 \end{array}
120 gross 2100 \label{COUPLES SADDLEPOINT iteration}
121 gross 1878 \end{equation}
122 gross 2100 We use the inner product induced by the norm
123 gross 1878 \begin{equation}
124 gross 2100 \|(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}
129 gross 1878 \begin{array}{rcl}
130 gross 2100 -\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} q & = & - (w-v)\hackscore{i,i} \\
132 gross 1878 \end{array}
133     \label{SADDLEPOINT iteration 2}
134     \end{equation}
135 lgraham 1702
136    
137 gross 2100 \subsection{Functions}
138 gross 1878
139 gross 2100 \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 gross 1878
144 gross 2100 \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 gross 1878
153 gross 2100 \begin{methoddesc}[StokesProblemCartesian]{solve}{v,p,
154     \optional{max_iter=20, \optional{verbose=False, \optional{useUzawa=True}}}}
155     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
157     by \var{fixed_u_mask} remain unchanged.
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 lgraham 1702
165    
166 gross 2100 \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 lgraham 1702
191 gross 2100 \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 jfenwick 2104 the lit driven cavity problem~\cite{LITDRIVENCAVITY}:
196 gross 2100 \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)
204     mask= (whereZero(x[0])*[1.,0]+whereZero(x[0]-1))*[1.,0] + \
205     (whereZero(x[1])*[0.,1.]+whereZero(x[1]-1))*[1.,1]
206     sc.initialize(eta=.1, fixed_u_mask= mask)
207     v=Vector(0.,Solution(dom))
208     v[0]+=whereZero(x[1]-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 lgraham 1702
214 gross 2100 \section{Darcy Flux}
215 gross 2108 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 gross 2100 \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 lgraham 1702
236    
237 gross 2100 \subsection{Solution Method \label{DARCY SOLVE}}
238 gross 2156 In practical applications it is an advantage to calculate the pressure $p$ as a correction of a 'static' pressure $p^{ref}$ which is the solution of
239 lgraham 1702 \begin{equation}
240 gross 2156 -(\kappa\hackscore{ki}\kappa\hackscore{kj} p\hackscore{,j}^{ref})\hackscore{,i} = - (\kappa\hackscore{ki} (g\hackscore{k}- u^{N}\hackscore{k}))\hackscore{,i}
241     \mbox{ with }
242     p^{ref} = p^{D} \mbox{ on } \Gamma\hackscore{D}
243     \end{equation}
244     With setting $u \leftarrow u-u^{N}$ and $p \leftarrow p-p^{ref}$ and
245     \begin{equation}
246 gross 2100 \begin{array}{rcl}
247 gross 2156 g\hackscore{i} & \leftarrow & g\hackscore{i} - u^{N}\hackscore{i} - \kappa\hackscore{ij} p^{ref}\hackscore{,j }\\
248 gross 2100 f & \leftarrow & f - u^{N}\hackscore{k,k}
249     \end{array}
250     \end{equation}
251 gross 2156 we can assume that $u^{N}\hackscore{i} \; n\hackscore{i}=0$ and
252 gross 2208 $p^{D}=0$.
253 gross 2100 We set
254     \begin{equation}
255     V = \{ q \in H^{1}(\Omega) : q=0 \mbox{ on } \Gamma\hackscore{D} \}
256     \end{equation}
257     and
258     \begin{equation}
259     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} \}
260     \end{equation}
261     and define the operator $Q: V \rightarrow (L^2(\Omega))^{d}$ defined by
262     \begin{equation}
263     (Qp)\hackscore{i} = \kappa\hackscore{ij} p\hackscore{,j}
264     \end{equation}
265     and the operator $D: W \rightarrow L^2(\Omega)$ defined by
266     \begin{equation}
267     Dv = v\hackscore{k,k}
268     \end{equation}
269     In operator notation the Darcy problem~\ref{DARCY PROBLEM} is written in the form
270     \begin{equation}
271     \begin{array}{rcl}
272     u + Qp & = & g \\
273     Du & = & f
274     \end{array}
275     \end{equation}
276     We solve this equation by minimising the functional
277     \begin{equation}
278     J(u,p):=\|u + Qp - g\|^2\hackscore{0} + \|Du-f\|\hackscore{0}^2
279     \end{equation}
280     over $W \times V$ where $\|.\|\hackscore{0}$ denotes the norm in $L^2(\Omega)$. A simple calculation shows that
281     one has to solve
282     \begin{equation}
283     ( v + Qq , u + Qp - g) + (Dv,Du-f) =0
284     \end{equation}
285     for all $v\in W$ and $q \in V$.which translates back into operator notation
286     \begin{equation}
287     \begin{array}{rcl}
288     (I+D^*D)u + Qp & = & D^*f + g \\
289 gross 2208 Q^*u + Q^*Q p & = & Q^*g \\
290 gross 2100 \end{array}
291     \end{equation}
292 gross 2208 where $D^*$ and $Q^*$ denote the adjoint operators.
293 gross 2100 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
294     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$)
295    
296     The approach we are taking is to eliminate the velocity $u$ from the problem. Assuming that $p$ is known we have
297     \begin{equation}
298     v= (I+D^*D)^{-1} (D^*f + g - Qp)
299     \end{equation}
300     (notice that $(I+D^*D)$ is coercive in $W$) which is inserted into the second equation
301     \begin{equation}
302 gross 2208 Q^* (I+D^*D)^{-1} (D^*f + g - Qp) + Q^* Q p = Q^*g
303 gross 2100 \end{equation}
304     which is
305     \begin{equation}
306 gross 2208 Q^* ( I - (I+D^*D)^{-1} ) Q p = Q^* (g-(I+D^*D)^{-1} (D^*f + g) )
307 gross 2100 \end{equation}
308 gross 2208 We use the PCG \index{linear solver!PCG}\index{PCG} method to solve this. The residual $r$ ($\in V^*$) is given as
309 gross 2100 \begin{equation}
310     \begin{array}{rcl}
311 gross 2208 r & = & Q^* \left( g -(I+D^*D)^{-1} (D^*f + g) - Qp + (I+D^*D)^{-1}Q p \right)\\
312 gross 2156 & =& Q^* \left( - Qp - (I+D^*D)^{-1} (D^*f + g - Qp) \right) \\
313 gross 2208 & =& Q^* \left( g - Qp - v \right)
314 gross 2100 \end{array}
315     \end{equation}
316 gross 2156 So in a partical implementation we use the pair $(Qp,v)$ to represent the residual. This will save the
317 gross 2100 reconstruction of the velocity $v$. In this notation the right hand side is given as
318 gross 2156 $(0,(I+D^*D)^{-1} (D^*f + g))$. The evaluation of the iteration operator for a given $p$ is then
319 gross 2100 returning $(Qp,w)$ where $w$ is the solution of
320     \begin{equation}\label{UPDATE W}
321     (I+D^*D)w = Qp
322     \end{equation}
323     We use $Q^*Q$ as a a preconditioner for the iteration operator $Q^* ( I - (I+D^*D)^{-1} ) Q$.
324    
325 gross 2208 The iteration PCG \index{linear solver!PCG}\index{PCG} is terminated if
326     \begin{equation}\label{DARCY STOP}
327     \int r \cdot (Q^*Q)^{-1} r \; dx \le \mbox{ATOL}^2
328     \end{equation}
329     where ATOL is a given absolute tolerance.
330     The initial residual $r\hackscore{0}$ is
331     \begin{equation}\label{DARCY STOP 2}
332     r\hackscore{0}=Q^* \left( g - v\hackscore{ref} \right) \mbox{ with } v\hackscore{ref} = (I+D^*D)^{-1} (D^*f + g)
333     \end{equation}
334     so the
335     \begin{equation}\label{DARCY NORM 0}
336     \int r\hackscore0 \cdot (Q^*Q)^{-1} r\hackscore0 \; dx = \int \left( g - v\hackscore{ref} \right) \cdot Q p\hackscore{ref} \; dx \mbox{ with }p\hackscore{ref} = (Q^*Q)^{-1} Q^* \left( g - v\hackscore{ref} \right)
337     \end{equation}
338     So we set
339     \begin{equation}\label{DARCY NORM 1}
340     ATOL = atol + rtol \cdot \max(|g - v\hackscore{ref}|\hackscore{0}, |Q p\hackscore{ref} |\hackscore{0} )
341     \end{equation}
342     where atol and rtol a given absolute and relative tolerances, respectively. The reference flux $v\hackscore{ref}$
343     and reference pressure $p\hackscore{ref}$ may be calcualated from their definition which would require to solve to
344     PDEs but in a practical application estimates can be used for instance solutions from previous time steps or for simplified scenarious (e.g. constant permability).
345    
346 gross 2100 \subsection{Functions}
347 gross 2108 \begin{classdesc}{DarcyFlow}{domain}
348     opens the Darcy flux problem\index{Darcy flux} on the \Domain domain.
349     \end{classdesc}
350 gross 2208 \begin{methoddesc}[DarcyFlow]{setValue}{\optional{f=None, \optional{g=None, \optional{location_of_fixed_pressure=None, \optional{location_of_fixed_flux=None, \optional{permeability=None}}}}}}
351     assigns values to the model parameters. Values can be assigned using various calls - in particular
352     in a time dependend problem only values that change over time needs to be reset. The permability can be defined as scalar (isotropic), a vector (orthotropic) or a matrix (anisotropic).
353     \var{f} and \var{g} are the corresponding parameters in~\ref{DARCY PROBLEM}.
354     The locations and compontents where the flux is prescribed are set by positive values in
355     \var{location_of_fixed_flux}.
356     The locations where the pressure is prescribed are set by
357     by positive values of \var{location_of_fixed_pressure}.
358     The values of the pressure and flux are defined by the initial guess.
359     Notice that at any point on the boundary of the domain the pressure or the normal component of
360     the flux must be defined. There must be at least one point where the pressure is prescribed.
361     The method will try to cast the given values to appropriate
362 gross 2108 \Data class objects.
363     \end{methoddesc}
364    
365 gross 2208 \begin{methoddesc}[DarcyFlow]{setTolerance}{\optional{atol=0,\optional{rtol=1e-8,\optional{p_ref=None,\optional{v_ref=None}}}}}
366     sets the absolute tolerance ATOL according to~\ref{DARCY NORM 1}. If \var{p_ref} is not present $0$ is used.
367     If \var{v_ref} is not present $0$ is used. If the final result ATOL is not positive an exception is thrown.
368     \end{methoddesc}
369 gross 2108
370 gross 2208
371    
372     \begin{methoddesc}[DarcyFlow]{solve}{u0,p0, \optional{max_iter=100, \optional{verbose=False \optional{sub_rtol=1.e-8}}}}
373     solves the problem. and returns approximations for the flux $v$ and the pressure $p$.
374     \var{u0} and \var{p0} define initial guess for flux and pressure. Values marked
375     by positive values \var{location_of_fixed_flux} and \var{location_of_fixed_pressure}, respectively, are kept unchanged.
376     \var{sub_rtol} defines the tolerance used to solve the involved PDEs. \var{sub_rtol} needs to be choosen sufficiently small to ensure convergence but users need to keep in mind that a very small value for \var{sub_rtol} will result in a long compute time. Typically $\var{sub_rtol}=\var{rtol}^2$ is a good choice if $\var{rtol}$ is not choosen too small.
377     \end{methoddesc}
378    
379    
380 gross 2100 \subsection{Example: Gravity Flow}
381 gross 2208 later
382 gross 2100
383     %================================================
384 gross 2208 % \section{Temperature Advection Diffusion\label{TEMP ADV DIFF}}
385 gross 2100
386 gross 2208 %\begin{equation}
387     % \rho c\hackscore{p} \left (\frac{\partial T}{\partial t} + \vec{v} \cdot \nabla T \right ) = k \nabla^{2}T
388     % \label{HEAT EQUATION}
389     % \end{equation}
390 lgraham 1702
391 gross 2208 % where $\vec{v}$ is the velocity vector, $T$ is the temperature, $\rho$ is the density, $\eta$ is the viscosity, % % $c\hackscore{p}$ is the specific heat at constant pressure and $k$ is the thermal conductivity.
392 lgraham 1702
393 gross 2208 % \subsection{Description}
394 lgraham 1702
395 gross 2208 % \subsection{Method}
396     %
397     % \begin{classdesc}{TemperatureCartesian}{dom,theta=THETA,useSUPG=SUPG}
398     % \end{classdesc}
399 lgraham 1702
400 gross 2208 % \subsection{Benchmark Problem}
401 gross 2100 %===============================================================================================================
402 lgraham 1702
403 gross 2100 %=========================================================
404 lgraham 2138 \input{levelsetmodel}
405 lgraham 1702
406 gross 1859 % \section{Drucker Prager Model}
407 lgraham 1702
408 gross 1841 \section{Isotropic Kelvin Material \label{IKM}}
409 gross 1859 As proposed by Kelvin~\ref{KELVN} material strain $D\hackscore{ij}=v\hackscore{i,j}+v\hackscore{j,i}$ can be decomposed into
410     an elastic part $D\hackscore{ij}^{el}$ and visco-plastic part $D\hackscore{ij}^{vp}$:
411 gross 1841 \begin{equation}\label{IKM-EQU-2}
412 gross 1859 D\hackscore{ij}=D\hackscore{ij}^{el}+D\hackscore{ij}^{vp}
413 gross 1841 \end{equation}
414 gross 1859 with the elastic strain given as
415 gross 1841 \begin{equation}\label{IKM-EQU-3}
416 gross 1878 D\hackscore{ij}'^{el}=\frac{1}{2 \mu} \dot{\sigma}\hackscore{ij}'
417 gross 1841 \end{equation}
418 gross 1859 where $\sigma'\hackscore{ij}$ is the deviatoric stress (Notice that $\sigma'\hackscore{ii}=0$).
419     If the material is composed by materials $q$ the visco-plastic strain can be decomposed as
420 gross 1841 \begin{equation}\label{IKM-EQU-4}
421 gross 1859 D\hackscore{ij}'^{vp}=\sum\hackscore{q} D\hackscore{ij}'^{q}
422 gross 1841 \end{equation}
423 gross 1859 where $D\hackscore{ij}^{q}$ is the strain in material $q$ given as
424 gross 1841 \begin{equation}\label{IKM-EQU-5}
425 gross 1859 D\hackscore{ij}'^{q}=\frac{1}{2 \eta^{q}} \sigma'\hackscore{ij}
426 gross 1841 \end{equation}
427 gross 1859 where $\eta^{q}$ is the viscosity of material $q$. We assume the following
428     betwee the the strain in material $q$
429     \begin{equation}\label{IKM-EQU-5b}
430     \eta^{q}=\eta^{q}\hackscore{N} \left(\frac{\tau}{\tau\hackscore{t}^q}\right)^{\frac{1}{n^{q}}-1}
431     \mbox{ with } \tau=\sqrt{\frac{1}{2}\sigma'\hackscore{ij} \sigma'\hackscore{ij}}
432     \end{equation}
433     for a given power law coefficients $n^{q}$ and transition stresses $\tau\hackscore{t}^q$, see~\ref{POERLAW}.
434     Notice that $n^{q}=1$ gives a constant viscosity.
435 gross 1841 After inserting equation~\ref{IKM-EQU-5} into equation \ref{IKM-EQU-4} one gets:
436 gross 1859 \begin{equation}\label{IKM-EQU-6}
437 gross 2100 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}} \;.
438 gross 1841 \end{equation}
439 gross 1859 With
440     \begin{equation}\label{IKM-EQU-8}
441     \dot{\gamma}=\sqrt{2 D\hackscore{ij} D\hackscore{ij}}
442     \end{equation}
443     one gets
444     \begin{equation}\label{IKM-EQU-8b}
445     \tau = \eta^{vp} \dot{\gamma}^{vp} \;.
446     \end{equation}
447     With the Drucker-Prager cohesion factor $\tau\hackscore{Y}$, Drucker-Prager friction $\beta$ and total pressure $p$ we want to achieve
448     \begin{equation}\label{IKM-EQU-8c}
449     \tau \le \tau\hackscore{Y} + \beta \; p
450     \end{equation}
451     which leads to the condition
452     \begin{equation}\label{IKM-EQU-8d}
453     \eta^{vp} \le \frac{\tau\hackscore{Y} + \beta \; p}{ \dot{\gamma}^{vp}} \; .
454     \end{equation}
455     Therefore we modify the definition of $\eta^{vp}$ to the form
456     \begin{equation}\label{IKM-EQU-6b}
457     \frac{1}{\eta^{vp}}=\max(\sum\hackscore{q} \frac{1}{\eta^{q}}, \frac{\dot{\gamma}^{vp}} {\tau\hackscore{Y} + \beta \; p})
458     \end{equation}
459     The deviatoric stress needs to fullfill the equilibrion equation
460 gross 1841 \begin{equation}\label{IKM-EQU-1}
461 gross 1859 -\sigma'\hackscore{ij,j}+p\hackscore{,i}=F\hackscore{i}
462 gross 1841 \end{equation}
463 gross 1859 where $F\hackscore{j}$ is a given external fource. We assume an incompressible media:
464 gross 1841 \begin{equation}\label{IKM-EQU-2}
465 gross 1859 -v\hackscore{i,i}=0
466 gross 1841 \end{equation}
467 gross 1878 Natural boundary conditions are taken in the form
468     \begin{equation}\label{IKM-EQU-Boundary}
469     \sigma'\hackscore{ij}n\hackscore{j}-n\hackscore{i}p=f
470     \end{equation}
471     which can be overwritten by a constraint
472     \begin{equation}\label{IKM-EQU-Boundary0}
473     v\hackscore{i}(x)=0
474     \end{equation}
475     where the index $i$ may depend on the location $x$ on the bondary.
476    
477     \subsection{Solution Method \label{IKM-SOLVE}}
478     By using a first order finite difference approximation wit step size $dt>0$~\ref{IKM-EQU-3} get the form
479     \begin{equation}\label{IKM-EQU-3b}
480     D\hackscore{ij}'^{el}=\frac{1}{2 \mu dt } \left( \sigma\hackscore{ij}' - \sigma\hackscore{ij}^{'-} \right)
481     \end{equation}
482     where $\sigma\hackscore{ij}^{'-}$ is the deviatoric stress at the precious time step.
483     Now we can combine equations~\ref{IKM-EQU-2}, \ref{IKM-EQU-3b} and~\ref{IKM-EQU-6b} to get
484     \begin{equation}\label{IKM-EQU-10}
485 gross 2100 \sigma\hackscore{ij}' = 2 \eta\hackscore{eff} \left( D\hackscore{ij}' +
486     \frac{1}{ 2 \mu \; dt} \sigma\hackscore{ij}^{'-}\right) \mbox{ with }
487 gross 1878 \frac{1}{\eta\hackscore{eff}}=\frac{1}{\mu \; dt}+\frac{1}{\eta^{vp}}
488     \end{equation}
489 gross 2100 Notice that $\eta\hackscore{eff}$ is a function of diatoric stress $\sigma\hackscore{ij}'$.
490 gross 1859 After inserting~\ref{IKM-EQU-10} into~\ref{IKM-EQU-1} we get
491     \begin{equation}\label{IKM-EQU-1ib}
492 gross 2100 -\left(\eta\hackscore{eff} (v\hackscore{i,j}+ v\hackscore{i,j})
493     \right)\hackscore{,j}+p\hackscore{,i}=F\hackscore{i}+
494 gross 1878 \frac{\eta\hackscore{eff}}{\mu dt } \sigma\hackscore{ij,j}^{'-}
495 gross 1859 \end{equation}
496 gross 1878 Together with the incomressibilty condition~\ref{IKM-EQU-2} we need to solve a problem with a form almost identical
497 jfenwick 1966 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
498 gross 1878 \begin{equation}
499     \begin{array}{rcl}
500 gross 2100 -\left(\eta\hackscore{eff}(dv\hackscore{i,j}+ dv\hackscore{i,j}
501     )\right)\hackscore{,j} & = & F\hackscore{i}+ \sigma\hackscore{ij,j}'-p\hackscore{,i} \\
502     \frac{1}{\eta\hackscore{eff}} dp & = & - v\hackscore{i,i}^+
503 gross 1878 \end{array}
504     \label{IKM iteration 2}
505     \end{equation}
506     where $v^+=v+dv$. As this problem is non-linear the Jacobi-free Newton-GMRES method is used with the norm
507     \begin{equation}
508 gross 2100 \|(v, p)\|^2= \int\hackscore{\Omega} v\hackscore{i,j}^2 + \frac{1}{\bar{\eta}^2\hackscore{eff}} p^2 \; dx
509 gross 1878 \label{IKM iteration 3}
510     \end{equation}
511 gross 2100 where $\bar{\eta}\hackscore{eff}$ is the caracteristic viscosity, for instance:
512     \begin{equation}
513     \frac{1}{\bar{\eta}\hackscore{eff}} = \frac{1}{\tau^{-}}+\sum\hackscore{q} \frac{1}{\eta^{q}\hackscore{N}}
514     \label{IKM iteration 4}
515     \end{equation}
516     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
517     calculation of $\eta\hackscore{eff}$ with the Newton-Raphson scheme. This value can then be used to calculate
518     $\sigma\hackscore{ij}'$ via~\ref{IKM-EQU-10}. We need to solve
519     \begin{equation}
520     \tau = \eta\hackscore{eff} \cdot \epsilon \mbox{ with }
521     \epsilon = \sqrt{ 2 \left( D\hackscore{ij}' +
522     \frac{1}{ 2 \mu \; dt} \sigma\hackscore{ij}^{'-}\right)^2}
523     \label{IKM iteration 5}
524     \end{equation}
525     The Newton scheme takes the form
526     \begin{equation}
527     \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)
528     = \min(\frac{\eta\hackscore{eff} - \tau\hackscore{n} \eta\hackscore{eff}'}
529     {1 - \eta\hackscore{eff}' \cdot \epsilon}, \frac{\tau\hackscore{Y} + \beta \; p}{\epsilon}) \epsilon
530     \label{IKM iteration 6}
531     \end{equation}
532     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
533     \begin{equation}
534     \eta\hackscore{eff}' = - \eta\hackscore{eff}^2 \left(\frac{1}{\eta\hackscore{eff}}\right)'
535     \mbox{ with }
536     \left(\frac{1}{\eta\hackscore{eff}}\right)' = \sum\hackscore{q} \left(\frac{1}{\eta^{q}} \right)'
537     \label{IKM iteration 7}
538     \end{equation}
539     \begin{equation}\label{IKM-EQU-5XX}
540     \left(\frac{1}{\eta^{q}} \right)'
541     = \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}}}}
542     = \frac{1-\frac{1}{n^{q}}}{ \tau \eta^{q}}
543     \end{equation}
544     Notice that allways $\eta\hackscore{eff}'\le 0$ which makes the denomionator in~\ref{IKM iteration 6}
545     positive.
546 gross 1841
547 gross 1878
548 gross 2100

  ViewVC Help
Powered by ViewVC 1.1.26