/[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 1099 - (show annotations)
Tue Apr 17 01:45:08 2007 UTC (12 years, 5 months ago) by jongui
File MIME type: text/x-python
File size: 1376 byte(s)
Upated some examples.
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, Camera
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.OFFLINE_JPG, x_size = 500, y_size = 500)
34 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 #saveVTK("T.%d.xml"%i,temp=T)
44
45 dc.setData(temp = T)
46 Map(scene = s, data_collector = dc, viewport = Viewport.SOUTH_WEST,
47 lut = Lut.COLOR, cell_to_point = False, outline = True)
48
49 c = Camera(scene = s, data_collector = dc, viewport = Viewport.SOUTH_WEST)
50
51 s.render(image_name = "diffusion_%02d.jpg" % i)
52

  ViewVC Help
Powered by ViewVC 1.1.26