Ocean

  • BoundaryFluxes model ocean mom6

    Stage-2 implementation of the MOM6 surface boundary fluxes applied in the diabatic column (applyBoundaryFluxesInOut, MOM_diabatic_aux.F90:702-1483 of the instrumented fork stage1/EqESM-cesm-mom6; run configuration C_JRA_t62_mom6_inst: AGGREGATE_FW_FORCING=True so netMassIn == 0 (the net mass change of the column is netMassOut alone), all unit rescale factors 1.0, dt = 3600 s). The component applies the net surface mass, heat and salt fluxes of a step to the surface layer (step A, F90:1039-1071 with netMassIn = 0, and step B, F90:1109-1146 with fractionOfForcing = 1 in the surface layer and the running remainders vanishing exactly -- every traced row has h_1 ~ 2.5 m well above minimum_forcing_depth, so all forcing is consumed by layer 1, verified on all 156 rows: h, T and S change only in layer 1, and only by the fluxes), with the heat content of the mass exchange added via dThickness*T*EnthalpyConst (F90:1141); the reference run has EnthalpyConst = 0 (F90:845-846) because the CESM coupler provides heat_content_evap. The penetrating shortwave is applied by absorbRemainingSW (step C, F90:1355-1362, MOM_opacity.F90:602-885): the component consumes the per-layer SW heating dT and the bottom leftover of the ShortwaveAbsorption component (mom6_shortwave.esm; here sourced from the mom6_sw_abs.csv dump columns dT_k and pen_sw_rem_n(75)). The column budgets are the plain per-layer sums dMass_col = sum_k (h_after_k - h_before_k) == netMassIn + netMassOut, dSalt_col = sum_k (h_after_k*S_after_k - h_before_k*S_before_k) == netSalt, and dHeat_col = sum_k (h_after_k*T_after_k - h_before_k*T_before_k) == netHeat + sum_n penSW_bnd(n) - leftover (netHeat already contains the non-penetrating SW and excludes the heat content of the outgoing mass; the dump rows satisfy these to rel 1e-9, the tolerance of the stage-1 validator stage1/analysis/validate_mom6_w2.py, because the guarded per-layer updates below the surface layer round T/S by ~1 ulp on ~10 of 74 layers per row). The heat_residual variable pins the consistency of the two dumps against the EnthalpyConst = 0 configuration: with EnthalpyConst = 0 it reduces to sum_k h_after_k*dT_k - (penSW_total - leftover) == 0, i.e. the shortwave dump's per-layer heating dT (mom6_sw_abs.csv) must reproduce the bflux dump's per-band totals penSW_bnd and leftover (mom6_bflux.csv) once the layer-1 flux law holds; the dThickness*T_before_1*EnthalpyConst term it also carries (F90:1141) pins EnthalpyConst = 0. The general multi-layer distribution of the fluxes (fractionOfForcing = min(1, h_k/max(H_subroundoff, minimum_forcing_depth - netMassOut_rem)), the evap_CFL_limit branch and the dSalt_frac_max floor, F90:1117-1132) is a sequential data-dependent scan that no traced row exercises (fractionOfForcing = 1 in layer 1, 0 below) and that is not expressible as an algebraic law; it is listed as a gap in README.md, as are the brine-plume insertion (DO_BRINE_PLUME=False in this run) and the heat-content-of-rain/runoff terms of extractFluxes1d (MOM_forcing_type.F90:464-961), which is not part of this component (its outputs netMassIn/netMassOut/netHeat/netSalt/penSW_bnd are the component's inputs).

  • FrazilFormation model ocean mom6

    Stage-2 implementation of MOM6 frazil formation in the diabatic column (make_frazil, MOM_diabatic_aux.F90:122-250 of the instrumented fork stage1/EqESM-cesm-mom6; run configuration C_JRA_t62_mom6_inst: TFREEZE_FORM=LINEAR with the Fortran defaults TFREEZE_S0_P0=0.0 degC and DTFREEZE_DS=-0.054 degC ppt-1 and DTFREEZE_DP=-7.75e-8 degC Pa-1 from the run's MOM_input, PRESSURE_DEPENDENT_FRAZIL=True, RHO_0=1035 kg m-3 and G_EARTH=9.8 m s-2 at their MOM6 defaults, C_P=3992 J kg-1 degC-1 from MOM_input, all unit rescale factors 1.0). The model evaluates the per-layer in-situ pressure as the hydrostatic cumulative integral of the constant gradient dpdz = RHO_0*g_Earth over the layer-thickness measure h (the composite-midpoint form of the F90:176-179 accumulation, lowered by the shared ./mom6_column_discretization.esm rules (the integral_lev_cumulative_from_bottom import of grids/column_nonuniform_1d, renamed lev -> layer at the 9.7.7 edge, the same import path mom6_kpp.esm uses)), the LINEAR freezing-point law (the linear_tfreeze expression template of ./mom6_templates.esm, calculate_TFreeze_linear_scalar, MOM_TFreeze.F90:62), the layer heat capacities hc = RHO_0*C_P*h (F90:190), and the per-layer branch law of the frazil scan: the supercooling supercooling_k = max(0, T_freeze_k - T_before_k) (the F90:228 trigger tv%T(k) < T_freeze(k)), the outcome T_after_k = T_before_k + supercooling_k (F90:230 warms a supercooled layer to the freezing point), and the column heat requirement fraz_col = sum_k hc_k*supercooling_k accumulated into tv%frazil (F90:229, 232, 238). In the traced window no layer is supercooled and no frazil heat is pending (all 312 rows of mom6_frazil.csv: T_before >= T_freeze everywhere, frazil_in == 0), so supercooling == 0, T_after == T_before, fraz_col == 0 and frazil_out == frazil_in == 0, and the column heat balance frazil_out - frazil_in == RHO_0*C_P*sum_k h_k*(T_after_k - T_before_k) (== 0) holds: the heat deficit added to tv%frazil equals the heat the column gains by warming to the freezing point. The formation branch's sequential bottom-up scan with its cross-layer partial-warming coupling (F90:207-234), the thin-layer exception (F90:219-224) and the reclaim branch (F90:183-205) are data-dependent and unexercised in the traced window; they are listed as gaps in README.md.

  • KPPBLD model ocean mom6

    Stage-2 implementation of the MOM6 CVMix KPP planetary boundary layer parameterization (MOM6 dev/ncar_260909 @301879336, fork stage1/EqESM-cesm-mom6 branch instrument/mom6-dumps; run configuration C_JRA_t62_mom6_inst: RI_CRIT=0.3, VON_KARMAN=0.4, SURF_LAYER_EXTENT=0.1, MINIMUM_OBL_DEPTH=5.0, MINIMUM_VT2=1e-10, INTERP_TYPE=quadratic, INTERP_TYPE2=LMD94, MATCH_TECHNIQUE=MatchGradient, ENHANCE_DIFFUSION=False, NLT_SHAPE=CVMix, N_SMOOTH=3, COMPUTE_MONIN_OBUKHOV=True, COMPUTE_EKMAN=False, USE_KPP_LT_K/VT2=False, KPP_IS_ADDITIVE=False, KPP_SHORTWAVE_METHOD=MXL_SW, l_LMD_ws=false, lnoDGat1=true, all unit rescale factors 1.0). Two models: KPPBLD reproduces KPP_compute_BLD (MOM_CVMix_KPP.F90:1195-1575) down to the pre-smoothing OBL depth and kOBL — the surface-layer averages (F90:1342-1405), the per-assumed-OBL hydrostatic pressure for the Wright 1997 EOS (F90:1428-1440, the shared wright_rho composition of ./mom6_templates.esm, whose 15 coefficients are the wright_coeff_* constant fragments shared with mom6_eos.esm), deltaBuoy/N2/N (F90:1444-1457), w_s/Vt^2/BulkRi (F90:1509-1550 via the ./mom6_kpp_templates.esm laws), and OBL_depth_low/kOBL (cvmix_kpp.F90:1585-1814, 1821-1867) with the quadratic interpolation, the Monin-Obukhov limit, the minOBLdepth floor and the MOM6 top/bottom bounds. The column prefix sums of the geometry and hydrostatics — the interface depths depth (and so the heights z_inter = -depth and z_cell), and the reference pressure pRef = p_surf + PRESS_STEP*depth — are ESD integral operators lowered by the local ./mom6_column_discretization.esm rules (the EarthSciDiscretizations column_nonuniform_1d integral_lev_nodes_cumulative_from_bottom and integral_lev_cumulative_from_bottom imports, the exact exclusive-prefix and midpoint stencils of the Fortran iFaceHeight/cellHeight/pRef loops, F90:1237-1243 and F90:1452-1456; see README.md for the summation-order notes). KPPCoefs reproduces cvmix_coeffs_kpp_low (cvmix_kpp.F90:701-1298, not lStokesMOST, MatchGradient, ENHANCE_DIFFUSION=False: the no-match shape G(sigma) = sigma*(1-sigma)^2, the diffusivity/viscosity overwrite at interfaces 2..floor(kOBL), the KPP_IS_ADDITIVE=False replacement of nonzero entries via the kpp_override_nonzero template (Kd_salt = Kd_heat), and the CVMix non-local term) driven by the SMOOTHED OBLdepth/kOBL, z_inter, uStar, surfBuoyFlux (MXL_SW) and the incoming Kt/Ks/Kv from mom6_kpp.csv. Pins: mom6_kpp_obl.csv rows for BulkRi/deltaU2/N2 at layers 2..kOBL+3 (layer 1 is 0 by construction), spot z_cell at layers 1..kOBL+3 and z_inter at ifaces 2..kOBL+3 (iface 1 is the surface) plus the deep z_cell/z_inter at layer/iface 75, and OBLdepth/kOBL (rel 1e-12; the N_SMOOTH=3 Laplacian smoothing of KPP_smooth_BLD is inherently horizontal and is NOT reproduced — the pre-smoothing values are pinned and the smoothed values are consumed as inputs), and mom6_kpp.csv rows for Kd_heat/Kv at interfaces 2..kwup plus one pass-through Kv_out at kwup+1 (the kpp_override_nonzero else-branch). Unpinned (never exercised by the 156 traced columns; see README.md): the OBL_limit branch (no traced column has BulkRi <= 0.3 everywhere, kfirst = N_LAYER+1), the interpolated OBL depth of the kfirst = 2 and 3 rows (always floored to MINIMUM_OBL_DEPTH in the traces), the unstable (surfBuoyFlux < 0) branches of the stability functions and of the non-local term, the Langmuir enhancement paths, and the MINIMUM_VT2 floor.

  • KPPCoefs model ocean mom6

    Stage-2 implementation of the MOM6 CVMix KPP planetary boundary layer parameterization (MOM6 dev/ncar_260909 @301879336, fork stage1/EqESM-cesm-mom6 branch instrument/mom6-dumps; run configuration C_JRA_t62_mom6_inst: RI_CRIT=0.3, VON_KARMAN=0.4, SURF_LAYER_EXTENT=0.1, MINIMUM_OBL_DEPTH=5.0, MINIMUM_VT2=1e-10, INTERP_TYPE=quadratic, INTERP_TYPE2=LMD94, MATCH_TECHNIQUE=MatchGradient, ENHANCE_DIFFUSION=False, NLT_SHAPE=CVMix, N_SMOOTH=3, COMPUTE_MONIN_OBUKHOV=True, COMPUTE_EKMAN=False, USE_KPP_LT_K/VT2=False, KPP_IS_ADDITIVE=False, KPP_SHORTWAVE_METHOD=MXL_SW, l_LMD_ws=false, lnoDGat1=true, all unit rescale factors 1.0). Two models: KPPBLD reproduces KPP_compute_BLD (MOM_CVMix_KPP.F90:1195-1575) down to the pre-smoothing OBL depth and kOBL — the surface-layer averages (F90:1342-1405), the per-assumed-OBL hydrostatic pressure for the Wright 1997 EOS (F90:1428-1440, the shared wright_rho composition of ./mom6_templates.esm, whose 15 coefficients are the wright_coeff_* constant fragments shared with mom6_eos.esm), deltaBuoy/N2/N (F90:1444-1457), w_s/Vt^2/BulkRi (F90:1509-1550 via the ./mom6_kpp_templates.esm laws), and OBL_depth_low/kOBL (cvmix_kpp.F90:1585-1814, 1821-1867) with the quadratic interpolation, the Monin-Obukhov limit, the minOBLdepth floor and the MOM6 top/bottom bounds. The column prefix sums of the geometry and hydrostatics — the interface depths depth (and so the heights z_inter = -depth and z_cell), and the reference pressure pRef = p_surf + PRESS_STEP*depth — are ESD integral operators lowered by the local ./mom6_column_discretization.esm rules (the EarthSciDiscretizations column_nonuniform_1d integral_lev_nodes_cumulative_from_bottom and integral_lev_cumulative_from_bottom imports, the exact exclusive-prefix and midpoint stencils of the Fortran iFaceHeight/cellHeight/pRef loops, F90:1237-1243 and F90:1452-1456; see README.md for the summation-order notes). KPPCoefs reproduces cvmix_coeffs_kpp_low (cvmix_kpp.F90:701-1298, not lStokesMOST, MatchGradient, ENHANCE_DIFFUSION=False: the no-match shape G(sigma) = sigma*(1-sigma)^2, the diffusivity/viscosity overwrite at interfaces 2..floor(kOBL), the KPP_IS_ADDITIVE=False replacement of nonzero entries via the kpp_override_nonzero template (Kd_salt = Kd_heat), and the CVMix non-local term) driven by the SMOOTHED OBLdepth/kOBL, z_inter, uStar, surfBuoyFlux (MXL_SW) and the incoming Kt/Ks/Kv from mom6_kpp.csv. Pins: mom6_kpp_obl.csv rows for BulkRi/deltaU2/N2 at layers 2..kOBL+3 (layer 1 is 0 by construction), spot z_cell at layers 1..kOBL+3 and z_inter at ifaces 2..kOBL+3 (iface 1 is the surface) plus the deep z_cell/z_inter at layer/iface 75, and OBLdepth/kOBL (rel 1e-12; the N_SMOOTH=3 Laplacian smoothing of KPP_smooth_BLD is inherently horizontal and is NOT reproduced — the pre-smoothing values are pinned and the smoothed values are consumed as inputs), and mom6_kpp.csv rows for Kd_heat/Kv at interfaces 2..kwup plus one pass-through Kv_out at kwup+1 (the kpp_override_nonzero else-branch). Unpinned (never exercised by the 156 traced columns; see README.md): the OBL_limit branch (no traced column has BulkRi <= 0.3 everywhere, kfirst = N_LAYER+1), the interpolated OBL depth of the kfirst = 2 and 3 rows (always floored to MINIMUM_OBL_DEPTH in the traces), the unstable (surfBuoyFlux < 0) branches of the stability functions and of the non-local term, the Langmuir enhancement paths, and the MINIMUM_VT2 floor.

  • ShortwaveAbsorption model ocean mom6

    Stage-2 implementation of the MOM6 penetrating shortwave absorption (MOM6 dev/ncar_260909 @301879336, fork stage1/EqESM-cesm-mom6 branch instrument/mom6-dumps; in this MOM6 version the two routines live in MOM_opacity.F90: absorbRemainingSW :602-869, which heats the water column by the Beer-Lambert decay of the penetrating bands, and sumSWoverBands :894-1041, which accumulates the penetrating shortwave for the KPP buoyancy-flux path; the per-band surface split penSW_bnd = sw_pen_band*dt/(RHO_0*C_P) is extractFluxes1d of MOM_forcing_type.F90:619; run configuration C_JRA_t62_mom6_inst: OPACITY_SCHEME=OHLMANN_03 (chlorophyll-driven opacity_from_chl :247-479), N_SW_BANDS=2, RHO_0=1035 kg m-3, C_P=3992 J kg-1 K-1, all unit rescale factors 1.0). The component is written as math, not as the Fortran's loop: the optical depth at interface i is the Beer-Lambert integral tau(n,i) = int_0^{z_i} opacity(n,z') dz' of the surface-to-interface water column (esm-spec 4.2), spelled with the ESD integral op and lowered by the local match rules of ./mom6_sw_discretization.esm (the cumulative-from-bottom integral of integral_lev_nodes_cumulative_from_bottom lifted to the [band, layer] integrand, because the imported EarthSciDiscretizations integral rules constrain the integrand to a bare lev-shaped reference); the measure is the per-path layer thickness, h = h_after (the post-flux thickness the heating path sees, absorbRemainingSW :748-750) for OD and h_buoy = h_before (the pre-flux thickness of the KPP buoyancy path, thickness_to_dz via MOM_forcing_type.F90:1102) for OD_buoy, with the surface bounds z_sfc = z_sfc_buoy = 0 m. The per-interface band flux is named once, F_pen(n,i) = penSW_bnd(n)*exp(-tau(n,i)) (and F_pen_buoy from tau_buoy); the remaining penetrating SW after layer k is pen_sw_rem(n,k) = F_pen(n,k+1) (absorbRemainingSW :752-753, 760-766), the layer heating is dT(k) = sum_n F_pen(n,k)*(1 - exp(-opacity(n,k)*h(k)))/h(k) (absorbRemainingSW :775-777, 797-802), and the interface net penetrating flux is netPen(i) = sum_n F_pen_buoy(n,i)/dt (sumSWoverBands :1000-1004). Coverage gap (see README.md): absorbRemainingSW's min_SW_heat clamp (PEN_SW_FLUX_ABSORB = 2.5e-11 degC m s-1, PEN_SW_ABSORB_MINTHICK = 1.0 m, answer_date >= 20190101, :711-730) rewrites pen_sw_rem/dT below the layers where nsw*pen_sw_rem(n,k) < 2.5e-11*dt degC m; it is a stateful recurrence (the clamped remaining feeds the next layer), so it is not expressed as pure math here and those layers are pinned only via the conservation identity absorbed_total = sum_k dT(k)*h(k) (which the clamp preserves up to the ~1e-24 leftover). State units: sw_pen_band [W m-2], opacity [m-1], h/h_buoy [m], dt [s], penSW_bnd [degC m] (heating per step), OD/OD_buoy dimensionless, pen_sw_rem [degC m], dT [degC], netPen [degC m s-1], absorbed_total [degC m]. Pins: mom6_sw_abs.csv rows (joined to mom6_bflux.csv for h_after/h_before/dt) at rel 1e-12 within the unclamped region, extracted by stage1/analysis/make_mom6_sw_abs_tests.py.

  • TridiagonalMixing model ocean mom6

    MOM6 implicit vertical tracer diffusion (tracer_vertdiff_Eulerian no-sink branch, MOM_tracer_diabatic.F90:384-413; ent computed in MOM_diabatic_driver.F90:1728-1739) written as the PDE dT/dt = d/dz (Kd dT/dz) for each tracer, discretized by the EarthSciDiscretizations rule varcoeff_face_laplacian_lev_flux_bc with zero prescribed face fluxes. The rule's lowering (G[n] = Kd[n](u[n]-u[n-1])/(zc[n]-zc[n-1]), L[ell] = (G[ell+1]-G[ell])/dz[ell], zero face fluxes) is exactly the MOM6 tridiagonal law h_k (u'_k - u_k) = ent_k (u'_{k-1} - u'_k) + ent_{k+1} (u'_{k+1} - u'_k) with ent = dt Kd/dz_int; the PDE's h divides out through the cell measure. The esd column reverses the MOM6 top-down order: esd lev ell <-> MOM6 layer NLEV+1-ell, esd interface n <-> MOM6 interface NLEV+2-n, ze increasing upward from the bottom (ze[1] = -H) to the surface (ze[NLEV+1] = 0). T and S are carried separately because Kd_heat != Kd_salt on most dumped interfaces (10-36 per column, up to ~50%; the dump contradicts the claim of README.md that they are equal). Pinned to rows of stage1/dumps/mom6/mom6_diabatic_tri.csv (see README.md; tuples extracted by stage1/analysis/extract_mom6_vertdiff_tuples.py).

  • WrightEOS model ocean mom6

    Stage-2 implementation of the MOM6 equation of state (stage 1 boundary B1 of stage1/runs/MOM6_LANE.md; MOM6 dev/ncar_260909 @301879336, fork stage1/EqESM-cesm-mom6 branch instrument/mom6-dumps): the Wright 1997 full-range in-situ density rho(T, S, p) and its analytic first derivatives drho/dT, drho/dS, as evaluated by the model's calculate_density / calculate_density_derivs_scalar calls in KPP_compute_BLD (MOM_CVMix_KPP.F90:1437; the EOS law itself is density_elem_Wright_full / calculate_density_derivs_elem_Wright_full, MOM_EOS_Wright_full.F90:75-91 / 179-204). The model WrightEOS binds the 15 Fortran coefficients by reference from the wright_coeff_a0..c5 constant fragments of ./mom6_templates.esm (MOM_EOS_Wright_full.F90:23-37; the fragments are the single shared source of the coefficient values, also used by the wright_rho composition and by the KPPBLD model of mom6_kpp.esm), computes the three shared polynomials al0/p0/lambda as intermediate unknowns via the wright_alpha0 and wright_poly templates of ./mom6_templates.esm (p0 and lambda are the same wright_poly law under the b- and c-coefficients), then rho = (p + p0)/(lambda + al0*(p + p0)) via the wright_density template and the Fortran's hand-coded derivative formulas (wright_drho_dT / wright_drho_dS templates) with the shared denominator inverse I_denom2 = 1/(lambda + al0*(p + p0))^2 (F90:198). The derivatives are transcribed formulas, NOT symbolic D(rho, T)/D(rho, S): in esm 1.3.0 the D operator is a rewrite-target for discretization stencils (esm-spec 4.2 / 9.6.8) and the CLI 0.7.0 evaluator rejects it for algebraic expressions ('unlowered_operator ... reached evaluation without being lowered to a stencil'), so the Fortran derivative formulas are reproduced exactly instead (operation order identical to the Fortran, so the tests pin the derivative columns to round-off, rel 1e-12). State units: T potential temperature [degC], S salinity [ppt], p pressure at the top interface of the layer [Pa] (surface pressure + hydrostatic weight of the layers above, MOM_CVMix_KPP.F90:1428-1440), rho in-situ density [kg m-3], drho/dT [kg m-3 degC-1], drho/dS [kg m-3 ppt-1]. The run configuration (C_JRA_t62_mom6_inst) uses EQN_OF_STATE = WRIGHT_FULL (the MOM6 default), USE_PSURF_IN_EOS = True, and all unit rescale factors 1.0, so the dumped values are the physical-unit law values.