Skip to content

(0.106.2) Refactor coriolis and add Triad scheme#5383

Merged
simone-silvestri merged 49 commits intomainfrom
ss/refactor-coriolis
Mar 25, 2026
Merged

(0.106.2) Refactor coriolis and add Triad scheme#5383
simone-silvestri merged 49 commits intomainfrom
ss/refactor-coriolis

Conversation

@simone-silvestri
Copy link
Copy Markdown
Collaborator

@simone-silvestri simone-silvestri commented Mar 9, 2026

This PR aims to do three things:

  • Make sure common coriolis models use the same schemes (i.e. BetaPlane, FPlane and SphericalCoriolis are all on a c-grid and can use the same schemes
  • Use the MITgcm active weigthing procedure for the EnstrophyConserving and EnergyConserving scheme
  • Implement the EEN Nemo scheme, a tad more complicated but not too much, it uses triads and it is proven to reduce the noise in the vertical velocity, which is what the active scheme should do, without any active masking
  • introduce Coriolis force in the split-explicit solver (not beneficial at the moment, to be tested thoroughly in another PR)

Point two is necessary since there are some problems in how we do active weighted interpolations. I suspect it is the averaging with the spacing. The motivation for this refactor is described here. The other two points are quality of life improvements and feature additions.
This PR might also help with #4912

@simone-silvestri simone-silvestri changed the title Refactor coriolis (0.105.5) Refactor coriolis and add EEN scheme Mar 9, 2026
@simone-silvestri
Copy link
Copy Markdown
Collaborator Author

Results from the validation case that mimicks the Jamart et al 1986 paper
jamart_basin_comparison

The images from the paper are here for convenience
image
image

@simone-silvestri
Copy link
Copy Markdown
Collaborator Author

@jm-c if you want to take a look

@glwagner
Copy link
Copy Markdown
Member

what happens on main?

@glwagner
Copy link
Copy Markdown
Member

should you put the test case into the coriolis documentation ?

@simone-silvestri
Copy link
Copy Markdown
Collaborator Author

should you put the test case into the coriolis documentation ?

Good idea! I ll also test on main.

@simone-silvestri
Copy link
Copy Markdown
Collaborator Author

simone-silvestri commented Mar 11, 2026

Ok after a lot of digging, I have the suspicion that the solution is very sensitive to the Coriolis scheme, because that is not added to the split explicit solver, so it is fixed in time and iterated upon many times. I guess that if I add the coriolis scheme to the SplitExplicitFreeSurface solver, the differences are way less since the barotropic flow adapts correctly to the coriolis force, making the flow less numerics-sensitive (typically it means pyhsics is more correctly represented)

This PR, therefore, will include a the refactor of the SplitExplicit to include the coriolis scheme in the fast dynamics (if I find out it is indeed relevant)

@jm-c
Copy link
Copy Markdown
Collaborator

jm-c commented Mar 12, 2026

Regarding the reference for EEN scheme:

from Sadourny, described by Burridge & Haseler, ECMWF Rep.4, 1977

but this was for relative vorticity (and not Coriolis), if I remember well. I can send you the pdf if you want.

@simone-silvestri
Copy link
Copy Markdown
Collaborator Author

Final update, then I think this PR can be merged. I have added two test cases with coriolis-free surface only dynamics (in the validation/coriolis folder). The results are as following:

  • Inserting Coriolis in the SplitExplicitFreeSurface does not change the results in both test cases I have investigated (we should keep it in mind though for the future, especially if we want to run super-coarse resolution cases)
  • I have implemented transport-based coriolis since it is beneficial for partial cells (defaults to the simple coriolis for grid-fitted bottom)
  • The Active-Weighted schemes (Jamart) are beneficial only in the very simple test case of the paper. Whenever there is a more complicated boundary they lead to numerical errors and energy injection given the amplification of the coriolis force. To make sure I didn't do anything wrong in the implementation, I have reproduced the same case with the MITgcm that shows the same exact error amplification of the active weighted schemes (selectCoriScheme=1)
compare_coriolis_final

So I would keep the simple EnsthrophyConserving as a default.

@glwagner
Copy link
Copy Markdown
Member

All of the Coriolis implementations should provide a scheme property and we should use the same default for all of them; also the implementation should be uniform.

I am not sure there is a point to the active-weighted schemes. It might be better to delete them. I am not sure in what case there is a benefit to the active weighted schemes -- is there a PR which demonstrated this for some case?

@simone-silvestri
Copy link
Copy Markdown
Collaborator Author

We have added these wet-point schemes because we found some benefit (the relevant PRs are #2729 and #4112).
So I think there might be some scope for keeping them, if someone finds numerical noise at the boundaries. We just can change the default because these schemes are not always a net benefit.

@jm-c
Copy link
Copy Markdown
Collaborator

jm-c commented Mar 19, 2026

I agree with this:

We have added these wet-point schemes because we found some benefit (the relevant PRs are #2729 and #4112). So I think there might be some scope for keeping them, if someone finds numerical noise at the boundaries. We just can change the default because these schemes are not always a net benefit.

@glwagner
Copy link
Copy Markdown
Member

I agree with this:

We have added these wet-point schemes because we found some benefit (the relevant PRs are #2729 and #4112). So I think there might be some scope for keeping them, if someone finds numerical noise at the boundaries. We just can change the default because these schemes are not always a net benefit.

PS can we please not call these "wet point" schemes? They do not only apply to ocean modeling. This is why we introduced the terminology "active weighted", because "active cells" generically apply to any fluid.

Just to get all the results in one place...

On 2729, there's a plot that shows the "regular scheme" on the left and "active weighted" scheme on the right:

image

the active-only scheme is shown on the right and has lower noise.

On 4112 we have

image

On this PR, there's a result above:

image

The analyses are not really consistent with one another though. It seems that active-weighted schemes reduce noise in the vertical velocity. But the analysis on this PR which shows spurious noise due to active weighted schemes looks only at horizontal velocity, and moreover is not a "full test" because it does not include momentum advection.

It feels to me like something is missing here.

@glwagner
Copy link
Copy Markdown
Member

  • Inserting Coriolis in the SplitExplicitFreeSurface does not change the results in both test cases I have investigated (we should keep it in mind though for the future, especially if we want to run super-coarse resolution cases)

Isn't this result specific to some physical parameters that you chose for the test and not a universal result? For example with smaller g or shallow water or very fast rotation, the free surface time-scale can be closer to the Coriolis time-scale. Thus this conclusion does not hold generically, it may hold for Earth's ocean. But then we cannot use this model for other planets or physical situations where the narrow assumptions of the test do not hold. Is there a downside to including Coriolis in the split-explicit solver? this is the more relevant question. I also recommend running validation cases where the Coriolis timescale and gravity wave speed are similar to understand the universality of the conclusion.

tomchor referenced this pull request Mar 20, 2026
…lization of the interior (#5329)

* Enhance MetalGPU support: add device handling for AbstractArray and remove maybe_copy_interior

* Fix initialization flag in reduction operations for fields

* Remove unused device method for AbstractArray

* Refactor device function to accept AbstractArray for broader compatibility

* Refactor device function to use Metal.device for Base.ReshapedArray

* Add comment about extension for Metal.device to support Base.ReshapedArray

* Metal 1.9.3 fix mapreduce device check
@tomchor tomchor changed the title (0.105.5) Refactor coriolis and add EEN scheme (0.106.1) Refactor coriolis and add EEN scheme Mar 20, 2026
@simone-silvestri
Copy link
Copy Markdown
Collaborator Author

For sure it might be relevant for other coriolis parameters / coarser resolutions. We should always keep in mind that we are doing this approximation. The only downside is the more computations we need to do which make the free surface heavier in the time stepping

@simone-silvestri simone-silvestri changed the title (0.106.1) Refactor coriolis and add EEN scheme (0.106.1) Refactor coriolis and add Triad scheme Mar 24, 2026
@simone-silvestri
Copy link
Copy Markdown
Collaborator Author

The analyses are not really consistent with one another though. It seems that active-weighted schemes reduce noise in the vertical velocity. But the analysis on this PR which shows spurious noise due to active weighted schemes looks only at horizontal velocity, and moreover is not a "full test" because it does not include momentum advection.

Yeah it's a typical case of balanced pros vs cons, there is not a universal "better" scheme in this case.
I have added momentum advection in the tests in this PR and it does not change the picture

@jm-c
Copy link
Copy Markdown
Collaborator

jm-c commented Mar 24, 2026

Regarding Coriolis in borotropic sub-time-stepping (split-expliicit free-surface): There might be an inconsistency on C-grid with immerse BC, where the Coriolis tendency of the barotropic model, which is evaluated from the barotropic transport, does not match the vertical integral of the the baroclinic Coriolis tendency.
This would be an other reason to leave this part aside and address it in an other PR.

@glwagner glwagner changed the title (0.106.1) Refactor coriolis and add Triad scheme (0.106.2) Refactor coriolis and add Triad scheme Mar 24, 2026
@simone-silvestri
Copy link
Copy Markdown
Collaborator Author

The failure on the oneAPI extension does not seem related. I will merge. Let's keep in mind the possible SplitExplicitFreeSurface change where we include the Coriolis term in the free surface solver

@simone-silvestri simone-silvestri merged commit 9759c4a into main Mar 25, 2026
11 of 14 checks passed
@simone-silvestri simone-silvestri deleted the ss/refactor-coriolis branch March 25, 2026 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants