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

Diff of /trunk/doc/user/diffusion.tex

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 569 by gross, Tue Feb 28 05:34:37 2006 UTC revision 573 by lkettle, Thu Mar 2 00:42:53 2006 UTC
# Line 78  the backward Euler Line 78  the backward Euler
78  scheme is based  scheme is based
79  on the Taylor expansion of $T$ at time $t^{(n)}$:  on the Taylor expansion of $T$ at time $t^{(n)}$:
80  \begin{equation}  \begin{equation}
81  T^{(n-1)}\approx T^{(n)}+T\hackscore{,t}^{(n)}(t^{(n-1)}-t^{(n)})  T^{(n)}\approx T^{(n-1)}+T\hackscore{,t}^{(n)}(t^{(n)}-t^{(n-1)})
82  =T^{(n-1)} - h \cdot T\hackscore{,t}^{(n)}  =T^{(n-1)} + h \cdot T\hackscore{,t}^{(n)}
83  \label{DIFFUSION TEMP EQ 6}  \label{DIFFUSION TEMP EQ 6}
84  \end{equation}  \end{equation}
85  This is inserted into \eqn{DIFFUSION TEMP EQ 1}. By separating the terms at  This is inserted into \eqn{DIFFUSION TEMP EQ 1}. By separating the terms at
# Line 159  d=\eta & y= g &  \\ Line 159  d=\eta & y= g &  \\
159  $\delta\hackscore{ij}$ is the Kronecker symbol \index{Kronecker symbol} defined by $\delta\hackscore{ij}=1$ for  $\delta\hackscore{ij}$ is the Kronecker symbol \index{Kronecker symbol} defined by $\delta\hackscore{ij}=1$ for
160  $i=j$ and $0$ otherwise. Undefined coefficients are assumed to be not present\footnote{There is a difference  $i=j$ and $0$ otherwise. Undefined coefficients are assumed to be not present\footnote{There is a difference
161  in \escript of being not present and set to zero. As not present coefficients are not processed,  in \escript of being not present and set to zero. As not present coefficients are not processed,
162  it is more efficient to leave a coefficient undefined insted assigning zero to it.}  it is more efficient to leave a coefficient undefined instead of assigning zero to it.}
163    
164  Defining and solving the Helmholtz equation is very easy now:  Defining and solving the Helmholtz equation is very easy now:
165  \begin{python}  \begin{python}
# Line 177  the PDE and returns the solution \code{u Line 177  the PDE and returns the solution \code{u
177  returning the Kronecker symbol.  returning the Kronecker symbol.
178    
179  The coefficients can set by several calls of \method{setValue} where the order can be chosen arbitrarily.  The coefficients can set by several calls of \method{setValue} where the order can be chosen arbitrarily.
180  If a value is assigned to a coefficint several times, the last assigned value is used when  If a value is assigned to a coefficient several times, the last assigned value is used when
181  the solution is calculated:  the solution is calculated:
182  \begin{python}  \begin{python}
183  mypde=LinearPDE(mydomain)  mypde=LinearPDE(mydomain)
# Line 245  print "error is ",Lsup(u-x[0]) Line 245  print "error is ",Lsup(u-x[0])
245  \end{python}  \end{python}
246  The script is similar to the script \file{poisson.py} dicussed in \Chap{FirstSteps}.  The script is similar to the script \file{poisson.py} dicussed in \Chap{FirstSteps}.
247  \code{mydomain.getNormal()} returns the outer normal field on the surface of the domain. The function \function{Lsup}  \code{mydomain.getNormal()} returns the outer normal field on the surface of the domain. The function \function{Lsup}
248  imported by the \code{from esys.escript import *} statement and returns the maximum absulute value of its argument.  imported by the \code{from esys.escript import *} statement and returns the maximum absolute value of its argument.
249  The error shown by the print statement should be in the order of $10^{-7}$. As piecewise bi-linear interpolation is  The error shown by the print statement should be in the order of $10^{-7}$. As piecewise bi-linear interpolation is
250  used by \finley approximate the solution and our solution is a linear function of the spatial coordinates one might  used by \finley approximate the solution and our solution is a linear function of the spatial coordinates one might
251  expect that the error would be zero or in the order of machine precision (typically $\approx 10^{-15}$).  expect that the error would be zero or in the order of machine precision (typically $\approx 10^{-15}$).
# Line 283  The heat source \var{q} which is defined Line 283  The heat source \var{q} which is defined
283  in an area defined as a circle of radius \var{r} and center \var{xc} and zero outside this circle.  in an area defined as a circle of radius \var{r} and center \var{xc} and zero outside this circle.
284  \var{q0} is a fixed constant. The following script defines \var{q} as desired:    \var{q0} is a fixed constant. The following script defines \var{q} as desired:  
285  \begin{python}  \begin{python}
286  from esys.escript import length  from esys.escript import length,whereNegative
287  xc=[0.02,0.002]  xc=[0.02,0.002]
288  r=0.001  r=0.001
289  x=mydomain.getX()  x=mydomain.getX()

Legend:
Removed from v.569  
changed lines
  Added in v.573

  ViewVC Help
Powered by ViewVC 1.1.26