Skip to content

Commit 08b80fa

Browse files
authored
Merge a3c332e into b4d802f
2 parents b4d802f + a3c332e commit 08b80fa

File tree

3 files changed

+19
-24
lines changed

3 files changed

+19
-24
lines changed

examples/tutorial_4_Pioneer.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@
760760
"outputs": [],
761761
"source": [
762762
"hydro_data = wot.add_linear_friction(bem_data, friction=None) \n",
763-
"hydro_data = wot.check_linear_damping(hydro_data, uniform_shift=False) \n",
763+
"hydro_data = wot.check_radiation_damping(hydro_data, uniform_shift=False) \n",
764764
"\n",
765765
"Zi = wot.hydrodynamic_impedance(hydro_data)\n",
766766
"Rad_res = np.real(Zi.squeeze())\n",

tests/test_core.py

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -919,8 +919,8 @@ def test_read_write_netcdf(self, hydro_data, hydro_data_new):
919919
assert hydro_data.equals(hydro_data_new)
920920

921921

922-
class TestCheckLinearDamping:
923-
"""Test function :python:`check_linear_damping`."""
922+
class TestCheckRadiationDamping:
923+
"""Test function :python:`check_radiation_damping`."""
924924

925925
@pytest.fixture(scope="class")
926926
def data(self, hydro_data):
@@ -933,44 +933,39 @@ def data(self, hydro_data):
933933

934934
@pytest.fixture(scope="class")
935935
def tol(self, data):
936-
"""Tolerance for function :python:`check_linear_damping`."""
936+
"""Tolerance for function :python:`check_radiation_damping`."""
937937
return 0.01
938938

939939
@pytest.fixture(scope="class")
940940
def data_new_uniform(self, data, tol):
941941
"""Hydrodynamic data structure for which the function
942-
:python:`check_linear_damping` has been called.
942+
:python:`check_radiation_damping` has been called.
943943
"""
944-
return wot.check_linear_damping(data, tol, True)
944+
return wot.check_radiation_damping(data, tol, True)
945945

946946
@pytest.fixture(scope="class")
947947
def data_new_nonuniform(self, data, tol):
948948
"""Hydrodynamic data structure for which the function
949-
:python:`check_linear_damping` has been called.
949+
:python:`check_radiation_damping` has been called.
950950
"""
951-
return wot.check_linear_damping(data, tol, False)
951+
return wot.check_radiation_damping(data, tol, False)
952952

953-
def test_friction(self, data_new_uniform, tol):
953+
def test_radiation(self, data, data_new_uniform, tol):
954954
"""Test that the modified friction diagonal has the expected
955955
value for a uniform shift.
956956
"""
957-
assert np.allclose(np.diagonal(data_new_uniform.friction.values), tol)
957+
radiation_diff = (data_new_uniform.radiation_damping.values
958+
- data.radiation_damping.values)
959+
assert np.allclose(radiation_diff, radiation_diff[0], tol)
958960

959-
def test_only_diagonal_friction(self, data, data_new_uniform):
960-
"""Test that only the diagonal was changed for a uniform shift."""
961-
data_org = data.copy(deep=True)
962-
def nodiag(x):
963-
return x.friction.values - np.diag(np.diagonal(x.friction.values))
964-
assert np.allclose(nodiag(data_new_uniform), nodiag(data_org))
965-
966-
def test_only_friction(self, data, data_new_uniform):
967-
"""Test that only the friction is changed in the hydrodynamic
961+
def test_only_radiation(self, data, data_new_uniform):
962+
"""Test that only the radiation is changed in the hydrodynamic
968963
data for a uniform shift.
969964
"""
970-
data_new_nofric = data_new_uniform.copy(deep=True
971-
).drop_vars('friction')
972-
data_org_nofric = data.copy(deep=True).drop_vars('friction')
973-
assert data_new_nofric.equals(data_org_nofric)
965+
data_new_norad = data_new_uniform.copy(deep=True
966+
).drop_vars('radiation_damping')
967+
data_org_norad = data.copy(deep=True).drop_vars('radiation_damping')
968+
assert data_new_norad.equals(data_org_norad)
974969

975970
def test_damping(self, data_new_nonuniform, tol):
976971
"""Test that the modified radiation damping diagonal has the expected

tests/test_integration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def hstiff(self, fb):
234234
def hydro_impedance(self, bem):
235235
"""Intrinsic hydrodynamic impedance"""
236236
hd = wot.add_linear_friction(bem)
237-
hd = wot.check_linear_damping(hd)
237+
hd = wot.check_radiation_damping(hd)
238238
Zi = wot.hydrodynamic_impedance(hd)
239239
return Zi
240240

0 commit comments

Comments
 (0)