Skip to content

Commit 287d228

Browse files
committed
Update to windage kernel to only sample wind_U and wind_V if they are going to be applied.
1 parent 2cbb03f commit 287d228

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

plasticparcels/kernels.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,13 @@ def WindageDrift(particle, fieldset, time):
102102
(ocean_U, ocean_V) = fieldset.UV[particle]
103103
ocean_speed = math.sqrt(ocean_U**2 + ocean_V**2)
104104

105-
# Sample the U / V components of wind
106-
wind_U = fieldset.Wind_U[time, particle.depth, particle.lat, particle.lon]
107-
wind_V = fieldset.Wind_V[time, particle.depth, particle.lat, particle.lon]
108-
109105
# Apply windage to particles that have some exposed surface above the ocean surface
110106
# Use a basic approach to only apply windage to particle in the ocean
111-
if particle.depth < 0.5*particle.plastic_diameter and ocean_speed > 1E-12:
107+
if particle.depth < 0.5*particle.plastic_diameter and ocean_speed > 1E-14:
108+
# Sample the U / V components of wind
109+
wind_U = fieldset.Wind_U[time, particle.depth, particle.lat, particle.lon]
110+
wind_V = fieldset.Wind_V[time, particle.depth, particle.lat, particle.lon]
111+
112112
# Compute particle displacement
113113
particle_dlon += particle.wind_coefficient * (wind_U - ocean_U) * particle.dt # noqa
114114
particle_dlat += particle.wind_coefficient * (wind_V - ocean_V) * particle.dt # noqa

0 commit comments

Comments
 (0)