Exemplo n.º 1
0
# %%############################################################################
"""
    Examination of the computational mesh
"""
# %% Maximum shear line
filenm = pathM + 'ShearLine.dat'
xcoord = np.unique(TimeAve['x'])
grouped = TimeAve.groupby(['x'])
shear = '||shear(<velocity>)||'
idx = grouped[shear].transform(max) == TimeAve[shear]
shear_max = TimeAve[idx]
shear_max.to_csv(filenm, sep=' ', index=False, float_format='%1.8e')

# %% Plot rms contour of the mean flow field
MeanFlow = DataPost()
# MeanFlow.UserData(VarName, pathM + "MeanFlow.dat", 1, Sep="\t")
TimeAve = pd.read_hdf(pathM + "MeanFlow.h5")
grouped = TimeAve.groupby(['x', 'y'])
MeanFlow = grouped.mean().reset_index()
x, y = np.meshgrid(np.unique(MeanFlow.x), np.unique(MeanFlow.y))
corner = (x < 0.0) & (y < 0.0)
var = "<u`u`>"
uu = griddata((MeanFlow.x, MeanFlow.y), getattr(MeanFlow, var), (x, y))
print("uu_max=", np.max(np.sqrt(np.abs(getattr(MeanFlow, var)))))
print("uu_min=", np.min(np.sqrt(np.abs(getattr(MeanFlow, var)))))
corner = (x < 0.0) & (y < 0.0)
uu[corner] = np.nan
fig, ax = plt.subplots(figsize=(10, 4))
matplotlib.rc("font", size=textsize)
rg1 = np.linspace(0.0, 0.22, 21)
Exemplo n.º 2
0
                               rho=rho0.values,
                               opt='momentum')[0]

stream = np.loadtxt(pathM + 'BubbleLine.dat', skiprows=1)
stream[:, -1] = stream[:, -1] + 3.0
func = interp1d(stream[:, 0], stream[:, 1], bounds_error=False, fill_value=0.0)
yd = func(xd)
xmax = np.max(stream[:, 0])


# fit curve
def func(t, A, B, C, D):
    return A * t**3 + B * t**2 + C * t + D


popt, pcov = DataPost.fit_func(func, xd, delta, guess=None)
A, B, C, D = popt
fitfunc = lambda t: A * t**3 + B * t**2 + C * t + D
delta_fit = fitfunc(xd)

popt, pcov = DataPost.fit_func(func, xd, yd, guess=None)
A, B, C, D = popt
fitfunc = lambda t: A * t**3 + B * t**2 + C * t + D
yd = fitfunc(xd)
# gortler = va.Gortler(1.3718e7, xd, delta1, theta)
radius = va.radius(xd[:-1], delta_fit[:-1])
# radius = va.Radius(xd[:-1], yd[:-1])
gortler = va.gortler_tur(theta[:-1], delta_star[:-1], radius)

fig3, ax3 = plt.subplots(figsize=(5, 2.5))
ax3.plot(xd, delta, 'k-', linewidth=1.5)  # boundary layer
Exemplo n.º 3
0
# ax.hlines(-1.875, 0, 30, colors='k', linestyles=':')
# ax.grid(b=True, which='both', linestyle=':')
plt.savefig(pathF + "Schematic.svg", bbox_inches="tight")
plt.show()

# %% Isosurface of vorticity1 criterion
Isosurf = MeanFlow._DataTab.query("vorticity_1 <= 0.101 & vorticity_1 >= 0.099")
xx, yy = np.mgrid[-0.0:30.0:50j, -3.0:0.0:30j]
zz = griddata((Isosurf.x, Isosurf.y), Isosurf.z, (xx, yy))
fig = plt.figure(figsize=(5, 3))
ax = fig.gca(projection="3d")
surf = ax.plot_surface(xx, yy, zz, rstride=1, cstride=1, linewidth=0)
plt.show()

#%% Isosurface of lambda2 criterion
MeanFlow = DataPost()
MeanFlow.UserDataBin(path+'MeanFlow2.h5')

Isosurf = MeanFlow._DataTab.loc[np.round(MeanFlow._DataTab['L2-criterion'], 5) == -0.005]
xx, yy  = np.mgrid[-10.0:30.0:300j, -3.0:10.0:100j]
zz      = griddata((Isosurf.x, Isosurf.y), Isosurf['z'], (xx, yy))
fig = plt.figure(figsize=(12,4))
ax = fig.add_subplot(111, projection='3d')
ax.view_init(0.0, -90.0)
surf = ax.plot_surface(xx, yy, zz, cmap="rainbow", antialiased=False)
cbar = plt.colorbar(surf)
ax.set_xlabel(r'$x/\delta_0$', fontdict = font3)
ax.set_ylabel(r'$y/\delta_0$', fontdict = font3)
plt.gca().set_aspect('equal', adjustable='box')
#ax.contourf()
plt.show()
Exemplo n.º 4
0
boundary = np.loadtxt(pathM + "BoundaryEdge.dat", skiprows=1)
ax.plot(boundary[:, 0], boundary[:, 1], "k", linewidth=1.0)
# Add dividing line(separation line)
dividing = np.loadtxt(pathM + "BubbleLine.dat", skiprows=1)
ax.plot(dividing[:, 0], dividing[:, 1], "k--", linewidth=1.2)

plt.savefig(pathF + "MeanFlowRMSVV.svg", bbox_inches="tight")
plt.show()

# %%############################################################################
###
### Vorticity contour
###
# %% Load Data for time-averaged results
path4 = "/media/weibo/Data1/BFS_M1.7L/Slice/"
MeanFlow = DataPost()
MeanFlow.UserDataBin(pathF + "SolTime995.00.h5")
# %% Preprocess the data in the xy plane (z=0.0)
MeanFlowZ0 = MeanFlow.DataTab.loc[MeanFlow.DataTab["z"] == 0.0]
MeanFlowZ1 = MeanFlow.DataTab.loc[MeanFlow.DataTab["z"] == 0.5]
MeanFlowZ2 = MeanFlow.DataTab.loc[MeanFlow.DataTab["z"] == -0.5]
MeanFlowZ3 = pd.concat((MeanFlowZ1, MeanFlowZ2))
MeanFlowZ4 = MeanFlowZ3.groupby(["x", "y"]).mean().reset_index()
MeanFlowZ5 = MeanFlowZ4.loc[MeanFlowZ4["y"] > 3.0]
MeanFlowZ0 = pd.concat((MeanFlowZ0, MeanFlowZ5), sort=False)
MeanFlowZ0.to_hdf(pathF + "MeanFlowZ0.h5", "w", format="fixed")

# %% Load data
fluc_flow = tf()
fluc_flow.load_3data(
        path, FileList=path+"/ZFluctuation_900.0.h5", NameList='h5'