Skip to content

Update for new AbstractModel interface #50

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ SeawaterPolynomials = "d496a93d-167e-4197-9f49-d3af4ff8fe40"
[compat]
Adapt = "3, 4"
KernelAbstractions = "0.9"
Oceananigans = "0.95.3 - 0.99"
Oceananigans = "0.95.14 - 0.99"
SeawaterPolynomials = "0.3.4"
RootSolvers = "0.3, 0.4"
Roots = "2"
Expand Down
25 changes: 14 additions & 11 deletions src/EnthalpyMethodSeaIceModel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@ import Oceananigans.Fields: set!
import Oceananigans.TimeSteppers: time_step!, update_state!
import Oceananigans.Simulations: reset!

mutable struct EnthalpyMethodSeaIceModel{Grid,
mutable struct EnthalpyMethodSeaIceModel{Arch,
Grid,
Tim,
Clk,
Clo,
State,
Cp,
Fu,
Tend} <: AbstractModel{Nothing}
Tend} <: AbstractModel{Nothing, Arch}
architecture :: Arch
grid :: Grid
timestepper :: Tim # unused placeholder for now
clock :: Clk
Expand Down Expand Up @@ -79,15 +81,16 @@ function EnthalpyMethodSeaIceModel(; grid,
tendencies = (; H=CenterField(grid))
clock = Clock{eltype(grid)}(time = 0)

return EnthalpyMethodSeaIceModel(grid,
nothing,
clock,
closure,
state,
ice_heat_capacity,
water_heat_capacity,
fusion_enthalpy,
tendencies)
return EnthalpyMethodSeaIceModel(architecture,
grid,
nothing,
clock,
closure,
state,
ice_heat_capacity,
water_heat_capacity,
fusion_enthalpy,
tendencies)
end

function set!(model::ETSIM; T=nothing, H=nothing)
Expand Down
8 changes: 5 additions & 3 deletions src/sea_ice_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ using Oceananigans.BoundaryConditions: regularize_field_boundary_conditions
using Oceananigans.Forcings: model_forcing
using ClimaSeaIce.SeaIceThermodynamics.HeatBoundaryConditions: flux_summary

struct SeaIceModel{GR, TD, D, TS, CL, U, T, IT, IC, ID, CT, STF, A, F} <: AbstractModel{TS}
struct SeaIceModel{A, GR, TD, D, TS, CL, U, T, IT, IC, ID, CT, STF, ADV, F} <: AbstractModel{TS, A}
architecture :: A
grid :: GR
clock :: CL
forcing :: F
Expand All @@ -26,7 +27,7 @@ struct SeaIceModel{GR, TD, D, TS, CL, U, T, IT, IC, ID, CT, STF, A, F} <: Abstra
external_heat_fluxes :: STF
# Numerics
timestepper :: TS
advection :: A
advection :: ADV
end

function SeaIceModel(grid;
Expand Down Expand Up @@ -113,7 +114,8 @@ function SeaIceModel(grid;
external_heat_fluxes = (top = top_heat_flux,
bottom = bottom_heat_flux)

return SeaIceModel(grid,
return SeaIceModel(architecture(grid),
grid,
clock,
forcing,
velocities,
Expand Down
Loading