Skip to content

Lagrangian-averaged DynamicSmagorinsky producing zero values for eddy viscosity (again) #5365

@tomchor

Description

@tomchor

Including "again" in the title to differentiate from #5257, which already reported on the same issue, which at the time was fixed by #5260, which made it's way to v0.104.4.

Version 0.105.0 seems to have reintroduced the issue, most likely through #5274

Here's a MWE

using Oceananigans

grid = RectilinearGrid(size = (4, 4, 4), extent = (1, 1, 1))
model = NonhydrostaticModel(grid, closure = DynamicSmagorinsky())
set!(model, u = (x, y, z) -> randn())
@show model.closure_fields.νₑ

On v0.104.4 and 0.104.5 this correctly produces:

model.closure_fields.νₑ = 4×4×4 Field{Center, Center, Center} on RectilinearGrid on CPU
├── grid: 4×4×4 RectilinearGrid{Float64, Periodic, Periodic, Bounded} on CPU with 3×3×3 halo
├── boundary conditions: FieldBoundaryConditions
│   └── west: Periodic, east: Periodic, south: Periodic, north: Periodic, bottom: ZeroFlux, top: ZeroFlux, immersed: Nothing
└── data: 10×10×10 OffsetArray(::Array{Float64, 3}, -2:7, -2:7, -2:7) with eltype Float64 with indices -2:7×-2:7×-2:7
    └── max=0.0146458, min=0.00268382, mean=0.00655843

But from v0.105.0 onward this produces

model.closure_fields.νₑ = 4×4×4 Field{Center, Center, Center} on RectilinearGrid on CPU
├── grid: 4×4×4 RectilinearGrid{Float64, Periodic, Periodic, Bounded} on CPU with 3×3×3 halo
├── boundary conditions: FieldBoundaryConditions
│   └── west: Periodic, east: Periodic, south: Periodic, north: Periodic, bottom: ZeroFlux, top: ZeroFlux, immersed: Nothing
└── data: 10×10×10 OffsetArray(::Array{Float64, 3}, -2:7, -2:7, -2:7) with eltype Float64 with indices -2:7×-2:7×-2:7
    └── max=0.0, min=0.0, mean=0.0

I'm assuming there's a missing method somewhere and some function (initialization maybe?) is defaulting to the fallback and failing silently. I guess we added #5310 after the bug was reintroduced? (I can't find that PR in any release notes for whatever reason)

cc @glwagner

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐞Even a perfect program still has bugs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions