Skip to content

Cleanup of CATKE and TKE previous_velocities#5483

Open
simone-silvestri wants to merge 3 commits intomainfrom
ss/remove-extra-velocities
Open

Cleanup of CATKE and TKE previous_velocities#5483
simone-silvestri wants to merge 3 commits intomainfrom
ss/remove-extra-velocities

Conversation

@simone-silvestri
Copy link
Copy Markdown
Collaborator

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

we do not need the previous_velocities for CATKE and TKEBased vertical diffusivities anymore because the velocities used to advect the tracers are in themselves "previous velocities".

Therefore, this PR removes the extra memory allocation by passing the transport_velocities to CATKE and TKE-based closure.

I also removed the active_cell_map since it is introduced automatically when launching the kernels with :xyz and :xy

This PR also removes the substepping of TKE for RK time discretization since the derivation was done for AB2 so the interaction with RK is not validated.

launch!(arch, grid, :xyz,
_rk_substep_turbulent_kinetic_energy!,
Le, σe⁻, grid, closure,
model.velocities, model.transport_velocities,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

which one of these is the velocity at n and which one is n+1? I'm confused about this...

Le, Lϵ,
grid, closure,
model.velocities, previous_velocities,
model.velocities, model.transport_velocities,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This will have to change soon if we want to use this for Breeze (which does not have transport_velocities) . Not sure the best way to capture this, but basically this is an optimization which makes the closure implementation less general

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also the NonhydrostaticModel does not have transport_velocities

Copy link
Copy Markdown
Member

@glwagner glwagner left a comment

Choose a reason for hiding this comment

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

We should consider this carefully because it is a specific optimization that makes it so we can't use these closures either with the NonhydrostaticModel or Breeze.AtmosphereModel.

@simone-silvestri
Copy link
Copy Markdown
Collaborator Author

Right it would limit the usage to only the hydrostatic model. Let's keep it hanging a bit, then we see if we could take another route.

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.

2 participants