Skip to content

Commit 2734c7e

Browse files
authored
Merge pull request #1708 from knutfrode/dev
Fix for vertical mixing with negative timesteps
2 parents d8bdb0a + 22e6bc4 commit 2734c7e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

opendrift/models/oceandrift.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ def vertical_mixing(self, store_depths=False):
524524
r = 1.0/3
525525
# New position = old position - up_K_flux + random walk
526526
self.elements.z = self.elements.z - self.elements.moving*(
527-
dKdz*dt_mix - R*np.sqrt((Kz*dt_mix*2/r)))
527+
dKdz*dt_mix - R*np.sqrt((Kz*np.abs(dt_mix)*2/r)))
528528

529529
# Reflect from surface
530530
reflect = np.where(self.elements.z >= 0)
@@ -550,7 +550,7 @@ def vertical_mixing(self, store_depths=False):
550550
# Formation of slick and wave mixing for surfaced particles
551551
# if implemented for this class
552552
self.surface_stick()
553-
self.surface_wave_mixing(dt_mix)
553+
self.surface_wave_mixing(np.abs(dt_mix))
554554

555555
# Let particles stick to bottom
556556
bottom = np.where(self.elements.z < Zmin)

0 commit comments

Comments
 (0)