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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 155 - (hide annotations)
Wed Nov 9 02:02:19 2005 UTC (17 years, 4 months ago) by jgs
File MIME type: text/x-python
File size: 744 byte(s)
move all directories from trunk/esys2 into trunk and remove esys2

1 jgs 102 # $Id$
2 jgs 108 from mytools import Helmholtz
3 jgs 113 from esys.escript import Lsup,length
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     mypde=Helmholtz(mydomain)
22     # ... set heat source: ....
23     x=mydomain.getX()
24 jgs 108 q=qc*(length(x-xc)-r).whereNegative()
25 jgs 102 # ... set initial temperature ....
26     T=Tref
27     # ... start iteration:
28 jgs 108 while t<tend:
29 jgs 102 i+=1
30     t+=h
31     print "time step :",t
32     mypde.setValue(kappa=kappa,omega=rhocp/h,f=q+rhocp/h*T,eta=eta,g=eta*Tref)
33     T=mypde.getSolution()
34 jgs 113 T.saveDX("T%d.dx"%i)

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26