From 245c98640be3f8f56c690ad4e197db97384fcb74 Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 16 Mar 2026 09:16:27 +0100 Subject: [PATCH 01/13] Speedy 0.18 compat --- Project.toml | 2 +- .../speedy_atmosphere_simulations.jl | 23 +++++++++++-------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Project.toml b/Project.toml index dd07cbf11..08cd45c88 100644 --- a/Project.toml +++ b/Project.toml @@ -82,7 +82,7 @@ PythonCall = "0.9.28" Reactant = "0.2.235" Scratch = "1" SeawaterPolynomials = "0.3.5" -SpeedyWeather = "0.17.4" +SpeedyWeather = "0.18.1" StaticArrays = "1" Statistics = "<0.0.1, 1" Thermodynamics = "0.15.3" diff --git a/ext/NumericalEarthSpeedyWeatherExt/speedy_atmosphere_simulations.jl b/ext/NumericalEarthSpeedyWeatherExt/speedy_atmosphere_simulations.jl index c108cc555..311537abb 100644 --- a/ext/NumericalEarthSpeedyWeatherExt/speedy_atmosphere_simulations.jl +++ b/ext/NumericalEarthSpeedyWeatherExt/speedy_atmosphere_simulations.jl @@ -24,6 +24,7 @@ function Oceananigans.TimeSteppers.time_step!(atmos::SpeedySimulation, Δt) for _ in 1:nsteps SpeedyWeather.timestep!(atmos) end + return end # The height of near-surface variables used in the turbulent flux solver @@ -43,14 +44,14 @@ thermodynamics_parameters(atmos::SpeedySimulation) = NumericalEarth.Atmospheres.AtmosphereThermodynamicsParameters(Float32) function initialize_atmospheric_state!(simulation::SpeedyWeather.Simulation) - progn, diagn, model = SpeedyWeather.unpack(simulation) + progn, diagn, model = SpeedyWeather.unpack(simulation) (; time) = progn.clock # current time # set the tendencies back to zero for accumulation fill!(diagn.tendencies, 0, typeof(model)) if model.physics - SpeedyWeather.parameterization_tendencies!(diagn, progn, time, model) + SpeedyWeather.parameterization_tendencies!(diagn, progn, model) end return nothing @@ -61,22 +62,24 @@ end Return an atmosphere simulation using `SpeedyWeather.PrimitiveWetModel` on `spectral_grid`. """ -function atmosphere_simulation(spectral_grid::SpeedyWeather.SpectralGrid; output=false) +function atmosphere_simulation(spectral_grid::SpeedyWeather.SpectralGrid; output = false) # Surface fluxes humidity_flux_ocean = SpeedyWeather.PrescribedOceanHumidityFlux(spectral_grid) humidity_flux_land = SpeedyWeather.SurfaceLandHumidityFlux(spectral_grid) - surface_humidity_flux = SpeedyWeather.SurfaceHumidityFlux(ocean=humidity_flux_ocean, land=humidity_flux_land) + surface_humidity_flux = SpeedyWeather.SurfaceHumidityFlux(ocean = humidity_flux_ocean, land = humidity_flux_land) ocean_heat_flux = SpeedyWeather.PrescribedOceanHeatFlux(spectral_grid) land_heat_flux = SpeedyWeather.SurfaceLandHeatFlux(spectral_grid) - surface_heat_flux = SpeedyWeather.SurfaceHeatFlux(ocean=ocean_heat_flux, land=land_heat_flux) + surface_heat_flux = SpeedyWeather.SurfaceHeatFlux(ocean = ocean_heat_flux, land = land_heat_flux) # The atmospheric model - atmosphere_model = SpeedyWeather.PrimitiveWetModel(spectral_grid; - surface_heat_flux, - surface_humidity_flux, - ocean = nothing, - sea_ice = nothing) # This is provided by ClimaSeaIce + atmosphere_model = SpeedyWeather.PrimitiveWetModel( + spectral_grid; + surface_heat_flux, + surface_humidity_flux, + ocean = nothing, + sea_ice = nothing + ) # This is provided by ClimaSeaIce # Construct the simulation atmosphere = SpeedyWeather.initialize!(atmosphere_model) From 280a294e3a52cca372425bc3a08ae4f0de15e578 Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 16 Mar 2026 09:23:16 +0100 Subject: [PATCH 02/13] revert some accidental automatic formatting --- .../speedy_atmosphere_simulations.jl | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/ext/NumericalEarthSpeedyWeatherExt/speedy_atmosphere_simulations.jl b/ext/NumericalEarthSpeedyWeatherExt/speedy_atmosphere_simulations.jl index 311537abb..4c71baf2a 100644 --- a/ext/NumericalEarthSpeedyWeatherExt/speedy_atmosphere_simulations.jl +++ b/ext/NumericalEarthSpeedyWeatherExt/speedy_atmosphere_simulations.jl @@ -24,7 +24,6 @@ function Oceananigans.TimeSteppers.time_step!(atmos::SpeedySimulation, Δt) for _ in 1:nsteps SpeedyWeather.timestep!(atmos) end - return end # The height of near-surface variables used in the turbulent flux solver @@ -62,24 +61,22 @@ end Return an atmosphere simulation using `SpeedyWeather.PrimitiveWetModel` on `spectral_grid`. """ -function atmosphere_simulation(spectral_grid::SpeedyWeather.SpectralGrid; output = false) +function atmosphere_simulation(spectral_grid::SpeedyWeather.SpectralGrid; output=false) # Surface fluxes humidity_flux_ocean = SpeedyWeather.PrescribedOceanHumidityFlux(spectral_grid) humidity_flux_land = SpeedyWeather.SurfaceLandHumidityFlux(spectral_grid) - surface_humidity_flux = SpeedyWeather.SurfaceHumidityFlux(ocean = humidity_flux_ocean, land = humidity_flux_land) + surface_humidity_flux = SpeedyWeather.SurfaceHumidityFlux(ocean=humidity_flux_ocean, land=humidity_flux_land) ocean_heat_flux = SpeedyWeather.PrescribedOceanHeatFlux(spectral_grid) land_heat_flux = SpeedyWeather.SurfaceLandHeatFlux(spectral_grid) - surface_heat_flux = SpeedyWeather.SurfaceHeatFlux(ocean = ocean_heat_flux, land = land_heat_flux) + surface_heat_flux = SpeedyWeather.SurfaceHeatFlux(ocean=ocean_heat_flux, land=land_heat_flux) # The atmospheric model - atmosphere_model = SpeedyWeather.PrimitiveWetModel( - spectral_grid; - surface_heat_flux, - surface_humidity_flux, - ocean = nothing, - sea_ice = nothing - ) # This is provided by ClimaSeaIce + atmosphere_model = SpeedyWeather.PrimitiveWetModel(spectral_grid; + surface_heat_flux, + surface_humidity_flux, + ocean = nothing, + sea_ice = nothing) # This is provided by ClimaSeaIce # Construct the simulation atmosphere = SpeedyWeather.initialize!(atmosphere_model) From b07254ee8ba10822babbb420ae2a9454889a8e6f Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 16 Mar 2026 10:12:34 +0100 Subject: [PATCH 03/13] test deps as well for Speedy --- test/Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Project.toml b/test/Project.toml index a3e88e5fd..086b44950 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -49,7 +49,7 @@ PythonCall = "0.9.28" Reactant = "0.2.235" Scratch = "1" SeawaterPolynomials = "0.3.5" -SpeedyWeather = "0.17.4" +SpeedyWeather = "0.18.1" Statistics = "<0.0.1, 1" Test = "<0.0.1, 1" Thermodynamics = "0.15.3" From 5e0da9687c23c9f7c054f5a5a8f277d8c63b9b74 Mon Sep 17 00:00:00 2001 From: "Navid C. Constantinou" Date: Mon, 16 Mar 2026 11:37:54 +0200 Subject: [PATCH 04/13] Update Project.toml --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 08cd45c88..38220a0f4 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "NumericalEarth" uuid = "904d977b-046a-4731-8b86-9235c0d1ef02" license = "MIT" -version = "0.2.0" +version = "0.2.1" authors = ["NumericalEarth contributors"] [deps] From ccc30126b82b162cb91804bc65c3ea9922535e68 Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 16 Mar 2026 13:56:04 +0100 Subject: [PATCH 05/13] added PrescribedOcean + running locally --- .../speedy_atmosphere_simulations.jl | 19 +++++++++++++------ .../speedy_weather_exchanger.jl | 2 +- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/ext/NumericalEarthSpeedyWeatherExt/speedy_atmosphere_simulations.jl b/ext/NumericalEarthSpeedyWeatherExt/speedy_atmosphere_simulations.jl index 4c71baf2a..3ba041ff6 100644 --- a/ext/NumericalEarthSpeedyWeatherExt/speedy_atmosphere_simulations.jl +++ b/ext/NumericalEarthSpeedyWeatherExt/speedy_atmosphere_simulations.jl @@ -12,6 +12,11 @@ const SpeedyNoSeaIceEarthSystemModel = NumericalEarth.EarthSystemModel{<:Union{N Base.summary(::SpeedySimulation) = "SpeedyWeather.Simulation" +# TODO: This is a temporary solution to tell SpeedyWeather to allocate the ocean variables, without having an ocean. In SpeedyWeather PR#969 it will be addressed slightly more properly. +struct PrescribedOcean <: SpeedyWeather.AbstractOcean end +SpeedyWeather.initialize!(ocean::PrognosticVariablesOcean, progn::SpeedyWeather.PrognosticVariables, diagn::SpeedyWeather.DiagnosticVariables, ::PrescribedOcean, model::SpeedyWeather.PrimitiveEquation) where PrognosticVariablesOcean = nothing +SpeedyWeather.timestep!(progn, diagn, ::PrescribedOcean, model::SpeedyWeather.PrimitiveEquation) = nothing + # Take one time-step or more depending on the global timestep function Oceananigans.TimeSteppers.time_step!(atmos::SpeedySimulation, Δt) Δt_atmos = atmos.model.time_stepping.Δt_sec @@ -28,7 +33,7 @@ end # The height of near-surface variables used in the turbulent flux solver function surface_layer_height(s::SpeedySimulation) - T = s.model.atmosphere.temp_ref + T = s.model.atmosphere.temperature_reference g = s.model.planet.gravity Φ = s.model.geopotential.Δp_geopot_full return Φ[end] * T / g @@ -72,11 +77,13 @@ function atmosphere_simulation(spectral_grid::SpeedyWeather.SpectralGrid; output surface_heat_flux = SpeedyWeather.SurfaceHeatFlux(ocean=ocean_heat_flux, land=land_heat_flux) # The atmospheric model - atmosphere_model = SpeedyWeather.PrimitiveWetModel(spectral_grid; - surface_heat_flux, - surface_humidity_flux, - ocean = nothing, - sea_ice = nothing) # This is provided by ClimaSeaIce + atmosphere_model = SpeedyWeather.PrimitiveWetModel( + spectral_grid; + surface_heat_flux, + surface_humidity_flux, + ocean = PrescribedOcean(), + sea_ice = nothing + ) # This is provided by ClimaSeaIce # Construct the simulation atmosphere = SpeedyWeather.initialize!(atmosphere_model) diff --git a/ext/NumericalEarthSpeedyWeatherExt/speedy_weather_exchanger.jl b/ext/NumericalEarthSpeedyWeatherExt/speedy_weather_exchanger.jl index 08c024e71..3eb4df62b 100644 --- a/ext/NumericalEarthSpeedyWeatherExt/speedy_weather_exchanger.jl +++ b/ext/NumericalEarthSpeedyWeatherExt/speedy_weather_exchanger.jl @@ -59,7 +59,7 @@ function interpolate_state!(exchanger, exchange_grid, atmos::SpeedySimulation, c pa = exp.(atmos.diagnostic_variables.grid.pres_grid.data) ℐꜜˢʷ = atmos.diagnostic_variables.physics.surface_shortwave_down.data ℐꜜˡʷ = atmos.diagnostic_variables.physics.surface_longwave_down.data - Jᶜ = atmos.diagnostic_variables.physics.total_precipitation_rate.data + Jᶜ = atmos.diagnostic_variables.physics.rain_rate.data .+ atmos.diagnostic_variables.physics.snow_rate.data regrid!(exchange_state.u, ua) regrid!(exchange_state.v, va) From 1ecbf8abad7d8449bb46ea3d493d5c371d928a54 Mon Sep 17 00:00:00 2001 From: Maximilian Gelbrecht Date: Tue, 17 Mar 2026 18:00:00 +0100 Subject: [PATCH 06/13] Update ext/NumericalEarthSpeedyWeatherExt/speedy_atmosphere_simulations.jl Co-authored-by: Navid C. Constantinou --- .../speedy_atmosphere_simulations.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/NumericalEarthSpeedyWeatherExt/speedy_atmosphere_simulations.jl b/ext/NumericalEarthSpeedyWeatherExt/speedy_atmosphere_simulations.jl index 3ba041ff6..9990d0bdb 100644 --- a/ext/NumericalEarthSpeedyWeatherExt/speedy_atmosphere_simulations.jl +++ b/ext/NumericalEarthSpeedyWeatherExt/speedy_atmosphere_simulations.jl @@ -82,8 +82,8 @@ function atmosphere_simulation(spectral_grid::SpeedyWeather.SpectralGrid; output surface_heat_flux, surface_humidity_flux, ocean = PrescribedOcean(), - sea_ice = nothing - ) # This is provided by ClimaSeaIce + sea_ice = nothing # provided by ClimaSeaIce + ) # Construct the simulation atmosphere = SpeedyWeather.initialize!(atmosphere_model) From d230e5d9dfee13990366915910d03dbac2f3cc0a Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 23 Apr 2026 16:06:16 +0200 Subject: [PATCH 07/13] SpeedyWeather 0.19 --- Project.toml | 2 +- .../speedy_atmosphere_simulations.jl | 15 ++++------ .../speedy_weather_exchanger.jl | 28 +++++++++---------- test/Project.toml | 2 +- 4 files changed, 21 insertions(+), 26 deletions(-) diff --git a/Project.toml b/Project.toml index b35816f94..4b12c78fe 100644 --- a/Project.toml +++ b/Project.toml @@ -76,7 +76,7 @@ PythonCall = "0.9.28" Reactant = "0.2.235" Scratch = "1" SeawaterPolynomials = "0.3.5" -SpeedyWeather = "0.18.1" +SpeedyWeather = "0.19" StaticArrays = "1" Statistics = "<0.0.1, 1" Thermodynamics = "0.15.3" diff --git a/ext/NumericalEarthSpeedyWeatherExt/speedy_atmosphere_simulations.jl b/ext/NumericalEarthSpeedyWeatherExt/speedy_atmosphere_simulations.jl index 9990d0bdb..07252ab69 100644 --- a/ext/NumericalEarthSpeedyWeatherExt/speedy_atmosphere_simulations.jl +++ b/ext/NumericalEarthSpeedyWeatherExt/speedy_atmosphere_simulations.jl @@ -12,11 +12,6 @@ const SpeedyNoSeaIceEarthSystemModel = NumericalEarth.EarthSystemModel{<:Union{N Base.summary(::SpeedySimulation) = "SpeedyWeather.Simulation" -# TODO: This is a temporary solution to tell SpeedyWeather to allocate the ocean variables, without having an ocean. In SpeedyWeather PR#969 it will be addressed slightly more properly. -struct PrescribedOcean <: SpeedyWeather.AbstractOcean end -SpeedyWeather.initialize!(ocean::PrognosticVariablesOcean, progn::SpeedyWeather.PrognosticVariables, diagn::SpeedyWeather.DiagnosticVariables, ::PrescribedOcean, model::SpeedyWeather.PrimitiveEquation) where PrognosticVariablesOcean = nothing -SpeedyWeather.timestep!(progn, diagn, ::PrescribedOcean, model::SpeedyWeather.PrimitiveEquation) = nothing - # Take one time-step or more depending on the global timestep function Oceananigans.TimeSteppers.time_step!(atmos::SpeedySimulation, Δt) Δt_atmos = atmos.model.time_stepping.Δt_sec @@ -33,7 +28,7 @@ end # The height of near-surface variables used in the turbulent flux solver function surface_layer_height(s::SpeedySimulation) - T = s.model.atmosphere.temperature_reference + T = s.model.atmosphere.reference_temperature g = s.model.planet.gravity Φ = s.model.geopotential.Δp_geopot_full return Φ[end] * T / g @@ -48,14 +43,14 @@ thermodynamics_parameters(atmos::SpeedySimulation) = NumericalEarth.Atmospheres.AtmosphereThermodynamicsParameters(Float32) function initialize_atmospheric_state!(simulation::SpeedyWeather.Simulation) - progn, diagn, model = SpeedyWeather.unpack(simulation) + vars, model = SpeedyWeather.unpack(simulation) (; time) = progn.clock # current time # set the tendencies back to zero for accumulation - fill!(diagn.tendencies, 0, typeof(model)) + fill!(vars.tendencies, 0, typeof(model)) if model.physics - SpeedyWeather.parameterization_tendencies!(diagn, progn, model) + SpeedyWeather.parameterization_tendencies!(vars, model) end return nothing @@ -81,7 +76,7 @@ function atmosphere_simulation(spectral_grid::SpeedyWeather.SpectralGrid; output spectral_grid; surface_heat_flux, surface_humidity_flux, - ocean = PrescribedOcean(), + ocean = SpeedyWeather.PrescribedOcean(), sea_ice = nothing # provided by ClimaSeaIce ) diff --git a/ext/NumericalEarthSpeedyWeatherExt/speedy_weather_exchanger.jl b/ext/NumericalEarthSpeedyWeatherExt/speedy_weather_exchanger.jl index 3eb4df62b..571f507f1 100644 --- a/ext/NumericalEarthSpeedyWeatherExt/speedy_weather_exchanger.jl +++ b/ext/NumericalEarthSpeedyWeatherExt/speedy_weather_exchanger.jl @@ -52,14 +52,14 @@ function interpolate_state!(exchanger, exchange_grid, atmos::SpeedySimulation, c exchange_state = exchanger.state surface_layer = atmos.model.spectral_grid.nlayers - ua = RingGrids.field_view(atmos.diagnostic_variables.grid.u_grid, :, surface_layer).data - va = RingGrids.field_view(atmos.diagnostic_variables.grid.v_grid, :, surface_layer).data - Ta = RingGrids.field_view(atmos.diagnostic_variables.grid.temp_grid, :, surface_layer).data - qa = RingGrids.field_view(atmos.diagnostic_variables.grid.humid_grid, :, surface_layer).data - pa = exp.(atmos.diagnostic_variables.grid.pres_grid.data) - ℐꜜˢʷ = atmos.diagnostic_variables.physics.surface_shortwave_down.data - ℐꜜˡʷ = atmos.diagnostic_variables.physics.surface_longwave_down.data - Jᶜ = atmos.diagnostic_variables.physics.rain_rate.data .+ atmos.diagnostic_variables.physics.snow_rate.data + ua = RingGrids.field_view(atmos.variables.grid.u_grid, :, surface_layer).data + va = RingGrids.field_view(atmos.variables.grid.v_grid, :, surface_layer).data + Ta = RingGrids.field_view(atmos.variables.grid.temp_grid, :, surface_layer).data + qa = RingGrids.field_view(atmos.variables.grid.humid_grid, :, surface_layer).data + pa = exp.(atmos.variables.grid.pres_grid.data) + ℐꜜˢʷ = atmos.variables.physics.surface_shortwave_down.data + ℐꜜˡʷ = atmos.variables.physics.surface_longwave_down.data + Jᶜ = atmos.variables.physics.rain_rate.data .+ atmos.variables.physics.snow_rate.data regrid!(exchange_state.u, ua) regrid!(exchange_state.v, va) @@ -111,9 +111,9 @@ function update_net_fluxes!(coupled_model, atmos::SpeedySimulation) ℵ = interior(sea_ice_concentration(coupled_model.sea_ice)) # All the location of these fluxes will change - 𝒬ᵀ_speedy = atmos.prognostic_variables.ocean.sensible_heat_flux.data - Jᵛ_speedy = atmos.prognostic_variables.ocean.surface_humidity_flux.data - sst = atmos.prognostic_variables.ocean.sea_surface_temperature.data + 𝒬ᵀ_speedy = atmos.variables.parameterizations.ocean.sensible_heat_flux.data + Jᵛ_speedy = atmos.variables.parameterizations.ocean.surface_humidity_flux.data + sst = atmos.variables.prognostic.ocean.sea_surface_temperature.data To = coupled_model.interfaces.atmosphere_ocean_interface.temperature Ti = coupled_model.interfaces.atmosphere_sea_ice_interface.temperature @@ -135,9 +135,9 @@ function update_net_fluxes!(coupled_model::SpeedyNoSeaIceEarthSystemModel, atmos Jᵛᵃᵒ = ao_fluxes.water_vapor # All the location of these fluxes will change - 𝒬ᵀ_speedy = atmos.prognostic_variables.ocean.sensible_heat_flux.data - Jᵛ_speedy = atmos.prognostic_variables.ocean.surface_humidity_flux.data - sst = atmos.prognostic_variables.ocean.sea_surface_temperature.data + 𝒬ᵀ_speedy = atmos.variables.parameterizations.ocean.sensible_heat_flux.data + Jᵛ_speedy = atmos.variables.parameterizations.ocean.surface_humidity_flux.data + sst = atmos.variables.prognostic.ocean.sea_surface_temperature.data To = coupled_model.interfaces.atmosphere_ocean_interface.temperature # TODO: Figure out how we are going to deal with upwelling radiation diff --git a/test/Project.toml b/test/Project.toml index 264de90b8..5c2f8ce4c 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -50,7 +50,7 @@ PythonCall = "0.9.28" Reactant = "0.2.235" Scratch = "1" SeawaterPolynomials = "0.3.5" -SpeedyWeather = "0.18.1" +SpeedyWeather = "0.19" Statistics = "<0.0.1, 1" Test = "<0.0.1, 1" Thermodynamics = "0.15.3" From 7c784427d47483563aa1c8ccad9963d31b1c2c35 Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 23 Apr 2026 16:33:38 +0200 Subject: [PATCH 08/13] physics -> parameterizations --- .../speedy_weather_exchanger.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ext/NumericalEarthSpeedyWeatherExt/speedy_weather_exchanger.jl b/ext/NumericalEarthSpeedyWeatherExt/speedy_weather_exchanger.jl index 571f507f1..4750aaedb 100644 --- a/ext/NumericalEarthSpeedyWeatherExt/speedy_weather_exchanger.jl +++ b/ext/NumericalEarthSpeedyWeatherExt/speedy_weather_exchanger.jl @@ -57,9 +57,9 @@ function interpolate_state!(exchanger, exchange_grid, atmos::SpeedySimulation, c Ta = RingGrids.field_view(atmos.variables.grid.temp_grid, :, surface_layer).data qa = RingGrids.field_view(atmos.variables.grid.humid_grid, :, surface_layer).data pa = exp.(atmos.variables.grid.pres_grid.data) - ℐꜜˢʷ = atmos.variables.physics.surface_shortwave_down.data - ℐꜜˡʷ = atmos.variables.physics.surface_longwave_down.data - Jᶜ = atmos.variables.physics.rain_rate.data .+ atmos.variables.physics.snow_rate.data + ℐꜜˢʷ = atmos.variables.parameterizations.surface_shortwave_down.data + ℐꜜˡʷ = atmos.variables.parameterizations.surface_longwave_down.data + Jᶜ = atmos.variables.parameterizations.rain_rate.data .+ atmos.variables.physics.snow_rate.data regrid!(exchange_state.u, ua) regrid!(exchange_state.v, va) From fdda2c1f06fb328b96dec2cf942802d412377484 Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 23 Apr 2026 16:34:54 +0200 Subject: [PATCH 09/13] physics -> parameterizations (ii) --- ext/NumericalEarthSpeedyWeatherExt/speedy_weather_exchanger.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/NumericalEarthSpeedyWeatherExt/speedy_weather_exchanger.jl b/ext/NumericalEarthSpeedyWeatherExt/speedy_weather_exchanger.jl index 4750aaedb..bb44940e7 100644 --- a/ext/NumericalEarthSpeedyWeatherExt/speedy_weather_exchanger.jl +++ b/ext/NumericalEarthSpeedyWeatherExt/speedy_weather_exchanger.jl @@ -59,7 +59,7 @@ function interpolate_state!(exchanger, exchange_grid, atmos::SpeedySimulation, c pa = exp.(atmos.variables.grid.pres_grid.data) ℐꜜˢʷ = atmos.variables.parameterizations.surface_shortwave_down.data ℐꜜˡʷ = atmos.variables.parameterizations.surface_longwave_down.data - Jᶜ = atmos.variables.parameterizations.rain_rate.data .+ atmos.variables.physics.snow_rate.data + Jᶜ = atmos.variables.parameterizations.rain_rate.data .+ atmos.variables.parameterizations.snow_rate.data regrid!(exchange_state.u, ua) regrid!(exchange_state.v, va) From 7ba824f7332717cef937ae7de99e183dd88112de Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 23 Apr 2026 16:37:20 +0200 Subject: [PATCH 10/13] long variable names --- .../speedy_weather_exchanger.jl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ext/NumericalEarthSpeedyWeatherExt/speedy_weather_exchanger.jl b/ext/NumericalEarthSpeedyWeatherExt/speedy_weather_exchanger.jl index bb44940e7..ec0dfa3e7 100644 --- a/ext/NumericalEarthSpeedyWeatherExt/speedy_weather_exchanger.jl +++ b/ext/NumericalEarthSpeedyWeatherExt/speedy_weather_exchanger.jl @@ -52,11 +52,11 @@ function interpolate_state!(exchanger, exchange_grid, atmos::SpeedySimulation, c exchange_state = exchanger.state surface_layer = atmos.model.spectral_grid.nlayers - ua = RingGrids.field_view(atmos.variables.grid.u_grid, :, surface_layer).data - va = RingGrids.field_view(atmos.variables.grid.v_grid, :, surface_layer).data - Ta = RingGrids.field_view(atmos.variables.grid.temp_grid, :, surface_layer).data - qa = RingGrids.field_view(atmos.variables.grid.humid_grid, :, surface_layer).data - pa = exp.(atmos.variables.grid.pres_grid.data) + ua = RingGrids.field_view(atmos.variables.grid.u, :, surface_layer).data + va = RingGrids.field_view(atmos.variables.grid.v, :, surface_layer).data + Ta = RingGrids.field_view(atmos.variables.grid.temperature, :, surface_layer).data + qa = RingGrids.field_view(atmos.variables.grid.humidity, :, surface_layer).data + pa = exp.(atmos.variables.grid.pressure.data) ℐꜜˢʷ = atmos.variables.parameterizations.surface_shortwave_down.data ℐꜜˡʷ = atmos.variables.parameterizations.surface_longwave_down.data Jᶜ = atmos.variables.parameterizations.rain_rate.data .+ atmos.variables.parameterizations.snow_rate.data From 37db5a684f6857097a46ffece923b230d720a783 Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 23 Apr 2026 16:52:44 +0200 Subject: [PATCH 11/13] reset_tendencies! Co-authored-by: Copilot --- .../speedy_atmosphere_simulations.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/NumericalEarthSpeedyWeatherExt/speedy_atmosphere_simulations.jl b/ext/NumericalEarthSpeedyWeatherExt/speedy_atmosphere_simulations.jl index 07252ab69..779a0e42d 100644 --- a/ext/NumericalEarthSpeedyWeatherExt/speedy_atmosphere_simulations.jl +++ b/ext/NumericalEarthSpeedyWeatherExt/speedy_atmosphere_simulations.jl @@ -47,7 +47,7 @@ function initialize_atmospheric_state!(simulation::SpeedyWeather.Simulation) (; time) = progn.clock # current time # set the tendencies back to zero for accumulation - fill!(vars.tendencies, 0, typeof(model)) + SpeedyWeather.reset_tendencies!(vars) if model.physics SpeedyWeather.parameterization_tendencies!(vars, model) From 91d2111839d40069a24aa8710c1e5602a85ce4bd Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 23 Apr 2026 17:09:26 +0200 Subject: [PATCH 12/13] locally test pass --- .../speedy_atmosphere_simulations.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/NumericalEarthSpeedyWeatherExt/speedy_atmosphere_simulations.jl b/ext/NumericalEarthSpeedyWeatherExt/speedy_atmosphere_simulations.jl index 779a0e42d..a2717edf9 100644 --- a/ext/NumericalEarthSpeedyWeatherExt/speedy_atmosphere_simulations.jl +++ b/ext/NumericalEarthSpeedyWeatherExt/speedy_atmosphere_simulations.jl @@ -44,12 +44,12 @@ thermodynamics_parameters(atmos::SpeedySimulation) = function initialize_atmospheric_state!(simulation::SpeedyWeather.Simulation) vars, model = SpeedyWeather.unpack(simulation) - (; time) = progn.clock # current time + (; time) = vars.prognostic.clock # current time # set the tendencies back to zero for accumulation SpeedyWeather.reset_tendencies!(vars) - if model.physics + if !model.dynamics_only SpeedyWeather.parameterization_tendencies!(vars, model) end From d037f4bffdf45c4ac9182e720c20e19256e3154b Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 23 Apr 2026 17:10:38 +0200 Subject: [PATCH 13/13] adjust speedy coupling test --- test/test_speedy_coupling.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_speedy_coupling.jl b/test/test_speedy_coupling.jl index 5a234001c..59cf8c58b 100644 --- a/test/test_speedy_coupling.jl +++ b/test/test_speedy_coupling.jl @@ -18,8 +18,8 @@ atmos = NumericalEarth.atmosphere_simulation(spectral_grid) radiation = Radiation(ocean_emissivity=0.0, sea_ice_emissivity=0.0) earth_model = EarthSystemModel(atmos, ocean, default_sea_ice(); radiation) -Qca = atmos.prognostic_variables.ocean.sensible_heat_flux.data -Mva = atmos.prognostic_variables.ocean.surface_humidity_flux.data +Qca = atmos.variables.parameterizations.ocean.sensible_heat_flux.data +Mva = atmos.variables.parameterizations.ocean.surface_humidity_flux.data @test !(all(Qca .== 0.0)) @test !(all(Mva .== 0.0))