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

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

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

revision 1316 by ksteube, Tue Sep 25 03:18:30 2007 UTC revision 2363 by gross, Fri Apr 3 03:56:19 2009 UTC
# Line 1  Line 1 
1    
2    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3  %  %
4  % $Id$  % Copyright (c) 2003-2008 by University of Queensland
5  %  % Earth Systems Science Computational Center (ESSCC)
6  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  % http://www.uq.edu.au/esscc
 %  
 %           Copyright 2003-2007 by ACceSS MNRF  
 %       Copyright 2007 by University of Queensland  
 %  
 %                http://esscc.uq.edu.au  
 %        Primary Business: Queensland, Australia  
 %  Licensed under the Open Software License version 3.0  
 %     http://www.opensource.org/licenses/osl-3.0.php  
7  %  %
8  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  % 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  %  %
12    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13    
14    
15  \section{The First Steps}  \section{The First Steps}
16  \label{FirstSteps}  \label{FirstSteps}
17    
18  \begin{figure}  
 \centerline{\includegraphics[width=\figwidth]{figures/FirstStepDomain}}  
 \caption{Domain $\Omega=[0,1]^2$ with outer normal field $n$.}  
 \label{fig:FirstSteps.1}  
 \end{figure}  
19    
20  In this chapter we give an introduction how to use \escript to solve  In this chapter we give an introduction how to use \escript to solve
21  a partial differential equation \index{partial differential equation} (PDE \index{partial differential equation!PDE}). We assume you are at least a little familiar with Python. The knowledge presented at the Python tutorial at \url{http://docs.python.org/tut/tut.html}  a partial differential equation \index{partial differential equation} (PDE \index{partial differential equation!PDE}). We assume you are at least a little familiar with Python. The knowledge presented at the Python tutorial at \url{http://docs.python.org/tut/tut.html}
# Line 39  is the unit square Line 33  is the unit square
33  \label{eq:FirstSteps.1b}  \label{eq:FirstSteps.1b}
34  \end{equation}  \end{equation}
35  The domain is shown in \fig{fig:FirstSteps.1}.  The domain is shown in \fig{fig:FirstSteps.1}.
36    \begin{figure} [h!]
37    \centerline{\includegraphics[width=\figwidth]{figures/FirstStepDomain}}
38    \caption{Domain $\Omega=[0,1]^2$ with outer normal field $n$.}
39    \label{fig:FirstSteps.1}
40    \end{figure}
41    
42  $\Delta$ denotes the Laplace operator\index{Laplace operator}, which is defined by  $\Delta$ denotes the Laplace operator\index{Laplace operator}, which is defined by
43  \begin{equation}  \begin{equation}
# Line 60  and \eqn{eq:FirstSteps.1} as Line 59  and \eqn{eq:FirstSteps.1} as
59  \end{equation*}  \end{equation*}
60  }  }
61  Basically, in the subindex of a function, any index to the left of the comma denotes a spatial derivative with respect  Basically, in the subindex of a function, any index to the left of the comma denotes a spatial derivative with respect
62  to the index. To get a more compact form we will write $w\hackscore{,ij}=(w\hackscore {,i})\hackscore{,j}$  to the index. To get a more compact form we will write $u\hackscore{,ij}=(u\hackscore {,i})\hackscore{,j}$
63  which leads to  which leads to
64  \begin{equation}  \begin{equation}
65  \Delta u = u\hackscore{,00}+u\hackscore{,11}=\sum\hackscore{i=0}^2 u\hackscore{,ii}  \Delta u = u\hackscore{,00}+u\hackscore{,11}=\sum\hackscore{i=0}^2 u\hackscore{,ii}
# Line 99  are applying the Einstein summation conv Line 98  are applying the Einstein summation conv
98  $n\hackscore{i} u\hackscore{,i}= n\hackscore{0} u\hackscore{,0} +  $n\hackscore{i} u\hackscore{,i}= n\hackscore{0} u\hackscore{,0} +
99  n\hackscore{1} u\hackscore{,1}$.  n\hackscore{1} u\hackscore{,1}$.
100  \footnote{Some readers may familiar with the notation  \footnote{Some readers may familiar with the notation
101  \begin{equation*}  $
102  \frac{\partial u}{\partial n} = n\hackscore{i} u\hackscore{,i}  \frac{\partial u}{\partial n} = n\hackscore{i} u\hackscore{,i}
103  \end{equation*}  $
104  for the normal derivative.}  for the normal derivative.}
105  The Neumann boundary condition of \eqn{eq:FirstSteps.2} should be fulfilled on the  The Neumann boundary condition of \eqn{eq:FirstSteps.2} should be fulfilled on the
106  set $\Gamma^N$ which is the top and right edge of the domain:  set $\Gamma^N$ which is the top and right edge of the domain:
# Line 126  with the Neumann boundary condition \eqn Line 125  with the Neumann boundary condition \eqn
125  Dirichlet boundary condition in \eqn{eq:FirstSteps.2d} form a so  Dirichlet boundary condition in \eqn{eq:FirstSteps.2d} form a so
126  called boundary value  called boundary value
127  problem\index{boundary value problem} (BVP\index{boundary value problem!BVP}) for  problem\index{boundary value problem} (BVP\index{boundary value problem!BVP}) for
128  the unknown  the unknown function~$u$.
 function $u$.  
129    
130    
131  \begin{figure}  \begin{figure}[h]
132  \centerline{\includegraphics[width=\figwidth]{figures/FirstStepMesh.eps}}  \centerline{\includegraphics[width=\figwidth]{figures/FirstStepMesh}}
133  \caption{Mesh of $4 \time 4$ elements on a rectangular domain.  Here  \caption{Mesh of $4 \time 4$ elements on a rectangular domain.  Here
134  each element is a quadrilateral and described by four nodes, namely  each element is a quadrilateral and described by four nodes, namely
135  the corner points. The solution is interpolated by a bi-linear  the corner points. The solution is interpolated by a bi-linear
# Line 250  and $0$ elsewhere. Line 248  and $0$ elsewhere.
248  Similarly, \code{whereZero(x[1])} creates function which equals $1$ where \code{x[1]} is  Similarly, \code{whereZero(x[1])} creates function which equals $1$ where \code{x[1]} is
249  equal to zero and $0$ elsewhere.  equal to zero and $0$ elsewhere.
250  The sum of the results of \code{whereZero(x[0])} and \code{whereZero(x[1])}  The sum of the results of \code{whereZero(x[0])} and \code{whereZero(x[1])}
251  gives a function on the domain \var{mydomain} which is exactly positive where $x\hackscore{0}$ or $x\hackscore{1}$ is equal to zero.  gives a function on the domain \var{mydomain} which is strictly positive where $x\hackscore{0}$ or $x\hackscore{1}$ is equal to zero.
252  Note that \var{gammaD} has the same \Rank, \Shape and \FunctionSpace like \var{x0} used to define it. So from  Note that \var{gammaD} has the same \Rank, \Shape and \FunctionSpace like \var{x0} used to define it. So from
253  \begin{python}  \begin{python}
254    print gammaD.getRank(),gammaD.getShape(),gammaD.getFunctionSpace()    print gammaD.getRank(),gammaD.getShape(),gammaD.getFunctionSpace()
# Line 303  Now you may run the script and visualize Line 301  Now you may run the script and visualize
301  See \fig{fig:FirstSteps.3}.  See \fig{fig:FirstSteps.3}.
302    
303  \begin{figure}  \begin{figure}
304  \centerline{\includegraphics[width=\figwidth]{figures/FirstStepResult.eps}}  \centerline{\includegraphics[width=\figwidth]{figures/FirstStepResult}}
305  \caption{Visualization of the Poisson Equation Solution for $f=1$}  \caption{Visualization of the Poisson Equation Solution for $f=1$}
306  \label{fig:FirstSteps.3}  \label{fig:FirstSteps.3}
307  \end{figure}  \end{figure}

Legend:
Removed from v.1316  
changed lines
  Added in v.2363

  ViewVC Help
Powered by ViewVC 1.1.26