Skip to content

Commit

Permalink
Merge branch 'ss/distributed-regridding' of github.com:CliMA/ClimaOce…
Browse files Browse the repository at this point in the history
…an.jl into ss/distributed-regridding
  • Loading branch information
simone-silvestri committed Dec 20, 2024
2 parents cf7413f + c650bdd commit d53cf69
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
3 changes: 3 additions & 0 deletions src/DataWrangling/ECCO/ECCO_metadata.jl
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ ECCO4_short_names = Dict(
:salinity => "SALT",
:u_velocity => "EVEL",
:v_velocity => "NVEL",
:free_surface => "SSH",
:sea_ice_thickness => "SIheff",
:sea_ice_area_fraction => "SIarea",
:net_heat_flux => "oceQnet"
Expand All @@ -178,6 +179,7 @@ ECCO2_short_names = Dict(
:salinity => "SALT",
:u_velocity => "UVEL",
:v_velocity => "VVEL",
:free_surface => "SSH",
:sea_ice_thickness => "SIheff",
:sea_ice_area_fraction => "SIarea",
:net_heat_flux => "oceQnet"
Expand All @@ -186,6 +188,7 @@ ECCO2_short_names = Dict(
ECCO_location = Dict(
:temperature => (Center, Center, Center),
:salinity => (Center, Center, Center),
:free_surface => (Center, Center, Nothing),
:sea_ice_thickness => (Center, Center, Nothing),
:sea_ice_area_fraction => (Center, Center, Nothing),
:net_heat_flux => (Center, Center, Nothing),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ const celsius_to_kelvin = 273.15
Base.summary(crf::OceanSeaIceSurfaceFluxes) = "OceanSeaIceSurfaceFluxes"
Base.show(io::IO, crf::OceanSeaIceSurfaceFluxes) = print(io, summary(crf))

function Base.show(io::IO, crf::OceanSeaIceSurfaceFluxes)
print(io, summary(crf), "\n")
print(io, "├── radiation: ", summary(crf.radiation), "\n")
print(io, "└── turbulent coefficients: ", summary(crf.turbulent), "\n")
return nothing
end

const SeaIceSimulation = Simulation{<:SeaIceModel}

function OceanSeaIceSurfaceFluxes(ocean, sea_ice=nothing;
Expand Down
16 changes: 9 additions & 7 deletions src/OceanSeaIceModels/ocean_sea_ice_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ using SeawaterPolynomials: TEOS10EquationOfState

# Simulations interface
import Oceananigans: fields, prognostic_fields
import Oceananigans.Architectures: architecture
import Oceananigans.Fields: set!
import Oceananigans.Models: timestepper, NaNChecker, default_nan_checker
import Oceananigans.OutputWriters: default_included_properties
Expand All @@ -15,9 +16,8 @@ import Oceananigans.TimeSteppers: time_step!, update_state!, time
import Oceananigans.Utils: prettytime
import Oceananigans.Models: timestepper, NaNChecker, default_nan_checker

struct OceanSeaIceModel{I, A, O, F, C, G} <: AbstractModel{Nothing}
struct OceanSeaIceModel{I, A, O, F, C} <: AbstractModel{Nothing}
clock :: C
grid :: G # TODO: make it so Oceananigans.Simulation does not require this
atmosphere :: A
sea_ice :: I
ocean :: O
Expand All @@ -27,20 +27,23 @@ end
const OSIM = OceanSeaIceModel

function Base.summary(model::OSIM)
A = nameof(typeof(architecture(model.grid)))
G = nameof(typeof(model.grid))
return string("OceanSeaIceModel{$A, $G}",
A = nameof(typeof(architecture(model)))
return string("OceanSeaIceModel{$A}",
"(time = ", prettytime(model.clock.time), ", iteration = ", model.clock.iteration, ")")
end

function Base.show(io::IO, cm::OSIM)
print(io, summary(cm), "\n")
print(io, "├── ocean: ", summary(cm.ocean.model), "\n")
print(io, "├── atmosphere: ", summary(cm.atmosphere), "\n")
print(io, "└── sea_ice: ", summary(cm.sea_ice), "\n")
print(io, "├── sea_ice: ", summary(cm.sea_ice), "\n")
print(io, "└── fluxes: ", summary(cm.fluxes))
return nothing
end

# Assumption: We have an ocean!
architecture(model::OSIM) = architecture(model.ocean)

prettytime(model::OSIM) = prettytime(model.clock.time)
iteration(model::OSIM) = model.clock.iteration
timestepper(::OSIM) = nothing
Expand Down Expand Up @@ -98,7 +101,6 @@ function OceanSeaIceModel(ocean, sea_ice=FreezingLimitedOceanTemperature();
radiation)

ocean_sea_ice_model = OceanSeaIceModel(clock,
ocean.model.grid,
atmosphere,
sea_ice,
ocean,
Expand Down

0 comments on commit d53cf69

Please sign in to comment.