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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1004 - (show annotations)
Thu Mar 1 04:57:31 2007 UTC (13 years, 9 months ago) by jongui
File MIME type: text/x-python
File size: 1398 byte(s)
Updated the epydocs, comments and organized codes to ease readability.
1 # $Id: diffusion.py 575 2006-03-03 03:33:07Z lkettle $
2 from esys.escript import *
3 from esys.escript.linearPDEs import LinearPDE
4 from esys.finley import Rectangle
5 from esys.pyvisi import Scene, DataCollector, Map
6 from esys.pyvisi.constant import *
7
8 #... set some parameters ...
9 xc=[0.02,0.002]
10 r=0.001
11 qc=50.e6
12 Tref=0.
13 rhocp=2.6e6
14 eta=75.
15 kappa=240.
16 tend=5.
17 # ... time, time step size and counter ...
18 t=0
19 h=0.1
20 i=0
21 #... generate domain ...
22 mydomain = Rectangle(l0=0.05,l1=0.01,n0=250, n1=50)
23 #... open PDE ...
24 mypde=LinearPDE(mydomain)
25 mypde.setSymmetryOn()
26 mypde.setValue(A=kappa*kronecker(mydomain),D=rhocp/h,d=eta,y=eta*Tref)
27 # ... set heat source: ....
28 x=mydomain.getX()
29 qH=qc*whereNegative(length(x-xc)-r)
30 # ... set initial temperature ....
31 T=Tref
32
33 s = Scene(renderer = Renderer.ONLINE, x_size = 800, y_size = 600)
34 dc = DataCollector(source = Source.ESCRIPT)
35
36
37 # ... start iteration:
38 while t<tend:
39 i+=1
40 t+=h
41 print "time step :",t
42 mypde.setValue(Y=qH+rhocp/h*T)
43 T=mypde.getSolution()
44 saveVTK("T.%d.xml"%i,temp=T)
45
46 dc.setData(temp=T)
47 Map(scene = s, data_collector = dc)
48 s.animate()
49
50 """
51 print i
52 if(i == 10):
53 dc.setData(temp=T)
54 Map(scene = s, data_collector = dc)
55 s.animate()
56 elif(i == 20):
57 dc.setData(temp=T)
58 Map(scene = s, data_collector = dc)
59 s.animate()
60 """
61

  ViewVC Help
Powered by ViewVC 1.1.26