Bulk-Flux
- AoFlux
model
coupler
cmeps
CMEPS atmosphere-ocean bulk flux component (stage 2 of the EqESM project): the pointwise laws of flux_atmOcn_large in cesm/flux_atmocn/flux_atmocn_Large.F90 (the Large & Pond / Large & Yeager scheme of the CESM mediator, cesm3.0-alphabranch checkout) transcribed exactly, with the expression templates of ./cmeps_templates.esm imported by reference. The traced configuration (the C_JRA_t62 DATM+MOM6 case, nuopc.runconfig of the instrumented run): add_gusts = .false., coldair_outbreak_mod = .false., aofluxes_use_shr_wv_sat = .true. (the shr_wv_sat Goff & Gratch / qsat path), minwind = 0.5 m/s (seq_flux_atmocn_minwind), flux_convergence = 0.01 and flux_max_iteration = 5 (the do-while of F90:242-290). Structure, in the order of the Fortran: (a) the 12 raw inputs zbot/ubot/vbot/thbot/qbot/rainc/rbot/tbot/pslv/us/vs/ts (the flux_atmOcn_large argument list, F90:50-67); (b) the derived inputs of F90:193-229: du = ubot - us and dv = vbot - vs (the relative-wind components), vmag (the minwind-clamped relative wind), wind0 = vmag (the resolved wind of F90:204; with add_gusts = .false. the Fortran computes wind0 = max(minwind, sqrt(du^2 + dv^2)) identically to vmag, so the alias is exact), esat_raw (Goff & Gratch at ts), esat = min(esat_raw, pslv), qsat from the RAW es (shr_wv_sat_qsat_liquid calls svp_to_qsat with the unminned es, shr_wv_sat_mod.F90:439-441), ssq = 0.98*qsat, delt, delq, alz = ln(zbot/10), al2 = ln(zref/ztref), cp = cpdair*(1 + cpvir*ssq), with the CESM constants cpdair = 1004.64 J/kg/K and cpvir = 1810/1004.64 - 1 declared once as named parameters of this component (shr_const_mod.F90:46, 48); (c) the neutral coefficients of F90:236-244 (stable0 = 0.5 + sign(0.5, delt) as a 0/1 selection, rdn0 = sqrt(cdn(vmag)), rhn0 = (1-stable0)*0.0327 + stable0*0.018, ren0 = 0.0346, ustar0/tstar0/qstar0); (d) the stability iteration of F90:242-290. The esm has no loop construct, so the iteration is represented compositionally: the 16-equation update law is authored ONCE in the one-step model AoFluxStep of ./cmeps_aoflux_step.esm (a single pass of the do-while: hol_raw (the unclamped Monin-Obukhov parameter of F90:252-253), hol = stability_parameter_clamp(hol_raw) (the |hol| <= 10 sign-preserving clamp of F90:254), the stability selection, xsq/xqq, the psi functions, the clamped wind-shift rdw of F90:272, u10n = vmag*rdw/rdn_prev, the updated neutral coefficients rdn = sqrt(cdn(u10n)) and rhn, the height-shifted rd/rh/re of F90:282-284, ustar/tstar/qstar, the per-update convergence flag conv = |(ustar - ustar_prev)/ustar| <= 0.01, and 4 frozen-state fields (ustar/tstar/qstar/rdn) pinning the first-converged state) and mounted six times by reference as top-level models step1..step5 and exit (esm-spec section 4.7; top-level mounts are required because the pinned CLI silently drops couplings in the single-top-level-model build path, see README.md), with the chained inputs coupled by variable_map (imported from the ./cmeps_aoflux_steps_coupling.esm coupling library, esm-spec sections 10.9-10.10, so the same 86 edges are reused by reference by the m9_ocn_flux.esm subassembly): ustar0/tstar0/qstar0/rdn0 seed step1, each step's state feeds the next (ustar/tstar/qstar/rdn), conv and the 4 frozen fields thread the convergence state, and the fixed pointwise fields vmag/delt/delq/alz/zbot/thbot/qbot feed every step (ren stays the constant 0.0346 of F90:277, not coupled; the CESM constants karman = 0.4, cpdair, cpvir, latvap = 2.501e6 J/kg and stebol = 5.67e-8 W/m^2/K^4 are declared once as named parameters of this component, shr_const_mod.F90:32, 46, 48, 52, 22). The 6th mount exit recomputes the exit-state fields from step5's frozen state: the exit-state fields of the first-converged update k are deterministic functions of the pre-converged state (the update k-1 outputs ustar/tstar/qstar/rdn) plus the fixed fields (Fortran do-while trace), so only these 4 states need to be threaded — exit is fed by step5.frozen_ustar_prev/frozen_tstar_prev/frozen_qstar_prev/frozen_rdn_prev (conv_prev stays at its 0 default, so the frozen selection inside exit is the identity) and the 7 fixed fields, and the parent aliases the 15 exit-state fields from its fresh unknowns (hol, stable, xsq, xqq, psimh, psixh, rd, u10n, rdn, rhn, rh, re, ustar, tstar, qstar), which coincide bit-identically with the Fortran exit state. The parent keeps the same external names as the pre-refactor unrolled model so the pinned tests are unchanged: conv_1..4 = step1..4.conv, iter = the first converged k, else 5 (nested ifelse on conv_1..4), and the 16 exit-state fields = the 15 exit.* fields (the first-converged update's values, recomputed by the exit mount from the pinned 4-state; in the no-convergence case the fresh 5th-update values) plus ren; (e) the fluxes of F90:299-311 (tau/taux/tauy/sen/lat/lwup/evap); (f) the 2-m diagnostics of F90:316-333 (hol2/xsq2/xqq2/psix2/fac_t/fac_q/tref/qref/duu10n/u10res), which consume the exit state exactly as the Fortran leaves it after the do-while.
- AoFluxStep
model
coupler
cmeps
One-step update of the CMEPS atmosphere-ocean stability iteration (stage 2 of the EqESM project): a single pass of the do-while of flux_atmOcn_large in cesm/flux_atmocn/flux_atmocn_Large.F90:242-290 (the Large & Pond / Large & Yeager scheme of the CESM mediator, cesm3.0-alphabranch checkout), transcribed exactly and mounted six times by reference in cmeps_aoflux.esm (top-level models.step1..step5, esm-spec section 4.7; the 6th mount exit recomputes the exit-state fields from step5's frozen state, see the parent's metadata) so the 16-equation update law is authored once and the unrolled iteration is composed. Inputs are the update-invariant pointwise fields vmag/delt/delq/alz/zbot/thbot/qbot (the wind magnitude, the temperature and humidity differences, the height logarithm ln(zbot/10) and the Monin-Obukhov inputs of F90:252-254) and the water coefficient ren = 0.0346 (constant across the iteration, F90:277), the previous update's state (ustar_prev/tstar_prev/qstar_prev feeding the stability parameter and the convergence test |(ustar - ustar_prev)/ustar| <= flux_convergence = 0.01 of F90:286-287, and rdn_prev, the pre-update neutral drag used by the clamped wind shift rdw of F90:272; the heat coefficient rhn is recomputed from this update's stability each pass, F90:278, so no rhn_prev is needed), the previous convergence flag conv_prev, and the 4 previous frozen-state fields (ustar/tstar/qstar/rdn). The CESM constants karman = 0.4, g = 9.80616 m/s^2 and zvir = 28.966/18.016 - 1 (shr_const_mod.F90:32, 21, 31) are parameters with defaults, bound into the stability_parameter template call and not coupled (the parent carries the same constants, the ren precedent). Outputs are the 17 update states (hol_raw, the unclamped Monin-Obukhov parameter of F90:252-253; hol = stability_parameter_clamp(hol_raw), the sign-preserving |hol| <= 10 clamp of F90:254; stable, xsq, xqq, psimh, psixh, rdw, u10n, rdn, rhn, rd, rh, re, ustar, tstar, qstar), this update's own convergence flag conv, and 4 frozen-state fields (frozen_ustar_prev/frozen_tstar_prev/frozen_qstar_prev/frozen_rdn_prev) that pin the INPUT state of the first-converged update (frozen_state_select on the update inputs ustar_prev/tstar_prev/qstar_prev/rdn_prev: once conv_prev = 1 the frozen fields stop updating, so the 5th mount's frozen outputs are the state the first-converged update was computed from — the pre-converged update's outputs, which the parent's exit mount feeds back through the update law to reproduce the Fortran exit state exactly — and the all-5-iterations case leaves the fresh 4th-update values, which reproduce the 5th update). The frozen threading is required because the iteration states do not repeat after convergence (ustar_2 differs from ustar_4 at the 1.8e-4 level on the pinned rows) while the dump pins the first-converged state; all 15 exit-state fields are functions of the pinned 4-input state plus the fixed fields and are recomputed by the parent's exit mount rather than threaded. The expression templates of ./cmeps_templates.esm are imported by reference.