From 5dd96cf310e988fc5d3a2523c2dcc7197f18ff62 Mon Sep 17 00:00:00 2001 From: Jago Strong-Wright Date: Fri, 6 Oct 2023 10:30:22 +0100 Subject: [PATCH] (0.89.1) Make maximum numeric diffusivity more generic for named tuples of diffusivity (#3274) * Update turbulence_closure_diagnostics.jl * Bump patch number * Update turbulence_closure_diagnostics.jl [skip ci] * Update TurbulenceClosures.jl * Update src/TurbulenceClosures/turbulence_closure_diagnostics.jl Co-authored-by: Gregory L. Wagner --------- Co-authored-by: Gregory L. Wagner Co-authored-by: Navid C. Constantinou --- Project.toml | 2 +- src/TurbulenceClosures/TurbulenceClosures.jl | 1 + src/TurbulenceClosures/turbulence_closure_diagnostics.jl | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index e01b7e9536..f7cc4cc415 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Oceananigans" uuid = "9e8cae18-63c1-5223-a75c-80ca9d6e9a09" authors = ["Climate Modeling Alliance and contributors"] -version = "0.89.0" +version = "0.89.1" [deps] Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" diff --git a/src/TurbulenceClosures/TurbulenceClosures.jl b/src/TurbulenceClosures/TurbulenceClosures.jl index 5cf2abf31a..60c27b9d3a 100644 --- a/src/TurbulenceClosures/TurbulenceClosures.jl +++ b/src/TurbulenceClosures/TurbulenceClosures.jl @@ -49,6 +49,7 @@ using Oceananigans.BuoyancyModels using Oceananigans.Utils using Oceananigans.Architectures: AbstractArchitecture, device +using Oceananigans.Fields: FunctionField import Oceananigans.Advection: required_halo_size const VerticallyBoundedGrid{FT} = AbstractGrid{FT, <:Any, <:Any, <:Bounded} diff --git a/src/TurbulenceClosures/turbulence_closure_diagnostics.jl b/src/TurbulenceClosures/turbulence_closure_diagnostics.jl index 5466be6545..839f6d4456 100644 --- a/src/TurbulenceClosures/turbulence_closure_diagnostics.jl +++ b/src/TurbulenceClosures/turbulence_closure_diagnostics.jl @@ -22,7 +22,8 @@ cell_diffusion_timescale(model) = cell_diffusion_timescale(model.closure, model. cell_diffusion_timescale(::Nothing, diffusivities, grid) = Inf maximum_numeric_diffusivity(κ::Number) = κ -maximum_numeric_diffusivity(κ::NamedTuple) = maximum(κ) +maximum_numeric_diffusivity(κ::FunctionField) = maximum(κ) +maximum_numeric_diffusivity(κ_tuple::NamedTuple) = maximum(maximum_numeric_diffusivity(κ) for κ in κ_tuple) maximum_numeric_diffusivity(κ::NamedTuple{()}) = 0 # tracers=nothing means empty diffusivity tuples maximum_numeric_diffusivity(::Nothing) = 0