1
Fork 0

Add real x support to post

This commit is contained in:
Edgar P. Burkhart 2022-03-04 11:01:01 +01:00
parent 1be7a5285b
commit 0bdd73da19
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
2 changed files with 9 additions and 7 deletions

View file

@ -20,5 +20,5 @@ mpi=4
inp=inp_post
out=out_post
dt=0.25
x0=125
x0=-1000
t0=180

View file

@ -31,13 +31,15 @@ x, t = data["x"], data["t"]
# Cospectral calculations
x0 = config.getint("post", "x0")
arg_x0 = (x - x0).abs().argmin()
t0 = config.getfloat("post", "t0")
arg_t0 = (t - t0).abs().argmin()
dt = config.getfloat("post", "dt")
f = 1 / dt
log.info(f"Computing reflection coefficient at x={x0}")
eta = data["watl"][t > t0, x0]
u = data["vel"][t > t0, 0, x0]
eta = data["watl"][t > t0, arg_x0]
u = data["vel"][t > t0, 0, arg_x0]
phi_eta = np.abs(sgl.csd(eta, eta, f))
phi_u = np.abs(sgl.csd(u, u, f))
@ -52,13 +54,13 @@ R = np.sqrt(
log.info("Plotting results")
fig, (ax_watl, ax_vel) = plt.subplots(2)
ax_watl.plot(t, data["watl"][:, x0], label="watl")
ax_watl.plot(t, data["watl"][:, arg_x0], 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, c="k", alpha=0.2)
ax_vel.plot(t, data["vel"][:, 0, x0], label="vel")
ax_vel.plot(t, data["vel"][:, 0, arg_x0], label="vel")
ax_vel.set(xlabel="t (s)", ylabel="U (m/s)")
ax_vel.autoscale(axis="x", tight=True)
ax_vel.grid()
@ -74,8 +76,8 @@ ax_r.set(ylim=(0, 1), xlabel="f (Hz)", ylabel="R")
ax_r.grid()
fig_x, ax_x = plt.subplots()
ax_x.plot(-data["botl"], color="k")
ax_x.plot(data["watl"][np.argmin(np.abs(t - t0)), :])
ax_x.plot(data["x"], -data["botl"], color="k")
ax_x.plot(data["x"], np.maximum(data["watl"][arg_t0, :], -data["botl"]))
ax_x.axvline(x0, c="k", alpha=0.2)
ax_x.set(xlabel="x (m)", ylabel="z (m)")
ax_x.autoscale(axis="x", tight=True)