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

cell_diffusion_timescale is not defined for CATKEVerticalDiffusivity #3772

Open
ali-ramadhan opened this issue Sep 9, 2024 · 1 comment
Open
Labels
bug 🐞 Even a perfect program still has bugs turbulence closures 🎐

Comments

@ali-ramadhan
Copy link
Member

ali-ramadhan commented Sep 9, 2024

Based on

# Vertically-implicit treatment of vertical diffusivity has no time-step restriction
cell_diffusion_timescale(::ConvectiveAdjustmentVerticalDiffusivity{<:VerticallyImplicitTimeDiscretization},
diffusivities, grid) = Inf

CATKE should also have an infinite cell diffusion timescale with the default implicit time discretization.

When CATKE is run with explicit time discretization I suppose the cell diffusion timescale should be computed from the maximum viscosity/diffusivity in model.diffusivity_fields.

Happy to add these cell_diffusion_timescale methods.

I know CATKEVerticalDiffusivity is not exported so I'm just opening the issue to document.


MWE:

using Oceananigans
using Oceananigans.TurbulenceClosures: CATKEVerticalDiffusivity

grid = RectilinearGrid(size=(12, 12, 12), extent=(1, 1, 1))
closure = CATKEVerticalDiffusivity()
buoyancy = SeawaterBuoyancy()
tracers = (:T, :S, :e)

model = HydrostaticFreeSurfaceModel(; grid, closure, buoyancy, tracers)

DiffusiveCFL(1.23)(model)

Error:

ERROR: MethodError: no method matching cell_diffusion_timescale(::CATKEVerticalDiffusivity{…}, ::@NamedTuple{…}, ::RectilinearGrid{…})

Closest candidates are:
  cell_diffusion_timescale(::Nothing, ::Any, ::Any)
   @ Oceananigans ~/atdepth/Oceananigans.jl/src/TurbulenceClosures/turbulence_closure_diagnostics.jl:22
  cell_diffusion_timescale(::ScalarBiharmonicDiffusivity{Dir}, ::Any, ::Any) where Dir
   @ Oceananigans ~/atdepth/Oceananigans.jl/src/TurbulenceClosures/turbulence_closure_diagnostics.jl:40
  cell_diffusion_timescale(::SmagorinskyLilly, ::Any, ::Any)
   @ Oceananigans ~/atdepth/Oceananigans.jl/src/TurbulenceClosures/turbulence_closure_diagnostics.jl:47
  ...

Stacktrace:
 [1] cell_diffusion_timescale(model::HydrostaticFreeSurfaceModel{…})
   @ Oceananigans.TurbulenceClosures ~/atdepth/Oceananigans.jl/src/TurbulenceClosures/turbulence_closure_diagnostics.jl:21
 [2] (::CFL{…})(model::HydrostaticFreeSurfaceModel{…})
   @ Oceananigans.Diagnostics ~/atdepth/Oceananigans.jl/src/Diagnostics/cfl.jl:25
 [3] top-level scope
   @ REPL[24]:1
Some type information was truncated. Use `show(err)` to see complete types.
@ali-ramadhan ali-ramadhan added bug 🐞 Even a perfect program still has bugs turbulence closures 🎐 labels Sep 9, 2024
@glwagner
Copy link
Member

Honestly, I hadn't considered trying to run CATKE with explicit time-stepping! Yes, this is good to add.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Even a perfect program still has bugs turbulence closures 🎐
Projects
None yet
Development

No branches or pull requests

2 participants