[1464] | 1 | |
---|
| 2 | # Example of using unirect2d meshes in a field object in Rappture. |
---|
| 3 | |
---|
| 4 | package require Rappture |
---|
| 5 | |
---|
| 6 | |
---|
| 7 | # Open an XML run file to write into |
---|
| 8 | set driver [Rappture::library [lindex $argv 0]] |
---|
| 9 | |
---|
| 10 | # Create 3 "field" objects to display the different flows. |
---|
| 11 | |
---|
| 12 | set f1 output.field(jwire) |
---|
| 13 | set f2 output.field(half) |
---|
| 14 | set f3 output.field(si02) |
---|
| 15 | |
---|
| 16 | set 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 | $f2.about.label "Flow 2d half" |
---|
| 66 | $f2.component.flow.axis z |
---|
| 67 | $f2.component.flow.position 0% |
---|
| 68 | $f2.component.flow.volume yes |
---|
| 69 | $f2.component.flow.streams no |
---|
| 70 | $f2.component.flow.outline no |
---|
| 71 | $f2.component.flow.particles(left).axis x |
---|
| 72 | $f2.component.flow.particles(left).color yellow |
---|
| 73 | $f2.component.flow.particles(left).position 10% |
---|
| 74 | $f2.component.flow.particles(right).axis x |
---|
| 75 | $f2.component.flow.particles(right).color pink |
---|
| 76 | $f2.component.flow.particles(right).position 90% |
---|
| 77 | $f2.component.style "-color rainbow -levels 6 -opacity 1" |
---|
| 78 | $f2.camera.position { |
---|
[3484] | 79 | qw 1 qx 0 qy 0 qz 0 pan-x 0 pan-y 0 zoom 1.0 |
---|
[1464] | 80 | } |
---|
[1943] | 81 | $f2.component.extents 2 |
---|
[1464] | 82 | $f2.component.mesh unirect2d(half) |
---|
| 83 | unirect2d(half).xaxis.min -0.5 |
---|
| 84 | unirect2d(half).xaxis.max 152 |
---|
| 85 | unirect2d(half).xaxis.numpoints 305 |
---|
| 86 | unirect2d(half).yaxis.min -22 |
---|
| 87 | unirect2d(half).yaxis.max 21.6 |
---|
| 88 | unirect2d(half).yaxis.numpoints 109 |
---|
| 89 | $f3.about.label "SiO2" |
---|
[3942] | 90 | $f3.about.view "flowvis" |
---|
[1464] | 91 | $f3.component.flow.axis z |
---|
| 92 | $f3.component.flow.position 0% |
---|
| 93 | $f3.component.flow.volume yes |
---|
| 94 | $f3.component.flow.streams no |
---|
| 95 | $f3.component.flow.outline no |
---|
| 96 | $f3.component.flow.particles(left).axis x |
---|
| 97 | $f3.component.flow.particles(left).color lightgreen |
---|
| 98 | $f3.component.flow.particles(left).position 10% |
---|
| 99 | $f3.component.flow.particles(right).axis x |
---|
| 100 | $f3.component.flow.particles(right).color khaki |
---|
| 101 | $f3.component.flow.particles(right).position 90% |
---|
| 102 | $f3.component.style "-color blue:red -levels 6 -opacity 1" |
---|
[3938] | 103 | $f3.component.elemtype vectors |
---|
| 104 | $f3.component.elemsize 3 |
---|
[3937] | 105 | $f3.component.mesh output.mesh(sio2) |
---|
| 106 | output.mesh(sio2).about.label "SiO2" |
---|
| 107 | output.mesh(sio2).dim 3 |
---|
| 108 | output.mesh(sio2).units "um" |
---|
| 109 | output.mesh(sio2).hide yes |
---|
| 110 | output.mesh(sio2).grid.xaxis.min 0 |
---|
| 111 | output.mesh(sio2).grid.xaxis.max 29.75206608 |
---|
| 112 | output.mesh(sio2).grid.xaxis.numpoints 121 |
---|
| 113 | output.mesh(sio2).grid.yaxis.min -1.5 |
---|
| 114 | output.mesh(sio2).grid.yaxis.max 2.82 |
---|
| 115 | output.mesh(sio2).grid.yaxis.numpoints 25 |
---|
| 116 | output.mesh(sio2).grid.zaxis.min -1 |
---|
| 117 | output.mesh(sio2).grid.zaxis.max 4.304347828 |
---|
| 118 | output.mesh(sio2).grid.zaxis.numpoints 23 |
---|
[1464] | 119 | }] |
---|
| 120 | |
---|
| 121 | puts stdout "Setting attributes..." |
---|
| 122 | flush stdout |
---|
| 123 | foreach {key value} $elements { |
---|
| 124 | $driver put $key $value |
---|
| 125 | } |
---|
| 126 | |
---|
| 127 | source demo1/data-unirect3d.tcl |
---|
| 128 | $driver put $f1.component.values $values |
---|
| 129 | |
---|
| 130 | source demo2/data-unirect2d.tcl |
---|
| 131 | $driver put $f2.component.values $values |
---|
| 132 | |
---|
[3937] | 133 | #source demo3/data-dx.tcl |
---|
| 134 | #set data [Rappture::encoding::encode -as zb64 "<DX>$dx"] |
---|
| 135 | #$driver put $f3.component.dx $data |
---|
[1464] | 136 | |
---|
[3937] | 137 | source demo3/data-values.tcl |
---|
| 138 | $driver put $f3.component.values $values |
---|
| 139 | |
---|
[1464] | 140 | # save the updated XML describing the run... |
---|
| 141 | Rappture::result $driver |
---|
| 142 | puts stdout "done" |
---|
| 143 | flush stdout |
---|
| 144 | exit 0 |
---|
| 145 | |
---|