-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathexample
More file actions
68 lines (53 loc) · 1.54 KB
/
example
File metadata and controls
68 lines (53 loc) · 1.54 KB
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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 4 09:27:01 2018
@author: nhamilto
@contact: nicholas.hamilton@nrel.gov
@version: v.0.1
"""
import numpy as np
import matplotlib.pyplot as plt
import h5py
import sys
sys.path.append('/Users/nhamilto/Documents/FlowTools')
import flowtools as ft
#from flowtools import FlowField
def clall():
plt.close('all')
def minmax(data):
minval = np.min(data)
maxval = np.max(data)
print('min:', minval)
print('max:', maxval)
#%% load data and make dictionaries for velocity and coordinates
indat = h5py.File('testdata2.mat')
u = np.asarray(indat['u'])
v = np.asarray(indat['v'])
w = np.asarray(indat['w'])
z = np.asarray(indat['z'])
y = np.asarray(indat['y'])
timevec = np.asarray(indat['t'])
u = u.swapaxes(0,-1)
v = v.swapaxes(0,-1)
w = w.swapaxes(0,-1)
velocities = {'u': u,
'v': v,
'w': w}
y, z = np.meshgrid(y, z)
coordinates = {'y': y,
'z': z,
't': timevec}
#%%
flowtest = ft.FlowField(velocities, coordinates)
flowtest.mean_flow()
flowtest.turbulent_stresses()
ft.snapshot_POD.decompose(flowtest)
fig = ft.snapshot_POD.check_lam(flowtest)
ft.snapshot_POD.calc_coefficients(flowtest)
fig, ax = ft.snapshot_POD.coeff_plot(flowtest)
ft.snapshot_POD.recompose_rst(flowtest)
flowtest.who()
fig, axs = ft.vis.rst_contours(flowtest, ['z', 'y'], flowtest.rst, commonscale = False)
fig, axs = ft.vis.rst_contours(flowtest, ['z', 'y'], flowtest.POD['rst'], commonscale = False)
ft.snapshot_POD.recompose_flucfield(flowtest)