Skip to content

Commit

Permalink
Avoid extra step in computing turbulent fluxes (#264)
Browse files Browse the repository at this point in the history
* avoid extra step

* Update atmosphere_ocean_fluxes.jl

* put atmosphere rotation in interpolation

* Update atmosphere_ocean_fluxes.jl
  • Loading branch information
simone-silvestri authored Nov 21, 2024
1 parent 8057d1a commit a4c405f
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions src/OceanSeaIceModels/CrossRealmFluxes/atmosphere_ocean_fluxes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,10 @@ end
# Usually precipitation
Mh = interp_atmos_time_series(prescribed_freshwater_flux, X, time, atmos_args...)

# 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ₐ
surface_atmos_state.v[i, j, 1] = vₐ
surface_atmos_state.T[i, j, 1] = Tₐ
Expand Down Expand Up @@ -293,6 +297,7 @@ end
𝒬ₐ = thermodynamic_atmospheric_state = AtmosphericThermodynamics.PhaseEquil_pTq(ℂₐ, pₐ, Tₐ, qₐ)

hₐ = atmosphere_reference_height # elevation of atmos variables relative to surface

Uₐ = SVector(uₐ, vₐ)
𝒰ₐ = dynamic_atmos_state = SurfaceFluxes.StateValues(hₐ, Uₐ, 𝒬ₐ)

Expand All @@ -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ₒ)
Expand All @@ -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
Expand All @@ -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

Expand Down

0 comments on commit a4c405f

Please sign in to comment.