Skip to content

(0.97.6) Move the computation of flux BC before the time-stepping #4696

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

Merged
merged 11 commits into from
Aug 7, 2025

Conversation

simone-silvestri
Copy link
Collaborator

This PR is moving the computation of the boundary conditions just before the time-stepping of the prognostic variables, rather than at the end of the time-stepping procedure.

This is because, in Oceananigans, we add the flux bcs to the tendencies, which are computed at the end of a time step. However, if we need to couple a model, the exchange between components is typically computed at the end of the stepping of all the components, meaning that, if we do this, we do not add the updated fluxes to the tendency in an Oceananigans model; rather, the fluxes corresponding to the previous time-step.

This might become an issue when coupling on large time steps, where the fluxes lag behind and the model can overshoot.
This change will not affect oceananigans-only models, but will affect coupled models like the OceanSeaIceModel in ClimaOcean.jl.

@navidcy
Copy link
Member

navidcy commented Aug 6, 2025

This is because, in Oceananigans, we add the flux bcs to the tendencies, which are computed at the end of a time step.

So, how was this working for multi-step timestepping schemes? Before this PR the flux bcs were added at the end of the Δt or at the end of each substep?

@navidcy navidcy added numerics 🧮 So things don't blow up and boil the lobsters alive boundary conditions 🏓 labels Aug 7, 2025
@simone-silvestri
Copy link
Collaborator Author

@navidcy This is the difference between main and this PR in a one-step method like AB2 blue boxes are computed in ClimaOcean, black boxes in Oceanananigans.
RK3 is a little more complex but still has only one blue box per complete Oceananigans timestep.

ab2-timestepping

@simone-silvestri
Copy link
Collaborator Author

This is a bit oversemplified, but it is the RK3 timestepper
rk3-timestep

If we want to compute fluxes each substep we probably need a timestepper for the OceanSeaIceModel which would probably help a lot with stabiliy as we could substep the sea ice with the ocean

@simone-silvestri simone-silvestri merged commit 11e08a6 into main Aug 7, 2025
69 checks passed
@simone-silvestri simone-silvestri deleted the ss/treat-flux-boundary-differently branch August 7, 2025 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
boundary conditions 🏓 numerics 🧮 So things don't blow up and boil the lobsters alive
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants