Skip to content

Commit 7d73a02

Browse files
committed
Small spelling fix, removing the TODO from the verticalmixing kernel, and adding a reflectatsurface kernel
1 parent 945ce07 commit 7d73a02

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

plasticparcels/kernels.py

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ def VerticalMixing(particle, fieldset, time):
489489
490490
Description
491491
----------
492-
A simple verticle mixing kernel that uses a markov-0 process to determine the vertical
492+
A simple vertical mixing kernel that uses a markov-0 process to determine the vertical
493493
displacement of a particle [1]. The deterministic component is determined
494494
using forward-difference with a given `delta_z`.
495495
@@ -524,7 +524,6 @@ def VerticalMixing(particle, fieldset, time):
524524

525525
# Compute the random walk component of Eq. (1)
526526
dz_random = ParcelsRandom.uniform(-1., 1.) * math.sqrt(math.fabs(particle.dt) * 3) * math.sqrt(2 * kz)
527-
# TODO - implement the reflective boundary condition
528527

529528
# Compute rise velocity component of Eq. (1) - Already accounted for in other kernels
530529
dz_wb = 0 # particle.settling_velocity * particle.dt
@@ -535,7 +534,31 @@ def VerticalMixing(particle, fieldset, time):
535534
# Update particle position
536535
particle_ddepth += ddepth # noqa
537536

538-
# Biofouling related kernels
537+
def reflectAtSurface(particle, fieldset, time):
538+
"""A reflecting boundary condition kernel at the ocean surface.
539+
540+
Description
541+
----------
542+
A simple kernel to reflect particles at the ocean surface if they go through the surface.
543+
544+
Parameter Requirements
545+
----------
546+
None
547+
548+
Kernel Requirements
549+
----------
550+
Order of Operations:
551+
This kernel should be performed after all vertical displacement kernels have been applied.
552+
553+
References
554+
----------
555+
None
556+
557+
"""
558+
potential_depth = particle.depth + particle_ddepth
559+
if potential_depth < 0.:# Particle is above the surface
560+
particle.depth = -potential_depth
561+
particle_ddepth = 0. # Set particle_ddepth to 0, as we have already updated the depth
539562

540563

541564
def unbeaching(particle, fieldset, time):

0 commit comments

Comments
 (0)