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

Allow Tuple of closures with CATKE #3960

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

Conversation

simone-silvestri
Copy link
Collaborator

in this way we don't timestep the energy equation twice within a time step when using a tuple of closures containing CATKE

Copy link
Member

@ali-ramadhan ali-ramadhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Was this a numerical bug, or is it just a performance issue as the :e tendency term was being computed twice? I assume it's done somewhere in the TurbulenceClosures module.

@simone-silvestri
Copy link
Collaborator Author

I think it is a bug because the tracer is advanced in the TurbulenceClosures module here

So with closure tuple it is advanced twice

@simone-silvestri
Copy link
Collaborator Author

Should I add a test for it?

@ali-ramadhan
Copy link
Member

Always good to add a test! Especially since this issue might come up again in the future with refactors.

I'm just trying to think of a good test... Are there analytic solutions to the TKE where we can take one time step and make sure the TKE values are correct (and that only one, not two, time steps were taken)?

As a side note: I've been running with CATKE in a tuple of closures and I encountered NaNs at the bottom-most grid cell but the simulations seems to continue time stepping just fine. Maybe it's related to this bug fix?

@simone-silvestri
Copy link
Collaborator Author

We can also brutally just check that we do not step the kinetic energy twice:
i.e that

eⁿ⁺¹ == eⁿ + Δt * Gᵉ # we have to account for the fast parts that depend on uⁿ⁺¹ here

and not

eⁿ⁺¹ == eⁿ + 2 * Δt * Gᵉ 

@glwagner
Copy link
Member

We can also brutally just check that we do not step the kinetic energy twice: i.e that

eⁿ⁺¹ == eⁿ + Δt * Gᵉ # we have to account for the fast parts that depend on uⁿ⁺¹ here

and not

eⁿ⁺¹ == eⁿ + 2 * Δt * Gᵉ 

We do this elsewhere, eg for test_forcings.jl, I think adding a forcing test with CATKE + e would be quick and easy.

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.

3 participants