From 6a1b5fd4fae0b4d45554deb0e74896fea8fc2b68 Mon Sep 17 00:00:00 2001 From: Gregory Wagner Date: Fri, 28 Mar 2025 08:47:30 -0600 Subject: [PATCH 1/3] Add a type for the PrescribedAtmosphereExchanger --- .../InterfaceComputations/component_interfaces.jl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/OceanSeaIceModels/InterfaceComputations/component_interfaces.jl b/src/OceanSeaIceModels/InterfaceComputations/component_interfaces.jl index ab77fc816..fbaa7f1c2 100644 --- a/src/OceanSeaIceModels/InterfaceComputations/component_interfaces.jl +++ b/src/OceanSeaIceModels/InterfaceComputations/component_interfaces.jl @@ -102,6 +102,11 @@ function StateExchanger(ocean::Simulation, atmosphere) return StateExchanger(ocean.model.grid, exchange_atmosphere_state, exchanger) end +mutable struct PrescribedAtmosphereExchanger{X, Y} + i :: X + j :: Y +end + function atmosphere_exchanger(atmosphere::PrescribedAtmosphere, exchange_grid) atmos_grid = atmosphere.grid arch = architecture(exchange_grid) @@ -114,7 +119,8 @@ function atmosphere_exchanger(atmosphere::PrescribedAtmosphere, exchange_grid) TX, TY, TZ = topology(exchange_grid) fi = TX() isa Flat ? nothing : Field{Center, Center, Nothing}(exchange_grid, FT) fj = TY() isa Flat ? nothing : Field{Center, Center, Nothing}(exchange_grid, FT) - frac_indices = (i=fi, j=fj) # no k needed, only horizontal interpolation + # frac_indices = (i=fi, j=fj) # no k needed, only horizontal interpolation + frac_indices = PrescribedAtmosphereExchanger(i, j) return frac_indices end From 83e9e22d3ab8fe661568ac6ef8e496bdbede73df Mon Sep 17 00:00:00 2001 From: "Gregory L. Wagner" Date: Sat, 12 Apr 2025 14:37:06 -0400 Subject: [PATCH 2/3] Update component_interfaces.jl --- .../InterfaceComputations/component_interfaces.jl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/OceanSeaIceModels/InterfaceComputations/component_interfaces.jl b/src/OceanSeaIceModels/InterfaceComputations/component_interfaces.jl index fbaa7f1c2..dae3a8775 100644 --- a/src/OceanSeaIceModels/InterfaceComputations/component_interfaces.jl +++ b/src/OceanSeaIceModels/InterfaceComputations/component_interfaces.jl @@ -107,6 +107,8 @@ mutable struct PrescribedAtmosphereExchanger{X, Y} j :: Y end +Adapt.adapt_structure(to, pae::PrescribedAtmosphereExchanger) = (i=pae.i, j=pae.j) + function atmosphere_exchanger(atmosphere::PrescribedAtmosphere, exchange_grid) atmos_grid = atmosphere.grid arch = architecture(exchange_grid) From 83cb0a587c48b9af647370b838fb8a533c1f77e1 Mon Sep 17 00:00:00 2001 From: "Gregory L. Wagner" Date: Sat, 12 Apr 2025 14:37:26 -0400 Subject: [PATCH 3/3] Update component_interfaces.jl --- .../InterfaceComputations/component_interfaces.jl | 1 - 1 file changed, 1 deletion(-) diff --git a/src/OceanSeaIceModels/InterfaceComputations/component_interfaces.jl b/src/OceanSeaIceModels/InterfaceComputations/component_interfaces.jl index dae3a8775..8e5a3aa76 100644 --- a/src/OceanSeaIceModels/InterfaceComputations/component_interfaces.jl +++ b/src/OceanSeaIceModels/InterfaceComputations/component_interfaces.jl @@ -121,7 +121,6 @@ function atmosphere_exchanger(atmosphere::PrescribedAtmosphere, exchange_grid) TX, TY, TZ = topology(exchange_grid) fi = TX() isa Flat ? nothing : Field{Center, Center, Nothing}(exchange_grid, FT) fj = TY() isa Flat ? nothing : Field{Center, Center, Nothing}(exchange_grid, FT) - # frac_indices = (i=fi, j=fj) # no k needed, only horizontal interpolation frac_indices = PrescribedAtmosphereExchanger(i, j) return frac_indices