Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion moorpy/subsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,7 @@ def getYawStiffness(self):

tau0 = -self.fB[0] # horizontal tension component [N]

yaw_stiff = (tau0/l)*self.rad_fair**2 + tau0*self.rad_fair # [N-m]
yaw_stiff = (tau0/self.span)*self.rad_fair**2 + tau0*self.rad_fair # [N-m]

return yaw_stiff

Expand Down
18 changes: 18 additions & 0 deletions tests/test_subsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,24 @@
import matplotlib.pyplot as plt


def test_getYawStiffness_runs():
"""Subsystem.getYawStiffness must not raise NameError.

Regression test: the yaw-stiffness formula referenced an undefined local
``l`` (a leftover from the rename of line length to ``span``), so every
call raised ``NameError: name 'l' is not defined``. It should instead use
``self.span`` and return ``(tau0/span)*rad_fair**2 + tau0*rad_fair``.
"""
ss = mp.Subsystem(depth=100, span=200, rad_fair=10, z_fair=-10)
# getYawStiffness reads the horizontal fairlead force fB (set during a
# solve); inject a representative value to exercise the formula directly.
ss.fB = np.array([-1.0e5, 0.0, 5.0e4])

tau0 = -ss.fB[0]
expected = (tau0 / ss.span) * ss.rad_fair**2 + tau0 * ss.rad_fair
assert_allclose(ss.getYawStiffness(), expected)


"""
def test_tensions_swap():
'''Compares two equivalent catenary mooring lines that are defined in opposite directions.'''
Expand Down
Loading