1- struct MomentumRoughnessLength{FT, V}
1+ struct MomentumRoughnessLength{FT, G, V}
22 gravitational_acceleration :: FT
33 air_kinematic_viscosity :: V
4- gravity_wave_parameter :: FT
4+ wave_formulation :: G
55 laminar_parameter :: FT
66 maximum_roughness_length :: FT
77end
@@ -12,17 +12,37 @@ struct ScalarRoughnessLength{FT, V, R}
1212 maximum_roughness_length :: FT
1313end
1414
15+ struct WindDependentWaveFormulation{FT}
16+ Umax :: FT
17+ ℂ₁ :: FT
18+ ℂ₂ :: FT
19+ end
20+
21+ """
22+ WindDependentWaveFormulation(FT = Oceananigans.defaults.FloatType;
23+ Umax = 19, ℂ₁ = 0.0017, ℂ₂ = -0.005)
24+
25+ A gravity wave parameter based on the wind speed `ΔU` with the formula `ℂ₁ * max(ΔU, Umax) + ℂ₂`.
26+ """
27+ WindDependentWaveFormulation (FT= Oceananigans. defaults. FloatType; Umax = 19 , ℂ₁ = 0.0017 , ℂ₂ = - 0.005 ) =
28+ WindDependentWaveFormulation (convert (FT, Umax),
29+ convert (FT, ℂ₁),
30+ convert (FT, ℂ₂))
31+
32+ gravity_wave_parameter (α:: Number , args... ) = α
33+ gravity_wave_parameter (α:: WindDependentWaveFormulation , ΔU) = α. ℂ₁ * max (ΔU, α. Umax) + α. ℂ₂
34+
1535"""
1636 ScalarRoughnessLength(FT = Float64;
1737 air_kinematic_viscosity = temperature_dependent_viscosity,
1838 reynolds_number_scaling_function = empirical_scaling_function,
1939 maximum_roughness_length = 1.6e-4)
2040
21- Constructs a `ScalarRoughnessLength` object that represents the scalar roughness length
41+ Construct a `ScalarRoughnessLength` object that represents the scalar roughness length
2242that regulates the exchange of heat and water vapor between the ocean and the atmosphere.
2343
2444Keyword Arguments
25- ==================
45+ =================
2646
2747- `air_kinematic_viscosity::Function`: The function to compute the air kinematic viscosity.
2848- `reynolds_number_scaling_function::Function`: The function to compute the Reynolds number scaling factor.
4363 gravitational_acceleration = default_gravitational_acceleration,
4464 maximum_roughness_length = 1.0,
4565 air_kinematic_viscosity = TemperatureDependentAirViscosity(FT),
46- gravity_wave_parameter = 0.011,
66+ wave_formulation = 0.011,
4767 laminar_parameter = 0.11)
4868
4969Construct a `MomentumRoughnessLength` object that represents the momentum roughness length that
@@ -55,21 +75,21 @@ Keyword Arguments
5575- `gravitational_acceleration`: The gravitational acceleration. Default: `default_gravitational_acceleration`.
5676- `maximum_roughness_length`: The maximum roughness length. Default: 1.0.
5777- `air_kinematic_viscosity`: The air kinematic viscosity. Default: `TemperatureDependentAirViscosity(FT)`.
58- - `gravity_wave_parameter `: The wave parameter. Default: 0.011.
78+ - `wave_formulation `: The wave parameter. Either constant or `WindDependentWaveFormulation(FT)` . Default: 0.011.
5979- `laminar_parameter`: The laminar parameter. Default: 0.11.
6080"""
6181function MomentumRoughnessLength (FT= Oceananigans. defaults. FloatType;
6282 gravitational_acceleration = default_gravitational_acceleration,
6383 maximum_roughness_length = 1.0 , # An estimate?
6484 air_kinematic_viscosity = TemperatureDependentAirViscosity (FT),
65- gravity_wave_parameter = 0.011 ,
85+ wave_formulation = 0.011 ,
6686 laminar_parameter = 0.11 )
6787
6888 return MomentumRoughnessLength (convert (FT, gravitational_acceleration),
69- air_kinematic_viscosity,
70- convert (FT, gravity_wave_parameter) ,
71- convert (FT, laminar_parameter),
72- convert (FT, maximum_roughness_length))
89+ air_kinematic_viscosity,
90+ wave_formulation ,
91+ convert (FT, laminar_parameter),
92+ convert (FT, maximum_roughness_length))
7393end
7494
7595function default_roughness_lengths (FT= Oceananigans. defaults. FloatType)
81101
82102# Temperature-dependent viscosity law
83103struct TemperatureDependentAirViscosity{FT}
84- C ₀ :: FT
85- C ₁ :: FT
86- C ₂ :: FT
87- C ₃ :: FT
104+ ℂ ₀ :: FT
105+ ℂ ₁ :: FT
106+ ℂ ₂ :: FT
107+ ℂ ₃ :: FT
88108end
89109
90110"""
91111 TemperatureDependentAirViscosity([FT = Oceananigans.defaults.FloatType;
92- C ₀ = 1.326e-5,
93- C ₁ = C ₀ * 6.542e-3,
94- C ₂ = C ₀ * 8.301e-6,
95- C ₃ = - C ₀ * 4.84e-9])
112+ ℂ ₀ = 1.326e-5,
113+ ℂ ₁ = ℂ ₀ * 6.542e-3,
114+ ℂ ₂ = ℂ ₀ * 8.301e-6,
115+ ℂ ₃ = - ℂ ₀ * 4.84e-9])
96116
97- Constructs a `TemperatureDependentAirViscosity` object that calculates the kinematic
117+ Construct a `TemperatureDependentAirViscosity` object that calculates the kinematic
98118viscosity of air as
119+
99120```math
100- C ₀ + C ₁ T + C ₂ T^2 + C ₃ T^3.
121+ ℂ ₀ + ℂ ₁ T + ℂ ₂ T^2 + ℂ ₃ T^3
101122```
102123"""
103124function TemperatureDependentAirViscosity (FT = Oceananigans. defaults. FloatType;
104- C ₀ = 1.326e-5 ,
105- C ₁ = C ₀ * 6.542e-3 ,
106- C ₂ = C ₀ * 8.301e-6 ,
107- C ₃ = - C ₀ * 4.84e-9 )
108-
109- return TemperatureDependentAirViscosity (convert (FT, C ₀),
110- convert (FT, C ₁),
111- convert (FT, C ₂),
112- convert (FT, C ₃))
125+ ℂ ₀ = 1.326e-5 ,
126+ ℂ ₁ = ℂ ₀ * 6.542e-3 ,
127+ ℂ ₂ = ℂ ₀ * 8.301e-6 ,
128+ ℂ ₃ = - ℂ ₀ * 4.84e-9 )
129+
130+ return TemperatureDependentAirViscosity (convert (FT, ℂ ₀),
131+ convert (FT, ℂ ₁),
132+ convert (FT, ℂ ₂),
133+ convert (FT, ℂ ₃))
113134end
114135
115136""" Calculate the air viscosity based on the temperature θ in Celsius. """
116137@inline function (ν:: TemperatureDependentAirViscosity )(θ)
117- FT = eltype (ν. C ₀)
138+ FT = eltype (ν. ℂ ₀)
118139 T = convert (FT, θ - celsius_to_kelvin)
119- return ν. C ₀ + ν. C ₁ * T + ν. C ₂ * T^ 2 + ν. C ₃ * T^ 3
140+ return ν. ℂ ₀ + ν. ℂ ₁ * T + ν. ℂ ₂ * T^ 2 + ν. ℂ ₃ * T^ 3
120141end
121142
122143# Fallbacks for constant roughness length!
@@ -125,11 +146,11 @@ end
125146
126147# Momentum roughness length should be different from scalar roughness length.
127148# Temperature and water vapor can be considered the same (Edson et al 2013)
128- @inline function roughness_length (ℓ:: MomentumRoughnessLength{FT} , u★, 𝒬, ℂ) where FT
149+ @inline function roughness_length (ℓ:: MomentumRoughnessLength{FT} , ΔU, u★, 𝒬, ℂ) where FT
129150 g = ℓ. gravitational_acceleration
130- α = ℓ. gravity_wave_parameter
131151 β = ℓ. laminar_parameter
132152 ℓm = ℓ. maximum_roughness_length
153+ α = gravity_wave_parameter (ℓ. wave_formulation, ΔU)
133154
134155 θ₀ = AtmosphericThermodynamics. air_temperature (ℂ, 𝒬)
135156 ν = ℓ. air_kinematic_viscosity (θ₀)
@@ -178,4 +199,3 @@ ReynoldsScalingFunction(FT = Oceananigans.defaults.FloatType; A = 5.85e-5, b = 0
178199
179200 return min (ℓq, ℓm)
180201end
181-
0 commit comments