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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 707 - (show annotations)
Wed Apr 12 23:58:02 2006 UTC (13 years, 8 months ago) by gross
File MIME type: text/x-python
File size: 805 byte(s)
latex build documentation is working now
1 # $Id$
2 from esys.escript import *
3 from esys.escript.linearPDEs import LinearPDE
4 from esys.finley import Rectangle
5 #... set some parameters ...
6 xc=[0.02,0.002]
7 r=0.001
8 qc=50.e6
9 Tref=0.
10 rhocp=2.6e6
11 eta=75.
12 kappa=240.
13 tend=5.
14 # ... time, time step size and counter ...
15 t=0
16 h=0.1
17 i=0
18 #... generate domain ...
19 mydomain = Rectangle(l0=0.05,l1=0.01,n0=250, n1=50)
20 #... open PDE ...
21 mypde=LinearPDE(mydomain)
22 mypde.setSymmetryOn()
23 mypde.setValue(A=kappa*kronecker(mydomain),D=rhocp/h,d=eta,y=eta*Tref)
24 # ... set heat source: ....
25 x=mydomain.getX()
26 qH=qc*whereNegative(length(x-xc)-r)
27 # ... set initial temperature ....
28 T=Tref
29 # ... start iteration:
30 while t<tend:
31 i+=1
32 t+=h
33 print "time step :",t
34 mypde.setValue(Y=qH+rhocp/h*T)
35 T=mypde.getSolution()
36 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