Skip to content

Commit

Permalink
fix shallow water example
Browse files Browse the repository at this point in the history
  • Loading branch information
tomchor committed Mar 8, 2025
1 parent 9df71e1 commit 1022e6a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions examples/shallow_water_Bickley_jet.jl
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,11 @@ ds = NCDataset(simulation.output_writers[:fields].filepath, "r")

times = ds["time"][:]

ω = @lift ds["ω"][:, :, 1, $n]
ω = @lift ds["ω"][:, :, $n]
hm_ω = heatmap!(ax_ω, x, y, ω, colorrange = (-1, 1), colormap = :balance)
Colorbar(fig[2, 2], hm_ω)

ω′ = @lift ds["ω′"][:, :, 1, $n]
ω′ = @lift ds["ω′"][:, :, $n]
hm_ω′ = heatmap!(ax_ω′, x, y, ω′, colormap = :balance)
Colorbar(fig[2, 4], hm_ω′)

Expand Down
4 changes: 3 additions & 1 deletion src/OutputWriters/netcdf_output_writer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ using Oceananigans.Fields
using Oceananigans.Grids: AbstractCurvilinearGrid, RectilinearGrid, StaticVerticalDiscretization
using Oceananigans.Grids: topology, halo_size, parent_index_range, ξnodes, ηnodes, rnodes, validate_index, peripheral_node
using Oceananigans.Fields: reduced_dimensions, reduced_location, location
using Oceananigans.Models: ShallowWaterModel
using Oceananigans.ImmersedBoundaries: ImmersedBoundaryGrid, GridFittedBottom, GFBIBG, GridFittedBoundary
using Oceananigans.TimeSteppers: float_or_date_time
using Oceananigans.BuoyancyFormulations: BuoyancyForce, BuoyancyTracer, SeawaterBuoyancy, LinearEquationOfState
Expand Down Expand Up @@ -605,7 +606,8 @@ default_tracer_attributes(::SeawaterBuoyancy) = Dict(

function default_output_attributes(model)
velocity_attrs = default_velocity_attributes(model.grid)
tracer_attrs = default_tracer_attributes(model.buoyancy)
buoyancy = model isa ShallowWaterModel ? nothing : model.buoyancy
tracer_attrs = default_tracer_attributes(buoyancy)
return merge(velocity_attrs, tracer_attrs)
end

Expand Down

0 comments on commit 1022e6a

Please sign in to comment.