Skip to content

Commit 277a984

Browse files
Updating Argo kernel to parcels v3 ddepth
1 parent 760610c commit 277a984

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

virtualship.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,8 @@ def ArgoVerticalMovement(particle, fieldset, time):
453453
if particle.cycle_phase == 0:
454454
# Phase 0: Sinking with vertical_speed until depth is driftdepth
455455
particle_ddepth += fieldset.vertical_speed * particle.dt
456-
if particle.depth >= fieldset.driftdepth:
456+
if particle.depth + particle_ddepth >= fieldset.driftdepth:
457+
particle_ddepth = fieldset.driftdepth - particle.depth
457458
particle.cycle_phase = 1
458459

459460
elif particle.cycle_phase == 1:
@@ -466,15 +467,16 @@ def ArgoVerticalMovement(particle, fieldset, time):
466467
elif particle.cycle_phase == 2:
467468
# Phase 2: Sinking further to maxdepth
468469
particle_ddepth += fieldset.vertical_speed * particle.dt
469-
if particle.depth <= fieldset.maxdepth:
470+
if particle.depth + particle_ddepth <= fieldset.maxdepth:
471+
particle_ddepth = fieldset.maxdepth - particle.depth
470472
particle.cycle_phase = 3
471473

472474
elif particle.cycle_phase == 3:
473475
# Phase 3: Rising with vertical_speed until at surface
474476
particle_ddepth -= fieldset.vertical_speed * particle.dt
475477
particle.cycle_age += particle.dt # solve issue of not updating cycle_age during ascent
476-
if particle.depth >= fieldset.mindepth:
477-
particle.depth = fieldset.mindepth
478+
if particle.depth + particle_ddepth >= fieldset.mindepth:
479+
particle_ddepth = fieldset.mindepth - particle.depth
478480
particle.temperature = math.nan # reset temperature to NaN at end of sampling cycle
479481
particle.salinity = math.nan # idem
480482
particle.cycle_phase = 4

0 commit comments

Comments
 (0)