/[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 1094 - (hide annotations)
Mon Apr 16 06:04:25 2007 UTC (14 years, 6 months ago) by jongui
File MIME type: text/x-python
File size: 1267 byte(s)
Fixed the bug related to the use of the 'setData' method in the DataCollector. Reading directly from escript objects should now work.
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 jongui 1076 s = Scene(renderer = Renderer.DISPLAY, x_size = 800, y_size = 600)
34 jongui 1001 dc = DataCollector(source = Source.ESCRIPT)
35    
36     # ... start iteration:
37     while t<tend:
38     i+=1
39     t+=h
40     print "time step :",t
41     mypde.setValue(Y=qH+rhocp/h*T)
42     T=mypde.getSolution()
43 jongui 1076 #saveVTK("T.%d.xml"%i,temp=T)
44 jongui 1001
45 jongui 1004 dc.setData(temp=T)
46 jongui 1076 Map(scene = s, data_collector = dc, viewport = Viewport.SOUTH_WEST,
47     lut = Lut.COLOR, cell_to_point = False, outline = True)
48     s.render(image_name = "%d.jpg" % i)
49 jongui 1001

  ViewVC Help
Powered by ViewVC 1.1.26