Example #1
0
# wakeDataDict = {} # 存储所有的原始尾流信息
f = open(
    projDir + 'postProcessing_all/' + caseName[case] + '_' + sec + '_wakeData',
    'rb')
wakeData_org = pickle.load(f)  # all wake information of the case
f.close()
timeList = list(wakeData_org.keys())
timeList.sort()
for time in timeList:
    wakeSec[time] = wakeData_org[time][sec]

secData = Sec(wakeSec)
del wakeData_org

secData_fd = secData.fSec_t(6, '18380')
secData_fd[:, 1:] = tM.trs(secData_fd[:, 1:])  # 第2列到第7列转换矩阵处理
secData_fd = SecITP(secData_fd)
secData_fd.meshITP_Nz((-378, 1512, 1890), (-252, 252, 504))
''' u contour for PlaneZ'''
x = {}
y = {}
z = {}
# 编织网格
dx, dy = 1, 1
x[case], y[case] = np.mgrid[slice(-378, 1512 + dx, dx),
                            slice(-252, 252 + dy, dy)]
x[case] = x[case].T
y[case] = y[case].T
# 向网格里填值
z[case] = np.array(zeros(shape(x[case])))
for row in secData_fd.meshData:
    1: 'probe2Dy',
    2: 'probe4Dy',
    3: 'probe6Dy',
    4: 'probe8Dy',
    5: 'probe10Dy'
}

probeData = {}  # original probeDataDict of all cases

for i in range(3):
    f = open(projDir + 'postProcessing_all/' + case[i] + '_probeData', 'rb')
    probeData[i] = pickle.load(f)  # all wake information of the case
    f.close()
''' end '''

M_ = tM.trs(probeData[0][probe[1]]['18240.0'])
y = M_[:, 1]
u_ave = {}  # 负责记录每个算例每个橫截面的速度廓线
tNum = {}
timeList = {}
for i in range(3):
    u_ave[i] = {}
    tNum[i] = {}
    timeList[i] = {}
    for j in range(6):
        u_ave[i][j] = np.zeros(y.shape)
        timeList[i][j] = list(probeData[i][probe[j]].keys())
        timeList[i][j].sort()
        tNum[i][j] = len(timeList[i][j])
for i in range(3):
    for j in range(6):
vz_ave = vz_ave / tNum
wv = (vx_ave**2 + vy_ave**2)**0.5
wd_rad = np.arcsin(vy_ave/vx_ave)
wd = wd_rad * 180/np.pi
z = probeData[0][timeList[0]][probeList[0]][:,2].reshape(vx_ave.shape, order='C')
# 拟合大气边界普朗特层对数率
z = z.reshape((z.shape[0]), order='C')
wv = wv.reshape((wv.shape[0]), order='C')
pp = fit.fit_ABL(0.7,0.4,0.001,z[:13],wv[:13]) # u*=0.4075
xp = fit.func_ABL(pp,0.4,0.001,z)

" 轮毂处速度时序 "
probeData_ = probeData # 转换坐标系
for t in timeList:
    for p in probeList:
        probeData_[0][t][p] = tM.trs(probeData[0][t][p])
v = np.zeros((tNum,1))
for i in range(tNum):
    v[i,0] = probeData_[0][timeList[i]][probe][7,3]

v = v[3000:-2996]
t = np.linspace(0,480,v.shape[0])
v = v.reshape(t.shape, order='C')

" 功率谱 "
v = v - np.mean(v)
seq = sgn.SignalSeq(v)
ps = seq.PSE_t_AM(50)
# 5/3律
x = np.linspace(0.01, 10, 2000)
y = x**(-5/3)
Example #4
0
u0_ave = np.array(u0_ave)  # 入流速度廓线
u_ave = {}  # 负责记录每个算例每个橫截面的速度廓线
tNum = {}
timeList = {}
for i in range(3):
    u_ave[i] = {}
    tNum[i] = {}
    timeList[i] = {}
    for j in range(6):
        u_ave[i][j] = np.zeros(z.shape)
        timeList[i][j] = list(probeData[i][probe[j]].keys())
        timeList[i][j].sort()
        tNum[i][j] = len(timeList[i][j])
for i in range(3):
    for j in range(6):
        for time in timeList[i][j]:
            M_ = tM.trs(probeData[i][probe[j]][time])
            u_ave[i][j] += M_[:, 3]
        u_ave[i][j] /= tNum[i][j]

cn = 2
plt.figure(figsize=(14, 6))
for j in range(6):
    plt.plot((u0_ave - u_ave[cn][j]) / u0_ave + j, z, 'ko-', linewidth=2)
plt.xticks([0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5],
           [0, 0.5, 0, 0.5, 0, 0.5, 0, 0.5, 0, 0.5, 0, 0.5])
plt.yticks([27, 90, 153, 216, 279, 342], [-1, 0, 1, 2, 3, 4])
plt.ylabel('r/R')
plt.grid()
plt.show()
wake_ave = {}  # wake 的时均(剥离了第二层的key,wake_ave[case]直接就是sec的矩阵)
wake_TI = {}
wake_ave_mesh = {}  # wake_ave 经转换矩阵处理后的网格化版本, SecITP 类
wake_TI_mesh = {}  # wake_TI 经转换矩阵处理后的网格化版本, SecITP 类
# wakeSec = {}
# secData = {}
''' assemble all the data of different secs in wakeDataDict '''
for case in range(2):
    wakeDataDict = {}  # 存储所有的原始尾流信息
    f = open(
        projDir + 'postProcessing_all/data.org/' + caseName[case] + '_' + sec +
        '_wakeData', 'rb')
    wakeData_org = pickle.load(f)  # all wake information of the case
    f.close()
    for t in list(wakeData_org.keys()):  # 将原始的流场信息转换到新坐标系
        wakeData_org[t][sec][:, 1:] = tM.trs(wakeData_org[t][sec][:, 1:])
    wake[case] = Wake(wakeData_org)
    del wakeData_org  # 汇总完了删除这个临时字典

for case in range(2):
    wake_ave[case] = wake[case].ave_wakeData()[sec]
    wake_TI[case] = wake[case].intensity()[sec]

    wake_ave_mesh[case] = SecITP(wake_ave[case])
    wake_ave_mesh[case].meshITP_Nx((-252, 252, 504), (0, 342, 342))
    wake_TI_mesh[case] = SecITP(wake_TI[case])
    wake_TI_mesh[case].meshITP_Nx((-252, 252, 504), (0, 342, 342))
''' u profile'''
x = {}
y = {}
u = {}
for cn in range(3):
    timeList[cn] = list(probeData[cn][prb].keys())
    timeList[cn].sort()
    tNum[cn] = len(timeList[cn])
    for i in range(12001, tNum[cn]):  # 删掉 480s 以后的时刻
        del timeList[cn][12001]
    tNum[cn] = len(timeList[cn])

wc = {}

prbData_ft = {}
for cn in range(3):
    prbData_ft[cn] = np.zeros(
        (tNum[cn], probeData[cn][prb]['18240.0'].shape[0]))
    for i in range(tNum[cn]):
        prbData_ft[cn][i, :] = tM.trs(probeData[cn][prb][timeList[cn][i]])[:,
                                                                           3]
    for j in range(prbData_ft[cn].shape[1]):
        prbData_ft[cn][:, j] = flt_seq(prbData_ft[cn][:, j], 75)

p = tM.trs(probeData[cn][prb]['18240.0'])[:, 1]

for cn in range(3):
    wc[cn] = np.zeros((tNum[cn], 2))
    wc[cn][:, 0] = np.linspace(float(timeList[cn][0]), float(timeList[cn][-1]),
                               tNum[cn])
    for i in range(prbData_ft[cn].shape[0]):
        vd = 1 - prbData_ft[cn][i, :] / 11.4
        vd[where(vd < 0)] = 0  # 拟合之前先要尽量排除尾流外的大气结构的影响!
        # fitting
        cp = ft.fit_gs((0, 30), p[7:45], vd[7:45])[0] - wd[cn]
        wc[cn][i, 1] = cp
Example #7
0
wake[cn] = Wake(wakeData_org)
del wakeData_org # 汇总完了删除这个临时字典
secData = wake[cn].wakeData

timeList = list(wake[cn].wakeData.keys())
timeList.sort()

N = len(timeList)

drvV = np.zeros(N)
drvW = np.zeros(N)

for i in range(N):
    print(round(i/N*100,2), '%', ' finished ......')
    secData[timeList[i]][sec][:,1:] = tM.trs(secData[timeList[i]][sec][:,1:])
    pNum = secData[timeList[i]][sec].shape[0]
    count = 0
    v_ave = 0
    w_ave = 0
    for j in range(pNum):
        if np.power((secData[timeList[i]][sec][j,2]-0)**2 + (secData[timeList[i]][sec][j,3]-90)**2,0.5) < 1.0*126:
            count += 1
            v_ave += secData[timeList[i]][sec][j,5]
            w_ave += secData[timeList[i]][sec][j,6]
    drvV[i] = v_ave / count
    drvW[i] = w_ave / count

drvV = flt_seq(drvV, 3)
drvW = flt_seq(drvW, 3)
Example #8
0
timeList[cn] = list(probeData[cn][prbs[0]].keys())
timeList[cn].sort()
tNum[cn] = len(timeList[cn])

wcb = {}
wc_ave = {}


prbData_ft = {}

prbData_ft[cn] = {}
for prb in prbs:
    prbData_ft[cn][prb] = np.zeros((tNum[cn],probeData[cn][prb][timeList[cn][0]].shape[0]))
    for i in range(tNum[cn]):
        prbData_ft[cn][prb][i,:] = tM.trs(probeData[cn][prb][timeList[cn][i]])[:,3]
        # 出去坏点
        nulindex = where(prbData_ft[cn][prb][i,:] < -100)
        prbData_ft[cn][prb][i,:][nulindex] = 11.4
    for j in range(prbData_ft[cn][prb].shape[1]):
        prbData_ft[cn][prb][:,j] = flt_seq(prbData_ft[cn][prb][:,j],75)

p = tM.trs(probeData[cn][prbs[0]][timeList[cn][0]])[:,1]

# 读取 wc_ave
wc_ave_org = {}
f = open(projDir + 'postProcessing_all/data.processed/' + case[cn] + '_' + sec + '_wc_ave', 'rb')
wc_ave_org[cn] = pickle.load(f) # all wake information of the case
f.close()
wc_ave[cn] = {}
for i in range(2,13):