-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmovie_press.py
executable file
·86 lines (51 loc) · 1.45 KB
/
movie_press.py
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
#!/usr/bin/python
import matplotlib.pyplot as plt
import numpy as np
#import matplotlib.cm as cm
#from matplotlib.colors import Normalize
import sys
#print "This is the name of the script: ", sys.argv[0]
#print "Number of arguments: ", len(sys.argv)
#print "The arguments are: " , str(sys.argv)
if(len(sys.argv) == 1) :
init_t = 0
else:
init_t = int( sys.argv[1] )
#import pylab as pl
plt.figure(figsize=(8,8))
skip=1
#path='timings_full/'
path='./'
LL= 1
omega = 2 * np.pi / (10 * 0.005)
print('omega = ' , omega)
def pp(r) : # analytic solution for Gresho's vortex pressure
r0 = 0.2
x = r/r0
if( x < 1) : return 5/2 - 4*np.log(2) + (x**2 -1)/2
if( x < 2) : return 4*np.log(x/2) - 4*(x-2) + (x**2 - 4)/2
return 0;
v_pp = np.vectorize( pp )
plt.figure(figsize=(8,8))
for n in range( init_t ,2000000+skip,skip):
strn = str(n)
plt.clf()
dt=np.loadtxt(path + strn +'/particles.dat')
x=dt[:,0]; y=dt[:,1];
# vol=dt[:,3]
w=dt[:,4];
# vx=dt[:,5]; vym=dt[:,6];
p=dt[:,9]
# s=dt[:,10]
# I=dt[:,11];
p = 0.5*omega**2 * w
r = np.sqrt( x**2 + y**2 )
#make furthest pressure value 0
rm = np.argmax(r)
p -= p[ rm ] # np.min( p )
plt.plot( r , p , 'o' )
rr = np.linspace( 0 , max(r) , 200 )
plt.plot( rr , v_pp(rr) )
print( 'pressure_{:03d}'.format( int(n/skip) ) )
plt.savefig( 'pressure_{:03d}'.format( int(n/skip) ) )
# plt.show()