diff --git a/src/surface_conditions/surface_conditions.jl b/src/surface_conditions/surface_conditions.jl index ce065af263..5387ed972d 100644 --- a/src/surface_conditions/surface_conditions.jl +++ b/src/surface_conditions/surface_conditions.jl @@ -61,11 +61,12 @@ end surface_state(sfc_setup_wrapper::SurfaceState, _, _, _) = sfc_setup_wrapper surface_state( - wrapped_sfc_setup::Function, + wrapped_sfc_setup::F, sfc_local_geometry_values, int_z_values, t, -) = wrapped_sfc_setup(sfc_local_geometry_values.coordinates, int_z_values, t) +) where {F <: Function} = + wrapped_sfc_setup(sfc_local_geometry_values.coordinates, int_z_values, t) # This is a hack for meeting the August 7th deadline. It is to ensure that the # coupler will be able to construct an integrator before overwriting its surface @@ -149,7 +150,7 @@ Computes the surface conditions, given information about the surface and the first interior point. Implements the assumptions listed for `SurfaceState`. """ function surface_state_to_conditions( - wrapped_sfc_setup, + wrapped_sfc_setup::WSS, surface_local_geometry, interior_ts, interior_u, @@ -161,7 +162,7 @@ function surface_state_to_conditions( atmos, sfc_prognostic_temp, t, -) +) where {WSS} surf_state = surface_state(wrapped_sfc_setup, surface_local_geometry, interior_z, t) parameterization = surf_state.parameterization diff --git a/src/surface_conditions/surface_setups.jl b/src/surface_conditions/surface_setups.jl index a07755d319..3ad6d88162 100644 --- a/src/surface_conditions/surface_setups.jl +++ b/src/surface_conditions/surface_setups.jl @@ -55,12 +55,15 @@ function (::GABLS)(params) q_vap = FT(0) z0 = FT(0.1) parameterization = MoninObukhov(; z0) - surface_state(surface_coordinates, interior_z, t) = SurfaceState(; - parameterization, - T = 265 - FT(0.25) * FT(t) / 3600, - p, - q_vap, - ) + function surface_state(surface_coordinates, interior_z, t) + _FT = eltype(surface_coordinates) # do not capture FT + SurfaceState(; + parameterization, + T = 265 - _FT(0.25) * _FT(t) / 3600, + p, + q_vap, + ) + end return surface_state end @@ -119,7 +122,8 @@ function (::LifeCycleTan2018)(params) z0 = FT(1e-4) ustar = FT(0.28) function surface_state(surface_coordinates, interior_z, t) - weight = FT(0.01) + FT(0.99) * (cos(2 * FT(π) * t / 3600) + 1) / 2 + _FT = eltype(surface_coordinates) # do not capture FT + weight = _FT(0.01) + _FT(0.99) * (cos(2 * _FT(π) * t / 3600) + 1) / 2 fluxes = θAndQFluxes(; θ_flux = θ_flux0 * weight, q_flux = q_flux0 * weight) parameterization = MoninObukhov(; z0, fluxes, ustar) @@ -226,9 +230,10 @@ function (::TRMM_LBA)(params) z0 = FT(1e-4) ustar = FT(0.28) # 0.28 is taken from Bomex. TODO: Approximate from LES TKE. function surface_state(surface_coordinates, interior_z, t) - value = cos(FT(π) / 2 * (1 - FT(t) / (FT(5.25) * 3600))) - shf = 270 * max(0, value)^FT(1.5) - lhf = 554 * max(0, value)^FT(1.3) + _FT = eltype(surface_coordinates) # do not capture FT + value = cos(_FT(π) / 2 * (1 - _FT(t) / (_FT(5.25) * 3600))) + shf = 270 * max(0, value)^_FT(1.5) + lhf = 554 * max(0, value)^_FT(1.3) fluxes = HeatFluxes(; shf, lhf) parameterization = MoninObukhov(; z0, fluxes, ustar) return SurfaceState(; parameterization, T, p, q_vap)