diff --git a/Project.toml b/Project.toml index ca11979ef..e33fb9936 100644 --- a/Project.toml +++ b/Project.toml @@ -80,7 +80,7 @@ PythonCall = "0.9.28" Reactant = "0.2.235" Scratch = "1" SeawaterPolynomials = "0.3.5" -SpeedyWeather = "0.17.4" +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 c108cc555..a2717edf9 100644 --- a/ext/NumericalEarthSpeedyWeatherExt/speedy_atmosphere_simulations.jl +++ b/ext/NumericalEarthSpeedyWeatherExt/speedy_atmosphere_simulations.jl @@ -28,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.temp_ref + T = s.model.atmosphere.reference_temperature g = s.model.planet.gravity Φ = s.model.geopotential.Δp_geopot_full return Φ[end] * T / g @@ -43,14 +43,14 @@ thermodynamics_parameters(atmos::SpeedySimulation) = NumericalEarth.Atmospheres.AtmosphereThermodynamicsParameters(Float32) function initialize_atmospheric_state!(simulation::SpeedyWeather.Simulation) - progn, diagn, model = SpeedyWeather.unpack(simulation) - (; time) = progn.clock # current time + vars, model = SpeedyWeather.unpack(simulation) + (; time) = vars.prognostic.clock # current time # set the tendencies back to zero for accumulation - fill!(diagn.tendencies, 0, typeof(model)) + SpeedyWeather.reset_tendencies!(vars) - if model.physics - SpeedyWeather.parameterization_tendencies!(diagn, progn, time, model) + if !model.dynamics_only + SpeedyWeather.parameterization_tendencies!(vars, model) end return nothing @@ -72,11 +72,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 = SpeedyWeather.PrescribedOcean(), + sea_ice = nothing # 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..ec0dfa3e7 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.total_precipitation_rate.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 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 692bb8459..54e377ccc 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -51,7 +51,7 @@ PythonCall = "0.9.28" Reactant = "0.2.235" Scratch = "1" SeawaterPolynomials = "0.3.5" -SpeedyWeather = "0.17.4" +SpeedyWeather = "0.19" Statistics = "<0.0.1, 1" Test = "<0.0.1, 1" Thermodynamics = "0.15.3" 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))