-
Notifications
You must be signed in to change notification settings - Fork 267
Open
Description
Below is an MWE:
using Oceananigans
grid = RectilinearGrid(CPU(), size = (4, 4), extent = (1, 1), topology = (Bounded, Flat, Bounded))
b_bc(y, z, t) = tanh(t)
b_bcs = FieldBoundaryConditions(west = FluxBoundaryCondition(b_bc))
model = NonhydrostaticModel(; grid,
tracers = :b,
buoyancy = BuoyancyTracer(),
boundary_conditions = (; b = b_bcs))
simulation = Simulation(model; Ξt = 1, stop_time = 2)
simulation.output_writers[:jld2] = JLD2Writer(model, (; b = model.tracers.b);
filename = joinpath("./instantaneous_fields.jld2"),
schedule = IterationInterval(1),
with_halos = true,
overwrite_existing = true)
run!(simulation)
b_data = FieldTimeSeries("./instantaneous_fields.jld2", "b", backend=OnDisk())
# b_data = FieldTimeSeries("./instantaneous_fields.jld2", "b")
b_data[1]
interior(b_data[1])doing b_data[1] gives
julia> b_data[1]
ERROR: MethodError: objects of type Nothing are not callable
The object of type `Nothing` exists, but no method is defined for this combination of argument types when trying to treat it as a callable object.
Stacktrace:
[1] fill_halo_event!
@ c:\Users\xinle\Dropbox\MIT\main_oceananigans\Oceananigans.jl\src\BoundaryConditions\fill_halo_regions.jl:40 [inlined]
[2] fill_halo_regions!(::OffsetArrays.OffsetArray{β¦}, ::FieldBoundaryConditions{β¦}, ::Tuple{β¦}, ::Tuple{β¦}, ::RectilinearGrid{β¦}; kwargs::@Kwargs{})
@ Oceananigans.BoundaryConditions c:\Users\xinle\Dropbox\MIT\main_oceananigans\Oceananigans.jl\src\BoundaryConditions\fill_halo_regions.jl:32
[3] fill_halo_regions!
@ c:\Users\xinle\Dropbox\MIT\main_oceananigans\Oceananigans.jl\src\BoundaryConditions\fill_halo_regions.jl:25 [inlined]
[4] #fill_halo_regions!#62
@ c:\Users\xinle\Dropbox\MIT\main_oceananigans\Oceananigans.jl\src\Fields\field.jl:852 [inlined]
[5] fill_halo_regions!(::Field{β¦})
@ Oceananigans.Fields c:\Users\xinle\Dropbox\MIT\main_oceananigans\Oceananigans.jl\src\Fields\field.jl:838
[6] getindex(fts::FieldTimeSeries{β¦}, n::Int64)
@ Oceananigans.OutputReaders c:\Users\xinle\Dropbox\MIT\main_oceananigans\Oceananigans.jl\src\OutputReaders\field_time_series_indexing.jl:158
[7] top-level scope
@ REPL[38]:1
Some type information was truncated. Use `show(err)` to see complete types.which is also similar to when we do interior(b_data[1]). However if we do
b_data = FieldTimeSeries("./instantaneous_fields.jld2", "b")then b_data[1] gives
Error showing value of type Field{Center, Center, Center, Nothing, RectilinearGrid{Float64, Bounded, Flat, Bounded, Oceananigans.Grids.StaticVerticalDiscretization{OffsetArrays.OffsetVector{Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}, OffsetArrays.OffsetVector{Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}, Float64, Float64}, Float64, Float64, OffsetArrays.OffsetVector{Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}, Nothing, CPU}, Tuple{Colon, Colon, Colon}, OffsetArrays.OffsetArray{Float64, 3, SubArray{Float64, 3, Array{Float64, 4}, Tuple{Base.Slice{Base.OneTo{Int64}}, Base.Slice{Base.OneTo{Int64}}, Base.Slice{Base.OneTo{Int64}}, Int64}, true}}, Float64, FieldBoundaryConditions{Missing, Oceananigans.BoundaryConditions.NoFluxBoundaryCondition, Nothing, Nothing, Oceananigans.BoundaryConditions.NoFluxBoundaryCondition, Oceananigans.BoundaryConditions.NoFluxBoundaryCondition, Nothing, @NamedTuple{bottom_and_top::KernelAbstractions.Kernel{KernelAbstractions.CPU, KernelAbstractions.NDIteration.StaticSize{(4, 1)}, KernelAbstractions.NDIteration.StaticSize{(4, 1)}, typeof(Oceananigans.BoundaryConditions.cpu__fill_bottom_and_top_halo!)}, south_and_north::Nothing, west_and_east::Nothing}, @NamedTuple{bottom_and_top::Tuple{Oceananigans.BoundaryConditions.NoFluxBoundaryCondition, Oceananigans.BoundaryConditions.NoFluxBoundaryCondition}, south_and_north::Tuple{Nothing, Nothing}, west_and_east::Tuple{Missing, Oceananigans.BoundaryConditions.NoFluxBoundaryCondition}}}, Oceananigans.Fields.FixedTime{Float64}, Nothing}:
ERROR: MethodError: no method matching bc_str(::Missing)
The function `bc_str` exists, but no method is defined for this combination of argument types.
Closest candidates are:
bc_str(::BoundaryCondition{Oceananigans.BoundaryConditions.Open, Nothing})
@ Oceananigans c:\Users\xinle\Dropbox\MIT\main_oceananigans\Oceananigans.jl\src\BoundaryConditions\show_boundary_conditions.jl:13
bc_str(::Oceananigans.BoundaryConditions.NoFluxBoundaryCondition)
@ Oceananigans c:\Users\xinle\Dropbox\MIT\main_oceananigans\Oceananigans.jl\src\BoundaryConditions\show_boundary_conditions.jl:12
bc_str(::Nothing)
@ Oceananigans c:\Users\xinle\Dropbox\MIT\main_oceananigans\Oceananigans.jl\src\BoundaryConditions\show_boundary_conditions.jl:17
...
Stacktrace:
[1] show(io::IOContext{Base.TTY}, field::Field{Center, Center, Center, Nothing, RectilinearGrid{β¦}, Tuple{β¦}, OffsetArrays.OffsetArray{β¦}, Float64, FieldBoundaryConditions{β¦}, Oceananigans.Fields.FixedTime{β¦}, Nothing})
@ Oceananigans.Fields c:\Users\xinle\Dropbox\MIT\main_oceananigans\Oceananigans.jl\src\Fields\show_fields.jl:43
[2] show(io::IOContext{Base.TTY}, ::MIME{Symbol("text/plain")}, f::Field{Center, Center, Center, Nothing, RectilinearGrid{β¦}, Tuple{β¦}, OffsetArrays.OffsetArray{β¦}, Float64, FieldBoundaryConditions{β¦}, Oceananigans.Fields.FixedTime{β¦}, Nothing})
@ Oceananigans.Fields c:\Users\xinle\Dropbox\MIT\main_oceananigans\Oceananigans.jl\src\Fields\show_fields.jl:74
[3] (::REPL.var"#68#69"{REPL.REPLDisplay{REPL.LineEditREPL}, MIME{Symbol("text/plain")}, Base.RefValue{Any}})(io::Any)
@ REPL C:\Users\xinle\AppData\Local\Programs\Julia-1.11.4\share\julia\stdlib\v1.11\REPL\src\REPL.jl:367
[4] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
@ REPL C:\Users\xinle\AppData\Local\Programs\Julia-1.11.4\share\julia\stdlib\v1.11\REPL\src\REPL.jl:661
[5] display(d::REPL.REPLDisplay, mime::MIME{Symbol("text/plain")}, x::Any)
@ REPL C:\Users\xinle\AppData\Local\Programs\Julia-1.11.4\share\julia\stdlib\v1.11\REPL\src\REPL.jl:353
[6] display(d::REPL.REPLDisplay, x::Any)
@ REPL C:\Users\xinle\AppData\Local\Programs\Julia-1.11.4\share\julia\stdlib\v1.11\REPL\src\REPL.jl:372
[7] display(x::Any)
@ Base.Multimedia .\multimedia.jl:340
[8] #invokelatest#2
@ .\essentials.jl:1055 [inlined]
[9] invokelatest
@ .\essentials.jl:1052 [inlined]
[10] print_response(errio::IO, response::Any, show_value::Bool, have_color::Bool, specialdisplay::Union{Nothing, AbstractDisplay})
@ REPL C:\Users\xinle\AppData\Local\Programs\Julia-1.11.4\share\julia\stdlib\v1.11\REPL\src\REPL.jl:409
[11] (::REPL.var"#70#71"{REPL.LineEditREPL, Pair{Any, Bool}, Bool, Bool})(io::Any)
@ REPL C:\Users\xinle\AppData\Local\Programs\Julia-1.11.4\share\julia\stdlib\v1.11\REPL\src\REPL.jl:378
[12] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
@ REPL C:\Users\xinle\AppData\Local\Programs\Julia-1.11.4\share\julia\stdlib\v1.11\REPL\src\REPL.jl:661
[13] print_response(repl::REPL.AbstractREPL, response::Any, show_value::Bool, have_color::Bool)
@ REPL C:\Users\xinle\AppData\Local\Programs\Julia-1.11.4\share\julia\stdlib\v1.11\REPL\src\REPL.jl:376
[14] (::REPL.var"#do_respond#96"{Bool, Bool, REPL.var"#112#130"{REPL.LineEditREPL, REPL.REPLHistoryProvider}, REPL.LineEditREPL, REPL.LineEdit.Prompt})(s::REPL.LineEdit.MIState, buf::Any, ok::Bool)
@ REPL C:\Users\xinle\AppData\Local\Programs\Julia-1.11.4\share\julia\stdlib\v1.11\REPL\src\REPL.jl:1003
[15] (::VSCodeServer.var"#103#106"{REPL.var"#do_respond#96"{Bool, Bool, REPL.var"#112#130"{REPL.LineEditREPL, REPL.REPLHistoryProvider}, REPL.LineEditREPL, REPL.LineEdit.Prompt}})(mi::REPL.LineEdit.MIState, buf::IOBuffer, ok::Bool)
@ VSCodeServer c:\Users\xinle\.vscode\extensions\julialang.language-julia-1.158.2\scripts\packages\VSCodeServer\src\repl.jl:122
[16] #invokelatest#2
@ .\essentials.jl:1055 [inlined]
[17] invokelatest
@ .\essentials.jl:1052 [inlined]
[18] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
@ REPL.LineEdit C:\Users\xinle\AppData\Local\Programs\Julia-1.11.4\share\julia\stdlib\v1.11\REPL\src\LineEdit.jl:2755
[19] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
@ REPL C:\Users\xinle\AppData\Local\Programs\Julia-1.11.4\share\julia\stdlib\v1.11\REPL\src\REPL.jl:1474
[20] (::REPL.var"#75#81"{REPL.LineEditREPL, REPL.REPLBackendRef})()
@ REPL C:\Users\xinle\AppData\Local\Programs\Julia-1.11.4\share\julia\stdlib\v1.11\REPL\src\REPL.jl:480
Some type information was truncated. Use `show(err)` to see complete types.while interior(b_data[1]) works.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels