-
Notifications
You must be signed in to change notification settings - Fork 0
/
visualise.cmgui
157 lines (123 loc) · 7.77 KB
/
visualise.cmgui
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#gfx read elem ./output/Fluid/Fluid0.part0.exelem region FluidRegion;
#gfx read node ./output/Fluid/Fluid0.part0.exnode region FluidRegion;
#gfx read elem ./output/Solid/Solid0.part0.exelem region SolidRegion;
#gfx read node ./output/Solid/Solid0.part0.exnode region SolidRegion;
#gfx read elem ./output/Interface/Interface0.part0.exelem region Interface;
#gfx read node ./output/Interface/Interface0.part0.exnode region Interface;
$dt=1; # frequency
$steps=1000; # number of time steps
$cores=1; # number of processors
$w=1000; # width of the graphical window
$h=500; # height of the graphical window
#Read in the sequence of nodal positions.
for ($i=0;$i<$steps;$i=$i+$dt)
{
$time = $i/($dt)
for ($j=0;$j<$cores;$j=$j+1)
{
$filename = sprintf("./output/Fluid/Fluid%01d.part%01d.exnode", $i, $j);
print "Reading $filename time $time\n";
gfx read node "$filename" time $i region FluidRegion;
$filename = sprintf("./output/Solid/Solid%01d.part%01d.exnode", $i, $j);
print "Reading $filename time $time\n";
gfx read node "$filename" time $i region SolidRegion;
$filename = sprintf("./output/Interface/Interface%01d.part%01d.exnode", $i, $j);
print "Reading $filename time $time\n";
gfx read node "$filename" time $i region Interface;
}
}
#Read in the element description
for ($k=0;$k<$cores;$k=$k+1)
{
$filename = sprintf("./output/Fluid/Fluid0.part%01d.exelem", $k);
gfx read element "$filename" region FluidRegion;
$filename = sprintf("./output/Solid/Solid0.part%01d.exelem", $k);
gfx read element "$filename" region SolidRegion;
$filename = sprintf("./output/Interface/Interface0.part%01d.exelem", $k);
gfx read element "$filename" region Interface;
}
gfx define faces egroup FluidRegion
gfx define faces egroup SolidRegion
gfx define faces egroup Interface
#Create the graphics window and set view angles
gfx create window 1
gfx modify window 1 layout simple ortho_axes z -y eye_spacing 0.25 width $w height $h;
gfx modify window 1 view eye_point -0.1 0.0 -0.01 interest_point 0.0 0.0 0.15 up_vector 0.0 1.0 0.0 near_clipping_plane 0.0 far_clipping_plane 20.0
#Define the various fields
#gfx define field FluidRegion/FluidVelocities component FluidDependent.1 FluidDependent.2 FluidDependent.3
gfx define field FluidRegion/FluidVelocities_x component FluidDependent.1
gfx define field FluidRegion/FluidVelocities_y component FluidDependent.2
gfx define field FluidRegion/FluidVelocities_z component FluidDependent.3
gfx define field FluidRegion/FluidPressure component FluidDependent.4
gfx define field FluidRegion/FluidVelocityMagnitude magnitude field FluidVelocities
gfx define field SolidRegion/SolidDeformed component SolidDependent.1 SolidDependent.2 SolidDependent.3
gfx define field SolidRegion/SolidPressure component SolidDependent.4
gfx define field SolidRegion/SolidReaction component SolidTraction.1 SolidTraction.2 SolidTraction.3
gfx define field SolidRegion/SolidReactionMagnitude magnitude field SolidReaction
gfx define field Interface/Lagrange component InterfaceLagrange.1 InterfaceLagrange.2 InterfaceLagrange.3
gfx define field Interface/LagrangeMagnitude magnitude field Lagrange
#Create all the materials
gfx create material Solid normal_mode ambient 0.3 0.3 0.3 diffuse 0 0 0 emission 0 0 0 specular 0.3 0.3 0.3 shininess 0.2;
gfx create material TransparentSolid normal_mode ambient 0.3 0.3 0.3 diffuse 0 0 0 emission 0 0 0 specular 0.3 0.3 0.3 alpha 0.8 shininess 0.2;
#Create all the spectrums
gfx create spectrum FluidFlow
gfx modify spectrum FluidFlow clear overwrite_colour
gfx modify spectrum FluidFlow linear reverse range 0.0 0.50 extend_above extend_below rainbow colour_range 0 1
gfx create spectrum FluidPressure
gfx modify spectrum FluidPressure clear overwrite_colour
gfx modify spectrum FluidPressure linear reverse range 0.0 0.001 extend_above extend_below rainbow colour_range 0 1
gfx create spectrum SolidPressure
gfx modify spectrum SolidPressure clear overwrite_colour
gfx modify spectrum SolidPressure linear reverse range -0.25 0.20 extend_above extend_below rainbow colour_range 0 1
gfx create spectrum SolidReaction
gfx modify spectrum SolidReaction clear overwrite_colour
gfx modify spectrum SolidReaction linear reverse range 0.0 1.00 extend_above extend_below rainbow colour_range 0 1
gfx create spectrum Lagrange
gfx modify spectrum Lagrange clear overwrite_colour
gfx modify spectrum Lagrange linear reverse range 0.0 5.0 extend_above extend_below rainbow colour_range 0 1
#Display lines
gfx modify g_element FluidRegion lines coordinate FluidGeometry
gfx modify g_element SolidRegion lines coordinate SolidGeometry
#Display flow glyphs
gfx modify g_element FluidRegion node_points glyph arrow_solid general size "0.003*0.003*0.003" centre 0,0,0 font default orientation FluidVelocities select_on material default data FluidVelocityMagnitude scale_factors "0.01*0.005*0.005" selected_material default_selected spectrum FluidFlow
#Display fluid pressure on the solid
gfx modify g_element FluidRegion surfaces exterior select_on material default data FluidPressure spectrum FluidPressure selected_material default_selected render_shaded;
#Display deformed solid lines
#gfx modify g_element SolidRegion lines coordinate SolidDeformed material red
#Display deformed solid outer surface
#gfx modify g_element SolidRegion surfaces coordinate SolidDeformed select_on material default selected_material default_selected render_shaded;
#gfx modify g_element SolidRegion surfaces coordinate SolidDeformed exterior face xi3_1 select_on material TransparentSolid selected_material default_selected render_shaded;
#Display solid hydrostatic pressure
#gfx modify g_element SolidRegion surfaces coordinate SolidDeformed select_on material default data SolidPressure spectrum SolidPressure selected_material default_selected render_shaded;
#Display solid reactions
#gfx modify g_element SolidRegion node_points glyph arrow_solid general size "0.05*0.05*0.05" centre 0,0,0 font default orientation SolidReaction select_on material default data SolidReactionMagnitude scale_factors "0.05*0.01*0.01" selected_material default_selected spectrum SolidReaction
#Display Lagrange surface
#gfx modify g_element Interface surfaces select_on material default data LagrangeMagnitude selected_material default_selected spectrum Lagrange
#Display Lagrange glyphs
#gfx modify g_element Interface node_points glyph arrow_solid general size "0.05*0.05*0.05" centre 0,0,0 font default orientation Lagrange select_on material default data LagrangeMagnitude scale_factors "0.05*0.01*0.01" selected_material default_selected spectrum Lagrange
#Write out the first frame
#$jpgFilename = "./output/HeartTube_0.jpg"
#print "Writing $jpgFilename\n";
#gfx print window 1 jpg file "$jpgFilename" height 1000 width 2000
#Set the timekeeper playing
gfx timekeeper default set 1.0;
gfx timekeeper default speed 1;
gfx create time_editor
#Read in the sequence of nodal positions.
#for($i=0; $i < 108; $i=$i+1)
# {
# $fluidFilename = sprintf("./output/Fluid/Fluid%d.part0.exnode", $i);
# $solidFilename = sprintf("./output/Solid/Solid%d.part0.exnode", $i);
# $interfaceFilename = sprintf("./output/Interface/Interface%d.part0.exnode", $i);
# print "Reading $fluidFilename time $i\n";
# gfx read node "$fluidFilename" region FluidRegion
# print "Reading $solidFilename time $i\n";
# gfx read node "$solidFilename" region SolidRegion
# print "Reading $interfaceFilename time $i\n";
# gfx read node "$interfaceFilename" region Interface
# $jpgFilename = sprintf("./output/HeartTube_%d.jpg", $i);
# print "Writing $jpgFilename\n";
# gfx print window 1 jpg file "$jpgFilename" height 1000 width 2000
# }
gfx edit scene
gfx edit spectrum