source: trunk/examples/flow/flowtest.tcl @ 1943

Last change on this file since 1943 was 1943, checked in by gah, 10 years ago

add unit cell to molvisviewer

File size: 4.5 KB
Line 
1
2# Example of using unirect2d meshes in a field object in Rappture.
3
4package require Rappture
5
6
7# Open an XML run file to write into
8set driver [Rappture::library [lindex $argv 0]]
9
10# Create 3 "field" objects to display the different flows.
11
12set f1 output.field(jwire)
13set f2 output.field(half)
14set f3 output.field(si02)
15
16set elements [subst {
17    $f1.about.label "Jwire example"
18    $f1.component.flow.label "Flow 1"
19    $f1.component.flow.axis z
20    $f1.component.flow.position 0%
21    $f1.component.flow.volume yes
22    $f1.component.flow.streams no
23    $f1.component.flow.outline no
24    $f1.component.flow.particles(left).label "Left particle flow"
25    $f1.component.flow.particles(left).description {
26        Lorem ipsum dolor sit amet, consectetur adipiscing elit.
27    }
28    $f1.component.flow.particles(left).axis x
29    $f1.component.flow.particles(left).color lightgreen
30    $f1.component.flow.particles(left).position 10%
31    $f1.component.flow.particles(right).label "Right particle flow"
32    $f1.component.flow.particles(right).description {
33        Cras elit eros,
34        ultricies vel, auctor nec, iaculis interdum, lectus. Vivamus lorem diam,
35        posuere nec, cursus ut, tempus in, tortor. Sed est eros, faucibus eu,
36        pellentesque quis, pharetra venenatis, massa.
37    }
38    $f1.component.flow.particles(right).axis x
39    $f1.component.flow.particles(right).color khaki
40    $f1.component.flow.particles(right).position 90%
41    $f1.component.style  "-color blue:red -levels 6 -opacity 1"
42    $f1.component.flow.box(one).label "Region 1"
43    $f1.component.flow.box(one).color cyan
44    $f1.component.flow.box(one).corner(1) "0 -100 -100"
45    $f1.component.flow.box(one).corner(2) "3000 400 400"
46    $f1.component.flow.box(two).label "Region 2"
47    $f1.component.flow.box(two).color violet
48    $f1.component.flow.box(two).corner(1) "1000 -150 -100"
49    $f1.component.flow.box(two).corner(2) "3000 3000 3000"
50    $f1.component.flow.box(three).label "Region 3"
51    $f1.component.flow.box(three).color magenta
52    $f1.component.flow.box(three).corner(1) "1000 -150 -100"
53    $f1.component.flow.box(three).corner(2) "2000 450 450"
54    $f1.component.extents 3
55    $f1.component.mesh unirect3d(jwire)
56    unirect3d(jwire).xaxis.min  0
57    unirect3d(jwire).xaxis.max  6300
58    unirect3d(jwire).xaxis.numpoints  126
59    unirect3d(jwire).yaxis.min  0
60    unirect3d(jwire).yaxis.max  1500
61    unirect3d(jwire).yaxis.numpoints  30
62    unirect3d(jwire).zaxis.min  0
63    unirect3d(jwire).zaxis.max  1519.05
64    unirect3d(jwire).zaxis.numpoints  22
65    unirect3d(jwire).components 3
66    $f2.about.label "Flow 2d half"
67    $f2.component.flow.axis z
68    $f2.component.flow.position 0%
69    $f2.component.flow.volume yes
70    $f2.component.flow.streams no
71    $f2.component.flow.outline no
72    $f2.component.flow.particles(left).axis x
73    $f2.component.flow.particles(left).color yellow
74    $f2.component.flow.particles(left).position 10%
75    $f2.component.flow.particles(right).axis x
76    $f2.component.flow.particles(right).color pink
77    $f2.component.flow.particles(right).position 90%
78    $f2.component.style  "-color rainbow -levels 6 -opacity 1"
79    $f2.camera.position {
80        theta 90 phi 0 psi 0 pan-x 0 pan-y 0 zoom 1.0
81    }
82    $f2.component.extents 2
83    $f2.component.mesh unirect2d(half)
84    unirect2d(half).xaxis.min   -0.5
85    unirect2d(half).xaxis.max   152
86    unirect2d(half).xaxis.numpoints  305
87    unirect2d(half).yaxis.min   -22
88    unirect2d(half).yaxis.max   21.6
89    unirect2d(half).yaxis.numpoints  109
90    unirect2d(half).components 2
91    $f3.about.label "SiO2"
92    $f3.component.flow.axis z
93    $f3.component.flow.position 0%
94    $f3.component.flow.volume yes
95    $f3.component.flow.streams no
96    $f3.component.flow.outline no
97    $f3.component.flow.particles(left).axis x
98    $f3.component.flow.particles(left).color lightgreen
99    $f3.component.flow.particles(left).position 10%
100    $f3.component.flow.particles(right).axis x
101    $f3.component.flow.particles(right).color khaki
102    $f3.component.flow.particles(right).position 90%
103    $f3.component.style  "-color blue:red -levels 6 -opacity 1"
104    $f3.component.extents 3
105}]
106
107puts stdout "Setting attributes..."
108flush stdout
109foreach {key value} $elements {
110    $driver put $key $value
111}
112
113source demo1/data-unirect3d.tcl
114$driver put $f1.component.values $values
115
116source demo2/data-unirect2d.tcl
117$driver put $f2.component.values $values
118
119source demo3/data-dx.tcl
120set data [Rappture::encoding::encode -as zb64 "<DX>$dx"]
121$driver put $f3.component.dx $data
122
123# save the updated XML describing the run...
124Rappture::result $driver
125puts stdout "done"
126flush stdout
127exit 0
128
Note: See TracBrowser for help on using the repository browser.