Stability-Iteration
- BareGroundStep
model
land_surface
clm
One-step update of the CLM bare-ground stability iteration: a single pass of the do-while of BareGroundFluxes in CTSM ctsm5.4.063 src/biogeophys/BareGroundFluxesMod.F90:342-388 (F90 line numbers below refer to that tag) (the FrictionVelocity call of :344-347 followed by the z0hg update, the stability-parameter update and the Obukhov-length update of :353-387), transcribed exactly and mounted three times by reference in clm_bareground.esm (top-level models.step1..step3, esm-spec section 4.7) so the 17-equation update law is authored once and the unrolled iteration is composed. Inputs are the update-invariant pointwise fields (the wind and temperature measurement heights forc_hgt_u/forc_hgt_t, the momentum roughness z0m = z0mg_patch which is constant across the iteration, the wind speed ur = max(wind_min, |forc_u,forc_v|), the temperature/humidity differences dth/dqh, the forcing specific/potential temperatures forc_q/forc_th, the virtual potential temperature thv, the convective velocity-scale inputs zii/beta, the zetamaxstable stability clamp and the physical constants vkc/grav/zetam/zetat/meier_param3/nu_param/beta_param) and the previous update's state (z0h_prev/obu_prev/um_prev). The iteration height is the step's own momentum profile height zldis_u = forc_hgt_u + z0m, which equals the parent's zldis = forc_hgt_u + z0mg (the redundant coupling is dropped), and the Fortran's stale wc local is computed unconditionally (only read by the unstable um branch; the dead wc threading is dropped). Outputs are the 17 update states (zldis_u = forc_hgt_u + z0m, zldis_t = forc_hgt_t + z0h_prev and zldis_2m = 2 + z0h_prev, the three profile heights of FrictionVelocityMod.F90:850-853, 946-949, 1022-1025; ustar from the four-branch momentum profile F90:857-871; temp1 from the four-branch scalar profile F90:956-970; temp2 = temp1 and temp22m = temp12m by the equality branch F90:997-998 and F90:1051-1052, which holds in the traced run because forc_hgt_q_patch == forc_hgt_t_patch and z0qg == z0hg; temp12m from the 2-m scalar profile F90:1022-1038; tstar = temp1*dth and qstar = temp2*dqh F90:354-355; z0h from the Meier2022 update F90:364; thvstar F90:375 (the virtual_potential_scale law shared with the parent's dthv); zeta_raw F90:376; the sign-preserving stability clamp zeta F90:378-386 (the clamp_zeta law shared with the MoninObukIni initialization); wc F90:383; obu = zldis/zeta F90:387). NaN safety: every branch of an ifelse may be evaluated eagerly by a backend, so the laws the Fortran evaluates only on one branch are written so their unselected branches stay finite - the wc base is clamped at zero (max(base, 0): on the unstable rows where wc is read the base is positive and the value is unchanged; on stable rows the Fortran never evaluates it), and the friction-velocity profile templates clamp the arguments of their unstable-branch logs, fractional powers and stability functions (clm_templates.esm). The expression templates of ./clm_templates.esm are imported by reference.