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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1001 - (hide annotations)
Wed Feb 28 01:15:27 2007 UTC (13 years, 7 months ago) by jongui
File MIME type: text/x-python
File size: 1403 byte(s)
Added diffusion_with_pyvisi.py, but the reading of multiple temporary files (created in the background) appears not to work properly. The first file is always displayed.
1 jongui 1001 # $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    
38     # ... start iteration:
39     while t<tend:
40     i+=1
41     t+=h
42     print "time step :",t
43     mypde.setValue(Y=qH+rhocp/h*T)
44     T=mypde.getSolution()
45     #saveVTK("T.%d.xml"%i,temp=T)
46    
47     #dc.setData(temp=T)
48     #Map(scene = s, data_collector = dc)
49     #s.animate()
50    
51     """
52     print i
53     if(i == 10):
54     dc.setData(temp=T)
55     Map(scene = s, data_collector = dc)
56     s.animate()
57     elif(i == 20):
58     dc.setData(temp=T)
59     Map(scene = s, data_collector = dc)
60     s.animate()
61     """
62    

  ViewVC Help
Powered by ViewVC 1.1.26