Skip to content

Commit 07735af

Browse files
authored
Merge pull request #1608 from knutfrode/dev
[run-ex] OpenBerg: setting property moving to 0 for grounded icebergs…
2 parents 9458dbe + 0e26098 commit 07735af

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

examples/example_openberg.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
# Simulating drift for 48 hours
3333
o = OpenBerg()
3434
o.set_config('drift:vertical_profile', False)
35+
o.set_config('drift:horizontal_diffusivity', 100)
3536
o.add_readers_from_list(forcing)
3637
o.seed_elements(**icebergs)
3738
o.run(duration=timedelta(days=2))

opendrift/models/openberg.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,8 @@ def dynamic(t,iceb_vel, water_vel, wind_vel, wave_height, wave_direction, Ao,
474474
hwall = draft - water_depth
475475
grounded = np.logical_and(hwall >= 0, grounding)
476476
if any(grounded) and grounding:
477-
logger.info(f"Grounding condition : Icebergs grounded = {len(hwall[hwall>0])}, hwall={np.round(hwall[hwall>0],3)} meters")
477+
logger.debug(f"Grounding condition : Icebergs grounded = {len(hwall[hwall>0])}, hwall={np.round(hwall[hwall>0],3)} meters")
478+
self.elements.moving[grounded] = 0 # Grounded icebergs shall not move, also not with diffusivity
478479

479480
sol = solve_ivp(dynamic, [0, self.time_step.total_seconds()], V0,
480481
args=(water_vel, wind_vel, wave_height, wave_direction, Ao, Aa, rho_water,
@@ -537,7 +538,7 @@ def roll_over(self):
537538
W, L = np.min([L, W], axis=0), np.max([L, W], axis=0)
538539
mask = (W / H) < crit
539540
if any(mask):
540-
logger.info(f"Rolling over : {np.sum(mask)} icebergs ...")
541+
logger.debug(f"Rolling over : {np.sum(mask)} icebergs ...")
541542
nL, nW, nH = (np.max([L[mask], H[mask]], axis=0), np.min([L[mask], H[mask]], axis=0), W[mask])
542543
L[mask], W[mask], H[mask] = nL, nW, nH
543544
depthib = H * alpha

0 commit comments

Comments
 (0)