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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 113 - (show annotations)
Mon Feb 28 07:06:33 2005 UTC (14 years, 1 month ago) by jgs
File MIME type: text/x-python
File size: 744 byte(s)
*** empty log message ***

1 # $Id$
2 from mytools import Helmholtz
3 from esys.escript import Lsup,length
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=Helmholtz(mydomain)
22 # ... set heat source: ....
23 x=mydomain.getX()
24 q=qc*(length(x-xc)-r).whereNegative()
25 # ... set initial temperature ....
26 T=Tref
27 # ... start iteration:
28 while t<tend:
29 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 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