forked from smowlavi/CoherentStructures
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hyperbolic_ABC.py
47 lines (39 loc) · 1.51 KB
/
hyperbolic_ABC.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
"""
An example demonstrating the computation of forward hyperbolic LCSs in a 3D
system, the ABC flow. In order to reduce the computational time, we only
consider trajectories initialized in slabs of thickness 0.2*pi at the planes
x=0, y=0, and z=2*pi.
"""
import numpy as np
import matplotlib.pyplot as plt
import scipy.io as sio
from functions.hyperbolic import HyperbolicLCS_3D
if __name__ == "__main__":
SavePath = './data/'
SaveName = 'hyperbolic_ABC'
# Parameters
direction = 'forward'
eps = 0.4
# Load data
data = sio.loadmat(SavePath+SaveName)
xP, yP, zP, tv = data['xP'], data['yP'], data['zP'], data['tv'].flatten()
# Compute forward hyperbolic LCS
FTLE = HyperbolicLCS_3D(xP,yP,zP,tv,direction,eps)
# Plot results
ind = np.flatnonzero((xP[:,0]>=0) & (xP[:,0]<=2*np.pi) &
(yP[:,0]>=0) & (yP[:,0]<=2*np.pi) &
(zP[:,0]>=0) & (zP[:,0]<=2*np.pi))
fig = plt.figure(figsize=[5,4])
ax = plt.axes(projection='3d',azim=230,elev=30)
sc = ax.scatter3D(xP[ind,0],yP[ind,0],zP[ind,0],s=6,c=FTLE[ind],cmap='jet',vmin=0,vmax=0.28)
fig.colorbar(sc, ax=ax, ticks=np.arange(0,0.28,0.07), extend='both')
ax.use_sticky_edges = True
ax.set_xlim([0,2*np.pi])
ax.set_ylim([0,2*np.pi])
ax.set_zlim([0,2*np.pi])
ax.set_xlabel('$x$')
ax.set_ylabel('$y$')
ax.set_ylabel('$z$')
ax.set_title('%s FTLE from t0 = %g to tf = %g \nwith eps = %g'
% (direction,tv[0],tv[-1],eps))
plt.show()