Skip to content

Commit 0cf3351

Browse files
committed
initial commit
1 parent b481ce5 commit 0cf3351

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+20463
-0
lines changed

angle90.py

Lines changed: 240 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,240 @@
1+
xsize=500
2+
ysize=400
3+
num=3
4+
#SetWindowArea(400, 0, num*(xsize+100), num*ysize)
5+
6+
import math
7+
#OpenDatabase("mri3d.vtk")
8+
OpenDatabase("localhost:./data.*.vtk database", 0)
9+
10+
pi=math.pi
11+
theta=-math.pi/2.0
12+
sliceq1 = math.cos(theta)
13+
sliceq2 = math.sin(theta)
14+
DefineScalarExpression("pi", "3.141592")
15+
DefineScalarExpression("theta", "%f" %theta)
16+
17+
18+
19+
20+
21+
# Begin spontaneous state
22+
View3DAtts = View3DAttributes()
23+
View3DAtts.viewNormal = (0.596332, -0.781887, 0.181771)
24+
View3DAtts.focus = (1, 1, 1)
25+
View3DAtts.viewUp = (-0.145957, 0.117053, 0.982342)
26+
View3DAtts.viewAngle = 30
27+
View3DAtts.parallelScale = 1.73205
28+
View3DAtts.nearPlane = -3.4641
29+
View3DAtts.farPlane = 3.4641
30+
View3DAtts.imagePan = (0, 0)
31+
View3DAtts.imageZoom = 1
32+
View3DAtts.perspective = 1
33+
View3DAtts.eyeAngle = 2
34+
View3DAtts.centerOfRotationSet = 0
35+
View3DAtts.centerOfRotation = (1, 1, 1)
36+
View3DAtts.axis3DScaleFlag = 0
37+
View3DAtts.axis3DScales = (1, 1, 1)
38+
View3DAtts.shear = (0, 0, 1)
39+
SetView3D(View3DAtts)
40+
# End spontaneous state
41+
42+
43+
44+
n=0
45+
theta=0.0
46+
thetastr="0.0"
47+
titlestr = "vx"
48+
def func (theta,state, unused2):
49+
thetastr=str(theta)
50+
thetaanglestr=str(theta*180/math.pi)
51+
titlestr="Vorticity Projected (h,z) , angle="+thetaanglestr[0:6]+", t=$cycle orbits"
52+
text = CreateAnnotationObject("Text2D")
53+
text.visible = 1
54+
text.active = 1
55+
text.position = (0.2, 0.88)
56+
text.text=titlestr
57+
text.textColor = (0, 0, 0, 255)
58+
text.useForegroundForTextColor = 1
59+
text.fontFamily = text.Times # Arial, Courier, Times
60+
text.fontBold = 0
61+
text.fontItalic = 0
62+
text.fontShadow = 0
63+
AnnotationAtts = AnnotationAttributes()
64+
AnnotationAtts.databaseInfoFlag = 0
65+
AnnotationAtts.userInfoFlag = 0
66+
SetAnnotationAttributes(AnnotationAtts)
67+
sliceq1 = math.sin(theta)
68+
sliceq2 = math.cos(theta)
69+
DefineScalarExpression("x", "coord(mesh)[0]")
70+
DefineScalarExpression("y", "coord(mesh)[1]")
71+
DefineScalarExpression("z", "coord(mesh)[2]")
72+
DefineScalarExpression("sbq", "1.5")
73+
DefineScalarExpression("sbomega", "1e-3")
74+
DefineScalarExpression("sba", "-0.5*sbq*sbomega")
75+
DefineScalarExpression("vsh", "2.0*sba")
76+
DefineScalarExpression("vshear", "vsh*x")
77+
DefineScalarExpression("amp", "5.444e-5*exp(0.75*state*sbomega)")
78+
amparr = [ ]
79+
for qq in range(30):
80+
amparr.append(0)
81+
amparr[9]=5.444e-5
82+
amparr[10]=0.0001138
83+
amparr[11]=0.0002354
84+
amparr[12]=0.0004782
85+
print "state", state
86+
ampdef=math.exp(.75*state)
87+
DefineScalarExpression("lx","2.0" )
88+
DefineScalarExpression("eps","1.0e-3" )
89+
DefineScalarExpression("scrh","lx*eps*sbomega/8.0" )
90+
DefineScalarExpression("amp",str(ampdef) )
91+
DefineScalarExpression("vmri", "amp*scrh*sin(2*pi*z)")
92+
# simulation variables
93+
DefineScalarExpression("ufull", "3D_Velocity_Field[0]")
94+
DefineScalarExpression("u", "3D_Velocity_Field[0]-vmri")
95+
DefineScalarExpression("v", "(3D_Velocity_Field[1]-vshear-vmri)")
96+
DefineScalarExpression("w", "3D_Velocity_Field[2]")
97+
DefineVectorExpression("velocity", "{u,v,w}")
98+
DefineScalarExpression("bx", "3D_Magnetic_Field[0]")
99+
DefineScalarExpression("by", "3D_Magnetic_Field[1])")
100+
DefineScalarExpression("bz", "3D_Magnetic_Field[2]")
101+
DefineVectorExpression("b", "3D_Magnetic_Field")
102+
# test variables
103+
#DefineScalarExpression("u", "-cos(pi*z)*sin(pi*x)")
104+
#DefineScalarExpression("v", "0*sin(pi*z)*cos(pi*x)")
105+
#DefineScalarExpression("w", "sin(pi*z)*cos(pi*x)")
106+
#DefineScalarExpression("v", "vshear")
107+
DefineScalarExpression("vel_mag", "magnitude(velocity)")
108+
DefineVectorExpression("curlv", "curl(velocity)")
109+
DefineScalarExpression("curlvx", "curlv[0]")
110+
DefineScalarExpression("curlvy", "curlv[1]")
111+
DefineScalarExpression("curlvz", "curlv[2]")
112+
DefineScalarExpression("phi", "pi/2.0")
113+
DefineScalarExpression("theta", thetastr)
114+
DefineScalarExpression("cos_theta", "cos(theta)*point_constant(mesh, 1.)")
115+
DefineScalarExpression("sin_theta", "sin(theta)*point_constant(mesh, 1.)")
116+
DefineScalarExpression("kz", "0*point_constant(mesh, 1.)")
117+
DefineVectorExpression("kh", "{cos_theta,sin_theta,kz}")
118+
DefineVectorExpression("kperp", "{-sin_theta,cos_theta,kz}")
119+
DefineScalarExpression("vortproj", "dot(curlv,kperp)")
120+
DefineScalarExpression("uhp", "dot(velocity,kh)")
121+
DefineScalarExpression("vhp", "dot(velocity,kperp)")
122+
DefineVectorExpression("velproj", "{uhp,vhp,w}")
123+
DefineScalarExpression("testvortproj", "curl(velproj)")
124+
#AddPlot("Pseudocolor", "vortproj", 1, 1)
125+
DeleteAllPlots()
126+
DeleteActivePlots()
127+
AddPlot("Pseudocolor", "curlvy", 1, 1)
128+
RemoveLastOperator()
129+
AddOperator("Slice", 0)
130+
SliceAtts = SliceAttributes()
131+
SliceAtts.originType = SliceAtts.Point # Point, Intercept, Percent, Zone, Node
132+
SliceAtts.originPoint = (0.0, 0.0, 0.0)
133+
SliceAtts.originIntercept = 0
134+
SliceAtts.originPercent = 0
135+
SliceAtts.originZone = 0
136+
SliceAtts.originNode = 0
137+
SliceAtts.normal = (sliceq1,sliceq2 , 0)
138+
SliceAtts.axisType = SliceAtts.Arbitrary # XAxis, YAxis, ZAxis, Arbitrary, ThetaPhi
139+
SliceAtts.upAxis = (0, 0, 1)
140+
SliceAtts.project2d = 0
141+
SliceAtts.interactive = 1
142+
SliceAtts.flip = 0
143+
SliceAtts.originZoneDomain = 0
144+
SliceAtts.originNodeDomain = 0
145+
SliceAtts.meshName = "mesh"
146+
SliceAtts.theta = 0
147+
SliceAtts.phi = 0
148+
SetOperatorOptions(SliceAtts, 1)
149+
SetOperatorOptions(SliceAtts, 1)
150+
DrawPlots()
151+
ToggleLockViewMode()
152+
ToggleLockTime()
153+
v=0
154+
AddPlot("Vector", "velproj", 1, 1)
155+
VectorAtts = VectorAttributes()
156+
VectorAtts.glyphLocation = VectorAtts.AdaptsToMeshResolution # AdaptsToMeshResolution, UniformInSpace
157+
VectorAtts.useStride = 0
158+
VectorAtts.stride = 1
159+
VectorAtts.nVectors = 600
160+
VectorAtts.lineStyle = VectorAtts.SOLID # SOLID, DASH, DOT, DOTDASH
161+
VectorAtts.lineWidth = 0
162+
VectorAtts.scale = 0.25
163+
VectorAtts.scaleByMagnitude = 1
164+
VectorAtts.autoScale = 1
165+
VectorAtts.headSize = 0.25
166+
VectorAtts.headOn = 1
167+
VectorAtts.colorByMag = 0
168+
VectorAtts.useLegend = 1
169+
VectorAtts.vectorColor = (255, 255, 255, 255)
170+
VectorAtts.colorTableName = "Default"
171+
VectorAtts.invertColorTable = 0
172+
VectorAtts.vectorOrigin = VectorAtts.Tail # Head, Middle, Tail
173+
VectorAtts.minFlag = 0
174+
VectorAtts.maxFlag = 0
175+
VectorAtts.limitsMode = VectorAtts.OriginalData # OriginalData, CurrentPlot
176+
VectorAtts.min = 0
177+
VectorAtts.max = 1
178+
VectorAtts.lineStem = 1
179+
VectorAtts.geometryQuality = VectorAtts.Fast # Fast, High
180+
VectorAtts.stemWidth = 0.08
181+
VectorAtts.origOnly = 1
182+
VectorAtts.glyphType = VectorAtts.Arrow # Arrow, Ellipsoid
183+
VectorAtts.nVectors = 400
184+
SetPlotOptions(VectorAtts)
185+
DrawPlots()
186+
return v
187+
###
188+
189+
190+
incdeg=-math.pi/16.0
191+
unused1=0
192+
unused2=0
193+
194+
SetWindowLayout(4)
195+
SetActiveWindow(1)
196+
theta=4*incdeg
197+
state=0
198+
func (theta,state, unused2)
199+
SetActiveWindow(2)
200+
AddPlot("Pseudocolor", "vmri" )
201+
DrawPlots()
202+
ToggleLockViewMode()
203+
ToggleLockTime()
204+
SetActiveWindow(3)
205+
AddPlot("Pseudocolor", "ufull" )
206+
DrawPlots()
207+
ToggleLockViewMode()
208+
ToggleLockTime()
209+
SetActiveWindow(4)
210+
AddPlot("Pseudocolor", "u" )
211+
DrawPlots()
212+
ToggleLockViewMode()
213+
ToggleLockTime()
214+
215+
for state in range(1,20):
216+
#for state in range(TimeSliderGetNStates()):
217+
SetTimeSliderState(state)
218+
DeleteAllPlots()
219+
# for ywin in range(0,3):
220+
# for xwin in range(0,3):
221+
# win=xwin+1+(num)*(ywin+0)
222+
# print win
223+
# MoveWindow(win,400+xwin*(xsize),ywin*ysize)
224+
# ResizeWindow(win, xsize, ysize)
225+
#AddOperator("Slice", 1)
226+
SetActiveWindow(1)
227+
#theta=4*incdeg
228+
theta=0*incdeg
229+
func (theta,state, unused2)
230+
showufull=1
231+
232+
#SaveWindow()
233+
sw=SaveWindowAttributes()
234+
sw.saveTiled=1
235+
sw.progressive=1
236+
sw.family = 0
237+
sw.fileName = "vmri%03d" %(state)
238+
SetSaveWindowAttributes(sw)
239+
SaveWindow()
240+

0 commit comments

Comments
 (0)