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

revision 2250 by gross, Mon Jan 12 06:37:07 2009 UTC revision 2251 by gross, Fri Feb 6 06:50:39 2009 UTC
# Line 61  with sufficient accuracy we check for Line 61  with sufficient accuracy we check for
61
62  \|v\hackscore{k,k}\| \hackscore \le  \epsilon  \|v\hackscore{k,k}\| \hackscore \le  \epsilon
63  \|\sqrt{v\hackscore{j,k}v\hackscore{j,k}}\|  \|\sqrt{v\hackscore{j,k}v\hackscore{j,k}}\|
64    \label{STOKES STOP}
65
66  where $\epsilon$ is the desired relative accuracy and  where $\epsilon$ is the desired relative accuracy and
67
68  \|p\|^2= \int\hackscore{\Omega} p^2 \; dx  \|p\|^2= \int\hackscore{\Omega} p^2 \; dx
69  \label{PRESSURE NORM}  \label{PRESSURE NORM}
70
71  defines the $L^2$-norm.  defines the $L^2$-norm. We use the Uzawa scheme \index{Uzawa scheme} to solve the problem.
72  There are two approaches to solve this problem. The first approach, called the Uzawa scheme \index{Uzawa scheme}
73  eliminates the velocity $v$ from the problem. The second approach solves the equation in coupled form after the application of a preconditioner.  In fact the first equation in~\ref{SADDLEPOINT} gives for a known pressure
74
75  \subsubsection{Uzawa scheme}  v=A^{-1}(G-B^{*}p)
76  The first eqution in~\ref{SADDLEPOINT} gives $v=A^{-1}(G-B^{*}p)$ assuming $p$ is known. This is inserted into the  \label{V CALC}
77  second eqution which leads to
78    which is inserted into the second equation leading to
79
80  S p =  B A^{-1} G  S p =  B A^{-1} G
81
82  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}  with the Schur complement \index{Schur complement} $S=BA^{-1}B^{*}$. This problem can be solved iteratively
83  with the preconditioner $\hat{S}$ defined as $q=\hat{S}^{-1}p$ by solving  with the preconditioner $\hat{S}$ defined as $q=\hat{S}^{-1}p$ by solving
84
85  \frac{1}{\eta}q = p  \frac{1}{\eta}q = p
86
87  see~\cite{ELMAN} for more details. The evaluation of $w=Sp$ is done in the form  see~\cite{ELMAN} for more details. Note that the residual for the current approximation $p$ is given as
88
89  \begin{array}{rcl}  r=B A^{-1} (G - B^* p) = Bv
A v & = & B^{*}p \\
w & = & Bv \\
\end{array}
\label{EVAL PCG}
90
91  The residual \index{residual}  $r=B A^{-1} G - S p$ is given as  where $v$ is given by~\ref{V CALC}.
92
93    If one uses the generalized minimal residual method (GMRES) \index{generalized minimal residual method!GMRES}
94    the method is directly applied to the preconditioned system
95
96  r=B A^{-1} (G - B^* p) = Bv \mbox{ with } v = A^{-1}(G-B^{*}p)  \hat{S}^{-1} S p =  \hat{S}^{-1} B A^{-1} G
97
98  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  We use the norm
99
100  (p,(v,Bv))=\int\hackscore{\Omega} p \cdot Bv \; dx  \|p\|\hackscore{GMRES} = \|\hat{S} p \|
101
102  where $p$ is the pressure increment and $(v,Bv)$ represents an increment in the residual.  Notice that for the residual $\hat{r}=\hat{S}^{-1} r$ one has

\subsubsection{Coupled Solver}
An alternative approach to solve the saddle point problem~\ref{SADDLEPOINT} directly using an iterative such as
the generalized minimal residual method (GMRES) \index{generalized minimal residual method!GMRES} with a suitable
preconditioner. Here we use the operator
103
104  \left[ \begin{array}{cc}  \
105  A^{-1}     & 0 \\
106  S^{-1} B A^{-1}  & -S^{-1} \\  If $p^{0}$ provides an initial guess for the pressure we use~\ref{V CALC} to get a first initial guess for the
107  \end{array} \right]  velocity $v^{0}$ which we use to set an absolute tolerance $ATOL =\epsilon \|\sqrt{v^{0}\hackscore{j,k}v^{0}\hackscore{j,k}}\|$.
108  \label{SADDLEPOINT PRECODITIONER}  The GMRES is terminated when

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
109
110  \begin{array}{rcl}  \|\hat{r}\|\hackscore{GMRES} \le ATOL
111  A w & = & Av+B^{*}p \\
112  \hat{S} q & = & B(w-v) \\  Notice that $\|\hat{r}\|\hackscore{GMRES}= \|r \| = \|Bv\| = \|v\hackscore{k,k}\|$ so we we can expect that
113  \end{array}  the target stopping criterion~\ref{STOKES STOP} is fullfilled. However, if $v$ is very different from the
114  \label{COUPLES SADDLEPOINT iteration}  initial choice of $v^{0}$ the value of $ATOL$ is corrected and GMRES is restarted with a new tolerance. For time dependend problems this apprach works well as value for $p$ form a previous time step provides a good initial guess.
115
116  We use the inner product induced by the norm  Alternatively, as $S$ is symmetric and positive definite one can apply the preconditioned conjugate gradient method (PCG) \index{preconditioned conjugate gradient method!PCG}. PCG use the norm
117
118  \|(v,p)\|^2= \int\hackscore{\Omega}  v\hackscore{i,j}  v\hackscore{i,j} + \left( \frac{p}{\eta}\right)^2\; dx  \|r\|\hackscore{PCG}^2 = \int\hackscore{\Omega} r \hat{S}^{-1}r \; dx = \int\hackscore{\Omega}  \eta r^2 \; dx
119  \label{COUPLES NORM}
120    To take the extra factor $\eta$ into consideration when checking the stopping criterion we use the following
121  In PDE form~\ref{COUPLES SADDLEPOINT iteration} takes the form  definition for $ATOL$:
122
123  \begin{array}{rcl}  ATOL = \epsilon \frac{\|\sqrt{v^{0}\hackscore{j,k}v^{0}\hackscore{j,k}}\|  }{\|v^{0}\hackscore{k,k}\|}
124  -\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} \\  \|v^{0}\hackscore{k,k}\|\hackscore{PCG}
125  \frac{1}{\eta}  q & = & - (w-v)\hackscore{i,i} \\
126  \end{array}

127
128
129  \subsection{Functions}  \subsection{Functions}
# Line 151  the values of \var{fixed_u_mask}. The me Line 143  the values of \var{fixed_u_mask}. The me
143  \end{methoddesc}  \end{methoddesc}
144
145  \begin{methoddesc}[StokesProblemCartesian]{solve}{v,p,  \begin{methoddesc}[StokesProblemCartesian]{solve}{v,p,
146  \optional{max_iter=20, \optional{verbose=False, \optional{useUzawa=True}}}}  \optional{max_iter=20, \optional{verbose=False, \optional{usePCG=True}}}}
147  solves the problem and return approximations for velocity and pressure.  solves the problem and return approximations for velocity and pressure.
148  The arguments \var{v} and \var{p} define initial guess. The values of \var{v} marked  The arguments \var{v} and \var{p} define initial guess. The values of \var{v} marked
150  If \var{useUzawa} is set to \True  If \var{usePCG} is set to \True
151  the Uzawa\index{Uszwa} scheme is used. Otherwise the problem is solved in coupled form. In most cases  reconditioned conjugate gradient method (PCG) \index{preconditioned conjugate gradient method!PCG}  scheme is used. Otherwise the problem is solved generalized minimal residual method (GMRES) \index{generalized minimal residual method!GMRES}. In most cases
152  the Uzawa scheme is more efficient.  the PCG scheme is more efficient.
153  \var{max_iter} defines the maximum number of iteration steps.  \var{max_iter} defines the maximum number of iteration steps.
154  If \var{verbose} is set to \True informations on the progress of of the solver are printed.  If \var{verbose} is set to \True informations on the progress of of the solver are printed.
155  \end{methoddesc}  \end{methoddesc}
156
157
158  \begin{methoddesc}[StokesProblemCartesian]{setTolerance}{\optional{tolerance=1.e-8}}  \begin{methoddesc}[StokesProblemCartesian]{setTolerance}{\optional{tolerance=1.e-4}}
159  sets the tolerance in an appropriate norm relative to the right hand side. The tolerance must be non-negative and less than 1.  sets the tolerance in an appropriate norm relative to the right hand side. The tolerance must be non-negative and less than 1.
160  \end{methoddesc}  \end{methoddesc}
161  \begin{methoddesc}[StokesProblemCartesian]{getTolerance}{}  \begin{methoddesc}[StokesProblemCartesian]{getTolerance}{}
# Line 176  absolute talerance is set to 0. Line 168  absolute talerance is set to 0.
168  \begin{methoddesc}[StokesProblemCartesian]{getAbsoluteTolerance}{}  \begin{methoddesc}[StokesProblemCartesian]{getAbsoluteTolerance}{}
169  sreturns the current absolute tolerance.  sreturns the current absolute tolerance.
170  \end{methoddesc}  \end{methoddesc}
171  \begin{methoddesc}[StokesProblemCartesian]{setSubToleranceReductionFactor}{\optional{reduction=None}}  \begin{methoddesc}[StokesProblemCartesian]{setSubProblemTolerance}{\optional{rtol=None}}
172  sets the reduction factor for the tolerance used to solve the PDEs. A reduction factor  sets the tolerance to solve the involved PDEs. The subtolerance \var{rtol} should not be choosen to large
173  in the order of one will minimize compute time per iteration step but my slow down convergence or even lead to  in order to avoid feed back of errors in the subproblem solution into the outer iteration.
174  divergency. On the other hand a very small value for the PDE tolerance could result in a wast of compute time.  On the otherhand is choosen to small compute time is wasted.
175  If \var{reduction} is set to \var{None} the sub-tolerance is solved adaptively but  If \var{rtol} is set to \var{None} the sub-tolerance is set automatically depending on the
176  in cases a very small tolerance is set ($<10^{-6}$) it is recommended to set the  tolerance choosen for the oter iteration.
reduction factor by hand. This may require some experiments.
177  \end{methoddesc}  \end{methoddesc}
178  \begin{methoddesc}[StokesProblemCartesian]{getSubToleranceReductionFactor}{}  \begin{methoddesc}[StokesProblemCartesian]{getSubProblemTolerance}{}
179  return the current reduction factor for the sub-problem tolerance.  return the tolerance for the involved PDEs.
180  \end{methoddesc}  \end{methoddesc}
181
182  \subsection{Example: Lit Driven Cavity}  \subsection{Example: Lit Driven Cavity}

Legend:
 Removed from v.2250 changed lines Added in v.2251