From 468253ec67ac1da1a6a9bada71b2cc1d45a21fc0 Mon Sep 17 00:00:00 2001 From: Simone Silvestri Date: Tue, 19 Nov 2024 13:37:39 -0800 Subject: [PATCH 1/4] avoid extra step --- .../atmosphere_ocean_fluxes.jl | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/OceanSeaIceModels/CrossRealmFluxes/atmosphere_ocean_fluxes.jl b/src/OceanSeaIceModels/CrossRealmFluxes/atmosphere_ocean_fluxes.jl index 250ab43c5..e6f618f98 100644 --- a/src/OceanSeaIceModels/CrossRealmFluxes/atmosphere_ocean_fluxes.jl +++ b/src/OceanSeaIceModels/CrossRealmFluxes/atmosphere_ocean_fluxes.jl @@ -293,6 +293,11 @@ end 𝒬ₐ = thermodynamic_atmospheric_state = AtmosphericThermodynamics.PhaseEquil_pTq(ℂₐ, pₐ, Tₐ, qₐ) hₐ = atmosphere_reference_height # elevation of atmos variables relative to surface + + # Convert the zonal - meridional atmosphere velocities to + # frame of reference of the native grid + uₐ, vₐ = intrinsic_vector(i, j, kᴺ, grid, uₐ, vₐ) + Uₐ = SVector(uₐ, vₐ) 𝒰ₐ = dynamic_atmos_state = SurfaceFluxes.StateValues(hₐ, Uₐ, 𝒬ₐ) @@ -304,11 +309,6 @@ end surface_type) # Thermodynamic and dynamic (ocean) surface state: - # - # Convert the native grid velocities to a zonal - meridional - # frame of reference (assuming the frame of reference is - # latitude - longitude here, we might want to change it) - uₒ, vₒ = extrinsic_vector(i, j, kᴺ, grid, uₒ, vₒ) Uₒ = SVector(uₒ, vₒ) 𝒬₀ = thermodynamic_surface_state = AtmosphericThermodynamics.PhaseEquil_pTq(ℂₐ, pₐ, Tₒ, qₒ) @@ -328,10 +328,6 @@ end atmosphere_boundary_layer_height, ℂₐ, g, ϰ, maxiter) - # Convert back from a zonal - meridional flux to the frame of - # reference of the native ocean grid - ρτxⁱʲ, ρτyⁱʲ = intrinsic_vector(i, j, kᴺ, grid, turbulent_fluxes.x_momentum, turbulent_fluxes.y_momentum) - # Store fluxes Qv = similarity_theory.fields.latent_heat Qc = similarity_theory.fields.sensible_heat @@ -344,8 +340,8 @@ end Qv[i, j, 1] = ifelse(inactive, 0, turbulent_fluxes.latent_heat) Qc[i, j, 1] = ifelse(inactive, 0, turbulent_fluxes.sensible_heat) Fv[i, j, 1] = ifelse(inactive, 0, turbulent_fluxes.water_vapor) - ρτx[i, j, 1] = ifelse(inactive, 0, ρτxⁱʲ) - ρτy[i, j, 1] = ifelse(inactive, 0, ρτyⁱʲ) + ρτx[i, j, 1] = ifelse(inactive, 0, turbulent_fluxes.x_momentum) + ρτy[i, j, 1] = ifelse(inactive, 0, turbulent_fluxes.y_momentum) end end From f411aebde806bf1b19f8365b8a740dc7febe7826 Mon Sep 17 00:00:00 2001 From: Simone Silvestri Date: Tue, 19 Nov 2024 13:40:08 -0800 Subject: [PATCH 2/4] Update atmosphere_ocean_fluxes.jl --- .../CrossRealmFluxes/atmosphere_ocean_fluxes.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OceanSeaIceModels/CrossRealmFluxes/atmosphere_ocean_fluxes.jl b/src/OceanSeaIceModels/CrossRealmFluxes/atmosphere_ocean_fluxes.jl index e6f618f98..090bae030 100644 --- a/src/OceanSeaIceModels/CrossRealmFluxes/atmosphere_ocean_fluxes.jl +++ b/src/OceanSeaIceModels/CrossRealmFluxes/atmosphere_ocean_fluxes.jl @@ -294,8 +294,8 @@ end hₐ = atmosphere_reference_height # elevation of atmos variables relative to surface - # Convert the zonal - meridional atmosphere velocities to - # frame of reference of the native grid + # Convert the atmosphere velocities from a zonal - meridional frame of reference + # to frame of reference of the ocean grid uₐ, vₐ = intrinsic_vector(i, j, kᴺ, grid, uₐ, vₐ) Uₐ = SVector(uₐ, vₐ) From 2a4d870b8943223082ea51875fbf2ad558926768 Mon Sep 17 00:00:00 2001 From: Simone Silvestri Date: Tue, 19 Nov 2024 13:54:08 -0800 Subject: [PATCH 3/4] put atmosphere rotation in interpolation --- .../CrossRealmFluxes/atmosphere_ocean_fluxes.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/OceanSeaIceModels/CrossRealmFluxes/atmosphere_ocean_fluxes.jl b/src/OceanSeaIceModels/CrossRealmFluxes/atmosphere_ocean_fluxes.jl index e6f618f98..9cc1a91eb 100644 --- a/src/OceanSeaIceModels/CrossRealmFluxes/atmosphere_ocean_fluxes.jl +++ b/src/OceanSeaIceModels/CrossRealmFluxes/atmosphere_ocean_fluxes.jl @@ -220,6 +220,10 @@ end # Usually precipitation Mh = interp_atmos_time_series(prescribed_freshwater_flux, X, time, atmos_args...) + # Convert the zonal - meridional atmosphere velocities to + # frame of reference of the native grid + uₐ, vₐ = intrinsic_vector(i, j, kᴺ, grid, uₐ, vₐ) + surface_atmos_state.u[i, j, 1] = uₐ surface_atmos_state.v[i, j, 1] = vₐ surface_atmos_state.T[i, j, 1] = Tₐ @@ -294,10 +298,6 @@ end hₐ = atmosphere_reference_height # elevation of atmos variables relative to surface - # Convert the zonal - meridional atmosphere velocities to - # frame of reference of the native grid - uₐ, vₐ = intrinsic_vector(i, j, kᴺ, grid, uₐ, vₐ) - Uₐ = SVector(uₐ, vₐ) 𝒰ₐ = dynamic_atmos_state = SurfaceFluxes.StateValues(hₐ, Uₐ, 𝒬ₐ) From 30bd8d09f16aaa7d8fc5ce5b4e1835ac279ec655 Mon Sep 17 00:00:00 2001 From: Simone Silvestri Date: Wed, 20 Nov 2024 12:02:33 -0800 Subject: [PATCH 4/4] Update atmosphere_ocean_fluxes.jl --- .../CrossRealmFluxes/atmosphere_ocean_fluxes.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OceanSeaIceModels/CrossRealmFluxes/atmosphere_ocean_fluxes.jl b/src/OceanSeaIceModels/CrossRealmFluxes/atmosphere_ocean_fluxes.jl index 9cc1a91eb..b47385a7e 100644 --- a/src/OceanSeaIceModels/CrossRealmFluxes/atmosphere_ocean_fluxes.jl +++ b/src/OceanSeaIceModels/CrossRealmFluxes/atmosphere_ocean_fluxes.jl @@ -220,8 +220,8 @@ end # Usually precipitation Mh = interp_atmos_time_series(prescribed_freshwater_flux, X, time, atmos_args...) - # Convert the zonal - meridional atmosphere velocities to - # frame of reference of the native grid + # Convert atmosphere velocities (defined on a latitude-longitude grid) to + # the frame of reference of the native grid uₐ, vₐ = intrinsic_vector(i, j, kᴺ, grid, uₐ, vₐ) surface_atmos_state.u[i, j, 1] = uₐ