OceanParcels / Parcels

Main code for Parcels (Probably A Really Computationally Efficient Lagrangian Simulator)
https://www.oceanparcels.org
MIT License
294 stars 135 forks source link

Update smagdiff function #1656

Closed coquereau closed 2 months ago

coquereau commented 2 months ago

The Smagdiff function didn't update the particle's position because it didn't modify the lat and lon attributes of the "particle" object. This problem has now been solved.

erikvansebille commented 2 months ago

Thanks for your involvement in parcels development and for creating this PR, @coquereau!

However, I'm not sure it does what you expect. Since Parcels v3.0, changes to particle position need to be given through he particle_dlon and particle_dlat variables; see the kernel loop tutorial. This is the only way to facilitate vectorial summing of displacements.

If the Smagorinski kernel does not work for you, that's likely because you're running a version pre-v3.0? In that case, check the documentation for your version (using the version switcher on the bottom right) and you'll see the right version of the kernel at e.g. https://docs.oceanparcels.org/en/v2.4.2/examples/tutorial_diffusion.html (for version 2.4.2)

coquereau commented 2 months ago

Thank you for your comments. You're absolutely right, I was using an older version of Parcels, which is why it wasn't working for me. I've updated it, everything works now. Sorry for the loss of time. And thanks for Parcels!

VeckoTheGecko commented 2 months ago

All good, we're glad you got it working 😄