Cesm
- BareGroundFluxes
model
land_surface
clm
CLM bare-ground turbulent-flux component: the pointwise laws of BareGroundFluxes in src/biogeophys/BareGroundFluxesMod.F90 of CTSM ctsm5.4.063 (the CESM3.0 alpha-branch land model; F90 line numbers below refer to that tag) transcribed exactly, with the expression templates of ./clm_templates.esm imported by reference. The traced configuration (the lnd_in namelist of the I2000Clm60Sp reference case): z0param_method = 'Meier2022', use_z0m_snowmelt = .true. (so z0mg comes from the snowmelt-dependent branch of SetRoughnessLengthsAndForcHeightsNonLake, FrictionVelocityMod.F90:620-623), zetamaxstable = 2.0, soil_resis_method = 1 (the Swenson & Lawrence 2014 soil-resistance branch, inactive on the pinned rows because they are all dew rows with dqh > 0), do_soilevap_beta inactive, GSWP3 forcing heights 30 m, wind_min = 1.0 m/s and the Meier2022 constants of the ctsm60_params.c260518.nc parameter file. Structure, in the order of the Fortran: (a) the raw inputs (forc_t/forc_q/forc_u/forc_v/forc_pbot/forc_rho, thm, t_grnd, qg, the ground-layer temperatures t_soisno_top = t_soisno(c,snl+1)/t_soisno_soil = t_soisno(c,1)/t_h2osfc, the surface-humidity fields qg_snow/qg_soil/qg_h2osfc and dqgdT, thv, and the constants); (b) the derived inputs of F90:318-322 (ur = max(wind_min, |forc_u,forc_v|), dth, dqh, dthv, zldis = forc_hgt_u + z0mg) with forc_th = thv/(1 + 0.61*forc_q) recovered from the dumped virtual potential temperature (dthv = dth*(1 + 0.61*forc_q) + 0.61*forc_th*dqh of F90:328 then inverts to forc_th = thv/(1 + 0.61*forc_q)); (c) z0mg from the Meier2022 snowmelt template (the traced rows are all in the frac_sno_albedo > 0, snomelt_accum < 1e-5 branch, pinning z0mg = exp(-b1*pi/2 + b4)*1e-3 = 8.13402050576016129e-05; the bare-soil zlnd branch of the select case is included for completeness); (d) the MoninObukIni initialization of F90:331 (um_ini, rib, zeta_ini clamped to [0.01, 2.0], obu_ini = zldis/zeta_ini); (e) the stability iteration of F90:342-388. The esm has no loop construct, so the iteration is represented compositionally: the 17-equation update law is authored ONCE in the one-step model BareGroundStep of ./clm_bareground_step.esm (a single pass of the do-while: the FrictionVelocity profiles and friction velocity, the Meier2022 z0hg update, the stability-parameter clamp and the um/wc/obu update) and mounted three times by reference as top-level models step1..step3 (esm-spec section 4.7; top-level mounts are required because the Rust CLI silently drops couplings in the single-top-level-model build path, see README.md), with the chained inputs coupled by the 66 variable_map edges of the ./clm_bareground_steps_coupling.esm coupling library (imported by reference): um_ini/obu_ini/z0mg seed step1, each step's state feeds the next (um/obu/z0h), and the update-invariant pointwise fields (forc_hgt_u, forc_hgt_t, z0m = z0mg, ur, dth, dqh, forc_q, forc_th, thv, zii, beta, zetamaxstable and the constants vkc/grav/zetam/zetat/meier_param3/nu_param/beta_param) feed every step; the parent's zldis equals the step's own profile height zldis_u (z0mg is iteration-constant) and the Fortran's stale wc local is only read by the unstable um branch, so the zldis and wc couplings are dropped as dead. The parent keeps the external names of the Fortran locals: ustar/temp1/temp2/temp12m/temp22m/z0h/um = the step3 outputs (the exit state of the 3-iteration loop, which matches the traced run's niters = 3). The 2-m humidity profiles are the equality branches temp2 = temp1 and temp22m = temp12m (F90:997-998, 1051-1052) because forc_hgt_q_patch == forc_hgt_t_patch and z0qg == z0hg in the traced run. (f) the flux laws of F90:400-476: ram/rah/raw, raih = forc_rho*cpair/rah, the vapor pressure forc_e = max(forc_q*forc_pbot/(forc_q + 0.622), 0.01*forc_esat) with forc_esat from the QSat polynomial, the Magnus dewpoint forc_dewpoint of F90:548-578 (ice coefficients on all traced rows: t_grnd ~ 234-250 K < tfrz selects the ice branch), the raiw selection of F90:423-442 (the dqh > 0 dew branch with the t_grnd > forc_dewpoint no-dew gate, the sl14/beta branches of the dqh <= 0 side transcribed for completeness), ram1, cgrnds/cgrndl/cgrnd (cgrnd = cgrnds + htvp*cgrndl, F90:450, where htvp is the column latent heat chosen by BiogeophysPreFluxCalcsMod.F90:353-357: hsub = SHR_CONST_LATSUB = 2.8347e6 J/kg when the top layer snl+1 holds ice and no liquid, else hvap = 2.501e6 J/kg; every traced row has a dry snow top layer, so htvp = hsub), taux/tauy (the wind_stress_component law), the sensible heat partition eflx_sh_grnd/soil/snow/h2osfc and the evaporation qflx_evap_soi and qflx_ev_snow/soil/h2osfc (one law: the aerodynamic_surface_flux template, flux = -resistance*(atmosphere - surface); qg_h2osfc is not dumped, so qflx_ev_h2osfc is transcribed but unpinned), and the 2-m diagnostics t_ref2m/q_ref2m/rh_ref2m (the ref2m_profile law, with qsat_ref2m from the shared qsat_qs) and kbm1 = log(z0mg/z0h) (F90:478-495). The tests pin the reference dumps: a CESM3 / CTSM ctsm5.4.063 I2000Clm60Sp land-only run (GSWP3 forcing, dtime = 1800 s) instrumented with write statements at the BareGroundFluxes exit, recording the inputs and outputs of the first 16 bare, deep-snowpack patches over the first 12 steps in full double precision: five of the 192 dumped rows (one per step/column regime, see README.md), asserting every dumped output column plus z0mg and cgrnd (cgrnd from the ComputeGroundHeatFluxAndDeriv dump of the same run). Tested regime: every one of the 192 dumped rows is stable (dthv > 0; the iteration zeta clamped at zetamaxstable = 2.0, so the momentum/heat profiles take the zeta > 1 branch and the 2-m profiles the 0 < zeta <= 1 branch), in the dew branch (dqh > 0, raiw = forc_rho/raw), below freezing (ice dewpoint coefficients), fully snow covered (frac_sno_albedo = 1, snomelt_accum = 0) and has forc_u == forc_v. The unstable branches (zeta < 0 and zeta < -zetam/-zetat), the evaporating dqh <= 0 branches (sl14 soil resistance and soilbeta), the liquid dewpoint branch, the snowmelt/bare-soil z0mg branches and rh_ref2m/kbm1/qflx_ev_h2osfc are transcribed but NOT exercised by any test, because the reference run contains no such rows. Not transcribed (dead or undumped in this configuration): the human-stress indices, the www soil-wetness variable, the rssun/rssha photosynthesis resistances, the u10 diagnostics of FrictionVelocityMod, and the ZengWang2007 z0hg branch (the traced run is Meier2022). Reference: CTSM ctsm5.4.063, src/biogeophys/BareGroundFluxesMod.F90 and FrictionVelocityMod.F90.
- 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.
- Channel
model
environmental_transport
mosart
MOSART main-channel routing step (stage 2 of the EqESM project): the per-cell Euler step 4 of mosart_physics.F90:Euler (F90:175-209) composed of mainchannelRouting -> Routing_KW (F90:273-348) and updateState_mainchannel (F90:385-402), written as a storage ODE with the pointwise laws imported from ./mosart_templates.esm. Equations, exactly as in the Fortran (RoutingMethod = 1, the only implemented method, F90:280-284): erin = -eroutUp (F90:302-303); with no river network (rlen <= 0) vr = 0 and erout = -(erin + erlateral) (F90:306-308); for an unrealistically small drainage density per channel (areaTotal2/(rwidth*rlen) > 1e6) erout = -(erin + erlateral) (F90:310-312); otherwise the Manning velocity vr = CRVRMAN_nosqrt(rslpsqrt, nr, rr) (F90:313) and erout = -vr*mr (F90:314), with the dry-cell clamp erout = -(erlateral + erin + wr/localdelt) when -erout > TINYVALUE and wr + (erlateral + erin + erout)*localdelt < TINYVALUE (F90:315-317), in which case vr = -erout/mr when mr > 0 (F90:318-320); the groundwater term temp_gwl = qgwl*area*frac (F90:325); dwr = erlateral + erin + erout + temp_gwl (F90:327), plus qirrig, the irrigation withdrawal (<= 0) that mosart_run takes out of wr once per coupling period (mosart_driver.F90:497), here a rate wired from the assembly's Control.qirrig_actual; d(wr)/dt = dwr (the Fortran advances wr += dwr*localdelt explicitly per substep, F90:189; here a continuous ODE, which is not the limit of that scheme - see README.md, 'Continuous ODEs vs the Fortran 3600-s Euler stepping'); updateState_mainchannel (F90:391-401) sets mr = GRMR(wr, rlen), yr = GRHR(mr, rwidth, rwidth0, rdepth), pr = GRPR(yr, rwidth, rwidth0, rdepth), rr = GRRR(mr, pr) when rlen > 0 and wr > 0, and zeroes all four otherwise; and the reach outflow streamflow flow = -erout (the Fortran accumulates flow -= erout over the m-levels and divides by DLevelH2R, F90:201, 216; here the instantaneous value) is exported to the assembly for the runoff aggregation. Units per mosart_tstatusflux_type.F90 / mosart_tspatialunit_type.F90: wr [m3]; erin, erout, dwr, erlateral, eroutUp [m3/s]; vr [m/s]; mr [m2]; yr, pr, rr [m]; rslpsqrt [1]; rlen, rwidth, rwidth0, rdepth, areaTotal2 [m2, m, m, m, m2]; nr is the main-reach Manning roughness (SI dimension s/m^(1/3)); qgwl [m/s]; localdelt = Tctl%DeltaT/DLevelH2R/numDT_r(nr) (F90:184). eroutUp is the outflow sum of the upstream gridcells delivered by the rh_eroutUp sparse-matrix gather over the ID/dnID network (F90:158) - a network-topology operation whose per-cell value is a parameter here until the frivinp network data source lands (boundaries.md 2.4). Two deliberate divergences, documented for reviewers: when the areaTotal2 branch fires the Fortran leaves vr stale (unused there), while here vr takes the Manning value; and the Fortran's negative-storage warning (F90:329-334) is a diagnostic, not physics, and is not transcribed. The tests block has three kinds of pins (the stage1/... paths refer to the EqESM instrumented-CESM checkout; see README.md, Testing): (1) dry-window CESM pins from stage1/dumps/mosart/ (gr_chan.csv, crvrman_chan.csv, mosart_euler.csv of the lane run, where every channel stays below TINYVALUE): the dry geometry chain and dry routing branches pointwise (time_span {0,0}) and a one-substep storage trace; (2) wet-window CESM pins from stage1/dumps/mosart_wet/ (a 1-day cold start whose runoff pulse drives reaches above bankfull): flood-plain geometry (floodplain_geom_*), wet Manning routing with qgwl and upstream inflow (wet_manning_*) and one wet m-level storage trace (wet_ode_*); (3) NOT from a CESM run: the in-bank/trapezoid/flood-plain geometry_*_cell100312 pins, whose expected values come from the unmodified GRHR/GRPR/GRRR compiled from mosart_physics.F90 into a standalone gfortran driver at chosen storages (EqESM checkout, stage1/analysis/mosart_geometry/mosart_geometry_driver.f90, gitignored); those pins caught and now guard the GRHR trapezoid transcription (the 0.1*(2.0/1.0) = 0.2 factor in place of SLOPE1/2 = 0.05 and the dropped rdepth prefix, F90:528). Reference: stage1/cesm/components/mosart/src/riverroute/mosart_physics.F90 (mosart1.1.13).
- Clmncep
model
data_models
cdeps
The CDEPS DATM data-atmosphere laws for the GSWP3v1 forcing with the CLMNCEP datamode (cdeps1.0.112), with no data access: (1) Streams - the stream layer of shr_strdata_advance for the four GSWP3 streams, with the time-interpolation factors computed from the model time t (coszen for Solar: cosz/tavCosz from the shr_orb_decl declination and the modeldt-sampled interval average, 0 at night; nearest for Precip; linear for TPQW; lower for the static topo), each 3-hourly field entering as its bracketing record pair [LB, UB] over the record axis rec (esm-spec 8.5.1); (2) Clmncep - the datamode transformation from the interpolated stream values to the export state Sa_* / Faxa_*. The shared pointwise laws are imported from ./cdeps_templates.esm. The tests pin CDEPS instrumentation dumps of a reference CESM I2000Clm60Sp_f19 run (cdeps_strdata_streams.csv for Streams, datm_gswp3_streams.csv + datm_gswp3_exports.csv for Clmncep; all traced points are at lat -90 on 2000-01-01, so polar day and all snow), plus closed-form recomputations for the branches no traced row reaches (README). The GSWP3 data sources and the reader -> Streams -> Clmncep wiring live in cdeps_datm_gswp3_data.esm, and the data-reading test in cdeps_datm_gswp3_synthetic.esm, so these law tests need no data.
- Control
model
cryosphere
cice
CICE sea-ice top-level component (stage 2 of the EqESM project): the cesm3_cice6_6_3_22 ice component as an esm 2.0.0 assembly, per the stage1/boundaries.md 1.3 boundary table. Five systems: IceCap (mounted from ./cice_coupling.esm, the med<->ice cap renames, the med2mod/mod2med areacor scaling, and the merge_fluxes export aggregation of ice_import_export.F90), Thermodynamics (./cice_thermodynamics.esm, the BL99 column physics: prep_radiation shortwave/albedo, step_therm1 vertical conduction and surface energy balance, step_therm2 growth/melt/ponds and the ocean heat/fresh/salt fluxes), Dynamics (./cice_dynamics.esm, the EVP momentum balance and stress relaxation of step_dyn_horiz), Transport (./cice_transport.esm, the per-category conservative advection of the area/volume/enthalpy/Tsfc states as a centered B-grid flux divergence -- the continuous flux form of the conservation law CICE integrates with incremental remapping, not the remap scheme itself), and the inline Control model, which is the ice_step orchestration (CICE_RunMod.F90:109-369 via ice_step_mod.F90) written as algebraic rate rules over one coupling period: the subcycling dt_dyn = dt/ndtd of the dynamics loop (CICE_RunMod.F90:271-281, ice_calendar dt_dyn), and the atmosphere boundary layer of the constant scheme (atmo_boundary_const, icepack_atmo.F90:398-496): wind = sqrt(uatm^2 + vatm^2) (prepare_forcing, ice_forcing.F90:1796), tau = rhoa*0.0012*wind with the components strairx = tau*uatm, strairy = tau*vatm (F90:460-464), shcoef = senscoef*cp_air*rhoa*wind (F90:493) and lhcoef = latncoef*Lsub*rhoa*wind (F90:494, Lheat = Lsub for ice F90:472-476). The coupling array wires the data flow with variable_map param_to_var entries in the ice_step order: the cap state fields (potT, Qa, rhoa, the four shortwave bands, flw, sst, sss, frzmlt, frain, fsnow, uocn, vocn, ss_tltx, ss_tlty) into Thermodynamics and Dynamics; the transport-owned mass states aicen/vicen/vsnon into Thermodynamics, Dynamics, and the cap aggregation; (the thermodynamics -> transport enthalpy hand-off, state_to_tracers, is an operator-splitting step the single-period assembly does not wire: Transport carries its own enthalpy-product states vqicen/vsqsnon); the dynamics-owned velocity uvel/vvel into Transport and the full ocean stress taux/tauy into the cap's Fioi_taux/tauy sign flip and the thermodynamics' ustar; and the per-category thermodynamics fluxes and albedos into the cap's export aggregation. Deferred to stage 3 (documented in the subcomponent descriptions and README.md): the Tsfc implicit surface-energy-balance solve (carried as a free parameter), the incremental-remap discretization of the transport PDEs (the lowered transport is a centered flux divergence without CICE's positivity/monotonicity guarantees), the ridge redistribution (the kstrength = 1 Rothrock strength itself is evaluated in Dynamics) and the kdyn/ktherm alternates, the similarity atmbndy scheme, the per-band Fioi_swpen_* fields, and the wave/aerosol/isotope exports. The shape-mismatched variable_map edges (3x5 dynamics/transport to the single-cell Thermodynamics/IceCap) carry faq full-map broadcast and single-cell select transforms (index of the traced cell (2,2) = global (3,5) inside a faq over ncat; the native compiler requires the full-rank index form), and the tests block pins the coupled assembly at the step-1 export-time state (17 assertions: the export-state chain through the coupling, the constant-scheme Control chain, and the broadcast ocean/tilt stress). The whole-coupling-period trace over [0, 3600] from the cold start remains a stage-3 concern. See README.md 'Testing'. Reference: stage1/cesm/components/cice/src/cicecore/drivers/nuopc/cmeps/.
- Control
model
environmental_transport
mosart
MOSART river-routing top-level component (stage 2 of the EqESM project): the cesm3.0-alphabranch mosart1.1.13 rof component as an esm 2.0.0 assembly, per the stage1/boundaries.md 1.5 boundary table and 2.6 subassembly mapping. Five systems: RofCap (mounted from ./mosart_coupling.esm, the med<->rof cap unit conversions), Hillslope (./mosart_hillslope.esm), Subnetwork (./mosart_subnetwork.esm), Channel (./mosart_channel.esm) - the Euler cascade of mosart_physics.F90 (hillslope -> subnetwork -> main channel, with the shared pointwise laws in ./mosart_templates.esm) - and the inline Control model, which is mosart_run (mosart_driver.F90:375-873) steps 2-8 written as algebraic rate rules over one coupling period: the irrigation withdrawal qirrig_actual = -min(-qirrig*coupling_period, wr)/coupling_period, removed from the channel storage through Channel.qirrig (the Fortran's wr -= irrig_volume, F90:497), with the overage returned to qsub (F90:476-500), the flood rule flood = (volr - fthresh)/delt_coupling for mask==1 cells with volr = wt + wr + wh*area (F90:509-531, 854), the direct-transfer rules (frozen runoff, glc runoff, the qgwl_runoff_option all/negative/threshold branches, negative qsur/qsub, mask==0 cells; F90:533-772), the subcycling nsub = ceil(coupling_period/delt_mosart) with delt = delt_coupling/nsub (F90:786-800), the CFL sub-timesteps phi_r/phi_t and the integer numDT_r/numDT_t of set_subtimesteps with its mask/rlen/tlen guards and integer truncation (mosart_tspatialunit_type.F90:624-684; Control is also the single source of the cell geometry - area, frac, rlen, rwidth, rdepth, areaTotal2, rslpsqrt, tlen, twidth, tslpsqrt - which the coupling library wires into the routing systems, so the CFL and the routing see the same cell), the flow/runoff aggregation runofftot = direct + runoffocn + direct_glc with the mask==1/mask>=2 split (F90:844-867), and the ice_runoff branch of the rof_import_export export_fields (F90:362-382). The data flow is wired by the 43 variable_map param_to_var coupling edges of the mosart_routing_coupling.esm coupling library (esm-spec 10.9-10.10), imported by reference below and expanded at flatten in the Euler order; the one network operation not yet wired is the rh_eroutUp upstream gather (erout of each cell mapped to the downstream cell's eroutUp, F90:158) and the rh_direct outlet gather - they are per-cell parameters (Channel.eroutUp, Control.direct_*) until the frivinp network data source lands (boundaries.md 2.4). The routing steps are written as continuous storage ODEs. They are NOT the continuous limit of the Fortran scheme: the Fortran advances storage with forward Euler at fixed 3600-s substeps (subcycled by DLevelH2R*numDT in the subnetwork and channel) and applies its dry-cell clamps per Euler step, so the .esm's ifelse clamps evaluated continuously, and the hillslope outflow reaching the subnetwork as a smooth ramp, give a structurally different intra-step trajectory and wt/wr split, while conserving the same total water (see README.md). The once-per-coupling-period irrigation storage jump (wr -= irrig_volume, F90:497) is a rate rule here, as is the flood subtraction from qsur. All fields use the standard CESM/CMEPS names; units are SI except the CMEPS surface fluxes (kg/m^2/s = mm/s). The Control tests block holds: the one-coupling-period assembly trace from the cold start of cell 100312 of the EqESM instrumented-CESM dry window (stage1/dumps/mosart/, mosart_run_imports.csv / mosart_run_exports.csv / mosart_run_imports_wide.csv), pinning the mass-conserved volr, the hillslope fill wh, the CFL/subcycling diagnostics with the cell's real geometry (areaTotal2 from the frivinp dnID network) and the zero branches, with the wt/wr split documented rather than asserted; two wet-window coupling tests (stage1/dumps/mosart_wet/: the positive-qgwl import path with numDT_r = 7, and the negative-qgwl direct transfer); and two hand-derived irrigation tests (the dumps carry no irrigation demand) that check the withdrawal leaves the channel storage and the overage goes to the subsurface stream, plus the set_subtimesteps rlen = tlen = 0 guards (see README.md Testing). Reference: stage1/cesm/components/mosart/src/riverroute/mosart_driver.F90 and mosart_physics.F90 (mosart1.1.13).
- Dynamics
model
cryosphere
cice
CICE sea-ice dynamics (stage 2 of the EqESM project): the B-grid momentum balance and the classic-EVP stress evolution of the default kdyn = 1 (EVP) configuration of cesm3_cice6_6_3_22, lowered onto the traced 3x5 subdomain (N_I = 3 T cells along x, N_J = 5 along y) of the stage-1 dump with the EarthSciDiscretizations CICE B-grid rules (grids/cice_bgrid): strain_rates_divu/tension/shear lower D(uvel,x)+D(vvel,y), D(uvel,x)-D(vvel,y), D(uvel,y)+D(vvel,x) to the four-corner (NE/NW/SW/SE) staggered strain-rate combinations of strain_rates (ice_dyn_shared.F90:2094-2175), and stress_divergence_strintx/strinty lower D(sigma11,x)+D(sigma12,y) and D(sigma12,x)+D(sigma22,y) to the B-grid stress integrals strintx/strinty = uarear*(str1 - str2 + str3 - str4) of stepu (ice_dyn_evp.F90:1698-1765, 958-961). The Fortran integrates the momentum equation in stepu (ice_dyn_shared.F90:923-964) inside the ndte = 120 subcycles of evp (ice_dyn_evp.F90:259-1447), solving implicitly with the intermediates vrel = aiX*rhow*Cw*|u_ocn - u| (F90:931-932), taux/tauy = vrel*waterx/y with the cosw/sinw rotation of the ocean velocity (F90:817-818; the default cosw = 1, sinw = 0; the full coupled form is carried here as in dyn_finish, F90:1345-1348), Cb = TbU/(|u| + u0) (F90:937), cca = (brlx + revp)*Umassdti + vrel*cosw + Cb, ccb = fm + sign(1,fm)*vrel*sinw, ab2 = cca^2 + ccb^2, cc1/cc2 (F90:949-956) and the update uvel = (cca*cc1 + ccb*cc2)/ab2, vvel = (cca*cc2 - ccb*cc1)/ab2 (F90:958-959); the model writes the continuous limit m*du/dt = tau_a + tau_tilt + tau_o + div(sigma) - Cb*u + m*f*khat x u instead (the implicit-solve algebra cca/ccb/ab2/cc1/cc2 is solver machinery, documented here rather than transcribed). The stress evolution: the classic-EVP under-relaxed maps stressp_new = (stressp*(1-arlx1i*revp) + arlx1i*(zetax2*divu - rep_prs))*denom1 etc. (stress, ice_dyn_evp.F90:1584-1609) with arlx = 2*elasticDamp*ndte, arlx1i = 1/arlx, brlx = ndte, denom1 = 1/(1+arlx1i) for revised_evp = .false. (set_evp_parameters, ice_dyn_shared.F90:451-484), which relax toward the plastic targets zetax2*divu - rep_prs, etax2*tension, 0.5*etax2*shear with the subcycle time step dt/ndte, i.e. the continuous relaxation d(sigma)/dt = (sigma_target - sigma)/Td with Td = 2*elasticDamp*dt (elasticDamp = 0.36 default); here the four-corner staggered stresses stressp_1..4 of the Fortran are carried per corner on the corner axis, and the stressp/stressm/stress12 unknowns ARE the four-corner fields of the dump (newp/newm/new12 ksub1), so no corner collapse is needed. The strain rates of strain_rates are area-weighted (the Fortran comment 'NOTE these are actually strain rates * area (m^2/s)', F90:2119-2120), so divu/tension/shear/Delta carry units m^2/s and the viscosities zetax2 = (1+Ktens)*tmpcalc, etax2 = epp2i*zetax2 with tmpcalc = capping*strength/max(Delta, DminArea) + (1-capping)*strength/(Delta + DminArea) (visc_replpress, ice_dyn_shared.F90:2467-2471, DminArea = DminTarea = deltaminEVP*dxT*dyT) carry kg/(m^2 s); rep_prs = (1-Ktens)*tmpcalc*Delta (F90:2470) is N/m. The ice strength P is the run's kstrength = 1 Rothrock (1975) potential-energy form (icepack_ice_strength, icepack_mechred.F90:1660-1712, with the D-class krdg_partic = krdg_redist = 1 and mu_rdg = 4): the open-water fraction aice0 = 1 - aice, the cumulative distribution Gsum and its normalization (ridge_itd, F90:848-889), the exponential participation functions apartic(0..ncat) (F90:919-934), the exponential redistribution hrmin/hrexp/krdg (F90:1004-1010), aksum (F90:1031-1036) and strength = Cf*Cp*sum_n(apartic*dh2rdg)/aksum (F90:1697-1710), evaluated per T cell from the transported aicen/vicen and pinned against cice_ice_strength.csv at all 15 traced cells (rel 1e-12); the ridge redistribution itself (ridge_shift of area/volume/enthalpy between categories) remains outside this model. The ocean-ice stress magnitude uses the dump's aiX = 1 - exp(-Cb_ocn*(1-aice)) (the cap's aice_init-based concentration, ice_dyn_shared.F90:928-930; aiX is a dump parameter here, NOT derived from aicen -- the 4-cell U-point average misses up to 2.6e-3 of the cap value, see README.md). The coupled momentum + stress ODEs are integrated over one EVP subcycle (dte = 30 s) in the test cice_dynamics_evp_subcycle_integrated, with strairx/strairy recovered from the momentum dump's forcex/forcey, and the interior stresses asserted against the dumped subcycle update with per-assertion tolerances of 0.6x the dumped increment (scheme-difference tolerances: the model's continuous momentum ODE is not the Fortran's semi-implicit pseudo-time stepu, so the velocities are not asserted; the cap test cice_coupling.esm pins the stepu partials vrel*waterx/y). Import contract: the model declares the N_I/N_J/NCAT metaparameters and i/j/corner/ncat index sets locally (the esm CLI 0.4.0/0.6.0 rejects faq-range metaparameter references when a template library is imported with bindings -- RangeSpec round-trip parse bug of the esm CLI), and imports the five B-grid lowering rules by reference from the EarthSciDiscretizations library (${ESD_ROOT} must be set to that repo's checkout when running the tests). The free-name contract of grid.esm: the model supplies dxT, dyT, cxp, cyp, cxm, cym, dxhy, dyhx, HTE, HTN, uarear as its own [i,j] parameters (the pin test overrides them from the dump; the metric derivations and their F90:413-437, 682-703 citations live in grids/cice_bgrid/grid.esm).
- Hillslope
model
environmental_transport
mosart
MOSART hillslope routing step (stage 2 of the EqESM project): the per-cell Euler step 1 of mosart_physics.F90:Euler (F90:74-80) composed of hillslopeRouting (F90:225-239) and updateState_hillslope (F90:352-360), written as a storage ODE with the pointwise laws imported from ./mosart_templates.esm. Equations, exactly as in the Fortran: ehout_manning = -CREHT_nosqrt(hslpsqrt, nh, Gxr, yh) (F90:232); the dry-cell clamp replaces ehout by -(qsur + wh/delt) when ehout < 0 and wh + (qsur + ehout)*delt < TINYVALUE (F90:233-236); dwh = qsur + ehout (F90:237); d(wh)/dt = dwh (the Fortran advances wh += dwh*DeltaT explicitly once per substep, F90:77; here a continuous ODE, not the limit of that scheme - see README.md, 'Continuous ODEs vs the Fortran 3600-s Euler stepping'); yh = wh (updateState_hillslope, F90:358); and the lateral inflow to the subnetwork etin = (-ehout + qsub)*area*frac (F90:79). Units per mosart_tstatusflux_type.F90 / mosart_tspatialunit_type.F90: wh, yh [m]; dwh, qsur, qsub, ehout [m/s]; etin [m3/s]; hslpsqrt [1]; Gxr [1/m]; area [m2]; frac [1]; nh is the hillslope Manning roughness (SI dimension s/m^(1/3), see mosart_templates.esm); delt is Tctl%DeltaT = delt_coupling/nsub (mosart_driver.F90:800). The qsur/qsub forcing arrives from the cap in m/s (mosart_driver.F90:806-813 converts the m3/s streams by /area). The tests block pins the overland law CREHT_nosqrt pointwise (instantaneous D-boundary tests, time_span {0,0}) and the one-substep storage traces in the continuous-ODE form, with numeric tuples from the EqESM instrumented-CESM dumps (stage1/dumps/mosart/ dry lane window: creht_nosqrt.csv, mosart_euler.csv, area from mosart_run_imports_wide.csv; stage1/dumps/mosart_wet/ wet window: the wet_overland_* pins); the trace assertions carry the measured Euler-vs-continuous scheme gaps (see README.md (Testing)). Reference: stage1/cesm/components/mosart/src/riverroute/mosart_physics.F90 (mosart1.1.13).
- IceCap
model
cryosphere
cice
CICE cap-boundary component (stage 2 of the EqESM project): the med<->ice field conversions and the export aggregation of ice_import_export.F90 (cesm3_cice6_6_3_22, cicecore/drivers/nuopc/cmeps/) as algebraic equations, per the stage1/boundaries.md 1.3 boundary table. Imports (med -> ice), exactly ice_import (F90:414-700): the ocean state So_t -> sst, So_s -> sss, So_u/So_v -> uocn/vocn, So_dhdx/So_dhdy -> ss_tltx/ss_tlty (F90:477-482, 610-624); the atmosphere state Sa_z -> zlvl, Sa_tbot -> Tair, Sa_shum -> Qa, Sa_u/Sa_v -> uatm/vatm (F90:487-501, 606-608); the potential-temperature branch Sa_ptem -> potT and Sa_dens -> rhoa when both are present, else the Sa_pbot branch potT = Tair*(100000/pbot)^0.286 and rhoa = pbot/(287.058*(1+0.608*Qa)*Tair) with the Fortran's zero/1.2 fallbacks (F90:503-515, 655-681); the flux imports Fioo_q -> frzmlt, Faxa_swvdr/swndr/swvdf/swndf -> swvdr/swidr/swvdf/swidf, Faxa_lwdn -> flw, Faxa_rain -> frain, Faxa_snow -> fsnow, each multiplied by med2mod_areacor (F90:529-575; frain stays kg/m2/s - the melt-pond volume change divides the water equivalent by rhofresh inside the pond law, icepack_meltpond_lvl.F90:158-160, and the ocean rain drain adds frain*aice, icepack_therm_itd.F90:2179). Exports (ice -> med), exactly ice_export (F90:1030-1317) and the merge_fluxes aggregation of icepack_flux.F90:180-260: the ice-fraction scaling ailohi = min(aice, 1) (F90:949) and the state fields Si_ifrac, Si_t = Tffresh + sum_n(Tsfc*aicen)/ailohi (F90:950-951; the trcr(:,nt_Tsfc) aggregate of icepack_aggregate), the merge_fluxes aggregations that scale_fluxes divides by the ice area aice (ice_flux.F90:1565-1592, so the coupled fields are per unit ice area) include Si_avsdr/anidr/avsdf/anidf = [sum_n(albedo*aicen)]/aice (the coupling_prep albedo aggregation, CICE_RunMod.F90:549-582; direct = diffuse under the ccsm3 shortwave scheme, icepack_shortwave.F90:568-572), Si_vice = sum_n vicen, Si_vsno = sum_n vsnon, Si_snowh = vsno/ailohi for ailohi > 0 (F90:1121-1129); the air-ice fluxes Faii_taux/tauy = strairxT/strairyT (the T-point atmo stress of the constant boundary-layer scheme, F90:962-964), Faii_lat/sen = [sum_n(flatn/fsensn*aicen)]/aice (icepack_flux.F90:204-206), Faii_lwup = [sum_n((flwoutn-(1-emissivity)*flw)*aicen)]/aice with the outgoing-longwave fix -stefan_boltzmann*(Tf+Tffresh)^4/ailohi where flwout > -puny (F90:213-215, 1149-1164), Faii_evap = [sum_n(evapn*aicen)]/aice, Faii_swnet = [sum_n(swabs*aicen)]/aice; and the ice-ocean fluxes Fioi_swpen = [sum_n(fswthru*aicen)]/aice (F90:247), Fioi_melth = [sum_n(fhocnn*aicen)]/aice, Fioi_meltw = [sum_n(freshn*aicen)]/aice, Fioi_salt = [sum_n(fsaltn*aicen)]/aice, Fioi_taux/tauy = -strocnxT/strocnyT (F90:966-968, the sign flip of the ice-into-ocean stress convention). All Faii_*/Fioi_* exports carry mod2med_areacor (state_setexport areacor, F90:1051-1317); the Si_* state exports do not. The wave (Si_thick, Si_floediam), aerosol (Fioi_bcpho/bcphi, Fioi_flxdst), isotope (Fioi_meltw_wiso, Faii_evap_wiso, Si_qref_wiso), and per-band penetration (Fioi_swpen_vdr/vdf/idr/idf) exports are deferred and carried as zero parameters; the reference-height exports Si_u10/Si_tref/Si_qref come from the transcribed similarity scheme (atmo_boundary_layer, icepack_atmo.F90:52-389): the atmbndy = 'default' similarity solve under the D-class natmiter = 5 and atmiter_conv = 0 (the do-while of F90:269 always runs 5 updates; unrolled here) with highfreq = .true. relative wind, and the merge_fluxes aicen_init weighting (icepack_flux.F90:180-260) divided by the post-thermo ice area in scale_fluxes (ice_flux.F90:1565-1592), so Si_tref = sum_n(Trefn*aicen_init)/sum_n(aicen) and likewise for Si_qref and Si_u10. The Rothrock ice strength (icepack_mechred.F90:1660-1712, kstrength = 1) is carried here as an algebraic probe of the dynamics physics, and the dynamics pointwise laws (the EVP stress maps, the strain invariant, the viscosities/replacement pressure, and the stepu ocean-ice stress) are carried here as dump-pinned probes as well, since the dynamics skeleton tests cannot compile on the single-cell geometry; the D-class ridge settings are krdg_partic = 1, krdg_redist = 1, mu_rdg = 4. The POP-grid rotation of tauxa/tauya/tauxo/tauyo (ANGLET, F90:962-968) and the tmask ocean-mask guards collapse to the identity on the single-cell skeleton and are documented in the descriptions. The Tf ocean freezing temperature is the import-side shr_frz_freezetemp law (share/shr_frz_mod.F90.in:94-105, the Assur-1958 liquidus clamped to >= -2 C; bugs.md #6) via the shared sea_freezing_temperature template. The tests block pins the imports, the freezing-temperature law, and the export aggregation (including the scale_fluxes /aice division) against the stage-1 dumps (stage1/dumps/cice/); see the test descriptions and README.md. Reference: stage1/cesm/components/cice/src/cicecore/drivers/nuopc/cmeps/ice_import_export.F90.
- RofCap
model
environmental_transport
mosart
MOSART cap-boundary component (stage 2 of the EqESM project): the med<->rof field conversions of rof_comp_nuopc/rof_import_export.F90 (mosart1.1.13) as algebraic equations, per the stage1/boundaries.md 1.5 boundary table. Imports (med -> rof): Flrl_rofsur, Flrl_rofsub, Flrl_rofgwl, Flrl_rofi, Flrl_irrig (lnd runoff, CMEPS kg/m^2/s which for water equals mm/s), and Fgrg_rofl, Fgrg_rofi (glc runoff, active when rof_from_glc). Exports (rof -> med): Forr_rofl, Forr_rofi, Forr_rofl_glc, Forr_rofi_glc, Flrr_flood, Flrr_volr, Flrr_volrmch, Sr_tdepth, Sr_tdepth_max. Import conversion, exactly state_getimport (rof_import_export.F90:589-595): q [m3/s] = field [mm/s] * med2mod_areacor * area [m2] * 0.001 [m/mm], where med2mod_areacor is the mesh-area correction factor (F90:209-210, ~1 for the rof mesh on the model grid) and 0.001 is spelled as the parameter mm_to_m [m/mm] for dimensional honesty. Export conversion, exactly state_setexport (F90:636-643): field [mm/s] = q [m3/s] * mod2med_areacor / (area [m2] * 0.001 [m/mm]); Flrr_flood carries the sign flip flood = -ctl%flood/(area*0.001) (F90:395, the land->rof positive convention); Flrr_volr = volr/area and Flrr_volrmch = wr/area are depths [m] with no mm scaling (F90:396-397); Sr_tdepth/Sr_tdepth_max are stream depths exported only when flds_r2l_stream_channel_depths (F90:398-402, tdepth_max = max(twidth0,0)*(rdepth/rwidth)). The direct-transfer, irrigation, flood and subcycling orchestration of mosart_run lives in the assembly mosart_routing.esm (its Control model) because the qgwl threshold option and the flood threshold need the channel storage wr; this file keeps the pure unit conversions, per the boundaries.md 2.6 mapping (cap boundary row). The tests block pins the med<->rof import/export unit conversions pointwise (instantaneous tests, time_span {0,0}) from the step-1 boundary values of cell 100312 (EqESM instrumented-CESM dumps stage1/dumps/mosart/mosart_run_imports.csv, mosart_run_exports.csv, and the area/areacor columns of mosart_run_imports_wide.csv); see README.md (Testing). Reference: stage1/cesm/components/mosart/src/cpl/nuopc/rof_import_export.F90 (mosart1.1.13).
- Shortwave
model
cryosphere
cice
CICE delta-Eddington shortwave radiation (stage 2 of the EqESM project): compute_dEdd_3bd (icepack_shortwave.F90:1703-3013) and its per-layer solver solution_dEdd (F90:3022-3488), the 3-band radiation scheme of the CICE sea-ice column. The model is a transcription of the Fortran law: the dzk/frsnw layer geometry (F90:2132-2156, 2122-2125); the snow IOP interpolation against the SNICAR grain-radius tables (F90:2396-2424, icepack_shortwave_data.F90:116-232) and the snow mass extinction ks (F90:2422-2425); the per-layer tau/w0/g assembly over the snow-cover, bare-ice and pond branches including the bulk aerosol mixing (F90:2425-2547, 2562-2717, 2549-2557); the per-band ocean albedo (F90:2772-2775); the delta-Eddington layer solution with the 8-point Gauss-Legendre angular integration of the diffuse reflectivity/transmissivity and the fresnel (refraction) layer at the base of the surface scattering layer (solution_dEdd F90:3296-3406); the downward and upward layer-combination recurrences with the trmin activity cutoff (F90:3287, 3408-3466); the interface flux fractions dfdir/dfdif (F90:2804-2832); and the band-weighted accumulations avdr/avdf/aidr/aidf, fsfc/fint/fthru, the visible/NIR transmitted fluxes and the Sabs/Iabs/fthrul layer absorptions (F90:2834-2960). The surface type srftyp (0 = air/bare ice, 1 = snow, 2 = pond) is a scalar parameter; the pond branch is transcribed but untested (the instrumented run contains no pond rows - see README-cice-shortwave.md). The 8-point Gauss diffuse reflectivity is written as an explicit sum over the 8 abscissas rather than an esm integral: no ESD quadrature rule exists for a bare mu axis (integral reaches evaluation only when an EarthSciDiscretizations rewrite rule lowers it; probed on this branch). The Fortran's trmin guard skips the layer solution below the cutoff; here the full solution is computed and the outputs are masked with the same condition, which reproduces the Fortran bit-for-bit (the guard condition is a property of the full solution). All laws are imported by reference from ./cice_templates.esm; the numeric tuples are extracted from the stage-1 instrumentation dump stage1/dumps/cice/cice_dedd.csv by stage1/analysis/gen_cice_dedd_tests.py.
- SoilFluxes
model
land_surface
clm
CTSM/CLM ground energy and moisture flux update SoilFluxes, transcribed from src/biogeophys/SoilFluxesMod.F90 of CTSM ctsm5.4.063 (cesm3.0-alphabranch; line numbers refer to that tag): the previous-time-step ground temperature and T^4 blend t_grnd0/lw_grnd (SoilFluxesMod.F90:175-183, :344-346), the sensible/latent flux corrections to the present soil temperature (:192-204), the liquid/solid partition of the ground evaporation into liquid evaporation, sublimation, liquid dew and solid dew (:208-274), the snow-evaporation moisture limit of the top layer (:276-297), the ground heat flux from absorbed shortwave, canopy longwave and black-body emission (:341-371), the total vegetation+ground fluxes and the history-tape latent heat breakdown (:373-394), the outgoing/net longwave radiation with the temperature-increment term and the bare-ground skin temperature (:451-495). The equations are written as math over the patch index set (the traced reference-dump rows carry p == c, so the column-level quantities of the Fortran are replicated patch-wise); the shared laws are imported by reference from ./clm_templates.esm (ground_temperature_blend, stefan_boltzmann_emission, flux_temperature_correction, stefan_boltzmann_emission_dT). All fluxes are mass fluxes in kg/m^2/s (= mm/s of water): the esm unit system requires the mass-flux form for dimensional consistency with the latent-heat multiplications (qflx*htvp [J/kg] = W/m^2), see README.md. The tests pin the reference dumps: a CESM3 / CTSM ctsm5.4.063 I2000Clm60Sp land-only run (GSWP3 forcing, dtime = 1800 s) instrumented with write statements at the SoilFluxes, BareGroundFluxes, SoilTemperature, ComputeGroundHeatFluxAndDeriv, SurfaceRadiation and BiogeophysPreFluxCalcs exits, recording the first 16 bare, deep-snowpack columns over the first 12 steps in full double precision; forc_lwrad is the downscaled column longwave recorded at ComputeGroundHeatFluxAndDeriv. Tested regime: all 192 dumped rows are dew rows (qflx_ev_snow < 0) below freezing (t_grnd < tfrz, so the dew is solid) with an all-snow blend (snl = -9, frac_sno_fluxes = 1, frac_h2osfc = 0, frac_veg_nosno = 0); the evaporation branch of the partition, the firing snow-evaporation limit, liquid dew, mixed snow/soil blends and snow-free columns are transcribed but not exercised, because the reference run has no such rows. The assertions on quantities that are not dump columns (lw_grnd, qflx_ev_snow, qflx_ev_soil, evaporation_limit, qflx_soliddew_to_top_layer, lwrad_emission, lwrad_increment, eflx_lwrad_out, qflx_evap_tot) are labelled derived (not a dump column) and computed offline (double-precision evaluation of the transcribed equations at the pinned dump inputs), cross-checked against every dump column they touch on all 192 rows (max rel err 7.9e-15).
- SoilTemperature
model
land_surface
clm
CTSM/CLM snow/soil temperature, single-time-step form. SCOPE AND VALIDITY (read first): this model reproduces ONE CLM soil-temperature time step from a supplied entry state; it is not a free-running soil-temperature model and must not be integrated over multiple steps on its own. (a) The thermal properties thk, cv and K are computed from the parameter t_entry (the start-of-step temperatures, as SoilThermProp does once per CLM step), not from the evolving state T. (b) The top boundary flux kdudz_top = hs + dhsdT*(T[NLEV] - t_entry[NLEV]) is linearized about t_entry, with hs, dhsdT, sabg and eflx_bot supplied as parameters for that step. (c) The column structure is fixed: the snow-layer count by the metaparameter N_SNOW_MAX = 9 (snl = -9) and the bedrock index by nbedrock = 20; there is no phase change, no snow-layer combination/division and no change of layer water content. It is valid for evaluating the instantaneous tendency cv*dT/dt = F(T) and the Crank-Nicolson identity of a single dtime = 1800 s step (every test uses time_span {0, 0}); integrated past one step it does not reproduce CLM (the properties and surface linearization go stale, and CLM's top row is fully implicit, see README.md). A multi-step use requires recomputing t_entry, hs, dhsdT and sabg every step from a coupled surface energy balance, which is not provided here. The SoilTemperature model of src/biogeophys/SoilTemperatureMod.F90 (CTSM ctsm5.4.063, cesm3.0-alphabranch; line numbers refer to that tag), as the heat-conduction PDE cv*dT/dt = dz*D(K*D(T,lev),lev) + sabg on the column_nonuniform_1d grid, pinned against the reference dumps: a CESM3 / CTSM ctsm5.4.063 I2000Clm60Sp land-only run (GSWP3 forcing, dtime = 1800 s) instrumented with write statements before SoilThermProp and after the band-diagonal solve, recording every layer of the first 16 bare columns over the first 12 steps in full double precision (column 1, ctype 1 soil, snl = -9, 34 layers; the tests pin column 1 at step 1). The state T is the layer temperature; the SoilThermProp thermal-property laws (F90:604-903) consume the entry state t_entry, as in CLM (SoilThermProp runs at the start of the step): per layer, the snow bulk density bw (:744), the Sturm1997 snow thermal conductivity (:774-778; the traced run's snow_thermal_cond_method; the five coefficients lack _r8 in the Fortran and execute as float32-rounded values (a CTSM defect at SoilTemperatureMod.F90:775,777), reproduced here to rel 1.6e-16), the snow heat capacity with the thin-layer floor (:892-895), the Johansen (1975) soil thermal conductivity (:712-727; saturation water content :712-713, Kersten number :715-719, liquid fraction :720-721, saturated conductivity :722, bedrock override :727), the de Vries (1963) soil heat capacity (:852-854) with the bedrock override (:854), and the harmonic-mean interface conductivity tk with the zero bottom boundary (:825-828). The interface conductivity array K (lev_nodes) is the faq of clm_interface_conductivity over the face index set (K[1] = 0 bottom, K[NLEV+1] = 0 dummy above the top layer). The divergence D(K*D(T,lev),lev) is lowered by the local rule clm_soiltemp_discretization.esm (priority 11, a CLM-specific rule kept local to this component): interior rows (G[k+1]-G[k])/dz[k], bottom row (G[2]-kdudz_bot)/dz[1], and the top row (kdudz_top - G[NLEV])/M with the capr-weighted measure M = 0.5*(ze[NLEV+1]-zc[NLEV] + capr*(ze[NLEV+1]-zc[NLEV-1])) of F90:1895, kdudz_top = hs + dhsdT*(T[NLEV]-t_entry[NLEV]) the linearized surface flux (ComputeGroundHeatFluxAndDeriv :1545-1798) and kdudz_bot = eflx_bot. The layer index set is the ESD bottom-up column (lev = 26 - j: lev 1 = j = 25 deepest soil, lev 34 = j = -8 top snow; snow j = -8..0, soil j = 1..25). The model is pinned three ways: (1) at the entry state T = t_entry, K, cv, the entry-state interface flux fn_esd = -G (the dumped fn column is exactly -G(t_entry), verified to 1e-13) and the instantaneous dT/dt of the PDE; (2) at the exit state T = t_exit, the instantaneous dT/dt and kdudz_top; (3) the derived Crank-Nicolson identity 0.5*(F(t_entry)+F(t_exit)) = cv*dT/dt (F = dz*D(K*D(u,lev),lev) + sabg), which holds for the interior and bottom rows (lev 1..33) to solver round-off (max |resid| = 6.3e-10 W/m2, computed offline in double precision from the dump before pinning); the top row deviates by the fully-implicit dhsdT term of SetMatrix_Snow and is not pinned (see README.md). The dumped values are reproduced to the dump's full double precision (rel 1e-12). Coverage gaps of the traced dump, each with its reason: imelt = 0 on every row (no phase change in the 12 traced steps), so the Phasechange laws are not exercised; snow_thermal_cond_method = 'Sturm1997' only (the Jordan1991 template exists but is untested); frac_sno_fluxes = 1 exactly; excess_ice = 0 and h2osoi_liq = 0 in the snow layers (the excess-ice and snow-liquid terms never bind); h2osno_no_layers = 0 (the cv(c,1) += cpice*h2osno_no_layers addition of F90:880-882 is not exercised); the top snow layer's absorbed solar (sabg = 57.79 W/m2 in the dump) is inside hs_top_snow (ComputeGroundHeatFluxAndDeriv :1779-1783 adds no sabg to the top row), so the model's sabg parameter carries 0 at the top layer; eflx_bot = 0 in the dump (the sign convention of the F90 comment, +upward, vs the fn slot, +downward, is unpinned; see README.md); the top-layer dumped dz (0.015578352833079012) differs from the grid spacing ze[NLEV+1]-ze[NLEV] (0.015517897173545236): in CTSM the top snow layer's (z, dz) is inconsistent with its zi interfaces (suspected in DivideSnowLayers/AddNewSnow), so dz stays a dumped parameter.
- Streams
model
data_models
cdeps
The CDEPS DATM data-atmosphere laws for the GSWP3v1 forcing with the CLMNCEP datamode (cdeps1.0.112), with no data access: (1) Streams - the stream layer of shr_strdata_advance for the four GSWP3 streams, with the time-interpolation factors computed from the model time t (coszen for Solar: cosz/tavCosz from the shr_orb_decl declination and the modeldt-sampled interval average, 0 at night; nearest for Precip; linear for TPQW; lower for the static topo), each 3-hourly field entering as its bracketing record pair [LB, UB] over the record axis rec (esm-spec 8.5.1); (2) Clmncep - the datamode transformation from the interpolated stream values to the export state Sa_* / Faxa_*. The shared pointwise laws are imported from ./cdeps_templates.esm. The tests pin CDEPS instrumentation dumps of a reference CESM I2000Clm60Sp_f19 run (cdeps_strdata_streams.csv for Streams, datm_gswp3_streams.csv + datm_gswp3_exports.csv for Clmncep; all traced points are at lat -90 on 2000-01-01, so polar day and all snow), plus closed-form recomputations for the branches no traced row reaches (README). The GSWP3 data sources and the reader -> Streams -> Clmncep wiring live in cdeps_datm_gswp3_data.esm, and the data-reading test in cdeps_datm_gswp3_synthetic.esm, so these law tests need no data.
- Subnetwork
model
environmental_transport
mosart
MOSART subnetwork (tributary) routing step (stage 2 of the EqESM project): the per-cell Euler step 2 of mosart_physics.F90:Euler (F90:114-132) composed of subnetworkRouting (F90:243-269) and updateState_subnetwork (F90:364-381), written as a storage ODE with the pointwise laws imported from ./mosart_templates.esm. Equations, exactly as in the Fortran: with no tributaries (tlen <= hlen) the subnetwork passes the inflow straight through, etout = -etin (F90:250-252); otherwise the Manning velocity vt = CRVRMAN_nosqrt(tslpsqrt, nt, rt) (F90:253) and etout = -vt*mt (F90:254), with the dry-cell clamp etout = -(etin + wt/localdelt) when wt + (etin + etout)*localdelt < TINYVALUE (F90:255-260), in which case vt = -etout/mt when mt > 0 (F90:257-259); dwt = etin + etout (F90:262); d(wt)/dt = dwt (the Fortran advances wt += dwt*localdelt explicitly per substep, F90:123; here a continuous ODE, not the limit of that scheme - see README.md, 'Continuous ODEs vs the Fortran 3600-s Euler stepping'); updateState_subnetwork (F90:370-380) sets mt = GRMR(wt, tlen), yt = GRHT(mt, twidth), pt = GRPT(yt, twidth), rt = GRRR(mt, pt) when tlen > 0 and wt > 0, and zeroes all four otherwise; and the lateral outflow to the main channel erlateral = -etout (the instantaneous value of the Fortran's per-substep accumulation and numDT_t average, F90:125-127). Units per mosart_tstatusflux_type.F90 / mosart_tspatialunit_type.F90: wt [m3]; etin, etout, dwt, erlateral [m3/s]; vt [m/s]; mt [m2]; yt, rt, pt [m]; tslpsqrt [1]; tlen, hlen, twidth [m]; nt is the subnetwork Manning roughness (SI dimension s/m^(1/3)); localdelt = Tctl%DeltaT/DLevelH2R/numDT_t(nr) (F90:120). One deliberate divergence, documented for reviewers: when tlen <= hlen the Fortran leaves vt stale (it is unused in that branch) while here vt always takes the Manning value; and when the dry-cell clamp fires with mt <= 0 the Fortran also leaves vt at the Manning value, which is what the ifelse expresses. The tests block pins the geometry chain GRMR/GRHT/GRPT/GRRR pointwise (instantaneous tests, time_span {0,0}) and the one-substep storage traces in the continuous-ODE form, with numeric tuples from the EqESM instrumented-CESM dumps (stage1/dumps/mosart/ dry lane window: gr_subnet.csv, crvrman_trib.csv, mosart_euler.csv; stage1/dumps/mosart_wet/ wet window: wet_geometry_* and wet_manning_trib_* pins); the trace assertions carry the measured Euler-vs-continuous scheme gaps (see README.md (Testing)). Reference: stage1/cesm/components/mosart/src/riverroute/mosart_physics.F90 (mosart1.1.13).
- Thermodynamics
model
cryosphere
cice
CICE column thermodynamics (stage 2 of the EqESM project): the per-category vertical heat conduction, surface energy balance, and growth/melt closures of the D-class run configuration of cesm3_cice6_6_3_22 (ktherm = 2 mushy, shortwave = 'dEdd', frzpnd = 'hlid' sea-level ponds, nilyr = 8, nslyr = 3, phi_i_mushy = 0.45, hs0 = 0.0, snwredist = 'none', use_smliq_pnd = .false., congel_freeze = 'one-step', saltflux_option = 'constant', tfrz_option = 'mushy', conduct = 'MU71', dpscale = 1e-3, vapor_flux_correction = .false.), written over the ncat thickness categories and the nilyr/nslyr layer axes. The Fortran state is the layer enthalpy (zqin, zqsn; icepack_therm_vertical.F90:1155-1156) with temperatures recovered by icepack_mushy_temperature_mush (icepack_mushy_physics.F90:348-452) for the ice and icepack_enthalpy_snow/temperature_snow (F90:145-179) for the snow; this model carries qicen/qsnon as states and recovers zTin/zTsn through the same laws. Heat conduction: the Fortran assembles and solves an implicit backward-Euler tridiagonal for the surface and layer temperatures (the mushy two-stage solver, icepack_therm_mushy.F90:1800-1985 with the kh conductances F90:1928-2061); this model writes the equivalent energy-conserving semi-discrete (method-of-lines) form d(q_k)/dt = (kh_up*(T_up - T_k) + kh_dn*(T_dn - T_k) + Iswabs_k)/hilyr with the interface conductances kh of the mushy conductance block (F90:1989-2061: kh_top = 2*kslyr/hslyr F90:2042, kh_snowice = 2*kslyr*kilyr(1)/(kslyr*hilyr + kilyr(1)*hslyr) F90:2046-2048, kh_bot = 2*kilyr(nilyr)/hilyr F90:2060, interior harmonic means F90:2052-2054) and the per-layer absorbed shortwave of the dEdd solver (Iswabs/Sswabs, deferred to the delta-Eddington rewrite, carried as parameters), i.e. the continuous PDE rho*cp*dT/dt = d/dz(k dT/dz) + S in enthalpy form; the layer conductivity is the mush law km = phi*(kb - ki) + ki of heat_conductivity (icepack_mushy_physics.F90:476-494; the ktherm = 1 MU71/bubbly laws remain as alternates in cice_templates.esm and are not used here). The surface temperature Tsfc is solved in the Fortran by the implicit surface energy balance fsurfn(Tsfc) - fcondtopn = 0 (the convergence checks fcondtop - fsurfn < ferrmax of the mushy two-stage solver, icepack_therm_mushy.F90:535/588/834/892, with fcondtop = 2*ks(1)*(Tsf - zTsn(1))/hslyr of F90:1674-1680 and the top-melt closure etop_mlt = max((fsurfn - fcondtopn)*dt, 0) of icepack_therm_vertical.F90:1337-1338; the downward-positive fcondtopn enters the surface heat budget as -fcondtopn, so the converged solve has fsurfn = fcondtopn); the balance is transcendental in Tsfc (the saturation-humidity exponential), so the skeleton carries Tsfc as a parameter fed by the coupled solve (stage-3 wiring). Growth/melt closures of thickness_changes (icepack_therm_vertical.F90): the melt enthalpies qmlt = enthalpy_of_melting(zSin) and qm = zqin - qmlt (F90:1283-1287), the congelation enthalpy qbot = qbotm - qbotw with qbotm = enthalpy_mush_liquid_fraction(Tbot, phi_i_mushy) and qbotw = enthalpy_brine(sst) under congel_freeze = 'one-step' (F90:1413-1416), the top/basal melt closures dhi = etop_mlt/qm(1) and ebot_mlt/qm(nilyr) (F90:1565-1581, 1589-1603), the snow/ice sublimation-condensation closures with qsub = zqsn(1) - rhos*Lvap over snow and qm(1) - rhoi*Lvap over ice (F90:1355-1403, 1502-1559), and the ocean heat flux fhocnn = fbot + (esub + etop_mlt + ebot_mlt)/dt + emlt_ocn/dt with emlt_ocn = -(qbotw*congeln + qmlt(1)*(melttn + evapin/rhoi) + qmlt(nilyr)*meltbn) (F90:1419, 1401, 1571, 1595, 1630, 1917; max(zqin, qmlt) = qmlt in the run regime since qm < 0 at melt). Radiation: the dEdd surface laws of icepack_shortwave.F90 - the snow fraction of shortwave_dEdd_set_snow (F90:3448-3454, hs0 = 0.0 so fs in {0,1}), the effective pond area of shortwave_dEdd_set_eff for tr_pond_sealvl (F90:3495-3637), the band albedos alvdrn/alidrn/alvdfn/alidfn (outputs of the deferred compute_dEdd_3bd solve, F90:1677-2936, carried as parameters), the component albedos albicen/albsnon/albpndn of F90:1496-1498 (the band-weighted sums of the awtvdr/awtidr/awtvdf/awtidf weights, icepack_parameters.F90:218-221; exact for the run's fs in {0,1} and apeffn = 0 surface-type masks), and the conservation fswintn = swabs - fswsfc - fswthrun with swabs = sum(sw*(1-al)) and fswthrun = sum of the four band transmissions. Melt ponds: the 'hlid' sea-level scheme of compute_ponds_sealvl (icepack_meltpond_sealvl.F90:50-265) with the Stefan lid growth/melt; dvn carries the per-step dvpondn and the pond tracers apnd/hpnd/ipnd/dhsn/ffracn are carried as parameters fed by the coupling (stage 3), with only the set_eff apeffn law pinned by tests. The surface-flux block (surface_heat_flux, icepack_therm_shared.F90:109-167; frzmlt_bottom_lateral, F90:637-678) is unchanged from the ktherm = 1 skeleton, with the run's emissivity = 0.95 (forcing_nml override, bugs.md #11). The ocean flux laws are the corrected rate forms of F90:510-521: freshn = -(rhoi*(congeln + meltbn + melttn) + rhos*meltsn) and fsaltn = -rhoi*dhi*ice_ref_salinity*0.001 with dhi = congeln + meltbn + melttn + evapin/rhoi (the evapn and new-snowfall terms of freshn = evapn - (rhoi*dhi + rhos*dhs) cancel exactly, F90:510-513, 1641-1672), the per-category snow thickness rate dsnown = fsnow/rhos - meltsn + evapsn/rhos, and the cell-level merged aggregates of icepack_flux.F90:196-257 (aice, fsurf, fcondtop, fhocn, fresh, fsalt, flwout, fsens, flat, evap, fswabs, fswthru, fswint, congel, meltb, meltt, melts, dsnow as sum_n(aicen*xn), with the flwout emissivity correction flwout = sum_n((flwoutn - 0.05*flw)*aicen) of F90:209-211 and the rain drainage fresh = fresh + frain*aice of icepack_therm_itd.F90:2043). The delta-Eddington solver (compute_dEdd_3bd, icepack_shortwave.F90:1677-3389) and the mushy enthalpy/T inversion pinning are deferred; see README.md for the coverage table.
- Transport
model
cryosphere
cice
CICE horizontal transport (stage 2 of the EqESM project): the per-category conservative advection of the area, volume and enthalpy/surface-temperature tracer states of the default configuration of cesm3_cice6_6_3_22, lowered onto the traced 3x5 subdomain (N_I = 3 T cells along x, N_J = 5 along y, global cells (2..4, 4..8) of the stage-1 dump) with the EarthSciDiscretizations CICE B-grid flux-divergence rules (grids/cice_bgrid/rules/transport_flux_divergence.esm and its layered companion transport_flux_divergence_layered.esm). The conservative statement per category n is the continuity system d(aicen)/dt + div(aicen*u) = 0, d(vicen)/dt + div(vicen*u) = 0, d(vsnon)/dt + div(vsnon*u) = 0, plus the tracer-product forms the Fortran conserves (update_fields, ice_transport_remap.F90:3556-3571; tracer types of ice_init.F90:3061-3067): d(aTsfcn)/dt + div(aTsfcn*u) = 0 for the area tracer Tsfcn (trcr_depend = 0), d(vqicen)/dt + div(vqicen*u) = 0 for the volume tracer qicen over the 8 ice layers (trcr_depend = 1, vqicen = vicen*qicen), and d(vsqsnon)/dt + div(vsqsnon*u) = 0 for the snow-volume tracer qsnon over the 3 snow layers (trcr_depend = 2, vsqsnon = vsnon*qsnon). The tracers are recovered by tracer_from_product (cice_templates.esm): Tsfcn = aTsfcn/aicen, qicen_adv = vqicen/vicen, qsnon_adv = vsqsnon/vsnon, floored where the transported mass vanishes exactly as the Fortran's update_fields/tracers_to_state (0 for Tsfc and qice, -rhos*Lfresh for qsno; ice_transport_remap.F90:3631-3658, ice_transport_driver.F90:990-1114). Every divergence is the spatial-D rewrite target D(c*uvel, x) + D(c*vvel, y) (the tracer_flux_divergence template), lowered by the rule to the conservative cell flux divergence (F_e(i,j) - F_e(i-1,j) + F_n(i,j) - F_n(i,j-1))/tarea of the Fortran's mass update (ice_transport_remap.F90:3586-3590) with the CENTERED face reconstruction F_e = HTE*((uS+uN)/2)*((cL+cR)/2), F_n = HTN*((vW+vE)/2)*((cS+cN)/2); the layered rule applies the same stencil on the passive layer axis (imported twice, layer renamed to ice_layer / snow_layer with N_LAYER bound to N_ILYR / N_SLYR). THIS IS NOT CICE'S INCREMENTAL REMAPPING. The Fortran advects with the incremental-remapping scheme of Dukowicz & Baumgardner (2000) / Lipscomb & Hunke (2004) (horizontal_remap, ice_transport_remap.F90:317-831: limited linear reconstruction construct_fields F90:1009-1283, departure_points F90:1449-1623, departure-region integrals transport_integrals F90:3188-3472), which is upwind-biased, monotone for the tracers and positivity-preserving for the masses. The centered flux divergence here is the continuous flux form of the same conservation law: it is conservative but neither upwind nor limited, so it carries NO positivity or monotonicity guarantee -- an integration can drive aicen/vicen/vsnon negative or create tracer extrema near sharp ice edges, and the tracer recovery floors only the exactly-zero-mass case. No upwind or limited face rule exists for the cice_bgrid grid in EarthSciDiscretizations (the upwind/limiter rules there are for the 1-D Cartesian grids only), and incremental remapping itself is a stage-3 discretization (see README.md 'Transport scheme'). The integrated test cice_transport_centered_flux_35_integrated quantifies the scheme difference against the dump at a single interior cell (residuals ~10% of the transported change, tolerances rel 1e-4/1e-4/2e-4); the measured worst-case scheme residuals of the model against the dump t_exit over the whole traced domain are aicen 4.0e-4, vicen 3.7e-4, vsnon 4.8e-4, Tsfcn 2.2e-3, qicen 2.1e-4, qsnon 9.9e-6 relative (each above one tenth of the field's transported change, so the other tests pin the operator itself, not the trajectory: the uniform-field and divergence pins evaluate the lowered rule exactly, rel 1e-12, and the uniform-tracer preservation test checks the advection-consistency property of the product/recovery formulation). The velocity and grid fields are parameters overridden from the dumps in the tests: uvel/vvel are the transport dump's t_entr step-1 ncat-1 rows (the cell (i,j) row carries the U(i,j) NE-corner velocity = the post-dynamics field), HTE/HTN/tarea are derived from the stress-dump metrics (HTE = (3*cyp - cym)/4, HTN = (3*cxp - cxm)/4, tarea = dxT*dyT; ice_dyn_shared.F90:432-436). Import contract: the model declares the N_I/N_J/NCAT/N_ILYR/N_SLYR metaparameters and the i/j/ncat/ice_layer/snow_layer index sets locally (a workaround for the esm CLI RangeSpec round-trip bug with faq-range metaparameter references under template-import bindings), and imports the rules by reference from ${ESD_ROOT} (an EarthSciDiscretizations checkout at main, which carries both cice_bgrid transport rules since PR #50 / #59). Assembly: the recovered states are named qicen_adv/qsnon_adv because the esm CLI's initial-conditions shape check resolves an override key's trailing local name against the first declaring model, so a Transport state named qicen would shadow Thermodynamics.qicen in the cice.esm assembly test. The thermodynamics -> transport enthalpy hand-off (initializing vqicen = vicen*qicen from the post-thermodynamics state each step, the Fortran's state_to_tracers) is an operator-splitting sequencing step the single-period assembly cannot express, so cice.esm does not wire Thermodynamics.qicen/qsnon into this model; the tests set the product states by initial_conditions.