Audience: coding agents and developers working in the GEOS_OceanGridComp repository.
Describes: the MAPL2 line, branch develop.
Verified against: GEOS_OceanGridComp @ 8d91ab7 (2026-11-05).
Placement: as in the GEOSgcm fixture (components.yaml @ 0f2e0fb).
Other fixtures (for example GEOSadas, GEOSldas) may place this repository
elsewhere; paths inside this repository do not change.
Paths are relative to this repository's root unless they start with src/ or @
(fixture-relative). Statements without a label are Verified and carry a
(path, routine-or-key) citation. Inferred: and Unverified: mark the weaker
cases. OGCM file means src/Components/@GEOSgcm_GridComp/GEOSogcm_GridComp/GEOS_OgcmGridComp.F90
(parent repository GEOSgcm_GridComp). MAPL file means
src/Shared/@MAPL/generic/MAPL_Generic.F90. Definitions at first use: MOM5 and MOM6 are the
Modular Ocean Model versions 5 and 6 (GFDL); MITgcm is the MIT General Circulation Model;
FMS is the GFDL Flexible Modeling System library; a plug-in here is a MAPL gridded component
that wraps one ocean model or a data ocean.
- The fixture lists this repository as
GEOS_OceanGridCompwithlocal: ./src/Components/@GEOSgcm_GridComp/GEOSogcm_GridComp/@GEOS_OceanGridComp,tag: v3.13.0,develop: develop(components.yaml,GEOS_OceanGridComp). This document was checked against thedevelopcheckout; the tags below are the pinned versions incomponents.yaml. - Parent repository:
GEOSgcm_GridComp, whose ocean compositeOGCM(GEOSogcm_GridComp/GEOS_OgcmGridComp.F90, moduleGEOS_OgcmGridCompMod) adds this repository's component as childOCEAN(OGCM file,SetServices:OCEAN = MAPL_AddChild(GC, NAME='OCEAN', SS=OceanSetServices)). Documents:GEOSgcm_GridComparchitecture (../../../docs/ARCHITECTURE.mdin the fixture) (theOGCMcomposite itself is marked "not yet documented" there), fixture architecture (../../../../../../docs/ARCHITECTURE.mdin the fixture), application repository (../../../../../Applications/@GEOSgcm_App/docs/ARCHITECTURE.mdin the fixture) (run-time templates andgcm_setup). - Children (links down, all gitignored here, all listed in
components.yaml):
| Fixture name | Local path in this repository | tag: / develop: |
Used by |
|---|---|---|---|
mom (remote ../MOM5.git) |
MOM_GEOS5PlugMod/@mom |
geos/5.1.0+2.1.0 / geos5 |
MOM_GEOS5PlugMod |
mom6 (remote ../MOM6.git, recurse_submodules) |
MOM6_GEOSPlug/@mom6 |
geos/v3.9 / geos/main |
MOM6_GEOSPlug |
stochastic_physics |
MOM6_GEOSPlug/@stochastic_physics |
geos/v1.0.0 / geos/master |
MOM6_GEOSPlug (optional) |
mit (remote ../MITgcm.git) |
MIT_GEOS5PlugMod/@mit |
checkpoint68o / none |
MIT_GEOS5PlugMod |
| Path | What it is | Module / entry |
|---|---|---|
GEOS_OceanGridComp.F90 |
The OCEAN wrapper: chooses one plug-in, runs it, converts and weights imports |
GEOS_OceanGridCompMod, SetServices |
GEOS_Ocean_StateSpecs.rc |
Import, internal and export specs of OCEAN (ACG input) |
CMakeLists.txt, mapl_acg |
GEOSdatasea_GridComp/ |
Data ocean plug-in (DATASEA) |
GEOS_DataSeaGridCompMod |
MOM_GEOS5PlugMod/ |
Plug-in around MOM5 (MOM); mom_app/mkMAPLTripolar grid-file scripts |
MOM_GEOS5PlugMod |
MOM6_GEOSPlug/ |
Plug-in around MOM6 (MOM6); mom6_app/ run-time configurations; mom6_cmake/, stochastic_physics_cmake/ build the nested sources |
MOM6_GEOSPlugMod |
MIT_GEOS5PlugMod/ |
Plug-in around MITgcm (MIT); mitgcm_setup/ driver code, configs/ experiment setups, instructions/ |
MIT_GEOS5PlugMod |
.github/, .circleci/, README.md, CONTRIBUTING.md, licence files |
CI, code owners, project files |
The build target is named GEOS_OceanGridComp (esma_set_this, CMakeLists.txt).
OCEAN is a thin wrapper (module header: "light-weight gridded component that serves an interface
to ocean/data_ocean components", GEOS_OceanGridComp.F90). It has exactly one active ocean child
(OCN), plus a second data-ocean child (OCNd) in dual-ocean mode. It is run by OGCM through
MAPL_GenericRunChildren in ordinary mode, or explicitly by phase in dual-ocean mode (OGCM file, Run).
It exchanges data with sibling components of OGCM (sea ice, ocean radiation, ocean biogeochemistry), not with
the atmosphere directly: the atmosphere-ocean exchange is made by GEOS_GcmGridComp.F90 and OGCM
(see the GEOSgcm_GridComp architecture (../../../docs/ARCHITECTURE.md in the fixture), section 3.3).
- Reads
USE_DATASEA:(default 1),OGCM_TOP_LAYER:(default 10.0, calledOrphanDepth) andUSE_DATA_ATM4OCN:(default.FALSE.). - Adds the active child:
USE_DATASEA/= 0: childDATASEA,MAPL_AddChild(GC, NAME=..., SS=DataSeaSetServices).- else reads
OCEAN_NAME:(default"MOM"):MOMandMOM6are loaded from shared libraries,MAPL_AddChild(OCEAN_NAME, 'setservices_', parentGC=GC, sharedObj=...), with the library name fromMOM_GEOS5PLUGMOD:(defaultlibMOM_GEOS5PlugMod.so) orMOM6_GEOSPLUG:(defaultlibMOM6_GEOSPlug.so);MITis added statically,SS=MITSetServices, only when compiled withBUILD_MIT_OCEAN; any other value writes a message and fails (VERIFY_(999)).
- Reads
DUAL_OCEAN:(default 0). If set, adds a second child namedDATASEA(OCNd). - Declares state:
#includeof the ACG output forGEOS_Ocean_StateSpecs.rc(imports, one internal, exports), the hand-written exportMASKO, and exports borrowed from the child (MAPL_AddExportSpec(..., CHILD_ID=OCN)): alwaysTW SW UW VW; when not data ocean alsoDH UWB VWB SLV T S;SSH PBOonly forMOM;UWC VWConly forMOM6. - For a non-data ocean,
MAPL_TerminateImportremoves from the child the importsTAUX TAUY PENUVR PENPAR PENUVF PENPAF DRNIR DFNIR DISCHARGE CALVING LWFLX SHFLX QFLUX RAIN SNOW SFLX SWHEAT:OCEANfills them by hand inRun.PEN_OCNis deliberately not terminated "since it is not used in the plug" (source comment). WithDUAL_OCEAN, the child'sDEL_TEMPimport is terminated too ("we will fill it here"). - Sets Initialize and Run entry points (
Initialize,Run); withDUAL_OCEANa secondRunentry point (phase 2, "only used in the predictor part of the replay for dual ocean"). Finalize and the record (checkpoint) entry point are not overridden, so the MAPL defaults apply (MAPL file,register_generic_entry_points:MAPL_GenericFinalize,MAPL_GenericRecord). - Calls
MAPL_GenericSetServices, which wires the children to each other and toOCEAN's own states (MAPL file,MAPL_WireComponent).
- Imports are the specs in
GEOS_Ocean_StateSpecs.rc(FROCEAN TAUX TAUY PENUVR PENPAR PENUVF PENPAF DRNIR DFNIR SWHEAT DISCHARGE LWFLX SHFLX QFLUX SNOW RAIN FRESH FSALT FHOCN PEN_OCN;CALVINGonly ifDO_DATA_ATM4OCN; bundlesTRandTRFLUXonly ifOCEAN_NAME == 'MOM';FRACICEdonly ifdual_ocean) plus any child import that is neither connected nor terminated: MAPL adds such child import specs to the parent's import spec (MAPL file,MAPL_WireComponent: "Imports that are not internally satisfied have their specs put in the GC's import spec to be externally satisfied"). Inferred: from that code, not checked in a run, this is how child-only imports such asPS(all real-ocean plug-ins),PICE(MOM,MOM6),STROCNXB STROCNYB AICEU(MOM),TAUXBOT TAUYBOT AICE(MOM6),WGHTandICESTATES(MIT), andFRACICE,DATA_SST,DATA_UW(DATASEA) appear inOCEAN's import state.OGCMthen fills or connects them (3.5). - Internal:
TS_FOUND(K, default 280.0,FRIENDLYTO = trim(COMP_NAME)), so it is also an export (GEOS_Ocean_StateSpecs.rc;MAPL file,MAPL_StateAddInternalSpec). - Exports:
SS_FOUND FRZMLT TAUX TAUY SWHEAT RFLUX DISCHARGE CALVING FROCEAN LWFLX SWFLX SHFLX QFLUX SFLX RAIN SNOW PEN_OCN(diagnostic copies of whatRunpassed on),T_Freezeonly ifOCEAN_NAME == 'MOM6'(GEOS_Ocean_StateSpecs.rc),MASKO, and the borrowed child exports of 3.2. - Private state: one clock, stored with
ESMF_UserCompSetInternalStateunder the name<OCEAN_NAME>_internal_state(GEOS_OceanGridComp.F90,Initialize). - Restarts: only
TS_FOUNDis declared here, with noRESTARToption (MAPL defaultMAPL_RestartOptional,MAPL file,MAPL_StateAddInternalSpec). The template names its file withOCEAN_INTERNAL_RESTART_FILE: ocean_internal_rston@COUPLEDlines (src/Applications/@GEOSgcm_App/AGCM.rc.tmpl). The ocean models restart themselves (section 5).
Initialize:
- Creates the private clock named
<OCEAN_NAME>Clock, stepOCEAN_DT:(defaultRUN_DT:, the heartbeat), starting at the current time. - Calls
MAPL_GenericInitialize(which initializes the children). - Non-data ocean only: allocates export
MASKOand fills it from the child's mask:<OCEAN_NAME>_3D_MASKlevel 1 forMOM/MIT,MOM_2D_MASKforMOM6.
Run (phase 1), when the private clock is not past the supervisor's time (it rewinds the private clock if it is):
- Gets the mask as above (data ocean: a field of 1.0).
- Weight
WGHT = FROCEAN / MASKwhereMASK > 0andFROCEAN /= MAPL_UNDEF, else 0. - Non-data ocean: copies imports into the child's import state multiplied by
WGHT:PENUVR PENPAR PENUVF PENPAF DRNIR DFNIR LWFLX QFLUX SNOW TAUX TAUY;SHFLX = (SHFLX - FHOCN)*WGHT;RAIN = (RAIN + FRESH)*WGHT;SFLX = FSALT*WGHT;DISCHARGE = DISCHARGE*WGHTandCALVING = 0, or, withUSE_DATA_ATM4OCN,DISCHARGEandCALVINGtaken unweighted and clipped at 0;SWHEATweighted forMOM/MITonly (theMOM6branch does nothing: "No 3D Mask from MOM6. Do nothing for now!") andRFLUXaccumulates the weighted heating in levels where the 3D mask is 0. WithBUILD_MIT_OCEANit also sets the child'sWGHTimport. Then fills the diagnostic exports. - Runs the child in a loop
do while (MyTime <= endTime), advancing the private clock byOCEAN_DT: ordinary modeMAPL_GenericRunChildren(GC, IMPORT, EXPORT, PrivateState%CLOCK); dual mode in 3.6. - After the loop:
SS_FOUND(34.0 psu whereWGHT = 0, else childSW);FRZMLTfrom the child whereWGHT > 0(data ocean: 0);T_Freezelikewise, only forMOM6;TS_FOUNDfrom childTWwhereWGHT > 0(dual mode: fromTWdwhere the ice fraction is below 0.05). - "Orphan points" (ocean fraction present, child mask 0):
TS_FOUNDis advanced with the surface heat budget overOrphanDepth,FRZMLTcomputed, andTS_FOUNDlimited below by the freezing temperature at salinity 34.0 (non-data ocean only).
- Selection keys read in
OGCM'sSetServices:USE_DATASEA:(default 1; comment "this get resource is repeated in Ocean - change both together!"),OCEAN_NAME:(defaultMOM),USE_DATA_ATM4OCN:,DUAL_OCEAN:,OCEAN_EXT_DATA:,OCEAN_SSS_DATA:andSEAICE_THICKNESS_EXT_DATA:(the last two only whenUSE_DATASEA == 1).OCEAN'sSetServicesreadsUSE_DATASEA:,OCEAN_NAME:,USE_DATA_ATM4OCN:,DUAL_OCEAN:again, and each plug-in readsDUAL_OCEAN:once more.OGCMasserts:USE_DATA_ATM4OCNneedsUSE_DATASEA = 0;USE_DATASEA /= 0needsUSE_CICE_Thermo = 0,USE_DATASEAICE /= 0andUSE_OCEANOBIOGEOCHEM = 0. - Connections
MAPL_AddConnectivityinSetServices, to or fromOCEAN:ORAD -> OCEAN: SWHEATandOCEAN -> ORAD: DH, MASKO(non-data ocean);SEAICE -> OCEAN: FRACICE(always),SEAICETHICKNESS(ifSEAICE_THICKNESS_EXT_DATA),ICESTATES(BUILD_MIT_OCEAN),FRACICEd(dual);OCEAN -> SEAICE: SS_FOUND(dual),UWB VWB UW VW SLV(non-data ocean),UWC VWC(non-data,OCEAN_NAMEneitherMOMnorMIT),TS_FOUND SS_FOUND FRZMLTrenamedSST SSS FRZMLT(USE_CICE_Thermo > 1);SEAICE -> OCEANfor a non-data ocean:TAUXBOT TAUYBOT HICE HSNO FRESH FSALT FHOCNplusSTROCNXB STROCNYB AICEUforMOMandAICEotherwise (theelsebranch is commented "MOM6" but also coversMIT);OCEAN -> OBIO: DH T S MASKO(with ocean biogeochemistry). - Imports of
OCEANthatOGCMfills by hand on the exchange grid from the surface skin (not by connection), withMAPL_LocStreamTransformintoGIM(OCEAN)(OGCM file,Run):TAUX TAUY OUSTAR3 PS(pointers fetched withnotfoundOK),LWFLX SHFLX QFLUX SNOW RAIN PEN_OCN, and for a real oceanPENUVR PENUVF PENPAR PENPAF DRNIR DFNIRandDISCHARGE(not withUSE_DATA_ATM4OCN).FROCEANis filled inInitializefor every child that has it (MAPL_LocStreamFracArea). OGCM'sSetServicesends with calls ofMAPL_TerminateImport(GC, names, child_ids)with arrays. This is the "all but" form: every unconnected import is terminated except one whose name is in the list, for a child that is in the list (not positional pairs:MAPL file,MAPL_TerminateImportAllBut,skip = any(names == short_name) .and. any(child_ids == I); for exampleDATA_SIT, listed forseaice, is also exempt foroceanwhenoceanis in the same call). The imports left unterminated forOCEANare:DATA_UW DATA_VWwhenOCEAN_EXT_DATAis false (plusDISCHARGE CALVINGwithUSE_DATA_ATM4OCN);DATA_SST(andDATA_SSSwhenOCEAN_SSS_DATA) whenOCEAN_EXT_DATAis true and the ocean is a data ocean; none when it is true and the ocean is real (OGCM file,SetServices). Inferred: the kept imports are the ones left to ExtData; everything else thatOCEANimports and nobody connects (for examplePS,PICE) is terminated at this level;OGCMfills some of those by hand (above). This agrees withDataSea_ExtData.yaml, which namesDATA_UWandDATA_VW(5.1).- Exports
OGCMreads back fromGEOS_OceanGridComp's export state:UW VW TS_FOUND SS_FOUND FRZMLTand, non-data,UWB VWB(OGCM file,Run). - Tracers: for
OCEAN_NAME == MOM,OGCMcollects ocean-biogeochemistry friendlies into theTRbundle ofOCEAN's import state (OGCM file,Initialize,MAPL_GridCompGetFriendlies(GCS(OBIO),"OCEAN", BUNDLE)).
A second data ocean DATASEA (OCNd) runs beside the real ocean and the real ocean is nudged toward it, for the predictor part
of regular replay (REPLAY_MODE: Regular, asserted in GEOS_GcmGridComp.F90; see the
GEOSgcm_GridComp architecture (../../../docs/ARCHITECTURE.md in the fixture), section 3.4).
Runphase 1 (corrector): runOCNdphase 1, its couplers,OCNphase 1, its couplers; thenDEL_TEMP = (TWd - TW)*DT/(DT + TAU_SST)where mask > 0 andFRACICEofOCNdis below 0.05, andDEL_TEMP = ((-0.054*SW + MAPL_TICE) - TW)*DT/(DT + TAU_SST_UNDER_ICE)where mask > 0, that ice fraction is at least 0.05 and importFRACICEdexceeds it (TAU_SST:default 432000 s,TAU_SST_UNDER_ICE:default 86400 s);DEL_TEMPis 0 elsewhere. Then runOCNphase 2, which addsDEL_TEMPto the top temperature level.Runphase 2 (predictor): runOCNdphase 1 and its couplers only.
Selection is made twice: OGCM reads the keys for connections, OCEAN for the child (3.2, 3.5).
DATASEA |
MOM |
MOM6 |
MIT |
|
|---|---|---|---|---|
| Directory, module | GEOSdatasea_GridComp, GEOS_DataSeaGridCompMod |
MOM_GEOS5PlugMod, MOM_GEOS5PlugMod |
MOM6_GEOSPlug, MOM6_GEOSPlugMod |
MIT_GEOS5PlugMod, MIT_GEOS5PlugMod |
| Wraps | Nothing: reads SST (and optionally SSS) data | MOM5 (@mom) with FMS |
MOM6 (@mom6) with FMS, optional @stochastic_physics |
MITgcm (@mit) through generated driver code |
| Selected by | USE_DATASEA: /= 0 (default 1) |
USE_DATASEA: 0 and OCEAN_NAME: MOM (default) |
USE_DATASEA: 0 and OCEAN_NAME: MOM6 |
USE_DATASEA: 0, OCEAN_NAME: MIT, and build option BUILD_MIT_OCEAN |
| Added as child | static SS=DataSeaSetServices |
shared object libMOM_GEOS5PlugMod.so, key MOM_GEOS5PLUGMOD:, symbol setservices_ |
shared object libMOM6_GEOSPlug.so, key MOM6_GEOSPLUG:, symbol setservices_ |
static SS=MITSetServices |
| State specs | GEOS_DataSea_StateSpecs.rc (ACG) |
MOM_GEOS5PlugMod_StateSpecs.rc (ACG, import and export only) |
MOM6_GEOSPlug_StateSpecs.rc (ACG) |
hand-written MAPL_Add*Spec in SetServices |
| Restarts | None of its own | Model files via ocean_model_restart (Record), ocean_model_end (Finalize) |
same pattern | Internal FRACICE, VOLICE; Record and Finalize do no model I/O |
Entry points, imports, exports and build details are in section 5 and 8; the *_StateSpecs.rc files (and, for MIT, SetServices) are the source of truth for field lists.
- Purpose: stands in for an ocean by passing sea surface temperature and, optionally, salinity and surface currents to the rest of the
coupled system (
GEOS_DataSeaGridComp.F90,RUNdescription: "Periodically refreshes the SST, sea ice and optionally SSS from dataset(s)"). It is the default ocean (USE_DATASEAdefaults to 1), used for atmosphere-only (AMIP-style) runs and, in dual-ocean mode, as the second child. SetServices: sets only theRunentry point; readsOCEAN_EXT_DATA:andOCEAN_SSS_DATA:(both default.FALSE.) which are conditions of the ACG importsDATA_SSTandDATA_SSS(GEOS_DataSea_StateSpecs.rc,COND); callsMAPL_GenericSetServices.Run: obtainsSSTfrom the ExtData importDATA_SSTifOCEAN_EXT_DATA, else from the binary file named byDATA_SST_FILE:withMAPL_ReadForcing(OGCM_IS_FCST:selectsINIT_ONLY);SSSfromDATA_SSSifOCEAN_SSS_DATA, elseSW = 30.0.UW,VWcome fromDATA_UW,DATA_VW, set to 0 where the speed is 10 m s-1 or more.SST_ADJ_UND_ICE:(default 0): 1 limits SST to the freezing value and blends it withFRACICE; 2 relaxes toward it withCTB:(default 1.0e-4) andDT:. ExportsTW = SST,SW.- State: no internal state, nothing checkpointed (
GEOS_DataSea_StateSpecs.rc, emptycategory: INTERNAL). - ExtData:
DataSea_ExtData.yamlpointsDATA_UWandDATA_VWat collection/dev/null; it is installed toetc(CMakeLists.txt) and listed insrc/Applications/@GEOSgcm_App/construct_extdata_yaml_list.py. Unverified: where the ExtData entries forDATA_SSTandDATA_SSScome from; none is in this repository or inAGCM.rc.tmpl/gcm_setup(grep ofOCEAN_EXT_DATA,DATA_SST). - Coupling:
FRACICEimport comes fromSEAICEviaOGCM's connection.OGCMleavesDATA_UW DATA_VWunterminated whenOCEAN_EXT_DATAis false, andDATA_SST(withDATA_SSSwhenOCEAN_SSS_DATA) when it is true; all other unconnected imports are terminated (3.5).
- Purpose: wraps MOM5 (
@mom). Header: "MAPL/ESMF Gridded Component that acts as a wrapper for MOM. ... heavy dependencies on FMS and MOM" (MOM_GEOS5PlugMod.F90).gcm_setupprints a warning that a MOM5 coupled set-up "is known to have problems" and refers to an issue in the MOM5 repository (src/Applications/@GEOSgcm_App/gcm_setup,OCNMODELbranchMOM5); Unverified: the content of that issue. - Selection and loading: section 4. A free
subroutine SetServicesat the end of the file calls the module'sSetServices(Inferred: so the shared object has the symbolsetservices_thatMAPL_AddChildlooks up). SetServices: readsDUAL_OCEAN:; ACG import and export specs; entry pointsInitialize,Run,Finalize, write-restartRecord, andRun2as a second run phase when dual (SetServices).Initialize: takes the FMS layout fromMAPL_Get(NX, NY), the date from the clock,fms_initwith the VM's MPI communicator,ocean_model_init, checks MOM's local size against the MAPL grid (assertions), allocates the flux "bulletin board"Ice_ocean_boundary, callsMAPL_GenericInitialize, then fillsTW SW DH MOM_3D_MASK AREAand the other exports early because the parent reads them before the firstRun.Run: converts to MOM units and sign:salt_flux = -SFLX,lw_flux,t_flux,q_flux,lprec,fprec,runoff, shortwave components (PENUVR+PENPARas visible direct, ...), pressureP = MOM_PICE_SCALING * PICE(key default 1.0); builds the shortwave decay fractionswheat_frfromSWHEATand surface shortwave, subtracts the surface flux from level 1 ofSWHEAT; converts the A-grid stress to B-grid (transformA2B), rotates it withcos_rot/sin_rotand combines it with ice-base stress:U_flux = (...)*(1 - AICEU) - STROCNXB; copies theTRbundle into MOM tracers namedGENtracer_NNN, callsupdate_ocean_model(skipped whensteady_state_ocean:/= 0), copies tracers back, and fills exports (B-grid and A-grid surface currents,TW,SW,SSH,SLV,FRZMLT,DH,T,S,RHO,HC,MLD, ...). Header notes (Unverified:) thatMLDis the KPP boundary layer depth andPSIis not filled.Run2(dual only): addsDEL_TEMPto the top level of MOM's temperature tracer (mom4_put_prog_tracer).Finalize:ocean_model_end,diag_manager_end,field_manager_end,fms_io_exit(fms_endis commented out), thenMAPL_GenericFinalize.- Restarts:
Recordcallsocean_model_restart(Ocean_State, timeStamp)whenMAPL_RecordAlarmIsRinging(MODE=MAPL_Write2Disk)is true;ocean_model_endis also called inFinalize. No MAPL internal state.gcm_run.jcopies$EXPDIR/RESTART/*toINPUTbefore the run andRESTART/*toINPUTafter each segment (@COUPLEDlines). Inferred: MOM5 reads its restart fromINPUTduringocean_model_init. - Run-time model configuration:
gcm_setupcopiesinput.nmland the*tablefiles from$ETCDIR/MOM5/geos5/<IM>x<JM>/INPUT;@mom/CMakeLists.txtinstallsdata/geos5toetc/MOM5. The grid fileMAPL_Tripolar.nc(OGCM.GRIDSPECinAGCM.rc.tmpl) is made withmom_app/mkMAPLTripolar/mkMAPLTripolarMOM5.py. - Trap:
TRis a bundle of references;Runcopies its arrays into MOM tracers beforeupdate_ocean_modeland back afterwards.
- Purpose: wraps MOM6 (
@mom6) through its FMS driver (ocean_model_MOM.F90,FMS_cap); header: "acts as a coupler for MOM" (MOM6_GEOSPlug.F90). The CI coupled run usesgcm_ocean_type: MOM6(.circleci/config.yml). - Selection and loading: section 4; the free
SetServicesat the end of the file (itusesMOM6_GEOSPlugMod). SetServices: readsDUAL_OCEAN:; ACG imports, exports (MOM6_GEOSPlug_StateSpecs.rc); entry points as forMOM.Initialize:MOM_infra_init,field_manager_init,MOM_diag_manager_init; checksocean_wind_stagger:(defaultAGRID;BGRID/CGRIDstop with a message, other values are errors);ocean_model_init(..., iwind_stagger),ocean_model_init_sfc; savesOcean_Statein the private state type; checks the local domain against the MAPL grid; allocatesBoundaryover the data domain (g_isd:g_ied, g_jsd:g_jed);MAPL_GenericInitialize; fillsMOM_2D_MASK,TW,SW,AREA,SLV,DH,T,S.Run: same conversion pattern asMOM, pluscalving; stress on the waterU = TAUX*(1-AICE) - TAUXBOT*AICE(A-grid), rotated withcos_rot,sin_rot; boundary pressure fromMOM_PICE_SCALING:(default 1.0) timesPICE, plusPSwhenpres_loading:isYES(defaultNO);DTFREEZE_DS:(default -0.054);update_ocean_modelunlesssteady_state_ocean:/= 0 (the other branch calls it with two extra.false.arguments; source comment: "though this will cause MOM_FATAL error"). ExportsFRAZILandMELT_POTfrom heat fluxes,FRZMLT=MELT_POTor, whereFRAZIL > 0,FRAZIL;T_Freeze = dTf_dS*SW(where mask > 0, else -1.8);UWC/VWC.Run2(dual only): addsDEL_TEMPto level 1 of thetempprognostic tracer.Finalize:ocean_model_end("this also calls ocean_model_save_restart", source comment),MOM_diag_manager_end,field_manager_end,io_infra_end, deallocatesBoundary.Record:ocean_model_restart(Ocean_State, timeStamp)on the same alarm asMOM.- Restarts and configuration: MOM6 writes
RESTART/;gcm_run.jcopiesMOM_inputandMOM_overrideinto the run directory and setsDTandDT_THERMinMOM_overrideto the heartbeat.gcm_setupcopiesMOM_input,MOM_override,input.nml,*tablefrom$ETCDIR/MOM6/mom6_app/<IM>x<JM>/, plusMOM_saltrestoreandcommon/MOM_dataatmif a data atmosphere is used (CMakeLists.txtinstallsmom6_apptoetc/MOM6). Resolutions present:72x36,540x458,720x576,1440x1080,2880x2240(mom6_app/). - Stochastic physics:
@stochastic_physicsis built into the MOM6 library when found, else MOM6's compile-only stubs are used with a warning (CMakeLists.txt,MOM6_USE_STOCHASTIC_PHYSICS); the plug-in source does not mention it.
- Purpose: wraps MITgcm (
@mit) on anllcocean grid (OGCM_GRID_TYPE = llcforMITingcm_setup;OGCM.GRIDSPEC: mit.asciiinAGCM.rc.tmpl). Header: "wrapper for MITgcm" (MIT_GEOS5PlugMod.F90). Compiled only withBUILD_MIT_OCEAN, and thenMOMandMOM6are not built (CMakeLists.txt). - Link to sea ice: with
BUILD_MIT_OCEANthe sea-ice composite usesMITSEAICEDYNA(GEOSseaice_GridComp/GEOS_SeaIceGridComp.F90,GEOSMITDyna_GridComp), which exports the state containerICESTATES(connectedSEAICE -> OCEAN, 3.5).MIT_GEOS5PlugMod'sInitializereads the attributeICECOMPNAMEfrom it and gets<name>_Importsand<name>_Exports. SetServices: readsDUAL_OCEAN:; declares by hand 19 imports and 17 exports with a table ofmstateentries; every import is also mirrored as an export "for diagnostic purposes"; addsICESTATES(state item),FRACICE/VOLICEexports and internal specs (MAPL_RestartOptional, default 0.0); readsCICE_N_ICE_CATEGORIES:andCICE_N_ICE_LAYERS:unconditionally withESMF_ConfigGetAttribute; entry points as forMOM.Initialize: readsOCEAN_DIR:(template:mitocean_run,@MITline), changes into it (mysetdir),DRIVER_INITwith the MPI communicator, back (popdir),MAPL_GenericInitialize; setsDHfrom hard-wired values (50 m, 70 m, ... 690 m for level 15 and below) and fills<name>_3D_MASK,TW,SWfrom the driver.Run: readsRUN_DT:,OCEAN_DT:,OCEAN_DIR:,ACTIVE_OCEAN:(default 1; with 0 the driver is not run); passes imports and the ice state to the driver withDRIVER_SET_IMPORT_STATE, runsDRIVER_RUN(istate, 1), reads exports withDRIVER_GET_EXPORT_STATE(US VS TS SS MASK, ice tendenciesDEL*,FRZMLT). The weightWGHTis provided byOCEAN(#ifdef BUILD_MIT_OCEAN, 3.4).Run2(dual): addsDEL_TEMPtoTWwhere the mask is positive and passes it withDRIVER_SET_IMPORT_STATE(..., 'TS', T)thenmitgcm_import_fill_ts.Recordevaluates the record alarm and does nothing else;Finalizeonly callsMAPL_GenericFinalize(MIT_GEOS5PlugMod.F90). Unverified: MITgcm's own pickup files are controlled by its namelists (configs/<id>/input/data,pickupStrictlyMatch).- Build and setup:
MIT_CONFIG_IDselectsconfigs/<id>/code(c12_cs32_01, c90_llc90_02/03/05, c180_llc270_01);genmake2and custom targetsmitgcmuv,mitgcmuv_driverbuild the model and the driver library inmitgcm_setup/(CMakeLists.txt); checkout recipes ininstructions/.
@mom, @mom6, @stochastic_physics and @mit are separate repositories (section 1); this repository holds only their wrappers
and configuration. Their own documents (present in a fixture checkout): MOM6_GEOSPlug/@mom6/AGENTS.md, MIT_GEOS5PlugMod/@mit/README.md,
MOM_GEOS5PlugMod/@mom/README.md, MOM6_GEOSPlug/@stochastic_physics/README.md. Change them only in their own repository.
| Key | File that sets it | Read in | Effect |
|---|---|---|---|
USE_DATASEA: (default 1) |
AGCM.rc (@COUPLED USE_DATASEA:0 in AGCM.rc.tmpl) |
GEOS_OceanGridComp.F90, GEOS_OgcmGridComp.F90 |
data ocean or real ocean; read twice |
OCEAN_NAME: (default MOM) |
AGCM.rc (@OCEAN_NAME, set in gcm_setup) |
same two files | MOM, MOM6 or MIT |
MOM_GEOS5PLUGMOD:, MOM6_GEOSPLUG: |
none found in the fixture (defaults used) | GEOS_OceanGridComp.F90 |
shared-library names |
DUAL_OCEAN: (default 0) |
commented hint @MOM5#DUAL_OCEAN: 1 in AGCM.rc.tmpl |
OCEAN, OGCM, each plug-in |
second DATASEA child, phase 2 |
USE_DATA_ATM4OCN: (default false) |
AGCM.rc |
OCEAN, OGCM |
CALVING import, unweighted discharge |
OCEAN_EXT_DATA:, OCEAN_SSS_DATA: |
none found in AGCM.rc.tmpl, gcm_setup |
DATASEA, OGCM, ocean radiation, data sea ice |
data source (ExtData or file) and which imports are left unterminated |
OCEAN_DT: (default RUN_DT:) |
not in AGCM.rc.tmpl (it sets OGCM_RUN_DT:) |
OCEAN, MIT |
private clock step |
OGCM_TOP_LAYER: (default 10.0), TAU_SST:, TAU_SST_UNDER_ICE: |
none found | GEOS_OceanGridComp.F90 |
orphan-point depth, dual-ocean relaxation |
ocean_wind_stagger: (default AGRID), pres_loading: (default NO), DTFREEZE_DS:, MOM_PICE_SCALING: (default 1.0), steady_state_ocean: (default 0) |
only steady_state_ocean: 0 and OCEAN_PICE_SCALING: 0.0 are in AGCM.rc.tmpl (@COUPLED lines) |
plug-ins (5.2, 5.3) | scheme options |
Resource lookup tries the component name as a prefix: MAPL_GetResource on a component passes its child name (MOM, MOM6, MIT,
OCEAN, DATASEA) and tries <name>_<label>, <type>_<label>, the bare label, then <name>.<label>
(src/Shared/@MAPL/generic/MAPL_Generic.F90, MAPL_GetResource with component_name = state%compname;
src/Shared/@MAPL/base/MAPL_Resource.F90, get_labels_with_prefix).
CMakeLists.txt: optionBUILD_MIT_OCEAN(default OFF). OFF: libraryGEOS_OceanGridCompfromGEOS_OceanGridComp.F90withSUBCOMPONENTS MOM6_GEOSPlug MOM_GEOS5PlugMod GEOSdatasea_GridComp. ON: definesBUILD_MIT_OCEAN, subcomponentsMIT_GEOS5PlugMod GEOSdatasea_GridComponly.mapl_acgruns onGEOS_Ocean_StateSpecs.rc.MOM_GEOS5PlugMod:TYPE SHARED,SUBCOMPONENTS @mom, compiled with the real-8 flags (FREAL8); source list plus an optionalseawater.F90if present;mapl_acgfor imports and exports only.MOM6_GEOSPlug:TYPE SHARED, depends onMAPL,FMS::fms_r8and the targetmom6, whichmom6_cmake/CMakeLists.txtbuilds from an explicit list of@mom6sources (infrastructureMOM6_INFRAisFMS1orFMS2, defaultFMS2). Real-8 flags; installsmom6_apptoetc/MOM6.MIT_GEOS5PlugMod: returns early with a message ifMIT_CONFIG_IDis not defined; depends on custom targetsmitgcmuvandmitgcmuv_driver; build options by compiler (build_options.gnu,build_options.intel).- The shared-object plug-ins are also listed as
SUBCOMPONENTS; whether the executable therefore links them is Unverified: in the fixture architecture (../../../../../../docs/ARCHITECTURE.mdin the fixture), section 3 ("Plug-ins loaded by name"). - Tests and CI: no unit-test target in this repository's own
CMakeLists.txtfiles..github/workflows/workflow.yml: fixture builds (ifort,gfortran-15,ifx, Debug) and a spack build;.circleci/config.yml: fixture build, atmosphere-only run, coupled run withgcm_ocean_type: MOM6.
- Selection is read in several places.
USE_DATASEA,OCEAN_NAME,USE_DATA_ATM4OCNandDUAL_OCEANare read byOGCM, byOCEANand (forDUAL_OCEAN) by each plug-in. Defaults agree today (GEOS_OgcmGridComp.F90,GEOS_OceanGridComp.F90); the source comment asks that they change together. OCEAN's imports are not only its.rcfile. Unconnected child imports are promoted to it (3.3); adding or removing a plug-in import changes whatOGCMmust provide, andOGCM's connections to names a child does not have are relaxed rather than failing (src/Shared/@MAPL/generic/VarConn.F90,checkReq).- Module state.
OCEAN_NAME,DO_DATASEA,OCN,OCNd,DUAL_OCEAN,OrphanDepthare module variables (alsoDUAL_OCEANin each plug-in). Inferred: oneOCEANinstance per executable. - Weighting. Fluxes handed to the real ocean are multiplied by
FROCEAN/MASK(3.4); exports are written back only whereWGHT > 0, so other points keep their earlier or default values. - Mask names differ.
MOM_3D_MASK,MIT_3D_MASK(built from the component name) andMOM_2D_MASK(MOM6);OCEANselects byOCEAN_NAME. - Precision. The
MOM/MOM6plug-ins are compiled with the real-8 flags (FREAL8, theirCMakeLists.txt) and declare GEOS-side fields asreal(kind=4)(G5KIND,GeosKind); conversions are explicit inRun. - Clocks. Ordinary mode runs the child with
OCEAN's private clock (stepOCEAN_DT); dual-ocean mode with the supervisorCLOCK. - Phase numbers.
RunreadscurrentPhaseand subtracts 10 if it is 10 or more ("to be replaced by MAPL get_phase").
Decisions: decisions.md.
OCEAN'sRunfetchesCALVINGfrom the child's import state for every non-data ocean (MAPL_GetPointer(GIM(OCN), CALVING, 'CALVING')withoutnotFoundOK);MOM6_GEOSPlug_StateSpecs.rcdeclaresCALVING, butMOM_GEOS5PlugMod_StateSpecs.rcandMIT_GEOS5PlugMod.F90do not (grep). What happens forOCEAN_NAMEMOMorMIT? (The CI coupled run usesMOM6only:.circleci/config.yml.)- The orphan-point block assigns
FRZMLTewithout anassociatedtest, while the earlierFRZMLTblock tests it (GEOS_OceanGridComp.F90,Run). Is theFRZMLTexport always allocated at that point? MOM_GEOS5PlugMod.F90declaresOcean_Stateas a local pointer inInitialize,Run,FinalizeandRecord, without=> null(). OnlyInitializepasses it, uninitialized, toocean_model_init(which may set it); the other routines have no assignment to it. The private state type holds onlyOceanandIce_ocean_boundary.MOM6_GEOSPlug.F90storesOcean_Statein its private state. MOM5'socean_model_inittestsassociated(Ocean_state)and otherwise allocates (@mom/src/mom5/ocean_core/ocean_model.F90). What is the intended lifetime ofOcean_Statein the MOM5 plug-in?OCEAN_PICE_SCALING: 0.0is set inAGCM.rc.tmpl; the plug-ins readMOM_PICE_SCALING:with default 1.0 and no source in the fixture readsOCEAN_PICE_SCALING(grep;src/Applications/@UMD_Etc/UMD_rc/AGCM.rcsetsMOM_PICE_SCALING). No code inGEOSogcm_GridCompfills thePICEimport (grep ofGEOS_OgcmGridComp.F90,GEOS_OceanGridComp.F90, the sea-ice composite); theMOM6source comment says "PICE that is available here is all = 0". Unverified: what providesPICE. Which key is meant to scale ice pressure?MOM/MOM6/MITplug-in module headers say "It does not use the configuration" although each reads resources (DUAL_OCEAN:, ...).OCEANRun: theselect case (trim(OCEAN_NAME))for the heating copy lists"DATASEA", but sits inside theDO_DATASEA == 0branch whereOCEAN_NAMEis neverDATASEA. ForMOM6theSWHEATcopy is skipped, whileHEATe = HEATstill runs when theSWHEATexport is requested; theMOM6plug-in'sSWHEATimport is declared asDUMMY_IMPORT_solar_heating_rate(MOM6_GEOSPlug_StateSpecs.rc). What is the role ofSWHEATforMOM6?MIT_GEOS5PlugMod.F90,Run2:Tpoints to the exportTW(MAPL_GetPointer(EXPORT, T, 'TW')) anddeallocate(T)follows. What owns that memory?MIT_GEOS5PlugMod.F90:InitializeoverwritesDHwith hard-wired thicknesses;RecordandFinalizedo no model I/O.MIT_GEOS5PlugMod/CMakeLists.txthaselseif()with no condition afterif(CMAKE_BUILD_TYPE MATCHES "Debug"), and setsFCtoifort/iccfor any compiler id that matchesIntel.OCEANRun:T_Freeze_eis looked up only whenOCEAN_NAME == "MOM6"and nullified otherwise (with the data oceanOCEAN_NAMEisDATASEA), so the branchT_Freeze_e = -1.8forDO_DATASEA /= 0appears unreachable. What is the intendedT_Freezeexport for the data ocean?OGCM file,SetServices: the connection list in theelsebranch is commented! MOM6but also applies toMIT. In theOCEAN_EXT_DATAblock (data ocean) the call labelled "both data_sss and data_sit" follows the two innerifblocks and is not inside anelse, so it also runs when only one of the two is set; Inferred: each "all but" call terminates every import outside its own list, so the net set left unterminated is the intersection of the lists and the unconditional call changes nothing in the two single-flag cases.
- Which of
MOM(a warning about known problems is printed bygcm_setup) andMITare supported configurations today, and is either exercised by a test? - Where are
OCEAN_EXT_DATAand the ExtData entries forDATA_SSTandDATA_SSSmeant to be set?