-
Notifications
You must be signed in to change notification settings - Fork 139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for CROCO 3D velocities #1641
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Also added idealised unit test
for more information, see https://pre-commit.ci
As of commit 40b76ac, this test has been failing. Not at all clear why, so temporarily silencing them
…w covered by xfail
…olving depth layers?
Improving calculation of local w velocity
…w that in tutorial overview
Fixing mypy error
for more information, see https://pre-commit.ci
VeckoTheGecko
requested changes
Oct 15, 2024
VeckoTheGecko
approved these changes
Oct 16, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements support for 3D velocities in CROCO (and potentially also ROMS, but not tested). Users can simply call
FieldSet.from_croco()
and provide thew
field from CROCO output in theirvariables
list and call theAdvectionRK4_3D
kernel. Under the hood, Parcels will then replace the kernel withAdvectionRK4_3D_CROCO
, which works slightly different from the normal 3D advection kernel because it converts the vertical velocity in sigma-units.In particular, the following algorithm is used (note that the RK4 version is slightly more complex than this Euler-Forward version, but the idea is identical)
We have tested this algorithm on an idealised setup (created by @vesnaber) of a purely zonal flow over a sloping bottom. Particles indeed stay on their depth levels (so cross sigma-levels) as expected, with this algorithm. So we think this is an appropriate scheme.
To make this work under the hood, we had to adapt Parcels to convert from particle depth (in m) to sigma-coordinates in Field interpolations. In a call such as
fieldset.U[time, particle.depth, particle.lat, particle.lon]
, theparticle.depth
will thus under-the-hood be converted tosigma
(= particle.depth / fieldset.H[time, particle.depth, particle.lat, particle.lon]
).Todo before this PR can be merged
FieldSet.from_croco()
for seamless usew
field)