@@ -390,9 +390,19 @@ Derivative of saturation vapor specific humidity with respect to temperature.
390390# Returns
391391- `∂q_v^* / ∂T`: Derivative of saturation specific humidity with respect to temperature [kg/kg/K].
392392
393- Computed via the Clausius-Clapeyron relation: `∂q_sat/∂T = q_sat * (L / (Rv * T^2) - 1 / T)`, which
394- follows from `q_sat = p_sat / (ρ * R_v * T)` and the Clausius-Clapeyron relation
395- `∂ln(p_sat)/∂T = L / (Rv * T^2)` by differentiation with respect to `T` while holding `ρ` constant.
393+ Computed via the Clausius-Clapeyron relation:
394+ ```math
395+ \f rac{\p artial q_v^*}{\p artial T} = q_v^* \l eft( \f rac{L}{R_v T^2} - \f rac{1}{T} \r ight)
396+ ```
397+ which follows from the definition of saturation specific humidity
398+ ```math
399+ q_v^* = \f rac{p_v^*}{\r ho R_v T}
400+ ```
401+ (where `` q_v^* `` is `q_vap_sat` and `` p_v^* `` is saturation vapor pressure) and the Clausius-Clapeyron relation
402+ ```math
403+ \f rac{\p artial \l n p_v^*}{\p artial T} = \f rac{L}{R_v T^2}
404+ ```
405+ by differentiation with respect to `` T `` while holding `` \r ho `` constant.
396406
397407If `q_liq` and `q_ice` are provided, the saturation specific humidity derivative is computed
398408assuming a phase mixture defined by the liquid fraction (see [`liquid_fraction`](@ref)).
@@ -407,16 +417,14 @@ parameterization (see [`liquid_fraction_ramp`](@ref)).
407417 q_vap_sat = q_vap_saturation (param_set, T, ρ)
408418 λ = liquid_fraction_ramp (param_set, T)
409419 L = latent_heat_mixed (param_set, T, λ)
410- R_v = TP. R_v (param_set)
411- return q_vap_sat * (L / (R_v * T^ 2 ) - 1 / T)
420+ return _∂q_vap_sat_∂T_from_L (param_set, q_vap_sat, L, T)
412421end
413422
414423@inline function ∂q_vap_sat_∂T (param_set:: APS , T, ρ, q_liq, q_ice)
415424 q_vap_sat = q_vap_saturation (param_set, T, ρ, q_liq, q_ice)
416425 λ = liquid_fraction (param_set, T, q_liq, q_ice)
417426 L = latent_heat_mixed (param_set, T, λ)
418- R_v = TP. R_v (param_set)
419- return q_vap_sat * (L / (R_v * T^ 2 ) - 1 / T)
427+ return _∂q_vap_sat_∂T_from_L (param_set, q_vap_sat, L, T)
420428end
421429
422430@inline function ∂q_vap_sat_∂T (param_set:: APS , T, ρ, phase:: Phase )
426434 latent_heat_vapor (param_set, T),
427435 latent_heat_sublim (param_set, T),
428436 )
437+ return _∂q_vap_sat_∂T_from_L (param_set, q_vap_sat, L, T)
438+ end
439+
440+ @inline function _∂q_vap_sat_∂T_from_L (param_set:: APS , q_vap_sat, L, T)
429441 R_v = TP. R_v (param_set)
430442 return q_vap_sat * (L / (R_v * T^ 2 ) - 1 / T)
431443end
@@ -628,4 +640,3 @@ If the specific humidities are not given, the result is the saturation vapor pre
628640 vapor_pressure_deficit (param_set, T, p, q_tot, q_liq, q_ice, Ice ()),
629641 )
630642end
631-
0 commit comments