-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathathbary.pro
187 lines (145 loc) · 2.8 KB
/
athbary.pro
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
nfile=1
nend=200
nstart=nend
;nstart=1000
;nend=nstart+1
;nend=1170
;nstart=12
;nend=152
;nstart=61
;nend=68
sfile = 0
pfile = 0
sfile = FILE_TEST('v0000.vtk')
pfile = FILE_TEST('data.0000.dbl')
print, sfile, pfile
code='snoopy'
if (pfile eq 1 ) then begin
code='pluto'
nstart=nlast
nend=nstart
nstep=2000
endif
nfile = FILE_TEST('usr000000.h5')
if (nfile eq 1 ) then begin
code='nirvana'
nstart=790000
getlast, nstart
getlast, nstart
nend=nstart
nstep=2000
endif
afile = FILE_TEST('HKDisk.0000.vtk')
if (afile eq 1 ) then begin
COMMON SHARE1,nx,ny,nz,nvar,nscalars
COMMON SHARE2,x,y,z
COMMON SHARE3,time,dt,gamm1,isocs
COMMON SHARE4,d,e,p,vx,vy,vz,bx,by,bz,s,phi
code='athena'
nstart=5
nend=21
nstep=1
endif
vshear=1.0
for nfile=nstart,nend,nstep do begin
;code='snoopy'
case code OF
'nirvana': begin
nirvanaread2, rho, vx,vy, vz,bx,by,bz, xx3d,yy3d,zz3d,xx,yy,zz,nx,ny,nz,nfile, time
sbq=1.5
sbomega=1
sba=-0.5*sbq*sbomega
vsh=2*sba
vshear=vsh*xx3d
vy=vy;-vshear
end
'pluto': begin
plutoread, dens, vx,vy, vz,bx,by,bz, xx3d,yy3d,zz3d,xx,yy,zz,nx,ny,nz,nfile, time
sbq=1.5
sbomega=1
sba=-0.5*sbq*sbomega
vsh=2*sba
vshear=vsh*xx3d
vy=vy-vshear
break;
end
'snoopy':begin
snoopyread, vx,vy, vz,bx,by,bz, xx3d,yy3d,zz3d,xx,yy,zz,nx,ny,nz,nfile, time
sbq=1.5
sbomega=1
sba=-0.5*sbq*sbomega
vsh=2*sba
vshear=vsh*xx3d
;vy=vy+vshear
rho=vshear
rho(*,*,*)=1.0
end
'athena':begin
strnum=string(nfile, format='(I04)')
readvtk, 'HKDisk'+'.'+strnum+'.vtk', pfact
rho=d
end
end
kstart=nz/2
kend=nz*0.75
invii=fltarr(nx,nz)
inviii=fltarr(nx,nz)
for i=0,nx-1 do begin
for k=kstart,kend do begin
u1=0.0d
u2=0.0d
u3=0.0d
reyave=dblarr(3,3)
reyave(*,*)=0.0d
for j=0,ny-1 do begin
dens=rho(i,j,k)
u1=vx(i,j,k)
u2=vy(i,j,k)
u3=vz(i,j,k)
a=[u1,u2,u3]
rey=dens*(a#a)
reyave=reyave+rey
endfor
reyave=reyave/ny
reystressanisotropytensor, reyave,reyanis
eigenvalues = EIGENQL(reyanis)
l1=eigenvalues(0)
l2=eigenvalues(1)
l3=eigenvalues(2)
c1c=l1-l2
c2c=2*(l2-l3)
c3c=3*l3+1
x1c=-1.0
y1c=0.0
x3c=0.0
y3c=1.734
x2c=1.0
y2c=0.0
xn=c1c*x1c+ c2c*x2c +c3c*x3c
yn=c1c*y1c+ c2c*y2c +c3c*y3c
invii(i,k)=xn
inviii(i,k)=yn
;print, trace(rey)^2-trace(rey^2), det
;print, invii(i,j,k)
;print, rey(0,0), trace(rey^2), determ(rey)
endfor
endfor
print, mean(invii, /double), mean(inviii, /double), format='(F27.24, F27.24)'
;print, min(-invii), min(inviii)
;pdf=histogram(invii, locations=xbin,binsize=0.001)
;cgplot, xbin, pdf
;cgplot, inviii, -invii, psym=2
spawn, 'basename $PWD', dirtag
tag="banervh0"+string(nfile, format='(I07)')
tag2="Maxwell z0"
qtag=strmid(dirtag,1,2)
qq=fix(qtag)
q=qq[0]/10.
qstr="q="+string(q, format='(F4.1)')
tag2=qstr+' , '+'z/H=0'
tag2='global disk'
tag3=qstr+' , '+'z/H=0'
tag3='global disk, t='+string(nfile, format='(I7)')
histbaner, invii, inviii, nfile, tag, tag2, time, tag3
endfor
end