/[escript]/trunk/pyvisi/test/python/gen_data.py
ViewVC logotype

Contents of /trunk/pyvisi/test/python/gen_data.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1067 - (show annotations)
Wed Mar 28 04:14:13 2007 UTC (13 years, 4 months ago) by jongui
File MIME type: text/x-python
File size: 1760 byte(s)
Added some test for the datacollector, map and scene modules.
1 # $Id:$
2 #
3 # simple script to generate some test data for pyvisi
4 #
5
6 __copyright__=""" Copyright (c) 2006 by ACcESS MNRF
7 http://www.access.edu.au
8 Primary Business: Queensland, Australia"""
9 __license__="""Licensed under the Open Software License version 3.0
10 http://www.opensource.org/licenses/osl-3.0.php"""
11 from esys.escript import *
12 from esys.escript.pdetools import Projector
13 from esys import finley
14 #
15 #
16 #
17 DIM=2
18 L0=3
19 L1=3.
20 L2=1.
21 #NE0=15
22 #NE1=int(NE0/L0*L1)
23 #NE2=int(NE0/L0*L2)
24 NE0=3
25 NE1=3
26 NE2=3
27 #
28 # generate domains:
29 #
30 for DIM in [2,3]:
31 if DIM == 2:
32 domain=finley.Rectangle(NE0,NE1,1,l0=L0,l1=L1)
33 trafo=numarray.array([[0.,1.],[-1.,0.]])
34 cen=numarray.array([L0/2.,L1/2.])
35 else:
36 domain=finley.Brick(NE0,NE1,NE2,1,l0=L0,l1=L1,l2=L2)
37 trafo=numarray.array([[0.,1.,0.],[-1.,0.,0.],[0.,0.,1.]])
38 cen=numarray.array([L0/2.,L1/2.,L2/2.])
39 pp=Projector(domain)
40 #
41 # get function spaces:
42 #
43 c=ContinuousFunction(domain)
44 f=Function(domain)
45 b=FunctionOnBoundary(domain)
46 #
47 # get coordinates
48 #
49 c_x=c.getX()-cen
50 c_r=length(c_x)
51 c_t=matrix_mult(trafo,c_x/(c_r+1.e-15))
52
53 f_x=f.getX()-cen
54 f_r=length(f_x)
55
56 b_x=b.getX()-cen
57 b_r=length(b_x)
58 #
59 #
60 #
61 saveVTK("interior_%dD.xml"%DIM,temperature=sin(2*c_r),temperature_cell=sin(2*f_r), \
62 velocity=matrix_mult(trafo,c_x/(c_r+1.e-15)), velocity_cell=matrix_mult(trafo,f_x/f_r), \
63 stress=pp(grad(c_t)), \
64 stress_cell=grad(c_t))
65 saveVTK("boundary_%dD.xml"%DIM,temperature=sin(b_r),velocity=matrix_mult(trafo,b_x/(b_r+1.e-15)), \
66 stress=grad(c_t,b))

  ViewVC Help
Powered by ViewVC 1.1.26