Black reformat on processing
This commit is contained in:
parent
eff2b09c8f
commit
358b57f23d
7 changed files with 62 additions and 41 deletions
|
@ -30,7 +30,7 @@ def data(var):
|
|||
|
||||
|
||||
x = data("x")
|
||||
#t = data("t")
|
||||
# t = data("t")
|
||||
|
||||
watl = data("watl")
|
||||
botl = data("botl")
|
||||
|
|
|
@ -55,7 +55,7 @@ vk = np.sqrt((velk[n] ** 2).sum(axis=1))
|
|||
|
||||
lines = ax.plot(x, zk[n].T, c="#0066cc")
|
||||
quiv = []
|
||||
for i in range(len(lines)-1):
|
||||
for i in range(len(lines) - 1):
|
||||
quiv.append(
|
||||
ax.quiver(
|
||||
x[::50],
|
||||
|
|
|
@ -70,7 +70,9 @@ def PUV_dam(u, p, h, fs, zmesP, zmesU):
|
|||
ccs.append(cs)
|
||||
cccp.append(ccp)
|
||||
# calcul des amplitudes des ondes incidentes a partir de uhoriz et p
|
||||
aincident13.append(0.5 * np.sqrt(
|
||||
aincident13.append(
|
||||
0.5
|
||||
* np.sqrt(
|
||||
a1 * a1 / (cc * cc)
|
||||
+ a3
|
||||
* a3
|
||||
|
@ -79,9 +81,18 @@ def PUV_dam(u, p, h, fs, zmesP, zmesU):
|
|||
* xf[ii]
|
||||
* xf[ii]
|
||||
/ (omega[ii] * omega[ii] * ccp * ccp)
|
||||
+ 2 * a1 * a3 * g * k_xb[ii] * np.cos(phi3 - phi1) / (cc * ccp * omega[ii])
|
||||
))
|
||||
areflechi13.append(0.5 * np.sqrt(
|
||||
+ 2
|
||||
* a1
|
||||
* a3
|
||||
* g
|
||||
* k_xb[ii]
|
||||
* np.cos(phi3 - phi1)
|
||||
/ (cc * ccp * omega[ii])
|
||||
)
|
||||
)
|
||||
areflechi13.append(
|
||||
0.5
|
||||
* np.sqrt(
|
||||
a1 * a1 / (cc * cc)
|
||||
+ a3
|
||||
* a3
|
||||
|
@ -90,8 +101,15 @@ def PUV_dam(u, p, h, fs, zmesP, zmesU):
|
|||
* k_xb[ii]
|
||||
* k_xb[ii]
|
||||
/ (omega[ii] * omega[ii] * ccp * ccp)
|
||||
- 2 * a1 * a3 * g * xf[ii] * np.cos(phi3 - phi1) / (cc * ccp * omega[ii])
|
||||
))
|
||||
- 2
|
||||
* a1
|
||||
* a3
|
||||
* g
|
||||
* xf[ii]
|
||||
* np.cos(phi3 - phi1)
|
||||
/ (cc * ccp * omega[ii])
|
||||
)
|
||||
)
|
||||
cv = g * xf[ii] / (omega[ii] * ccp)
|
||||
cp = 1 / cc
|
||||
aprog.append(a3 / (g * xf[ii] / (omega[ii] * ccp)))
|
||||
|
|
|
@ -35,9 +35,9 @@ vel = np.load(inp.joinpath("vel_x.npy"))
|
|||
# Cospectral calculations
|
||||
x0 = config.getint("post", "x0")
|
||||
arg_x0 = np.abs(x - x0).argmin()
|
||||
t0 = int(config.getfloat("post", "t0")*1e3)
|
||||
t0 = int(config.getfloat("post", "t0") * 1e3)
|
||||
arg_t0 = np.abs(t - t0).argmin()
|
||||
dt = np.diff(t).mean()*1e-3
|
||||
dt = np.diff(t).mean() * 1e-3
|
||||
f = 1 / dt
|
||||
nperseg = config.getint("post", "nperseg", fallback=None)
|
||||
log.info(f"Computing reflection coefficient at x={x0}")
|
||||
|
@ -58,10 +58,10 @@ R = np.sqrt(
|
|||
(np.abs(phi_eta[1]) + np.abs(phi_u[1]) - 2 * phi_eta_u[1].real)
|
||||
/ (np.abs(phi_eta[1]) + np.abs(phi_u[1]) + 2 * phi_eta_u[1].real)
|
||||
)
|
||||
#R = np.sqrt(
|
||||
# R = np.sqrt(
|
||||
# (1 + G**2 - 2 * G * np.cos(th_eta_u))
|
||||
# / (1 + G**2 + 2 * G * np.cos(th_eta_u))
|
||||
#)
|
||||
# )
|
||||
|
||||
if config.has_option("post", "compare"):
|
||||
inp_comp = pathlib.Path(config.get("post", "compare"))
|
||||
|
@ -91,27 +91,27 @@ if config.has_option("post", "compare"):
|
|||
(np.abs(phi_eta_[1]) + np.abs(phi_u_[1]) - 2 * phi_eta_u_[1].real)
|
||||
/ (np.abs(phi_eta_[1]) + np.abs(phi_u_[1]) + 2 * phi_eta_u_[1].real)
|
||||
)
|
||||
#R_ = np.sqrt(
|
||||
# R_ = np.sqrt(
|
||||
# (1 + G_**2 - 2 * G_ * np.cos(th_eta_u_))
|
||||
# / (1 + G_**2 + 2 * G_ * np.cos(th_eta_u_))
|
||||
#)
|
||||
# )
|
||||
|
||||
|
||||
# Plotting
|
||||
log.info("Plotting results")
|
||||
fig, (ax_watl, ax_vel) = plt.subplots(2)
|
||||
|
||||
ax_watl.plot(t*1e-3, watl[:, arg_x0], lw=1, label="watl")
|
||||
ax_watl.plot(t * 1e-3, watl[:, arg_x0], lw=1, label="watl")
|
||||
ax_watl.set(xlabel="t (s)", ylabel="z (m)")
|
||||
ax_watl.autoscale(axis="x", tight=True)
|
||||
ax_watl.grid()
|
||||
ax_watl.axvline(t0*1e-3, c="k", alpha=0.2)
|
||||
ax_watl.axvline(t0 * 1e-3, c="k", alpha=0.2)
|
||||
|
||||
ax_vel.plot(t*1e-3, vel[:, arg_x0], lw=1, label="vel")
|
||||
ax_vel.plot(t * 1e-3, vel[:, arg_x0], lw=1, label="vel")
|
||||
ax_vel.set(xlabel="t (s)", ylabel="U (m/s)")
|
||||
ax_vel.autoscale(axis="x", tight=True)
|
||||
ax_vel.grid()
|
||||
ax_vel.axvline(t0*1e-3, c="k", alpha=0.2)
|
||||
ax_vel.axvline(t0 * 1e-3, c="k", alpha=0.2)
|
||||
|
||||
fig.tight_layout()
|
||||
|
||||
|
|
|
@ -40,7 +40,9 @@ for r in np.arange(0, 1.1, 0.1):
|
|||
*Rn,
|
||||
c="#ff6600",
|
||||
)
|
||||
axr.annotate(f"{r=:.1f}", (Rn[0][0], Rn[1][0]), bbox={"boxstyle": "square", "facecolor": "w"})
|
||||
axr.annotate(
|
||||
f"{r=:.1f}", (Rn[0][0], Rn[1][0]), bbox={"boxstyle": "square", "facecolor": "w"}
|
||||
)
|
||||
axr.grid()
|
||||
axr.autoscale(True, "x", tight=True)
|
||||
axr.set(ylim=(0, 1), ylabel="R", xlabel="f")
|
||||
|
|
|
@ -7,6 +7,7 @@ import numpy as np
|
|||
|
||||
log = logging.getLogger("read_swash")
|
||||
|
||||
|
||||
class ReadSwash:
|
||||
def __init__(self):
|
||||
self._n_x = None
|
||||
|
|
|
@ -30,14 +30,14 @@ np.save(inp.joinpath("tsec"), rsws.read_time(sws_out.joinpath("tsec.dat")))
|
|||
np.save(inp.joinpath("xp"), rsws.read_x(sws_out.joinpath("xp.dat")))
|
||||
|
||||
var = {
|
||||
#"dep": rsws.read_scalar,
|
||||
# "dep": rsws.read_scalar,
|
||||
"botl": rsws.read_const,
|
||||
"watl": rsws.read_scalar,
|
||||
#"pressk": rsws.read_scalar_lay,
|
||||
#"nhprsk": rsws.read_scalar_lay,
|
||||
#"zk": rsws.read_scalar_lay,
|
||||
#"velk": rsws.read_vector_lay,
|
||||
#"vz": rsws.read_scalar_lay,
|
||||
# "pressk": rsws.read_scalar_lay,
|
||||
# "nhprsk": rsws.read_scalar_lay,
|
||||
# "zk": rsws.read_scalar_lay,
|
||||
# "velk": rsws.read_vector_lay,
|
||||
# "vz": rsws.read_scalar_lay,
|
||||
"vel": rsws.read_vector,
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue