Skip to content

Commit

Permalink
Try this terminology
Browse files Browse the repository at this point in the history
  • Loading branch information
glwagner committed Mar 31, 2024
1 parent e82bb06 commit 7912520
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions src/surface_conditions/surface_conditions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -383,36 +383,37 @@ function atmos_surface_conditions(
surface_conditions

# surface normal
= surface_normal(surface_local_geometry)
z = surface_normal(surface_local_geometry)

energy_flux = (; ρ_flux_h_tot = scalar_flux(shf + lhf, ))
energy_flux = (; ρ_flux_h_tot = vector_from_component(shf + lhf, z))

moisture_flux =
atmos.moisture_model isa DryModel ? (;) :
(; ρ_flux_q_tot = scalar_flux(evaporation, ))
(; ρ_flux_q_tot = vector_from_component(evaporation, z))

return (;
ts,
ustar,
obukhov_length = L_MO,
buoyancy_flux = buoy_flux,
# This drops the C3 component of ρ_flux_u, need to add ρ_flux_u₃
ρ_flux_uₕ = vector_flux(ρτxz, ρτyz, surface_local_geometry, ),
ρ_flux_uₕ = tensor_from_components(ρτxz, ρτyz, surface_local_geometry, z),
energy_flux...,
moisture_flux...,
)
end

@inline surface_normal(G::Geometry.LocalGeometry) = C3(unit_basis_vector_data(C3, G))
@inline surface_normal(L::Geometry.LocalGeometry) = C3(unit_basis_vector_data(C3, L))

@inline scalar_flux(flux, n) = flux * n
@inline scalar_flux(flux, G::Geometry.LocalGeometry) = scalar_flux(flux, surface_normal(G))
@inline vector_from_component(f₁, n₁) = f₁ * n₁
@inline vector_from_component(f₁, L::Geometry.LocalGeometry) =
vector_from_component(f₁, surface_normal(L))

@inline function vector_flux(σxz, σyz, G, n=surface_normal(G))
xz = CT12(CT1(unit_basis_vector_data(CT1, G)), G)
yz = CT12(CT2(unit_basis_vector_data(CT2, G)), G)
σ = C12(σxz * xz + σyz * xz, G)
return n σ
@inline function tensor_from_components(f₁₃, f₂₃, L, n=surface_normal(L))
xz = CT12(CT1(unit_basis_vector_data(CT1, L)), L)
yz = CT12(CT2(unit_basis_vector_data(CT2, L)), L)
f = C12(f₁₃ * xz + f₂₃ * xz, L)
return n f
end

"""
Expand Down

0 comments on commit 7912520

Please sign in to comment.