/[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 572 by gross, Tue Feb 28 05:34:37 2006 UTC revision 573 by lkettle, Thu Mar 2 00:42:53 2006 UTC
# Line 130  method} (FEM\index{finite element Line 130  method} (FEM\index{finite element
130  method!FEM}). The basic idea is to fill the domain with a  method!FEM}). The basic idea is to fill the domain with a
131  set of points called nodes. The solution is approximated by its  set of points called nodes. The solution is approximated by its
132  values on the nodes\index{finite element  values on the nodes\index{finite element
133  method!nodes}. Moreover, the domain is subdivided into small,  method!nodes}. Moreover, the domain is subdivided into smaller
134  sub-domain called elements \index{finite element  sub-domains called elements \index{finite element
135  method!element}. On each element the solution is  method!element}. On each element the solution is
136  represented by a polynomial of a certain degree through its values at  represented by a polynomial of a certain degree through its values at
137  the nodes located in the element. The nodes and its connection through  the nodes located in the element. The nodes and its connection through
# Line 181  and $0$ elsewhere. In our case of $\Gamm Line 181  and $0$ elsewhere. In our case of $\Gamm
181  we need to construct a function \var{gammaD} which is positive for the cases $x\hackscore{0}=0$ or $x\hackscore{1}=0$. To get  we need to construct a function \var{gammaD} which is positive for the cases $x\hackscore{0}=0$ or $x\hackscore{1}=0$. To get
182  an object \var{x} which represents locations in the domain one uses  an object \var{x} which represents locations in the domain one uses
183  \begin{python}  \begin{python}
184  x=mydomain.getX() \;.  x=mydomain.getX()
185  \end{python}  \end{python}
186  In fact \var{x} is a \Data object which we will learn more about in Chapter~\ref{X}. At this stage we only have to know  In fact \var{x} is a \Data object which we will learn more about in Chapter~\ref{X}. At this stage we only have to know
187  that \var{x} has a  that \var{x} has a
# Line 226  will print Line 226  will print
226  \end{python}  \end{python}
227  We can now construct the function \var{gammaD} by  We can now construct the function \var{gammaD} by
228  \begin{python}  \begin{python}
229    from esys.escript import whereZero
230  gammaD=whereZero(x[0])+whereZero(x[1])  gammaD=whereZero(x[0])+whereZero(x[1])
231  \end{python}  \end{python}
232  where  where
# Line 252  from esys.linearPDEs import Poisson Line 253  from esys.linearPDEs import Poisson
253  x = mydomain.getX()  x = mydomain.getX()
254  gammaD = whereZero(x[0])+whereZero(x[1])  gammaD = whereZero(x[0])+whereZero(x[1])
255  mypde = Poisson(domain=mydomain)  mypde = Poisson(domain=mydomain)
256  mypde = setValue(f=1,q=gammaD)  mypde.setValue(f=1,q=gammaD)
257  \end{python}  \end{python}
258  The first statement imports the \Poisson class definition form the \linearPDEs module \escript package.  The first statement imports the \Poisson class definition from the \linearPDEs module \escript package.
259  To get the solution of the Poisson equation defined by \var{mypde} we just have to call its  To get the solution of the Poisson equation defined by \var{mypde} we just have to call its
260  \method{getSolution}.  \method{getSolution}.
261    
# Line 280  saveVTK("u.xml",sol=u) Line 281  saveVTK("u.xml",sol=u)
281  The last statement writes the solution tagged with the name "sol" to the external file \file{u.xml} in  The last statement writes the solution tagged with the name "sol" to the external file \file{u.xml} in
282  \VTK file format. \VTK is a software library  \VTK file format. \VTK is a software library
283  for the visualization of scientific, engineering and analytical data and is freely available  for the visualization of scientific, engineering and analytical data and is freely available
284  from \url{http://www.vtk.org}. There are a variaty of graphical user interfaces  from \url{http://www.vtk.org}. There are a variety of graphical user interfaces
285  for \VTK available, for instance \mayavi which can be downloaded from \url{http://mayavi.sourceforge.net/} but is also available on most  for \VTK available, for instance \mayavi which can be downloaded from \url{http://mayavi.sourceforge.net/} but is also available on most
286  \LINUX distributions.  \LINUX distributions.
287    
288  \begin{figure}  \begin{figure}
289  \centerline{\includegraphics[width=\figwidth]{FirstStepResult.eps}}  \centerline{\includegraphics[width=\figwidth]{FirstStepResult.eps}}
290  \caption{Visualization of the Possion Equation Solution for $f=1$}  \caption{Visualization of the Poisson Equation Solution for $f=1$}
291  \label{fig:FirstSteps.3}  \label{fig:FirstSteps.3}
292  \end{figure}  \end{figure}
293    

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

  ViewVC Help
Powered by ViewVC 1.1.26