259 |
\method{getSolution}. |
\method{getSolution}. |
260 |
|
|
261 |
Now we can write the script to solve our test problem (Remember that |
Now we can write the script to solve our test problem (Remember that |
262 |
lines starting with '\#' are comment lines in Python) (available as \file{mypoisson.py} |
lines starting with '\#' are comment lines in Python) (available as \file{poisson.py} |
263 |
in the \ExampleDirectory): |
in the \ExampleDirectory): |
264 |
\begin{python} |
\begin{python} |
265 |
from esys.escript import * |
from esys.escript import * |
266 |
from linearPDEs import Poisson |
from esys.escript.linearPDEs import Poisson |
267 |
from esys.finley import Rectangle |
from esys.finley import Rectangle |
268 |
# generate domain: |
# generate domain: |
269 |
mydomain = Rectangle(l0=1.,l1=1.,n0=40, n1=20) |
mydomain = Rectangle(l0=1.,l1=1.,n0=40, n1=20) |
291 |
\end{figure} |
\end{figure} |
292 |
|
|
293 |
You can edit the script file using your favourite text editor (or the Integrated DeveLopment Environment IDLE |
You can edit the script file using your favourite text editor (or the Integrated DeveLopment Environment IDLE |
294 |
for Python, see \url{http://idlefork.sourceforge.net}). If the script file has the name \file{mypoisson.py} \index{scripts!\file{mypoisson.py}} you can run the |
for Python, see \url{http://idlefork.sourceforge.net}). If the script file has the name \file{poisson.py} \index{scripts!\file{poisson.py}} you can run the |
295 |
script from any shell using the command: |
script from any shell using the command: |
296 |
\begin{python} |
\begin{python} |
297 |
python mypoisson.py |
python poisson.py |
298 |
\end{python} |
\end{python} |
299 |
After the script has (hopefully successfully) been completed you will find the file \file{u.dx} in the current |
After the script has (hopefully successfully) been completed you will find the file \file{u.xml} in the current |
300 |
directory. An easy way to visualize the results is the command |
directory. An easy way to visualize the results is the command |
301 |
\begin{python} |
\begin{python} |
302 |
mayavi -d u.xml -m SurfaceMap & |
mayavi -d u.xml -m SurfaceMap & |