Skip to content

Commit

Permalink
Wave height solve (#215)
Browse files Browse the repository at this point in the history
Change order of calculating runup and reducing the wave height from the significant to the depth-dependent wave height.
  • Loading branch information
christavanijzendoorn authored Aug 11, 2024
1 parent c640ea7 commit acb4452
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions aeolis/hydro.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'])
Expand Down

0 comments on commit acb4452

Please sign in to comment.