Merge

  • AtmMerge model coupler cmeps

    CMEPS atmosphere-import merge component (stage 2 of the EqESM project): the fraction-weighted merges of the land/ice/ocean fields onto the atm grid in med_phases_prep_atm (mediator/med_phases_prep_atm_mod.F90:156-166, the med_merge_auto of med_merge_mod.F90:405-412 with the merge specs of esmFldsExchange_cesm_mod.F90), transcribed exactly with the fraction_weighted_sum expression template of ./cmeps_templates.esm imported by reference. The traced configuration (the F2000climo_f19_inst case of the instrumented CMEPS run 12284979, stage1/dumps/cmeps/cmeps_prep_atm.csv, 432 rows = 36 traced atm cells x 12 coupling steps): the cesm coupling mode with samegrid_atmlnd = .true. and component_computes_enthalpy_flux = none; every lnd2atm export is a three-source merge weighted by the FBFrac(compatm) fractions lfrac/ifrac/ofrac (the land weight is mrg_fracname_lnd2atm_state = 'lfrac' of med_internalstate_mod.F90:289-290, the ice/ocean weights are the 'ifrac'/'ofrac' strings of the addmrg specs), and the So_t copy export of L1282-1285 is the unweighted mrg_type = 'copy'. The merge lists: Sx_avsdr L875-887, Sx_avsdf L902-914, Sx_anidr L929-941, Sx_anidf L956-968, Sx_tref L988-1002, Sx_u10 L1015-1029, Sx_qref L1046-1062 (the bulk blank-suffix branch of the water_bulk_or_tracers split; the traced run is bulk), Faxx_taux L1085-1099, Faxx_tauy L1112-1126, Faxx_lat L1139-1153, Faxx_sen L1166-1180, Faxx_evap L1197-1211, Faxx_lwup L1236-1250, Sx_t L1267-1279. The dump carries each source field mapped to the atm grid and the merged export, so each test pins one cell/step at full dump precision: the traced cells are the first dump_first_cells = 12 atm cells of PET 0 (local element order, the Antarctica row block of the f19 grid) unioned with the per-step partial-ice (0 < ifrac < 1) and partial-land (0 < lfrac < 1) cells (36 distinct cells); the pinned rows cover the fraction regimes fully-land (lfrac = 1), open-ocean (ofrac = 1), partial-ice (ifrac = 0.99875) and the mixed three-fraction cell (atm cell n = 6, all weights nonzero, every source valid), plus the same mixed cell at the last step where the 05:30 local-time albedo sources are the dark-side 1.0. Sources on zero-fraction cells carry the CMEPS spval 1e30 (e.g. Sl_* on the ocean/ice cells) or 0.0 (Si_* of the ice-free Antarctica rows) - both inert at weight 0 (0.0*1e30 = 0.0 exactly, no NaN), which the tests pin implicitly. Each merge reproduces the Fortran accumulation order exactly: dp = 0 + Sl*lfrac, dp = dp + Si*ifrac, dp = dp + So*ofrac (med_merge_mod.F90:405-412), i.e. fraction_weighted_sum applied twice: the land+ice pair weighted by lfrac/ifrac first (the inner application), then the open-ocean source weighted by ofrac added on top (the outer application with the identity ice_frac = 1.0, which multiplies exactly).

  • OcnMerge model coupler cmeps

    CMEPS ocean-export merge component (stage 2 of the EqESM project): the fraction-weighted merges of the atmosphere/ocean/ice/runoff fields onto the ocean grid in med_phases_prep_ocn_accum (mediator/med_phases_prep_ocn_mod.F90:161-168, the med_merge_auto of med_merge_mod.F90:405-412 with the merge specs of esmFldsExchange_cesm_mod.F90) plus the med_phases_prep_ocn_custom shortwave computation (F90:582-894), transcribed exactly with the merge expression templates of ./cmeps_templates.esm imported by reference. The traced configuration (the C_JRA_t62 DATM+SICE+MOM6 case, stage1/dumps/cmeps/cmeps_merge.csv, 288 rows = 12 traced ocean cells x 24 coupling steps of the instrumented run 12134714; all traced cells are partial-ice, ifrac 0.0683..0.6246): the ice component (SICE data ice) is present, so the cice-is-present branch of the custom computation (F90:756-837) is exercised: fswabsv = Faxa_swvdr*(1 - avsdr) + Faxa_swvdf*(1 - avsdf) and fswabsi = Faxa_swndr*(1 - anidr) + Faxa_swndf*(1 - anidf) with the ocean albedos of the ocnalb phase (FBMed_ocnalb_o So_avsdr/avsdf/anidr/anidf, the anidr/avsdr/avsdf outputs of the cmeps_ocnalb component), the scaled fractions ifrac_scaled/ofrac_scaled/ifracr_scaled/ofracr_scaled of F90:800-813 (from ifrac/ofrac and the radiation fractions ifrad/ofrad; the dumped ifrad/ofrad lag the current ifrac/ofrac by one coupling step - ifrad(k) = ifrac(k-1) - because the ocnalb phase copies the fractions after its albedo loop, so the traced swnet weights the PREVIOUS step's radiation fractions; see the cmeps_ocnalb component), Foxx_swnet = ofracr_scaled*(fswabsv + fswabsi) + ifrac_scaled*Fioi_swpen (F90:814) and the shortwave band split Foxx_swnet_vdr/vdf/idr/idf = c*Foxx_swnet with the SINGLE-precision Fortran literals c1 = c2 = 0.285 and c3 = c4 = 0.215 promoted to r8 (0.2849999964237213 / 0.2150000035762787, F90:830-834; the import_swpen_by_bands per-band branch of F90:824-827 is not exercised because SICE does not export Fioi_swpen_vdr/vdf/idr/idf). The accumulated merges (the esmFldsExchange_cesm_mod.F90 specs, all ofrac-weighted for the atm/aoflux sources and ifrac-weighted for the ice sources): Faxa_rain = rainc*ofrac + rainl*ofrac (L1940-1942), Faxa_snow = snowc*ofrac + snowl*ofrac (L1949-1951), Foxx_lwnet = Faox_lwup*ofrac + Faxa_lwdn*ofrac (L1759-1762; Faox_lwup is the negative upward flux of the aoflux phase, so the sum is the net downward longwave), Foxx_sen = Faox_sen*ofrac (L1966-1967), Foxx_taux = Fioi_taux*ifrac + Faox_taux*ofrac (L2154-2158), Foxx_tauy = Fioi_tauy*ifrac + Faox_tauy*ofrac (L2169-2173), Foxx_evap = Faox_evap*ofrac (L1992-1993), Fioi_melth = Fioi_melth*ifrac (L2204-2206), Fioi_meltw = Fioi_meltw*ifrac (L2189-2191), Fioi_salt = Fioi_salt*ifrac (L2218-2220), Foxx_rofl = Forr_rofl (L2354) and Foxx_rofi = Forr_rofi (L2394), each reproduced bit-identically by the replay of stage1/analysis/validate_cmeps_ocnalb_merge_dumps.py (0.000e+00 relative error on all 23 columns over all 288 rows). The enthalpy fields (Foxx_hlat/hsen/etc.) are not dumped (documented gap): the traced run merges only the mass/energy fields above. The Sx_*/Faxx_* atmosphere merges of prep_atm are not exercised by this case (no prep_atm phase in the run sequence; needs a CAM case). Dump input labels carry the _ice suffix for the ice-import fields (FBImp(compice,compocn) names drop it). Reference: stage1/EqESM-cesm-cmeps/components/cmeps/mediator/med_phases_prep_ocn_mod.F90, med_merge_mod.F90 and esmFldsExchange_cesm_mod.F90.