Skip to content

Commit acb4452

Browse files
Wave height solve (#215)
Change order of calculating runup and reducing the wave height from the significant to the depth-dependent wave height.
1 parent c640ea7 commit acb4452

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed

aeolis/hydro.py

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,28 @@ def interpolate(s, p, t):
118118
p['wave_file'][:,0],
119119
p['wave_file'][:,2])
120120

121+
if p['process_runup']:
122+
ny = p['ny']
123+
124+
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
125+
126+
hs = s['Hs'][iy][0]
127+
tp = s['Tp'][iy][0]
128+
wl = s['SWL'][iy][0]
129+
130+
eta, sigma_s, R = calc_runup_stockdon(hs, tp, p['beach_slope'])
131+
s['R'][iy][:] = R
132+
s['eta'][iy][:] = eta
133+
s['sigma_s'][iy][:] = sigma_s
134+
135+
if hasattr(s['runup_mask'], "__len__"):
136+
s['eta'][iy][:] = apply_mask(s['eta'][iy][:], s['runup_mask'][iy][:])
137+
s['R'][iy][:] = apply_mask(s['R'][iy][:], s['runup_mask'][iy][:])
138+
139+
s['TWL'][iy][:] = s['SWL'][iy][:] + s['R'][iy][:]
140+
s['DSWL'][iy][:] = s['SWL'][iy][:] + s['eta'][iy][:] # Was s['zs'] before
141+
142+
# Alters wave height based on maximum wave height over depth ratio, gamma default = 0.5
121143
s['Hs'] = np.minimum(h * p['gamma'], s['Hs'])
122144

123145
# apply complex mask
@@ -136,27 +158,6 @@ def interpolate(s, p, t):
136158

137159
if p['process_runup']:
138160
ny = p['ny']
139-
140-
if ('Hs' not in p['external_vars']):
141-
142-
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
143-
144-
hs = s['Hs'][iy][0]
145-
tp = s['Tp'][iy][0]
146-
wl = s['SWL'][iy][0]
147-
148-
eta, sigma_s, R = calc_runup_stockdon(hs, tp, p['beach_slope'])
149-
s['R'][iy][:] = R
150-
s['eta'][iy][:] = eta
151-
s['sigma_s'][iy][:] = sigma_s
152-
153-
if hasattr(s['runup_mask'], "__len__"):
154-
s['eta'][iy][:] = apply_mask(s['eta'][iy][:], s['runup_mask'][iy][:])
155-
s['R'][iy][:] = apply_mask(s['R'][iy][:], s['runup_mask'][iy][:])
156-
157-
s['TWL'][iy][:] = s['SWL'][iy][:] + s['R'][iy][:]
158-
s['DSWL'][iy][:] = s['SWL'][iy][:] + s['eta'][iy][:] # Was s['zs'] before
159-
160161
if ('Hs' in p['external_vars']):
161162

162163
eta, sigma_s, R = calc_runup_stockdon(s['Hs'], s['Tp'], p['beach_slope'])

0 commit comments

Comments
 (0)