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

Error using closure tuples with CATKEVerticalDiffusivity #3804

Closed
glwagner opened this issue Sep 30, 2024 · 0 comments · Fixed by #3805
Closed

Error using closure tuples with CATKEVerticalDiffusivity #3804

glwagner opened this issue Sep 30, 2024 · 0 comments · Fixed by #3805
Labels
bug 🐞 Even a perfect program still has bugs

Comments

@glwagner
Copy link
Member

using Oceananigans
using Oceananigans.Units
using Oceananigans.TurbulenceClosures: CATKEVerticalDiffusivity

grid = RectilinearGrid(size=128, z=(-128, 0), topology=(Flat, Flat, Bounded))

closure = (VerticalScalarDiffusivity(VerticallyImplicitTimeDiscretization(), κ=1e-4),
           CATKEVerticalDiffusivity())

model = HydrostaticFreeSurfaceModel(; grid, closure,
                                    tracers = (:b, :e),
                                    buoyancy = BuoyancyTracer())

bᵢ(z) = 1e-5 * z
set!(model, b = bᵢ)
simulation = Simulation(model, Δt=1minute, stop_iteration=10)

run!(simulation)

generates the error

julia> include("tupled_vertical_diffusion.jl")
[ Info: Initializing simulation...
[ Info:     ... simulation initialization complete (2.367 seconds)
[ Info: Executing initial time step...
ERROR: LoadError: type Tuple has no field κe
Stacktrace:
  [1] getproperty
    @ ./Base.jl:37 [inlined]
  [2] time_step_catke_equation!(model::HydrostaticFreeSurfaceModel{…})
    @ Oceananigans.TurbulenceClosures.TKEBasedVerticalDiffusivities ~/Projects/Oceananigans.jl/src/TurbulenceClosures/turbulence_closure_implementations/TKEBasedVerticalDiffusivities/time_step_catke_equation.jl:25
  [3] compute_diffusivities!(diffusivities::@NamedTuple{}, closure::CATKEVerticalDiffusivity{…}, model::HydrostaticFreeSurfaceModel{…}; parameters::Symbol)
    @ Oceananigans.TurbulenceClosures.TKEBasedVerticalDiffusivities ~/Projects/Oceananigans.jl/src/TurbulenceClosures/turbulence_closure_implementations/TKEBasedVerticalDiffusivities/catke_vertical_diffusivity.jl:197
  [4] compute_diffusivities!
    @ ~/Projects/Oceananigans.jl/src/TurbulenceClosures/turbulence_closure_implementations/TKEBasedVerticalDiffusivities/catke_vertical_diffusivity.jl:181 [inlined]
  [5] #compute_diffusivities!#24
    @ ~/Projects/Oceananigans.jl/src/TurbulenceClosures/closure_tuples.jl:79 [inlined]
  [6] compute_diffusivities!
    @ ~/Projects/Oceananigans.jl/src/TurbulenceClosures/closure_tuples.jl:76 [inlined]
  [7] update_state!(model::HydrostaticFreeSurfaceModel{…}, grid::RectilinearGrid{…}, callbacks::Tuple{}; compute_tendencies::Bool)
    @ Oceananigans.Models.HydrostaticFreeSurfaceModels ~/Projects/Oceananigans.jl/src/Models/HydrostaticFreeSurfaceModels/single_column_model_mode.jl:72
  [8] update_state!
    @ ~/Projects/Oceananigans.jl/src/Models/HydrostaticFreeSurfaceModels/single_column_model_mode.jl:64 [inlined]
  [9] update_state!
    @ ~/Projects/Oceananigans.jl/src/Models/HydrostaticFreeSurfaceModels/update_hydrostatic_free_surface_model_state.jl:29 [inlined]
 [10] time_step!(model::HydrostaticFreeSurfaceModel{…}, Δt::Float64; callbacks::Tuple{}, euler::Bool)
    @ Oceananigans.TimeSteppers ~/Projects/Oceananigans.jl/src/TimeSteppers/quasi_adams_bashforth_2.jl:123
 [11] time_step!(sim::Simulation{HydrostaticFreeSurfaceModel{…}, Float64, Float64, OrderedCollections.OrderedDict{…}, OrderedCollections.OrderedDict{…}, OrderedCollections.OrderedDict{…}})
    @ Oceananigans.Simulations ~/Projects/Oceananigans.jl/src/Simulations/run.jl:122
 [12] run!(sim::Simulation{HydrostaticFreeSurfaceModel{…}, Float64, Float64, OrderedCollections.OrderedDict{…}, OrderedCollections.OrderedDict{…}, OrderedCollections.OrderedDict{…}}; pickup::Bool)
    @ Oceananigans.Simulations ~/Projects/Oceananigans.jl/src/Simulations/run.jl:97
 [13] run!(sim::Simulation{HydrostaticFreeSurfaceModel{…}, Float64, Float64, OrderedCollections.OrderedDict{…}, OrderedCollections.OrderedDict{…}, OrderedCollections.OrderedDict{…}})
    @ Oceananigans.Simulations ~/Projects/Oceananigans.jl/src/Simulations/run.jl:85
 [14] top-level scope
    @ ~/Projects/Oceananigans.jl/validation/vertical_mixing_closures/tupled_vertical_diffusion.jl:20
 [15] include(fname::String)
    @ Base.MainInclude ./client.jl:489
 [16] top-level scope
    @ REPL[1]:1
in expression starting at /Users/gregorywagner/Projects/Oceananigans.jl/validation/vertical_mixing_closures/tupled_vertical_diffusion.jl:20
Some type information was truncated. Use `show(err)` to see complete types.
@glwagner glwagner added the bug 🐞 Even a perfect program still has bugs label Oct 1, 2024
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant