From 9a0c90ca28db1842d3574fbb3d19da118373272d Mon Sep 17 00:00:00 2001 From: Christa van IJzendoorn <52737913+christavanijzendoorn@users.noreply.github.com> Date: Fri, 26 Jul 2024 15:08:31 -0700 Subject: [PATCH] Wave height solve Change order of calculating runup and reducing the wave height from the significant to the depth-dependent wave height. --- aeolis/hydro.py | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/aeolis/hydro.py b/aeolis/hydro.py index e26f30e7..6ac42541 100644 --- a/aeolis/hydro.py +++ b/aeolis/hydro.py @@ -118,6 +118,28 @@ def interpolate(s, p, t): p['wave_file'][:,0], p['wave_file'][:,2]) + if p['process_runup']: + ny = p['ny'] + + for iy in range(ny + 1): # do this computation seperately on every y for now so alongshore variable wave runup can be added in the future + + hs = s['Hs'][iy][0] + tp = s['Tp'][iy][0] + wl = s['SWL'][iy][0] + + eta, sigma_s, R = calc_runup_stockdon(hs, tp, p['beach_slope']) + s['R'][iy][:] = R + s['eta'][iy][:] = eta + s['sigma_s'][iy][:] = sigma_s + + if hasattr(s['runup_mask'], "__len__"): + s['eta'][iy][:] = apply_mask(s['eta'][iy][:], s['runup_mask'][iy][:]) + s['R'][iy][:] = apply_mask(s['R'][iy][:], s['runup_mask'][iy][:]) + + s['TWL'][iy][:] = s['SWL'][iy][:] + s['R'][iy][:] + s['DSWL'][iy][:] = s['SWL'][iy][:] + s['eta'][iy][:] # Was s['zs'] before + + # Alters wave height based on maximum wave height over depth ratio, gamma default = 0.5 s['Hs'] = np.minimum(h * p['gamma'], s['Hs']) # apply complex mask @@ -136,27 +158,6 @@ def interpolate(s, p, t): if p['process_runup']: ny = p['ny'] - - if ('Hs' not in p['external_vars']): - - for iy in range(ny + 1): # do this computation seperately on every y for now so alongshore variable wave runup can be added in the future - - hs = s['Hs'][iy][0] - tp = s['Tp'][iy][0] - wl = s['SWL'][iy][0] - - eta, sigma_s, R = calc_runup_stockdon(hs, tp, p['beach_slope']) - s['R'][iy][:] = R - s['eta'][iy][:] = eta - s['sigma_s'][iy][:] = sigma_s - - if hasattr(s['runup_mask'], "__len__"): - s['eta'][iy][:] = apply_mask(s['eta'][iy][:], s['runup_mask'][iy][:]) - s['R'][iy][:] = apply_mask(s['R'][iy][:], s['runup_mask'][iy][:]) - - s['TWL'][iy][:] = s['SWL'][iy][:] + s['R'][iy][:] - s['DSWL'][iy][:] = s['SWL'][iy][:] + s['eta'][iy][:] # Was s['zs'] before - if ('Hs' in p['external_vars']): eta, sigma_s, R = calc_runup_stockdon(s['Hs'], s['Tp'], p['beach_slope'])