Skip to content

Commit 4b7a10a

Browse files
authored
Merge pull request #1762 from knutfrode/dev
Fixed three bugs in OpenBerg: decreasing wave force coefficient from …
2 parents 33ed766 + f59566e commit 4b7a10a

2 files changed

Lines changed: 16 additions & 16 deletions

File tree

opendrift/models/openberg.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def ocean_force(iceb_vel, water_vel, Avo, Aho, rho_water, water_form_drag_coef,
108108
water_vel : Ocean current velocity
109109
rho_water : Water density
110110
Avo : Vertical area of the iceberg in the ocean (length x draft)
111-
Aho : Horizontal area of the iceberg in contact with the ocean (width x draft)
111+
Aho : Horizontal area of the iceberg in contact with the ocean (width x length)
112112
water_form_drag_coef : Co is the ocean form drag coefficient
113113
water_skin_drag_coef : Cdo is the ocean skin drag coefficient
114114
"""
@@ -129,7 +129,7 @@ def wind_force(iceb_vel, wind_vel, Ava, Aha, wind_form_drag_coef, wind_skin_drag
129129
iceb_vel : Iceberg's velocity at time t
130130
wind_vel : Wind velocity
131131
Ava : Vertical area of the iceberg in the air (length x sail)
132-
Aha : Horizontal area of the iceberg in contact with the air (width x sail)
132+
Aha : Horizontal area of the iceberg in contact with the air (width x length)
133133
wind_form_drag_coef : Ca is the air form drag coefficient
134134
wind_skin_drag_coef : Cda is the air skin drag coefficient
135135
"""
@@ -154,8 +154,8 @@ def wave_radiation_force(rho_water, wave_height, wave_direction, iceb_length):
154154
wave_direction : Wave direction
155155
iceb_length : Iceberg's length
156156
"""
157-
F_wave_x = (0.5 * rho_water * wave_drag_coef * g * iceb_length * (wave_height / 2) ** 2 * np.sin(np.deg2rad(wave_direction)))
158-
F_wave_y = (0.5 * rho_water * wave_drag_coef * g * iceb_length * (wave_height / 2) ** 2 * np.cos(np.deg2rad(wave_direction)))
157+
F_wave_x = (0.25 * rho_water * wave_drag_coef * g * iceb_length * (wave_height / 2) ** 2 * np.sin(np.deg2rad(wave_direction)))
158+
F_wave_y = (0.25 * rho_water * wave_drag_coef * g * iceb_length * (wave_height / 2) ** 2 * np.cos(np.deg2rad(wave_direction)))
159159
return np.array([F_wave_x, F_wave_y])
160160

161161

@@ -447,10 +447,10 @@ def advect_iceberg(self):
447447
sea_ice_thickness = self.environment.sea_ice_thickness
448448
sea_ice_conc = self.environment.sea_ice_area_fraction
449449
water_depth = self.environment.sea_floor_depth_below_sea_level
450-
Avo = length * abs(draft)
451-
Aho = width * abs(draft)
450+
Avo = length * draft
451+
Aho = width * length
452452
Ava = length * sail
453-
Aha = width * sail
453+
Aha = width * length
454454
Ai = sea_ice_thickness * length
455455

456456
mass = width * (Ava + Avo) * rho_iceb * weight_coef

tests/models/test_openberg.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ def test_openberg_constant_forcing():
3636
o.set_config('environment:constant:y_sea_water_velocity', 0)
3737
o.set_config('environment:constant:x_wind', 0)
3838
o.set_config('environment:constant:y_wind', 0)
39-
o.set_config('environment:constant:sea_surface_wave_significant_height', 3)
39+
o.set_config('environment:constant:sea_surface_wave_significant_height', 2)
4040
o.set_config('environment:constant:sea_surface_wave_from_direction', 270)
4141
o.set_config('drift:horizontal_diffusivity', 0)
4242
o.set_config('drift:coriolis', False)
4343
o.seed_elements(4, 60, time=datetime.now())
4444
o.run(steps=2)
45-
np.testing.assert_almost_equal(o.result.lon.isel(time=-1), 4.127, 3)
45+
np.testing.assert_almost_equal(o.result.lon.isel(time=-1), 4.055, 3)
4646
np.testing.assert_almost_equal(o.result.lat.isel(time=-1), 60.0, 3)
4747

4848
# No current and wind, waves from east
@@ -57,7 +57,7 @@ def test_openberg_constant_forcing():
5757
o.set_config('drift:coriolis', False)
5858
o.seed_elements(4, 60, time=datetime.now())
5959
o.run(steps=2)
60-
np.testing.assert_almost_equal(o.result.lon.isel(time=-1), 3.873, 3)
60+
np.testing.assert_almost_equal(o.result.lon.isel(time=-1), 3.915, 3)
6161
np.testing.assert_almost_equal(o.result.lat.isel(time=-1), 60.0, 3)
6262

6363
# Northwards current, no wind, no Coriolis
@@ -96,7 +96,7 @@ def test_openberg_constant_forcing():
9696
o.set_config('drift:coriolis', True)
9797
o.seed_elements(4, 60, time=datetime.now())
9898
o.run(steps=2)
99-
np.testing.assert_almost_equal(o.result.lon.isel(time=-1), 4.114, 3)
99+
np.testing.assert_almost_equal(o.result.lon.isel(time=-1), 4.083, 3)
100100
np.testing.assert_almost_equal(o.result.lat.isel(time=-1), 60.058, 3)
101101

102102
# No current, eastwards wind
@@ -109,7 +109,7 @@ def test_openberg_constant_forcing():
109109
o.set_config('drift:coriolis', False)
110110
o.seed_elements(4, 60, time=datetime.now())
111111
o.run(steps=2)
112-
np.testing.assert_almost_equal(o.result.lon.isel(time=-1), 4.107, 3)
112+
np.testing.assert_almost_equal(o.result.lon.isel(time=-1), 4.075, 3)
113113
np.testing.assert_almost_equal(o.result.lat.isel(time=-1), 60.000, 3)
114114

115115
# No current, weaker eastwards wind
@@ -123,7 +123,7 @@ def test_openberg_constant_forcing():
123123
o.seed_elements(4, 60, time=datetime.now())
124124
o.run(steps=2)
125125
# TODO: Half wind gives only 25% of eastwards movement. Should be checked.
126-
np.testing.assert_almost_equal(o.result.lon.isel(time=-1), 4.028, 3)
126+
np.testing.assert_almost_equal(o.result.lon.isel(time=-1), 4.022, 3)
127127
np.testing.assert_almost_equal(o.result.lat.isel(time=-1), 60.000, 3)
128128

129129
# No current, westwards wind
@@ -136,7 +136,7 @@ def test_openberg_constant_forcing():
136136
o.set_config('drift:coriolis', False)
137137
o.seed_elements(4, 60, time=datetime.now())
138138
o.run(steps=2)
139-
np.testing.assert_almost_equal(o.result.lon.isel(time=-1), 3.892, 3)
139+
np.testing.assert_almost_equal(o.result.lon.isel(time=-1), 3.924, 3)
140140
np.testing.assert_almost_equal(o.result.lat.isel(time=-1), 60.000, 3)
141141

142142
# No current, northwards wind
@@ -150,7 +150,7 @@ def test_openberg_constant_forcing():
150150
o.seed_elements(4, 60, time=datetime.now())
151151
o.run(steps=2)
152152
np.testing.assert_almost_equal(o.result.lon.isel(time=-1), 4, 3)
153-
np.testing.assert_almost_equal(o.result.lat.isel(time=-1), 60.054, 3)
153+
np.testing.assert_almost_equal(o.result.lat.isel(time=-1), 60.039, 3)
154154

155155
# No current, southwards wind
156156
o = OpenBerg(loglevel=50)
@@ -163,7 +163,7 @@ def test_openberg_constant_forcing():
163163
o.seed_elements(4, 60, time=datetime.now())
164164
o.run(steps=2)
165165
np.testing.assert_almost_equal(o.result.lon.isel(time=-1), 4, 3)
166-
np.testing.assert_almost_equal(o.result.lat.isel(time=-1), 59.946, 3)
166+
np.testing.assert_almost_equal(o.result.lat.isel(time=-1), 59.962, 3)
167167

168168

169169
def test_openberg_norkyst():

0 commit comments

Comments
 (0)