Skip to content

Avoid extra step in computing turbulent fluxes #264

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Nov 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading