-
Notifications
You must be signed in to change notification settings - Fork 0
/
plotstresstime.py
65 lines (48 loc) · 1.3 KB
/
plotstresstime.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
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
from matplotlib.ticker import LinearLocator
import pickle
from scipy.special import roots_legendre
Reynolds = 360
expir = 'OSC'
if Reynolds == 170:
Re_bulk = 5000
elif Reynolds == 360:
Re_bulk = 11700
else:
Re_bulk = 25800
utau = 2*Reynolds/Re_bulk
if expir == 'STD':
nphases = 1
nfpf = 3200
elif expir == 'OSC':
nphases = 32
nfpf = 100
ntot = nfpf*nphases
ptemp = 'RE{0}/RE{0}_{1}_{2}_{3}.pkl'
for ph in range(nphases):
for fi in range(1,nfpf+1):
pname = ptemp.format(Reynolds,expir,ph,fi)
with open(pname,'rb') as f:
data = pickle.load(f)
data = data[0]
if ph == 0 and fi == 1:
nf,ny = data.shape
tdata = np.zeros((ntot,nf,ny))
ind = (fi-1)*nphases + ph
tdata[ind] = data
r,w = roots_legendre(ny)
r = (1-(r+1)/2)*Reynolds
t = np.linspace(1,ntot,ntot)*1
R,T = np.meshgrid(r,t,indexing='xy')
f,a = plt.subplots(constrained_layout=True,figsize=(8,4))
pdata = tdata[:,7,:]/(utau**2)
z_max = 1.1*np.amax(pdata)
z_min = 1.1*np.amin(pdata)
cf = a.contourf(T,R,pdata,cmap=cm.coolwarm,linewidth=0)
cb = f.colorbar(cf,shrink=0.5,aspect=5)
#a.set_yscale('log')
a.set_ylim(1,Reynolds)
#a.set_xlim(t[0],t[-1]/4)
plt.show()