/[escript]/trunk/doc/examples/diffusion.py
ViewVC logotype

Annotation of /trunk/doc/examples/diffusion.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 575 - (hide annotations)
Fri Mar 3 03:33:07 2006 UTC (14 years, 8 months ago) by lkettle
Original Path: trunk/doc/user/examples/diffusion.py
File MIME type: text/x-python
File size: 805 byte(s)
I have changed some of the documentation and added more explanations for
the online reference guide for esys13. I have modified two of the
example source codes to write out the results for Helmholtz problem and
changed one variable name in the diffusion.py code to avoid confusion.

1 jgs 102 # $Id$
2 gross 569 from esys.escript import *
3     from esys.escript.linearPDEs import LinearPDE
4 jgs 108 from esys.finley import Rectangle
5 jgs 102 #... set some parameters ...
6 jgs 108 xc=[0.02,0.002]
7 jgs 102 r=0.001
8 jgs 108 qc=50.e6
9 jgs 102 Tref=0.
10     rhocp=2.6e6
11     eta=75.
12     kappa=240.
13 jgs 108 tend=5.
14     # ... time, time step size and counter ...
15     t=0
16 jgs 102 h=0.1
17     i=0
18     #... generate domain ...
19 jgs 108 mydomain = Rectangle(l0=0.05,l1=0.01,n0=250, n1=50)
20 jgs 102 #... open PDE ...
21 gross 569 mypde=LinearPDE(mydomain)
22     mypde.setSymmetryOn()
23     mypde.setValue(A=kappa*kronecker(mydomain),D=rhocp/h,d=eta,y=eta*Tref)
24 jgs 102 # ... set heat source: ....
25     x=mydomain.getX()
26 lkettle 575 qH=qc*whereNegative(length(x-xc)-r)
27 jgs 102 # ... set initial temperature ....
28     T=Tref
29     # ... start iteration:
30 jgs 108 while t<tend:
31 jgs 102 i+=1
32     t+=h
33     print "time step :",t
34 lkettle 575 mypde.setValue(Y=qH+rhocp/h*T)
35 jgs 102 T=mypde.getSolution()
36 gross 569 saveVTK("T.%d.xml"%i,temp=T)

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26