@@ -14,7 +14,12 @@ import SurfaceFluxes.UniversalFunctions as UF
1414 thermo_params,
1515
1616 # Arguments for the first method (most commonly called):
17- ts::TD.ThermodynamicState,
17+ T, # Air temperature [K]
18+ ρ, # Air density [kg/m³]
19+ q_tot, # Total specific humidity [kg/kg]
20+ q_liq, # Liquid specific humidity [kg/kg]
21+ q_ice, # Ice specific humidity [kg/kg]
22+ cf, # Cloud fraction
1823 ::Type{C3}, # Covariant3 vector type, for projecting gradients
1924 ∂qt∂z::AbstractField, # Vertical gradient of total specific humidity
2025 ∂θli∂z::AbstractField, # Vertical gradient of liquid-ice potential temperature
@@ -36,23 +41,22 @@ fraction. The calculation involves:
3641 thermodynamic variables (`∂θᵥ/∂z`, `∂θₗᵢ/∂z`, `∂qₜ/∂z`), obtained from
3742 the input fields after projection.
38433. Blending the resulting unsaturated and saturated buoyancy gradients based on
39- the environmental cloud fraction derived from the thermodynamic state `ts`.
40-
41- The dispatch on `EnvBuoyGradVars` (used internally by the first method after
42- constructing it from `ts` and projected gradients) occurs during its construction.
43- The analytical solutions employed are consistent for both mean fields and
44- conditional fields derived from assumed distributions over conserved thermodynamic
45- variables.
44+ the environmental cloud fraction.
4645
4746Arguments:
4847- `closure`: The environmental buoyancy gradient closure type (e.g., `BuoyGradMean`).
4948- `thermo_params`: Thermodynamic parameters from `CLIMAParameters`.
50- - `ts`: Center-level thermodynamic state of the environment.
49+ - `T`: Air temperature [K]
50+ - `ρ`: Air density [kg/m³]
51+ - `q_tot`: Total specific humidity [kg/kg]
52+ - `q_liq`: Liquid specific humidity [kg/kg]
53+ - `q_ice`: Ice specific humidity [kg/kg]
54+ - `cf`: Cloud fraction
5155- `C3`: The `ClimaCore.Geometry.Covariant3Vector` type, used for projecting input vertical gradients.
5256- `∂qt∂z`: Field of vertical gradients of total specific humidity.
5357- `∂θli∂z`: Field of vertical gradients of liquid-ice potential temperature.
5458- `local_geometry`: Field of local geometry at cell centers, used for gradient projection.
55- The second method takes a precomputed `EnvBuoyGradVars` object instead of `ts` and gradient fields.
59+ The second method takes a precomputed `EnvBuoyGradVars` object instead of T, ρ, q_tot, q_liq, q_ice and gradient fields.
5660
5761Returns:
5862- `∂b∂z`: The mean vertical buoyancy gradient [s⁻²], as a field of scalars.
@@ -62,7 +66,11 @@ function buoyancy_gradients end
6266function buoyancy_gradients (
6367 ebgc:: AbstractEnvBuoyGradClosure ,
6468 thermo_params,
65- ts,
69+ T,
70+ ρ,
71+ q_tot,
72+ q_liq,
73+ q_ice,
6674 cf,
6775 :: Type{C3} ,
6876 ∂qt∂z,
@@ -73,7 +81,11 @@ function buoyancy_gradients(
7381 ebgc,
7482 thermo_params,
7583 EnvBuoyGradVars (
76- ts,
84+ T,
85+ ρ,
86+ q_tot,
87+ q_liq,
88+ q_ice,
7789 cf,
7890 projected_vector_buoy_grad_vars (
7991 C3,
@@ -96,18 +108,18 @@ function buoyancy_gradients(
96108 Rv_over_Rd = TDP. Rv_over_Rd (thermo_params)
97109 R_v = TDP. R_v (thermo_params)
98110
99- ts = bg_model. ts
100- ∂b∂θv = g / TD. virtual_pottemp (thermo_params, ts )
111+ (; T, ρ, q_tot, q_liq, q_ice) = bg_model
112+ ∂b∂θv = g / TD. virtual_pottemp (thermo_params, T, ρ, q_tot, q_liq, q_ice )
101113
102- T = TD . air_temperature (thermo_params, ts)
103- λ = TD. liquid_fraction (thermo_params, ts )
114+ # TODO : is this correct for equilmoist?
115+ λ = TD. liquid_fraction (thermo_params, T, q_liq, q_ice )
104116 lh =
105117 λ * TD. latent_heat_vapor (thermo_params, T) +
106118 (1 - λ) * TD. latent_heat_sublim (thermo_params, T)
107- cp_m = TD. cp_m (thermo_params, ts )
108- q_sat = TD . q_vap_saturation (thermo_params, ts)
109- q_tot = TD. total_specific_humidity (thermo_params, ts )
110- θ = TD. dry_pottemp (thermo_params, ts )
119+ cp_m = TD. cp_m (thermo_params, q_tot, q_liq, q_ice )
120+ # TODO : is this correct for equilmoist?
121+ q_sat = TD. q_vap_saturation (thermo_params, T, ρ, q_liq, q_ice )
122+ θ = TD. potential_temperature (thermo_params, T, ρ, q_tot, q_liq, q_ice )
111123 ∂b∂θli_unsat = ∂b∂θv * (1 + (Rv_over_Rd - 1 ) * q_tot)
112124 ∂b∂qt_unsat = ∂b∂θv * (Rv_over_Rd - 1 ) * θ
113125 ∂b∂θli_sat = (
0 commit comments