Skip to content
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

RK3 for the hydrostatic free surface model #3874

Closed
wants to merge 13 commits into from

Conversation

simone-silvestri
Copy link
Collaborator

@simone-silvestri simone-silvestri commented Oct 28, 2024

paired with a splitting of the barotropic- baroclinic mode described in
https://www.sciencedirect.com/science/article/abs/pii/S0021999122001127?fr=RR-2&ref=pdf_download&rr=8d81dd3bab0dba9a which seems to ensure consistency in the forcing of the barotropic and baroclinic mode.

The algorithm follows:

substep 1

  • $u^{*, n+1/2} = u^{n} + \Delta t G(u^{n})$
  • $U^{n+1/2} = \text{barotropic-step}\left( u^n, \eta^n, G(u^{n}) \right)$
  • $u^{n+1/2} = \text{barotropic-correction}\left(u^{*, n+1/2}, U^{n+1/2} \right)$

substep 2

  • $u^{*, n+1/3} = \frac{3}{4}u^{n} + \frac{1}{4}\left(u^{n+1/2} + \Delta t G(u^{n+1/2}) \right)$
  • $U^{*, n+1/3} = \text{barotropic-step}\left(u^{n+1/2}, \eta^{n+1/2}, G(u^{n+1/2}) \right)$
  • $U^{n+1/3} = \frac{3}{4}U^{n} + \frac{1}{4}U^{*, n+1/3}$
  • $u^{n+1/3} = \text{barotropic-correction}\left(u^{*, n+1/3}, U^{n+1/3} \right)$

substep 3

  • $u^{*, n+1} = \frac{1}{3}u^{n} + \frac{2}{3}\left(u^{n+1/3} + \Delta t G(u^{n+1/3})\right)$
  • $\overline{G}^{n+1} = \frac{1}{6}G(u^{n}) + \frac{1}{6}G(u^{n+1/2}) + \frac{2}{3}G(u^{n+1/3})$
  • $U^{n+1} = \text{barotropic-step}\left(u^{n}, \eta^{n}, \overline{G}^{n+1} \right)$
  • $u^{n+1} = \text{barotropic-correction}\left(u^{*, n+1}, U^{n+1} \right)$

The proof of concept in this PR is working and allowing a much larger CFL than the AB2 code we use (with the added benefit of reducing the implicit diffusion of the AB2 scheme and being self-starting from time-step n).

This is just a PR thrown together to check this numerical scheme works. I would like to do a couple of improvements on the SplitExplicit code before bringing this PR to a mergeable state. The suggested improvements are described in issue #3873

@simone-silvestri simone-silvestri marked this pull request as draft October 28, 2024 10:27
@simone-silvestri
Copy link
Collaborator Author

simone-silvestri commented Oct 28, 2024

For the moment this works only with the SplitExplicitFreeSurface but I think it can be extended to work also with an implicit free surface following the above mentioned algorithm where $\text{barotropic-step}$ and $\text{barotropic-correction}$ are substituted with a solve of the linear system (starting from interpolated velocities) and a pressure correction step with interpolated eta, i.e.:

substep 1:

  • $u^{*, n+1/2} = u^{n} + \Delta t G(u^{n})$
  • $\eta^{n+1/2} = \text{barotropic-solve}\left(\eta^n, \int_z u^{*, n+1/2} \right)$
  • $u^{n+1/2} = \text{pressure-correction}\left(u^{*, n+1/2}, \eta^{n+1/2} \right)$

substep 2

  • $u^{*, n+1/3} = \frac{3}{4}u^{n} + \frac{1}{4}\left(u^{n+1/2} + \Delta t G(u^{n+1/2}) \right)$
  • $\eta^* = \text{barotropic-solve}\left(\eta^{n+1/2}, \int_z u^{*, n+1/3} \right)$
  • $\eta^{n+1/3} = \frac{3}{4}\eta^{n} + \frac{1}{4}\eta^*$
  • $u^{n+1/3} = \text{pressure-correction}\left(u^{*, n+1/3}, \eta^{n+1/3} \right)$

substep 3

  • $u^{*, n+1} = \frac{1}{3}u^{n} + \frac{2}{3}\left(u^{n+1/3} + \Delta t G(u^{n+1/3})\right)$
  • $\int_z u ^{n+1} = \frac{1}{6}\int_z u^{n} + \frac{1}{6}\int_z u^{n+1/2} + \frac{2}{3}\int_z u^{*, n+1}$
  • $\eta^{n+1} = \text{barotropic-solve}\left(\eta^{n}, \int_z u ^{n+1} \right)$
  • $u^{n+1} = \text{pressure-correction}\left(u^{*, n+1}, \eta^{n+1}\right)$

@simone-silvestri
Copy link
Collaborator Author

It is indeed equivalent in terms of results: when testing tracer advection with a fixed velocity it looks like the profiles are identical for this timestepper in the HydrostaticModel and a NonhydrostaticModel (so probably it is good to have just one rk3 timestepper type)

There is some difference in the nomenclature which I think allows a better understanding of how to split the barotropic and baroclinic modes, because the previous old field are stored and used to restart the substeps instead of having two different tendencies that are averaged at each substep.

@glwagner
Copy link
Member

There are some differences between how this algorithm is implemented and how we do the stepping for the NonhydrostaticModel --- do you have any comment about that? We could try implementing this kind of algorithm for the NonhydrostaticModel as well. The implicit free surface solve can be interpreted as a 2D pressure solve, which in the nonhydrostatic context is replaced by a 3D pressure solve.

In particular, it seems that the intermediate predictor velocities $u^\star$ are computed differently and different coefficients are used (1/4, 3/4, 1/3, 2/3) than what we currently use for RK3 in the NonhydrostaticModel:

γ¹ = 8 // 15
γ² = 5 // 12
γ³ = 3 // 4
ζ² = -17 // 60
ζ³ = -5 // 12

PS ^\star is superior to *!

@glwagner
Copy link
Member

It is indeed equivalent in terms of results: when testing tracer advection with a fixed velocity it looks like the profiles are identical for this timestepper in the HydrostaticModel and a NonhydrostaticModel (so probably it is good to have just one rk3 timestepper type)

There is some difference in the nomenclature which I think allows a better understanding of how to split the barotropic and baroclinic modes, because the previous old field are stored and used to restart the substeps instead of having two different tendencies that are averaged at each substep.

Ah sorry after I wrote that (a now deleted comment) I realized there were some subtle differences which I noted above.

@glwagner
Copy link
Member

Perhaps worth stating here that I think RK3 is vastly superior to AB2 not only because of the faster time-to-solution but also because it is "self-starting" (does not depend on tendencies from previous time-steps), checkpointing is cheaper and simplified, and the chance of bugs (which cost us nearly 6 months during parameterization development in the past) wherein "restarted" simulations can fail when the prior tendencies have NaN even if we attempt to start with an Euler time-step. So RK3 is both faster and simpler.

@navidcy navidcy added the numerics 🧮 So things don't blow up and boil the lobsters alive label Oct 28, 2024
@simone-silvestri
Copy link
Collaborator Author

This PR is a little stale, I ll open a version two that is cleaner and close this one.

@simone-silvestri
Copy link
Collaborator Author

closed in favor of #3930

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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