 # Annotation of /trunk/doc/user/darcyflux.tex

Revision 6678 - (hide annotations)
Mon Jun 11 04:05:30 2018 UTC (15 months ago) by jfenwick
File MIME type: application/x-tex
File size: 8654 byte(s)
Fixing overfull hboxes


 1 caltinay 3326 2 jfenwick 3989 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3 jfenwick 6651 % Copyright (c) 2003-2018 by The University of Queensland 4 jfenwick 3989 5 caltinay 3326 % 6 % Primary Business: Queensland, Australia 7 jfenwick 6112 % Licensed under the Apache License, version 2.0 8 9 caltinay 3326 % 10 jfenwick 3989 % Development until 2012 by Earth Systems Science Computational Center (ESSCC) 11 jfenwick 4657 % Development 2012-2013 by School of Earth Sciences 12 % Development from 2014 by Centre for Geoscience Computing (GeoComp) 13 jfenwick 3989 % 14 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 15 caltinay 3326 16 gross 2960 \section{Darcy Flux} 17 \label{DARCY FLUX} 18 gross 3747 We want to calculate the flux $u$ and pressure $p$ on a domain $\Omega$ 19 caltinay 3326 solving the Darcy flux problem\index{Darcy flux}\index{Darcy flow} 20 gross 2960 \begin{equation}\label{DARCY PROBLEM} 21 \begin{array}{rcl} 22 jfenwick 3295 u_{i} + \kappa_{ij} p_{,j} & = & g_{i} \\ 23 u_{k,k} & = & f 24 gross 2960 \end{array} 25 \end{equation} 26 with the boundary conditions 27 \begin{equation}\label{DARCY BOUNDARY} 28 \begin{array}{rcl} 29 jfenwick 3295 u_{i} \; n_{i} = u^{N}_{i} \; n_{i} & \mbox{ on } & \Gamma_{N} \\ 30 p = p^{D} & \mbox{ on } & \Gamma_{D} \\ 31 gross 2960 \end{array} 32 \end{equation} 33 caltinay 3326 where $\Gamma_{N}$ and $\Gamma_{D}$ are a partition of the boundary of 34 $\Omega$ with $\Gamma_{D}$ non-empty, $n_{i}$ is the outer normal field of the 35 boundary of $\Omega$, $u^{N}_{i}$ and $p^{D}$ are given functions on $\Omega$, 36 $g_{i}$ and $f$ are given source terms and $\kappa_{ij}$ is the given 37 permeability. 38 We assume that $\kappa_{ij}$ is symmetric (which is not really required) and 39 positive definite, i.e. there are positive constants $\alpha_{0}$ and 40 $\alpha_{1}$ which are independent from the location in $\Omega$ such that 41 gross 2960 \begin{equation} 42 jfenwick 3295 \alpha_{0} \; x_{i} x_{i} \le \kappa_{ij} x_{i} x_{j} \le \alpha_{1} \; x_{i} x_{i} 43 gross 2960 \end{equation} 44 caltinay 3326 for all $x_{i}$. 45 gross 2960 46 gross 3501 47 gross 2960 \subsection{Solution Method \label{DARCY SOLVE}} 48 gross 3502 Unfortunate equation~\ref{DARCY PROBLEM} can not solved directly in an easy way and requires mixed FEM. 49 We consider a few options to solve equation~\ref{DARCY PROBLEM} 50 gross 3568 \subsubsection{Evaluation}\label{SEC DARCY SIMPLE} 51 gross 3502 The first equation of equation~\ref{DARCY PROBLEM} is inserted into the second one: 52 \begin{equation}\label{DARCY PROBLEM SIMPLE} 53 - (\kappa_{ij} p_{,j})_{,i} = f - (g_{i})_{,i} 54 gross 3501 \end{equation} 55 gross 3568 56 gross 3502 with boundary conditions 57 \begin{equation}\label{DARCY BOUNDARY SIMPLE} 58 gross 3501 \begin{array}{rcl} 59 gross 3502 \kappa_{ij} p_{,j} \; n_{i} = ( g_{i} - u^{N}_{i} ) \; n_{i} & \mbox{ on } & \Gamma_{N} \\ 60 p = p^{D} & \mbox{ on } & \Gamma_{D} \\ 61 gross 3501 \end{array} 62 \end{equation} 63 gross 3568 Then the flux field is recovered by directly setting 64 gross 3502 \begin{equation}\label{DARCY PROBLEM SIMPLE FLUX} 65 u_{j} = g_j - \kappa_{ij} p_{,j} 66 \end{equation} 67 gross 3568 This simple recovery process will not ensure that the (numerically) calculated flux 68 meets the boundary conditions for flux or the incompressibility condition. 69 However this is a very fast way of calculating the flux. 70 gross 3502 71 gross 3568 72 gross 3502 \subsubsection{Global Postprocessing \label{SEC DARCY POST}} 73 An improved flux recovery can be achieved by solving a modified version of equation~\ref{DARCY PROBLEM SIMPLE FLUX} 74 caltinay 4285 adding the gradient of the divergence of the flux: 75 gross 3502 \begin{equation}\label{DARCY PROBLEM POST FLUX} 76 \kappa^{-1}_{ij} u_{j} - 77 (\lambda \cdot u_{k,k} )_{,i}= 78 \kappa^{-1}_{ij} g_j- p_{,i} 79 - (\lambda \cdot f )_{,i} 80 \end{equation} 81 where 82 \begin{equation}\label{DARCY PROBLEM POST FLUX A} 83 \lambda = \omega \cdot |\kappa^{-1}| \cdot vol(\Omega)^{1/d} \cdot h 84 \end{equation} 85 with a non-negative factor $\omega$, $d$ is the spatial dimension and $h$ is the local element size. 86 \begin{equation}\label{DARCY PROBLEM POST FLUX BOUNDARY} 87 gross 3501 \begin{array}{rcl} 88 gross 3502 u_{i} \; n_{i} = u^{N}_{i} \; n_{i} & \mbox{ on } & \Gamma_{N} \\ 89 u_{k,k} = f & \mbox{ on } & \Gamma_{D} \\ 90 gross 3501 \end{array} 91 gross 3502 \end{equation} 92 gross 3568 Notice that the second condition is a natural boundary condition. 93 Global post-processing is more expense than direct pressure evaluation 94 however the flux is more accurate and asymptotic incompressibility 95 gross 3569 for mesh size towards zero can be shown, if $\omega>0$. 96 gross 3502 97 gross 2960 98 \subsection{Functions} 99 gross 3629 \begin{classdesc}{DarcyFlow}{domain, \optional{w=1., \optional{solver=\member{DarcyFlow.POST}, \optional{ 100 gross 3502 useReduced=\True, \optional{ verbose=\True} } }}} 101 opens the Darcy flux problem\index{Darcy flux} on the \Domain domain. 102 Reduced approximations for pressure and flux are used if \var{useReduced} is set. 103 Argument \var{solver} defines the solver method. 104 If \var{verbose} is set some information are printed. 105 gross 3568 \var{w} defines the weighting factor $\omega$ for global post-processing of the flux (see equation~\ref{DARCY PROBLEM POST FLUX A}.) 106 gross 2960 \end{classdesc} 107 108 gross 3568 \begin{memberdesc}[DarcyFlow]{EVAL} 109 flux is calculated directly from pressure evaluation, see section~\ref{SEC DARCY SIMPLE}. 110 gross 3502 \end{memberdesc} 111 112 gross 3569 \begin{memberdesc}[DarcyFlow]{SMOOTH} 113 solver using global post-processing of flux with weighting factor $\omega=0$, see section~\ref{SEC DARCY POST}. 114 \end{memberdesc} 115 116 gross 3502 \begin{memberdesc}[DarcyFlow]{POST} 117 gross 3568 solver using global post-processing of flux, see section~\ref{SEC DARCY POST}. 118 gross 3502 \end{memberdesc} 119 120 gross 2960 \begin{methoddesc}[DarcyFlow]{setValue}{\optional{f=None, \optional{g=None, \optional{location_of_fixed_pressure=None, \optional{location_of_fixed_flux=None, 121 \\\optional{permeability=None}}}}}} 122 caltinay 3326 assigns values to the model parameters. Values can be assigned using various 123 calls -- in particular in a time dependent problem only values that change 124 over time need to be reset. The permeability can be defined as a scalar 125 gross 3568 (isotropic), or a symmetric matrix (anisotropic). 126 gross 2960 \var{f} and \var{g} are the corresponding parameters in~\ref{DARCY PROBLEM}. 127 caltinay 3326 The locations and components where the flux is prescribed are set by positive 128 values in \var{location_of_fixed_flux}. 129 The locations where the pressure is prescribed are set by by positive values 130 of \var{location_of_fixed_pressure}. 131 gross 2960 The values of the pressure and flux are defined by the initial guess. 132 caltinay 3326 Notice that at any point on the boundary of the domain the pressure or the 133 normal component of the flux must be defined. There must be at least one point 134 where the pressure is prescribed. 135 The method will try to cast the given values to appropriate \Data class objects. 136 gross 2960 \end{methoddesc} 137 138 \begin{methoddesc}[DarcyFlow]{getSolverOptionsFlux}{} 139 gross 3502 returns the solver options used to solve the flux problems. 140 caltinay 3326 Use this \SolverOptions object to control the solution algorithms. 141 gross 3568 This option is only relevant if global postprocesing is used. 142 gross 2960 \end{methoddesc} 143 144 \begin{methoddesc}[DarcyFlow]{getSolverOptionsPressure}{} 145 caltinay 3331 returns a \SolverOptions object with the options used to solve the pressure 146 gross 3502 problems. 147 caltinay 3331 Use this object to control the solution algorithms. 148 gross 2960 \end{methoddesc} 149 150 gross 3568 \begin{methoddesc}[DarcyFlow]{solve}{u0,p0} 151 caltinay 3326 solves the problem and returns approximations for the flux $v$ and the pressure $p$. 152 \var{u0} and \var{p0} define initial guesses for flux and pressure. 153 Values marked by positive values \var{location_of_fixed_flux} and 154 \var{location_of_fixed_pressure}, respectively, are kept unchanged. 155 gross 2960 \end{methoddesc} 156 157 gross 3502 \begin{methoddesc}[DarcyFlow]{getFlux}{p, \optional{ u0 = None}} 158 returns the flux for a given pressure \var{p} where the flux is equal to \var{u0} 159 on locations where \var{location_of_fixed_flux} is positive, see \member{setValue}. 160 Notice that \var{g} and \var{f} are used. 161 \end{methoddesc} 162 163 gross 3629 \begin{figure} 164 \centerline{\includegraphics[width=\figwidth]{darcy_result}} 165 \caption{Flux and pressure field of the Dary flow example.} 166 gross 4537 \label{DARCY FIG 1} 167 gross 3629 \end{figure} 168 gross 3502 169 gross 3629 \subsection{Example: Gravity Flow} 170 The following script \file{darcy.py}\index{scripts!\file{darcy.py.py}}\index{Darcy flow} 171 jfenwick 6678 which is available in the \ExampleDirectory illustrates the usage of the\\ 172 gross 3629 \class{DarcyFlow} class: 173 \begin{python} 174 from esys.escript import * 175 from esys.escript.models import DarcyFlow 176 from esys.finley import Rectangle 177 from esys.weipa import saveVTK 178 mydomain = Rectangle(l0=2.,l1=1.,n0=40, n1=20) 179 x = mydomain.getX() 180 p_BC=whereZero(x-1.)*wherePositive(x-1.) 181 u_BC=(whereZero(x)+whereZero(x-2.)) * [1.,0.] + \ 182 (whereZero(x) + whereZero(x-1.)*whereNonPositive(x-1.0)) * [0., 1.] 183 mypde = DarcyFlow(domain=mydomain) 184 mypde.setValue(g=[0., 2], 185 location_of_fixed_pressure=p_BC, 186 location_of_fixed_flux=u_BC, 187 permeability=100.) 188 gross 3502 189 gross 3629 u,p=mypde.solve(u0=x*[0., -1.], p0=0) 190 saveVTK("u.vtu",flux=u, pressure=p) 191 \end{python} 192 caltinay 4286 In the example the pressure is fixed to the initial pressure \var{p0} on the right half of the top face. 193 gross 3629 The normal flux is set on all other faces. The corresponding values for the flux are set by the initial value 194 \var{u0}.