Skip to content

Commit

Permalink
Add Holman1986 model (closes #16)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisleaman committed May 9, 2019
1 parent 7bb5673 commit 72569d3
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The following empirical wave parameterizations are made available in this module

- :class:`models.Stockdon2006`: The most commonly cited and widely used runup model.
- :class:`models.Power2018`: Based on the Gene-Expression Programming technique.

- :class:`models.Holman1986`: Incorporated wave setup using Duck, NC measurements.

------------

Expand Down
52 changes: 48 additions & 4 deletions py_wave_runup/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,6 @@ def setup(self):
The setup level using Eqn (10):
.. math:: \\bar{\\eta} = 0.35 \\beta (H_{s}L_{p})^{0.5}
"""
result = 0.35 * self.beta * (self.Hs * self.Lp) ** 0.5
result = self._return_one_or_array(result)
Expand Down Expand Up @@ -204,8 +202,7 @@ class Power2018(RunupModel):
https://doi.org/10.1016/j.coastaleng.2018.10.006
Examples:
Calculate 2% exceedence runup level, including setup component and swash
component given Hs=4m, Tp=11s, beta=0.1.
Calculate 2% exceedence runup level given Hs=4m, Tp=11s, beta=0.1.
>>> from py_wave_runup.models import Power2018
>>> pow18 = Power2018(Hs=1, Tp=8, beta=0.07, r=0.00075)
Expand Down Expand Up @@ -353,3 +350,50 @@ def R2(self):

result = self._return_one_or_array(result)
return result


class Holman1986(RunupModel):
"""
This class implements the empirical wave runup model from:
Holman, R.A., 1986. Extreme value statistics for wave run-up on a natural
beach. Coastal Engineering 9, 527–544. https://doi.org/10.1016/0378-3839(
86)90002-5
Examples:
Calculate 2% exceedence runup level, including setup component given Hs=4m,
Tp=11s, beta=0.1.
>>> from py_wave_runup.models import Power2018
>>> hol86 = Holman1986(Hs=4, Tp=11, beta=0.1)
>>> hol86.R2
3.09
>>> hol86.setup
0.8
"""

doi = "10.1016/0378-3839(86)90002-5"

@property
def R2(self):
"""
Returns:
The 2% exceedence runup level, given by
.. math:: R_{2} = 0.83 \\tan{\\beta} \\sqrt{H_{s}+L_{p}} + 0.2 H_{s}
"""
result = 0.83 * np.tan(self.beta) * np.sqrt(self.Hs * self.Lp) + 0.2 * self.Hs
result = self._return_one_or_array(result)
return result

@property
def setup(self):
"""
Returns:
The setup level using:
.. math:: S = 0.2 H_{s}
"""
result = 0.2 * self.Hs
result = self._return_one_or_array(result)
return result
17 changes: 17 additions & 0 deletions tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,20 @@ def test_list_input(self):
def test_no_roughness(self):
with raises(ValueError):
model = models.Power2018(Hs=4, Tp=11, beta=0.1)


class TestHolman1986(object):
def test_reflective(self):
model = models.Holman1986(Hs=4, Tp=11, beta=0.1)
assert model.R2 == approx(3.09, abs=0.01)
assert model.setup == approx(0.8, abs=0.01)

def test_dissipative(self):
model = models.Holman1986(Hs=4, Tp=11, beta=0.001)
assert model.R2 == approx(0.82, abs=0.01)
assert model.setup == approx(0.8, abs=0.01)

def test_list_input(self):
model = models.Holman1986(Hs=[1, 2], Lp=[100, 200], beta=[0.05, 0.1])
assert model.R2 == approx((0.62, 2.06), abs=0.1)
assert model.setup == approx((0.2, 0.4), abs=0.01)

0 comments on commit 72569d3

Please sign in to comment.