@@ -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
541564def unbeaching (particle , fieldset , time ):
0 commit comments