From c681eaa5faf4423b34af12ad0d1e57729f3841f9 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Tue, 3 Dec 2019 23:52:16 +0000 Subject: [PATCH 01/68] Remove an outdated comment. --- HierarchyProto/esmApp.F90 | 1 - 1 file changed, 1 deletion(-) diff --git a/HierarchyProto/esmApp.F90 b/HierarchyProto/esmApp.F90 index 75de1114..396853ae 100644 --- a/HierarchyProto/esmApp.F90 +++ b/HierarchyProto/esmApp.F90 @@ -54,7 +54,6 @@ program esmApp !----------------------------------------------------------------------------- - ! need to add "density" to the NUOPC Field Dictionary ! Create the earth system Component esmComp = ESMF_GridCompCreate(name="esm", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & From d6ec6e81b9b3366f9b48cf0f9710934e7917a5fe Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Tue, 17 Dec 2019 23:48:04 +0000 Subject: [PATCH 02/68] Adapt to the TransferOffer attribute change. --- AsyncIOBlockingProto/asyncIODriver.F90 | 6 ++-- AsyncIOBlockingProto/io.F90 | 49 ++++++++++++++++++++++---- AtmOcnMirrorFieldsProto/atm.F90 | 16 ++++----- AtmOcnTransferGridProto/atm.F90 | 4 +-- AtmOcnTransferLocStreamProto/atm.F90 | 2 +- AtmOcnTransferMeshProto/atm.F90 | 2 +- ExternalDriverAPIProto/externalApp.F90 | 4 +-- 7 files changed, 60 insertions(+), 23 deletions(-) diff --git a/AsyncIOBlockingProto/asyncIODriver.F90 b/AsyncIOBlockingProto/asyncIODriver.F90 index 61cbfeb1..a881244d 100644 --- a/AsyncIOBlockingProto/asyncIODriver.F90 +++ b/AsyncIOBlockingProto/asyncIODriver.F90 @@ -128,7 +128,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompAttributeSet(child, name="Verbosity", value="1", rc=rc) + call NUOPC_CompAttributeSet(child, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -156,7 +156,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompAttributeSet(child, name="Verbosity", value="1", rc=rc) + call NUOPC_CompAttributeSet(child, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -170,7 +170,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompAttributeSet(connector, name="Verbosity", value="1", rc=rc) + call NUOPC_CompAttributeSet(connector, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & diff --git a/AsyncIOBlockingProto/io.F90 b/AsyncIOBlockingProto/io.F90 index 7a4e8b4c..d41a6c91 100644 --- a/AsyncIOBlockingProto/io.F90 +++ b/AsyncIOBlockingProto/io.F90 @@ -185,14 +185,35 @@ subroutine checkConnectedFlagProvide(state, rc) character(len=80) :: stateName type(ESMF_Field) :: field character(len=80) :: connectedValue - character(len=20) :: transferAction + character(len=80) :: transferAction character(len=80), allocatable :: itemNameList(:) type(ESMF_StateItem_Flag), allocatable :: itemTypeList(:) type(ESMF_Config) :: config integer :: gridDims(2) type(ESMF_Grid) :: gridIn - + type(ESMF_StateIntent_Flag) :: stateIntent + character(len=80) :: transferActionAttr + if (present(rc)) rc = ESMF_SUCCESS + + call ESMF_StateGet(state, stateIntent=stateIntent, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + if (stateIntent==ESMF_STATEINTENT_EXPORT) then + transferActionAttr="ProducerTransferAction" + elseif (stateIntent==ESMF_STATEINTENT_IMPORT) then + transferActionAttr="ConsumerTransferAction" + else + call ESMF_LogSetError(ESMF_RC_ARG_BAD, & + msg="The stateIntent must either be IMPORT or EXPORT here.", & + line=__LINE__, & + file=__FILE__, & + rcToReturn=rc) + return ! bail out + endif call ESMF_StateGet(state, name=stateName, nestedFlag=.true., & itemCount=itemCount, rc=rc) @@ -233,7 +254,7 @@ subroutine checkConnectedFlagProvide(state, rc) file=__FILE__)) & return ! bail out else - call NUOPC_GetAttribute(field, name="TransferActionGeomObject", & + call NUOPC_GetAttribute(field, name=transferActionAttr, & value=transferAction, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -332,7 +353,7 @@ subroutine adjustAcceptedGeom(state, rc) ! local variables integer :: itemCount, item type(ESMF_Field) :: field - character(len=20) :: transferAction + character(len=80) :: transferAction character(len=80), allocatable :: itemNameList(:) type(ESMF_StateItem_Flag), allocatable :: itemTypeList(:) type(ESMF_GeomType_Flag) :: geomtype @@ -342,14 +363,30 @@ subroutine adjustAcceptedGeom(state, rc) type(ESMF_DistGrid) :: distgrid integer :: dimCount, tileCount integer, allocatable :: minIndexPTile(:,:), maxIndexPTile(:,:) + type(ESMF_StateIntent_Flag) :: stateIntent + character(len=80) :: transferActionAttr if (present(rc)) rc = ESMF_SUCCESS - call ESMF_StateGet(state, nestedFlag=.true., itemCount=itemCount, rc=rc) + call ESMF_StateGet(state, nestedFlag=.true., itemCount=itemCount, & + stateIntent=stateIntent, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out + + if (stateIntent==ESMF_STATEINTENT_EXPORT) then + transferActionAttr="ProducerTransferAction" + elseif (stateIntent==ESMF_STATEINTENT_IMPORT) then + transferActionAttr="ConsumerTransferAction" + else + call ESMF_LogSetError(ESMF_RC_ARG_BAD, & + msg="The stateIntent must either be IMPORT or EXPORT here.", & + line=__LINE__, & + file=__FILE__, & + rcToReturn=rc) + return ! bail out + endif allocate(itemNameList(itemCount), itemTypeList(itemCount)) @@ -369,7 +406,7 @@ subroutine adjustAcceptedGeom(state, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_GetAttribute(field, name="TransferActionGeomObject", & + call NUOPC_GetAttribute(field, name=transferActionAttr, & value=transferAction, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & diff --git a/AtmOcnMirrorFieldsProto/atm.F90 b/AtmOcnMirrorFieldsProto/atm.F90 index 16e22604..2e97b62c 100644 --- a/AtmOcnMirrorFieldsProto/atm.F90 +++ b/AtmOcnMirrorFieldsProto/atm.F90 @@ -201,14 +201,14 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) ! finds on the other side of the connection (i.e. in the Connector's ! importState). ! Mirrored fields are automatically advertised with the - ! "TransferOfferGeomObject" attribute set to be "opposite" to what the + ! "TransferOffer" attribute set to be "opposite" to what the ! original field was advertised with. Here this means that the - ! TransferOfferGeomObject attribute is set to "cannot provide" for all of + ! TransferOffer attribute is set to "cannot provide" for all of ! the mirrored fields (because the OCN component was advertising with the ! default of "will provide"). - ! However, the automatically set "TransferOfferGeomObject" attribute can be + ! However, the automatically set "TransferOffer" attribute can be ! overwritten here. E.g. explicitly setting - ! TransferOfferGeomObject = "will provide" here allows the component to set + ! TransferOffer = "will provide" here allows the component to set ! its own grid for the mirrored fields. ! air_pressure_at_sea_level @@ -218,8 +218,8 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - ! set TransferOfferGeomObject = "will provide" - call NUOPC_SetAttribute(field, name="TransferOfferGeomObject", & + ! set ProducerTransferOffer = "will provide" + call NUOPC_SetAttribute(field, name="ProducerTransferOffer", & value="will provide", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -233,8 +233,8 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - ! set TransferOfferGeomObject = "will provide" - call NUOPC_SetAttribute(field, name="TransferOfferGeomObject", & + ! set ProducerTransferOffer = "will provide" + call NUOPC_SetAttribute(field, name="ProducerTransferOffer", & value="will provide", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & diff --git a/AtmOcnTransferGridProto/atm.F90 b/AtmOcnTransferGridProto/atm.F90 index e2bb83c5..d09bb124 100644 --- a/AtmOcnTransferGridProto/atm.F90 +++ b/AtmOcnTransferGridProto/atm.F90 @@ -239,7 +239,7 @@ subroutine InitializeP3(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_GetAttribute(field, name="TransferActionGeomObject", & + call NUOPC_GetAttribute(field, name="ConsumerTransferAction", & value=transferAction, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -741,7 +741,7 @@ subroutine InitializeP4(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_GetAttribute(field, name="TransferActionGeomObject", & + call NUOPC_GetAttribute(field, name="ConsumerTransferAction", & value=transferAction, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & diff --git a/AtmOcnTransferLocStreamProto/atm.F90 b/AtmOcnTransferLocStreamProto/atm.F90 index 2f344433..98b143a8 100644 --- a/AtmOcnTransferLocStreamProto/atm.F90 +++ b/AtmOcnTransferLocStreamProto/atm.F90 @@ -215,7 +215,7 @@ subroutine InitializeP3(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_GetAttribute(field, name="TransferActionGeomObject", & + call NUOPC_GetAttribute(field, name="ConsumerTransferAction", & value=transferAction, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & diff --git a/AtmOcnTransferMeshProto/atm.F90 b/AtmOcnTransferMeshProto/atm.F90 index 82b4f251..eae4df16 100644 --- a/AtmOcnTransferMeshProto/atm.F90 +++ b/AtmOcnTransferMeshProto/atm.F90 @@ -241,7 +241,7 @@ subroutine InitializeRealizeForProvide(model, importState, exportState, clock, r line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_GetAttribute(field, name="TransferActionGeomObject", & + call NUOPC_GetAttribute(field, name="ConsumerTransferAction", & value=transferAction, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & diff --git a/ExternalDriverAPIProto/externalApp.F90 b/ExternalDriverAPIProto/externalApp.F90 index 0d1ff4f0..e70d8f5d 100644 --- a/ExternalDriverAPIProto/externalApp.F90 +++ b/ExternalDriverAPIProto/externalApp.F90 @@ -74,12 +74,12 @@ program externalApp call ESMF_Finalize(endflag=ESMF_END_ABORT) ! Create the earth system import/export States - esmImportState = ESMF_StateCreate(rc=rc) + esmImportState = ESMF_StateCreate(stateintent=ESMF_STATEINTENT_IMPORT, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - esmExportState = ESMF_StateCreate(rc=rc) + esmExportState = ESMF_StateCreate(stateintent=ESMF_STATEINTENT_EXPORT, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & From 0504f58bdde210693478eb61815cb09a1e35b528 Mon Sep 17 00:00:00 2001 From: Ben Koziol Date: Fri, 17 Jan 2020 15:51:23 +0000 Subject: [PATCH 03/68] Branch for Info-JSON development issues --- AtmOcnMirrorFieldsProto/esm.F90 | 4 ++-- AtmOcnPetListProto/esm.F90 | 4 ++-- AtmOcnTransferGridProto/esm.F90 | 8 ++++---- HierarchyProto/esm.F90 | 2 +- SingleModelOpenMPProto/driver.F90 | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/AtmOcnMirrorFieldsProto/esm.F90 b/AtmOcnMirrorFieldsProto/esm.F90 index 4a6f9221..c9866a1d 100644 --- a/AtmOcnMirrorFieldsProto/esm.F90 +++ b/AtmOcnMirrorFieldsProto/esm.F90 @@ -100,7 +100,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call ESMF_AttributeSet(info, name="maxPeCountPerPet", value=2, rc=rc) + call ESMF_InfoSet(info, key="maxPeCountPerPet", value=2, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -138,7 +138,7 @@ subroutine SetModelServices(driver, rc) deallocate(petList) ! SetServices for OCN with petList on second half of PETs - call ESMF_AttributeSet(info, name="maxPeCountPerPet", value=4, rc=rc) + call ESMF_InfoSet(info, key="maxPeCountPerPet", value=4, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & diff --git a/AtmOcnPetListProto/esm.F90 b/AtmOcnPetListProto/esm.F90 index 5087c788..ed9c41eb 100644 --- a/AtmOcnPetListProto/esm.F90 +++ b/AtmOcnPetListProto/esm.F90 @@ -112,7 +112,7 @@ subroutine SetModelServices(driver, rc) do i=1, petCount/2 petList(i) = i-1 ! PET labeling goes from 0 to petCount-1 enddo - call ESMF_AttributeSet(info, name="maxPeCountPerPet", value=2, rc=rc) + call ESMF_InfoSet(info, key="maxPeCountPerPet", value=2, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -200,7 +200,7 @@ subroutine SetModelServices(driver, rc) do i=1, petCount/2 petList(i) = petCount/2 + i-1 ! PET labeling goes from 0 to petCount-1 enddo - call ESMF_AttributeSet(info, name="maxPeCountPerPet", value=2, rc=rc) + call ESMF_InfoSet(info, key="maxPeCountPerPet", value=2, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & diff --git a/AtmOcnTransferGridProto/esm.F90 b/AtmOcnTransferGridProto/esm.F90 index daa23d8b..7fb61407 100644 --- a/AtmOcnTransferGridProto/esm.F90 +++ b/AtmOcnTransferGridProto/esm.F90 @@ -109,9 +109,9 @@ subroutine SetModelServices(driver, rc) return ! bail out #define MORE_THAN_ONE_PE_PER_PET_WORKING_ATM #ifdef MORE_THAN_ONE_PE_PER_PET_WORKING_ATM - call ESMF_AttributeSet(info, name="maxPeCountPerPet", value=2, rc=rc) + call ESMF_InfoSet(info, key="maxPeCountPerPet", value=2, rc=rc) #else - call ESMF_AttributeSet(info, name="maxPeCountPerPet", value=1, rc=rc) + call ESMF_InfoSet(info, key="maxPeCountPerPet", value=1, rc=rc) #endif if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -149,9 +149,9 @@ subroutine SetModelServices(driver, rc) #define MORE_THAN_ONE_PE_PER_PET_WORKING_OCN #ifdef MORE_THAN_ONE_PE_PER_PET_WORKING_OCN - call ESMF_AttributeSet(info, name="maxPeCountPerPet", value=2, rc=rc) + call ESMF_InfoSet(info, key="maxPeCountPerPet", value=2, rc=rc) #else - call ESMF_AttributeSet(info, name="maxPeCountPerPet", value=1, rc=rc) + call ESMF_InfoSet(info, key="maxPeCountPerPet", value=1, rc=rc) #endif if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & diff --git a/HierarchyProto/esm.F90 b/HierarchyProto/esm.F90 index 0d8494fa..2144d3d5 100644 --- a/HierarchyProto/esm.F90 +++ b/HierarchyProto/esm.F90 @@ -134,7 +134,7 @@ subroutine SetModelServices(driver, rc) do i=1, petCountOCN petList(i) = petCountATM + i-1 ! PET labeling goes from 0 to petCount-1 enddo - call ESMF_AttributeSet(info, name="maxPeCountPerPet", value=2, rc=rc) + call ESMF_InfoSet(info, key="maxPeCountPerPet", value=2, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & diff --git a/SingleModelOpenMPProto/driver.F90 b/SingleModelOpenMPProto/driver.F90 index edc12877..97d230bc 100644 --- a/SingleModelOpenMPProto/driver.F90 +++ b/SingleModelOpenMPProto/driver.F90 @@ -99,7 +99,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call ESMF_AttributeSet(info, name="maxPeCountPerPet", value=2, rc=rc) + call ESMF_InfoSet(info, key="maxPeCountPerPet", value=2, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & From f0a6136f5ee3cdb54f7d1826f154ee59d62bd700 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Mon, 10 Feb 2020 20:22:44 +0000 Subject: [PATCH 04/68] Bring the code more in line with recent versions of ESMF/NUOPC. Also try to fix some of the obvious issue. However, it still does not run to completion, failing in the RegridStore(). There is a lot to be cleaned up before this will function correctly, and before this can be included as one of the officially released prototypes. --- AtmOcnMedTransferGridMakeMeshProto/atm.F90 | 6 +- AtmOcnMedTransferGridMakeMeshProto/esm.F90 | 2 + AtmOcnMedTransferGridMakeMeshProto/med.F90 | 71 ++++++++++++++++------ AtmOcnMedTransferGridMakeMeshProto/ocn.F90 | 2 +- 4 files changed, 60 insertions(+), 21 deletions(-) diff --git a/AtmOcnMedTransferGridMakeMeshProto/atm.F90 b/AtmOcnMedTransferGridMakeMeshProto/atm.F90 index 87a77be4..294b6c52 100644 --- a/AtmOcnMedTransferGridMakeMeshProto/atm.F90 +++ b/AtmOcnMedTransferGridMakeMeshProto/atm.F90 @@ -245,14 +245,14 @@ subroutine InitializeP3(model, importState, exportState, clock, rc) ! importable field: sea_surface_temperature ! This Field was marked with TransferOfferGeomObject="can provide", so here - ! we need to see what TransferActionGeomObject the Connector determined for + ! we need to see what ConsumerTransferAction the Connector determined for ! this Field: call ESMF_StateGet(importState, field=field, itemName="sst", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_GetAttribute(field, name="TransferActionGeomObject", & + call NUOPC_GetAttribute(field, name="ConsumerTransferAction", & value=transferAction, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -748,7 +748,7 @@ subroutine InitializeP4(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_GetAttribute(field, name="TransferActionGeomObject", & + call NUOPC_GetAttribute(field, name="ConsumerTransferAction", & value=transferAction, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & diff --git a/AtmOcnMedTransferGridMakeMeshProto/esm.F90 b/AtmOcnMedTransferGridMakeMeshProto/esm.F90 index d2aff6d1..62c844bc 100644 --- a/AtmOcnMedTransferGridMakeMeshProto/esm.F90 +++ b/AtmOcnMedTransferGridMakeMeshProto/esm.F90 @@ -288,6 +288,7 @@ subroutine ModifyCplLists(driver, rc) return ! bail out ! go through all of the entries in the cplList do j=1, cplListSize +#if 0 if (trim(cplList(j))=="precipitation_flux") then ! switch remapping to redist, b/c arbDistr Grid cplList(j) = trim(cplList(j))//":REMAPMETHOD=redist" @@ -301,6 +302,7 @@ subroutine ModifyCplLists(driver, rc) ! switch remapping to redist, b/c can have holes in index space cplList(j) = trim(cplList(j))//":REMAPMETHOD=redist" endif +#endif enddo ! store the modified cplList in CplList attribute of connector i call NUOPC_CompAttributeSet(connectorList(i), & diff --git a/AtmOcnMedTransferGridMakeMeshProto/med.F90 b/AtmOcnMedTransferGridMakeMeshProto/med.F90 index dacbf98c..bf4cdedb 100644 --- a/AtmOcnMedTransferGridMakeMeshProto/med.F90 +++ b/AtmOcnMedTransferGridMakeMeshProto/med.F90 @@ -296,11 +296,32 @@ subroutine checkConnectedFlagProvide(state, rc) character(len=80) :: stateName type(ESMF_Field) :: field character(len=80) :: connectedValue - character(len=20) :: transferAction + character(len=80) :: transferAction character(len=80), allocatable :: itemNameList(:) type(ESMF_StateItem_Flag), allocatable :: itemTypeList(:) + type(ESMF_StateIntent_Flag) :: stateIntent + character(len=80) :: transferActionAttr if (present(rc)) rc = ESMF_SUCCESS + + call ESMF_StateGet(state, stateIntent=stateIntent, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + if (stateIntent==ESMF_STATEINTENT_EXPORT) then + transferActionAttr="ProducerTransferAction" + elseif (stateIntent==ESMF_STATEINTENT_IMPORT) then + transferActionAttr="ConsumerTransferAction" + else + call ESMF_LogSetError(ESMF_RC_ARG_BAD, & + msg="The stateIntent must either be IMPORT or EXPORT here.", & + line=__LINE__, & + file=__FILE__, & + rcToReturn=rc) + return ! bail out + endif call ESMF_StateGet(state, name=stateName, nestedFlag=.true., & itemCount=itemCount, rc=rc) @@ -341,7 +362,7 @@ subroutine checkConnectedFlagProvide(state, rc) file=__FILE__)) & return ! bail out else - call NUOPC_GetAttribute(field, name="TransferActionGeomObject", & + call NUOPC_GetAttribute(field, name=transferActionAttr, & value=transferAction, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -400,7 +421,7 @@ subroutine adjustAcceptedGeom(state, rc) ! local variables integer :: itemCount, item type(ESMF_Field) :: field - character(len=20) :: transferAction + character(len=80) :: transferAction character(len=80), allocatable :: itemNameList(:) type(ESMF_StateItem_Flag), allocatable :: itemTypeList(:) type(ESMF_GeomType_Flag) :: geomtype @@ -413,9 +434,30 @@ subroutine adjustAcceptedGeom(state, rc) integer, allocatable :: minIndexPTile(:,:), maxIndexPTile(:,:) integer, allocatable :: regDecompPTile(:,:) integer :: i, j + type(ESMF_StateIntent_Flag) :: stateIntent + character(len=80) :: transferActionAttr if (present(rc)) rc = ESMF_SUCCESS + call ESMF_StateGet(state, stateIntent=stateIntent, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + if (stateIntent==ESMF_STATEINTENT_EXPORT) then + transferActionAttr="ProducerTransferAction" + elseif (stateIntent==ESMF_STATEINTENT_IMPORT) then + transferActionAttr="ConsumerTransferAction" + else + call ESMF_LogSetError(ESMF_RC_ARG_BAD, & + msg="The stateIntent must either be IMPORT or EXPORT here.", & + line=__LINE__, & + file=__FILE__, & + rcToReturn=rc) + return ! bail out + endif + call ESMF_StateGet(state, nestedFlag=.true., itemCount=itemCount, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -440,7 +482,7 @@ subroutine adjustAcceptedGeom(state, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_GetAttribute(field, name="TransferActionGeomObject", & + call NUOPC_GetAttribute(field, name=transferActionAttr, & value=transferAction, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -653,7 +695,7 @@ subroutine realizeWithAcceptedGeom(state, rc) integer :: itemCount, item, stat, idxns, ii type(ESMF_State) :: nestedState type(ESMF_State) :: nestedStates(4) - type(ESMF_Field) :: field + type(ESMF_Field) :: field, fieldOnMesh type(ESMF_Grid) :: grid type(ESMF_Mesh) :: mesh character(len=80) :: fieldName @@ -681,6 +723,7 @@ subroutine realizeWithAcceptedGeom(state, rc) file=__FILE__)) & return ! bail out + idxns = 0 do item =1, itemCount if(itemTypeList(item) == ESMF_STATEITEM_STATE) then call ESMF_StateGet(state, itemName=itemNameList(item), nestedState=nestedState, rc=rc) @@ -728,19 +771,12 @@ subroutine realizeWithAcceptedGeom(state, rc) file=__FILE__)) & return ! bail out - field = ESMF_FieldCreate(mesh, typekind=ESMF_TYPEKIND_R8, name=FieldName, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_StateRemove(state, itemNameList(item), rc=rc) + fieldOnMesh = ESMF_FieldCreate(mesh, typekind=ESMF_TYPEKIND_R8, name=FieldName, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - ! Find the nested State where this field is contained do ii = 1, idxns call ESMF_StateGet(nestedStates(ii), itemName=fieldName, itemType=itemType, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -754,14 +790,14 @@ subroutine realizeWithAcceptedGeom(state, rc) !call NUOPC_Realize(State, mesh=mesh, selection="realize_connected_remove_others", fieldName=fieldName, rc=rc) !call NUOPC_Realize(State, mesh=mesh, fieldName=fieldName, rc=rc) !call NUOPC_Realize(State, mesh=mesh, fieldName=itemNameList(item), rc=rc) - !call NUOPC_Realize(State, field=field, rc=rc) + call NUOPC_Realize(nestedStates(ii), field=fieldOnMesh, rc=rc) !call NUOPC_Realize(nestedStates(ii), mesh=mesh, fieldName=fieldName, rc=rc) - call NUOPC_Realize(State, mesh=mesh, fieldName=fieldName, rc=rc) + !call NUOPC_Realize(State, mesh=mesh, fieldName=fieldName, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - +#if 0 nullify(ugLBound, ugUBound, gridToFieldMap) ! deal with gridToFieldMap call ESMF_AttributeGet(field, name="GridToFieldMap", & @@ -836,12 +872,13 @@ subroutine realizeWithAcceptedGeom(state, rc) return ! bail out endif deallocate(gridToFieldMap) +#endif endif endif enddo deallocate(itemNameList, itemTypeList) - + end subroutine end subroutine diff --git a/AtmOcnMedTransferGridMakeMeshProto/ocn.F90 b/AtmOcnMedTransferGridMakeMeshProto/ocn.F90 index b21dec17..4521726c 100644 --- a/AtmOcnMedTransferGridMakeMeshProto/ocn.F90 +++ b/AtmOcnMedTransferGridMakeMeshProto/ocn.F90 @@ -9,7 +9,7 @@ !============================================================================== ! Make sure to define test macros consistently across all source files: -#define TEST_GRID_EDGE_WIDTHS +#define TEST_GRID_EDGE_WIDTHS_off #define TEST_GRID_EDGE_WIDTHS_KEEP_FACTORIZED_COORDS___off #define TEST_MULTI_TILE_GRID From 12db72c970ba2e2a8d478e127591619375c8c50e Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Thu, 30 Apr 2020 16:15:01 +0000 Subject: [PATCH 05/68] Build out this proto to test data-initialize with SetVM (i.e. with pthreads). Also show how to access localPe from under user OpenMP threads. --- SingleModelOpenMPProto/driver.F90 | 9 ++-- SingleModelOpenMPProto/model.F90 | 88 +++++++++++++++++++++++++++---- 2 files changed, 83 insertions(+), 14 deletions(-) diff --git a/SingleModelOpenMPProto/driver.F90 b/SingleModelOpenMPProto/driver.F90 index edc12877..bbfacf7c 100644 --- a/SingleModelOpenMPProto/driver.F90 +++ b/SingleModelOpenMPProto/driver.F90 @@ -62,7 +62,7 @@ subroutine SetServices(driver, rc) return ! bail out ! set driver verbosity - call NUOPC_CompAttributeSet(driver, name="Verbosity", value="low", rc=rc) + call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -89,7 +89,7 @@ subroutine SetModelServices(driver, rc) type(ESMF_VM) :: vm logical :: isFlag character(80) :: msgString - integer :: mpiComm + integer :: mpiComm, size, ierr rc = ESMF_SUCCESS @@ -112,7 +112,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompAttributeSet(child, name="Verbosity", value="low", rc=rc) + call NUOPC_CompAttributeSet(child, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -158,7 +158,8 @@ subroutine SetModelServices(driver, rc) if (mpiComm==MPI_COMM_NULL) then write(msgString,*) "MPI_COMM_NULL" else - write(msgString,*) "valid MPI_COMM" + call MPI_Comm_size(mpiComm, size, ierr) + write(msgString,*) "valid MPI_COMM with size=",size endif call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & diff --git a/SingleModelOpenMPProto/model.F90 b/SingleModelOpenMPProto/model.F90 index 7a53bbd8..3874ea15 100644 --- a/SingleModelOpenMPProto/model.F90 +++ b/SingleModelOpenMPProto/model.F90 @@ -18,8 +18,9 @@ module MODEL use NUOPC use NUOPC_Model, only: & SetVM, & - model_routine_SS => SetServices, & - model_label_Advance => label_Advance + model_routine_SS => SetServices, & + model_label_DataInitialize => label_DataInitialize, & + model_label_Advance => label_Advance implicit none @@ -44,21 +45,35 @@ subroutine SetServices(model, rc) file=__FILE__)) & return ! bail out + ! -> switching to IPD version to demonstrate DataInitialize + call ESMF_GridCompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & + userRoutine=InitializeP0, phase=0, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! set entry point for methods that require specific implementation call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + phaseLabelList=(/"IPDv02p1"/), userRoutine=InitializeAdvertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + phaseLabelList=(/"IPDv02p3"/), userRoutine=InitializeRealize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out ! attach specializing method(s) + call NUOPC_CompSpecialize(model, specLabel=model_label_DataInitialize, & + specRoutine=DataInitialize, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & specRoutine=ModelAdvance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -70,7 +85,27 @@ subroutine SetServices(model, rc) !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine InitializeP0(model, importState, exportState, clock, rc) + type(ESMF_GridComp) :: model + type(ESMF_State) :: importState, exportState + type(ESMF_Clock) :: clock + integer, intent(out) :: rc + + rc = ESMF_SUCCESS + + ! Switch to IPDv02 by filtering all other phaseMap entries + call NUOPC_CompFilterPhaseMap(model, ESMF_METHOD_INITIALIZE, & + acceptStringList=(/"IPDv02p"/), rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + end subroutine + + !----------------------------------------------------------------------------- + + subroutine InitializeAdvertise(model, importState, exportState, clock, rc) type(ESMF_GridComp) :: model type(ESMF_State) :: importState, exportState type(ESMF_Clock) :: clock @@ -113,7 +148,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine InitializeRealize(model, importState, exportState, clock, rc) type(ESMF_GridComp) :: model type(ESMF_State) :: importState, exportState type(ESMF_Clock) :: clock @@ -178,9 +213,39 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out + + call ESMF_VMLogMemInfo(prefix="After Realize:", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out end subroutine - + + !----------------------------------------------------------------------------- + + subroutine DataInitialize(model, rc) + type(ESMF_GridComp) :: model + integer, intent(out) :: rc + + integer, save :: inHere=1 + + rc = ESMF_SUCCESS + + if (inHere > 1) then + ! indicate that data initialization is complete (breaking out of init-loop) + call NUOPC_CompAttributeSet(model, & + name="InitializeDataComplete", value="true", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + endif + + inHere = inHere + 1 + + end subroutine + !----------------------------------------------------------------------------- subroutine ModelAdvance(model, rc) @@ -192,7 +257,7 @@ subroutine ModelAdvance(model, rc) type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState type(ESMF_VM) :: vm - integer :: localPet, localPeCount + integer :: localPet, localPeCount, localPe character(len=160) :: msgString rc = ESMF_SUCCESS @@ -217,14 +282,17 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out + !$ call omp_set_num_threads(localPeCount) ! Now can use OpenMP for fine grained parallelism... ! Here just write info about the PET-local OpenMP threads to Log. -!$omp parallel private(msgString) +!$omp parallel private(msgString, localPe) !$omp critical -!$ write(msgString,'(A,I4,A,I4,A,I4,A,I4)') & +!$ call ESMF_VMGet(vm, localPe=localPe) +!$ write(msgString,'(A,I4,A,I4,A,I4,A,I4,A,I4)') & !$ "thread_num=", omp_get_thread_num(), & +!$ " localPe=", localPe, & !$ " num_threads=", omp_get_num_threads(), & !$ " max_threads=", omp_get_max_threads(), & !$ " num_procs=", omp_get_num_procs() From 1a5e93f143aff8aa197a908dacf27f29a2d36a30 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Thu, 30 Apr 2020 16:25:18 +0000 Subject: [PATCH 06/68] Set Verbosity to "high". --- AtmOcnTransferGridProto/esm.F90 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/AtmOcnTransferGridProto/esm.F90 b/AtmOcnTransferGridProto/esm.F90 index daa23d8b..ac9b4bd7 100644 --- a/AtmOcnTransferGridProto/esm.F90 +++ b/AtmOcnTransferGridProto/esm.F90 @@ -73,7 +73,7 @@ subroutine SetServices(driver, rc) verbosity = ibset(verbosity,11) ! log info about data dependency during init verbosity = ibset(verbosity,13) ! log component creation write(attrStr,"(I10)") verbosity - call NUOPC_CompAttributeSet(driver, name="Verbosity", value=attrStr, rc=rc) + call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -141,7 +141,7 @@ subroutine SetModelServices(driver, rc) file=__FILE__)) & return ! bail out deallocate(petList) - call NUOPC_CompAttributeSet(child, name="Verbosity", value="9", rc=rc) + call NUOPC_CompAttributeSet(child, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -170,7 +170,7 @@ subroutine SetModelServices(driver, rc) file=__FILE__)) & return ! bail out deallocate(petList) - call NUOPC_CompAttributeSet(child, name="Verbosity", value="9", rc=rc) + call NUOPC_CompAttributeSet(child, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -183,7 +183,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompAttributeSet(conn, name="Verbosity", value="9", rc=rc) + call NUOPC_CompAttributeSet(conn, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -196,7 +196,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompAttributeSet(conn, name="Verbosity", value="9", rc=rc) + call NUOPC_CompAttributeSet(conn, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & From 168bf93679f5f8957b1bd0ad3b477de2ab371022 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Thu, 30 Apr 2020 16:28:02 +0000 Subject: [PATCH 07/68] Testing optimized Mesh transfer in NUOPC. Need more fields with transferred Mesh for this test. --- AtmOcnTransferMeshProto/atm.F90 | 38 +++++++++++++++++++++++++++++++++ AtmOcnTransferMeshProto/esm.F90 | 15 +++++++++---- AtmOcnTransferMeshProto/ocn.F90 | 18 ++++++++++++++++ 3 files changed, 67 insertions(+), 4 deletions(-) diff --git a/AtmOcnTransferMeshProto/atm.F90 b/AtmOcnTransferMeshProto/atm.F90 index eae4df16..234d107b 100644 --- a/AtmOcnTransferMeshProto/atm.F90 +++ b/AtmOcnTransferMeshProto/atm.F90 @@ -154,6 +154,16 @@ subroutine InitializeAdvertise(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out + ! importable field: sea_surface_salinity + ! -> marked as "cannot provide" + call NUOPC_Advertise(importState, & + StandardName="sea_surface_salinity", name="sss", & + TransferOfferGeomObject="cannot provide", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! exportable field: air_pressure_at_sea_level ! -> marked as "cannot provide" call NUOPC_Advertise(exportState, & @@ -606,6 +616,25 @@ subroutine InitializeAcceptChangeDistGrid(model, importState, exportState, clock file=__FILE__)) & return ! bail out + ! access the "sss" field in the importState + call ESMF_StateGet(importState, field=field, itemName="sss", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! Swap Mesh in the "sss" field to be the same one that was constructed + ! for "sst". This way the NUOPC Layer knows that both fields are to be + ! built on the same Mesh (with same distribution) and will transfer the + ! Mesh coordinates only once. + ! If on the other hand a different distribution is desired for different + ! fields, then construct separate Meshes and swap those into the field. + call ESMF_FieldEmptySet(field, mesh=mesh, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! extro call NUOPC_LogExtro(name, rName, verbosity, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -723,6 +752,15 @@ subroutine InitializeAcceptMeshAndRealize(model, importState, exportState, clock file=__FILE__)) & return ! bail out + ! realize "sss" field in the importState, with transferred Mesh + ! test the option here to specify an explicit typekind + call NUOPC_Realize(importState, fieldName="sss", & + typekind=ESMF_TYPEKIND_R4, field=field, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! extro call NUOPC_LogExtro(name, rName, verbosity, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & diff --git a/AtmOcnTransferMeshProto/esm.F90 b/AtmOcnTransferMeshProto/esm.F90 index 0cffc825..43c8ce7b 100644 --- a/AtmOcnTransferMeshProto/esm.F90 +++ b/AtmOcnTransferMeshProto/esm.F90 @@ -63,6 +63,13 @@ subroutine SetServices(driver, rc) file=__FILE__)) & return ! bail out + ! set verbosity on driver + call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + end subroutine !----------------------------------------------------------------------------- @@ -112,7 +119,7 @@ subroutine SetModelServices(driver, rc) verbosity = 0 ! reset verbosity = ibset(verbosity,0) ! log basic intro/extro and indentation write(attrStr,"(I10)") verbosity - call NUOPC_CompAttributeSet(child, name="Verbosity", value=attrStr, rc=rc) + call NUOPC_CompAttributeSet(child, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -133,7 +140,7 @@ subroutine SetModelServices(driver, rc) verbosity = 0 ! reset verbosity = ibset(verbosity,0) ! log basic intro/extro and indentation write(attrStr,"(I10)") verbosity - call NUOPC_CompAttributeSet(child, name="Verbosity", value=attrStr, rc=rc) + call NUOPC_CompAttributeSet(child, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -150,7 +157,7 @@ subroutine SetModelServices(driver, rc) verbosity = ibset(verbosity,0) ! log basic intro/extro and indentation verbosity = ibset(verbosity,11) ! log GeomObject transfer write(attrStr,"(I10)") verbosity - call NUOPC_CompAttributeSet(conn, name="Verbosity", value=attrStr, rc=rc) + call NUOPC_CompAttributeSet(conn, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -167,7 +174,7 @@ subroutine SetModelServices(driver, rc) verbosity = ibset(verbosity,0) ! log basic intro/extro and indentation verbosity = ibset(verbosity,11) ! log GeomObject transfer write(attrStr,"(I10)") verbosity - call NUOPC_CompAttributeSet(conn, name="Verbosity", value=attrStr, rc=rc) + call NUOPC_CompAttributeSet(conn, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & diff --git a/AtmOcnTransferMeshProto/ocn.F90 b/AtmOcnTransferMeshProto/ocn.F90 index c0267ad4..f29c8042 100644 --- a/AtmOcnTransferMeshProto/ocn.F90 +++ b/AtmOcnTransferMeshProto/ocn.F90 @@ -118,6 +118,15 @@ subroutine InitializeAdvertise(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out + ! exportable field: sea_surface_temperature + ! -> use default, i.e. marked as "will provide" + call NUOPC_Advertise(exportState, & + StandardName="sea_surface_salinity", name="sss", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! extro call NUOPC_LogExtro(name, rName, verbosity, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -386,6 +395,15 @@ subroutine InitializeRealize(model, importState, exportState, clock, rc) return ! bail out #endif + ! exportable field: sea_surface_salinity + call NUOPC_Realize(exportState, meshOut, fieldName="sss", & + typekind=ESMF_TYPEKIND_R8, selection="realize_connected_remove_others", & + rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! extro call NUOPC_LogExtro(name, rName, verbosity, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & From 8bbc89548aabfa0f75fbf4e143937ece01dede08 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Thu, 30 Apr 2020 16:59:00 +0000 Subject: [PATCH 08/68] Update copyright date. --- AsyncIOBlockingProto/asyncIOApp.F90 | 2 +- AsyncIOBlockingProto/asyncIODriver.F90 | 2 +- AsyncIOBlockingProto/io.F90 | 2 +- AsyncIOBlockingProto/model.F90 | 2 +- AsyncIONonblockingProto/asyncIOApp.F90 | 2 +- AsyncIONonblockingProto/asyncIODriver.F90 | 2 +- AsyncIONonblockingProto/conn.F90 | 2 +- AsyncIONonblockingProto/io.F90 | 2 +- AsyncIONonblockingProto/model.F90 | 2 +- AtmOcnConProto/atm.F90 | 2 +- AtmOcnConProto/conn.F90 | 2 +- AtmOcnConProto/esm.F90 | 2 +- AtmOcnConProto/esmApp.F90 | 2 +- AtmOcnConProto/ocn.F90 | 2 +- AtmOcnCplListProto/atm.F90 | 2 +- AtmOcnCplListProto/esm.F90 | 2 +- AtmOcnCplListProto/esmApp.F90 | 2 +- AtmOcnCplListProto/ocn.F90 | 2 +- AtmOcnFDSynoProto/atm.F90 | 2 +- AtmOcnFDSynoProto/esm.F90 | 2 +- AtmOcnFDSynoProto/esmApp.F90 | 2 +- AtmOcnFDSynoProto/ocn.F90 | 2 +- AtmOcnIceSimpleImplicitProto/atm.F90 | 2 +- AtmOcnIceSimpleImplicitProto/esm.F90 | 2 +- AtmOcnIceSimpleImplicitProto/esmApp.F90 | 2 +- AtmOcnIceSimpleImplicitProto/ice.F90 | 2 +- AtmOcnIceSimpleImplicitProto/ocn.F90 | 2 +- AtmOcnImplicitProto/atm.F90 | 2 +- AtmOcnImplicitProto/esm.F90 | 2 +- AtmOcnImplicitProto/esmApp.F90 | 2 +- AtmOcnImplicitProto/ocn.F90 | 2 +- AtmOcnLndProto/atm.F90 | 2 +- AtmOcnLndProto/esm.F90 | 2 +- AtmOcnLndProto/esmApp.F90 | 2 +- AtmOcnLndProto/lnd.F90 | 2 +- AtmOcnLndProto/ocn.F90 | 2 +- AtmOcnLogNoneProto/atm.F90 | 2 +- AtmOcnLogNoneProto/esm.F90 | 2 +- AtmOcnLogNoneProto/esmApp.F90 | 2 +- AtmOcnLogNoneProto/ocn.F90 | 2 +- AtmOcnMedIngestFromConfigProto/atm.F90 | 2 +- AtmOcnMedIngestFromConfigProto/esm.F90 | 2 +- AtmOcnMedIngestFromConfigProto/esmApp.F90 | 2 +- AtmOcnMedIngestFromConfigProto/med.F90 | 2 +- AtmOcnMedIngestFromConfigProto/ocn.F90 | 2 +- AtmOcnMedIngestFromInternalProto/atm.F90 | 2 +- AtmOcnMedIngestFromInternalProto/esm.F90 | 2 +- AtmOcnMedIngestFromInternalProto/esmApp.F90 | 2 +- AtmOcnMedIngestFromInternalProto/med.F90 | 2 +- AtmOcnMedIngestFromInternalProto/ocn.F90 | 2 +- AtmOcnMedPetListProto/atm.F90 | 2 +- AtmOcnMedPetListProto/esm.F90 | 2 +- AtmOcnMedPetListProto/esmApp.F90 | 2 +- AtmOcnMedPetListProto/med.F90 | 2 +- AtmOcnMedPetListProto/ocn.F90 | 2 +- AtmOcnMedPetListTimescalesProto/atm.F90 | 2 +- AtmOcnMedPetListTimescalesProto/esm.F90 | 2 +- AtmOcnMedPetListTimescalesProto/esmApp.F90 | 2 +- AtmOcnMedPetListTimescalesProto/med.F90 | 2 +- AtmOcnMedPetListTimescalesProto/ocn.F90 | 2 +- AtmOcnMedPetListTimescalesSplitFastProto/atm.F90 | 2 +- AtmOcnMedPetListTimescalesSplitFastProto/esm.F90 | 2 +- AtmOcnMedPetListTimescalesSplitFastProto/esmApp.F90 | 2 +- AtmOcnMedPetListTimescalesSplitFastProto/med.F90 | 2 +- AtmOcnMedPetListTimescalesSplitFastProto/ocn.F90 | 2 +- AtmOcnMedProto/atm.F90 | 2 +- AtmOcnMedProto/esm.F90 | 2 +- AtmOcnMedProto/esmApp.F90 | 2 +- AtmOcnMedProto/med.F90 | 2 +- AtmOcnMedProto/ocn.F90 | 2 +- AtmOcnMedTransferGridMakeMeshProto/atm.F90 | 2 +- AtmOcnMedTransferGridMakeMeshProto/esm.F90 | 2 +- AtmOcnMedTransferGridMakeMeshProto/esmApp.F90 | 2 +- AtmOcnMedTransferGridMakeMeshProto/med.F90 | 2 +- AtmOcnMedTransferGridMakeMeshProto/ocn.F90 | 2 +- AtmOcnMirrorFieldsProto/atm.F90 | 2 +- AtmOcnMirrorFieldsProto/esm.F90 | 2 +- AtmOcnMirrorFieldsProto/esmApp.F90 | 2 +- AtmOcnMirrorFieldsProto/ocn.F90 | 2 +- AtmOcnPetListProto/atm.F90 | 2 +- AtmOcnPetListProto/esm.F90 | 2 +- AtmOcnPetListProto/esmApp.F90 | 2 +- AtmOcnPetListProto/ocn.F90 | 2 +- AtmOcnProto/atm.F90 | 2 +- AtmOcnProto/esm.F90 | 2 +- AtmOcnProto/esmApp.F90 | 2 +- AtmOcnProto/ocn.F90 | 2 +- AtmOcnRtmTwoTimescalesProto/atm.F90 | 2 +- AtmOcnRtmTwoTimescalesProto/esm.F90 | 2 +- AtmOcnRtmTwoTimescalesProto/esmApp.F90 | 2 +- AtmOcnRtmTwoTimescalesProto/ocn.F90 | 2 +- AtmOcnRtmTwoTimescalesProto/rtm.F90 | 2 +- AtmOcnScalarProto/atm.F90 | 2 +- AtmOcnScalarProto/esm.F90 | 2 +- AtmOcnScalarProto/esmApp.F90 | 2 +- AtmOcnScalarProto/ocn.F90 | 2 +- AtmOcnSelectExternalProto/ATM-A/atmA.F90 | 2 +- AtmOcnSelectExternalProto/ATM-B/atmB.F90 | 2 +- AtmOcnSelectExternalProto/ATM-B/procedure.F90 | 2 +- AtmOcnSelectExternalProto/ATM-C/atmC.F90 | 2 +- AtmOcnSelectExternalProto/ATM-C/procedure.F90 | 2 +- AtmOcnSelectExternalProto/ATM-D/atmD.F90 | 2 +- AtmOcnSelectExternalProto/ATM-E/atmE.F90 | 2 +- AtmOcnSelectExternalProto/OcnCommon/ocnCommon.F90 | 2 +- AtmOcnSelectExternalProto/OcnCommon/subModule1.F90 | 2 +- AtmOcnSelectExternalProto/OcnCommon/subModule2.F90 | 2 +- AtmOcnSelectExternalProto/OcnModelA/ocn.F90 | 2 +- AtmOcnSelectExternalProto/OcnModelB/ocn.F90 | 2 +- AtmOcnSelectExternalProto/OcnModelC/ocn.F90 | 2 +- AtmOcnSelectExternalProto/esm.F90 | 2 +- AtmOcnSelectExternalProto/esmApp.F90 | 2 +- AtmOcnSelectProto/atmA.F90 | 2 +- AtmOcnSelectProto/atmB.F90 | 2 +- AtmOcnSelectProto/esm.F90 | 2 +- AtmOcnSelectProto/esmApp.F90 | 2 +- AtmOcnSelectProto/ocnA.F90 | 2 +- AtmOcnSelectProto/ocnB.F90 | 2 +- AtmOcnSimpleImplicitProto/atm.F90 | 2 +- AtmOcnSimpleImplicitProto/esm.F90 | 2 +- AtmOcnSimpleImplicitProto/esmApp.F90 | 2 +- AtmOcnSimpleImplicitProto/ocn.F90 | 2 +- AtmOcnTransferGridProto/atm.F90 | 2 +- AtmOcnTransferGridProto/esm.F90 | 2 +- AtmOcnTransferGridProto/esmApp.F90 | 2 +- AtmOcnTransferGridProto/ocn.F90 | 2 +- AtmOcnTransferLocStreamProto/atm.F90 | 2 +- AtmOcnTransferLocStreamProto/esm.F90 | 2 +- AtmOcnTransferLocStreamProto/esmApp.F90 | 2 +- AtmOcnTransferLocStreamProto/ocn.F90 | 2 +- AtmOcnTransferMeshProto/atm.F90 | 2 +- AtmOcnTransferMeshProto/esm.F90 | 2 +- AtmOcnTransferMeshProto/esmApp.F90 | 2 +- AtmOcnTransferMeshProto/ocn.F90 | 2 +- ComponentExplorer/nuopcExplorerApp.F90 | 2 +- ComponentExplorer/nuopcExplorerDriver.F90 | 2 +- CustomFieldDictionaryProto/driver.F90 | 2 +- CustomFieldDictionaryProto/mainApp.F90 | 2 +- CustomFieldDictionaryProto/model.F90 | 2 +- CustomFieldDictionaryProto/util.F90 | 2 +- DriverInDriverProto/atm.F90 | 2 +- DriverInDriverProto/driverChildComp.F90 | 2 +- DriverInDriverProto/driverParentComp.F90 | 2 +- DriverInDriverProto/mainApp.F90 | 2 +- DriverInDriverProto/ocn.F90 | 2 +- DriverInDriverProtoIPDv02/atm.F90 | 2 +- DriverInDriverProtoIPDv02/driverChildComp.F90 | 2 +- DriverInDriverProtoIPDv02/driverParentComp.F90 | 2 +- DriverInDriverProtoIPDv02/mainApp.F90 | 2 +- DriverInDriverProtoIPDv02/ocn.F90 | 2 +- DynPhyProto/atm.F90 | 2 +- DynPhyProto/dyn.F90 | 2 +- DynPhyProto/esmApp.F90 | 2 +- DynPhyProto/phy.F90 | 2 +- ExternalDriverAPIProto/atm.F90 | 2 +- ExternalDriverAPIProto/esm.F90 | 2 +- ExternalDriverAPIProto/externalApp.F90 | 2 +- ExternalDriverAPIProto/ocn.F90 | 2 +- GenericMediatorProto/app.F90 | 2 +- GenericMediatorProto/driver.F90 | 2 +- GenericMediatorProto/mediator.F90 | 2 +- GenericMediatorProto/modelA.F90 | 2 +- GenericMediatorProto/modelB.F90 | 2 +- HierarchyProto/atm.F90 | 2 +- HierarchyProto/dyn.F90 | 2 +- HierarchyProto/esm.F90 | 2 +- HierarchyProto/esmApp.F90 | 2 +- HierarchyProto/ocn.F90 | 2 +- HierarchyProto/phy.F90 | 2 +- NamespaceProto/atm.F90 | 2 +- NamespaceProto/driver.F90 | 2 +- NamespaceProto/mainApp.F90 | 2 +- NamespaceProto/med.F90 | 2 +- NestingMultipleProto/advectDiffComp.F90 | 2 +- NestingMultipleProto/driverComp.F90 | 2 +- NestingMultipleProto/mainApp.F90 | 2 +- NestingSingleProto/advectDiffComp.F90 | 2 +- NestingSingleProto/driverComp.F90 | 2 +- NestingSingleProto/mainApp.F90 | 2 +- NestingTelescopeMultipleProto/advectDiffComp.F90 | 2 +- NestingTelescopeMultipleProto/driverComp.F90 | 2 +- NestingTelescopeMultipleProto/mainApp.F90 | 2 +- PerformanceConnectorProto/atm.F90 | 2 +- PerformanceConnectorProto/conn.F90 | 2 +- PerformanceConnectorProto/esm.F90 | 2 +- PerformanceConnectorProto/esmApp.F90 | 2 +- PerformanceConnectorProto/ocn.F90 | 2 +- PerformanceRunSequenceProto/driver.F90 | 2 +- PerformanceRunSequenceProto/mainApp.F90 | 2 +- PerformanceRunSequenceProto/model.F90 | 2 +- SingleModelOpenMPProto/driver.F90 | 2 +- SingleModelOpenMPProto/mainApp.F90 | 2 +- SingleModelOpenMPProto/model.F90 | 2 +- SingleModelProto/driver.F90 | 2 +- SingleModelProto/mainApp.F90 | 2 +- SingleModelProto/model.F90 | 2 +- testProtos.sh | 2 +- 196 files changed, 196 insertions(+), 196 deletions(-) diff --git a/AsyncIOBlockingProto/asyncIOApp.F90 b/AsyncIOBlockingProto/asyncIOApp.F90 index a62d6926..c0ccf08a 100644 --- a/AsyncIOBlockingProto/asyncIOApp.F90 +++ b/AsyncIOBlockingProto/asyncIOApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AsyncIOBlockingProto/asyncIODriver.F90 b/AsyncIOBlockingProto/asyncIODriver.F90 index a881244d..0ccb6eaf 100644 --- a/AsyncIOBlockingProto/asyncIODriver.F90 +++ b/AsyncIOBlockingProto/asyncIODriver.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AsyncIOBlockingProto/io.F90 b/AsyncIOBlockingProto/io.F90 index d41a6c91..4a1bc3a4 100644 --- a/AsyncIOBlockingProto/io.F90 +++ b/AsyncIOBlockingProto/io.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AsyncIOBlockingProto/model.F90 b/AsyncIOBlockingProto/model.F90 index 98e659c5..11c95249 100644 --- a/AsyncIOBlockingProto/model.F90 +++ b/AsyncIOBlockingProto/model.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AsyncIONonblockingProto/asyncIOApp.F90 b/AsyncIONonblockingProto/asyncIOApp.F90 index a62d6926..c0ccf08a 100644 --- a/AsyncIONonblockingProto/asyncIOApp.F90 +++ b/AsyncIONonblockingProto/asyncIOApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AsyncIONonblockingProto/asyncIODriver.F90 b/AsyncIONonblockingProto/asyncIODriver.F90 index a99d07ed..aaafbcdf 100644 --- a/AsyncIONonblockingProto/asyncIODriver.F90 +++ b/AsyncIONonblockingProto/asyncIODriver.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AsyncIONonblockingProto/conn.F90 b/AsyncIONonblockingProto/conn.F90 index 5c1de9c5..725703a2 100644 --- a/AsyncIONonblockingProto/conn.F90 +++ b/AsyncIONonblockingProto/conn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AsyncIONonblockingProto/io.F90 b/AsyncIONonblockingProto/io.F90 index b42ccb31..2b15e8ad 100644 --- a/AsyncIONonblockingProto/io.F90 +++ b/AsyncIONonblockingProto/io.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AsyncIONonblockingProto/model.F90 b/AsyncIONonblockingProto/model.F90 index bf5a6aa9..cb4e74e9 100644 --- a/AsyncIONonblockingProto/model.F90 +++ b/AsyncIONonblockingProto/model.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnConProto/atm.F90 b/AtmOcnConProto/atm.F90 index f97b9300..41656f55 100644 --- a/AtmOcnConProto/atm.F90 +++ b/AtmOcnConProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnConProto/conn.F90 b/AtmOcnConProto/conn.F90 index 3eba6edd..514790c1 100644 --- a/AtmOcnConProto/conn.F90 +++ b/AtmOcnConProto/conn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnConProto/esm.F90 b/AtmOcnConProto/esm.F90 index 2d254a03..8b864edc 100644 --- a/AtmOcnConProto/esm.F90 +++ b/AtmOcnConProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnConProto/esmApp.F90 b/AtmOcnConProto/esmApp.F90 index 391faaed..9226f49a 100644 --- a/AtmOcnConProto/esmApp.F90 +++ b/AtmOcnConProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnConProto/ocn.F90 b/AtmOcnConProto/ocn.F90 index b3a33eaf..88aa9e00 100644 --- a/AtmOcnConProto/ocn.F90 +++ b/AtmOcnConProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnCplListProto/atm.F90 b/AtmOcnCplListProto/atm.F90 index 89bdbe27..420e3117 100644 --- a/AtmOcnCplListProto/atm.F90 +++ b/AtmOcnCplListProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnCplListProto/esm.F90 b/AtmOcnCplListProto/esm.F90 index a44f433c..b1e2af3c 100644 --- a/AtmOcnCplListProto/esm.F90 +++ b/AtmOcnCplListProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnCplListProto/esmApp.F90 b/AtmOcnCplListProto/esmApp.F90 index 391faaed..9226f49a 100644 --- a/AtmOcnCplListProto/esmApp.F90 +++ b/AtmOcnCplListProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnCplListProto/ocn.F90 b/AtmOcnCplListProto/ocn.F90 index 5dda6f7f..2b2fd46a 100644 --- a/AtmOcnCplListProto/ocn.F90 +++ b/AtmOcnCplListProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnFDSynoProto/atm.F90 b/AtmOcnFDSynoProto/atm.F90 index 6c466b88..273b3aff 100644 --- a/AtmOcnFDSynoProto/atm.F90 +++ b/AtmOcnFDSynoProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnFDSynoProto/esm.F90 b/AtmOcnFDSynoProto/esm.F90 index 0dab739c..cbfadd01 100644 --- a/AtmOcnFDSynoProto/esm.F90 +++ b/AtmOcnFDSynoProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnFDSynoProto/esmApp.F90 b/AtmOcnFDSynoProto/esmApp.F90 index f97b10e8..988ec1a4 100644 --- a/AtmOcnFDSynoProto/esmApp.F90 +++ b/AtmOcnFDSynoProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnFDSynoProto/ocn.F90 b/AtmOcnFDSynoProto/ocn.F90 index b3a33eaf..88aa9e00 100644 --- a/AtmOcnFDSynoProto/ocn.F90 +++ b/AtmOcnFDSynoProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnIceSimpleImplicitProto/atm.F90 b/AtmOcnIceSimpleImplicitProto/atm.F90 index b6105e72..b286f0c2 100644 --- a/AtmOcnIceSimpleImplicitProto/atm.F90 +++ b/AtmOcnIceSimpleImplicitProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnIceSimpleImplicitProto/esm.F90 b/AtmOcnIceSimpleImplicitProto/esm.F90 index 336bd8ff..718a3e2f 100644 --- a/AtmOcnIceSimpleImplicitProto/esm.F90 +++ b/AtmOcnIceSimpleImplicitProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnIceSimpleImplicitProto/esmApp.F90 b/AtmOcnIceSimpleImplicitProto/esmApp.F90 index 03794b3e..b80f7d5c 100644 --- a/AtmOcnIceSimpleImplicitProto/esmApp.F90 +++ b/AtmOcnIceSimpleImplicitProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnIceSimpleImplicitProto/ice.F90 b/AtmOcnIceSimpleImplicitProto/ice.F90 index 1898266e..4ea166bc 100644 --- a/AtmOcnIceSimpleImplicitProto/ice.F90 +++ b/AtmOcnIceSimpleImplicitProto/ice.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnIceSimpleImplicitProto/ocn.F90 b/AtmOcnIceSimpleImplicitProto/ocn.F90 index e272ed8d..707c7558 100644 --- a/AtmOcnIceSimpleImplicitProto/ocn.F90 +++ b/AtmOcnIceSimpleImplicitProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnImplicitProto/atm.F90 b/AtmOcnImplicitProto/atm.F90 index e0c6334f..6e7c3379 100644 --- a/AtmOcnImplicitProto/atm.F90 +++ b/AtmOcnImplicitProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnImplicitProto/esm.F90 b/AtmOcnImplicitProto/esm.F90 index d0d9db22..0791264d 100644 --- a/AtmOcnImplicitProto/esm.F90 +++ b/AtmOcnImplicitProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnImplicitProto/esmApp.F90 b/AtmOcnImplicitProto/esmApp.F90 index 03794b3e..b80f7d5c 100644 --- a/AtmOcnImplicitProto/esmApp.F90 +++ b/AtmOcnImplicitProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnImplicitProto/ocn.F90 b/AtmOcnImplicitProto/ocn.F90 index eb17b0d1..f92d484a 100644 --- a/AtmOcnImplicitProto/ocn.F90 +++ b/AtmOcnImplicitProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnLndProto/atm.F90 b/AtmOcnLndProto/atm.F90 index 61349375..324ef678 100644 --- a/AtmOcnLndProto/atm.F90 +++ b/AtmOcnLndProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnLndProto/esm.F90 b/AtmOcnLndProto/esm.F90 index 783c3993..d8501c4c 100644 --- a/AtmOcnLndProto/esm.F90 +++ b/AtmOcnLndProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnLndProto/esmApp.F90 b/AtmOcnLndProto/esmApp.F90 index 03794b3e..b80f7d5c 100644 --- a/AtmOcnLndProto/esmApp.F90 +++ b/AtmOcnLndProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnLndProto/lnd.F90 b/AtmOcnLndProto/lnd.F90 index 5cf54bea..005edd70 100644 --- a/AtmOcnLndProto/lnd.F90 +++ b/AtmOcnLndProto/lnd.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnLndProto/ocn.F90 b/AtmOcnLndProto/ocn.F90 index b3a33eaf..88aa9e00 100644 --- a/AtmOcnLndProto/ocn.F90 +++ b/AtmOcnLndProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnLogNoneProto/atm.F90 b/AtmOcnLogNoneProto/atm.F90 index 240f7438..5e02da27 100644 --- a/AtmOcnLogNoneProto/atm.F90 +++ b/AtmOcnLogNoneProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnLogNoneProto/esm.F90 b/AtmOcnLogNoneProto/esm.F90 index 0dab739c..cbfadd01 100644 --- a/AtmOcnLogNoneProto/esm.F90 +++ b/AtmOcnLogNoneProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnLogNoneProto/esmApp.F90 b/AtmOcnLogNoneProto/esmApp.F90 index 7860cae6..5034eba0 100644 --- a/AtmOcnLogNoneProto/esmApp.F90 +++ b/AtmOcnLogNoneProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnLogNoneProto/ocn.F90 b/AtmOcnLogNoneProto/ocn.F90 index 926d6834..df44b999 100644 --- a/AtmOcnLogNoneProto/ocn.F90 +++ b/AtmOcnLogNoneProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedIngestFromConfigProto/atm.F90 b/AtmOcnMedIngestFromConfigProto/atm.F90 index 3770b486..bbd6386f 100644 --- a/AtmOcnMedIngestFromConfigProto/atm.F90 +++ b/AtmOcnMedIngestFromConfigProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedIngestFromConfigProto/esm.F90 b/AtmOcnMedIngestFromConfigProto/esm.F90 index f4d582d6..1fd7a8e9 100644 --- a/AtmOcnMedIngestFromConfigProto/esm.F90 +++ b/AtmOcnMedIngestFromConfigProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedIngestFromConfigProto/esmApp.F90 b/AtmOcnMedIngestFromConfigProto/esmApp.F90 index 03794b3e..b80f7d5c 100644 --- a/AtmOcnMedIngestFromConfigProto/esmApp.F90 +++ b/AtmOcnMedIngestFromConfigProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedIngestFromConfigProto/med.F90 b/AtmOcnMedIngestFromConfigProto/med.F90 index 32741c46..3239979d 100644 --- a/AtmOcnMedIngestFromConfigProto/med.F90 +++ b/AtmOcnMedIngestFromConfigProto/med.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedIngestFromConfigProto/ocn.F90 b/AtmOcnMedIngestFromConfigProto/ocn.F90 index 9eb63387..5dcc2ff0 100644 --- a/AtmOcnMedIngestFromConfigProto/ocn.F90 +++ b/AtmOcnMedIngestFromConfigProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedIngestFromInternalProto/atm.F90 b/AtmOcnMedIngestFromInternalProto/atm.F90 index 3770b486..bbd6386f 100644 --- a/AtmOcnMedIngestFromInternalProto/atm.F90 +++ b/AtmOcnMedIngestFromInternalProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedIngestFromInternalProto/esm.F90 b/AtmOcnMedIngestFromInternalProto/esm.F90 index 2bd31880..b0ebc89d 100644 --- a/AtmOcnMedIngestFromInternalProto/esm.F90 +++ b/AtmOcnMedIngestFromInternalProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedIngestFromInternalProto/esmApp.F90 b/AtmOcnMedIngestFromInternalProto/esmApp.F90 index 03794b3e..b80f7d5c 100644 --- a/AtmOcnMedIngestFromInternalProto/esmApp.F90 +++ b/AtmOcnMedIngestFromInternalProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedIngestFromInternalProto/med.F90 b/AtmOcnMedIngestFromInternalProto/med.F90 index 30d379a6..a452426e 100644 --- a/AtmOcnMedIngestFromInternalProto/med.F90 +++ b/AtmOcnMedIngestFromInternalProto/med.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedIngestFromInternalProto/ocn.F90 b/AtmOcnMedIngestFromInternalProto/ocn.F90 index 9eb63387..5dcc2ff0 100644 --- a/AtmOcnMedIngestFromInternalProto/ocn.F90 +++ b/AtmOcnMedIngestFromInternalProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedPetListProto/atm.F90 b/AtmOcnMedPetListProto/atm.F90 index 623d2c10..462a0d0f 100644 --- a/AtmOcnMedPetListProto/atm.F90 +++ b/AtmOcnMedPetListProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedPetListProto/esm.F90 b/AtmOcnMedPetListProto/esm.F90 index efe9a26b..9a88995a 100644 --- a/AtmOcnMedPetListProto/esm.F90 +++ b/AtmOcnMedPetListProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedPetListProto/esmApp.F90 b/AtmOcnMedPetListProto/esmApp.F90 index 03794b3e..b80f7d5c 100644 --- a/AtmOcnMedPetListProto/esmApp.F90 +++ b/AtmOcnMedPetListProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedPetListProto/med.F90 b/AtmOcnMedPetListProto/med.F90 index 8de9befc..f8ce7484 100644 --- a/AtmOcnMedPetListProto/med.F90 +++ b/AtmOcnMedPetListProto/med.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedPetListProto/ocn.F90 b/AtmOcnMedPetListProto/ocn.F90 index be74be79..4043e256 100644 --- a/AtmOcnMedPetListProto/ocn.F90 +++ b/AtmOcnMedPetListProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedPetListTimescalesProto/atm.F90 b/AtmOcnMedPetListTimescalesProto/atm.F90 index 37912800..897782be 100644 --- a/AtmOcnMedPetListTimescalesProto/atm.F90 +++ b/AtmOcnMedPetListTimescalesProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedPetListTimescalesProto/esm.F90 b/AtmOcnMedPetListTimescalesProto/esm.F90 index aed4b964..32d0d5c8 100644 --- a/AtmOcnMedPetListTimescalesProto/esm.F90 +++ b/AtmOcnMedPetListTimescalesProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedPetListTimescalesProto/esmApp.F90 b/AtmOcnMedPetListTimescalesProto/esmApp.F90 index 03794b3e..b80f7d5c 100644 --- a/AtmOcnMedPetListTimescalesProto/esmApp.F90 +++ b/AtmOcnMedPetListTimescalesProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedPetListTimescalesProto/med.F90 b/AtmOcnMedPetListTimescalesProto/med.F90 index 57fc7d16..783df9c3 100644 --- a/AtmOcnMedPetListTimescalesProto/med.F90 +++ b/AtmOcnMedPetListTimescalesProto/med.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedPetListTimescalesProto/ocn.F90 b/AtmOcnMedPetListTimescalesProto/ocn.F90 index 1b38d607..c3e469cf 100644 --- a/AtmOcnMedPetListTimescalesProto/ocn.F90 +++ b/AtmOcnMedPetListTimescalesProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedPetListTimescalesSplitFastProto/atm.F90 b/AtmOcnMedPetListTimescalesSplitFastProto/atm.F90 index 4e375788..b5dc9c02 100644 --- a/AtmOcnMedPetListTimescalesSplitFastProto/atm.F90 +++ b/AtmOcnMedPetListTimescalesSplitFastProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedPetListTimescalesSplitFastProto/esm.F90 b/AtmOcnMedPetListTimescalesSplitFastProto/esm.F90 index 6f676dbc..61d30b5e 100644 --- a/AtmOcnMedPetListTimescalesSplitFastProto/esm.F90 +++ b/AtmOcnMedPetListTimescalesSplitFastProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedPetListTimescalesSplitFastProto/esmApp.F90 b/AtmOcnMedPetListTimescalesSplitFastProto/esmApp.F90 index 03794b3e..b80f7d5c 100644 --- a/AtmOcnMedPetListTimescalesSplitFastProto/esmApp.F90 +++ b/AtmOcnMedPetListTimescalesSplitFastProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedPetListTimescalesSplitFastProto/med.F90 b/AtmOcnMedPetListTimescalesSplitFastProto/med.F90 index fc9042fb..effddd14 100644 --- a/AtmOcnMedPetListTimescalesSplitFastProto/med.F90 +++ b/AtmOcnMedPetListTimescalesSplitFastProto/med.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedPetListTimescalesSplitFastProto/ocn.F90 b/AtmOcnMedPetListTimescalesSplitFastProto/ocn.F90 index da389038..4f5c582a 100644 --- a/AtmOcnMedPetListTimescalesSplitFastProto/ocn.F90 +++ b/AtmOcnMedPetListTimescalesSplitFastProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedProto/atm.F90 b/AtmOcnMedProto/atm.F90 index 623d2c10..462a0d0f 100644 --- a/AtmOcnMedProto/atm.F90 +++ b/AtmOcnMedProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedProto/esm.F90 b/AtmOcnMedProto/esm.F90 index 1da67afe..311cac73 100644 --- a/AtmOcnMedProto/esm.F90 +++ b/AtmOcnMedProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedProto/esmApp.F90 b/AtmOcnMedProto/esmApp.F90 index 03794b3e..b80f7d5c 100644 --- a/AtmOcnMedProto/esmApp.F90 +++ b/AtmOcnMedProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedProto/med.F90 b/AtmOcnMedProto/med.F90 index 79489de8..5540ce3a 100644 --- a/AtmOcnMedProto/med.F90 +++ b/AtmOcnMedProto/med.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedProto/ocn.F90 b/AtmOcnMedProto/ocn.F90 index be74be79..4043e256 100644 --- a/AtmOcnMedProto/ocn.F90 +++ b/AtmOcnMedProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedTransferGridMakeMeshProto/atm.F90 b/AtmOcnMedTransferGridMakeMeshProto/atm.F90 index 294b6c52..0d09ec0e 100644 --- a/AtmOcnMedTransferGridMakeMeshProto/atm.F90 +++ b/AtmOcnMedTransferGridMakeMeshProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedTransferGridMakeMeshProto/esm.F90 b/AtmOcnMedTransferGridMakeMeshProto/esm.F90 index 62c844bc..84db8a51 100644 --- a/AtmOcnMedTransferGridMakeMeshProto/esm.F90 +++ b/AtmOcnMedTransferGridMakeMeshProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedTransferGridMakeMeshProto/esmApp.F90 b/AtmOcnMedTransferGridMakeMeshProto/esmApp.F90 index 6f1aa655..ed302230 100644 --- a/AtmOcnMedTransferGridMakeMeshProto/esmApp.F90 +++ b/AtmOcnMedTransferGridMakeMeshProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedTransferGridMakeMeshProto/med.F90 b/AtmOcnMedTransferGridMakeMeshProto/med.F90 index bf4cdedb..1067512c 100644 --- a/AtmOcnMedTransferGridMakeMeshProto/med.F90 +++ b/AtmOcnMedTransferGridMakeMeshProto/med.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedTransferGridMakeMeshProto/ocn.F90 b/AtmOcnMedTransferGridMakeMeshProto/ocn.F90 index 4521726c..bfc085c3 100644 --- a/AtmOcnMedTransferGridMakeMeshProto/ocn.F90 +++ b/AtmOcnMedTransferGridMakeMeshProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMirrorFieldsProto/atm.F90 b/AtmOcnMirrorFieldsProto/atm.F90 index 2e97b62c..826a6901 100644 --- a/AtmOcnMirrorFieldsProto/atm.F90 +++ b/AtmOcnMirrorFieldsProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMirrorFieldsProto/esm.F90 b/AtmOcnMirrorFieldsProto/esm.F90 index 4a6f9221..3cf52b0f 100644 --- a/AtmOcnMirrorFieldsProto/esm.F90 +++ b/AtmOcnMirrorFieldsProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMirrorFieldsProto/esmApp.F90 b/AtmOcnMirrorFieldsProto/esmApp.F90 index 6f1aa655..ed302230 100644 --- a/AtmOcnMirrorFieldsProto/esmApp.F90 +++ b/AtmOcnMirrorFieldsProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMirrorFieldsProto/ocn.F90 b/AtmOcnMirrorFieldsProto/ocn.F90 index 62af2e45..6ae27979 100644 --- a/AtmOcnMirrorFieldsProto/ocn.F90 +++ b/AtmOcnMirrorFieldsProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnPetListProto/atm.F90 b/AtmOcnPetListProto/atm.F90 index 378db39b..84b7d737 100644 --- a/AtmOcnPetListProto/atm.F90 +++ b/AtmOcnPetListProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnPetListProto/esm.F90 b/AtmOcnPetListProto/esm.F90 index 5087c788..5a44c7ea 100644 --- a/AtmOcnPetListProto/esm.F90 +++ b/AtmOcnPetListProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnPetListProto/esmApp.F90 b/AtmOcnPetListProto/esmApp.F90 index 6f1aa655..ed302230 100644 --- a/AtmOcnPetListProto/esmApp.F90 +++ b/AtmOcnPetListProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnPetListProto/ocn.F90 b/AtmOcnPetListProto/ocn.F90 index 697cb205..eb0233f5 100644 --- a/AtmOcnPetListProto/ocn.F90 +++ b/AtmOcnPetListProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnProto/atm.F90 b/AtmOcnProto/atm.F90 index 8d84b9b8..587ea699 100644 --- a/AtmOcnProto/atm.F90 +++ b/AtmOcnProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnProto/esm.F90 b/AtmOcnProto/esm.F90 index 9b7ef1e1..996554b2 100644 --- a/AtmOcnProto/esm.F90 +++ b/AtmOcnProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnProto/esmApp.F90 b/AtmOcnProto/esmApp.F90 index 434dbc8e..67e83ebf 100644 --- a/AtmOcnProto/esmApp.F90 +++ b/AtmOcnProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnProto/ocn.F90 b/AtmOcnProto/ocn.F90 index 926d6834..df44b999 100644 --- a/AtmOcnProto/ocn.F90 +++ b/AtmOcnProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnRtmTwoTimescalesProto/atm.F90 b/AtmOcnRtmTwoTimescalesProto/atm.F90 index 6cfc7b88..2152d695 100644 --- a/AtmOcnRtmTwoTimescalesProto/atm.F90 +++ b/AtmOcnRtmTwoTimescalesProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnRtmTwoTimescalesProto/esm.F90 b/AtmOcnRtmTwoTimescalesProto/esm.F90 index 857d5421..47e33f46 100644 --- a/AtmOcnRtmTwoTimescalesProto/esm.F90 +++ b/AtmOcnRtmTwoTimescalesProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnRtmTwoTimescalesProto/esmApp.F90 b/AtmOcnRtmTwoTimescalesProto/esmApp.F90 index cb1282a2..7782a06b 100644 --- a/AtmOcnRtmTwoTimescalesProto/esmApp.F90 +++ b/AtmOcnRtmTwoTimescalesProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnRtmTwoTimescalesProto/ocn.F90 b/AtmOcnRtmTwoTimescalesProto/ocn.F90 index d39f6193..f001242c 100644 --- a/AtmOcnRtmTwoTimescalesProto/ocn.F90 +++ b/AtmOcnRtmTwoTimescalesProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnRtmTwoTimescalesProto/rtm.F90 b/AtmOcnRtmTwoTimescalesProto/rtm.F90 index 2a8c8f98..42e34ce3 100644 --- a/AtmOcnRtmTwoTimescalesProto/rtm.F90 +++ b/AtmOcnRtmTwoTimescalesProto/rtm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnScalarProto/atm.F90 b/AtmOcnScalarProto/atm.F90 index bd3cc664..d6f1ddd4 100644 --- a/AtmOcnScalarProto/atm.F90 +++ b/AtmOcnScalarProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnScalarProto/esm.F90 b/AtmOcnScalarProto/esm.F90 index 6ecb4975..bc2f7c30 100644 --- a/AtmOcnScalarProto/esm.F90 +++ b/AtmOcnScalarProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnScalarProto/esmApp.F90 b/AtmOcnScalarProto/esmApp.F90 index b9fb4f01..1959dba9 100644 --- a/AtmOcnScalarProto/esmApp.F90 +++ b/AtmOcnScalarProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnScalarProto/ocn.F90 b/AtmOcnScalarProto/ocn.F90 index af94cd81..25a01b38 100644 --- a/AtmOcnScalarProto/ocn.F90 +++ b/AtmOcnScalarProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectExternalProto/ATM-A/atmA.F90 b/AtmOcnSelectExternalProto/ATM-A/atmA.F90 index 31f1512f..aa150a34 100644 --- a/AtmOcnSelectExternalProto/ATM-A/atmA.F90 +++ b/AtmOcnSelectExternalProto/ATM-A/atmA.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectExternalProto/ATM-B/atmB.F90 b/AtmOcnSelectExternalProto/ATM-B/atmB.F90 index d34a3d91..b655d89b 100644 --- a/AtmOcnSelectExternalProto/ATM-B/atmB.F90 +++ b/AtmOcnSelectExternalProto/ATM-B/atmB.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectExternalProto/ATM-B/procedure.F90 b/AtmOcnSelectExternalProto/ATM-B/procedure.F90 index 4a3889b0..dab3518e 100644 --- a/AtmOcnSelectExternalProto/ATM-B/procedure.F90 +++ b/AtmOcnSelectExternalProto/ATM-B/procedure.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectExternalProto/ATM-C/atmC.F90 b/AtmOcnSelectExternalProto/ATM-C/atmC.F90 index 34ce5371..5bbb0b88 100644 --- a/AtmOcnSelectExternalProto/ATM-C/atmC.F90 +++ b/AtmOcnSelectExternalProto/ATM-C/atmC.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectExternalProto/ATM-C/procedure.F90 b/AtmOcnSelectExternalProto/ATM-C/procedure.F90 index 6f76d1e1..8a793ef5 100644 --- a/AtmOcnSelectExternalProto/ATM-C/procedure.F90 +++ b/AtmOcnSelectExternalProto/ATM-C/procedure.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectExternalProto/ATM-D/atmD.F90 b/AtmOcnSelectExternalProto/ATM-D/atmD.F90 index 156d2600..7583eeb9 100644 --- a/AtmOcnSelectExternalProto/ATM-D/atmD.F90 +++ b/AtmOcnSelectExternalProto/ATM-D/atmD.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectExternalProto/ATM-E/atmE.F90 b/AtmOcnSelectExternalProto/ATM-E/atmE.F90 index 3256c250..1fdd197c 100644 --- a/AtmOcnSelectExternalProto/ATM-E/atmE.F90 +++ b/AtmOcnSelectExternalProto/ATM-E/atmE.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectExternalProto/OcnCommon/ocnCommon.F90 b/AtmOcnSelectExternalProto/OcnCommon/ocnCommon.F90 index 83dd58ef..15cb1bcd 100644 --- a/AtmOcnSelectExternalProto/OcnCommon/ocnCommon.F90 +++ b/AtmOcnSelectExternalProto/OcnCommon/ocnCommon.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectExternalProto/OcnCommon/subModule1.F90 b/AtmOcnSelectExternalProto/OcnCommon/subModule1.F90 index 8ad84933..c92aa687 100644 --- a/AtmOcnSelectExternalProto/OcnCommon/subModule1.F90 +++ b/AtmOcnSelectExternalProto/OcnCommon/subModule1.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectExternalProto/OcnCommon/subModule2.F90 b/AtmOcnSelectExternalProto/OcnCommon/subModule2.F90 index 8c8192d3..6ac11dcd 100644 --- a/AtmOcnSelectExternalProto/OcnCommon/subModule2.F90 +++ b/AtmOcnSelectExternalProto/OcnCommon/subModule2.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectExternalProto/OcnModelA/ocn.F90 b/AtmOcnSelectExternalProto/OcnModelA/ocn.F90 index 533c587f..5177ffd5 100644 --- a/AtmOcnSelectExternalProto/OcnModelA/ocn.F90 +++ b/AtmOcnSelectExternalProto/OcnModelA/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectExternalProto/OcnModelB/ocn.F90 b/AtmOcnSelectExternalProto/OcnModelB/ocn.F90 index 1f1b2f54..47d57ed4 100644 --- a/AtmOcnSelectExternalProto/OcnModelB/ocn.F90 +++ b/AtmOcnSelectExternalProto/OcnModelB/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectExternalProto/OcnModelC/ocn.F90 b/AtmOcnSelectExternalProto/OcnModelC/ocn.F90 index 85691347..0adabe4f 100644 --- a/AtmOcnSelectExternalProto/OcnModelC/ocn.F90 +++ b/AtmOcnSelectExternalProto/OcnModelC/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectExternalProto/esm.F90 b/AtmOcnSelectExternalProto/esm.F90 index 289a59ae..206ebb00 100644 --- a/AtmOcnSelectExternalProto/esm.F90 +++ b/AtmOcnSelectExternalProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectExternalProto/esmApp.F90 b/AtmOcnSelectExternalProto/esmApp.F90 index 391faaed..9226f49a 100644 --- a/AtmOcnSelectExternalProto/esmApp.F90 +++ b/AtmOcnSelectExternalProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectProto/atmA.F90 b/AtmOcnSelectProto/atmA.F90 index 31f1512f..aa150a34 100644 --- a/AtmOcnSelectProto/atmA.F90 +++ b/AtmOcnSelectProto/atmA.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectProto/atmB.F90 b/AtmOcnSelectProto/atmB.F90 index 039c66fc..f1933995 100644 --- a/AtmOcnSelectProto/atmB.F90 +++ b/AtmOcnSelectProto/atmB.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectProto/esm.F90 b/AtmOcnSelectProto/esm.F90 index 8f55d063..f224e51f 100644 --- a/AtmOcnSelectProto/esm.F90 +++ b/AtmOcnSelectProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectProto/esmApp.F90 b/AtmOcnSelectProto/esmApp.F90 index 391faaed..9226f49a 100644 --- a/AtmOcnSelectProto/esmApp.F90 +++ b/AtmOcnSelectProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectProto/ocnA.F90 b/AtmOcnSelectProto/ocnA.F90 index e84883ba..54c6a297 100644 --- a/AtmOcnSelectProto/ocnA.F90 +++ b/AtmOcnSelectProto/ocnA.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectProto/ocnB.F90 b/AtmOcnSelectProto/ocnB.F90 index 6480414f..502d25dc 100644 --- a/AtmOcnSelectProto/ocnB.F90 +++ b/AtmOcnSelectProto/ocnB.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSimpleImplicitProto/atm.F90 b/AtmOcnSimpleImplicitProto/atm.F90 index d594fd0b..8dadca92 100644 --- a/AtmOcnSimpleImplicitProto/atm.F90 +++ b/AtmOcnSimpleImplicitProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSimpleImplicitProto/esm.F90 b/AtmOcnSimpleImplicitProto/esm.F90 index f308ac45..036ea8b6 100644 --- a/AtmOcnSimpleImplicitProto/esm.F90 +++ b/AtmOcnSimpleImplicitProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSimpleImplicitProto/esmApp.F90 b/AtmOcnSimpleImplicitProto/esmApp.F90 index 03794b3e..b80f7d5c 100644 --- a/AtmOcnSimpleImplicitProto/esmApp.F90 +++ b/AtmOcnSimpleImplicitProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSimpleImplicitProto/ocn.F90 b/AtmOcnSimpleImplicitProto/ocn.F90 index 26f14578..76012957 100644 --- a/AtmOcnSimpleImplicitProto/ocn.F90 +++ b/AtmOcnSimpleImplicitProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnTransferGridProto/atm.F90 b/AtmOcnTransferGridProto/atm.F90 index d09bb124..66381e39 100644 --- a/AtmOcnTransferGridProto/atm.F90 +++ b/AtmOcnTransferGridProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnTransferGridProto/esm.F90 b/AtmOcnTransferGridProto/esm.F90 index ac9b4bd7..456f3c54 100644 --- a/AtmOcnTransferGridProto/esm.F90 +++ b/AtmOcnTransferGridProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnTransferGridProto/esmApp.F90 b/AtmOcnTransferGridProto/esmApp.F90 index 6f1aa655..ed302230 100644 --- a/AtmOcnTransferGridProto/esmApp.F90 +++ b/AtmOcnTransferGridProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnTransferGridProto/ocn.F90 b/AtmOcnTransferGridProto/ocn.F90 index fa0cac40..13b8f1cf 100644 --- a/AtmOcnTransferGridProto/ocn.F90 +++ b/AtmOcnTransferGridProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnTransferLocStreamProto/atm.F90 b/AtmOcnTransferLocStreamProto/atm.F90 index 98b143a8..9c9ac400 100644 --- a/AtmOcnTransferLocStreamProto/atm.F90 +++ b/AtmOcnTransferLocStreamProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnTransferLocStreamProto/esm.F90 b/AtmOcnTransferLocStreamProto/esm.F90 index 8afd16e0..4c8d2fb7 100644 --- a/AtmOcnTransferLocStreamProto/esm.F90 +++ b/AtmOcnTransferLocStreamProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnTransferLocStreamProto/esmApp.F90 b/AtmOcnTransferLocStreamProto/esmApp.F90 index 9e7bec43..1cb22710 100644 --- a/AtmOcnTransferLocStreamProto/esmApp.F90 +++ b/AtmOcnTransferLocStreamProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnTransferLocStreamProto/ocn.F90 b/AtmOcnTransferLocStreamProto/ocn.F90 index 4962d331..768d946d 100644 --- a/AtmOcnTransferLocStreamProto/ocn.F90 +++ b/AtmOcnTransferLocStreamProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnTransferMeshProto/atm.F90 b/AtmOcnTransferMeshProto/atm.F90 index 234d107b..72389d82 100644 --- a/AtmOcnTransferMeshProto/atm.F90 +++ b/AtmOcnTransferMeshProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnTransferMeshProto/esm.F90 b/AtmOcnTransferMeshProto/esm.F90 index 43c8ce7b..71932311 100644 --- a/AtmOcnTransferMeshProto/esm.F90 +++ b/AtmOcnTransferMeshProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnTransferMeshProto/esmApp.F90 b/AtmOcnTransferMeshProto/esmApp.F90 index 9e7bec43..1cb22710 100644 --- a/AtmOcnTransferMeshProto/esmApp.F90 +++ b/AtmOcnTransferMeshProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnTransferMeshProto/ocn.F90 b/AtmOcnTransferMeshProto/ocn.F90 index f29c8042..06931c0b 100644 --- a/AtmOcnTransferMeshProto/ocn.F90 +++ b/AtmOcnTransferMeshProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/ComponentExplorer/nuopcExplorerApp.F90 b/ComponentExplorer/nuopcExplorerApp.F90 index ef6a61b7..2b0fa601 100644 --- a/ComponentExplorer/nuopcExplorerApp.F90 +++ b/ComponentExplorer/nuopcExplorerApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/ComponentExplorer/nuopcExplorerDriver.F90 b/ComponentExplorer/nuopcExplorerDriver.F90 index ad304078..96afc61c 100644 --- a/ComponentExplorer/nuopcExplorerDriver.F90 +++ b/ComponentExplorer/nuopcExplorerDriver.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/CustomFieldDictionaryProto/driver.F90 b/CustomFieldDictionaryProto/driver.F90 index 881e1eff..57abb5ff 100644 --- a/CustomFieldDictionaryProto/driver.F90 +++ b/CustomFieldDictionaryProto/driver.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/CustomFieldDictionaryProto/mainApp.F90 b/CustomFieldDictionaryProto/mainApp.F90 index bf009fc0..7bbf0cbd 100644 --- a/CustomFieldDictionaryProto/mainApp.F90 +++ b/CustomFieldDictionaryProto/mainApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/CustomFieldDictionaryProto/model.F90 b/CustomFieldDictionaryProto/model.F90 index f6dcc8de..0fdedc67 100644 --- a/CustomFieldDictionaryProto/model.F90 +++ b/CustomFieldDictionaryProto/model.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/CustomFieldDictionaryProto/util.F90 b/CustomFieldDictionaryProto/util.F90 index 309d7bd1..af95890d 100644 --- a/CustomFieldDictionaryProto/util.F90 +++ b/CustomFieldDictionaryProto/util.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/DriverInDriverProto/atm.F90 b/DriverInDriverProto/atm.F90 index e31dbfc9..aa98c4bf 100644 --- a/DriverInDriverProto/atm.F90 +++ b/DriverInDriverProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/DriverInDriverProto/driverChildComp.F90 b/DriverInDriverProto/driverChildComp.F90 index 17ea8d86..c6e8da32 100644 --- a/DriverInDriverProto/driverChildComp.F90 +++ b/DriverInDriverProto/driverChildComp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/DriverInDriverProto/driverParentComp.F90 b/DriverInDriverProto/driverParentComp.F90 index 2a458320..a4221f13 100644 --- a/DriverInDriverProto/driverParentComp.F90 +++ b/DriverInDriverProto/driverParentComp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/DriverInDriverProto/mainApp.F90 b/DriverInDriverProto/mainApp.F90 index 446e57c0..57aadf07 100644 --- a/DriverInDriverProto/mainApp.F90 +++ b/DriverInDriverProto/mainApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/DriverInDriverProto/ocn.F90 b/DriverInDriverProto/ocn.F90 index b3a33eaf..88aa9e00 100644 --- a/DriverInDriverProto/ocn.F90 +++ b/DriverInDriverProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/DriverInDriverProtoIPDv02/atm.F90 b/DriverInDriverProtoIPDv02/atm.F90 index b7d22349..ae3484b5 100644 --- a/DriverInDriverProtoIPDv02/atm.F90 +++ b/DriverInDriverProtoIPDv02/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/DriverInDriverProtoIPDv02/driverChildComp.F90 b/DriverInDriverProtoIPDv02/driverChildComp.F90 index 601f0dc1..dfc30f2f 100644 --- a/DriverInDriverProtoIPDv02/driverChildComp.F90 +++ b/DriverInDriverProtoIPDv02/driverChildComp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/DriverInDriverProtoIPDv02/driverParentComp.F90 b/DriverInDriverProtoIPDv02/driverParentComp.F90 index 0a4b188f..c3cdc8d8 100644 --- a/DriverInDriverProtoIPDv02/driverParentComp.F90 +++ b/DriverInDriverProtoIPDv02/driverParentComp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/DriverInDriverProtoIPDv02/mainApp.F90 b/DriverInDriverProtoIPDv02/mainApp.F90 index 446e57c0..57aadf07 100644 --- a/DriverInDriverProtoIPDv02/mainApp.F90 +++ b/DriverInDriverProtoIPDv02/mainApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/DriverInDriverProtoIPDv02/ocn.F90 b/DriverInDriverProtoIPDv02/ocn.F90 index 5ed878ba..2243eded 100644 --- a/DriverInDriverProtoIPDv02/ocn.F90 +++ b/DriverInDriverProtoIPDv02/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/DynPhyProto/atm.F90 b/DynPhyProto/atm.F90 index 7944f317..794fe0e7 100644 --- a/DynPhyProto/atm.F90 +++ b/DynPhyProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/DynPhyProto/dyn.F90 b/DynPhyProto/dyn.F90 index c5d59377..e2741f34 100644 --- a/DynPhyProto/dyn.F90 +++ b/DynPhyProto/dyn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/DynPhyProto/esmApp.F90 b/DynPhyProto/esmApp.F90 index 1b61f623..dd7dd8ce 100644 --- a/DynPhyProto/esmApp.F90 +++ b/DynPhyProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/DynPhyProto/phy.F90 b/DynPhyProto/phy.F90 index 3d3b3e82..50252efb 100644 --- a/DynPhyProto/phy.F90 +++ b/DynPhyProto/phy.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/ExternalDriverAPIProto/atm.F90 b/ExternalDriverAPIProto/atm.F90 index 66026da7..b4e1246e 100644 --- a/ExternalDriverAPIProto/atm.F90 +++ b/ExternalDriverAPIProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/ExternalDriverAPIProto/esm.F90 b/ExternalDriverAPIProto/esm.F90 index a858b93d..358810c4 100644 --- a/ExternalDriverAPIProto/esm.F90 +++ b/ExternalDriverAPIProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/ExternalDriverAPIProto/externalApp.F90 b/ExternalDriverAPIProto/externalApp.F90 index e70d8f5d..2957404d 100644 --- a/ExternalDriverAPIProto/externalApp.F90 +++ b/ExternalDriverAPIProto/externalApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/ExternalDriverAPIProto/ocn.F90 b/ExternalDriverAPIProto/ocn.F90 index 28a96818..ac29963b 100644 --- a/ExternalDriverAPIProto/ocn.F90 +++ b/ExternalDriverAPIProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/GenericMediatorProto/app.F90 b/GenericMediatorProto/app.F90 index 019e007e..a1a087db 100644 --- a/GenericMediatorProto/app.F90 +++ b/GenericMediatorProto/app.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/GenericMediatorProto/driver.F90 b/GenericMediatorProto/driver.F90 index 07a3c7d2..279ae908 100644 --- a/GenericMediatorProto/driver.F90 +++ b/GenericMediatorProto/driver.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/GenericMediatorProto/mediator.F90 b/GenericMediatorProto/mediator.F90 index ad826deb..c5df5023 100644 --- a/GenericMediatorProto/mediator.F90 +++ b/GenericMediatorProto/mediator.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/GenericMediatorProto/modelA.F90 b/GenericMediatorProto/modelA.F90 index 9d9ba2c7..fad2c0cd 100644 --- a/GenericMediatorProto/modelA.F90 +++ b/GenericMediatorProto/modelA.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/GenericMediatorProto/modelB.F90 b/GenericMediatorProto/modelB.F90 index 995daa4c..a4ecbc22 100644 --- a/GenericMediatorProto/modelB.F90 +++ b/GenericMediatorProto/modelB.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/HierarchyProto/atm.F90 b/HierarchyProto/atm.F90 index 6a357237..c6fd56ac 100644 --- a/HierarchyProto/atm.F90 +++ b/HierarchyProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/HierarchyProto/dyn.F90 b/HierarchyProto/dyn.F90 index 29be29ff..74808f86 100644 --- a/HierarchyProto/dyn.F90 +++ b/HierarchyProto/dyn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/HierarchyProto/esm.F90 b/HierarchyProto/esm.F90 index 0d8494fa..8ce92dd2 100644 --- a/HierarchyProto/esm.F90 +++ b/HierarchyProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/HierarchyProto/esmApp.F90 b/HierarchyProto/esmApp.F90 index 396853ae..cb487bdd 100644 --- a/HierarchyProto/esmApp.F90 +++ b/HierarchyProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/HierarchyProto/ocn.F90 b/HierarchyProto/ocn.F90 index 02ab2c76..8db628e0 100644 --- a/HierarchyProto/ocn.F90 +++ b/HierarchyProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/HierarchyProto/phy.F90 b/HierarchyProto/phy.F90 index 5b136e1b..ad84fd71 100644 --- a/HierarchyProto/phy.F90 +++ b/HierarchyProto/phy.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/NamespaceProto/atm.F90 b/NamespaceProto/atm.F90 index fef02496..73728c95 100644 --- a/NamespaceProto/atm.F90 +++ b/NamespaceProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/NamespaceProto/driver.F90 b/NamespaceProto/driver.F90 index 2304cf67..e08eed18 100644 --- a/NamespaceProto/driver.F90 +++ b/NamespaceProto/driver.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/NamespaceProto/mainApp.F90 b/NamespaceProto/mainApp.F90 index fd86b792..e05a761b 100644 --- a/NamespaceProto/mainApp.F90 +++ b/NamespaceProto/mainApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/NamespaceProto/med.F90 b/NamespaceProto/med.F90 index 922ab269..86a0cabe 100644 --- a/NamespaceProto/med.F90 +++ b/NamespaceProto/med.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/NestingMultipleProto/advectDiffComp.F90 b/NestingMultipleProto/advectDiffComp.F90 index b2b084e2..fa87f258 100644 --- a/NestingMultipleProto/advectDiffComp.F90 +++ b/NestingMultipleProto/advectDiffComp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/NestingMultipleProto/driverComp.F90 b/NestingMultipleProto/driverComp.F90 index 95b71138..c2c0a9b1 100644 --- a/NestingMultipleProto/driverComp.F90 +++ b/NestingMultipleProto/driverComp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/NestingMultipleProto/mainApp.F90 b/NestingMultipleProto/mainApp.F90 index 50e19651..2c9040d1 100644 --- a/NestingMultipleProto/mainApp.F90 +++ b/NestingMultipleProto/mainApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/NestingSingleProto/advectDiffComp.F90 b/NestingSingleProto/advectDiffComp.F90 index e542ded9..d398cb65 100644 --- a/NestingSingleProto/advectDiffComp.F90 +++ b/NestingSingleProto/advectDiffComp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/NestingSingleProto/driverComp.F90 b/NestingSingleProto/driverComp.F90 index 74e9a7c1..a6e6114c 100644 --- a/NestingSingleProto/driverComp.F90 +++ b/NestingSingleProto/driverComp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/NestingSingleProto/mainApp.F90 b/NestingSingleProto/mainApp.F90 index 50e19651..2c9040d1 100644 --- a/NestingSingleProto/mainApp.F90 +++ b/NestingSingleProto/mainApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/NestingTelescopeMultipleProto/advectDiffComp.F90 b/NestingTelescopeMultipleProto/advectDiffComp.F90 index 65d1f384..42910ba2 100644 --- a/NestingTelescopeMultipleProto/advectDiffComp.F90 +++ b/NestingTelescopeMultipleProto/advectDiffComp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/NestingTelescopeMultipleProto/driverComp.F90 b/NestingTelescopeMultipleProto/driverComp.F90 index 695831b2..a572bece 100644 --- a/NestingTelescopeMultipleProto/driverComp.F90 +++ b/NestingTelescopeMultipleProto/driverComp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/NestingTelescopeMultipleProto/mainApp.F90 b/NestingTelescopeMultipleProto/mainApp.F90 index 50e19651..2c9040d1 100644 --- a/NestingTelescopeMultipleProto/mainApp.F90 +++ b/NestingTelescopeMultipleProto/mainApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/PerformanceConnectorProto/atm.F90 b/PerformanceConnectorProto/atm.F90 index d084a84b..d406e3e1 100644 --- a/PerformanceConnectorProto/atm.F90 +++ b/PerformanceConnectorProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/PerformanceConnectorProto/conn.F90 b/PerformanceConnectorProto/conn.F90 index 2c5c69b4..c63811dc 100644 --- a/PerformanceConnectorProto/conn.F90 +++ b/PerformanceConnectorProto/conn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/PerformanceConnectorProto/esm.F90 b/PerformanceConnectorProto/esm.F90 index e27026e0..40aa20d6 100644 --- a/PerformanceConnectorProto/esm.F90 +++ b/PerformanceConnectorProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/PerformanceConnectorProto/esmApp.F90 b/PerformanceConnectorProto/esmApp.F90 index a1a107a9..dbf229f4 100644 --- a/PerformanceConnectorProto/esmApp.F90 +++ b/PerformanceConnectorProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/PerformanceConnectorProto/ocn.F90 b/PerformanceConnectorProto/ocn.F90 index e48855b0..7fe0fb9f 100644 --- a/PerformanceConnectorProto/ocn.F90 +++ b/PerformanceConnectorProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/PerformanceRunSequenceProto/driver.F90 b/PerformanceRunSequenceProto/driver.F90 index 13281053..0ca1e1f5 100644 --- a/PerformanceRunSequenceProto/driver.F90 +++ b/PerformanceRunSequenceProto/driver.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/PerformanceRunSequenceProto/mainApp.F90 b/PerformanceRunSequenceProto/mainApp.F90 index d5389bf7..c2a42dc7 100644 --- a/PerformanceRunSequenceProto/mainApp.F90 +++ b/PerformanceRunSequenceProto/mainApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/PerformanceRunSequenceProto/model.F90 b/PerformanceRunSequenceProto/model.F90 index 13971b44..f2758755 100644 --- a/PerformanceRunSequenceProto/model.F90 +++ b/PerformanceRunSequenceProto/model.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/SingleModelOpenMPProto/driver.F90 b/SingleModelOpenMPProto/driver.F90 index bbfacf7c..12696e78 100644 --- a/SingleModelOpenMPProto/driver.F90 +++ b/SingleModelOpenMPProto/driver.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/SingleModelOpenMPProto/mainApp.F90 b/SingleModelOpenMPProto/mainApp.F90 index e9b7ae89..ca55da2a 100644 --- a/SingleModelOpenMPProto/mainApp.F90 +++ b/SingleModelOpenMPProto/mainApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/SingleModelOpenMPProto/model.F90 b/SingleModelOpenMPProto/model.F90 index 3874ea15..f4279c8e 100644 --- a/SingleModelOpenMPProto/model.F90 +++ b/SingleModelOpenMPProto/model.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/SingleModelProto/driver.F90 b/SingleModelProto/driver.F90 index aee963dc..f39606a3 100644 --- a/SingleModelProto/driver.F90 +++ b/SingleModelProto/driver.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/SingleModelProto/mainApp.F90 b/SingleModelProto/mainApp.F90 index fd86b792..e05a761b 100644 --- a/SingleModelProto/mainApp.F90 +++ b/SingleModelProto/mainApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/SingleModelProto/model.F90 b/SingleModelProto/model.F90 index 80cf2558..82a563eb 100644 --- a/SingleModelProto/model.F90 +++ b/SingleModelProto/model.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/testProtos.sh b/testProtos.sh index 033a6c17..62d6e5ef 100755 --- a/testProtos.sh +++ b/testProtos.sh @@ -2,7 +2,7 @@ #============================================================================== # Earth System Modeling Framework -# Copyright 2002-2019, University Corporation for Atmospheric Research, +# Copyright 2002-2020, University Corporation for Atmospheric Research, # Massachusetts Institute of Technology, Geophysical Fluid Dynamics # Laboratory, University of Michigan, National Centers for Environmental # Prediction, Los Alamos National Laboratory, Argonne National Laboratory, From 616eb41df3001c8f4463e9584c7d9d6ee7a6e748 Mon Sep 17 00:00:00 2001 From: Daniel Rosen Date: Fri, 1 May 2020 23:43:57 +0000 Subject: [PATCH 09/68] Add AtmOcnConOptsProto to NUOPC prototypes. --- AtmOcnConOptsProto/Makefile | 73 ++++ AtmOcnConOptsProto/README | 48 +++ AtmOcnConOptsProto/atm.F90 | 481 ++++++++++++++++++++++++++ AtmOcnConOptsProto/esm.F90 | 483 ++++++++++++++++++++++++++ AtmOcnConOptsProto/esmApp.F90 | 114 +++++++ AtmOcnConOptsProto/esmApp.runconfig | 44 +++ AtmOcnConOptsProto/ocn.F90 | 507 ++++++++++++++++++++++++++++ testProtos.sh | 1 + 8 files changed, 1751 insertions(+) create mode 100644 AtmOcnConOptsProto/Makefile create mode 100644 AtmOcnConOptsProto/README create mode 100644 AtmOcnConOptsProto/atm.F90 create mode 100644 AtmOcnConOptsProto/esm.F90 create mode 100644 AtmOcnConOptsProto/esmApp.F90 create mode 100644 AtmOcnConOptsProto/esmApp.runconfig create mode 100644 AtmOcnConOptsProto/ocn.F90 diff --git a/AtmOcnConOptsProto/Makefile b/AtmOcnConOptsProto/Makefile new file mode 100644 index 00000000..9ab63796 --- /dev/null +++ b/AtmOcnConOptsProto/Makefile @@ -0,0 +1,73 @@ +# GNU Makefile template for user ESMF application + +################################################################################ +################################################################################ +## This Makefile must be able to find the "esmf.mk" Makefile fragment in the ## +## 'include' line below. Following the ESMF User's Guide, a complete ESMF ## +## installation should ensure that a single environment variable "ESMFMKFILE" ## +## is made available on the system. This variable should point to the ## +## "esmf.mk" file. ## +## ## +## This example Makefile uses the "ESMFMKFILE" environment variable. ## +## ## +## If you notice that this Makefile cannot find variable ESMFMKFILE then ## +## please contact the person responsible for the ESMF installation on your ## +## system. ## +## As a work-around you can simply hardcode the path to "esmf.mk" in the ## +## include line below. However, doing so will render this Makefile a lot less ## +## flexible and non-portable. ## +################################################################################ + +ifneq ($(origin ESMFMKFILE), environment) +$(error Environment variable ESMFMKFILE was not set.) +endif + +include $(ESMFMKFILE) + +################################################################################ +################################################################################ + +.SUFFIXES: .f90 .F90 .c .C + +%.o : %.f90 + $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREENOCPP) $< + +%.o : %.F90 + $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $< + +%.o : %.c + $(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< + +%.o : %.C + $(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< + + +# ----------------------------------------------------------------------------- +esmApp: esmApp.o esm.o atm.o ocn.o + $(ESMF_F90LINKER) $(ESMF_F90LINKOPTS) $(ESMF_F90LINKPATHS) $(ESMF_F90LINKRPATHS) -o $@ $^ $(ESMF_F90ESMFLINKLIBS) + +# module dependencies: +esmApp.o: esm.o +esm.o: atm.o ocn.o + +# ----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- +.PHONY: dust clean distclean info edit +dust: + rm -rf PET*.ESMF_LogFile traceout *.nc *.stdout +clean: + rm -f esmApp *.o *.mod +distclean: dust clean + +info: + @echo ================================================================== + @echo ESMFMKFILE=$(ESMFMKFILE) + @echo ================================================================== + @cat $(ESMFMKFILE) + @echo ================================================================== + +edit: + nedit esmApp.F90 esm.F90 atm.F90 ocn.F90 & + +run: + mpirun -np 4 ./esmApp diff --git a/AtmOcnConOptsProto/README b/AtmOcnConOptsProto/README new file mode 100644 index 00000000..d5d16d29 --- /dev/null +++ b/AtmOcnConOptsProto/README @@ -0,0 +1,48 @@ +README for ATM-OCN Connector Options NUOPC prototype +---------------------------------------------------- + +A two model system with runtime configuration for connector options. + +Description: + + A two-way coupled system with a single driver, two model components, and + connectors. + + The ESM driver component uses the run sequence configured in the + esmApp.runconfig file. + + The connector components are automatically added by the driver unless + AUTOCONNECTORS is disabled in esm.F90. + + Both ATM and OCN components initialize import data fields to 999999. + Export data is initialized based on the field. + + Run success is determined by the zeroValues and missingValues found in + the final import state. Set zeroValues and missingValues in the + esmApp.runconfig file as needed. + + For example: + zeroregion=select, this setting results in missing values + extrapmethod=nearest_stod, this setting results in no missing/zero values + +Build: + - Set environment variable ESMFMKFILE to point to the esmf.mk of your ESMF + installation. + - gmake + +Execution: + - Optionally set environment variable ESMF_RUNTIME_COMPLIANCECHECK to ON. + - mpirun -np X ./esmApp (where X is the total number of PETs, typically 4) + +Output: + - PET*.Log files containing compliance checker output if turned on. + - The prototype outputs time stepping information to stdout. + +Code structure: + - Makefile - Makefile that is based on the standard esmf.mk mechanism. + - atm.F90 - The ATM component, specializing generic NUOPC_Model. + - ocn.F90 - The OCN component, specializing generic NUOPC_Model. + - esm.F90 - The Earth System Model (ESM) component, specializing + generic NUOPC_Driver. + - esmApp.F90 - ESM application. + - esmApp.runconfig - Runtime configuration diff --git a/AtmOcnConOptsProto/atm.F90 b/AtmOcnConOptsProto/atm.F90 new file mode 100644 index 00000000..074fb265 --- /dev/null +++ b/AtmOcnConOptsProto/atm.F90 @@ -0,0 +1,481 @@ +!============================================================================== +! Earth System Modeling Framework +! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! NASA Goddard Space Flight Center. +! Licensed under the University of Illinois-NCSA License. +!============================================================================== + +module ATM + + !----------------------------------------------------------------------------- + ! ATM Component. + !----------------------------------------------------------------------------- + + use ESMF + use NUOPC + use NUOPC_Model, & + model_routine_SS => SetServices, & + model_label_Advance => label_Advance, & + model_label_Finalize => label_Finalize + + implicit none + + private + + public SetServices + + real(ESMF_KIND_R8),parameter :: zeroValue = 0.0_ESMF_KIND_R8 + real(ESMF_KIND_R8),parameter :: missingValue = 999999.0_ESMF_KIND_R8 + + !----------------------------------------------------------------------------- + contains + !----------------------------------------------------------------------------- + + subroutine SetServices(model, rc) + type(ESMF_GridComp) :: model + integer, intent(out) :: rc + + rc = ESMF_SUCCESS + + ! the NUOPC model component will register the generic methods + call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! set entry point for methods that require specific implementation + call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & + phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & + phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! attach specializing method(s) + call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & + specRoutine=ModelAdvance, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_CompSpecialize(model, specLabel=model_label_Finalize, & + specRoutine=ModelFinalize, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + end subroutine + + !----------------------------------------------------------------------------- + + subroutine InitializeP1(model, importState, exportState, clock, rc) + type(ESMF_GridComp) :: model + type(ESMF_State) :: importState, exportState + type(ESMF_Clock) :: clock + integer, intent(out) :: rc + + rc = ESMF_SUCCESS + + ! Disabling the following macro, e.g. renaming to WITHIMPORTFIELDS_disable, + ! will result in a model component that does not advertise any importable + ! Fields. Use this if you want to drive the model independently. +#define WITHIMPORTFIELDS +#ifdef WITHIMPORTFIELDS + ! importable field: sea_surface_temperature + call NUOPC_Advertise(importState, & + StandardName="sea_surface_temperature", name="sst", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out +#endif + + ! exportable field: air_pressure_at_sea_level + call NUOPC_Advertise(exportState, & + StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! exportable field: surface_net_downward_shortwave_flux + call NUOPC_Advertise(exportState, & + StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + end subroutine + + !----------------------------------------------------------------------------- + + subroutine InitializeP2(model, importState, exportState, clock, rc) + type(ESMF_GridComp) :: model + type(ESMF_State) :: importState, exportState + type(ESMF_Clock) :: clock + integer, intent(out) :: rc + + ! local variables + type(ESMF_Field) :: field + type(ESMF_Grid) :: gridIn + type(ESMF_Grid) :: gridOut + + rc = ESMF_SUCCESS + + ! create a Grid object for Fields + gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/24, 25/), & + minCornerCoord=(/245._ESMF_KIND_R8, -5._ESMF_KIND_R8/), & + maxCornerCoord=(/350._ESMF_KIND_R8, 55._ESMF_KIND_R8/), & + coordSys=ESMF_COORDSYS_SPH_DEG, staggerLocList=(/ESMF_STAGGERLOC_CENTER/), & + rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + gridOut = gridIn ! for now out same as in + +#ifdef WITHIMPORTFIELDS + ! importable field: sea_surface_temperature + field = ESMF_FieldCreate(name="sst", grid=gridIn, & + typekind=ESMF_TYPEKIND_R8, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_Realize(importState, field=field, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! fill import field sst with 999999 + call ESMF_FieldFill(field, dataFillScheme="const", & + const1=missingValue, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out +#endif + + ! exportable field: air_pressure_at_sea_level +#ifdef CREATE_AND_REALIZE + ! This branch shows the standard procedure of creating a complete field + ! with Grid and memory allocation, and then calling Realize() for it. + field = ESMF_FieldCreate(name="pmsl", grid=gridOut, & + typekind=ESMF_TYPEKIND_R8, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_Realize(exportState, field=field, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out +#else + ! This branch shows the alternative way of "realizing" an advertised field. + ! It accesses the empty field that was created during advertise, and + ! finishes it, setting a Grid on it, and then calling FieldEmptyComplete(). + ! No formal Realize() is then needed. + call ESMF_StateGet(exportState, field=field, itemName="pmsl", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_FieldEmptySet(field, grid=gridOut, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_FieldEmptyComplete(field, typekind=ESMF_TYPEKIND_R8, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out +#ifdef WITH_FORMAL_REALIZE + ! There is not need to formally call Realize() when completing the + ! adverised field directly. However, calling Realize() also works. + call NUOPC_Realize(exportState, field=field, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out +#endif +#endif + ! fill export field pmsl with 95000 + call ESMF_FieldFill(field, dataFillScheme="const", & + const1=95000.0_ESMF_KIND_R8, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! exportable field: surface_net_downward_shortwave_flux + field = ESMF_FieldCreate(name="rsns", grid=gridOut, & + typekind=ESMF_TYPEKIND_R8, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_Realize(exportState, field=field, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! fill export field rsns with 200 + call ESMF_FieldFill(field, dataFillScheme="const", & + const1=200.0_ESMF_KIND_R8, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + end subroutine + + !----------------------------------------------------------------------------- + + subroutine ModelAdvance(model, rc) + type(ESMF_GridComp) :: model + integer, intent(out) :: rc + + ! local variables + type(ESMF_Clock) :: clock + type(ESMF_State) :: importState, exportState + character(len=160) :: msgString + +#define NUOPC_TRACE__OFF +#ifdef NUOPC_TRACE + call ESMF_TraceRegionEnter("ATM:ModelAdvance") +#endif + + rc = ESMF_SUCCESS + + ! query the Component for its clock, importState and exportState + call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep + + ! Because of the way that the internal Clock was set by default, + ! its timeStep is equal to the parent timeStep. As a consequence the + ! currTime + timeStep is equal to the stopTime of the internal Clock + ! for this call of the ModelAdvance() routine. + + call ESMF_ClockPrint(clock, options="currTime", & + preString="------>Advancing ATM from: ", unit=msgString, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + call ESMF_ClockPrint(clock, options="stopTime", & + preString="---------------------> to: ", unit=msgString, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + +#ifdef NUOPC_TRACE + call ESMF_TraceRegionExit("ATM:ModelAdvance") +#endif + + end subroutine + + !----------------------------------------------------------------------------- + + subroutine ModelFinalize(model, rc) + type(ESMF_GridComp) :: model + integer, intent(out) :: rc + ! local variables + type(ESMF_VM) :: vm + character(ESMF_MAXSTR) :: name + character(len=8) :: value + logical :: zeroValues + logical :: missingValues + integer :: localPet + type(ESMF_State) :: importState + integer :: itemCount, i + integer :: fieldCount + character(len=80), allocatable :: itemNameList(:) + type(ESMF_StateItem_Flag), allocatable :: itemTypeList(:) + type(ESMF_Field) :: field + real(ESMF_KIND_R8), pointer :: farrayPtr(:,:) + integer :: lclZero(1) + integer :: gblZero(1) + integer :: lclMissing(1) + integer :: gblMissing(1) + + rc = ESMF_SUCCESS + + ! query the Component for its vm + call ESMF_GridCompGet(model, vm=vm, name=name, localPet=localPet, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! get diagnostic settings + call ESMF_AttributeGet(model, name="zeroValues", & + value=value, defaultValue="false", & + convention="NUOPC", purpose="Instance", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + value = ESMF_UtilStringLowerCase(value, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + select case (value) + case ('true','t','yes') + zeroValues=.true. + case default + zeroValues=.false. + endselect + + call ESMF_AttributeGet(model, name="missingValues", & + value=value, defaultValue="false", & + convention="NUOPC", purpose="Instance", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + value = ESMF_UtilStringLowerCase(value, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + select case (value) + case ('true','t','yes') + missingValues=.true. + case default + missingValues=.false. + endselect + + ! query the Component for its importState + call NUOPC_ModelGet(model, importState=importState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! fill import state with zeros + call ESMF_StateGet(importState, nestedFlag=.true., & + itemCount=itemCount, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + allocate(itemNameList(itemCount), itemTypeList(itemCount)) + call ESMF_StateGet(importState, nestedFlag=.true., & + itemNameList=itemNameList, itemTypeList=itemTypeList, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + do i=1, itemCount + if (itemTypeList(i)==ESMF_STATEITEM_FIELD) then + call ESMF_StateGet(importState, field=field, itemName=itemNameList(i), & + rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_FieldGet(field, farrayPtr=farrayPtr, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + lclZero(1) = COUNT(farrayPtr(:,:).eq.zeroValue) + lclMissing(1) = COUNT(farrayPtr(:,:).eq.missingValue) + call ESMF_VMReduce(vm, lclZero, gblZero, & + reduceflag=ESMF_REDUCE_SUM, count=1, rootPet=0, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_VMReduce(vm, lclMissing, gblMissing, & + reduceflag=ESMF_REDUCE_SUM, count=1, rootPet=0, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + if (localPet.eq.0) then + select case (itemNameList(i)) + case ('sst') + write (*,"(A,A,A,A,I0)") trim(name),": ", & + trim(itemNameList(i)), & + " zero values = ", gblZero(1) + write (*,"(A,A,A,A,I0)") trim(name),": ", & + trim(itemNameList(i)), & + " missing values = ", gblMissing(1) + if ((gblZero(1).gt.0).neqv.zeroValues) then + write (*,"(A,A,A,L1,A)") "ERROR: ",trim(name), & + " zero values must be ", zeroValues, & + ", see esmApp.runconfig file " + call ESMF_LogSetError(ESMF_RC_NOT_VALID, & + msg="Zero values does not match config settings", & + line=__LINE__, & + file=__FILE__, & + rcToReturn=rc) + return ! bail out + elseif ((gblMissing(1).gt.0).neqv.missingValues) then + write (*,"(A,A,A,L1,A)") "ERROR: ",trim(name), & + " missing values must be ", missingValues, & + ", see esmApp.runconfig file " + call ESMF_LogSetError(ESMF_RC_NOT_VALID, & + msg="Missing values does not match config settings", & + line=__LINE__, & + file=__FILE__, & + rcToReturn=rc) + return ! bail out + endif + case default + write (*,"(A)") "Field is unknown "//trim(itemNameList(i)) + call ESMF_LogSetError(ESMF_RC_NOT_VALID, & + msg="Field is unknown "//trim(itemNameList(i)), & + line=__LINE__, & + file=__FILE__, & + rcToReturn=rc) + return ! bail out + endselect + endif + endif + enddo + deallocate(itemNameList, itemTypeList) + + call ESMF_LogWrite("ATM: Field check passed.", ESMF_LOGMSG_INFO, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + end subroutine + +end module diff --git a/AtmOcnConOptsProto/esm.F90 b/AtmOcnConOptsProto/esm.F90 new file mode 100644 index 00000000..bc57c981 --- /dev/null +++ b/AtmOcnConOptsProto/esm.F90 @@ -0,0 +1,483 @@ +!============================================================================== +! Earth System Modeling Framework +! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! NASA Goddard Space Flight Center. +! Licensed under the University of Illinois-NCSA License. +!============================================================================== + +! Disabling the following macro, e.g. renaming to AUTOCONNECTORS_disable, +! will result in a driver that manually adds connectors between the model +! components before NUOPC_DriverIngestRunSequence +#define AUTOCONNECTORS + +module ESM + + !----------------------------------------------------------------------------- + ! Code that specializes generic ESM Component code. + !----------------------------------------------------------------------------- + + use ESMF + use NUOPC + use NUOPC_Driver, & + driver_routine_SS => SetServices, & + driver_label_SetModelServices => label_SetModelServices, & + driver_label_SetRunSequence => label_SetRunSequence + + use ATM, only: atmSS => SetServices + use OCN, only: ocnSS => SetServices + + use NUOPC_Connector, only: cplSS => SetServices + + implicit none + + private + + public SetServices + + !----------------------------------------------------------------------------- + contains + !----------------------------------------------------------------------------- + + subroutine SetServices(driver, rc) + type(ESMF_GridComp) :: driver + integer, intent(out) :: rc + + type(ESMF_Config) :: config + + rc = ESMF_SUCCESS + + ! NUOPC_Driver registers the generic methods + call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! attach specializing method(s) + call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & + specRoutine=SetModelServices, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetRunSequence, & + specRoutine=SetRunSequence, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! create, open and set the config + config = ESMF_ConfigCreate(rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_ConfigLoadFile(config, "esmApp.runconfig", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_GridCompSet(driver, config=config, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + end subroutine + + !----------------------------------------------------------------------------- + + subroutine SetModelServices(driver, rc) + type(ESMF_GridComp) :: driver + integer, intent(out) :: rc + + ! local variables + integer :: localPet + character(len=8) :: zeroValues + character(len=8) :: missingValues + type(ESMF_GridComp) :: child + type(ESMF_CplComp) :: connector + type(ESMF_Time) :: startTime + type(ESMF_Time) :: stopTime + type(ESMF_TimeInterval) :: timeStep + type(ESMF_Clock) :: internalClock + type(ESMF_Config) :: config + type(NUOPC_FreeFormat) :: attrFF + + rc = ESMF_SUCCESS + + ! query the Component for its localPet + call ESMF_GridCompGet(driver, localPet=localPet, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! read free format driver attributes + call ESMF_GridCompGet(driver, config=config, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + attrFF = NUOPC_FreeFormatCreate(config, label="driverAttributes::", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! read diagnostic settings + call ESMF_ConfigGetAttribute(config, missingValues, & + label="missingValues:", default="false", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_ConfigGetAttribute(config, zeroValues, & + label="zeroValues:", default="false", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + +#if 0 + print *, "-- start FreeFormatPrint(attrFF) of read in attributes --------" + call NUOPC_FreeFormatPrint(attrFF, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + print *, "---- end FreeFormatPrint(attrFF) of read in attributes --------" +#endif + + ! ingest FreeFormat driver attributes + call NUOPC_CompAttributeIngest(driver, attrFF, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! clean-up + call NUOPC_FreeFormatDestroy(attrFF, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! SetServices for ATM + call NUOPC_DriverAddComp(driver, "ATM", atmSS, comp=child, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! set default ATM attributes + call NUOPC_CompAttributeSet(child, name="Verbosity", value="1", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_CompAttributeSet(child, name="Diagnostic", value="0", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_CompAttributeAdd(child, & + attrList=(/"zeroValues ","missingValues"/), rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_AttributeSet(child, name="zeroValues", & + value=zeroValues, convention="NUOPC", purpose="Instance", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_AttributeSet(child, name="missingValues", & + value=missingValues, convention="NUOPC", purpose="Instance", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! read ATM attributes from config file into FreeFormat + attrFF = NUOPC_FreeFormatCreate(config, label="atmAttributes::", & + relaxedflag=.true., rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! ingest FreeFormat atm attributes + call NUOPC_CompAttributeIngest(child, attrFF, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! clean-up + call NUOPC_FreeFormatDestroy(attrFF, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! SetServices for OCN + call NUOPC_DriverAddComp(driver, "OCN", ocnSS, comp=child, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! set default OCN attributes + call NUOPC_CompAttributeSet(child, name="Verbosity", value="1", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_CompAttributeSet(child, name="Diagnostic", value="0", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_CompAttributeAdd(child, & + attrList=(/"zeroValues ","missingValues"/), rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_AttributeSet(child, name="zeroValues", & + value=zeroValues, convention="NUOPC", purpose="Instance", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_AttributeSet(child, name="missingValues", & + value=missingValues, convention="NUOPC", purpose="Instance", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! read OCN attributes from config file into FreeFormat + attrFF = NUOPC_FreeFormatCreate(config, label="ocnAttributes::", & + relaxedflag=.true., rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! ingest FreeFormat ocn attributes + call NUOPC_CompAttributeIngest(child, attrFF, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! clean-up + call NUOPC_FreeFormatDestroy(attrFF, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + +#ifndef AUTOCONNECTORS + if (localPet.eq.0) then + write(*,"(A)") "Manually adding connectors: ENABLED" + endif + ! SetServices for atm2ocn + call NUOPC_DriverAddComp(driver, srcCompLabel="ATM", dstCompLabel="OCN", & + compSetServicesRoutine=cplSS, comp=connector, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_CompAttributeSet(connector, name="Verbosity", value="1", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_CompAttributeSet(connector, name="Diagnostic", value="0", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + attrFF = NUOPC_FreeFormatCreate(config, label="connectorAttributes::", & + relaxedflag=.true., rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_CompAttributeIngest(connector, attrFF, & + addFlag=.true., rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_FreeFormatDestroy(attrFF, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! SetServices for ocn2atm + call NUOPC_DriverAddComp(driver, srcCompLabel="OCN", dstCompLabel="ATM", & + compSetServicesRoutine=cplSS, comp=connector, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_CompAttributeSet(connector, name="Verbosity", value="1", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_CompAttributeSet(connector, name="Diagnostic", value="0", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + attrFF = NUOPC_FreeFormatCreate(config, label="connectorAttributes::", & + relaxedflag=.true., rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_CompAttributeIngest(connector, attrFF, & + addFlag=.true., rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_FreeFormatDestroy(attrFF, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out +#else + if (localPet.eq.0) then + write(*,"(A)") "Manually adding connectors: DISABLED" + endif +#endif + + ! set the driver clock + call ESMF_TimeIntervalSet(timeStep, m=30, rc=rc) ! 15 minute default step + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + call ESMF_TimeSet(startTime, yy=2010, mm=6, dd=1, h=0, m=0, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + call ESMF_TimeSet(stopTime, yy=2010, mm=6, dd=1, h=1, m=0, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + internalClock = ESMF_ClockCreate(name="Application Clock", & + timeStep=timeStep, startTime=startTime, stopTime=stopTime, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + end subroutine + + !----------------------------------------------------------------------------- + + subroutine SetRunSequence(driver, rc) + type(ESMF_GridComp) :: driver + integer, intent(out) :: rc + + ! local variables + character(ESMF_MAXSTR) :: name + integer :: localPet + type(ESMF_Config) :: config + type(NUOPC_FreeFormat) :: runSeqFF + type(ESMF_CplComp), pointer :: connectorList(:) + integer :: i + type(NUOPC_FreeFormat) :: attrFF + + rc = ESMF_SUCCESS + + ! query the Component for info + call ESMF_GridCompGet(driver, name=name, localPet=localPet, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out + + ! read free format run sequence from config + call ESMF_GridCompGet(driver, config=config, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out + runSeqFF = NUOPC_FreeFormatCreate(config, label="runSeq::", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out + +#if 0 + call NUOPC_FreeFormatPrint(runSeqFF, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out +#endif + +#ifdef AUTOCONNECTORS + if (localPet.eq.0) then + write(*,"(A)") "NUOPC_DriverIngestRunSequence autoAddConnectors: .TRUE." + endif + ! ingest FreeFormat run sequence + call NUOPC_DriverIngestRunSequence(driver, runSeqFF, & + autoAddConnectors=.true., rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out + + nullify(connectorList) + call NUOPC_DriverGetComp(driver, compList=connectorList, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, file=__FILE__)) return ! bail out + + do i=1, size(connectorList) + call NUOPC_CompAttributeSet(connectorList(i), name="Verbosity", & + value="0", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, file=__FILE__)) return ! bail out + ! read CON attributes from config file into FreeFormat + attrFF = NUOPC_FreeFormatCreate(config, label="connectorAttributes::", & + relaxedflag=.true., rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, file=__FILE__)) return ! bail out + call NUOPC_CompAttributeIngest(connectorList(i), attrFF, & + addFlag=.true., rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, file=__FILE__)) return ! bail out + call NUOPC_FreeFormatDestroy(attrFF, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, file=__FILE__)) return ! bail out + enddo + + deallocate(connectorList) +#else + if (localPet.eq.0) then + write(*,"(A)") "NUOPC_DriverIngestRunSequence autoAddConnectors: UNSPECIFIED" + endif + ! ingest FreeFormat run sequence + call NUOPC_DriverIngestRunSequence(driver, runSeqFF, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out +#endif + + ! clean-up + call NUOPC_FreeFormatDestroy(runSeqFF, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out + + end subroutine + + !----------------------------------------------------------------------------- + +end module diff --git a/AtmOcnConOptsProto/esmApp.F90 b/AtmOcnConOptsProto/esmApp.F90 new file mode 100644 index 00000000..e86b8905 --- /dev/null +++ b/AtmOcnConOptsProto/esmApp.F90 @@ -0,0 +1,114 @@ +!============================================================================== +! Earth System Modeling Framework +! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! NASA Goddard Space Flight Center. +! Licensed under the University of Illinois-NCSA License. +!============================================================================== + +program esmApp + + !----------------------------------------------------------------------------- + ! Generic ESM application driver + !----------------------------------------------------------------------------- + + use ESMF + use NUOPC + use ESM, only: esmSS => SetServices + + implicit none + + integer :: rc, urc + type(ESMF_GridComp) :: esmComp + + ! Initialize ESMF + call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, & + defaultCalkind=ESMF_CALKIND_GREGORIAN, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + + call ESMF_LogWrite("esmApp STARTING", ESMF_LOGMSG_INFO, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + + ! Create the earth system Component + esmComp = ESMF_GridCompCreate(name="esm", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + + ! SetServices for the earth system Component + call ESMF_GridCompSetServices(esmComp, esmSS, userRc=urc, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + + ! Set Profiling Attribute + call NUOPC_CompAttributeSet(esmComp, name="Profiling", value="0", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + + ! Call Initialize for the earth system Component + call ESMF_GridCompInitialize(esmComp, userRc=urc, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + + ! Call Run for earth the system Component + call ESMF_GridCompRun(esmComp, userRc=urc, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + + ! Call Finalize for the earth system Component + call ESMF_GridCompFinalize(esmComp, userRc=urc, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + + ! Destroy the earth system Component + call ESMF_GridCompDestroy(esmComp, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + + call ESMF_LogWrite("esmApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + + ! Finalize ESMF + call ESMF_Finalize() + +end program diff --git a/AtmOcnConOptsProto/esmApp.runconfig b/AtmOcnConOptsProto/esmApp.runconfig new file mode 100644 index 00000000..2874ef4f --- /dev/null +++ b/AtmOcnConOptsProto/esmApp.runconfig @@ -0,0 +1,44 @@ +############################################### +#### esmApp Run-Time Configuration File ##### +############################################### + +# Connector Options +# :remapmethod = redist,bilinear,patch,nearest_stod,nearest_dtos, +# conserve (default=bilinear) +# :extrapmethod = none,nearest_idavg,nearest_stod,creep (default=none) +# :extrapnumsrcpnts = INTEGER (default=8) +# :extrapdistexponent = REAL (default=2.0) +# :extrapnumlevels = INTEGER (default=10) +# :ignoreDegenerate = true,false (default=false) +# :unmappedaction = error,ignore (default=ignore) +# :zeroregion = total(d),select,empty (default=total) + +zeroValues: true +missingValues: false + +# Encoding a simple run sequence +runSeq:: + @1800 # 30min time step + ATM -> OCN :remapmethod=bilinear:unmappedaction=ignore + OCN -> ATM :remapmethod=bilinear:unmappedaction=ignore + ATM + OCN + @ +:: + +# Attributes for components + +driverAttributes:: + Verbosity = 1 + Profiling = 0 +:: + +atmAttributes:: + Verbosity = 1 + Diagnostic = 0 +:: + +ocnAttributes:: + Verbosity = 1 + Diagnostic = 0 +:: diff --git a/AtmOcnConOptsProto/ocn.F90 b/AtmOcnConOptsProto/ocn.F90 new file mode 100644 index 00000000..8c4717fe --- /dev/null +++ b/AtmOcnConOptsProto/ocn.F90 @@ -0,0 +1,507 @@ +!============================================================================== +! Earth System Modeling Framework +! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! NASA Goddard Space Flight Center. +! Licensed under the University of Illinois-NCSA License. +!============================================================================== + +module OCN + + !----------------------------------------------------------------------------- + ! OCN Component. + !----------------------------------------------------------------------------- + + use ESMF + use NUOPC + use NUOPC_Model, & + model_routine_SS => SetServices, & + model_label_SetClock => label_SetClock, & + model_label_Advance => label_Advance, & + model_label_Finalize => label_Finalize + + implicit none + + private + + public SetServices + + real(ESMF_KIND_R8),parameter :: zeroValue = 0.0_ESMF_KIND_R8 + real(ESMF_KIND_R8),parameter :: missingValue = 999999.0_ESMF_KIND_R8 + + !----------------------------------------------------------------------------- + contains + !----------------------------------------------------------------------------- + + subroutine SetServices(model, rc) + type(ESMF_GridComp) :: model + integer, intent(out) :: rc + + rc = ESMF_SUCCESS + + ! the NUOPC model component will register the generic methods + call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! set entry point for methods that require specific implementation + call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & + phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & + phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! attach specializing method(s) + call NUOPC_CompSpecialize(model, specLabel=model_label_SetClock, & + specRoutine=SetClock, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & + specRoutine=ModelAdvance, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_CompSpecialize(model, specLabel=model_label_Finalize, & + specRoutine=ModelFinalize, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + end subroutine + + !----------------------------------------------------------------------------- + + subroutine InitializeP1(model, importState, exportState, clock, rc) + type(ESMF_GridComp) :: model + type(ESMF_State) :: importState, exportState + type(ESMF_Clock) :: clock + integer, intent(out) :: rc + + rc = ESMF_SUCCESS + + ! Disabling the following macro, e.g. renaming to WITHIMPORTFIELDS_disable, + ! will result in a model component that does not advertise any importable + ! Fields. Use this if you want to drive the model independently. +#define WITHIMPORTFIELDS +#ifdef WITHIMPORTFIELDS + ! importable field: air_pressure_at_sea_level + call NUOPC_Advertise(importState, & + StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! importable field: surface_net_downward_shortwave_flux + call NUOPC_Advertise(importState, & + StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out +#endif + + ! exportable field: sea_surface_temperature + call NUOPC_Advertise(exportState, & + StandardName="sea_surface_temperature", name="sst", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + end subroutine + + !----------------------------------------------------------------------------- + + subroutine InitializeP2(model, importState, exportState, clock, rc) + type(ESMF_GridComp) :: model + type(ESMF_State) :: importState, exportState + type(ESMF_Clock) :: clock + integer, intent(out) :: rc + + ! local variables + type(ESMF_TimeInterval) :: stabilityTimeStep + type(ESMF_Field) :: field + type(ESMF_Grid) :: gridIn + type(ESMF_Grid) :: gridOut + + rc = ESMF_SUCCESS + + ! create a Grid object for Fields + gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/15, 16/), & + minCornerCoord=(/260._ESMF_KIND_R8, 0._ESMF_KIND_R8/), & + maxCornerCoord=(/355._ESMF_KIND_R8, 45._ESMF_KIND_R8/), & + coordSys=ESMF_COORDSYS_SPH_DEG, staggerLocList=(/ESMF_STAGGERLOC_CENTER/), & + rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + gridOut = gridIn ! for now out same as in + + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + gridOut = gridIn ! for now out same as in + +#ifdef WITHIMPORTFIELDS + ! importable field: air_pressure_at_sea_level + field = ESMF_FieldCreate(name="pmsl", grid=gridIn, & + typekind=ESMF_TYPEKIND_R8, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_Realize(importState, field=field, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! fill import field pmsl with 999999 + call ESMF_FieldFill(field, dataFillScheme="const", & + const1=999999.0_ESMF_KIND_R8, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! importable field: surface_net_downward_shortwave_flux + field = ESMF_FieldCreate(name="rsns", grid=gridIn, & + typekind=ESMF_TYPEKIND_R8, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_Realize(importState, field=field, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! fill import field rsns with 999999 + call ESMF_FieldFill(field, dataFillScheme="const", & + const1=999999.0_ESMF_KIND_R8, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out +#endif + + ! exportable field: sea_surface_temperature + field = ESMF_FieldCreate(name="sst", grid=gridOut, & + typekind=ESMF_TYPEKIND_R8, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_Realize(exportState, field=field, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! fill export field sst with 270 + call ESMF_FieldFill(field, dataFillScheme="const", & + const1=270.0_ESMF_KIND_R8, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + end subroutine + + !----------------------------------------------------------------------------- + + subroutine SetClock(model, rc) + type(ESMF_GridComp) :: model + integer, intent(out) :: rc + + ! local variables + type(ESMF_Clock) :: clock + type(ESMF_TimeInterval) :: stabilityTimeStep + + rc = ESMF_SUCCESS + + ! query the Component for its clock, importState and exportState + call NUOPC_ModelGet(model, modelClock=clock, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! initialize internal clock + ! here: parent Clock and stability timeStep determine actual model timeStep + !TODO: stabilityTimeStep should be read in from configuation + !TODO: or computed from internal Grid information + call ESMF_TimeIntervalSet(stabilityTimeStep, m=5, rc=rc) ! 5 minute steps + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_CompSetClock(model, clock, stabilityTimeStep, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + end subroutine + + !----------------------------------------------------------------------------- + + subroutine ModelAdvance(model, rc) + type(ESMF_GridComp) :: model + integer, intent(out) :: rc + + ! local variables + type(ESMF_Clock) :: clock + type(ESMF_State) :: importState, exportState + type(ESMF_Time) :: currTime + type(ESMF_TimeInterval) :: timeStep + character(len=160) :: msgString + +#define NUOPC_TRACE__OFF +#ifdef NUOPC_TRACE + call ESMF_TraceRegionEnter("OCN:ModelAdvance") +#endif + + rc = ESMF_SUCCESS + + ! query the Component for its clock, importState and exportState + call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep + + ! Because of the way that the internal Clock was set in SetClock(), + ! its timeStep is likely smaller than the parent timeStep. As a consequence + ! the time interval covered by a single parent timeStep will result in + ! multiple calls to the ModelAdvance() routine. Every time the currTime + ! will come in by one internal timeStep advanced. This goes until the + ! stopTime of the internal Clock has been reached. + + call ESMF_ClockPrint(clock, options="currTime", & + preString="------>Advancing OCN from: ", unit=msgString, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + call ESMF_TimePrint(currTime + timeStep, & + preString="---------------------> to: ", unit=msgString, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + +#ifdef NUOPC_TRACE + call ESMF_TraceRegionExit("OCN:ModelAdvance") +#endif + end subroutine + + !----------------------------------------------------------------------------- + + subroutine ModelFinalize(model, rc) + type(ESMF_GridComp) :: model + integer, intent(out) :: rc + ! local variables + type(ESMF_VM) :: vm + character(ESMF_MAXSTR) :: name + character(len=8) :: value + logical :: zeroValues + logical :: missingValues + integer :: localPet + type(ESMF_State) :: importState + integer :: itemCount, i + integer :: fieldCount + character(len=80), allocatable :: itemNameList(:) + type(ESMF_StateItem_Flag), allocatable :: itemTypeList(:) + type(ESMF_Field) :: field + real(ESMF_KIND_R8), pointer :: farrayPtr(:,:) + integer :: lclZero(1) + integer :: gblZero(1) + integer :: lclMissing(1) + integer :: gblMissing(1) + + rc = ESMF_SUCCESS + + ! query the Component for its vm + call ESMF_GridCompGet(model, vm=vm, name=name, localPet=localPet, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! get diagnostic settings + call ESMF_AttributeGet(model, name="zeroValues", & + value=value, defaultValue="false", & + convention="NUOPC", purpose="Instance", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + value = ESMF_UtilStringLowerCase(value, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + select case (value) + case ('true','t','yes') + zeroValues=.true. + case default + zeroValues=.false. + endselect + + call ESMF_AttributeGet(model, name="missingValues", & + value=value, defaultValue="false", & + convention="NUOPC", purpose="Instance", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + value = ESMF_UtilStringLowerCase(value, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + select case (value) + case ('true','t','yes') + missingValues=.true. + case default + missingValues=.false. + endselect + + ! query the Component for its importState + call NUOPC_ModelGet(model, importState=importState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! fill import state with zeros + call ESMF_StateGet(importState, nestedFlag=.true., & + itemCount=itemCount, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + allocate(itemNameList(itemCount), itemTypeList(itemCount)) + call ESMF_StateGet(importState, nestedFlag=.true., & + itemNameList=itemNameList, itemTypeList=itemTypeList, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + do i=1, itemCount + if (itemTypeList(i)==ESMF_STATEITEM_FIELD) then + call ESMF_StateGet(importState, field=field, itemName=itemNameList(i), & + rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_FieldGet(field, farrayPtr=farrayPtr, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + lclZero(1) = COUNT(farrayPtr(:,:).eq.zeroValue) + lclMissing(1) = COUNT(farrayPtr(:,:).eq.missingValue) + call ESMF_VMReduce(vm, lclZero, gblZero, & + reduceflag=ESMF_REDUCE_SUM, count=1, rootPet=0, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_VMReduce(vm, lclMissing, gblMissing, & + reduceflag=ESMF_REDUCE_SUM, count=1, rootPet=0, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + if (localPet.eq.0) then + select case (itemNameList(i)) + case ('pmsl','rsns') + write (*,"(A,A,A,A,I0)") trim(name),": ", & + trim(itemNameList(i)), & + " zero values = ", gblZero(1) + write (*,"(A,A,A,A,I0)") trim(name),": ", & + trim(itemNameList(i)), & + " missing values = ", gblMissing(1) + if ((gblZero(1).gt.0).neqv.zeroValues) then + write (*,"(A,A,A,L1,A)") "ERROR: ",trim(name), & + " zero values must be ", zeroValues, & + ", see esmApp.runconfig file " + call ESMF_LogSetError(ESMF_RC_NOT_VALID, & + msg="Zero values does not match config settings", & + line=__LINE__, & + file=__FILE__, & + rcToReturn=rc) + return ! bail out + elseif ((gblMissing(1).gt.0).neqv.missingValues) then + write (*,"(A,A,A,L1,A)") "ERROR: ",trim(name), & + " missing values must be ", missingValues, & + ", see esmApp.runconfig file " + call ESMF_LogSetError(ESMF_RC_NOT_VALID, & + msg="Missing values does not match config settings", & + line=__LINE__, & + file=__FILE__, & + rcToReturn=rc) + return ! bail out + endif + case default + write (*,"(A)") "Field is unknown "//trim(itemNameList(i)) + call ESMF_LogSetError(ESMF_RC_NOT_VALID, & + msg="Field is unknown "//trim(itemNameList(i)), & + line=__LINE__, & + file=__FILE__, & + rcToReturn=rc) + return ! bail out + endselect + endif + endif + enddo + deallocate(itemNameList, itemTypeList) + + call ESMF_LogWrite("ATM: Field check passed.", ESMF_LOGMSG_INFO, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + end subroutine + +end module diff --git a/testProtos.sh b/testProtos.sh index 62d6e5ef..2d507bdd 100755 --- a/testProtos.sh +++ b/testProtos.sh @@ -223,6 +223,7 @@ echo TestProto AsyncIOBlockingProto asyncIOApp TestProto AsyncIONonblockingProto asyncIOApp TestProto AtmOcnConProto esmApp +TestProto AtmOcnConOptsProto esmApp TestProto AtmOcnCplListProto esmApp TestProto AtmOcnCplSetProto esmApp TestProto AtmOcnFDSynoProto esmApp From d9767d10bbf7675f0933832014b798feb27c19cb Mon Sep 17 00:00:00 2001 From: Daniel Rosen Date: Wed, 6 May 2020 15:40:22 +0000 Subject: [PATCH 10/68] Add runconfig (.cfg) files to AtmOcnConOptsProto. --- AtmOcnConOptsProto/README | 19 ++++++-- AtmOcnConOptsProto/atm.F90 | 4 +- .../{esmApp.runconfig => bilinear.cfg} | 0 AtmOcnConOptsProto/bilinear_nearest.cfg | 44 +++++++++++++++++++ AtmOcnConOptsProto/bilinear_select.cfg | 44 +++++++++++++++++++ AtmOcnConOptsProto/esm.F90 | 40 ++++++++++++++++- AtmOcnConOptsProto/ocn.F90 | 4 +- testProtos.sh | 36 +++++++++++++++ 8 files changed, 181 insertions(+), 10 deletions(-) rename AtmOcnConOptsProto/{esmApp.runconfig => bilinear.cfg} (100%) create mode 100644 AtmOcnConOptsProto/bilinear_nearest.cfg create mode 100644 AtmOcnConOptsProto/bilinear_select.cfg diff --git a/AtmOcnConOptsProto/README b/AtmOcnConOptsProto/README index d5d16d29..e76e5f2d 100644 --- a/AtmOcnConOptsProto/README +++ b/AtmOcnConOptsProto/README @@ -9,7 +9,7 @@ Description: connectors. The ESM driver component uses the run sequence configured in the - esmApp.runconfig file. + [runconfig] file. The connector components are automatically added by the driver unless AUTOCONNECTORS is disabled in esm.F90. @@ -19,7 +19,7 @@ Description: Run success is determined by the zeroValues and missingValues found in the final import state. Set zeroValues and missingValues in the - esmApp.runconfig file as needed. + [runconfig] file as needed. For example: zeroregion=select, this setting results in missing values @@ -32,7 +32,10 @@ Build: Execution: - Optionally set environment variable ESMF_RUNTIME_COMPLIANCECHECK to ON. - - mpirun -np X ./esmApp (where X is the total number of PETs, typically 4) + - mpirun -np X ./esmApp [runconfig] + where X is the total number of PETs, typically 4 + and [runconfig] is the configuration file, which defaults to + bilinear.cfg if no command line argument is provided. Output: - PET*.Log files containing compliance checker output if turned on. @@ -45,4 +48,12 @@ Code structure: - esm.F90 - The Earth System Model (ESM) component, specializing generic NUOPC_Driver. - esmApp.F90 - ESM application. - - esmApp.runconfig - Runtime configuration + +Runtime configuraiton files: + - bilinear.cfg - Bilinear regridding with zero values used to fill + unmapped points. + - bilinear_nearest.cfg - Bilinear regridding with nearest neighbor + extrapolation used to fill unmapped points. + - bilinear_select.cfg - Bilinear regridding with zeroregion=select used to + ignore unmapped points resulting in missing value + in unmapped points. diff --git a/AtmOcnConOptsProto/atm.F90 b/AtmOcnConOptsProto/atm.F90 index 074fb265..8749542e 100644 --- a/AtmOcnConOptsProto/atm.F90 +++ b/AtmOcnConOptsProto/atm.F90 @@ -438,7 +438,7 @@ subroutine ModelFinalize(model, rc) if ((gblZero(1).gt.0).neqv.zeroValues) then write (*,"(A,A,A,L1,A)") "ERROR: ",trim(name), & " zero values must be ", zeroValues, & - ", see esmApp.runconfig file " + ", see [runconfig] file " call ESMF_LogSetError(ESMF_RC_NOT_VALID, & msg="Zero values does not match config settings", & line=__LINE__, & @@ -448,7 +448,7 @@ subroutine ModelFinalize(model, rc) elseif ((gblMissing(1).gt.0).neqv.missingValues) then write (*,"(A,A,A,L1,A)") "ERROR: ",trim(name), & " missing values must be ", missingValues, & - ", see esmApp.runconfig file " + ", see [runconfig] file " call ESMF_LogSetError(ESMF_RC_NOT_VALID, & msg="Missing values does not match config settings", & line=__LINE__, & diff --git a/AtmOcnConOptsProto/esmApp.runconfig b/AtmOcnConOptsProto/bilinear.cfg similarity index 100% rename from AtmOcnConOptsProto/esmApp.runconfig rename to AtmOcnConOptsProto/bilinear.cfg diff --git a/AtmOcnConOptsProto/bilinear_nearest.cfg b/AtmOcnConOptsProto/bilinear_nearest.cfg new file mode 100644 index 00000000..8e5a104d --- /dev/null +++ b/AtmOcnConOptsProto/bilinear_nearest.cfg @@ -0,0 +1,44 @@ +############################################### +#### esmApp Run-Time Configuration File ##### +############################################### + +# Connector Options +# :remapmethod = redist,bilinear,patch,nearest_stod,nearest_dtos, +# conserve (default=bilinear) +# :extrapmethod = none,nearest_idavg,nearest_stod,creep (default=none) +# :extrapnumsrcpnts = INTEGER (default=8) +# :extrapdistexponent = REAL (default=2.0) +# :extrapnumlevels = INTEGER (default=10) +# :ignoreDegenerate = true,false (default=false) +# :unmappedaction = error,ignore (default=ignore) +# :zeroregion = total(d),select,empty (default=total) + +zeroValues: false +missingValues: false + +# Encoding a simple run sequence +runSeq:: + @1800 # 30min time step + ATM -> OCN :remapmethod=bilinear:extrapmethod=nearest_stod + OCN -> ATM :remapmethod=bilinear:extrapmethod=nearest_stod + ATM + OCN + @ +:: + +# Attributes for components + +driverAttributes:: + Verbosity = 1 + Profiling = 0 +:: + +atmAttributes:: + Verbosity = 1 + Diagnostic = 0 +:: + +ocnAttributes:: + Verbosity = 1 + Diagnostic = 0 +:: diff --git a/AtmOcnConOptsProto/bilinear_select.cfg b/AtmOcnConOptsProto/bilinear_select.cfg new file mode 100644 index 00000000..a2efbaa2 --- /dev/null +++ b/AtmOcnConOptsProto/bilinear_select.cfg @@ -0,0 +1,44 @@ +############################################### +#### esmApp Run-Time Configuration File ##### +############################################### + +# Connector Options +# :remapmethod = redist,bilinear,patch,nearest_stod,nearest_dtos, +# conserve (default=bilinear) +# :extrapmethod = none,nearest_idavg,nearest_stod,creep (default=none) +# :extrapnumsrcpnts = INTEGER (default=8) +# :extrapdistexponent = REAL (default=2.0) +# :extrapnumlevels = INTEGER (default=10) +# :ignoreDegenerate = true,false (default=false) +# :unmappedaction = error,ignore (default=ignore) +# :zeroregion = total(d),select,empty (default=total) + +zeroValues: false +missingValues: true + +# Encoding a simple run sequence +runSeq:: + @1800 # 30min time step + ATM -> OCN :remapmethod=bilinear:zeroregion=select + OCN -> ATM :remapmethod=bilinear:zeroregion=select + ATM + OCN + @ +:: + +# Attributes for components + +driverAttributes:: + Verbosity = 1 + Profiling = 0 +:: + +atmAttributes:: + Verbosity = 1 + Diagnostic = 0 +:: + +ocnAttributes:: + Verbosity = 1 + Diagnostic = 0 +:: diff --git a/AtmOcnConOptsProto/esm.F90 b/AtmOcnConOptsProto/esm.F90 index bc57c981..496cc5bc 100644 --- a/AtmOcnConOptsProto/esm.F90 +++ b/AtmOcnConOptsProto/esm.F90 @@ -36,6 +36,8 @@ module ESM private public SetServices + + character(*), parameter :: dflt_cfname = "bilinear.cfg" !----------------------------------------------------------------------------- contains @@ -45,7 +47,11 @@ subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc + type(ESMF_VM) :: vm + integer :: localPet type(ESMF_Config) :: config + integer :: argCount(1) + character(len=32) :: cfName rc = ESMF_SUCCESS @@ -69,14 +75,44 @@ subroutine SetServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + + ! query the Component for its vm and localPet + call ESMF_GridCompGet(driver, vm=vm, localPet=localPet, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! get config file name from command line arguments + if (localPet.eq.0) then + call ESMF_UtilGetArgC(argCount(1), rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + if (argCount(1).gt.0) then + call ESMF_UtilGetArg(argindex=1, argvalue=cfName, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + else + cfName = dflt_cfName + endif + endif + call ESMF_VMBroadcast(vm, cfName, 32, rootPet=0, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create, open and set the config config = ESMF_ConfigCreate(rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call ESMF_ConfigLoadFile(config, "esmApp.runconfig", rc=rc) + call ESMF_ConfigLoadFile(config, cfName, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & diff --git a/AtmOcnConOptsProto/ocn.F90 b/AtmOcnConOptsProto/ocn.F90 index 8c4717fe..ddbbb6d0 100644 --- a/AtmOcnConOptsProto/ocn.F90 +++ b/AtmOcnConOptsProto/ocn.F90 @@ -464,7 +464,7 @@ subroutine ModelFinalize(model, rc) if ((gblZero(1).gt.0).neqv.zeroValues) then write (*,"(A,A,A,L1,A)") "ERROR: ",trim(name), & " zero values must be ", zeroValues, & - ", see esmApp.runconfig file " + ", see [runconfig] file " call ESMF_LogSetError(ESMF_RC_NOT_VALID, & msg="Zero values does not match config settings", & line=__LINE__, & @@ -474,7 +474,7 @@ subroutine ModelFinalize(model, rc) elseif ((gblMissing(1).gt.0).neqv.missingValues) then write (*,"(A,A,A,L1,A)") "ERROR: ",trim(name), & " missing values must be ", missingValues, & - ", see esmApp.runconfig file " + ", see [runconfig] file " call ESMF_LogSetError(ESMF_RC_NOT_VALID, & msg="Missing values does not match config settings", & line=__LINE__, & diff --git a/testProtos.sh b/testProtos.sh index 2d507bdd..9f5de611 100755 --- a/testProtos.sh +++ b/testProtos.sh @@ -41,6 +41,42 @@ echo --------------------------------------------------------------------------- echo } +function TestProtoArgList { +if [ "$#" -ne 3 ]; then +echo ERROR: TestProtoArg requires 3 arguments. +echo " $*" +return 1 +fi +((count++)) +testList[count]=$1 +read -ra ARGS <<< "$3" +echo --------------------------------------------------------------------------- +echo STARTING: $1 +cd $1 +gmake distclean +gmake +for arg in "${ARGS[@]}"; do +set -x +$MPIRUN 4 $TOOLRUN ./$2 $arg > $2.$arg.stdout 2>&1 +local result=$? +set +x +if [ $result -ne 0 ] +then +break +fi +done +if [ $result -eq 0 ] +then +testResult[count]="PASS" +else +testResult[count]="FAIL" +fi +echo FINISHED: $1 +cd .. +echo --------------------------------------------------------------------------- +echo +} + function TestSelectProto { echo --------------------------------------------------------------------------- echo STARTING: $1 From aa38089b0028502476c76cef5fa336473d969582 Mon Sep 17 00:00:00 2001 From: Daniel Rosen Date: Wed, 6 May 2020 17:29:43 +0000 Subject: [PATCH 11/68] Add mask testing to AtmOcnConOptsProto. --- AtmOcnConOptsProto/atm.F90 | 58 +++++++++++++++++++++-- AtmOcnConOptsProto/bilinear.cfg | 4 +- AtmOcnConOptsProto/bilinear_mask.cfg | 46 ++++++++++++++++++ AtmOcnConOptsProto/bilinear_nearest.cfg | 4 +- AtmOcnConOptsProto/bilinear_select.cfg | 4 +- AtmOcnConOptsProto/ocn.F90 | 62 +++++++++++++++++++++---- 6 files changed, 162 insertions(+), 16 deletions(-) create mode 100644 AtmOcnConOptsProto/bilinear_mask.cfg diff --git a/AtmOcnConOptsProto/atm.F90 b/AtmOcnConOptsProto/atm.F90 index 8749542e..36229349 100644 --- a/AtmOcnConOptsProto/atm.F90 +++ b/AtmOcnConOptsProto/atm.F90 @@ -29,6 +29,10 @@ module ATM real(ESMF_KIND_R8),parameter :: zeroValue = 0.0_ESMF_KIND_R8 real(ESMF_KIND_R8),parameter :: missingValue = 999999.0_ESMF_KIND_R8 + real(ESMF_KIND_R8),parameter :: islandLoc(4) = (/ 289.5_ESMF_KIND_R8, & + 295.5_ESMF_KIND_R8, & + 9.5_ESMF_KIND_R8, & + 25.5_ESMF_KIND_R8 /) !----------------------------------------------------------------------------- contains @@ -128,9 +132,14 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) integer, intent(out) :: rc ! local variables - type(ESMF_Field) :: field - type(ESMF_Grid) :: gridIn - type(ESMF_Grid) :: gridOut + type(ESMF_Field) :: field + type(ESMF_Grid) :: gridIn + type(ESMF_Grid) :: gridOut + integer :: tlb(2), tub(2) + real(ESMF_KIND_R8), pointer :: lon_fptr(:) + real(ESMF_KIND_R8), pointer :: lat_fptr(:) + integer(ESMF_KIND_I4), pointer :: msk_fptr(:,:) + integer :: i,j rc = ESMF_SUCCESS @@ -144,6 +153,47 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out + + ! get grid coordinates + call ESMF_GridGetCoord(gridIn, coordDim=1, & + staggerLoc=ESMF_STAGGERLOC_CENTER, farrayPtr=lon_fptr, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_GridGetCoord(gridIn, coordDim=2, & + staggerLoc=ESMF_STAGGERLOC_CENTER, farrayPtr=lat_fptr, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! add mask and island + call ESMF_GridAddItem(gridIn, itemflag=ESMF_GRIDITEM_MASK, & + staggerLoc=ESMF_STAGGERLOC_CENTER, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_GridGetItem(gridIn, itemflag=ESMF_GRIDITEM_MASK, & + staggerLoc=ESMF_STAGGERLOC_CENTER, & + totalLBound=tlb, totalUBound=tub, farrayPtr=msk_fptr, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + msk_fptr = 0 + do j=tlb(2), tub(2) + do i=tlb(1), tub(1) + if ((lon_fptr(i).ge.islandLoc(1)) .AND. & + (lon_fptr(i).le.islandLoc(2)) .AND. & + (lat_fptr(j).ge.islandLoc(3)) .AND. & + (lat_fptr(j).le.islandLoc(4)) ) then + msk_fptr(i,j) = 1 + endif + enddo + enddo + gridOut = gridIn ! for now out same as in #ifdef WITHIMPORTFIELDS @@ -159,7 +209,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - ! fill import field sst with 999999 + ! fill import field sst with missingValue call ESMF_FieldFill(field, dataFillScheme="const", & const1=missingValue, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & diff --git a/AtmOcnConOptsProto/bilinear.cfg b/AtmOcnConOptsProto/bilinear.cfg index 2874ef4f..72abd537 100644 --- a/AtmOcnConOptsProto/bilinear.cfg +++ b/AtmOcnConOptsProto/bilinear.cfg @@ -8,10 +8,12 @@ # :extrapmethod = none,nearest_idavg,nearest_stod,creep (default=none) # :extrapnumsrcpnts = INTEGER (default=8) # :extrapdistexponent = REAL (default=2.0) -# :extrapnumlevels = INTEGER (default=10) +# :extrapnumlevels = INTEGER # :ignoreDegenerate = true,false (default=false) # :unmappedaction = error,ignore (default=ignore) # :zeroregion = total(d),select,empty (default=total) +# :srcMaskValues = INTEGER +# :dstMaskValues = INTEGER zeroValues: true missingValues: false diff --git a/AtmOcnConOptsProto/bilinear_mask.cfg b/AtmOcnConOptsProto/bilinear_mask.cfg new file mode 100644 index 00000000..a8913ba8 --- /dev/null +++ b/AtmOcnConOptsProto/bilinear_mask.cfg @@ -0,0 +1,46 @@ +############################################### +#### esmApp Run-Time Configuration File ##### +############################################### + +# Connector Options +# :remapmethod = redist,bilinear,patch,nearest_stod,nearest_dtos, +# conserve (default=bilinear) +# :extrapmethod = none,nearest_idavg,nearest_stod,creep (default=none) +# :extrapnumsrcpnts = INTEGER (default=8) +# :extrapdistexponent = REAL (default=2.0) +# :extrapnumlevels = INTEGER +# :ignoreDegenerate = true,false (default=false) +# :unmappedaction = error,ignore (default=ignore) +# :zeroregion = total(d),select,empty (default=total) +# :srcMaskValues = INTEGER +# :dstMaskValues = INTEGER + +zeroValues: true +missingValues: false + +# Encoding a simple run sequence +runSeq:: + @1800 # 30min time step + ATM -> OCN :remapmethod=bilinear:srcMaskValues=1:dstMaskValues=1 + OCN -> ATM :remapmethod=bilinear:srcMaskValues=1:dstMaskValues=1 + ATM + OCN + @ +:: + +# Attributes for components + +driverAttributes:: + Verbosity = 1 + Profiling = 0 +:: + +atmAttributes:: + Verbosity = 1 + Diagnostic = 0 +:: + +ocnAttributes:: + Verbosity = 1 + Diagnostic = 0 +:: diff --git a/AtmOcnConOptsProto/bilinear_nearest.cfg b/AtmOcnConOptsProto/bilinear_nearest.cfg index 8e5a104d..1e3904ee 100644 --- a/AtmOcnConOptsProto/bilinear_nearest.cfg +++ b/AtmOcnConOptsProto/bilinear_nearest.cfg @@ -8,10 +8,12 @@ # :extrapmethod = none,nearest_idavg,nearest_stod,creep (default=none) # :extrapnumsrcpnts = INTEGER (default=8) # :extrapdistexponent = REAL (default=2.0) -# :extrapnumlevels = INTEGER (default=10) +# :extrapnumlevels = INTEGER # :ignoreDegenerate = true,false (default=false) # :unmappedaction = error,ignore (default=ignore) # :zeroregion = total(d),select,empty (default=total) +# :srcMaskValues = INTEGER +# :dstMaskValues = INTEGER zeroValues: false missingValues: false diff --git a/AtmOcnConOptsProto/bilinear_select.cfg b/AtmOcnConOptsProto/bilinear_select.cfg index a2efbaa2..97d7da4b 100644 --- a/AtmOcnConOptsProto/bilinear_select.cfg +++ b/AtmOcnConOptsProto/bilinear_select.cfg @@ -8,10 +8,12 @@ # :extrapmethod = none,nearest_idavg,nearest_stod,creep (default=none) # :extrapnumsrcpnts = INTEGER (default=8) # :extrapdistexponent = REAL (default=2.0) -# :extrapnumlevels = INTEGER (default=10) +# :extrapnumlevels = INTEGER # :ignoreDegenerate = true,false (default=false) # :unmappedaction = error,ignore (default=ignore) # :zeroregion = total(d),select,empty (default=total) +# :srcMaskValues = INTEGER +# :dstMaskValues = INTEGER zeroValues: false missingValues: true diff --git a/AtmOcnConOptsProto/ocn.F90 b/AtmOcnConOptsProto/ocn.F90 index ddbbb6d0..d785fe7b 100644 --- a/AtmOcnConOptsProto/ocn.F90 +++ b/AtmOcnConOptsProto/ocn.F90 @@ -30,6 +30,10 @@ module OCN real(ESMF_KIND_R8),parameter :: zeroValue = 0.0_ESMF_KIND_R8 real(ESMF_KIND_R8),parameter :: missingValue = 999999.0_ESMF_KIND_R8 + real(ESMF_KIND_R8),parameter :: islandLoc(4) = (/ 289.5_ESMF_KIND_R8, & + 295.5_ESMF_KIND_R8, & + 9.5_ESMF_KIND_R8, & + 25.5_ESMF_KIND_R8 /) !----------------------------------------------------------------------------- contains @@ -135,10 +139,15 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) integer, intent(out) :: rc ! local variables - type(ESMF_TimeInterval) :: stabilityTimeStep - type(ESMF_Field) :: field - type(ESMF_Grid) :: gridIn - type(ESMF_Grid) :: gridOut + type(ESMF_TimeInterval) :: stabilityTimeStep + type(ESMF_Field) :: field + type(ESMF_Grid) :: gridIn + type(ESMF_Grid) :: gridOut + integer :: tlb(2), tub(2) + real(ESMF_KIND_R8), pointer :: lon_fptr(:) + real(ESMF_KIND_R8), pointer :: lat_fptr(:) + integer(ESMF_KIND_I4), pointer :: msk_fptr(:,:) + integer :: i,j rc = ESMF_SUCCESS @@ -152,12 +161,47 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - gridOut = gridIn ! for now out same as in + ! get grid coordinates + call ESMF_GridGetCoord(gridIn, coordDim=1, & + staggerLoc=ESMF_STAGGERLOC_CENTER, farrayPtr=lon_fptr, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_GridGetCoord(gridIn, coordDim=2, & + staggerLoc=ESMF_STAGGERLOC_CENTER, farrayPtr=lat_fptr, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! add mask and island + call ESMF_GridAddItem(gridIn, itemflag=ESMF_GRIDITEM_MASK, & + staggerLoc=ESMF_STAGGERLOC_CENTER, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_GridGetItem(gridIn, itemflag=ESMF_GRIDITEM_MASK, & + staggerLoc=ESMF_STAGGERLOC_CENTER, & + totalLBound=tlb, totalUBound=tub, farrayPtr=msk_fptr, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out + msk_fptr = 0 + do j=tlb(2), tub(2) + do i=tlb(1), tub(1) + if ((lon_fptr(i).ge.islandLoc(1)) .AND. & + (lon_fptr(i).le.islandLoc(2)) .AND. & + (lat_fptr(j).ge.islandLoc(3)) .AND. & + (lat_fptr(j).le.islandLoc(4)) ) then + msk_fptr(i,j) = 1 + endif + enddo + enddo + gridOut = gridIn ! for now out same as in #ifdef WITHIMPORTFIELDS @@ -173,9 +217,9 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - ! fill import field pmsl with 999999 + ! fill import field pmsl with missingValue call ESMF_FieldFill(field, dataFillScheme="const", & - const1=999999.0_ESMF_KIND_R8, rc=rc) + const1=missingValue, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -193,9 +237,9 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - ! fill import field rsns with 999999 + ! fill import field rsns with missingValue call ESMF_FieldFill(field, dataFillScheme="const", & - const1=999999.0_ESMF_KIND_R8, rc=rc) + const1=missingValue, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & From 585703050286e6c67f6f299028dbb7269c63c5e5 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Mon, 1 Jun 2020 20:57:31 +0000 Subject: [PATCH 12/68] Update copyright date to 2020. --- AtmOcnConOptsProto/atm.F90 | 2 +- AtmOcnConOptsProto/esm.F90 | 2 +- AtmOcnConOptsProto/esmApp.F90 | 2 +- AtmOcnConOptsProto/ocn.F90 | 2 +- AtmOcnSelectExternalProto/ATM-F/atmF.C | 2 +- ComponentExplorer/nuopcExplorerScript | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/AtmOcnConOptsProto/atm.F90 b/AtmOcnConOptsProto/atm.F90 index 36229349..8c96e8e5 100644 --- a/AtmOcnConOptsProto/atm.F90 +++ b/AtmOcnConOptsProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnConOptsProto/esm.F90 b/AtmOcnConOptsProto/esm.F90 index 496cc5bc..2f6fa371 100644 --- a/AtmOcnConOptsProto/esm.F90 +++ b/AtmOcnConOptsProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnConOptsProto/esmApp.F90 b/AtmOcnConOptsProto/esmApp.F90 index e86b8905..58def34c 100644 --- a/AtmOcnConOptsProto/esmApp.F90 +++ b/AtmOcnConOptsProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnConOptsProto/ocn.F90 b/AtmOcnConOptsProto/ocn.F90 index d785fe7b..8511db2b 100644 --- a/AtmOcnConOptsProto/ocn.F90 +++ b/AtmOcnConOptsProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, +! Copyright 2002-2020, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectExternalProto/ATM-F/atmF.C b/AtmOcnSelectExternalProto/ATM-F/atmF.C index f347a3a2..3a9d4d73 100644 --- a/AtmOcnSelectExternalProto/ATM-F/atmF.C +++ b/AtmOcnSelectExternalProto/ATM-F/atmF.C @@ -1,6 +1,6 @@ //============================================================================== // Earth System Modeling Framework -// Copyright 2002-2019, University Corporation for Atmospheric Research, +// Copyright 2002-2020, University Corporation for Atmospheric Research, // Massachusetts Institute of Technology, Geophysical Fluid Dynamics // Laboratory, University of Michigan, National Centers for Environmental // Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/ComponentExplorer/nuopcExplorerScript b/ComponentExplorer/nuopcExplorerScript index fe710b86..bb390198 100755 --- a/ComponentExplorer/nuopcExplorerScript +++ b/ComponentExplorer/nuopcExplorerScript @@ -2,7 +2,7 @@ #============================================================================== # Earth System Modeling Framework -# Copyright 2002-2019, University Corporation for Atmospheric Research, +# Copyright 2002-2020, University Corporation for Atmospheric Research, # Massachusetts Institute of Technology, Geophysical Fluid Dynamics # Laboratory, University of Michigan, National Centers for Environmental # Prediction, Los Alamos National Laboratory, Argonne National Laboratory, From 1af2caeeaaae70dd59347c50933542d156e5945d Mon Sep 17 00:00:00 2001 From: Himanshu Pillai Date: Thu, 11 Jun 2020 08:33:53 -0600 Subject: [PATCH 13/68] Create README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 00000000..9bc90baa --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# nuopc-app-prototypes + +nuopc-app-prototypes From eddff062d4a2329bb34f545b281e72739b0677fe Mon Sep 17 00:00:00 2001 From: Himanshu Pillai Date: Thu, 11 Jun 2020 08:34:13 -0600 Subject: [PATCH 14/68] Update README.md --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 9bc90baa..4fb65739 100644 --- a/README.md +++ b/README.md @@ -1,3 +1 @@ # nuopc-app-prototypes - -nuopc-app-prototypes From eb5029eb76e3ff385029eb9d95b382cec59eb86e Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Fri, 10 Jul 2020 10:28:41 -0700 Subject: [PATCH 15/68] Remove white spaces at the end of line. --- AtmOcnProto/atm.F90 | 8 ++++---- AtmOcnProto/esm.F90 | 8 ++++---- AtmOcnProto/esmApp.F90 | 8 ++++---- AtmOcnProto/ocn.F90 | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/AtmOcnProto/atm.F90 b/AtmOcnProto/atm.F90 index 587ea699..3c64d026 100644 --- a/AtmOcnProto/atm.F90 +++ b/AtmOcnProto/atm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== diff --git a/AtmOcnProto/esm.F90 b/AtmOcnProto/esm.F90 index 996554b2..d43a0f8f 100644 --- a/AtmOcnProto/esm.F90 +++ b/AtmOcnProto/esm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== diff --git a/AtmOcnProto/esmApp.F90 b/AtmOcnProto/esmApp.F90 index 67e83ebf..f22999b9 100644 --- a/AtmOcnProto/esmApp.F90 +++ b/AtmOcnProto/esmApp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== diff --git a/AtmOcnProto/ocn.F90 b/AtmOcnProto/ocn.F90 index df44b999..4311c427 100644 --- a/AtmOcnProto/ocn.F90 +++ b/AtmOcnProto/ocn.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== From ba51d8e57b1519c613391efc9568b2ceae93a295 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Fri, 10 Jul 2020 14:35:36 -0700 Subject: [PATCH 16/68] Add .gitignore to filter generated artifacts. --- .gitignore | 803 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 803 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..dbc5b4fd --- /dev/null +++ b/.gitignore @@ -0,0 +1,803 @@ +AsyncIOBlockingProto/PET0.ESMF_LogFile +AsyncIOBlockingProto/PET1.ESMF_LogFile +AsyncIOBlockingProto/PET2.ESMF_LogFile +AsyncIOBlockingProto/PET3.ESMF_LogFile +AsyncIOBlockingProto/asyncIOApp +AsyncIOBlockingProto/asyncIOApp.o +AsyncIOBlockingProto/asyncIOApp.stdout +AsyncIOBlockingProto/asyncIODriver.o +AsyncIOBlockingProto/asynciodriver.mod +AsyncIOBlockingProto/field_00001_pmsl.nc +AsyncIOBlockingProto/field_00002_pmsl.nc +AsyncIOBlockingProto/field_00003_pmsl.nc +AsyncIOBlockingProto/field_00004_pmsl.nc +AsyncIOBlockingProto/field_00005_pmsl.nc +AsyncIOBlockingProto/field_00006_pmsl.nc +AsyncIOBlockingProto/field_00007_pmsl.nc +AsyncIOBlockingProto/field_00008_pmsl.nc +AsyncIOBlockingProto/field_00009_pmsl.nc +AsyncIOBlockingProto/field_00010_pmsl.nc +AsyncIOBlockingProto/field_00011_pmsl.nc +AsyncIOBlockingProto/field_00012_pmsl.nc +AsyncIOBlockingProto/field_00013_pmsl.nc +AsyncIOBlockingProto/field_00014_pmsl.nc +AsyncIOBlockingProto/field_00015_pmsl.nc +AsyncIOBlockingProto/field_00016_pmsl.nc +AsyncIOBlockingProto/field_00017_pmsl.nc +AsyncIOBlockingProto/field_00018_pmsl.nc +AsyncIOBlockingProto/field_00019_pmsl.nc +AsyncIOBlockingProto/field_00020_pmsl.nc +AsyncIOBlockingProto/field_00021_pmsl.nc +AsyncIOBlockingProto/field_00022_pmsl.nc +AsyncIOBlockingProto/field_00023_pmsl.nc +AsyncIOBlockingProto/field_00024_pmsl.nc +AsyncIOBlockingProto/field_00025_pmsl.nc +AsyncIOBlockingProto/field_00026_pmsl.nc +AsyncIOBlockingProto/field_00027_pmsl.nc +AsyncIOBlockingProto/field_00028_pmsl.nc +AsyncIOBlockingProto/field_00029_pmsl.nc +AsyncIOBlockingProto/field_00030_pmsl.nc +AsyncIOBlockingProto/field_00031_pmsl.nc +AsyncIOBlockingProto/field_00032_pmsl.nc +AsyncIOBlockingProto/io.o +AsyncIOBlockingProto/iocomp.mod +AsyncIOBlockingProto/model.o +AsyncIOBlockingProto/modelcomp.mod +AsyncIONonblockingProto/PET0.ESMF_LogFile +AsyncIONonblockingProto/PET1.ESMF_LogFile +AsyncIONonblockingProto/PET2.ESMF_LogFile +AsyncIONonblockingProto/PET3.ESMF_LogFile +AsyncIONonblockingProto/asyncIOApp +AsyncIONonblockingProto/asyncIOApp.o +AsyncIONonblockingProto/asyncIOApp.stdout +AsyncIONonblockingProto/asyncIODriver.o +AsyncIONonblockingProto/asynciodriver.mod +AsyncIONonblockingProto/con.mod +AsyncIONonblockingProto/conn.o +AsyncIONonblockingProto/field_pmsl.nc +AsyncIONonblockingProto/io.o +AsyncIONonblockingProto/iocomp.mod +AsyncIONonblockingProto/model.o +AsyncIONonblockingProto/modelcomp.mod +AtmOcnConOptsProto/PET0.ESMF_LogFile +AtmOcnConOptsProto/PET1.ESMF_LogFile +AtmOcnConOptsProto/PET2.ESMF_LogFile +AtmOcnConOptsProto/PET3.ESMF_LogFile +AtmOcnConOptsProto/atm.mod +AtmOcnConOptsProto/atm.o +AtmOcnConOptsProto/esm.mod +AtmOcnConOptsProto/esm.o +AtmOcnConOptsProto/esmApp +AtmOcnConOptsProto/esmApp.o +AtmOcnConOptsProto/esmApp.stdout +AtmOcnConOptsProto/ocn.mod +AtmOcnConOptsProto/ocn.o +AtmOcnConProto/PET0.ESMF_LogFile +AtmOcnConProto/PET1.ESMF_LogFile +AtmOcnConProto/PET2.ESMF_LogFile +AtmOcnConProto/PET3.ESMF_LogFile +AtmOcnConProto/atm.mod +AtmOcnConProto/atm.o +AtmOcnConProto/con.mod +AtmOcnConProto/conn.o +AtmOcnConProto/esm.mod +AtmOcnConProto/esm.o +AtmOcnConProto/esmApp +AtmOcnConProto/esmApp.o +AtmOcnConProto/esmApp.stdout +AtmOcnConProto/ocn.mod +AtmOcnConProto/ocn.o +AtmOcnCplListProto/PET0.ESMF_LogFile +AtmOcnCplListProto/PET1.ESMF_LogFile +AtmOcnCplListProto/PET2.ESMF_LogFile +AtmOcnCplListProto/PET3.ESMF_LogFile +AtmOcnCplListProto/atm.mod +AtmOcnCplListProto/atm.o +AtmOcnCplListProto/esm.mod +AtmOcnCplListProto/esm.o +AtmOcnCplListProto/esmApp +AtmOcnCplListProto/esmApp.o +AtmOcnCplListProto/esmApp.stdout +AtmOcnCplListProto/field_atm_export_pmsl.nc +AtmOcnCplListProto/field_atm_export_rsnl.nc +AtmOcnCplListProto/field_atm_export_rsns.nc +AtmOcnCplListProto/field_atm_export_sdhf.nc +AtmOcnCplListProto/field_atm_import_sst.nc +AtmOcnCplListProto/field_ocn_export_sst.nc +AtmOcnCplListProto/field_ocn_import_pmsl.nc +AtmOcnCplListProto/field_ocn_import_rsnl.nc +AtmOcnCplListProto/field_ocn_import_rsns.nc +AtmOcnCplListProto/field_ocn_import_sdhf.nc +AtmOcnCplListProto/ocn.mod +AtmOcnCplListProto/ocn.o +AtmOcnCplListProto/weightmatrix_ATM-TO-OCN_surface_downward_heat_flux_in_air.nc +AtmOcnCplListProto/weightmatrix_ATM-TO-OCN_surface_net_downward_longwave_flux.nc +AtmOcnCplListProto/weightmatrix_OCN-TO-ATM_sea_surface_temperature.nc +AtmOcnCplSetProto/PET0.ESMF_LogFile +AtmOcnCplSetProto/PET1.ESMF_LogFile +AtmOcnCplSetProto/PET2.ESMF_LogFile +AtmOcnCplSetProto/PET3.ESMF_LogFile +AtmOcnCplSetProto/atm.mod +AtmOcnCplSetProto/atm.o +AtmOcnCplSetProto/esm.mod +AtmOcnCplSetProto/esm.o +AtmOcnCplSetProto/esmApp +AtmOcnCplSetProto/esmApp.o +AtmOcnCplSetProto/esmApp.stdout +AtmOcnCplSetProto/ocn.mod +AtmOcnCplSetProto/ocn.o +AtmOcnFDSynoProto/PET0.ESMF_LogFile +AtmOcnFDSynoProto/PET1.ESMF_LogFile +AtmOcnFDSynoProto/PET2.ESMF_LogFile +AtmOcnFDSynoProto/PET3.ESMF_LogFile +AtmOcnFDSynoProto/atm.mod +AtmOcnFDSynoProto/atm.o +AtmOcnFDSynoProto/esm.mod +AtmOcnFDSynoProto/esm.o +AtmOcnFDSynoProto/esmApp +AtmOcnFDSynoProto/esmApp.o +AtmOcnFDSynoProto/esmApp.stdout +AtmOcnFDSynoProto/ocn.mod +AtmOcnFDSynoProto/ocn.o +AtmOcnIceSimpleImplicitProto/PET0.ESMF_LogFile +AtmOcnIceSimpleImplicitProto/PET1.ESMF_LogFile +AtmOcnIceSimpleImplicitProto/PET2.ESMF_LogFile +AtmOcnIceSimpleImplicitProto/PET3.ESMF_LogFile +AtmOcnIceSimpleImplicitProto/atm.mod +AtmOcnIceSimpleImplicitProto/atm.o +AtmOcnIceSimpleImplicitProto/esm.mod +AtmOcnIceSimpleImplicitProto/esm.o +AtmOcnIceSimpleImplicitProto/esmApp +AtmOcnIceSimpleImplicitProto/esmApp.o +AtmOcnIceSimpleImplicitProto/esmApp.stdout +AtmOcnIceSimpleImplicitProto/ice.mod +AtmOcnIceSimpleImplicitProto/ice.o +AtmOcnIceSimpleImplicitProto/ocn.mod +AtmOcnIceSimpleImplicitProto/ocn.o +AtmOcnImplicitProto/PET0.ESMF_LogFile +AtmOcnImplicitProto/PET1.ESMF_LogFile +AtmOcnImplicitProto/PET2.ESMF_LogFile +AtmOcnImplicitProto/PET3.ESMF_LogFile +AtmOcnImplicitProto/atm.mod +AtmOcnImplicitProto/atm.o +AtmOcnImplicitProto/esm.mod +AtmOcnImplicitProto/esm.o +AtmOcnImplicitProto/esmApp +AtmOcnImplicitProto/esmApp.o +AtmOcnImplicitProto/esmApp.stdout +AtmOcnImplicitProto/ocn.mod +AtmOcnImplicitProto/ocn.o +AtmOcnLndProto/PET0.ESMF_LogFile +AtmOcnLndProto/PET1.ESMF_LogFile +AtmOcnLndProto/PET2.ESMF_LogFile +AtmOcnLndProto/PET3.ESMF_LogFile +AtmOcnLndProto/atm.mod +AtmOcnLndProto/atm.o +AtmOcnLndProto/esm.mod +AtmOcnLndProto/esm.o +AtmOcnLndProto/esmApp +AtmOcnLndProto/esmApp.o +AtmOcnLndProto/esmApp.stdout +AtmOcnLndProto/lnd.mod +AtmOcnLndProto/lnd.o +AtmOcnLndProto/ocn.mod +AtmOcnLndProto/ocn.o +AtmOcnLogNoneProto/atm.mod +AtmOcnLogNoneProto/atm.o +AtmOcnLogNoneProto/esm.mod +AtmOcnLogNoneProto/esm.o +AtmOcnLogNoneProto/esmApp +AtmOcnLogNoneProto/esmApp.o +AtmOcnLogNoneProto/esmApp.stdout +AtmOcnLogNoneProto/ocn.mod +AtmOcnLogNoneProto/ocn.o +AtmOcnMedIngestFromConfigProto/PET0.ESMF_LogFile +AtmOcnMedIngestFromConfigProto/PET1.ESMF_LogFile +AtmOcnMedIngestFromConfigProto/PET2.ESMF_LogFile +AtmOcnMedIngestFromConfigProto/PET3.ESMF_LogFile +AtmOcnMedIngestFromConfigProto/atm.mod +AtmOcnMedIngestFromConfigProto/atm.o +AtmOcnMedIngestFromConfigProto/esm.mod +AtmOcnMedIngestFromConfigProto/esm.o +AtmOcnMedIngestFromConfigProto/esmApp +AtmOcnMedIngestFromConfigProto/esmApp.o +AtmOcnMedIngestFromConfigProto/esmApp.stdout +AtmOcnMedIngestFromConfigProto/med.mod +AtmOcnMedIngestFromConfigProto/med.o +AtmOcnMedIngestFromConfigProto/ocn.mod +AtmOcnMedIngestFromConfigProto/ocn.o +AtmOcnMedIngestFromInternalProto/PET0.ESMF_LogFile +AtmOcnMedIngestFromInternalProto/PET1.ESMF_LogFile +AtmOcnMedIngestFromInternalProto/PET2.ESMF_LogFile +AtmOcnMedIngestFromInternalProto/PET3.ESMF_LogFile +AtmOcnMedIngestFromInternalProto/atm.mod +AtmOcnMedIngestFromInternalProto/atm.o +AtmOcnMedIngestFromInternalProto/esm.mod +AtmOcnMedIngestFromInternalProto/esm.o +AtmOcnMedIngestFromInternalProto/esmApp +AtmOcnMedIngestFromInternalProto/esmApp.o +AtmOcnMedIngestFromInternalProto/esmApp.stdout +AtmOcnMedIngestFromInternalProto/med.mod +AtmOcnMedIngestFromInternalProto/med.o +AtmOcnMedIngestFromInternalProto/ocn.mod +AtmOcnMedIngestFromInternalProto/ocn.o +AtmOcnMedPetListProto/PET0.ESMF_LogFile +AtmOcnMedPetListProto/PET1.ESMF_LogFile +AtmOcnMedPetListProto/PET2.ESMF_LogFile +AtmOcnMedPetListProto/PET3.ESMF_LogFile +AtmOcnMedPetListProto/atm.mod +AtmOcnMedPetListProto/atm.o +AtmOcnMedPetListProto/esm.mod +AtmOcnMedPetListProto/esm.o +AtmOcnMedPetListProto/esmApp +AtmOcnMedPetListProto/esmApp.o +AtmOcnMedPetListProto/esmApp.stdout +AtmOcnMedPetListProto/med.mod +AtmOcnMedPetListProto/med.o +AtmOcnMedPetListProto/ocn.mod +AtmOcnMedPetListProto/ocn.o +AtmOcnMedPetListTimescalesProto/PET0.ESMF_LogFile +AtmOcnMedPetListTimescalesProto/PET1.ESMF_LogFile +AtmOcnMedPetListTimescalesProto/PET2.ESMF_LogFile +AtmOcnMedPetListTimescalesProto/PET3.ESMF_LogFile +AtmOcnMedPetListTimescalesProto/atm.mod +AtmOcnMedPetListTimescalesProto/atm.o +AtmOcnMedPetListTimescalesProto/esm.mod +AtmOcnMedPetListTimescalesProto/esm.o +AtmOcnMedPetListTimescalesProto/esmApp +AtmOcnMedPetListTimescalesProto/esmApp.o +AtmOcnMedPetListTimescalesProto/esmApp.stdout +AtmOcnMedPetListTimescalesProto/med.mod +AtmOcnMedPetListTimescalesProto/med.o +AtmOcnMedPetListTimescalesProto/ocn.mod +AtmOcnMedPetListTimescalesProto/ocn.o +AtmOcnMedPetListTimescalesSplitFastProto/PET0.ESMF_LogFile +AtmOcnMedPetListTimescalesSplitFastProto/PET1.ESMF_LogFile +AtmOcnMedPetListTimescalesSplitFastProto/PET2.ESMF_LogFile +AtmOcnMedPetListTimescalesSplitFastProto/PET3.ESMF_LogFile +AtmOcnMedPetListTimescalesSplitFastProto/atm.mod +AtmOcnMedPetListTimescalesSplitFastProto/atm.o +AtmOcnMedPetListTimescalesSplitFastProto/esm.mod +AtmOcnMedPetListTimescalesSplitFastProto/esm.o +AtmOcnMedPetListTimescalesSplitFastProto/esmApp +AtmOcnMedPetListTimescalesSplitFastProto/esmApp.o +AtmOcnMedPetListTimescalesSplitFastProto/esmApp.stdout +AtmOcnMedPetListTimescalesSplitFastProto/med.mod +AtmOcnMedPetListTimescalesSplitFastProto/med.o +AtmOcnMedPetListTimescalesSplitFastProto/ocn.mod +AtmOcnMedPetListTimescalesSplitFastProto/ocn.o +AtmOcnMedProto/PET0.ESMF_LogFile +AtmOcnMedProto/PET1.ESMF_LogFile +AtmOcnMedProto/PET2.ESMF_LogFile +AtmOcnMedProto/PET3.ESMF_LogFile +AtmOcnMedProto/atm.mod +AtmOcnMedProto/atm.o +AtmOcnMedProto/esm.mod +AtmOcnMedProto/esm.o +AtmOcnMedProto/esmApp +AtmOcnMedProto/esmApp.o +AtmOcnMedProto/esmApp.stdout +AtmOcnMedProto/med.mod +AtmOcnMedProto/med.o +AtmOcnMedProto/ocn.mod +AtmOcnMedProto/ocn.o +AtmOcnMirrorFieldsProto/PET0.ESMF_LogFile +AtmOcnMirrorFieldsProto/PET1.ESMF_LogFile +AtmOcnMirrorFieldsProto/PET2.ESMF_LogFile +AtmOcnMirrorFieldsProto/PET3.ESMF_LogFile +AtmOcnMirrorFieldsProto/atm.mod +AtmOcnMirrorFieldsProto/atm.o +AtmOcnMirrorFieldsProto/esm.mod +AtmOcnMirrorFieldsProto/esm.o +AtmOcnMirrorFieldsProto/esmApp +AtmOcnMirrorFieldsProto/esmApp.o +AtmOcnMirrorFieldsProto/esmApp.stdout +AtmOcnMirrorFieldsProto/field_atm_export_air_pressure_at_sea_level.nc +AtmOcnMirrorFieldsProto/field_atm_export_surface_net_downward_shortwave_flux.nc +AtmOcnMirrorFieldsProto/field_atm_import_sst.nc +AtmOcnMirrorFieldsProto/field_ocn_export_sst.nc +AtmOcnMirrorFieldsProto/field_ocn_import_pmsl.nc +AtmOcnMirrorFieldsProto/field_ocn_import_rsns.nc +AtmOcnMirrorFieldsProto/ocn.mod +AtmOcnMirrorFieldsProto/ocn.o +AtmOcnPetListProto/PET0.ESMF_LogFile +AtmOcnPetListProto/PET1.ESMF_LogFile +AtmOcnPetListProto/PET2.ESMF_LogFile +AtmOcnPetListProto/PET3.ESMF_LogFile +AtmOcnPetListProto/atm.mod +AtmOcnPetListProto/atm.o +AtmOcnPetListProto/esm.mod +AtmOcnPetListProto/esm.o +AtmOcnPetListProto/esmApp +AtmOcnPetListProto/esmApp.o +AtmOcnPetListProto/esmApp.stdout +AtmOcnPetListProto/ocn.mod +AtmOcnPetListProto/ocn.o +AtmOcnProto/PET0.ESMF_LogFile +AtmOcnProto/PET1.ESMF_LogFile +AtmOcnProto/PET2.ESMF_LogFile +AtmOcnProto/PET3.ESMF_LogFile +AtmOcnProto/atm.mod +AtmOcnProto/atm.o +AtmOcnProto/esm.mod +AtmOcnProto/esm.o +AtmOcnProto/esmApp +AtmOcnProto/esmApp.o +AtmOcnProto/esmApp.stdout +AtmOcnProto/ocn.mod +AtmOcnProto/ocn.o +AtmOcnRtmTwoTimescalesProto/PET0.ESMF_LogFile +AtmOcnRtmTwoTimescalesProto/PET1.ESMF_LogFile +AtmOcnRtmTwoTimescalesProto/PET2.ESMF_LogFile +AtmOcnRtmTwoTimescalesProto/PET3.ESMF_LogFile +AtmOcnRtmTwoTimescalesProto/atm.mod +AtmOcnRtmTwoTimescalesProto/atm.o +AtmOcnRtmTwoTimescalesProto/esm.mod +AtmOcnRtmTwoTimescalesProto/esm.o +AtmOcnRtmTwoTimescalesProto/esmApp +AtmOcnRtmTwoTimescalesProto/esmApp.o +AtmOcnRtmTwoTimescalesProto/esmApp.stdout +AtmOcnRtmTwoTimescalesProto/ocn.mod +AtmOcnRtmTwoTimescalesProto/ocn.o +AtmOcnRtmTwoTimescalesProto/rtm.mod +AtmOcnRtmTwoTimescalesProto/rtm.o +AtmOcnScalarProto/PET0.ESMF_LogFile +AtmOcnScalarProto/PET1.ESMF_LogFile +AtmOcnScalarProto/PET2.ESMF_LogFile +AtmOcnScalarProto/PET3.ESMF_LogFile +AtmOcnScalarProto/atm.mod +AtmOcnScalarProto/atm.o +AtmOcnScalarProto/esm.mod +AtmOcnScalarProto/esm.o +AtmOcnScalarProto/esmApp +AtmOcnScalarProto/esmApp.o +AtmOcnScalarProto/esmApp.stdout +AtmOcnScalarProto/field_ocn_export_adv_sst.nc +AtmOcnScalarProto/ocn.mod +AtmOcnScalarProto/ocn.o +AtmOcnSelectExternalProto/ATM-A/atmA.mk +AtmOcnSelectExternalProto/ATM-A/atmA.o +AtmOcnSelectExternalProto/ATM-A/atma.mod +AtmOcnSelectExternalProto/ATM-B/atmB.mk +AtmOcnSelectExternalProto/ATM-B/atmB.o +AtmOcnSelectExternalProto/ATM-B/atmb.mod +AtmOcnSelectExternalProto/ATM-B/procedure.o +AtmOcnSelectExternalProto/ATM-C/atmC.mk +AtmOcnSelectExternalProto/ATM-C/atmC.o +AtmOcnSelectExternalProto/ATM-C/atmc.mod +AtmOcnSelectExternalProto/ATM-C/libatmC.a +AtmOcnSelectExternalProto/ATM-C/procedure.o +AtmOcnSelectExternalProto/ATM-D/atmD.mk +AtmOcnSelectExternalProto/ATM-D/atmd.mod +AtmOcnSelectExternalProto/ATM-D/libatmD.so +AtmOcnSelectExternalProto/ATM-E/atmE.mk +AtmOcnSelectExternalProto/ATM-E/atme.mod +AtmOcnSelectExternalProto/OcnCommon/oceancommon.mod +AtmOcnSelectExternalProto/OcnCommon/ocnCommon.mk +AtmOcnSelectExternalProto/OcnCommon/ocnCommon.o +AtmOcnSelectExternalProto/OcnCommon/subModule1.o +AtmOcnSelectExternalProto/OcnCommon/subModule2.o +AtmOcnSelectExternalProto/OcnCommon/submodule1.mod +AtmOcnSelectExternalProto/OcnCommon/submodule2.mod +AtmOcnSelectExternalProto/OcnModelA/ocn.mk +AtmOcnSelectExternalProto/OcnModelA/ocn.o +AtmOcnSelectExternalProto/OcnModelA/ocna.mod +AtmOcnSelectExternalProto/OcnModelB/OcnSub/ocnSub.mk +AtmOcnSelectExternalProto/OcnModelB/OcnSub/ocnSub.o +AtmOcnSelectExternalProto/OcnModelB/OcnSub/ocnsub.mod +AtmOcnSelectExternalProto/OcnModelB/ocn.mk +AtmOcnSelectExternalProto/OcnModelB/ocn.o +AtmOcnSelectExternalProto/OcnModelB/ocnb.mod +AtmOcnSelectExternalProto/OcnModelC/OcnSub/ocnSub.mk +AtmOcnSelectExternalProto/OcnModelC/OcnSub/ocnSub.o +AtmOcnSelectExternalProto/OcnModelC/OcnSub/ocnsub.mod +AtmOcnSelectExternalProto/OcnModelC/ocn.mk +AtmOcnSelectExternalProto/OcnModelC/ocnc.mod +AtmOcnSelectExternalProto/PET0.ESMF_LogFile +AtmOcnSelectExternalProto/PET1.ESMF_LogFile +AtmOcnSelectExternalProto/PET2.ESMF_LogFile +AtmOcnSelectExternalProto/PET3.ESMF_LogFile +AtmOcnSelectExternalProto/atmE.so +AtmOcnSelectExternalProto/esmApp.stdout +AtmOcnSelectExternalProto/ocn.so +AtmOcnSelectProto/PET0.ESMF_LogFile +AtmOcnSelectProto/PET1.ESMF_LogFile +AtmOcnSelectProto/PET2.ESMF_LogFile +AtmOcnSelectProto/PET3.ESMF_LogFile +AtmOcnSelectProto/atmA.o +AtmOcnSelectProto/atmB.o +AtmOcnSelectProto/atma.mod +AtmOcnSelectProto/atmb.mod +AtmOcnSelectProto/esm.mod +AtmOcnSelectProto/esm.o +AtmOcnSelectProto/esmApp +AtmOcnSelectProto/esmApp.o +AtmOcnSelectProto/esmApp.stdout +AtmOcnSelectProto/ocnA.o +AtmOcnSelectProto/ocnB.o +AtmOcnSelectProto/ocna.mod +AtmOcnSelectProto/ocnb.mod +AtmOcnSimpleImplicitProto/PET0.ESMF_LogFile +AtmOcnSimpleImplicitProto/PET1.ESMF_LogFile +AtmOcnSimpleImplicitProto/PET2.ESMF_LogFile +AtmOcnSimpleImplicitProto/PET3.ESMF_LogFile +AtmOcnSimpleImplicitProto/atm.mod +AtmOcnSimpleImplicitProto/atm.o +AtmOcnSimpleImplicitProto/esm.mod +AtmOcnSimpleImplicitProto/esm.o +AtmOcnSimpleImplicitProto/esmApp +AtmOcnSimpleImplicitProto/esmApp.o +AtmOcnSimpleImplicitProto/esmApp.stdout +AtmOcnSimpleImplicitProto/ocn.mod +AtmOcnSimpleImplicitProto/ocn.o +AtmOcnTransferGridProto/ATM-accepted-Grid-pmsl_centers.2.0.vtk +AtmOcnTransferGridProto/ATM-accepted-Grid-pmsl_centers.2.1.vtk +AtmOcnTransferGridProto/ATM-accepted-Grid-ssh_centers.2.0.vtk +AtmOcnTransferGridProto/ATM-accepted-Grid-ssh_centers.2.1.vtk +AtmOcnTransferGridProto/OCN-GridAux_centers.2.0.vtk +AtmOcnTransferGridProto/OCN-GridAux_centers.2.1.vtk +AtmOcnTransferGridProto/OCN-GridCS_centers.2.0.vtk +AtmOcnTransferGridProto/OCN-GridCS_centers.2.1.vtk +AtmOcnTransferGridProto/OCN-GridIn_centers.2.0.vtk +AtmOcnTransferGridProto/OCN-GridIn_centers.2.1.vtk +AtmOcnTransferGridProto/PET0.ESMF_LogFile +AtmOcnTransferGridProto/PET1.ESMF_LogFile +AtmOcnTransferGridProto/PET2.ESMF_LogFile +AtmOcnTransferGridProto/PET3.ESMF_LogFile +AtmOcnTransferGridProto/array_ATM-grid_center_coord1.nc +AtmOcnTransferGridProto/array_ATM-grid_center_coord2.nc +AtmOcnTransferGridProto/array_ATM-grid_corner_coord1.nc +AtmOcnTransferGridProto/array_ATM-grid_corner_coord2.nc +AtmOcnTransferGridProto/array_ATM-grid_edge1_coord1.nc +AtmOcnTransferGridProto/array_ATM-grid_edge1_coord2.nc +AtmOcnTransferGridProto/array_ATM-grid_edge2_coord1.nc +AtmOcnTransferGridProto/array_ATM-grid_edge2_coord2.nc +AtmOcnTransferGridProto/array_OCN-gridIn_center_coord1.nc +AtmOcnTransferGridProto/array_OCN-gridIn_center_coord2.nc +AtmOcnTransferGridProto/array_OCN-gridIn_corner_coord1.nc +AtmOcnTransferGridProto/array_OCN-gridIn_corner_coord2.nc +AtmOcnTransferGridProto/array_OCN-gridIn_edge1_coord1.nc +AtmOcnTransferGridProto/array_OCN-gridIn_edge1_coord2.nc +AtmOcnTransferGridProto/array_OCN-gridIn_edge2_coord1.nc +AtmOcnTransferGridProto/array_OCN-gridIn_edge2_coord2.nc +AtmOcnTransferGridProto/atm.mod +AtmOcnTransferGridProto/atm.o +AtmOcnTransferGridProto/esm.mod +AtmOcnTransferGridProto/esm.o +AtmOcnTransferGridProto/esmApp +AtmOcnTransferGridProto/esmApp.o +AtmOcnTransferGridProto/esmApp.stdout +AtmOcnTransferGridProto/field_atm_export_pmsl.nc +AtmOcnTransferGridProto/field_atm_export_precip.nc +AtmOcnTransferGridProto/field_atm_export_rsns.nc +AtmOcnTransferGridProto/field_atm_init_export_pmsl.nc +AtmOcnTransferGridProto/field_atm_init_export_precip.nc +AtmOcnTransferGridProto/field_atm_init_export_rsns.nc +AtmOcnTransferGridProto/field_gridArb.nc +AtmOcnTransferGridProto/field_ocn_import_pmsl.nc +AtmOcnTransferGridProto/field_ocn_import_precip.nc +AtmOcnTransferGridProto/field_ocn_import_rsns.nc +AtmOcnTransferGridProto/fields_ocn_init_export.tile1.nc +AtmOcnTransferGridProto/fields_ocn_init_export.tile2.nc +AtmOcnTransferGridProto/fields_ocn_init_export.tile3.nc +AtmOcnTransferGridProto/fields_ocn_init_export.tile4.nc +AtmOcnTransferGridProto/fields_ocn_init_export.tile5.nc +AtmOcnTransferGridProto/fields_ocn_init_export.tile6.nc +AtmOcnTransferGridProto/ocn.mod +AtmOcnTransferGridProto/ocn.o +AtmOcnTransferLocStreamProto/PET0.ESMF_LogFile +AtmOcnTransferLocStreamProto/PET1.ESMF_LogFile +AtmOcnTransferLocStreamProto/PET2.ESMF_LogFile +AtmOcnTransferLocStreamProto/PET3.ESMF_LogFile +AtmOcnTransferLocStreamProto/atm.mod +AtmOcnTransferLocStreamProto/atm.o +AtmOcnTransferLocStreamProto/esm.mod +AtmOcnTransferLocStreamProto/esm.o +AtmOcnTransferLocStreamProto/esmApp +AtmOcnTransferLocStreamProto/esmApp.o +AtmOcnTransferLocStreamProto/esmApp.stdout +AtmOcnTransferLocStreamProto/field_pmsl_init.nc +AtmOcnTransferLocStreamProto/ocn.mod +AtmOcnTransferLocStreamProto/ocn.o +AtmOcnTransferMeshProto/Atm-MeshIn_corners.2.0.vtk +AtmOcnTransferMeshProto/Atm-MeshIn_corners.2.1.vtk +AtmOcnTransferMeshProto/Atm-MeshOut_corners.2.0.vtk +AtmOcnTransferMeshProto/Atm-MeshOut_corners.2.1.vtk +AtmOcnTransferMeshProto/OCN-MeshIn.2.0.vtk +AtmOcnTransferMeshProto/OCN-MeshIn.2.1.vtk +AtmOcnTransferMeshProto/OCN-MeshOut.2.0.vtk +AtmOcnTransferMeshProto/OCN-MeshOut.2.1.vtk +AtmOcnTransferMeshProto/PET0.ESMF_LogFile +AtmOcnTransferMeshProto/PET1.ESMF_LogFile +AtmOcnTransferMeshProto/PET2.ESMF_LogFile +AtmOcnTransferMeshProto/PET3.ESMF_LogFile +AtmOcnTransferMeshProto/atm.mod +AtmOcnTransferMeshProto/atm.o +AtmOcnTransferMeshProto/esm.mod +AtmOcnTransferMeshProto/esm.o +AtmOcnTransferMeshProto/esmApp +AtmOcnTransferMeshProto/esmApp.o +AtmOcnTransferMeshProto/esmApp.stdout +AtmOcnTransferMeshProto/field_pmsl_init.nc +AtmOcnTransferMeshProto/ocn.mod +AtmOcnTransferMeshProto/ocn.o +ComponentExplorer/PET0.ESMF_LogFile +ComponentExplorer/PET1.ESMF_LogFile +ComponentExplorer/PET2.ESMF_LogFile +ComponentExplorer/PET3.ESMF_LogFile +ComponentExplorer/nuopcExplorerApp +ComponentExplorer/nuopcExplorerApp.stdout +ComponentExplorer/nuopcexplorerdriver.mod +CustomFieldDictionaryProto/PET0.ESMF_LogFile +CustomFieldDictionaryProto/PET1.ESMF_LogFile +CustomFieldDictionaryProto/PET2.ESMF_LogFile +CustomFieldDictionaryProto/PET3.ESMF_LogFile +CustomFieldDictionaryProto/driver.mod +CustomFieldDictionaryProto/driver.o +CustomFieldDictionaryProto/mainApp +CustomFieldDictionaryProto/mainApp.o +CustomFieldDictionaryProto/mainApp.stdout +CustomFieldDictionaryProto/model.mod +CustomFieldDictionaryProto/model.o +CustomFieldDictionaryProto/util.mod +CustomFieldDictionaryProto/util.o +DriverInDriverProto/PET0.ESMF_LogFile +DriverInDriverProto/PET1.ESMF_LogFile +DriverInDriverProto/PET2.ESMF_LogFile +DriverInDriverProto/PET3.ESMF_LogFile +DriverInDriverProto/atm.mod +DriverInDriverProto/atm.o +DriverInDriverProto/driverChildComp.o +DriverInDriverProto/driverParentComp.o +DriverInDriverProto/driverchildcomp.mod +DriverInDriverProto/driverparentcomp.mod +DriverInDriverProto/mainApp +DriverInDriverProto/mainApp.o +DriverInDriverProto/mainApp.stdout +DriverInDriverProto/ocn.mod +DriverInDriverProto/ocn.o +DriverInDriverProtoIPDv02/PET0.ESMF_LogFile +DriverInDriverProtoIPDv02/PET1.ESMF_LogFile +DriverInDriverProtoIPDv02/PET2.ESMF_LogFile +DriverInDriverProtoIPDv02/PET3.ESMF_LogFile +DriverInDriverProtoIPDv02/atm.mod +DriverInDriverProtoIPDv02/atm.o +DriverInDriverProtoIPDv02/driverChildComp.o +DriverInDriverProtoIPDv02/driverParentComp.o +DriverInDriverProtoIPDv02/driverchildcomp.mod +DriverInDriverProtoIPDv02/driverparentcomp.mod +DriverInDriverProtoIPDv02/field_atm_export_adv_pmsl.nc +DriverInDriverProtoIPDv02/field_atm_export_adv_rsns.nc +DriverInDriverProtoIPDv02/field_atm_import_adv_sst.nc +DriverInDriverProtoIPDv02/field_atm_import_datainit_sst.nc +DriverInDriverProtoIPDv02/field_ocn_export_datainit_sst.nc +DriverInDriverProtoIPDv02/mainApp +DriverInDriverProtoIPDv02/mainApp.o +DriverInDriverProtoIPDv02/mainApp.stdout +DriverInDriverProtoIPDv02/ocn.mod +DriverInDriverProtoIPDv02/ocn.o +DynPhyProto/PET0.ESMF_LogFile +DynPhyProto/PET1.ESMF_LogFile +DynPhyProto/PET2.ESMF_LogFile +DynPhyProto/PET3.ESMF_LogFile +DynPhyProto/atm.mod +DynPhyProto/atm.o +DynPhyProto/diagnostic_DYN_Finalize_enter_import_2010_06_01_01_00_00_000_phyex_field.nc +DynPhyProto/diagnostic_DYN_Finalize_exit_import_2010_06_01_01_00_00_000_phyex_field.nc +DynPhyProto/diagnostic_DYN_InitializeP3_enter_import_2010_06_01_00_00_00_000_phyex_field.nc +DynPhyProto/diagnostic_DYN_InitializeP3_exit_import_2010_06_01_00_00_00_000_phyex_field.nc +DynPhyProto/diagnostic_DYN_InitializeP5_enter_import_2010_06_01_00_00_00_000_phyex_field.nc +DynPhyProto/diagnostic_DYN_InitializeP5_exit_import_2010_06_01_00_00_00_000_phyex_field.nc +DynPhyProto/diagnostic_DYN_Run_enter_import_2010_06_01_00_00_00_000_phyex_field.nc +DynPhyProto/diagnostic_DYN_Run_enter_import_2010_06_01_00_15_00_000_phyex_field.nc +DynPhyProto/diagnostic_DYN_Run_enter_import_2010_06_01_00_30_00_000_phyex_field.nc +DynPhyProto/diagnostic_DYN_Run_enter_import_2010_06_01_00_45_00_000_phyex_field.nc +DynPhyProto/diagnostic_DYN_Run_exit_import_2010_06_01_00_00_00_000_phyex_field.nc +DynPhyProto/diagnostic_DYN_Run_exit_import_2010_06_01_00_15_00_000_phyex_field.nc +DynPhyProto/diagnostic_DYN_Run_exit_import_2010_06_01_00_30_00_000_phyex_field.nc +DynPhyProto/diagnostic_DYN_Run_exit_import_2010_06_01_00_45_00_000_phyex_field.nc +DynPhyProto/diagnostic_PHY-TO-DYN_Finalize_enter_export_2010_06_01_01_00_00_000_phyex_field.nc +DynPhyProto/diagnostic_PHY-TO-DYN_Finalize_enter_import_2010_06_01_01_00_00_000_PHYEX.nc +DynPhyProto/diagnostic_PHY-TO-DYN_Finalize_exit_export_2010_06_01_01_00_00_000_phyex_field.nc +DynPhyProto/diagnostic_PHY-TO-DYN_Finalize_exit_import_2010_06_01_01_00_00_000_PHYEX.nc +DynPhyProto/diagnostic_PHY-TO-DYN_InitializeIPDv05p4_enter_export_2010_06_01_00_00_00_000_phyex_field.nc +DynPhyProto/diagnostic_PHY-TO-DYN_InitializeIPDv05p4_exit_export_2010_06_01_00_00_00_000_phyex_field.nc +DynPhyProto/diagnostic_PHY-TO-DYN_InitializeIPDv05p4_exit_import_2010_06_01_00_00_00_000_PHYEX.nc +DynPhyProto/diagnostic_PHY-TO-DYN_InitializeIPDv05p5_enter_export_2010_06_01_00_00_00_000_phyex_field.nc +DynPhyProto/diagnostic_PHY-TO-DYN_InitializeIPDv05p5_enter_import_2010_06_01_00_00_00_000_PHYEX.nc +DynPhyProto/diagnostic_PHY-TO-DYN_InitializeIPDv05p5_exit_export_2010_06_01_00_00_00_000_phyex_field.nc +DynPhyProto/diagnostic_PHY-TO-DYN_InitializeIPDv05p5_exit_import_2010_06_01_00_00_00_000_PHYEX.nc +DynPhyProto/diagnostic_PHY-TO-DYN_InitializeIPDv05p6a_enter_export_2010_06_01_00_00_00_000_phyex_field.nc +DynPhyProto/diagnostic_PHY-TO-DYN_InitializeIPDv05p6a_enter_import_2010_06_01_00_00_00_000_PHYEX.nc +DynPhyProto/diagnostic_PHY-TO-DYN_InitializeIPDv05p6a_exit_export_2010_06_01_00_00_00_000_phyex_field.nc +DynPhyProto/diagnostic_PHY-TO-DYN_InitializeIPDv05p6a_exit_import_2010_06_01_00_00_00_000_PHYEX.nc +DynPhyProto/diagnostic_PHY-TO-DYN_InitializeIPDv05p6b_enter_export_2010_06_01_00_00_00_000_phyex_field.nc +DynPhyProto/diagnostic_PHY-TO-DYN_InitializeIPDv05p6b_enter_import_2010_06_01_00_00_00_000_PHYEX.nc +DynPhyProto/diagnostic_PHY-TO-DYN_InitializeIPDv05p6b_exit_export_2010_06_01_00_00_00_000_phyex_field.nc +DynPhyProto/diagnostic_PHY-TO-DYN_InitializeIPDv05p6b_exit_import_2010_06_01_00_00_00_000_PHYEX.nc +DynPhyProto/diagnostic_PHY-TO-DYN_Run_enter_export_2010_06_01_00_00_00_000_phyex_field.nc +DynPhyProto/diagnostic_PHY-TO-DYN_Run_enter_export_2010_06_01_00_15_00_000_phyex_field.nc +DynPhyProto/diagnostic_PHY-TO-DYN_Run_enter_export_2010_06_01_00_30_00_000_phyex_field.nc +DynPhyProto/diagnostic_PHY-TO-DYN_Run_enter_export_2010_06_01_00_45_00_000_phyex_field.nc +DynPhyProto/diagnostic_PHY-TO-DYN_Run_enter_import_2010_06_01_00_00_00_000_PHYEX.nc +DynPhyProto/diagnostic_PHY-TO-DYN_Run_enter_import_2010_06_01_00_15_00_000_PHYEX.nc +DynPhyProto/diagnostic_PHY-TO-DYN_Run_enter_import_2010_06_01_00_30_00_000_PHYEX.nc +DynPhyProto/diagnostic_PHY-TO-DYN_Run_enter_import_2010_06_01_00_45_00_000_PHYEX.nc +DynPhyProto/diagnostic_PHY-TO-DYN_Run_exit_export_2010_06_01_00_00_00_000_phyex_field.nc +DynPhyProto/diagnostic_PHY-TO-DYN_Run_exit_export_2010_06_01_00_15_00_000_phyex_field.nc +DynPhyProto/diagnostic_PHY-TO-DYN_Run_exit_export_2010_06_01_00_30_00_000_phyex_field.nc +DynPhyProto/diagnostic_PHY-TO-DYN_Run_exit_export_2010_06_01_00_45_00_000_phyex_field.nc +DynPhyProto/diagnostic_PHY-TO-DYN_Run_exit_import_2010_06_01_00_00_00_000_PHYEX.nc +DynPhyProto/diagnostic_PHY-TO-DYN_Run_exit_import_2010_06_01_00_15_00_000_PHYEX.nc +DynPhyProto/diagnostic_PHY-TO-DYN_Run_exit_import_2010_06_01_00_30_00_000_PHYEX.nc +DynPhyProto/diagnostic_PHY-TO-DYN_Run_exit_import_2010_06_01_00_45_00_000_PHYEX.nc +DynPhyProto/diagnostic_PHY_Finalize_enter_export_2010_06_01_01_00_00_000_PHYEX.nc +DynPhyProto/diagnostic_PHY_Finalize_exit_export_2010_06_01_01_00_00_000_PHYEX.nc +DynPhyProto/diagnostic_PHY_InitializeP3_enter_export_2010_06_01_00_00_00_000_PHYEX.nc +DynPhyProto/diagnostic_PHY_InitializeP3_exit_export_2010_06_01_00_00_00_000_PHYEX.nc +DynPhyProto/diagnostic_PHY_InitializeP5_enter_export_2010_06_01_00_00_00_000_PHYEX.nc +DynPhyProto/diagnostic_PHY_InitializeP5_exit_export_2010_06_01_00_00_00_000_PHYEX.nc +DynPhyProto/diagnostic_PHY_Run_enter_export_2010_06_01_00_00_00_000_PHYEX.nc +DynPhyProto/diagnostic_PHY_Run_enter_export_2010_06_01_00_15_00_000_PHYEX.nc +DynPhyProto/diagnostic_PHY_Run_enter_export_2010_06_01_00_30_00_000_PHYEX.nc +DynPhyProto/diagnostic_PHY_Run_enter_export_2010_06_01_00_45_00_000_PHYEX.nc +DynPhyProto/diagnostic_PHY_Run_exit_export_2010_06_01_00_00_00_000_PHYEX.nc +DynPhyProto/diagnostic_PHY_Run_exit_export_2010_06_01_00_15_00_000_PHYEX.nc +DynPhyProto/diagnostic_PHY_Run_exit_export_2010_06_01_00_30_00_000_PHYEX.nc +DynPhyProto/diagnostic_PHY_Run_exit_export_2010_06_01_00_45_00_000_PHYEX.nc +DynPhyProto/dyn.mod +DynPhyProto/dyn.o +DynPhyProto/esmApp +DynPhyProto/esmApp.o +DynPhyProto/esmApp.stdout +DynPhyProto/field_dyn_import_adv_phyex_field.nc +DynPhyProto/field_dyn_import_datainit_phyex_field.nc +DynPhyProto/field_phy_export_adv_PHYEX.nc +DynPhyProto/field_phy_export_datainit_PHYEX.nc +DynPhyProto/phy.mod +DynPhyProto/phy.o +ExternalDriverAPIProto/PET0.ESMF_LogFile +ExternalDriverAPIProto/PET1.ESMF_LogFile +ExternalDriverAPIProto/PET2.ESMF_LogFile +ExternalDriverAPIProto/PET3.ESMF_LogFile +ExternalDriverAPIProto/atm.mod +ExternalDriverAPIProto/atm.o +ExternalDriverAPIProto/esm.mod +ExternalDriverAPIProto/esm.o +ExternalDriverAPIProto/externalApp +ExternalDriverAPIProto/externalApp.o +ExternalDriverAPIProto/externalApp.stdout +ExternalDriverAPIProto/field_ocn_export_sst.nc +ExternalDriverAPIProto/field_ocn_import_pmsl.nc +ExternalDriverAPIProto/field_ocn_import_rsnl.nc +ExternalDriverAPIProto/field_ocn_import_rsns.nc +ExternalDriverAPIProto/field_ocn_import_sdhf.nc +ExternalDriverAPIProto/ocn.mod +ExternalDriverAPIProto/ocn.o +GenericMediatorProto/PET0.ESMF_LogFile +GenericMediatorProto/PET1.ESMF_LogFile +GenericMediatorProto/PET2.ESMF_LogFile +GenericMediatorProto/PET3.ESMF_LogFile +GenericMediatorProto/app +GenericMediatorProto/app.o +GenericMediatorProto/app.stdout +GenericMediatorProto/driver.mod +GenericMediatorProto/driver.o +GenericMediatorProto/mediator.mod +GenericMediatorProto/mediator.o +GenericMediatorProto/modelA.o +GenericMediatorProto/modelB.o +GenericMediatorProto/modela.mod +GenericMediatorProto/modelb.mod +HierarchyProto/PET0.ESMF_LogFile +HierarchyProto/PET1.ESMF_LogFile +HierarchyProto/PET2.ESMF_LogFile +HierarchyProto/PET3.ESMF_LogFile +HierarchyProto/atm.mod +HierarchyProto/atm.o +HierarchyProto/dyn.mod +HierarchyProto/dyn.o +HierarchyProto/esm.mod +HierarchyProto/esm.o +HierarchyProto/esmApp +HierarchyProto/esmApp.o +HierarchyProto/esmApp.stdout +HierarchyProto/field_dyn_export_adv_pmsl.nc +HierarchyProto/field_dyn_export_adv_rsns.nc +HierarchyProto/field_dyn_export_datainit_pmsl.nc +HierarchyProto/field_dyn_export_datainit_rsns.nc +HierarchyProto/field_dyn_import_adv_PHYEX.nc +HierarchyProto/field_dyn_import_adv_sst.nc +HierarchyProto/field_dyn_import_datainit_PHYEX.nc +HierarchyProto/field_dyn_import_datainit_sst.nc +HierarchyProto/field_ocn_export_adv_sst.nc +HierarchyProto/field_ocn_export_datainit_sst.nc +HierarchyProto/field_ocn_import_adv_pmsl.nc +HierarchyProto/field_ocn_import_adv_precipitation_flux.nc +HierarchyProto/field_ocn_import_adv_rsns.nc +HierarchyProto/field_phy_export_adv_PHYEX.nc +HierarchyProto/field_phy_export_adv_precipitation_flux.nc +HierarchyProto/field_phy_export_datainit_PHYEX.nc +HierarchyProto/field_phy_export_datainit_precipitation_flux.nc +HierarchyProto/field_phy_import_adv_sst.nc +HierarchyProto/ocn.mod +HierarchyProto/ocn.o +HierarchyProto/phy.mod +HierarchyProto/phy.o +NamespaceProto/PET0.ESMF_LogFile +NamespaceProto/PET1.ESMF_LogFile +NamespaceProto/PET2.ESMF_LogFile +NamespaceProto/PET3.ESMF_LogFile +NamespaceProto/atm.mod +NamespaceProto/atm.o +NamespaceProto/driver.mod +NamespaceProto/driver.o +NamespaceProto/mainApp +NamespaceProto/mainApp.o +NamespaceProto/mainApp.stdout +NamespaceProto/med.mod +NamespaceProto/med.o +NestingMultipleProto/PET0.ESMF_LogFile +NestingMultipleProto/PET1.ESMF_LogFile +NestingMultipleProto/PET2.ESMF_LogFile +NestingMultipleProto/PET3.ESMF_LogFile +NestingMultipleProto/advectDiffComp.o +NestingMultipleProto/advectDiff_Nestling0_export_density.nc +NestingMultipleProto/advectDiff_Nestling1_export_density.nc +NestingMultipleProto/advectDiff_Parent_export_density.nc +NestingMultipleProto/advectdiffcomp.mod +NestingMultipleProto/driverComp.o +NestingMultipleProto/drivercomp.mod +NestingMultipleProto/mainApp +NestingMultipleProto/mainApp.o +NestingMultipleProto/mainApp.stdout +NestingSingleProto/PET0.ESMF_LogFile +NestingSingleProto/PET1.ESMF_LogFile +NestingSingleProto/PET2.ESMF_LogFile +NestingSingleProto/PET3.ESMF_LogFile +NestingSingleProto/advectDiffComp.o +NestingSingleProto/advectDiff_Nestling0_export_density.nc +NestingSingleProto/advectDiff_Parent_export_density.nc +NestingSingleProto/advectdiffcomp.mod +NestingSingleProto/driverComp.o +NestingSingleProto/drivercomp.mod +NestingSingleProto/mainApp +NestingSingleProto/mainApp.o +NestingSingleProto/mainApp.stdout +NestingTelescopeMultipleProto/PET0.ESMF_LogFile +NestingTelescopeMultipleProto/PET1.ESMF_LogFile +NestingTelescopeMultipleProto/PET2.ESMF_LogFile +NestingTelescopeMultipleProto/PET3.ESMF_LogFile +NestingTelescopeMultipleProto/advectDiffComp.o +NestingTelescopeMultipleProto/advectDiff_Gen1Nestling0_export_density.nc +NestingTelescopeMultipleProto/advectDiff_Gen1Nestling1_export_density.nc +NestingTelescopeMultipleProto/advectDiff_Gen2Nestling0_export_density.nc +NestingTelescopeMultipleProto/advectDiff_Parent_export_density.nc +NestingTelescopeMultipleProto/advectdiffcomp.mod +NestingTelescopeMultipleProto/driverComp.o +NestingTelescopeMultipleProto/drivercomp.mod +NestingTelescopeMultipleProto/mainApp +NestingTelescopeMultipleProto/mainApp.o +NestingTelescopeMultipleProto/mainApp.stdout +SingleModelOpenMPProto/PET0.ESMF_LogFile +SingleModelOpenMPProto/PET1.ESMF_LogFile +SingleModelOpenMPProto/PET2.ESMF_LogFile +SingleModelOpenMPProto/PET3.ESMF_LogFile +SingleModelOpenMPProto/driver.mod +SingleModelOpenMPProto/driver.o +SingleModelOpenMPProto/mainApp +SingleModelOpenMPProto/mainApp.o +SingleModelOpenMPProto/mainApp.stdout +SingleModelOpenMPProto/model.mod +SingleModelOpenMPProto/model.o +SingleModelProto/PET0.ESMF_LogFile +SingleModelProto/PET1.ESMF_LogFile +SingleModelProto/PET2.ESMF_LogFile +SingleModelProto/PET3.ESMF_LogFile +SingleModelProto/driver.mod +SingleModelProto/driver.o +SingleModelProto/mainApp +SingleModelProto/mainApp.o +SingleModelProto/mainApp.stdout +SingleModelProto/model.mod +SingleModelProto/model.o From 51d67d515d4e399247dc3e1d724623bbe4432ab1 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Fri, 7 Aug 2020 08:43:28 -0700 Subject: [PATCH 17/68] Remove the call to ESMF_MethodRemove() now that NUOPC_CompSpecialize() takes care of this. --- AtmOcnIceSimpleImplicitProto/ice.F90 | 5 ----- AtmOcnIceSimpleImplicitProto/ocn.F90 | 5 ----- AtmOcnMedIngestFromConfigProto/med.F90 | 12 ------------ AtmOcnMedIngestFromConfigProto/ocn.F90 | 6 ------ AtmOcnMedIngestFromInternalProto/med.F90 | 12 ------------ AtmOcnMedIngestFromInternalProto/ocn.F90 | 6 ------ AtmOcnMedTransferGridMakeMeshProto/atm.F90 | 5 ----- AtmOcnMedTransferGridMakeMeshProto/med.F90 | 6 ------ AtmOcnMedTransferGridMakeMeshProto/ocn.F90 | 5 ----- AtmOcnSimpleImplicitProto/ocn.F90 | 5 ----- ExternalDriverAPIProto/atm.F90 | 5 ----- 11 files changed, 72 deletions(-) diff --git a/AtmOcnIceSimpleImplicitProto/ice.F90 b/AtmOcnIceSimpleImplicitProto/ice.F90 index 4ea166bc..1d543438 100644 --- a/AtmOcnIceSimpleImplicitProto/ice.F90 +++ b/AtmOcnIceSimpleImplicitProto/ice.F90 @@ -89,11 +89,6 @@ subroutine SetServices(model, rc) return ! bail out ! overwrite default CheckImport method to replace explicit with implement check - call ESMF_MethodRemove(model, label=model_label_CheckImport, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out call NUOPC_CompSpecialize(model, specLabel=model_label_CheckImport, & specRoutine=CheckImport, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & diff --git a/AtmOcnIceSimpleImplicitProto/ocn.F90 b/AtmOcnIceSimpleImplicitProto/ocn.F90 index 707c7558..7e831011 100644 --- a/AtmOcnIceSimpleImplicitProto/ocn.F90 +++ b/AtmOcnIceSimpleImplicitProto/ocn.F90 @@ -94,11 +94,6 @@ subroutine SetServices(model, rc) return ! bail out ! overwrite default CheckImport method to replace explicit with implement check - call ESMF_MethodRemove(model, label=model_label_CheckImport, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out call NUOPC_CompSpecialize(model, specLabel=model_label_CheckImport, & specRoutine=CheckImport, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & diff --git a/AtmOcnMedIngestFromConfigProto/med.F90 b/AtmOcnMedIngestFromConfigProto/med.F90 index 3239979d..814248d2 100644 --- a/AtmOcnMedIngestFromConfigProto/med.F90 +++ b/AtmOcnMedIngestFromConfigProto/med.F90 @@ -64,12 +64,6 @@ subroutine SetServices(mediator, rc) return ! bail out ! attach specializing method(s) - ! -> NUOPC specializes by default --->>> first need to remove the default - call ESMF_MethodRemove(mediator, label_CheckImport, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out call NUOPC_CompSpecialize(mediator, specLabel=label_CheckImport, & specRoutine=NUOPC_NoOp, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -78,12 +72,6 @@ subroutine SetServices(mediator, rc) return ! bail out ! attach specializing method(s) - ! -> NUOPC specializes by default --->>> first need to remove the default - call ESMF_MethodRemove(mediator, label_SetRunClock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out call NUOPC_CompSpecialize(mediator, specLabel=label_SetRunClock, & specRoutine=SetRunClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & diff --git a/AtmOcnMedIngestFromConfigProto/ocn.F90 b/AtmOcnMedIngestFromConfigProto/ocn.F90 index 5dcc2ff0..f6d6827d 100644 --- a/AtmOcnMedIngestFromConfigProto/ocn.F90 +++ b/AtmOcnMedIngestFromConfigProto/ocn.F90 @@ -70,12 +70,6 @@ subroutine SetServices(model, rc) return ! bail out ! attach specializing method(s) - ! -> NUOPC specializes by default --->>> first need to remove the default - call ESMF_MethodRemove(model, label_CheckImport, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out call NUOPC_CompSpecialize(model, specLabel=label_CheckImport, & specRoutine=CheckImport, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & diff --git a/AtmOcnMedIngestFromInternalProto/med.F90 b/AtmOcnMedIngestFromInternalProto/med.F90 index a452426e..0aed284a 100644 --- a/AtmOcnMedIngestFromInternalProto/med.F90 +++ b/AtmOcnMedIngestFromInternalProto/med.F90 @@ -64,12 +64,6 @@ subroutine SetServices(mediator, rc) return ! bail out ! attach specializing method(s) - ! -> NUOPC specializes by default --->>> first need to remove the default - call ESMF_MethodRemove(mediator, label_CheckImport, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out call NUOPC_CompSpecialize(mediator, specLabel=label_CheckImport, & specRoutine=NUOPC_NoOp, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -78,12 +72,6 @@ subroutine SetServices(mediator, rc) return ! bail out ! attach specializing method(s) - ! -> NUOPC specializes by default --->>> first need to remove the default - call ESMF_MethodRemove(mediator, label_SetRunClock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out call NUOPC_CompSpecialize(mediator, specLabel=label_SetRunClock, & specRoutine=SetRunClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & diff --git a/AtmOcnMedIngestFromInternalProto/ocn.F90 b/AtmOcnMedIngestFromInternalProto/ocn.F90 index 5dcc2ff0..f6d6827d 100644 --- a/AtmOcnMedIngestFromInternalProto/ocn.F90 +++ b/AtmOcnMedIngestFromInternalProto/ocn.F90 @@ -70,12 +70,6 @@ subroutine SetServices(model, rc) return ! bail out ! attach specializing method(s) - ! -> NUOPC specializes by default --->>> first need to remove the default - call ESMF_MethodRemove(model, label_CheckImport, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out call NUOPC_CompSpecialize(model, specLabel=label_CheckImport, & specRoutine=CheckImport, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & diff --git a/AtmOcnMedTransferGridMakeMeshProto/atm.F90 b/AtmOcnMedTransferGridMakeMeshProto/atm.F90 index 0d09ec0e..c5f2cbcb 100644 --- a/AtmOcnMedTransferGridMakeMeshProto/atm.F90 +++ b/AtmOcnMedTransferGridMakeMeshProto/atm.F90 @@ -92,11 +92,6 @@ subroutine SetServices(model, rc) return ! bail out call NUOPC_CompSpecialize(model, specLabel=model_label_DataInitialize, & specRoutine=DataInitialize, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_MethodRemove(model, model_label_CheckImport, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & diff --git a/AtmOcnMedTransferGridMakeMeshProto/med.F90 b/AtmOcnMedTransferGridMakeMeshProto/med.F90 index 1067512c..6a0bbf1e 100644 --- a/AtmOcnMedTransferGridMakeMeshProto/med.F90 +++ b/AtmOcnMedTransferGridMakeMeshProto/med.F90 @@ -123,17 +123,11 @@ subroutine SetServices(mediator, rc) return ! bail out ! Handle the clocks when multiple run phases exist - call ESMF_MethodRemove(mediator, mediator_label_CheckImport, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=__FILE__)) return ! bail out call NUOPC_CompSpecialize(mediator, specLabel=mediator_label_CheckImport, & specRoutine=NUOPC_NoOp, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_MethodRemove(mediator, mediator_label_SetRunClock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=__FILE__)) return ! bail out call NUOPC_CompSpecialize(mediator, specLabel=mediator_label_SetRunClock, & specRoutine=SetRunClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & diff --git a/AtmOcnMedTransferGridMakeMeshProto/ocn.F90 b/AtmOcnMedTransferGridMakeMeshProto/ocn.F90 index bfc085c3..9a718daf 100644 --- a/AtmOcnMedTransferGridMakeMeshProto/ocn.F90 +++ b/AtmOcnMedTransferGridMakeMeshProto/ocn.F90 @@ -73,11 +73,6 @@ subroutine SetServices(model, rc) return ! bail out call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & specRoutine=ModelAdvance, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_MethodRemove(model, model_label_CheckImport, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & diff --git a/AtmOcnSimpleImplicitProto/ocn.F90 b/AtmOcnSimpleImplicitProto/ocn.F90 index 76012957..2f1f4fea 100644 --- a/AtmOcnSimpleImplicitProto/ocn.F90 +++ b/AtmOcnSimpleImplicitProto/ocn.F90 @@ -89,11 +89,6 @@ subroutine SetServices(model, rc) return ! bail out ! overwrite default CheckImport method to replace explicit with implement check - call ESMF_MethodRemove(model, label=model_label_CheckImport, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out call NUOPC_CompSpecialize(model, specLabel=model_label_CheckImport, & specRoutine=CheckImport, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & diff --git a/ExternalDriverAPIProto/atm.F90 b/ExternalDriverAPIProto/atm.F90 index b4e1246e..2e9a937d 100644 --- a/ExternalDriverAPIProto/atm.F90 +++ b/ExternalDriverAPIProto/atm.F90 @@ -68,11 +68,6 @@ subroutine SetServices(model, rc) ! attach specializing method(s) call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & specRoutine=ModelAdvance, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_MethodRemove(model, label_CheckImport, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & From 2f0d86dd17e6023a70be9bd8b0a3a2dbcf35216d Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Fri, 7 Aug 2020 09:38:33 -0700 Subject: [PATCH 18/68] Set Verbosity to "high". --- DriverInDriverProto/driverChildComp.F90 | 2 +- DriverInDriverProto/driverParentComp.F90 | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/DriverInDriverProto/driverChildComp.F90 b/DriverInDriverProto/driverChildComp.F90 index c6e8da32..20f4869b 100644 --- a/DriverInDriverProto/driverChildComp.F90 +++ b/DriverInDriverProto/driverChildComp.F90 @@ -75,7 +75,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompAttributeSet(child, name="Verbosity", value="1", rc=rc) + call NUOPC_CompAttributeSet(child, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & diff --git a/DriverInDriverProto/driverParentComp.F90 b/DriverInDriverProto/driverParentComp.F90 index a4221f13..5f1362a5 100644 --- a/DriverInDriverProto/driverParentComp.F90 +++ b/DriverInDriverProto/driverParentComp.F90 @@ -61,6 +61,13 @@ subroutine SetServices(driver, rc) file=__FILE__)) & return ! bail out + ! set driver verbosity + call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + end subroutine !----------------------------------------------------------------------------- @@ -99,7 +106,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompAttributeSet(child, name="Verbosity", value="1", rc=rc) + call NUOPC_CompAttributeSet(child, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -112,7 +119,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompAttributeSet(child, name="Verbosity", value="1", rc=rc) + call NUOPC_CompAttributeSet(child, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -129,7 +136,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompAttributeSet(connector, name="Verbosity", value="1", rc=rc) + call NUOPC_CompAttributeSet(connector, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -143,7 +150,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompAttributeSet(connector, name="Verbosity", value="1", rc=rc) + call NUOPC_CompAttributeSet(connector, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & From c4ab2c60af154d0c3e3bbf16fa5fbfc7a47357f1 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Tue, 11 Aug 2020 13:54:10 -0700 Subject: [PATCH 19/68] Change 'maxPeCountPerPet' to '/NUOPC/Instance/maxPeCountPerPet' as a consequence of the Attribute -> Info work in ESMF. --- AtmOcnMirrorFieldsProto/esm.F90 | 6 ++++-- AtmOcnPetListProto/esm.F90 | 6 ++++-- AtmOcnTransferGridProto/esm.F90 | 12 ++++++++---- HierarchyProto/esm.F90 | 3 ++- SingleModelOpenMPProto/driver.F90 | 3 ++- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/AtmOcnMirrorFieldsProto/esm.F90 b/AtmOcnMirrorFieldsProto/esm.F90 index 3b626dae..19e045d9 100644 --- a/AtmOcnMirrorFieldsProto/esm.F90 +++ b/AtmOcnMirrorFieldsProto/esm.F90 @@ -100,7 +100,8 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call ESMF_InfoSet(info, key="maxPeCountPerPet", value=2, rc=rc) + call ESMF_InfoSet(info, key="/NUOPC/Instance/maxPeCountPerPet", value=2, & + rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -138,7 +139,8 @@ subroutine SetModelServices(driver, rc) deallocate(petList) ! SetServices for OCN with petList on second half of PETs - call ESMF_InfoSet(info, key="maxPeCountPerPet", value=4, rc=rc) + call ESMF_InfoSet(info, key="/NUOPC/Instance/maxPeCountPerPet", value=4, & + rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & diff --git a/AtmOcnPetListProto/esm.F90 b/AtmOcnPetListProto/esm.F90 index 5ddf854d..67a672b6 100644 --- a/AtmOcnPetListProto/esm.F90 +++ b/AtmOcnPetListProto/esm.F90 @@ -112,7 +112,8 @@ subroutine SetModelServices(driver, rc) do i=1, petCount/2 petList(i) = i-1 ! PET labeling goes from 0 to petCount-1 enddo - call ESMF_InfoSet(info, key="maxPeCountPerPet", value=2, rc=rc) + call ESMF_InfoSet(info, key="/NUOPC/Instance/maxPeCountPerPet", value=2, & + rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -200,7 +201,8 @@ subroutine SetModelServices(driver, rc) do i=1, petCount/2 petList(i) = petCount/2 + i-1 ! PET labeling goes from 0 to petCount-1 enddo - call ESMF_InfoSet(info, key="maxPeCountPerPet", value=2, rc=rc) + call ESMF_InfoSet(info, key="/NUOPC/Instance/maxPeCountPerPet", value=2, & + rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & diff --git a/AtmOcnTransferGridProto/esm.F90 b/AtmOcnTransferGridProto/esm.F90 index 18dbeb45..370eade1 100644 --- a/AtmOcnTransferGridProto/esm.F90 +++ b/AtmOcnTransferGridProto/esm.F90 @@ -109,9 +109,11 @@ subroutine SetModelServices(driver, rc) return ! bail out #define MORE_THAN_ONE_PE_PER_PET_WORKING_ATM #ifdef MORE_THAN_ONE_PE_PER_PET_WORKING_ATM - call ESMF_InfoSet(info, key="maxPeCountPerPet", value=2, rc=rc) + call ESMF_InfoSet(info, key="/NUOPC/Instance/maxPeCountPerPet", value=2, & + rc=rc) #else - call ESMF_InfoSet(info, key="maxPeCountPerPet", value=1, rc=rc) + call ESMF_InfoSet(info, key="/NUOPC/Instance/maxPeCountPerPet", value=1, & + rc=rc) #endif if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -149,9 +151,11 @@ subroutine SetModelServices(driver, rc) #define MORE_THAN_ONE_PE_PER_PET_WORKING_OCN #ifdef MORE_THAN_ONE_PE_PER_PET_WORKING_OCN - call ESMF_InfoSet(info, key="maxPeCountPerPet", value=2, rc=rc) + call ESMF_InfoSet(info, key="/NUOPC/Instance/maxPeCountPerPet", value=2, & + rc=rc) #else - call ESMF_InfoSet(info, key="maxPeCountPerPet", value=1, rc=rc) + call ESMF_InfoSet(info, key="/NUOPC/Instance/maxPeCountPerPet", value=1, & + rc=rc) #endif if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & diff --git a/HierarchyProto/esm.F90 b/HierarchyProto/esm.F90 index d288f8f1..b0b1d00f 100644 --- a/HierarchyProto/esm.F90 +++ b/HierarchyProto/esm.F90 @@ -134,7 +134,8 @@ subroutine SetModelServices(driver, rc) do i=1, petCountOCN petList(i) = petCountATM + i-1 ! PET labeling goes from 0 to petCount-1 enddo - call ESMF_InfoSet(info, key="maxPeCountPerPet", value=2, rc=rc) + call ESMF_InfoSet(info, key="/NUOPC/Instance/maxPeCountPerPet", value=2, & + rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & diff --git a/SingleModelOpenMPProto/driver.F90 b/SingleModelOpenMPProto/driver.F90 index 27eac8a5..4e99623d 100644 --- a/SingleModelOpenMPProto/driver.F90 +++ b/SingleModelOpenMPProto/driver.F90 @@ -99,7 +99,8 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call ESMF_InfoSet(info, key="maxPeCountPerPet", value=2, rc=rc) + call ESMF_InfoSet(info, key="/NUOPC/Instance/maxPeCountPerPet", value=2, & + rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & From f30fabc4ee406826a7af9e48f215af42d879f865 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Tue, 18 Aug 2020 09:40:01 -0700 Subject: [PATCH 20/68] Completely rework all of the active NUOPC prototype examples to use IPDvX. --- AsyncIOBlockingProto/asyncIOApp.F90 | 32 +- AsyncIOBlockingProto/asyncIODriver.F90 | 86 ++--- AsyncIOBlockingProto/io.F90 | 298 ++++++++--------- AsyncIOBlockingProto/model.F90 | 129 ++++---- AsyncIONonblockingProto/asyncIOApp.F90 | 28 +- AsyncIONonblockingProto/asyncIODriver.F90 | 90 +++--- AsyncIONonblockingProto/conn.F90 | 94 +++--- AsyncIONonblockingProto/io.F90 | 272 +++++++--------- AsyncIONonblockingProto/model.F90 | 137 ++++---- AtmOcnConOptsProto/atm.F90 | 130 ++++---- AtmOcnConOptsProto/esm.F90 | 90 +++--- AtmOcnConOptsProto/esmApp.F90 | 26 +- AtmOcnConOptsProto/ocn.F90 | 143 +++++---- AtmOcnConProto/atm.F90 | 115 ++++--- AtmOcnConProto/conn.F90 | 95 +++--- AtmOcnConProto/esm.F90 | 61 ++-- AtmOcnConProto/esmApp.F90 | 28 +- AtmOcnConProto/ocn.F90 | 130 ++++---- AtmOcnCplListProto/atm.F90 | 121 +++---- AtmOcnCplListProto/esm.F90 | 81 ++--- AtmOcnCplListProto/esmApp.F90 | 28 +- AtmOcnCplListProto/ocn.F90 | 132 ++++---- AtmOcnCplSetProto/atm.F90 | 115 ++++--- AtmOcnCplSetProto/esm.F90 | 62 ++-- AtmOcnCplSetProto/esmApp.F90 | 28 +- AtmOcnCplSetProto/ocn.F90 | 128 ++++---- AtmOcnFDSynoProto/atm.F90 | 117 ++++--- AtmOcnFDSynoProto/esm.F90 | 76 +++-- AtmOcnFDSynoProto/esmApp.F90 | 38 +-- AtmOcnFDSynoProto/ocn.F90 | 130 ++++---- AtmOcnIceSimpleImplicitProto/atm.F90 | 190 +++++------ AtmOcnIceSimpleImplicitProto/esm.F90 | 80 +++-- AtmOcnIceSimpleImplicitProto/esmApp.F90 | 28 +- AtmOcnIceSimpleImplicitProto/ice.F90 | 205 ++++++------ AtmOcnIceSimpleImplicitProto/ocn.F90 | 210 ++++++------ AtmOcnImplicitProto/atm.F90 | 207 ++++++------ AtmOcnImplicitProto/esm.F90 | 69 ++-- AtmOcnImplicitProto/esmApp.F90 | 28 +- AtmOcnImplicitProto/ocn.F90 | 141 +++++---- AtmOcnLndProto/atm.F90 | 117 ++++--- AtmOcnLndProto/esm.F90 | 95 +++--- AtmOcnLndProto/esmApp.F90 | 28 +- AtmOcnLndProto/lnd.F90 | 112 ++++--- AtmOcnLndProto/ocn.F90 | 130 ++++---- AtmOcnLogNoneProto/atm.F90 | 125 ++++---- AtmOcnLogNoneProto/esm.F90 | 76 +++-- AtmOcnLogNoneProto/esmApp.F90 | 26 +- AtmOcnLogNoneProto/ocn.F90 | 136 ++++---- AtmOcnMedIngestFromConfigProto/atm.F90 | 115 ++++--- AtmOcnMedIngestFromConfigProto/esm.F90 | 88 +++--- AtmOcnMedIngestFromConfigProto/esmApp.F90 | 28 +- AtmOcnMedIngestFromConfigProto/med.F90 | 165 +++++----- AtmOcnMedIngestFromConfigProto/ocn.F90 | 149 +++++---- AtmOcnMedIngestFromInternalProto/atm.F90 | 115 ++++--- AtmOcnMedIngestFromInternalProto/esm.F90 | 79 ++--- AtmOcnMedIngestFromInternalProto/esmApp.F90 | 28 +- AtmOcnMedIngestFromInternalProto/med.F90 | 163 +++++----- AtmOcnMedIngestFromInternalProto/ocn.F90 | 149 +++++---- AtmOcnMedPetListProto/atm.F90 | 117 ++++--- AtmOcnMedPetListProto/esm.F90 | 73 +++-- AtmOcnMedPetListProto/esmApp.F90 | 28 +- AtmOcnMedPetListProto/med.F90 | 127 ++++---- AtmOcnMedPetListProto/ocn.F90 | 131 ++++---- AtmOcnMedPetListTimescalesProto/atm.F90 | 134 ++++---- AtmOcnMedPetListTimescalesProto/esm.F90 | 67 ++-- AtmOcnMedPetListTimescalesProto/esmApp.F90 | 28 +- AtmOcnMedPetListTimescalesProto/med.F90 | 217 +++++++------ AtmOcnMedPetListTimescalesProto/ocn.F90 | 134 ++++---- .../atm.F90 | 130 ++++---- .../esm.F90 | 67 ++-- .../esmApp.F90 | 28 +- .../med.F90 | 291 +++++++++-------- .../ocn.F90 | 130 ++++---- AtmOcnMedProto/atm.F90 | 117 ++++--- AtmOcnMedProto/esm.F90 | 69 ++-- AtmOcnMedProto/esmApp.F90 | 28 +- AtmOcnMedProto/med.F90 | 127 ++++---- AtmOcnMedProto/ocn.F90 | 131 ++++---- AtmOcnMedTransferGridMakeMeshProto/README | 3 +- AtmOcnMirrorFieldsProto/atm.F90 | 153 +++++---- AtmOcnMirrorFieldsProto/esm.F90 | 51 ++- AtmOcnMirrorFieldsProto/esmApp.F90 | 32 +- AtmOcnMirrorFieldsProto/ocn.F90 | 132 ++++---- AtmOcnPetListProto/atm.F90 | 119 ++++--- AtmOcnPetListProto/esm.F90 | 65 ++-- AtmOcnPetListProto/esmApp.F90 | 32 +- AtmOcnPetListProto/ocn.F90 | 132 ++++---- AtmOcnProto/atm.F90 | 119 ++++--- AtmOcnProto/esm.F90 | 63 ++-- AtmOcnProto/esmApp.F90 | 27 +- AtmOcnProto/ocn.F90 | 128 ++++---- AtmOcnRtmTwoTimescalesProto/atm.F90 | 128 ++++---- AtmOcnRtmTwoTimescalesProto/esm.F90 | 69 ++-- AtmOcnRtmTwoTimescalesProto/esmApp.F90 | 35 +- AtmOcnRtmTwoTimescalesProto/ocn.F90 | 151 +++++---- AtmOcnRtmTwoTimescalesProto/rtm.F90 | 127 ++++---- AtmOcnScalarProto/atm.F90 | 121 +++---- AtmOcnScalarProto/esm.F90 | 78 +++-- AtmOcnScalarProto/esmApp.F90 | 28 +- AtmOcnScalarProto/ocn.F90 | 130 ++++---- AtmOcnSelectExternalProto/ATM-A/atmA.F90 | 119 ++++--- AtmOcnSelectExternalProto/ATM-B/atmB.F90 | 121 +++---- AtmOcnSelectExternalProto/ATM-B/procedure.F90 | 8 +- AtmOcnSelectExternalProto/ATM-C/atmC.F90 | 121 +++---- AtmOcnSelectExternalProto/ATM-C/procedure.F90 | 8 +- AtmOcnSelectExternalProto/ATM-D/atmD.F90 | 119 ++++--- AtmOcnSelectExternalProto/ATM-E/atmE.F90 | 119 ++++--- .../OcnCommon/ocnCommon.F90 | 22 +- .../OcnCommon/subModule1.F90 | 18 +- .../OcnCommon/subModule2.F90 | 18 +- AtmOcnSelectExternalProto/OcnModelA/ocn.F90 | 138 ++++---- AtmOcnSelectExternalProto/OcnModelB/ocn.F90 | 138 ++++---- AtmOcnSelectExternalProto/OcnModelC/ocn.F90 | 138 ++++---- AtmOcnSelectExternalProto/esm.F90 | 64 ++-- AtmOcnSelectExternalProto/esmApp.F90 | 31 +- AtmOcnSelectProto/atmA.F90 | 119 ++++--- AtmOcnSelectProto/atmB.F90 | 121 +++---- AtmOcnSelectProto/esm.F90 | 66 ++-- AtmOcnSelectProto/esmApp.F90 | 31 +- AtmOcnSelectProto/ocnA.F90 | 134 ++++---- AtmOcnSelectProto/ocnB.F90 | 134 ++++---- AtmOcnSimpleImplicitProto/atm.F90 | 196 +++++------- AtmOcnSimpleImplicitProto/esm.F90 | 69 ++-- AtmOcnSimpleImplicitProto/esmApp.F90 | 28 +- AtmOcnSimpleImplicitProto/ocn.F90 | 202 ++++++------ AtmOcnTransferGridProto/README | 3 +- AtmOcnTransferGridProto/atm.F90 | 286 +++++++++-------- AtmOcnTransferGridProto/esm.F90 | 83 +++-- AtmOcnTransferGridProto/esmApp.F90 | 32 +- AtmOcnTransferGridProto/ocn.F90 | 168 +++++----- AtmOcnTransferLocStreamProto/README | 3 +- AtmOcnTransferLocStreamProto/atm.F90 | 229 +++++++------- AtmOcnTransferLocStreamProto/esm.F90 | 81 ++--- AtmOcnTransferLocStreamProto/esmApp.F90 | 28 +- AtmOcnTransferLocStreamProto/ocn.F90 | 135 ++++---- AtmOcnTransferMeshProto/README | 3 +- AtmOcnTransferMeshProto/atm.F90 | 299 +++++++----------- AtmOcnTransferMeshProto/esm.F90 | 76 +++-- AtmOcnTransferMeshProto/esmApp.F90 | 28 +- AtmOcnTransferMeshProto/ocn.F90 | 154 ++++----- ComponentExplorer/nuopcExplorerApp.F90 | 70 ++-- ComponentExplorer/nuopcExplorerDriver.F90 | 75 +++-- ComponentExplorer/nuopcExplorerScript | 10 +- CustomFieldDictionaryProto/driver.F90 | 54 ++-- CustomFieldDictionaryProto/mainApp.F90 | 30 +- CustomFieldDictionaryProto/model.F90 | 119 ++++--- CustomFieldDictionaryProto/util.F90 | 16 +- .../Makefile | 0 .../README | 10 +- .../atm.F90 | 152 ++++----- .../driverChildComp.F90 | 42 +-- .../driverParentComp.F90 | 50 +-- .../mainApp.F90 | 40 +-- .../ocn.F90 | 171 +++++----- DriverInDriverProto/atm.F90 | 115 ++++--- DriverInDriverProto/driverChildComp.F90 | 48 +-- DriverInDriverProto/driverParentComp.F90 | 47 +-- DriverInDriverProto/mainApp.F90 | 40 +-- DriverInDriverProto/ocn.F90 | 131 ++++---- DynPhyProto/atm.F90 | 48 +-- DynPhyProto/dyn.F90 | 208 ++++-------- DynPhyProto/esmApp.F90 | 30 +- DynPhyProto/phy.F90 | 204 ++++-------- ExternalDriverAPIProto/atm.F90 | 179 ++++------- ExternalDriverAPIProto/esm.F90 | 55 ++-- ExternalDriverAPIProto/externalApp.F90 | 42 +-- ExternalDriverAPIProto/ocn.F90 | 156 ++++----- GenericMediatorProto/app.F90 | 28 +- GenericMediatorProto/driver.F90 | 82 ++--- GenericMediatorProto/mediator.F90 | 272 +++++++--------- GenericMediatorProto/modelA.F90 | 130 ++++---- GenericMediatorProto/modelB.F90 | 126 ++++---- HierarchyProto/atm.F90 | 60 ++-- HierarchyProto/dyn.F90 | 178 +++++------ HierarchyProto/esm.F90 | 52 +-- HierarchyProto/esmApp.F90 | 28 +- HierarchyProto/ocn.F90 | 134 ++++---- HierarchyProto/phy.F90 | 139 ++++---- NamespaceProto/atm.F90 | 117 ++++--- NamespaceProto/driver.F90 | 66 ++-- NamespaceProto/mainApp.F90 | 28 +- NamespaceProto/med.F90 | 154 ++++----- NestingMultipleProto/advectDiffComp.F90 | 294 ++++++++--------- NestingMultipleProto/driverComp.F90 | 56 ++-- NestingMultipleProto/mainApp.F90 | 26 +- NestingSingleProto/advectDiffComp.F90 | 286 +++++++++-------- NestingSingleProto/driverComp.F90 | 56 ++-- NestingSingleProto/mainApp.F90 | 26 +- .../advectDiffComp.F90 | 196 ++++++------ NestingTelescopeMultipleProto/driverComp.F90 | 63 ++-- NestingTelescopeMultipleProto/mainApp.F90 | 26 +- SingleModelOpenMPProto/driver.F90 | 57 ++-- SingleModelOpenMPProto/mainApp.F90 | 32 +- SingleModelOpenMPProto/model.F90 | 153 ++++----- SingleModelProto/driver.F90 | 49 +-- SingleModelProto/mainApp.F90 | 28 +- SingleModelProto/model.F90 | 119 ++++--- testProtos.sh | 2 +- 198 files changed, 9897 insertions(+), 9417 deletions(-) rename {DriverInDriverProtoIPDv02 => DriverInDriverDataDepProto}/Makefile (100%) rename {DriverInDriverProtoIPDv02 => DriverInDriverDataDepProto}/README (87%) rename {DriverInDriverProtoIPDv02 => DriverInDriverDataDepProto}/atm.F90 (82%) rename {DriverInDriverProtoIPDv02 => DriverInDriverDataDepProto}/driverChildComp.F90 (86%) rename {DriverInDriverProtoIPDv02 => DriverInDriverDataDepProto}/driverParentComp.F90 (93%) rename {DriverInDriverProtoIPDv02 => DriverInDriverDataDepProto}/mainApp.F90 (88%) rename {DriverInDriverProtoIPDv02 => DriverInDriverDataDepProto}/ocn.F90 (82%) diff --git a/AsyncIOBlockingProto/asyncIOApp.F90 b/AsyncIOBlockingProto/asyncIOApp.F90 index c0ccf08a..a3ca829d 100644 --- a/AsyncIOBlockingProto/asyncIOApp.F90 +++ b/AsyncIOBlockingProto/asyncIOApp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -22,14 +22,14 @@ program asyncIOApp integer :: rc, urc type(ESMF_GridComp) :: driver - + ! Initialize ESMF call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("asyncIOApp STARTING", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -53,7 +53,7 @@ program asyncIOApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Initialize for the earth system Component call ESMF_GridCompInitialize(driver, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -64,13 +64,7 @@ program asyncIOApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - - call NUOPC_CompAttributeSet(driver, name="Verbosity", value="1", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Run for earth the system Component call ESMF_GridCompRun(driver, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -81,7 +75,7 @@ program asyncIOApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Finalize for the earth system Component call ESMF_GridCompFinalize(driver, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -92,14 +86,14 @@ program asyncIOApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Destroy the earth system Component call ESMF_GridCompDestroy(driver, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("asyncIOApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -108,5 +102,5 @@ program asyncIOApp ! Finalize ESMF call ESMF_Finalize() - -end program + +end program diff --git a/AsyncIOBlockingProto/asyncIODriver.F90 b/AsyncIOBlockingProto/asyncIODriver.F90 index 0ccb6eaf..2ae7d5b4 100644 --- a/AsyncIOBlockingProto/asyncIODriver.F90 +++ b/AsyncIOBlockingProto/asyncIODriver.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,21 +17,19 @@ module asyncIODriver use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices, & - driver_label_ModifyCplLists => label_ModifyCplLists + driverSS => SetServices use ModelComp, only: modelSS => SetServices use IOComp, only: ioSS => SetServices - + use NUOPC_Connector, only: cplSS => SetServices - + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -39,30 +37,37 @@ module asyncIODriver subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(driver, specLabel=driver_label_ModifyCplLists, & + call NUOPC_CompSpecialize(driver, specLabel=label_ModifyCplLists, & specRoutine=ModifyCplLists, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + + ! set driver verbosity + call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + end subroutine !----------------------------------------------------------------------------- @@ -70,7 +75,7 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables character(len=80) :: name type(ESMF_Grid) :: grid @@ -87,14 +92,14 @@ subroutine SetModelServices(driver, rc) type(ESMF_Config) :: config rc = ESMF_SUCCESS - + ! get the petCount and name call ESMF_GridCompGet(driver, petCount=petCount, name=name, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! create and open the config config = ESMF_ConfigCreate(rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -116,7 +121,7 @@ subroutine SetModelServices(driver, rc) petListBounds(1) = 0 petListBounds(2) = petCount - 1 endif - + ! add the ModelComp allocate(petList(petListBounds(2)-petListBounds(1)+1)) do i=petListBounds(1), petListBounds(2) @@ -134,7 +139,7 @@ subroutine SetModelServices(driver, rc) file=__FILE__)) & return ! bail out deallocate(petList) - + ! determine the IOComp petList bounds call ESMF_ConfigGetAttribute(config, petListBounds, & label="io_petlist_bounds:", default=-1, rc=rc) @@ -144,7 +149,7 @@ subroutine SetModelServices(driver, rc) petListBounds(1) = 0 petListBounds(2) = petCount - 1 endif - + ! add the IOComp allocate(petList(petListBounds(2)-petListBounds(1)+1)) do i=petListBounds(1), petListBounds(2) @@ -162,7 +167,7 @@ subroutine SetModelServices(driver, rc) file=__FILE__)) & return ! bail out deallocate(petList) - + ! Add Connector for model2io call NUOPC_DriverAddComp(driver, srcCompLabel="Model", dstCompLabel="IO", & compSetServicesRoutine=cplSS, comp=connector, rc=rc) @@ -170,12 +175,13 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompAttributeSet(connector, name="Verbosity", value="high", rc=rc) + call NUOPC_CompAttributeSet(connector, name="Verbosity", value="high", & + rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! set the model clock call ESMF_TimeIntervalSet(timeStep, m=15, rc=rc) ! 15 minute steps if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -203,13 +209,13 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- @@ -217,29 +223,29 @@ subroutine SetModelServices(driver, rc) subroutine ModifyCplLists(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables - character(len=160) :: msg + character(len=160) :: msg type(ESMF_CplComp), pointer :: connectorList(:) integer :: i, j, cplListSize character(len=160), allocatable :: cplList(:) character(len=160) :: tempString - + rc = ESMF_SUCCESS - + call ESMF_LogWrite("Driver is in ModifyCplLists()", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + nullify(connectorList) call NUOPC_DriverGetComp(driver, compList=connectorList, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + write (msg,*) "Found ", size(connectorList), " Connectors."// & " Modifying CplList Attribute...." call ESMF_LogWrite(trim(msg), ESMF_LOGMSG_INFO, rc=rc) @@ -247,7 +253,7 @@ subroutine ModifyCplLists(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + do i=1, size(connectorList) ! query the cplList for connector i call NUOPC_CompAttributeGet(connectorList(i), name="CplList", & @@ -279,9 +285,9 @@ subroutine ModifyCplLists(driver, rc) deallocate(cplList) endif enddo - + deallocate(connectorList) - + end subroutine !----------------------------------------------------------------------------- diff --git a/AsyncIOBlockingProto/io.F90 b/AsyncIOBlockingProto/io.F90 index 4a1bc3a4..3ff5ad7a 100644 --- a/AsyncIOBlockingProto/io.F90 +++ b/AsyncIOBlockingProto/io.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -16,126 +16,89 @@ module IOComp use ESMF use NUOPC - use NUOPC_Model, only: & - model_routine_SS => SetServices, & - model_label_DataInitialize => label_DataInitialize, & - model_label_Advance => label_Advance - + use NUOPC_Model, & + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - - subroutine SetServices(gcomp, rc) - type(ESMF_GridComp) :: gcomp + + subroutine SetServices(model, rc) + type(ESMF_GridComp) :: model integer, intent(out) :: rc - - rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(gcomp, model_routine_SS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! --- Initialization phases -------------------------------------- - ! Provide InitializeP0 to switch from default IPDv00 to IPDv03 - call ESMF_GridCompSetEntryPoint(gcomp, ESMF_METHOD_INITIALIZE, & - userRoutine=InitializeP0, phase=0, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out + rc = ESMF_SUCCESS - ! IPDv03p1: advertise Fields - call NUOPC_CompSetEntryPoint(gcomp, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv03p1"/), userRoutine=InitializeP1, rc=rc) + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - ! IPDv03p3: realize connected Fields with transfer action "provide" - call NUOPC_CompSetEntryPoint(gcomp, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv03p3"/), userRoutine=InitializeP3, rc=rc) + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! IPDv03p4: optionally modify the decomp/distr of transferred Grid/Mesh - call NUOPC_CompSetEntryPoint(gcomp, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv03p4"/), userRoutine=InitializeP4, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=RealizeProvided, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! IPDv03p5: realize all Fields with transfer action "accept" - call NUOPC_CompSetEntryPoint(gcomp, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv03p5"/), userRoutine=InitializeP5, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_AcceptTransfer, & + specRoutine=AcceptTransfer, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(gcomp, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeAccepted, & + specRoutine=RealizeAccepted, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(gcomp, specLabel=model_label_DataInitialize, & - specRoutine=DataInitialize, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP0(gcomp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: gcomp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - + subroutine Advertise(model, rc) + type(ESMF_GridComp) :: model + integer, intent(out) :: rc + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - ! Switch to IPDv03 by filtering all other phaseMap entries - call NUOPC_CompFilterPhaseMap(gcomp, ESMF_METHOD_INITIALIZE, & - acceptStringList=(/"IPDv03p"/), rc=rc) + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine InitializeP1(gcomp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: gcomp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - rc = ESMF_SUCCESS ! importable field: air_pressure_at_sea_level call NUOPC_Advertise(importState, & StandardName="air_pressure_at_sea_level", name="pmsl", & -#define WITH_GRID_TRANSFERoff +#define WITH_GRID_TRANSFER #ifdef WITH_GRID_TRANSFER TransferOfferGeomObject="cannot provide", rc=rc) #else @@ -145,21 +108,28 @@ subroutine InitializeP1(gcomp, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP3(gcomp, importState, exportState, clock, rc) - ! IPDv03p3: realize connected Fields with transfer action "provide" - ! and remove Fields that are not connected - type(ESMF_GridComp) :: gcomp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock + subroutine RealizeProvided(model, rc) + type(ESMF_GridComp) :: model integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call checkConnectedFlagProvide(importState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -173,10 +143,10 @@ subroutine InitializeP3(gcomp, importState, exportState, clock, rc) return ! bail out contains ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + subroutine checkConnectedFlagProvide(state, rc) ! Look at all of the fields in state, including in nested states. Error - ! out if a connected field is found for which geom object must be + ! out if a connected field is found for which geom object must be ! provided here. Remove all not connected fields. type(ESMF_State) :: state integer, optional :: rc @@ -193,9 +163,9 @@ subroutine checkConnectedFlagProvide(state, rc) type(ESMF_Grid) :: gridIn type(ESMF_StateIntent_Flag) :: stateIntent character(len=80) :: transferActionAttr - + if (present(rc)) rc = ESMF_SUCCESS - + call ESMF_StateGet(state, stateIntent=stateIntent, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -214,16 +184,16 @@ subroutine checkConnectedFlagProvide(state, rc) rcToReturn=rc) return ! bail out endif - + call ESMF_StateGet(state, name=stateName, nestedFlag=.true., & itemCount=itemCount, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + allocate(itemNameList(itemCount), itemTypeList(itemCount)) - + call ESMF_StateGet(state, nestedFlag=.true., & itemNameList=itemNameList, itemTypeList=itemTypeList, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -261,8 +231,8 @@ subroutine checkConnectedFlagProvide(state, rc) file=__FILE__)) & return ! bail out if (trim(transferAction)=="provide") then - ! the Connector instructed the gcomp to provide geom object - + ! the Connector instructed the model to provide geom object + ! create and open the config config = ESMF_ConfigCreate(rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -285,7 +255,7 @@ subroutine checkConnectedFlagProvide(state, rc) gridDims(1) = 10 gridDims(2) = 20 endif - + ! create a Grid object for Fields gridIn = ESMF_GridCreate1PeriDimUfrm(maxIndex=gridDims, & minCornerCoord=(/0._ESMF_KIND_R8, -60._ESMF_KIND_R8/), & @@ -308,29 +278,37 @@ subroutine checkConnectedFlagProvide(state, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + endif endif endif enddo - + deallocate(itemNameList, itemTypeList) - + end subroutine end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP4(gcomp, importState, exportState, clock, rc) - ! IPDv03p4: optionally modify the decomp/distr of transferred Grid/Mesh - type(ESMF_GridComp) :: gcomp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock + subroutine AcceptTransfer(model, rc) + type(ESMF_GridComp) :: model integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call adjustAcceptedGeom(importState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -344,7 +322,7 @@ subroutine InitializeP4(gcomp, importState, exportState, clock, rc) return ! bail out contains ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + subroutine adjustAcceptedGeom(state, rc) ! Look at all of the fields in state, including in nested states. Adjust ! the distribution of the accepted geom object to a 1 DE/PET distribution. @@ -365,9 +343,9 @@ subroutine adjustAcceptedGeom(state, rc) integer, allocatable :: minIndexPTile(:,:), maxIndexPTile(:,:) type(ESMF_StateIntent_Flag) :: stateIntent character(len=80) :: transferActionAttr - + if (present(rc)) rc = ESMF_SUCCESS - + call ESMF_StateGet(state, nestedFlag=.true., itemCount=itemCount, & stateIntent=stateIntent, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -387,9 +365,9 @@ subroutine adjustAcceptedGeom(state, rc) rcToReturn=rc) return ! bail out endif - + allocate(itemNameList(itemCount), itemTypeList(itemCount)) - + call ESMF_StateGet(state, nestedFlag=.true., & itemNameList=itemNameList, itemTypeList=itemTypeList, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -413,7 +391,7 @@ subroutine adjustAcceptedGeom(state, rc) file=__FILE__)) & return ! bail out if (trim(transferAction)=="accept") then - ! the Connector instructed the gcomp to accept geom object + ! the Connector instructed the model to accept geom object ! -> find out which type geom object the field holds call ESMF_FieldGet(field, geomtype=geomtype, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -433,7 +411,7 @@ subroutine adjustAcceptedGeom(state, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - ! Create a custom DistGrid, based on the minIndex, maxIndex of the + ! Create a custom DistGrid, based on the minIndex, maxIndex of the ! accepted DistGrid, but with a default regDecomp for the current VM ! that leads to 1DE/PET. ! get dimCount and tileCount @@ -443,7 +421,8 @@ subroutine adjustAcceptedGeom(state, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - ! allocate minIndexPTile and maxIndexPTile accord. to dimCount and tileCount + ! allocate minIndexPTile and maxIndexPTile accord. to dimCount + ! and tileCount allocate(minIndexPTile(dimCount, tileCount), & maxIndexPTile(dimCount, tileCount)) ! get minIndex and maxIndex arrays @@ -453,8 +432,8 @@ subroutine adjustAcceptedGeom(state, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - ! create the new DistGrid with the same minIndexPTile and maxIndexPTile, - ! but with a default regDecompPTile + ! create the new DistGrid with the same minIndexPTile and + ! maxIndexPTile, but with a default regDecompPTile distgrid = ESMF_DistGridCreate(minIndexPTile=minIndexPTile, & maxIndexPTile=maxIndexPTile, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -467,7 +446,7 @@ subroutine adjustAcceptedGeom(state, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call ESMF_FieldEmptySet(field, grid=grid, rc=rc) + call ESMF_FieldEmptySet(field, grid=grid, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -487,9 +466,9 @@ subroutine adjustAcceptedGeom(state, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - ! Create a custom DistGrid, based on the minIndex, maxIndex of the - ! accepted DistGrid, but with a default regDecomp for the current VM - ! that leads to 1DE/PET. + ! Create a custom DistGrid, based on the minIndex, maxIndex of the + ! accepted DistGrid, but with a default regDecomp for the current + ! VM ! that leads to 1DE/PET. ! get dimCount and tileCount call ESMF_DistGridGet(distgrid, dimCount=dimCount, & tileCount=tileCount, rc=rc) @@ -497,7 +476,8 @@ subroutine adjustAcceptedGeom(state, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - ! allocate minIndexPTile and maxIndexPTile accord. to dimCount and tileCount + ! allocate minIndexPTile and maxIndexPTile according + ! to dimCount and tileCount allocate(minIndexPTile(dimCount, tileCount), & maxIndexPTile(dimCount, tileCount)) ! get minIndex and maxIndex arrays @@ -507,8 +487,8 @@ subroutine adjustAcceptedGeom(state, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - ! create the new DistGrid with the same minIndexPTile and maxIndexPTile, - ! but with a default regDecompPTile + ! create the new DistGrid with the same minIndexPTile and + ! maxIndexPTile, but with a default regDecompPTile distgrid = ESMF_DistGridCreate(minIndexPTile=minIndexPTile, & maxIndexPTile=maxIndexPTile, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -521,7 +501,7 @@ subroutine adjustAcceptedGeom(state, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call ESMF_FieldEmptySet(field, mesh=mesh, rc=rc) + call ESMF_FieldEmptySet(field, mesh=mesh, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -540,24 +520,32 @@ subroutine adjustAcceptedGeom(state, rc) endif endif enddo - + deallocate(itemNameList, itemTypeList) - + end subroutine - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP5(gcomp, importState, exportState, clock, rc) - ! IPDv03p5: realize all Fields with transfer action "accept" - type(ESMF_GridComp) :: gcomp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock + subroutine RealizeAccepted(model, rc) + type(ESMF_GridComp) :: model integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call realizeWithAcceptedGeom(importState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -569,9 +557,9 @@ subroutine InitializeP5(gcomp, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + contains ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + subroutine realizeWithAcceptedGeom(state, rc) ! Look at all of the fields in state, including in nested states. Realize ! with the accepted and adjusted geom object. @@ -581,9 +569,9 @@ subroutine realizeWithAcceptedGeom(state, rc) integer :: itemCount, item character(len=80), allocatable :: itemNameList(:) type(ESMF_StateItem_Flag), allocatable :: itemTypeList(:) - + if (present(rc)) rc = ESMF_SUCCESS - + ! query info about the items in the state call ESMF_StateGet(state, nestedFlag=.true., itemCount=itemCount, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -609,37 +597,19 @@ subroutine realizeWithAcceptedGeom(state, rc) return ! bail out endif enddo - - deallocate(itemNameList, itemTypeList) - - end subroutine - end subroutine - - !----------------------------------------------------------------------------- + deallocate(itemNameList, itemTypeList) - subroutine DataInitialize(gcomp, rc) - type(ESMF_GridComp) :: gcomp - integer, intent(out) :: rc - - rc = ESMF_SUCCESS + end subroutine - ! indicate that data initialization is complete (breaking out of init-loop) - call NUOPC_CompAttributeSet(gcomp, & - name="InitializeDataComplete", value="true", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(gcomp, rc) - type(ESMF_GridComp) :: gcomp + subroutine Advance(model, rc) + type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -654,9 +624,9 @@ subroutine ModelAdvance(gcomp, rc) character(len=5) :: sChar rc = ESMF_SUCCESS - + ! query the Component for its clock, importState - call ESMF_GridCompGet(gcomp, clock=clock, importState=importState, & + call ESMF_GridCompGet(model, clock=clock, importState=importState, & rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -675,7 +645,7 @@ subroutine ModelAdvance(gcomp, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & diff --git a/AsyncIOBlockingProto/model.F90 b/AsyncIOBlockingProto/model.F90 index 11c95249..82841367 100644 --- a/AsyncIOBlockingProto/model.F90 +++ b/AsyncIOBlockingProto/model.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -16,67 +16,73 @@ module ModelComp use ESMF use NUOPC - use NUOPC_Model, only: & - model_routine_SS => SetServices, & - model_label_Advance => label_Advance - + use NUOPC_Model, & + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - - subroutine SetServices(gcomp, rc) - type(ESMF_GridComp) :: gcomp + + subroutine SetServices(model, rc) + type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(gcomp, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(gcomp, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(gcomp, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(gcomp, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(gcomp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: gcomp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock + subroutine Advertise(model, rc) + type(ESMF_GridComp) :: model integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! exportable field: air_pressure_at_sea_level call NUOPC_Advertise(exportState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -84,18 +90,17 @@ subroutine InitializeP1(gcomp, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(gcomp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: gcomp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock + subroutine Realize(model, rc) + type(ESMF_GridComp) :: model integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridOut real(ESMF_KIND_R8), pointer :: dataPtr(:,:), lonPtr(:), latPtr(:) @@ -104,7 +109,15 @@ subroutine InitializeP2(gcomp, importState, exportState, clock, rc) integer :: gridDims(2) rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create and open the config config = ESMF_ConfigCreate(rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -127,7 +140,7 @@ subroutine InitializeP2(gcomp, importState, exportState, clock, rc) gridDims(1) = 10 gridDims(2) = 20 endif - + ! create a Grid object for Fields gridOut = ESMF_GridCreate1PeriDimUfrm(maxIndex=gridDims, & minCornerCoord=(/0._ESMF_KIND_R8, -60._ESMF_KIND_R8/), & @@ -174,13 +187,13 @@ subroutine InitializeP2(gcomp, importState, exportState, clock, rc) enddo end subroutine - + !----------------------------------------------------------------------------- - subroutine ModelAdvance(gcomp, rc) - type(ESMF_GridComp) :: gcomp + subroutine Advance(model, rc) + type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: exportState @@ -188,15 +201,15 @@ subroutine ModelAdvance(gcomp, rc) type(ESMF_Grid) :: grid type(ESMF_StateItem_Flag) :: itemType real(ESMF_KIND_R8), pointer :: dataPtr(:,:), lonPtr(:), latPtr(:) - integer :: i,j, k + integer :: i,j,k character(len=160) :: msgString integer, save :: slice=1 integer, parameter :: kWaste=40 rc = ESMF_SUCCESS - - ! query the Component for its clock, exportState - call ESMF_GridCompGet(gcomp, clock=clock, & + + ! query for clock, importState and exportState + call ESMF_GridCompGet(model, clock=clock, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -215,7 +228,7 @@ subroutine ModelAdvance(gcomp, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -270,12 +283,14 @@ subroutine ModelAdvance(gcomp, rc) enddo enddo enddo - + endif - + ! advance the time slice counter slice = slice + 1 end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AsyncIONonblockingProto/asyncIOApp.F90 b/AsyncIONonblockingProto/asyncIOApp.F90 index c0ccf08a..42f324c6 100644 --- a/AsyncIONonblockingProto/asyncIOApp.F90 +++ b/AsyncIONonblockingProto/asyncIOApp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -22,14 +22,14 @@ program asyncIOApp integer :: rc, urc type(ESMF_GridComp) :: driver - + ! Initialize ESMF call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("asyncIOApp STARTING", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -53,7 +53,7 @@ program asyncIOApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Initialize for the earth system Component call ESMF_GridCompInitialize(driver, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -64,13 +64,13 @@ program asyncIOApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call NUOPC_CompAttributeSet(driver, name="Verbosity", value="1", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Run for earth the system Component call ESMF_GridCompRun(driver, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -81,7 +81,7 @@ program asyncIOApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Finalize for the earth system Component call ESMF_GridCompFinalize(driver, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -92,14 +92,14 @@ program asyncIOApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Destroy the earth system Component call ESMF_GridCompDestroy(driver, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("asyncIOApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -108,5 +108,5 @@ program asyncIOApp ! Finalize ESMF call ESMF_Finalize() - -end program + +end program diff --git a/AsyncIONonblockingProto/asyncIODriver.F90 b/AsyncIONonblockingProto/asyncIODriver.F90 index aaafbcdf..9fd5ad85 100644 --- a/AsyncIONonblockingProto/asyncIODriver.F90 +++ b/AsyncIONonblockingProto/asyncIODriver.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,21 +17,19 @@ module asyncIODriver use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices, & - driver_label_ModifyCplLists => label_ModifyCplLists + driverSS => SetServices use ModelComp, only: modelSS => SetServices use IOComp, only: ioSS => SetServices - + use CON, only: cplSS => SetServices - + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -39,30 +37,37 @@ module asyncIODriver subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(driver, specLabel=driver_label_ModifyCplLists, & + call NUOPC_CompSpecialize(driver, specLabel=label_ModifyCplLists, & specRoutine=ModifyCplLists, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + + ! set driver verbosity + call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + end subroutine !----------------------------------------------------------------------------- @@ -70,7 +75,7 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables character(len=80) :: name type(ESMF_Grid) :: grid @@ -87,14 +92,14 @@ subroutine SetModelServices(driver, rc) type(ESMF_Config) :: config rc = ESMF_SUCCESS - + ! get the petCount and name call ESMF_GridCompGet(driver, petCount=petCount, name=name, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! create and open the config config = ESMF_ConfigCreate(rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -116,7 +121,7 @@ subroutine SetModelServices(driver, rc) petListBounds(1) = 0 petListBounds(2) = petCount - 1 endif - + ! add the ModelComp allocate(petList(petListBounds(2)-petListBounds(1)+1)) do i=petListBounds(1), petListBounds(2) @@ -128,13 +133,13 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompAttributeSet(child, name="Verbosity", value="1", rc=rc) + call NUOPC_CompAttributeSet(child, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out deallocate(petList) - + ! determine the IOComp petList bounds call ESMF_ConfigGetAttribute(config, petListBounds, & label="io_petlist_bounds:", default=-1, rc=rc) @@ -144,7 +149,7 @@ subroutine SetModelServices(driver, rc) petListBounds(1) = 0 petListBounds(2) = petCount - 1 endif - + ! add the IOComp allocate(petList(petListBounds(2)-petListBounds(1)+1)) do i=petListBounds(1), petListBounds(2) @@ -156,13 +161,13 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompAttributeSet(child, name="Verbosity", value="1", rc=rc) + call NUOPC_CompAttributeSet(child, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out deallocate(petList) - + ! Add Connector for model2io call NUOPC_DriverAddComp(driver, srcCompLabel="Model", dstCompLabel="IO", & compSetServicesRoutine=cplSS, comp=connector, rc=rc) @@ -170,12 +175,13 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompAttributeSet(connector, name="Verbosity", value="1", rc=rc) + call NUOPC_CompAttributeSet(connector, name="Verbosity", value="high", & + rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! set the model clock call ESMF_TimeIntervalSet(timeStep, m=15, rc=rc) ! 15 minute steps if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -203,13 +209,13 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- @@ -217,29 +223,29 @@ subroutine SetModelServices(driver, rc) subroutine ModifyCplLists(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables - character(len=160) :: msg + character(len=160) :: msg type(ESMF_CplComp), pointer :: connectorList(:) integer :: i, j, cplListSize character(len=160), allocatable :: cplList(:) character(len=160) :: tempString - + rc = ESMF_SUCCESS - + call ESMF_LogWrite("Driver is in ModifyCplLists()", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + nullify(connectorList) call NUOPC_DriverGetComp(driver, compList=connectorList, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + write (msg,*) "Found ", size(connectorList), " Connectors."// & " Modifying CplList Attribute...." call ESMF_LogWrite(trim(msg), ESMF_LOGMSG_INFO, rc=rc) @@ -247,7 +253,7 @@ subroutine ModifyCplLists(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + do i=1, size(connectorList) ! query the cplList for connector i call NUOPC_CompAttributeGet(connectorList(i), name="CplList", & @@ -279,9 +285,9 @@ subroutine ModifyCplLists(driver, rc) deallocate(cplList) endif enddo - + deallocate(connectorList) - + end subroutine !----------------------------------------------------------------------------- diff --git a/AsyncIONonblockingProto/conn.F90 b/AsyncIONonblockingProto/conn.F90 index 725703a2..70ef9bab 100644 --- a/AsyncIONonblockingProto/conn.F90 +++ b/AsyncIONonblockingProto/conn.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -13,55 +13,51 @@ module CON !----------------------------------------------------------------------------- ! Connector Component. !----------------------------------------------------------------------------- - + use ESMF use NUOPC - use NUOPC_Connector, only: & - con_routine_SS => SetServices, & - con_label_ExecuteRH => label_ExecuteRouteHandle, & - con_label_ReleaseRH => label_ReleaseRouteHandle, & - con_label_ComputeRH => label_ComputeRouteHandle, & - NUOPC_ConnectorGet, NUOPC_ConnectorSet - + use NUOPC_Connector, & + connSS => SetServices + implicit none - + private - + logical, save :: outstanding=.false. public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(connector, rc) - type(ESMF_CplComp) :: connector + type(ESMF_CplComp) :: connector integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC connector component will register the generic methods - call NUOPC_CompDerive(connector, con_routine_SS, rc=rc) + + ! derive from NUOPC_Connector + call NUOPC_CompDerive(connector, connSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - ! attach specializing method to compute the connection RouteHandle - call NUOPC_CompSpecialize(connector, specLabel=con_label_ComputeRH, & + ! specialize connector + call NUOPC_CompSpecialize(connector, specLabel=label_ComputeRouteHandle, & specRoutine=ComputeRH, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(connector, specLabel=con_label_ExecuteRH, & + call NUOPC_CompSpecialize(connector, specLabel=label_ExecuteRouteHandle, & specRoutine=ExecuteRH, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(connector, specLabel=con_label_ReleaseRH, & + call NUOPC_CompSpecialize(connector, specLabel=label_ReleaseRouteHandle, & specRoutine=ReleaseRH, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -69,13 +65,13 @@ subroutine SetServices(connector, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- subroutine ComputeRH(connector, rc) type(ESMF_CplComp) :: connector integer, intent(out) :: rc - + ! local variables type(ESMF_State) :: state type(ESMF_FieldBundle) :: dstFields, srcFields @@ -86,7 +82,7 @@ subroutine ComputeRH(connector, rc) type(ESMF_Array) :: dstArray, srcArray rc = ESMF_SUCCESS - + call NUOPC_ConnectorGet(connector, srcFields=srcFields, & dstFields=dstFields, state=state, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -140,15 +136,15 @@ subroutine ComputeRH(connector, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- subroutine ExecuteRH(connector, rc) type(ESMF_CplComp) :: connector integer, intent(out) :: rc - + ! local variables type(ESMF_FieldBundle) :: dstFields, srcFields type(ESMF_Field), allocatable :: fields(:) @@ -159,22 +155,22 @@ subroutine ExecuteRH(connector, rc) integer :: localPet, petCount rc = ESMF_SUCCESS - + call NUOPC_ConnectorGet(connector, srcFields=srcFields, & dstFields=dstFields, rh=rh, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_CplCompGet(connector, localPet=localPet, petCount=petCount, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! for now assume that there is a single Field on both the src and dst side - + ! Pull out first Array from FieldBundles and execute RH for ArrayRedist call ESMF_FieldBundleGet(dstFields, fieldCount=fieldCount, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -210,7 +206,7 @@ subroutine ExecuteRH(connector, rc) file=__FILE__)) & return ! bail out deallocate(fields) - + if (outstanding) then call ESMF_ArrayRedist(srcArray, dstArray, routehandle=rh, & routesyncflag=ESMF_ROUTESYNC_NBWAITFINISH, rc=rc) @@ -220,7 +216,7 @@ subroutine ExecuteRH(connector, rc) return ! bail out outstanding = .false. endif - + ! execute the RouteHandle for srcArray->dstArray call ESMF_ArrayRedist(srcArray, dstArray, routehandle=rh, & routesyncflag=ESMF_ROUTESYNC_NBSTART, rc=rc) @@ -228,9 +224,9 @@ subroutine ExecuteRH(connector, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + outstanding = .true. - + if (localPet==petCount-1) then call ESMF_ArrayRedist(srcArray, dstArray, routehandle=rh, & routesyncflag=ESMF_ROUTESYNC_NBWAITFINISH, rc=rc) @@ -242,13 +238,13 @@ subroutine ExecuteRH(connector, rc) endif end subroutine - + !----------------------------------------------------------------------------- subroutine ReleaseRH(connector, rc) type(ESMF_CplComp) :: connector integer, intent(out) :: rc - + ! local variables type(ESMF_FieldBundle) :: dstFields, srcFields type(ESMF_Field), allocatable :: fields(:) @@ -258,19 +254,19 @@ subroutine ReleaseRH(connector, rc) type(ESMF_Array) :: dstArray, srcArray rc = ESMF_SUCCESS - - ! Use this specialization point to flush the SRC side if there is an + + ! Use this specialization point to flush the SRC side if there is an ! outstanding RH (as it is expected here) - + call NUOPC_ConnectorGet(connector, srcFields=srcFields, & dstFields=dstFields, rh=rh, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! for now assume that there is a single Field on both the src and dst side - + ! Pull out first Array from FieldBundles and execute RH for ArrayRedist call ESMF_FieldBundleGet(dstFields, fieldCount=fieldCount, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -306,7 +302,7 @@ subroutine ReleaseRH(connector, rc) file=__FILE__)) & return ! bail out deallocate(fields) - + if (outstanding) then call ESMF_ArrayRedist(srcArray, dstArray, routehandle=rh, & routesyncflag=ESMF_ROUTESYNC_NBWAITFINISH, rc=rc) @@ -318,6 +314,8 @@ subroutine ReleaseRH(connector, rc) endif end subroutine - + + !----------------------------------------------------------------------------- + end module diff --git a/AsyncIONonblockingProto/io.F90 b/AsyncIONonblockingProto/io.F90 index 2b15e8ad..e7943b8a 100644 --- a/AsyncIONonblockingProto/io.F90 +++ b/AsyncIONonblockingProto/io.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -16,121 +16,84 @@ module IOComp use ESMF use NUOPC - use NUOPC_Model, only: & - model_routine_SS => SetServices, & - model_label_DataInitialize => label_DataInitialize, & - model_label_Advance => label_Advance - + use NUOPC_Model, & + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - - subroutine SetServices(gcomp, rc) - type(ESMF_GridComp) :: gcomp + + subroutine SetServices(model, rc) + type(ESMF_GridComp) :: model integer, intent(out) :: rc - - rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(gcomp, model_routine_SS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! --- Initialization phases -------------------------------------- - ! Provide InitializeP0 to switch from default IPDv00 to IPDv03 - call ESMF_GridCompSetEntryPoint(gcomp, ESMF_METHOD_INITIALIZE, & - userRoutine=InitializeP0, phase=0, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out + rc = ESMF_SUCCESS - ! IPDv03p1: advertise Fields - call NUOPC_CompSetEntryPoint(gcomp, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv03p1"/), userRoutine=InitializeP1, rc=rc) + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - ! IPDv03p3: realize connected Fields with transfer action "provide" - call NUOPC_CompSetEntryPoint(gcomp, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv03p3"/), userRoutine=InitializeP3, rc=rc) + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! IPDv03p4: optionally modify the decomp/distr of transferred Grid/Mesh - call NUOPC_CompSetEntryPoint(gcomp, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv03p4"/), userRoutine=InitializeP4, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=RealizeProvided, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! IPDv03p5: realize all Fields with transfer action "accept" - call NUOPC_CompSetEntryPoint(gcomp, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv03p5"/), userRoutine=InitializeP5, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_AcceptTransfer, & + specRoutine=AcceptTransfer, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(gcomp, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeAccepted, & + specRoutine=RealizeAccepted, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(gcomp, specLabel=model_label_DataInitialize, & - specRoutine=DataInitialize, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP0(gcomp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: gcomp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - + subroutine Advertise(model, rc) + type(ESMF_GridComp) :: model + integer, intent(out) :: rc + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - ! Switch to IPDv03 by filtering all other phaseMap entries - call NUOPC_CompFilterPhaseMap(gcomp, ESMF_METHOD_INITIALIZE, & - acceptStringList=(/"IPDv03p"/), rc=rc) + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine InitializeP1(gcomp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: gcomp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - rc = ESMF_SUCCESS ! importable field: air_pressure_at_sea_level call NUOPC_Advertise(importState, & @@ -140,7 +103,7 @@ subroutine InitializeP1(gcomp, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + #ifdef SECONDFIELD ! importable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(importState, & @@ -153,19 +116,26 @@ subroutine InitializeP1(gcomp, importState, exportState, clock, rc) #endif end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP3(gcomp, importState, exportState, clock, rc) - ! IPDv03p3: realize connected Fields with transfer action "provide" - ! and remove Fields that are not connected - type(ESMF_GridComp) :: gcomp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock + subroutine RealizeProvided(model, rc) + type(ESMF_GridComp) :: model integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call checkConnectedFlagProvide(importState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -179,10 +149,10 @@ subroutine InitializeP3(gcomp, importState, exportState, clock, rc) return ! bail out contains ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + subroutine checkConnectedFlagProvide(state, rc) ! Look at all of the fields in state, including in nested states. Error - ! out if a connected field is found for which geom object must be + ! out if a connected field is found for which geom object must be ! provided here. Remove all not connected fields. type(ESMF_State) :: state integer, optional :: rc @@ -194,18 +164,18 @@ subroutine checkConnectedFlagProvide(state, rc) character(len=20) :: transferAction character(len=80), allocatable :: itemNameList(:) type(ESMF_StateItem_Flag), allocatable :: itemTypeList(:) - + if (present(rc)) rc = ESMF_SUCCESS - + call ESMF_StateGet(state, name=stateName, nestedFlag=.true., & itemCount=itemCount, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + allocate(itemNameList(itemCount), itemTypeList(itemCount)) - + call ESMF_StateGet(state, nestedFlag=.true., & itemNameList=itemNameList, itemTypeList=itemTypeList, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -243,7 +213,7 @@ subroutine checkConnectedFlagProvide(state, rc) file=__FILE__)) & return ! bail out if (trim(transferAction)=="provide") then - ! the Connector instructed the gcomp to provide geom object + ! the Connector instructed the model to provide geom object call ESMF_LogSetError(ESMF_RC_NOT_VALID, & msg="Cannot fulfill request to provide geom object for "// & trim(itemNameList(item))//" in State "//trim(stateName), & @@ -255,24 +225,32 @@ subroutine checkConnectedFlagProvide(state, rc) endif endif enddo - + deallocate(itemNameList, itemTypeList) - + end subroutine end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP4(gcomp, importState, exportState, clock, rc) - ! IPDv03p4: optionally modify the decomp/distr of transferred Grid/Mesh - type(ESMF_GridComp) :: gcomp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock + subroutine AcceptTransfer(model, rc) + type(ESMF_GridComp) :: model integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call adjustAcceptedGeom(importState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -286,7 +264,7 @@ subroutine InitializeP4(gcomp, importState, exportState, clock, rc) return ! bail out contains ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + subroutine adjustAcceptedGeom(state, rc) ! Look at all of the fields in state, including in nested states. Adjust ! the distribution of the accepted geom object to a 1 DE/PET distribution. @@ -305,17 +283,17 @@ subroutine adjustAcceptedGeom(state, rc) type(ESMF_DistGrid) :: distgrid integer :: dimCount, tileCount integer, allocatable :: minIndexPTile(:,:), maxIndexPTile(:,:) - + if (present(rc)) rc = ESMF_SUCCESS - + call ESMF_StateGet(state, nestedFlag=.true., itemCount=itemCount, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + allocate(itemNameList(itemCount), itemTypeList(itemCount)) - + call ESMF_StateGet(state, nestedFlag=.true., & itemNameList=itemNameList, itemTypeList=itemTypeList, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -339,7 +317,7 @@ subroutine adjustAcceptedGeom(state, rc) file=__FILE__)) & return ! bail out if (trim(transferAction)=="accept") then - ! the Connector instructed the gcomp to accept geom object + ! the Connector instructed the model to accept geom object ! -> find out which type geom object the field holds call ESMF_FieldGet(field, geomtype=geomtype, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -359,7 +337,7 @@ subroutine adjustAcceptedGeom(state, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - ! Create a custom DistGrid, based on the minIndex, maxIndex of the + ! Create a custom DistGrid, based on the minIndex, maxIndex of the ! accepted DistGrid, but with a default regDecomp for the current VM ! that leads to 1DE/PET. ! get dimCount and tileCount @@ -393,7 +371,7 @@ subroutine adjustAcceptedGeom(state, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call ESMF_FieldEmptySet(field, grid=grid, rc=rc) + call ESMF_FieldEmptySet(field, grid=grid, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -413,7 +391,7 @@ subroutine adjustAcceptedGeom(state, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - ! Create a custom DistGrid, based on the minIndex, maxIndex of the + ! Create a custom DistGrid, based on the minIndex, maxIndex of the ! accepted DistGrid, but with a default regDecomp for the current VM ! that leads to 1DE/PET. ! get dimCount and tileCount @@ -447,7 +425,7 @@ subroutine adjustAcceptedGeom(state, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call ESMF_FieldEmptySet(field, mesh=mesh, rc=rc) + call ESMF_FieldEmptySet(field, mesh=mesh, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -466,24 +444,32 @@ subroutine adjustAcceptedGeom(state, rc) endif endif enddo - + deallocate(itemNameList, itemTypeList) - + end subroutine - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP5(gcomp, importState, exportState, clock, rc) - ! IPDv03p5: realize all Fields with transfer action "accept" - type(ESMF_GridComp) :: gcomp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock + subroutine RealizeAccepted(model, rc) + type(ESMF_GridComp) :: model integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call realizeWithAcceptedGeom(importState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -495,9 +481,9 @@ subroutine InitializeP5(gcomp, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + contains ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + subroutine realizeWithAcceptedGeom(state, rc) ! Look at all of the fields in state, including in nested states. Realize ! with the accepted and adjusted geom object. @@ -507,9 +493,9 @@ subroutine realizeWithAcceptedGeom(state, rc) integer :: itemCount, item character(len=80), allocatable :: itemNameList(:) type(ESMF_StateItem_Flag), allocatable :: itemTypeList(:) - + if (present(rc)) rc = ESMF_SUCCESS - + ! query info about the items in the state call ESMF_StateGet(state, nestedFlag=.true., itemCount=itemCount, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -535,37 +521,19 @@ subroutine realizeWithAcceptedGeom(state, rc) return ! bail out endif enddo - - deallocate(itemNameList, itemTypeList) - - end subroutine - end subroutine - - !----------------------------------------------------------------------------- + deallocate(itemNameList, itemTypeList) - subroutine DataInitialize(gcomp, rc) - type(ESMF_GridComp) :: gcomp - integer, intent(out) :: rc - - rc = ESMF_SUCCESS + end subroutine - ! indicate that data initialization is complete (breaking out of init-loop) - call NUOPC_CompAttributeSet(gcomp, & - name="InitializeDataComplete", value="true", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(gcomp, rc) - type(ESMF_GridComp) :: gcomp + subroutine Advance(model, rc) + type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -579,9 +547,9 @@ subroutine ModelAdvance(gcomp, rc) integer, save :: slice=1 rc = ESMF_SUCCESS - + ! query the Component for its clock, importState - call ESMF_GridCompGet(gcomp, clock=clock, importState=importState, & + call ESMF_GridCompGet(model, clock=clock, importState=importState, & rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -600,7 +568,7 @@ subroutine ModelAdvance(gcomp, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -625,4 +593,6 @@ subroutine ModelAdvance(gcomp, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AsyncIONonblockingProto/model.F90 b/AsyncIONonblockingProto/model.F90 index cb4e74e9..508fe560 100644 --- a/AsyncIONonblockingProto/model.F90 +++ b/AsyncIONonblockingProto/model.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -16,67 +16,73 @@ module ModelComp use ESMF use NUOPC - use NUOPC_Model, only: & - model_routine_SS => SetServices, & - model_label_Advance => label_Advance - + use NUOPC_Model, & + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - - subroutine SetServices(gcomp, rc) - type(ESMF_GridComp) :: gcomp + + subroutine SetServices(model, rc) + type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(gcomp, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(gcomp, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(gcomp, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(gcomp, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(gcomp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: gcomp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock + subroutine Advertise(model, rc) + type(ESMF_GridComp) :: model integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! exportable field: air_pressure_at_sea_level call NUOPC_Advertise(exportState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -84,7 +90,7 @@ subroutine InitializeP1(gcomp, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + #ifdef SECONDFIELD ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & @@ -96,23 +102,30 @@ subroutine InitializeP1(gcomp, importState, exportState, clock, rc) #endif end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(gcomp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: gcomp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock + subroutine Realize(model, rc) + type(ESMF_GridComp) :: model integer, intent(out) :: rc - - ! local variables - type(ESMF_Field) :: field - type(ESMF_Grid) :: gridOut - real(ESMF_KIND_R8), pointer :: dataPtr(:,:), lonPtr(:), latPtr(:) - integer :: i,j - + + ! local variables + type(ESMF_State) :: importState, exportState + type(ESMF_Field) :: field + type(ESMF_Grid) :: gridOut + real(ESMF_KIND_R8), pointer :: dataPtr(:,:), lonPtr(:), latPtr(:) + integer :: i,j + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridOut = ESMF_GridCreate1PeriDimUfrm(maxIndex=(/200, 300/), & minCornerCoord=(/0._ESMF_KIND_R8, -60._ESMF_KIND_R8/), & @@ -186,13 +199,13 @@ subroutine InitializeP2(gcomp, importState, exportState, clock, rc) #endif end subroutine - + !----------------------------------------------------------------------------- - subroutine ModelAdvance(gcomp, rc) - type(ESMF_GridComp) :: gcomp + subroutine Advance(model, rc) + type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: exportState @@ -206,9 +219,9 @@ subroutine ModelAdvance(gcomp, rc) integer, parameter :: kWaste=40 rc = ESMF_SUCCESS - - ! query the Component for its clock, exportState - call ESMF_GridCompGet(gcomp, clock=clock, & + + ! query for clock, importState and exportState + call ESMF_GridCompGet(model, clock=clock, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -270,9 +283,9 @@ subroutine ModelAdvance(gcomp, rc) enddo enddo enddo - + endif - + #ifdef SECONDFIELD ! update the "rsns" field call ESMF_StateGet(exportState, itemName="rsns", itemType=itemType, rc=rc) @@ -316,9 +329,9 @@ subroutine ModelAdvance(gcomp, rc) enddo enddo enddo - + endif - + #endif ! advance the time slice counter @@ -326,4 +339,6 @@ subroutine ModelAdvance(gcomp, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnConOptsProto/atm.F90 b/AtmOcnConOptsProto/atm.F90 index 8c96e8e5..88817231 100644 --- a/AtmOcnConOptsProto/atm.F90 +++ b/AtmOcnConOptsProto/atm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,14 +17,12 @@ module ATM use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_Advance => label_Advance, & - model_label_Finalize => label_Finalize - + modelSS => SetServices + implicit none - + private - + public SetServices real(ESMF_KIND_R8),parameter :: zeroValue = 0.0_ESMF_KIND_R8 @@ -37,60 +35,67 @@ module ATM !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_Finalize, & - specRoutine=ModelFinalize, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Finalize, & + specRoutine=Finalize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! Disabling the following macro, e.g. renaming to WITHIMPORTFIELDS_disable, ! will result in a model component that does not advertise any importable ! Fields. Use this if you want to drive the model independently. @@ -104,7 +109,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out #endif - + ! exportable field: air_pressure_at_sea_level call NUOPC_Advertise(exportState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -112,7 +117,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -122,16 +127,15 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut @@ -140,9 +144,17 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) real(ESMF_KIND_R8), pointer :: lat_fptr(:) integer(ESMF_KIND_I4), pointer :: msk_fptr(:,:) integer :: i,j - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/24, 25/), & minCornerCoord=(/245._ESMF_KIND_R8, -5._ESMF_KIND_R8/), & @@ -195,7 +207,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) enddo gridOut = gridIn ! for now out same as in - + #ifdef WITHIMPORTFIELDS ! importable field: sea_surface_temperature field = ESMF_FieldCreate(name="sst", grid=gridIn, & @@ -254,7 +266,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out #ifdef WITH_FORMAL_REALIZE - ! There is not need to formally call Realize() when completing the + ! There is not need to formally call Realize() when completing the ! adverised field directly. However, calling Realize() also works. call NUOPC_Realize(exportState, field=field, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -292,13 +304,13 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -306,11 +318,11 @@ subroutine ModelAdvance(model, rc) #define NUOPC_TRACE__OFF #ifdef NUOPC_TRACE - call ESMF_TraceRegionEnter("ATM:ModelAdvance") + call ESMF_TraceRegionEnter("ATM:Advance") #endif rc = ESMF_SUCCESS - + ! query the Component for its clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) @@ -320,12 +332,12 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set by default, ! its timeStep is equal to the parent timeStep. As a consequence the ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. - + ! for this call of the Advance() routine. + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing ATM from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -337,7 +349,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -351,14 +363,14 @@ subroutine ModelAdvance(model, rc) return ! bail out #ifdef NUOPC_TRACE - call ESMF_TraceRegionExit("ATM:ModelAdvance") + call ESMF_TraceRegionExit("ATM:Advance") #endif - + end subroutine !----------------------------------------------------------------------------- - subroutine ModelFinalize(model, rc) + subroutine Finalize(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc ! local variables @@ -525,7 +537,9 @@ subroutine ModelFinalize(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnConOptsProto/esm.F90 b/AtmOcnConOptsProto/esm.F90 index 2f6fa371..122a5a81 100644 --- a/AtmOcnConOptsProto/esm.F90 +++ b/AtmOcnConOptsProto/esm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -22,23 +22,21 @@ module ESM use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices, & - driver_label_SetRunSequence => label_SetRunSequence - + driverSS => SetServices + use ATM, only: atmSS => SetServices use OCN, only: ocnSS => SetServices - + use NUOPC_Connector, only: cplSS => SetServices - + implicit none - + private - + public SetServices character(*), parameter :: dflt_cfname = "bilinear.cfg" - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -46,7 +44,8 @@ module ESM subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + + ! local variables type(ESMF_VM) :: vm integer :: localPet type(ESMF_Config) :: config @@ -54,22 +53,22 @@ subroutine SetServices(driver, rc) character(len=32) :: cfName rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetRunSequence, & + call NUOPC_CompSpecialize(driver, specLabel=label_SetRunSequence, & specRoutine=SetRunSequence, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -81,7 +80,7 @@ subroutine SetServices(driver, rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & - return ! bail out + return ! bail out ! get config file name from command line arguments if (localPet.eq.0) then @@ -122,7 +121,14 @@ subroutine SetServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + + ! set driver verbosity + call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + end subroutine !----------------------------------------------------------------------------- @@ -130,7 +136,7 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables integer :: localPet character(len=8) :: zeroValues @@ -143,7 +149,7 @@ subroutine SetModelServices(driver, rc) type(ESMF_Clock) :: internalClock type(ESMF_Config) :: config type(NUOPC_FreeFormat) :: attrFF - + rc = ESMF_SUCCESS ! query the Component for its localPet @@ -178,7 +184,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + #if 0 print *, "-- start FreeFormatPrint(attrFF) of read in attributes --------" call NUOPC_FreeFormatPrint(attrFF, rc=rc) @@ -195,14 +201,14 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! clean-up call NUOPC_FreeFormatDestroy(attrFF, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for ATM call NUOPC_DriverAddComp(driver, "ATM", atmSS, comp=child, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -210,7 +216,7 @@ subroutine SetModelServices(driver, rc) file=__FILE__)) & return ! bail out ! set default ATM attributes - call NUOPC_CompAttributeSet(child, name="Verbosity", value="1", rc=rc) + call NUOPC_CompAttributeSet(child, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -257,7 +263,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for OCN call NUOPC_DriverAddComp(driver, "OCN", ocnSS, comp=child, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -265,7 +271,7 @@ subroutine SetModelServices(driver, rc) file=__FILE__)) & return ! bail out ! set default OCN attributes - call NUOPC_CompAttributeSet(child, name="Verbosity", value="1", rc=rc) + call NUOPC_CompAttributeSet(child, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -324,7 +330,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompAttributeSet(connector, name="Verbosity", value="1", rc=rc) + call NUOPC_CompAttributeSet(connector, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -351,7 +357,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for ocn2atm call NUOPC_DriverAddComp(driver, srcCompLabel="OCN", dstCompLabel="ATM", & compSetServicesRoutine=cplSS, comp=connector, rc=rc) @@ -359,7 +365,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompAttributeSet(connector, name="Verbosity", value="1", rc=rc) + call NUOPC_CompAttributeSet(connector, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -391,7 +397,7 @@ subroutine SetModelServices(driver, rc) write(*,"(A)") "Manually adding connectors: DISABLED" endif #endif - + ! set the driver clock call ESMF_TimeIntervalSet(timeStep, m=30, rc=rc) ! 15 minute default step if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -417,13 +423,13 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- @@ -431,7 +437,7 @@ subroutine SetModelServices(driver, rc) subroutine SetRunSequence(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables character(ESMF_MAXSTR) :: name integer :: localPet @@ -447,7 +453,7 @@ subroutine SetRunSequence(driver, rc) call ESMF_GridCompGet(driver, name=name, localPet=localPet, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - + ! read free format run sequence from config call ESMF_GridCompGet(driver, config=config, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -455,7 +461,7 @@ subroutine SetRunSequence(driver, rc) runSeqFF = NUOPC_FreeFormatCreate(config, label="runSeq::", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - + #if 0 call NUOPC_FreeFormatPrint(runSeqFF, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -479,7 +485,7 @@ subroutine SetRunSequence(driver, rc) do i=1, size(connectorList) call NUOPC_CompAttributeSet(connectorList(i), name="Verbosity", & - value="0", rc=rc) + value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=__FILE__)) return ! bail out ! read CON attributes from config file into FreeFormat @@ -506,12 +512,12 @@ subroutine SetRunSequence(driver, rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out #endif - + ! clean-up call NUOPC_FreeFormatDestroy(runSeqFF, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - + end subroutine !----------------------------------------------------------------------------- diff --git a/AtmOcnConOptsProto/esmApp.F90 b/AtmOcnConOptsProto/esmApp.F90 index 58def34c..60b17a2a 100644 --- a/AtmOcnConOptsProto/esmApp.F90 +++ b/AtmOcnConOptsProto/esmApp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -22,7 +22,7 @@ program esmApp integer :: rc, urc type(ESMF_GridComp) :: esmComp - + ! Initialize ESMF call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, & defaultCalkind=ESMF_CALKIND_GREGORIAN, rc=rc) @@ -30,7 +30,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp STARTING", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -55,7 +55,7 @@ program esmApp file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - ! Set Profiling Attribute + ! Set Profiling Attribute call NUOPC_CompAttributeSet(esmComp, name="Profiling", value="0", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -72,7 +72,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Run for earth the system Component call ESMF_GridCompRun(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -83,7 +83,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Finalize for the earth system Component call ESMF_GridCompFinalize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -94,14 +94,14 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Destroy the earth system Component call ESMF_GridCompDestroy(esmComp, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -110,5 +110,5 @@ program esmApp ! Finalize ESMF call ESMF_Finalize() - -end program + +end program diff --git a/AtmOcnConOptsProto/ocn.F90 b/AtmOcnConOptsProto/ocn.F90 index 8511db2b..e089bfae 100644 --- a/AtmOcnConOptsProto/ocn.F90 +++ b/AtmOcnConOptsProto/ocn.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,15 +17,12 @@ module OCN use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_SetClock => label_SetClock, & - model_label_Advance => label_Advance, & - model_label_Finalize => label_Finalize - + modelSS => SetServices + implicit none - + private - + public SetServices real(ESMF_KIND_R8),parameter :: zeroValue = 0.0_ESMF_KIND_R8 @@ -34,70 +31,77 @@ module OCN 295.5_ESMF_KIND_R8, & 9.5_ESMF_KIND_R8, & 25.5_ESMF_KIND_R8 /) - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_SetClock, & + call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & specRoutine=SetClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_Finalize, & - specRoutine=ModelFinalize, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Finalize, & + specRoutine=Finalize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! Disabling the following macro, e.g. renaming to WITHIMPORTFIELDS_disable, ! will result in a model component that does not advertise any importable ! Fields. Use this if you want to drive the model independently. @@ -110,7 +114,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(importState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -129,16 +133,15 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_TimeInterval) :: stabilityTimeStep type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn @@ -148,9 +151,17 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) real(ESMF_KIND_R8), pointer :: lat_fptr(:) integer(ESMF_KIND_I4), pointer :: msk_fptr(:,:) integer :: i,j - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/15, 16/), & minCornerCoord=(/260._ESMF_KIND_R8, 0._ESMF_KIND_R8/), & @@ -224,7 +235,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux field = ESMF_FieldCreate(name="rsns", grid=gridIn, & typekind=ESMF_TYPEKIND_R8, rc=rc) @@ -267,26 +278,26 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- subroutine SetClock(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_TimeInterval) :: stabilityTimeStep rc = ESMF_SUCCESS - + ! query the Component for its clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! initialize internal clock ! here: parent Clock and stability timeStep determine actual model timeStep !TODO: stabilityTimeStep should be read in from configuation @@ -301,15 +312,15 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -319,12 +330,12 @@ subroutine ModelAdvance(model, rc) #define NUOPC_TRACE__OFF #ifdef NUOPC_TRACE - call ESMF_TraceRegionEnter("OCN:ModelAdvance") + call ESMF_TraceRegionEnter("OCN:Advance") #endif - + rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -333,14 +344,14 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set in SetClock(), ! its timeStep is likely smaller than the parent timeStep. As a consequence - ! the time interval covered by a single parent timeStep will result in - ! multiple calls to the ModelAdvance() routine. Every time the currTime + ! the time interval covered by a single parent timeStep will result in + ! multiple calls to the Advance() routine. Every time the currTime ! will come in by one internal timeStep advanced. This goes until the ! stopTime of the internal Clock has been reached. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing OCN from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -352,13 +363,13 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_TimePrint(currTime + timeStep, & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -372,13 +383,13 @@ subroutine ModelAdvance(model, rc) return ! bail out #ifdef NUOPC_TRACE - call ESMF_TraceRegionExit("OCN:ModelAdvance") + call ESMF_TraceRegionExit("OCN:Advance") #endif end subroutine !----------------------------------------------------------------------------- - subroutine ModelFinalize(model, rc) + subroutine Finalize(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc ! local variables @@ -545,7 +556,9 @@ subroutine ModelFinalize(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnConProto/atm.F90 b/AtmOcnConProto/atm.F90 index 41656f55..4543bc34 100644 --- a/AtmOcnConProto/atm.F90 +++ b/AtmOcnConProto/atm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,66 +17,72 @@ module ATM use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! Disabling the following macro, e.g. renaming to WITHIMPORTFIELDS_disable, ! will result in a model component that does not advertise any importable ! Fields. Use this if you want to drive the model independently. @@ -90,7 +96,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out #endif - + ! exportable field: air_pressure_at_sea_level call NUOPC_Advertise(exportState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -98,7 +104,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -108,22 +114,29 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/10, 100/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -178,21 +191,21 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -201,11 +214,11 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set by default, ! its timeStep is equal to the parent timeStep. As a consequence the ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. + ! for this call of the Advance() routine. call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing ATM from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -217,7 +230,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -232,4 +245,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnConProto/conn.F90 b/AtmOcnConProto/conn.F90 index 514790c1..71dc652a 100644 --- a/AtmOcnConProto/conn.F90 +++ b/AtmOcnConProto/conn.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -13,80 +13,74 @@ module CON !----------------------------------------------------------------------------- ! Connector Component. !----------------------------------------------------------------------------- - + ! Enabling the followng macro, i.e. setting it to WITHSTATEUSE_on, ! will activate sections of code that demonstrate how ! the "state" member inside the NUOPC_Connector is used. The ! example creates an FieldBundle that's a duplicate of dstFields inside the - ! connector, and precomputes two RouteHandles. The first is a Regrid, while + ! connector, and precomputes two RouteHandles. The first is a Regrid, while ! the second is simply an identity operation using FieldRedist() to show the ! principle. #define WITHSTATEUSE_on use ESMF use NUOPC - use NUOPC_Connector, only: & - con_routine_SS => SetServices, & -#ifdef WITHSTATEUSE_on - con_label_ExecuteRH => label_ExecuteRouteHandle, & - con_label_ReleaseRH => label_ReleaseRouteHandle, & -#endif - con_label_ComputeRH => label_ComputeRouteHandle, & - NUOPC_ConnectorGet, NUOPC_ConnectorSet - + use NUOPC_Connector, & + conSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(connector, rc) type(ESMF_CplComp) :: connector integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC connector component will register the generic methods - call NUOPC_CompDerive(connector, con_routine_SS, rc=rc) + + ! derive from NUOPC_Connector + call NUOPC_CompDerive(connector, conSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method to compute the connection RouteHandle - call NUOPC_CompSpecialize(connector, specLabel=con_label_ComputeRH, & + + ! specialize connector + call NUOPC_CompSpecialize(connector, specLabel=label_ComputeRouteHandle, & specRoutine=ComputeRH, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out #ifdef WITHSTATEUSE_on - call NUOPC_CompSpecialize(connector, specLabel=con_label_ExecuteRH, & + call NUOPC_CompSpecialize(connector, specLabel=label_ExecuteRouteHandle, & specRoutine=ExecuteRH, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(connector, specLabel=con_label_ReleaseRH, & + call NUOPC_CompSpecialize(connector, specLabel=label_ReleaseRouteHandle, & specRoutine=ReleaseRH, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out #endif - + end subroutine - + !----------------------------------------------------------------------------- subroutine ComputeRH(connector, rc) type(ESMF_CplComp) :: connector integer, intent(out) :: rc - + ! local variables type(ESMF_State) :: state type(ESMF_FieldBundle) :: dstFields, srcFields @@ -95,7 +89,7 @@ subroutine ComputeRH(connector, rc) type(ESMF_Field), allocatable :: fields(:) integer :: fieldCount, i type(ESMF_Grid) :: Grid - type(ESMF_TypeKind_Flag) :: typekind + type(ESMF_TypeKind_Flag) :: typekind type(ESMF_Field) :: field type(ESMF_RouteHandle) :: rh1, rh2 #else @@ -103,7 +97,7 @@ subroutine ComputeRH(connector, rc) #endif rc = ESMF_SUCCESS - + call NUOPC_ConnectorGet(connector, srcFields=srcFields, & dstFields=dstFields, state=state, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -122,7 +116,7 @@ subroutine ComputeRH(connector, rc) ! - pull out fields in list form ! - !!!! MUST specify itemorderflag=ESMF_ITEMORDER_ADDORDER in order to ! !!!! preserve the same order as the original FieldBundle, or else the - ! !!!! FieldBundle communication methods will incorrectly map from + ! !!!! FieldBundle communication methods will incorrectly map from ! !!!! src -> dst! allocate(fields(fieldCount)) call ESMF_FieldBundleGet(dstFields, fieldList=fields, & @@ -192,7 +186,7 @@ subroutine ComputeRH(connector, rc) line=__LINE__, & file=__FILE__)) & return ! bail out -#else +#else ! specialize with Redist, instead of the default Regrid call ESMF_FieldBundleRedistStore(srcFields, dstFields, & routehandle=rh, rc=rc) @@ -206,9 +200,9 @@ subroutine ComputeRH(connector, rc) file=__FILE__)) & return ! bail out #endif - + end subroutine - + !----------------------------------------------------------------------------- #ifdef WITHSTATEUSE_on @@ -216,7 +210,7 @@ subroutine ComputeRH(connector, rc) subroutine ExecuteRH(connector, rc) type(ESMF_CplComp) :: connector integer, intent(out) :: rc - + ! local variables type(ESMF_FieldBundle) :: interDstFields type(ESMF_RouteHandle) :: rh1, rh2 @@ -226,14 +220,14 @@ subroutine ExecuteRH(connector, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - + call NUOPC_ConnectorGet(connector, srcFields=srcFields, & dstFields=dstFields, state=state, driverClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! test the parent clock call ESMF_ClockPrint(clock, options="currTime", & preString="Testing parentClock from conn.F90 ExecuteRH(): ", & @@ -247,7 +241,7 @@ subroutine ExecuteRH(connector, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! retrieve interDstFields FieldBundle from state member call ESMF_StateGet(state, "interDstFields", interDstFields, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -280,27 +274,28 @@ subroutine ExecuteRH(connector, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine + !----------------------------------------------------------------------------- subroutine ReleaseRH(connector, rc) type(ESMF_CplComp) :: connector integer, intent(out) :: rc - + ! local variables type(ESMF_State) :: state type(ESMF_FieldBundle) :: interDstFields type(ESMF_RouteHandle) :: rh1, rh2 rc = ESMF_SUCCESS - + call NUOPC_ConnectorGet(connector, state=state, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! retrieve interDstFields FieldBundle from state member call ESMF_StateGet(state, "interDstFields", interDstFields, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -331,14 +326,16 @@ subroutine ReleaseRH(connector, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! Could destroy intermediate Fields and interDstFields FieldBundle here, ! but it is more convenient to let ESMF automatic garbage collection take ! care of them. - + end subroutine -#endif - +#endif + + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnConProto/esm.F90 b/AtmOcnConProto/esm.F90 index 8b864edc..9e306ae2 100644 --- a/AtmOcnConProto/esm.F90 +++ b/AtmOcnConProto/esm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -14,7 +14,7 @@ module ESM ! Code that specializes generic ESM Component code. !----------------------------------------------------------------------------- - ! Enabling the followng macro, i.e. setting it to WITHPETLISTS_on, will + ! Enabling the followng macro, i.e. setting it to WITHPETLISTS_on, will ! activate sections of code that demonstrate how ! the ATM and OCN components can run on exclusive sets of PETs. Turning this ! on/off does not affect how the Connector component is specialized. @@ -23,20 +23,19 @@ module ESM use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices - + driverSS => SetServices + use ATM, only: atmSS => SetServices use OCN, only: ocnSS => SetServices - + use CON, only: cplSS => SetServices - + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -44,26 +43,26 @@ module ESM subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & + + ! specialize driver + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! set driver verbosity - call NUOPC_CompAttributeSet(driver, name="Verbosity", value="low", rc=rc) + call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -76,7 +75,7 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables type(ESMF_Grid) :: grid type(ESMF_Field) :: field @@ -92,14 +91,14 @@ subroutine SetModelServices(driver, rc) character(len=10) :: attrStr rc = ESMF_SUCCESS - + ! get the petCount call ESMF_GridCompGet(driver, petCount=petCount, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for ATM with petList on first half of PETs #ifdef WITHPETLISTS_on allocate(petList(petCount/2)) @@ -127,7 +126,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for OCN with petList on second half of PETs #ifdef WITHPETLISTS_on allocate(petList(petCount/2)) @@ -155,7 +154,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for atm2ocn call NUOPC_DriverAddComp(driver, srcCompLabel="ATM", dstCompLabel="OCN", & compSetServicesRoutine=cplSS, comp=conn, rc=rc) @@ -172,7 +171,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for ocn2atm call NUOPC_DriverAddComp(driver, srcCompLabel="OCN", dstCompLabel="ATM", & compSetServicesRoutine=cplSS, comp=conn, rc=rc) @@ -189,7 +188,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! set the driver clock call ESMF_TimeIntervalSet(timeStep, m=15, rc=rc) ! 15 minute steps if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -217,13 +216,13 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- diff --git a/AtmOcnConProto/esmApp.F90 b/AtmOcnConProto/esmApp.F90 index 9226f49a..85a857f3 100644 --- a/AtmOcnConProto/esmApp.F90 +++ b/AtmOcnConProto/esmApp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -21,14 +21,14 @@ program esmApp integer :: rc, urc type(ESMF_GridComp) :: esmComp - + ! Initialize ESMF call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp STARTING", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -41,7 +41,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! SetServices for the earth system Component call ESMF_GridCompSetServices(esmComp, esmSS, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -52,7 +52,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Initialize for the earth system Component call ESMF_GridCompInitialize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -63,7 +63,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Run for earth the system Component call ESMF_GridCompRun(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -74,7 +74,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Finalize for the earth system Component call ESMF_GridCompFinalize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -85,14 +85,14 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Destroy the earth system Component call ESMF_GridCompDestroy(esmComp, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -101,5 +101,5 @@ program esmApp ! Finalize ESMF call ESMF_Finalize() - -end program + +end program diff --git a/AtmOcnConProto/ocn.F90 b/AtmOcnConProto/ocn.F90 index 88aa9e00..14b8708d 100644 --- a/AtmOcnConProto/ocn.F90 +++ b/AtmOcnConProto/ocn.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,73 +17,78 @@ module OCN use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_SetClock => label_SetClock, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_SetClock, & + call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & specRoutine=SetClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! Disabling the following macro, e.g. renaming to WITHIMPORTFIELDS_disable, ! will result in a model component that does not advertise any importable ! Fields. Use this if you want to drive the model independently. @@ -96,7 +101,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(importState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -115,23 +120,30 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_TimeInterval) :: stabilityTimeStep type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/100, 10/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -157,7 +169,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux field = ESMF_FieldCreate(name="rsns", grid=gridIn, & typekind=ESMF_TYPEKIND_R8, rc=rc) @@ -186,26 +198,26 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- subroutine SetClock(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_TimeInterval) :: stabilityTimeStep rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock call NUOPC_ModelGet(model, modelClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! initialize internal clock ! here: parent Clock and stability timeStep determine actual model timeStep !TODO: stabilityTimeStep should be read in from configuation @@ -220,15 +232,15 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -237,8 +249,8 @@ subroutine ModelAdvance(model, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -247,14 +259,14 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set in SetClock(), ! its timeStep is likely smaller than the parent timeStep. As a consequence - ! the time interval covered by a single parent timeStep will result in - ! multiple calls to the ModelAdvance() routine. Every time the currTime + ! the time interval covered by a single parent timeStep will result in + ! multiple calls to the Advance() routine. Every time the currTime ! will come in by one internal timeStep advanced. This goes until the ! stopTime of the internal Clock has been reached. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing OCN from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -266,13 +278,13 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_TimePrint(currTime + timeStep, & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -287,4 +299,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnCplListProto/atm.F90 b/AtmOcnCplListProto/atm.F90 index 420e3117..2dccad5e 100644 --- a/AtmOcnCplListProto/atm.F90 +++ b/AtmOcnCplListProto/atm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,66 +17,72 @@ module ATM use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: sea_surface_temperature call NUOPC_Advertise(importState, & StandardName="sea_surface_temperature", name="sst", rc=rc) @@ -84,7 +90,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: air_pressure_at_sea_level call NUOPC_Advertise(exportState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -92,7 +98,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & StandardName="surface_net_downward_longwave_flux", name="rsnl", rc=rc) @@ -118,24 +124,31 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut real(ESMF_KIND_R8), pointer :: dataPtr(:,:), lonPtr(:), latPtr(:) integer :: i,j - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreate1PeriDimUfrm(maxIndex=(/100, 50/), & minCornerCoord=(/0._ESMF_KIND_R8, -60._ESMF_KIND_R8/), & @@ -271,13 +284,13 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) enddo end subroutine - + !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -289,8 +302,8 @@ subroutine ModelAdvance(model, rc) integer, save :: slice=1 rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -299,12 +312,12 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set by default, ! its timeStep is equal to the parent timeStep. As a consequence the ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. - + ! for this call of the Advance() routine. + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing ATM from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -316,7 +329,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -353,7 +366,7 @@ subroutine ModelAdvance(model, rc) enddo enddo endif - + ! update the "rsns" field call ESMF_StateGet(exportState, itemName="rsns", itemType=itemType, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -378,7 +391,7 @@ subroutine ModelAdvance(model, rc) enddo enddo endif - + ! write out the Fields in the importState call NUOPC_Write(importState, fileNamePrefix="field_atm_import_", & timeslice=slice, overwrite=.true., relaxedFlag=.true., rc=rc) @@ -398,4 +411,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnCplListProto/esm.F90 b/AtmOcnCplListProto/esm.F90 index b1e2af3c..da35142a 100644 --- a/AtmOcnCplListProto/esm.F90 +++ b/AtmOcnCplListProto/esm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,21 +17,19 @@ module ESM use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices, & - driver_label_ModifyCplLists => label_ModifyCplLists + driverSS => SetServices use ATM, only: atmSS => SetServices use OCN, only: ocnSS => SetServices - + use NUOPC_Connector, only: cplSS => SetServices - + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -39,30 +37,37 @@ module ESM subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & + + ! specialize driver + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(driver, specLabel=driver_label_ModifyCplLists, & + call NUOPC_CompSpecialize(driver, specLabel=label_ModifyCplLists, & specRoutine=ModifyCplLists, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + + ! set driver verbosity + call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + end subroutine !----------------------------------------------------------------------------- @@ -70,7 +75,7 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables type(ESMF_Grid) :: grid type(ESMF_Field) :: field @@ -84,14 +89,14 @@ subroutine SetModelServices(driver, rc) integer, allocatable :: petList(:) rc = ESMF_SUCCESS - + ! get the petCount call ESMF_GridCompGet(driver, petCount=petCount, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for ATM with petList on first half of PETs allocate(petList(petCount/2)) do i=1, petCount/2 @@ -109,7 +114,7 @@ subroutine SetModelServices(driver, rc) file=__FILE__)) & return ! bail out deallocate(petList) - + ! SetServices for OCN with petList on second half of PETs allocate(petList(petCount/2)) do i=1, petCount/2 @@ -127,7 +132,7 @@ subroutine SetModelServices(driver, rc) file=__FILE__)) & return ! bail out deallocate(petList) - + ! SetServices for atm2ocn call NUOPC_DriverAddComp(driver, srcCompLabel="ATM", dstCompLabel="OCN", & compSetServicesRoutine=cplSS, comp=connector, rc=rc) @@ -140,7 +145,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for ocn2atm call NUOPC_DriverAddComp(driver, srcCompLabel="OCN", dstCompLabel="ATM", & compSetServicesRoutine=cplSS, comp=connector, rc=rc) @@ -153,7 +158,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! set the driver clock call ESMF_TimeIntervalSet(timeStep, m=15, rc=rc) ! 15 minute steps if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -181,13 +186,13 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- @@ -195,7 +200,7 @@ subroutine SetModelServices(driver, rc) subroutine ModifyCplLists(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables character(len=160) :: msg type(ESMF_CplComp), pointer :: connectorList(:) @@ -203,22 +208,22 @@ subroutine ModifyCplLists(driver, rc) integer :: i, j, cplListSize character(len=160), allocatable :: cplList(:) character(len=160) :: tempString - + rc = ESMF_SUCCESS - + call ESMF_LogWrite("Driver is in ModifyCplLists()", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + nullify(connectorList) call NUOPC_DriverGetComp(driver, compList=connectorList, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + write (msg,*) "Found ", size(connectorList), " Connectors."// & " Modifying CplList Attribute...." call ESMF_LogWrite(trim(msg), ESMF_LOGMSG_INFO, rc=rc) @@ -226,7 +231,7 @@ subroutine ModifyCplLists(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + do i=1, size(connectorList) ! query connector i for its name call NUOPC_CompGet(connectorList(i), name=connectorName, rc=rc) @@ -283,9 +288,9 @@ subroutine ModifyCplLists(driver, rc) deallocate(cplList) endif enddo - + deallocate(connectorList) - + end subroutine !----------------------------------------------------------------------------- diff --git a/AtmOcnCplListProto/esmApp.F90 b/AtmOcnCplListProto/esmApp.F90 index 9226f49a..85a857f3 100644 --- a/AtmOcnCplListProto/esmApp.F90 +++ b/AtmOcnCplListProto/esmApp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -21,14 +21,14 @@ program esmApp integer :: rc, urc type(ESMF_GridComp) :: esmComp - + ! Initialize ESMF call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp STARTING", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -41,7 +41,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! SetServices for the earth system Component call ESMF_GridCompSetServices(esmComp, esmSS, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -52,7 +52,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Initialize for the earth system Component call ESMF_GridCompInitialize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -63,7 +63,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Run for earth the system Component call ESMF_GridCompRun(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -74,7 +74,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Finalize for the earth system Component call ESMF_GridCompFinalize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -85,14 +85,14 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Destroy the earth system Component call ESMF_GridCompDestroy(esmComp, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -101,5 +101,5 @@ program esmApp ! Finalize ESMF call ESMF_Finalize() - -end program + +end program diff --git a/AtmOcnCplListProto/ocn.F90 b/AtmOcnCplListProto/ocn.F90 index 2b2fd46a..d824dce7 100644 --- a/AtmOcnCplListProto/ocn.F90 +++ b/AtmOcnCplListProto/ocn.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,73 +17,78 @@ module OCN use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_SetClock => label_SetClock, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_SetClock, & + call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & specRoutine=SetClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: air_pressure_at_sea_level call NUOPC_Advertise(importState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -91,7 +96,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(importState, & StandardName="surface_net_downward_longwave_flux", name="rsnl", rc=rc) @@ -125,16 +130,15 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut @@ -142,7 +146,15 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) integer :: i,j rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreate1PeriDimUfrm(maxIndex=(/100, 50/), & minCornerCoord=(/0._ESMF_KIND_R8, -60._ESMF_KIND_R8/), & @@ -166,7 +178,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_longwave_flux field = ESMF_FieldCreate(name="rsnl", grid=gridIn, & typekind=ESMF_TYPEKIND_R8, rc=rc) @@ -218,7 +230,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! fill export with some data call ESMF_GridGetCoord(gridOut, coordDim=1, farrayPtr=lonPtr, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -242,26 +254,26 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) enddo end subroutine - + !----------------------------------------------------------------------------- subroutine SetClock(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_TimeInterval) :: stabilityTimeStep rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query the Component for its clock call NUOPC_ModelGet(model, modelClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! initialize internal clock ! here: parent Clock and stability timeStep determine actual model timeStep !TODO: stabilityTimeStep should be read in from configuation @@ -276,15 +288,15 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -298,8 +310,8 @@ subroutine ModelAdvance(model, rc) integer, save :: slice=1 rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -308,14 +320,14 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set in SetClock(), ! its timeStep is likely smaller than the parent timeStep. As a consequence - ! the time interval covered by a single parent timeStep will result in - ! multiple calls to the ModelAdvance() routine. Every time the currTime + ! the time interval covered by a single parent timeStep will result in + ! multiple calls to the Advance() routine. Every time the currTime ! will come in by one internal timeStep advanced. This goes until the ! stopTime of the internal Clock has been reached. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing OCN from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -327,13 +339,13 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_TimePrint(currTime + timeStep, & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -370,7 +382,7 @@ subroutine ModelAdvance(model, rc) enddo enddo endif - + ! write out the Fields in the importState call NUOPC_Write(importState, fileNamePrefix="field_ocn_import_", & timeslice=slice, overwrite=.true., relaxedFlag=.true., rc=rc) @@ -390,4 +402,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnCplSetProto/atm.F90 b/AtmOcnCplSetProto/atm.F90 index b4db7cd3..741c8592 100644 --- a/AtmOcnCplSetProto/atm.F90 +++ b/AtmOcnCplSetProto/atm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -24,70 +24,76 @@ module ATM use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices type(ESMF_State) :: NStateImp1, NStateImp2, NStateImp3 - type(ESMF_State) :: NStateExp1, NStateExp2, NStateExp3 + type(ESMF_State) :: NStateExp1, NStateExp2, NStateExp3 type(ESMF_Grid) :: Domain1, Domain2, Domain3 !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! add nested import states call NUOPC_AddNestedState(importState, & CplSet="Nest1", & @@ -159,7 +165,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: air_pressure_at_sea_level call NUOPC_Advertise(NStateExp1, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -179,7 +185,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(NStateExp1, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -201,22 +207,29 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields Domain1 = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/10, 10/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -424,21 +437,21 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) endif end subroutine - + !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -447,12 +460,12 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set by default, ! its timeStep is equal to the parent timeStep. As a consequence the ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. - + ! for this call of the Advance() routine. + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing ATM from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -464,7 +477,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -479,4 +492,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnCplSetProto/esm.F90 b/AtmOcnCplSetProto/esm.F90 index c39c2003..24b82266 100644 --- a/AtmOcnCplSetProto/esm.F90 +++ b/AtmOcnCplSetProto/esm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,20 +17,19 @@ module ESM use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices - + driverSS => SetServices + use ATM, only: atmSS => SetServices use OCN, only: ocnSS => SetServices - + use NUOPC_Connector, only: cplSS => SetServices - + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -38,24 +37,25 @@ module ESM subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & + + ! specialize driver + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + + ! set driver verbosity call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -69,7 +69,7 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables integer :: localrc type(ESMF_Grid) :: grid @@ -82,7 +82,7 @@ subroutine SetModelServices(driver, rc) type(ESMF_CplComp) :: connector rc = ESMF_SUCCESS - + ! SetServices for ATM call NUOPC_DriverAddComp(driver, "ATM", atmSS, comp=child, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -94,7 +94,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for OCN call NUOPC_DriverAddComp(driver, "OCN", ocnSS, comp=child, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -106,10 +106,10 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! Disabling the following macro, e.g. renaming to WITHCONNECTORS_disable, ! will result in a driver that does not call connectors between the model - ! components. This mode can be used if all model components are driven + ! components. This mode can be used if all model components are driven ! as independent models. However, even for independent models the ! connectors can be set here, but will turn into no-ops. #define WITHCONNECTORS @@ -126,7 +126,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for ocn2atm call NUOPC_DriverAddComp(driver, srcCompLabel="OCN", dstCompLabel="ATM", & compSetServicesRoutine=cplSS, comp=connector, rc=rc) @@ -139,9 +139,9 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + #endif - + ! set the model clock call ESMF_TimeIntervalSet(timeStep, m=10, rc=rc) ! 15 minute steps if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -169,13 +169,15 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnCplSetProto/esmApp.F90 b/AtmOcnCplSetProto/esmApp.F90 index 03794b3e..9e5e2ae8 100644 --- a/AtmOcnCplSetProto/esmApp.F90 +++ b/AtmOcnCplSetProto/esmApp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -21,7 +21,7 @@ program esmApp integer :: rc, urc type(ESMF_GridComp) :: esmComp - + ! Initialize ESMF call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, & defaultCalkind=ESMF_CALKIND_GREGORIAN, rc=rc) @@ -29,7 +29,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp STARTING", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -42,7 +42,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! SetServices for the earth system Component call ESMF_GridCompSetServices(esmComp, esmSS, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -53,7 +53,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Initialize for the earth system Component call ESMF_GridCompInitialize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -64,7 +64,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Run for earth the system Component call ESMF_GridCompRun(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -75,7 +75,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Finalize for the earth system Component call ESMF_GridCompFinalize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -86,14 +86,14 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Destroy the earth system Component call ESMF_GridCompDestroy(esmComp, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -102,5 +102,5 @@ program esmApp ! Finalize ESMF call ESMF_Finalize() - -end program + +end program diff --git a/AtmOcnCplSetProto/ocn.F90 b/AtmOcnCplSetProto/ocn.F90 index bf55ea12..65c5be4a 100644 --- a/AtmOcnCplSetProto/ocn.F90 +++ b/AtmOcnCplSetProto/ocn.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2019, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -24,14 +24,12 @@ module OCN use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_SetClock => label_SetClock, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices type(ESMF_State) :: NStateImp2, NStateImp3 @@ -41,60 +39,67 @@ module OCN !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_SetClock, & + call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & specRoutine=SetClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! add nested import states call NUOPC_AddNestedState(importState, & CplSet="Nest2", & @@ -143,7 +148,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & - return ! bail out + return ! bail out ! importable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(NStateImp2, & @@ -174,23 +179,30 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_TimeInterval) :: stabilityTimeStep type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid objects for Fields Domain2 = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/20, 20/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -250,7 +262,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out endif - + ! importable field: surface_net_downward_shortwave_flux if (NUOPC_IsConnected(NStateImp2, fieldName="rsns", rc=rc)) then field = ESMF_FieldCreate(name="rsns", grid=Domain2, & @@ -332,26 +344,26 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) endif end subroutine - + !----------------------------------------------------------------------------- subroutine SetClock(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_TimeInterval) :: stabilityTimeStep rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock call NUOPC_ModelGet(model, modelClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! initialize internal clock ! here: parent Clock and stability timeStep determine actual model timeStep !TODO: stabilityTimeStep should be read in from configuation @@ -366,15 +378,15 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -383,8 +395,8 @@ subroutine ModelAdvance(model, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -393,14 +405,14 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set in SetClock(), ! its timeStep is likely smaller than the parent timeStep. As a consequence - ! the time interval covered by a single parent timeStep will result in - ! multiple calls to the ModelAdvance() routine. Every time the currTime + ! the time interval covered by a single parent timeStep will result in + ! multiple calls to the Advance() routine. Every time the currTime ! will come in by one internal timeStep advanced. This goes until the ! stopTime of the internal Clock has been reached. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing OCN from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -412,13 +424,13 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_TimePrint(currTime + timeStep, & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -433,4 +445,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnFDSynoProto/atm.F90 b/AtmOcnFDSynoProto/atm.F90 index 273b3aff..1d7ae2c8 100644 --- a/AtmOcnFDSynoProto/atm.F90 +++ b/AtmOcnFDSynoProto/atm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,66 +17,72 @@ module ATM use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! Disabling the following macro, e.g. renaming to WITHIMPORTFIELDS_disable, ! will result in a model component that does not advertise any importable ! Fields. Use this if you want to drive the model independently. @@ -90,7 +96,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out #endif - + ! exportable field: air_pressure_at_sea_level call NUOPC_Advertise(exportState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -98,7 +104,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -108,22 +114,29 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/10, 100/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -178,21 +191,21 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -201,12 +214,12 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set by default, ! its timeStep is equal to the parent timeStep. As a consequence the ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. - + ! for this call of the Advance() routine. + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing ATM from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -218,7 +231,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -233,4 +246,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnFDSynoProto/esm.F90 b/AtmOcnFDSynoProto/esm.F90 index cbfadd01..2364c70c 100644 --- a/AtmOcnFDSynoProto/esm.F90 +++ b/AtmOcnFDSynoProto/esm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,20 +17,19 @@ module ESM use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices - + driverSS => SetServices + use ATM, only: atmSS => SetServices use OCN, only: ocnSS => SetServices - + use NUOPC_Connector, only: cplSS => SetServices - + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -38,24 +37,31 @@ module ESM subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & + + ! specialize driver + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + + ! set driver verbosity + call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + end subroutine !----------------------------------------------------------------------------- @@ -63,7 +69,7 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables type(ESMF_Grid) :: grid type(ESMF_Field) :: field @@ -75,34 +81,34 @@ subroutine SetModelServices(driver, rc) type(ESMF_CplComp) :: connector rc = ESMF_SUCCESS - + ! SetServices for ATM call NUOPC_DriverAddComp(driver, "ATM", atmSS, comp=child, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompAttributeSet(child, name="Verbosity", value="1", rc=rc) + call NUOPC_CompAttributeSet(child, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for OCN call NUOPC_DriverAddComp(driver, "OCN", ocnSS, comp=child, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompAttributeSet(child, name="Verbosity", value="1", rc=rc) + call NUOPC_CompAttributeSet(child, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! Disabling the following macro, e.g. renaming to WITHCONNECTORS_disable, ! will result in a driver that does not call connectors between the model - ! components. This mode can be used if all model components are driven + ! components. This mode can be used if all model components are driven ! as independent models. However, even for independent models the ! connectors can be set here, but will turn into no-ops. #define WITHCONNECTORS @@ -114,12 +120,12 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompAttributeSet(connector, name="Verbosity", value="1", rc=rc) + call NUOPC_CompAttributeSet(connector, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for ocn2atm call NUOPC_DriverAddComp(driver, srcCompLabel="OCN", dstCompLabel="ATM", & compSetServicesRoutine=cplSS, comp=connector, rc=rc) @@ -127,14 +133,14 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompAttributeSet(connector, name="Verbosity", value="1", rc=rc) + call NUOPC_CompAttributeSet(connector, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + #endif - + ! set the driver clock call ESMF_TimeIntervalSet(timeStep, m=15, rc=rc) ! 15 minute steps if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -162,13 +168,15 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnFDSynoProto/esmApp.F90 b/AtmOcnFDSynoProto/esmApp.F90 index 988ec1a4..bc057eac 100644 --- a/AtmOcnFDSynoProto/esmApp.F90 +++ b/AtmOcnFDSynoProto/esmApp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -23,20 +23,20 @@ program esmApp integer :: rc, urc type(ESMF_GridComp) :: esmComp type(NUOPC_FreeFormat) :: freeFormat - + ! Initialize ESMF call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp STARTING", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + !----------------------------------------------------------------------------- ! Setting up and/or modifying the NUOPC field dictionary to be done on the ! application level! @@ -52,7 +52,7 @@ program esmApp file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) endif - + ! set synonym in the NUOPC field dictionary call NUOPC_FieldDictionarySetSyno(standardNames=(/ & "sea_surface_temperature", & @@ -61,14 +61,14 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! egest the NUOPC field dictionary as FreeFormat call NUOPC_FieldDictionaryEgest(freeFormat, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! output the NUOPC field dictionary in FreeFormat to Log call NUOPC_FreeFormatLog(freeFormat, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -76,14 +76,14 @@ program esmApp file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) !----------------------------------------------------------------------------- - + ! Create the earth system Component esmComp = ESMF_GridCompCreate(name="esm", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! SetServices for the earth system Component call ESMF_GridCompSetServices(esmComp, esmSS, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -94,7 +94,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Initialize for the earth system Component call ESMF_GridCompInitialize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -105,7 +105,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Run for earth the system Component call ESMF_GridCompRun(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -116,7 +116,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Finalize for the earth system Component call ESMF_GridCompFinalize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -127,14 +127,14 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Destroy the earth system Component call ESMF_GridCompDestroy(esmComp, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -143,5 +143,5 @@ program esmApp ! Finalize ESMF call ESMF_Finalize() - -end program + +end program diff --git a/AtmOcnFDSynoProto/ocn.F90 b/AtmOcnFDSynoProto/ocn.F90 index 88aa9e00..14b8708d 100644 --- a/AtmOcnFDSynoProto/ocn.F90 +++ b/AtmOcnFDSynoProto/ocn.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,73 +17,78 @@ module OCN use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_SetClock => label_SetClock, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_SetClock, & + call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & specRoutine=SetClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! Disabling the following macro, e.g. renaming to WITHIMPORTFIELDS_disable, ! will result in a model component that does not advertise any importable ! Fields. Use this if you want to drive the model independently. @@ -96,7 +101,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(importState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -115,23 +120,30 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_TimeInterval) :: stabilityTimeStep type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/100, 10/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -157,7 +169,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux field = ESMF_FieldCreate(name="rsns", grid=gridIn, & typekind=ESMF_TYPEKIND_R8, rc=rc) @@ -186,26 +198,26 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- subroutine SetClock(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_TimeInterval) :: stabilityTimeStep rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock call NUOPC_ModelGet(model, modelClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! initialize internal clock ! here: parent Clock and stability timeStep determine actual model timeStep !TODO: stabilityTimeStep should be read in from configuation @@ -220,15 +232,15 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -237,8 +249,8 @@ subroutine ModelAdvance(model, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -247,14 +259,14 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set in SetClock(), ! its timeStep is likely smaller than the parent timeStep. As a consequence - ! the time interval covered by a single parent timeStep will result in - ! multiple calls to the ModelAdvance() routine. Every time the currTime + ! the time interval covered by a single parent timeStep will result in + ! multiple calls to the Advance() routine. Every time the currTime ! will come in by one internal timeStep advanced. This goes until the ! stopTime of the internal Clock has been reached. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing OCN from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -266,13 +278,13 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_TimePrint(currTime + timeStep, & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -287,4 +299,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnIceSimpleImplicitProto/atm.F90 b/AtmOcnIceSimpleImplicitProto/atm.F90 index b286f0c2..e8655aa6 100644 --- a/AtmOcnIceSimpleImplicitProto/atm.F90 +++ b/AtmOcnIceSimpleImplicitProto/atm.F90 @@ -1,25 +1,21 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== -! The ATM Component can either use default IPDv00, if the following macro is -! in the _off state, or use IPDv02 if in the _on state: +! Implement complex data dependency during initialize or not. Macro _on or _off #define WITHCOMPLEXDATADEPENDENCY_on -! When the IPDv02 option is selected, the ATM introduces a more complex -! initialize data dependency with the OCN component. In both modes (_on or _off) -! the OCN component depends on ATM's "pmsl" Field in order to initialize the -! OCN "sst" Field. However, the ATM component in IPDv00 mode does not depend on -! any OCN Fields - both ATM Fields are initialized without requiring valid input -! data Fields from OCN. When turning on Complex-Data-Dependency via the above -! macro, this changes, and the ATM component starts depending on the "sst" OCN -! Field for the initialization of the "rsns" ATM Field. The IPDv02 can handle -! these sort of complex data dependencies during initialize between components. +! In both modes (_on or _off) the OCN component depends on ATM's "pmsl" Field +! in order to initialize the OCN "sst" Field. However, the ATM component in +! (_off) mode does not depend on any OCN Fields - both ATM Fields are +! initialized without requiring valid input data Fields from OCN. When switching +! to _on, the ATM component starts depending on the "sst" OCN Field for the +! initialization of the "rsns" ATM Field. module ATM @@ -30,109 +26,80 @@ module ATM use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & -#ifdef WITHCOMPLEXDATADEPENDENCY_on - model_label_DataInitialize => label_DataInitialize, & -#endif - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - -#ifdef WITHCOMPLEXDATADEPENDENCY_on - ! overwrite the default IPDv00 with IPDv02 - call ESMF_GridCompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - userRoutine=InitializeP0, phase=0, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#endif - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1", "IPDv02p1"/), userRoutine=InitializeP1, rc=rc) + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2", "IPDv02p2"/), userRoutine=InitializeP2, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out #ifdef WITHCOMPLEXDATADEPENDENCY_on - call NUOPC_CompSpecialize(model, specLabel=model_label_DataInitialize, & + call NUOPC_CompSpecialize(model, specLabel=label_DataInitialize, & specRoutine=DataInitialize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out #endif - - end subroutine - - !----------------------------------------------------------------------------- - -#ifdef WITHCOMPLEXDATADEPENDENCY_on - subroutine InitializeP0(model, importState, exportState, clock, rc) - type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - - ! Switch to IPDv02 by filtering all other phaseMap entries - call NUOPC_CompFilterPhaseMap(model, ESMF_METHOD_INITIALIZE, & - acceptStringList=(/"IPDv02p"/), rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine -#endif !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: sea_surface_temperature call NUOPC_Advertise(importState, & StandardName="sea_surface_temperature", name="sst", rc=rc) @@ -140,7 +107,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: sea_surface_salinity call NUOPC_Advertise(importState, & StandardName="sea_surface_salinity", name="sss", rc=rc) @@ -148,7 +115,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: air_pressure_at_sea_level call NUOPC_Advertise(exportState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -156,7 +123,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -166,22 +133,29 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/10, 100/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -247,14 +221,14 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- #ifdef WITHCOMPLEXDATADEPENDENCY_on subroutine DataInitialize(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -263,24 +237,24 @@ subroutine DataInitialize(model, rc) logical :: isUpdated rc = ESMF_SUCCESS - + ! the ATM needs valid OCN export Fields to initialize its internal state - ! query the Component for its clock, importState and exportState + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! get the current time out of the clock call ESMF_ClockGet(clock, currTime=time, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! check that required Fields in the importState show correct timestamp ! -> here only "sst" is needed call ESMF_StateGet(importState, field=field, itemName="sst", rc=rc) @@ -293,7 +267,7 @@ subroutine DataInitialize(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + if (.not.isUpdated) then call ESMF_LogWrite("ATM - Initialize-Data-Dependency NOT YET SATISFIED!!!", & ESMF_LOGMSG_INFO, rc=rc) @@ -308,7 +282,7 @@ subroutine DataInitialize(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - ! -> set Updated Field Attribute to "true", indicating to the IPDv02p5 + ! -> set Updated Field Attribute to "true", indicating to the ! generic code to set the timestamp for this Field call ESMF_StateGet(exportState, field=field, itemName="rsns", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -322,7 +296,7 @@ subroutine DataInitialize(model, rc) file=__FILE__)) & return ! bail out endif - + ! the "pmsl" Field can be initialized without depending on "sst" ! -> set Updated Field Attribute to "true", indicating to the IPDv02p5 ! generic code to set the timestamp for this Field @@ -337,7 +311,7 @@ subroutine DataInitialize(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! check whether all Fields in the exportState are "Updated" if (NUOPC_IsUpdated(exportState)) then ! This simple ATM component is only concerned with marking Fields in @@ -350,24 +324,24 @@ subroutine DataInitialize(model, rc) file=__FILE__)) & return ! bail out endif - + end subroutine #endif !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -376,12 +350,12 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set by default, ! its timeStep is equal to the parent timeStep. As a consequence the ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. - + ! for this call of the Advance() routine. + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing ATM from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -393,7 +367,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -408,4 +382,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnIceSimpleImplicitProto/esm.F90 b/AtmOcnIceSimpleImplicitProto/esm.F90 index 718a3e2f..e090b139 100644 --- a/AtmOcnIceSimpleImplicitProto/esm.F90 +++ b/AtmOcnIceSimpleImplicitProto/esm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -14,7 +14,7 @@ module ESM ! Code that specializes generic ESM Component code. !----------------------------------------------------------------------------- - ! Enabling the followng macro, i.e. setting it to WITHPETLISTS_on, will + ! Enabling the followng macro, i.e. setting it to WITHPETLISTS_on, will ! activate sections of code that demonstrate how ! the ATM and OCN components can run on exclusive sets of PETs. Turning this ! on/off does not affect how the Connector component is specialized. @@ -24,22 +24,20 @@ module ESM use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices, & - driver_label_SetRunSequence => label_SetRunSequence - + driverSS => SetServices + use ATM, only: atmSS => SetServices use OCN, only: ocnSS => SetServices use ICE, only: iceSS => SetServices - + use NUOPC_Connector, only: cplSS => SetServices - + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -47,43 +45,37 @@ module ESM subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & + + ! specialize driver + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetRunSequence, & + call NUOPC_CompSpecialize(driver, specLabel=label_SetRunSequence, & specRoutine=SetRunSequence, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - call NUOPC_CompAttributeSet(driver, name="Verbosity", value="8193", rc=rc) + + ! set driver verbosity + call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out -! call NUOPC_CompAttributeSet(driver, name="Profiling", value="max", & -! rc=rc) -! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & -! line=__LINE__, & -! file=__FILE__)) & -! return ! bail out - - + end subroutine !----------------------------------------------------------------------------- @@ -91,7 +83,7 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables type(ESMF_Grid) :: grid type(ESMF_Field) :: field @@ -105,20 +97,20 @@ subroutine SetModelServices(driver, rc) integer :: petCount, i, iMax(compCount) rc = ESMF_SUCCESS - + ! get the petCount call ESMF_GridCompGet(driver, petCount=petCount, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! find iMax iMax = petCount/compCount do i=1, compCount if (petCount - iMax(i)*compCount >= i) iMax(i) = iMax(i) + 1 enddo - + ! SetServices for ATM call NUOPC_DriverAddComp(driver, "ATM", atmSS, & #ifdef WITHPETLISTS_on @@ -135,7 +127,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for OCN call NUOPC_DriverAddComp(driver, "OCN", ocnSS, & #ifdef WITHPETLISTS_on @@ -152,7 +144,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for ICE call NUOPC_DriverAddComp(driver, "ICE", iceSS, & #ifdef WITHPETLISTS_on @@ -169,7 +161,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! set the driver clock call ESMF_TimeIntervalSet(timeStep, m=15, rc=rc) ! 15 minute steps if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -197,13 +189,13 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- @@ -211,18 +203,18 @@ subroutine SetModelServices(driver, rc) subroutine SetRunSequence(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables character(ESMF_MAXSTR) :: name type(NUOPC_FreeFormat) :: runSeqFF rc = ESMF_SUCCESS - + ! query the driver for its name call ESMF_GridCompGet(driver, name=name, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - + ! set up free format run sequence runSeqFF = NUOPC_FreeFormatCreate(stringList=(/ & " @* ", & diff --git a/AtmOcnIceSimpleImplicitProto/esmApp.F90 b/AtmOcnIceSimpleImplicitProto/esmApp.F90 index b80f7d5c..9e5e2ae8 100644 --- a/AtmOcnIceSimpleImplicitProto/esmApp.F90 +++ b/AtmOcnIceSimpleImplicitProto/esmApp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -21,7 +21,7 @@ program esmApp integer :: rc, urc type(ESMF_GridComp) :: esmComp - + ! Initialize ESMF call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, & defaultCalkind=ESMF_CALKIND_GREGORIAN, rc=rc) @@ -29,7 +29,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp STARTING", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -42,7 +42,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! SetServices for the earth system Component call ESMF_GridCompSetServices(esmComp, esmSS, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -53,7 +53,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Initialize for the earth system Component call ESMF_GridCompInitialize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -64,7 +64,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Run for earth the system Component call ESMF_GridCompRun(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -75,7 +75,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Finalize for the earth system Component call ESMF_GridCompFinalize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -86,14 +86,14 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Destroy the earth system Component call ESMF_GridCompDestroy(esmComp, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -102,5 +102,5 @@ program esmApp ! Finalize ESMF call ESMF_Finalize() - -end program + +end program diff --git a/AtmOcnIceSimpleImplicitProto/ice.F90 b/AtmOcnIceSimpleImplicitProto/ice.F90 index 1d543438..4818adb6 100644 --- a/AtmOcnIceSimpleImplicitProto/ice.F90 +++ b/AtmOcnIceSimpleImplicitProto/ice.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,116 +17,89 @@ module ICE use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_SetClock => label_SetClock, & - model_label_DataInitialize => label_DataInitialize, & - model_label_Advance => label_Advance, & - model_label_CheckImport => label_CheckImport - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! overwrite the default IPDv00 with IPDv02 - call ESMF_GridCompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - userRoutine=InitializeP0, phase=0, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv02p1"/), userRoutine=InitializeP1, rc=rc) + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv02p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & + specRoutine=SetClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_SetClock, & - specRoutine=SetClock, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_DataInitialize, & + specRoutine=DataInitialize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_DataInitialize, & - specRoutine=DataInitialize, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! overwrite default CheckImport method to replace explicit with implement check - call NUOPC_CompSpecialize(model, specLabel=model_label_CheckImport, & + call NUOPC_CompSpecialize(model, specLabel=label_CheckImport, & specRoutine=CheckImport, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP0(model, importState, exportState, clock, rc) - type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - + subroutine Advertise(model, rc) + type(ESMF_GridComp) :: model + integer, intent(out) :: rc + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - ! Switch to IPDv02 by filtering all other phaseMap entries - call NUOPC_CompFilterPhaseMap(model, ESMF_METHOD_INITIALIZE, & - acceptStringList=(/"IPDv02p"/), rc=rc) + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine InitializeP1(model, importState, exportState, clock, rc) - type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - rc = ESMF_SUCCESS ! importable field: air_pressure_at_sea_level call NUOPC_Advertise(importState, & @@ -135,7 +108,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(importState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -151,7 +124,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: sea_surface_salinity call NUOPC_Advertise(exportState, & StandardName="sea_surface_salinity", name="sss", rc=rc) @@ -161,23 +134,29 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - - !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + !----------------------------------------------------------------------------- + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_TimeInterval) :: stabilityTimeStep type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/100, 10/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -202,7 +181,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux field = ESMF_FieldCreate(name="rsns", grid=gridIn, & typekind=ESMF_TYPEKIND_R8, rc=rc) @@ -243,26 +222,26 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- subroutine SetClock(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_TimeInterval) :: stabilityTimeStep rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock call NUOPC_ModelGet(model, modelClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! initialize internal clock ! here: parent Clock and stability timeStep determine actual model timeStep !TODO: stabilityTimeStep should be read in from configuation @@ -277,7 +256,7 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- @@ -285,7 +264,7 @@ subroutine SetClock(model, rc) subroutine DataInitialize(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -294,24 +273,24 @@ subroutine DataInitialize(model, rc) logical :: isUpdated rc = ESMF_SUCCESS - + ! the ICE needs valid ATM export Fields to initialize its internal state - ! query the Component for its clock, importState and exportState + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! get the current time out of the clock call ESMF_ClockGet(clock, currTime=time, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! check that required Fields in the importState show correct timestamp ! -> here only "pmsl" is needed call ESMF_StateGet(importState, field=field, itemName="pmsl", rc=rc) @@ -324,7 +303,7 @@ subroutine DataInitialize(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + if (.not.isUpdated) then call ESMF_LogWrite("ICE - Initialize-Data-Dependency NOT YET SATISFIED!!!", & ESMF_LOGMSG_INFO, rc=rc) @@ -339,8 +318,8 @@ subroutine DataInitialize(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - - ! -> set Updated Field Attribute to "true", indicating to the IPDv02p5 + + ! -> set Updated Field Attribute to "true", indicating to the ! generic code to set the timestamp for this Field call ESMF_StateGet(exportState, field=field, itemName="sss", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -353,9 +332,9 @@ subroutine DataInitialize(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! Since setting the "sss" field was the only thing to be done on the ICE - ! side, the component needs to indicate that it is fully done with + ! side, the component needs to indicate that it is fully done with ! initializing its data: ! -> set InitializeDataComplete Component Attribute to "true", indicating ! to the driver that this Component has fully initialized its data @@ -367,15 +346,15 @@ subroutine DataInitialize(model, rc) return ! bail out endif - + end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -384,8 +363,8 @@ subroutine ModelAdvance(model, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -394,14 +373,14 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set in SetClock(), ! its timeStep is likely smaller than the parent timeStep. As a consequence - ! the time interval covered by a single parent timeStep will result in - ! multiple calls to the ModelAdvance() routine. Every time the currTime + ! the time interval covered by a single parent timeStep will result in + ! multiple calls to the Advance() routine. Every time the currTime ! will come in by one internal timeStep advanced. This goes until the ! stopTime of the internal Clock has been reached. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing ICE from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -413,7 +392,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -429,19 +408,19 @@ subroutine ModelAdvance(model, rc) end subroutine !----------------------------------------------------------------------------- - + subroutine CheckImport(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! This is the routine that enforces the complex time dependence on the - ! import fields. + ! import fields. ! - ! The implicit leap-frog scheme with the ATM component requires import + ! The implicit leap-frog scheme with the ATM component requires import ! fields from ATM to be at stopTime. The explicit coupling with the OCN ! component means that import fields from OCN are checked against the ! currTime. - + ! local variables type(ESMF_Clock) :: clock type(ESMF_Time) :: currTime, stopTime @@ -450,8 +429,8 @@ subroutine CheckImport(model, rc) type(ESMF_Field) :: field rc = ESMF_SUCCESS - - ! query the Component for its clock and importState + + ! query for clock and importState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -464,7 +443,7 @@ subroutine CheckImport(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! ensure fields from ATM are at stopTime call ESMF_StateGet(importState, field=field, itemName="pmsl", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -512,7 +491,7 @@ subroutine CheckImport(model, rc) rcToReturn=rc) return ! bail out endif - + ! ensure fields from OCN are at currTime call ESMF_StateGet(importState, field=field, itemName="sst", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -537,7 +516,7 @@ subroutine CheckImport(model, rc) rcToReturn=rc) return ! bail out endif - + end subroutine !----------------------------------------------------------------------------- diff --git a/AtmOcnIceSimpleImplicitProto/ocn.F90 b/AtmOcnIceSimpleImplicitProto/ocn.F90 index 7e831011..7fb44c8b 100644 --- a/AtmOcnIceSimpleImplicitProto/ocn.F90 +++ b/AtmOcnIceSimpleImplicitProto/ocn.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -22,116 +22,89 @@ module OCN use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_SetClock => label_SetClock, & - model_label_DataInitialize => label_DataInitialize, & - model_label_Advance => label_Advance, & - model_label_CheckImport => label_CheckImport - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! overwrite the default IPDv00 with IPDv02 - call ESMF_GridCompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - userRoutine=InitializeP0, phase=0, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv02p1"/), userRoutine=InitializeP1, rc=rc) + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv02p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & + specRoutine=SetClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_SetClock, & - specRoutine=SetClock, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_DataInitialize, & + specRoutine=DataInitialize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_DataInitialize, & - specRoutine=DataInitialize, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! overwrite default CheckImport method to replace explicit with implement check - call NUOPC_CompSpecialize(model, specLabel=model_label_CheckImport, & + call NUOPC_CompSpecialize(model, specLabel=label_CheckImport, & specRoutine=CheckImport, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP0(model, importState, exportState, clock, rc) - type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - + subroutine Advertise(model, rc) + type(ESMF_GridComp) :: model + integer, intent(out) :: rc + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - ! Switch to IPDv02 by filtering all other phaseMap entries - call NUOPC_CompFilterPhaseMap(model, ESMF_METHOD_INITIALIZE, & - acceptStringList=(/"IPDv02p"/), rc=rc) + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine InitializeP1(model, importState, exportState, clock, rc) - type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - rc = ESMF_SUCCESS ! importable field: air_pressure_at_sea_level call NUOPC_Advertise(importState, & @@ -140,7 +113,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(importState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -156,7 +129,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: sea_surface_temperature call NUOPC_Advertise(exportState, & StandardName="sea_surface_temperature", name="sst", rc=rc) @@ -166,23 +139,30 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_TimeInterval) :: stabilityTimeStep type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/100, 10/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -207,7 +187,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux field = ESMF_FieldCreate(name="rsns", grid=gridIn, & typekind=ESMF_TYPEKIND_R8, rc=rc) @@ -248,26 +228,26 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- subroutine SetClock(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_TimeInterval) :: stabilityTimeStep rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock call NUOPC_ModelGet(model, modelClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! initialize internal clock ! here: parent Clock and stability timeStep determine actual model timeStep !TODO: stabilityTimeStep should be read in from configuation @@ -282,7 +262,7 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- @@ -290,7 +270,7 @@ subroutine SetClock(model, rc) subroutine DataInitialize(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -301,7 +281,7 @@ subroutine DataInitialize(model, rc) integer :: verbosity rc = ESMF_SUCCESS - + ! determine verbosity call NUOPC_CompAttributeGet(model, name="Verbosity", value=valueString, & rc=rc) @@ -318,21 +298,21 @@ subroutine DataInitialize(model, rc) ! the OCN needs valid ATM export Fields to initialize its internal state - ! query the Component for its clock, importState and exportState + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! get the current time out of the clock call ESMF_ClockGet(clock, currTime=time, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! check that required Fields in the importState show correct timestamp ! -> here only "pmsl" is needed call ESMF_StateGet(importState, field=field, itemName="pmsl", rc=rc) @@ -364,8 +344,8 @@ subroutine DataInitialize(model, rc) file=__FILE__)) & return ! bail out endif - - ! -> set Updated Field Attribute to "true", indicating to the IPDv02p5 + + ! -> set Updated Field Attribute to "true", indicating to the ! generic code to set the timestamp for this Field call ESMF_StateGet(exportState, field=field, itemName="sst", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -378,7 +358,7 @@ subroutine DataInitialize(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + #ifdef WITHCOMPLEXDATADEPENDENCY_on ! check that the "rsns" field from the ATM is not yet updated ! if it is, then something is wrong @@ -404,7 +384,7 @@ subroutine DataInitialize(model, rc) #endif ! Since setting the "sst" field was the only thing to be done on the OCN - ! side, the component needs to indicate that it is fully done with + ! side, the component needs to indicate that it is fully done with ! initializing its data: ! -> set InitializeDataComplete Component Attribute to "true", indicating ! to the driver that this Component has fully initialized its data @@ -416,15 +396,15 @@ subroutine DataInitialize(model, rc) return ! bail out endif - + end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -433,8 +413,8 @@ subroutine ModelAdvance(model, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -443,14 +423,14 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set in SetClock(), ! its timeStep is likely smaller than the parent timeStep. As a consequence - ! the time interval covered by a single parent timeStep will result in - ! multiple calls to the ModelAdvance() routine. Every time the currTime + ! the time interval covered by a single parent timeStep will result in + ! multiple calls to the Advance() routine. Every time the currTime ! will come in by one internal timeStep advanced. This goes until the ! stopTime of the internal Clock has been reached. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing OCN from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -462,13 +442,13 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_TimePrint(currTime + timeStep, & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -484,23 +464,23 @@ subroutine ModelAdvance(model, rc) end subroutine !----------------------------------------------------------------------------- - + subroutine CheckImport(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! This is the routine that enforces the complex time dependence on the - ! import fields. + ! import fields. ! ! In the simple case, where OCN leap-frogs with ATM & ICE, _all_ of the OCN - ! import fiels must come into here with timestamps at the stopTime of the - ! Component's internalClock. + ! import fiels must come into here with timestamps at the stopTime of the + ! Component's internalClock. ! ! In the more complex case, OCN leap-frogs with ATM, but has an explicit ! dependency on ICE. Here the timestamps on the fields need to be checked ! individually. Import fields from ATM are checked against stopTime, while ! fields from ICE are checked against currTime - + ! local variables type(ESMF_Clock) :: clock type(ESMF_Time) :: currTime, stopTime @@ -511,8 +491,8 @@ subroutine CheckImport(model, rc) #endif rc = ESMF_SUCCESS - - ! query the Component for its clock and importState + + ! query for clock and importState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -525,7 +505,7 @@ subroutine CheckImport(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + #ifdef OCN_ICE_LEAPFROG_on ! check all fields in the entire state for the same timestamp @@ -535,7 +515,7 @@ subroutine CheckImport(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + if (.not.isAtTimeFlag) then !TODO: introduce and use INCOMPATIBILITY return codes!!!! call ESMF_LogSetError(ESMF_RC_ARG_BAD, & @@ -550,7 +530,7 @@ subroutine CheckImport(model, rc) #else ! need to deal with fields individually - + ! ensure fields from ATM are at stopTime call ESMF_StateGet(importState, field=field, itemName="pmsl", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -598,7 +578,7 @@ subroutine CheckImport(model, rc) rcToReturn=rc) return ! bail out endif - + ! ensure fields from ICE are at currTime call ESMF_StateGet(importState, field=field, itemName="sss", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -623,7 +603,7 @@ subroutine CheckImport(model, rc) rcToReturn=rc) return ! bail out endif - + #endif end subroutine diff --git a/AtmOcnImplicitProto/atm.F90 b/AtmOcnImplicitProto/atm.F90 index 6e7c3379..50965622 100644 --- a/AtmOcnImplicitProto/atm.F90 +++ b/AtmOcnImplicitProto/atm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -26,112 +26,112 @@ module ATM use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_routine_Run => routine_Run, & - model_label_SetClock => label_SetClock, & - model_label_Advance => label_Advance, & - model_label_SetRunClock => label_SetRunClock, & - model_label_CheckImport => label_CheckImport - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - -! RUN: DOWN sweep - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_RUN, & - phaseLabelList=(/"down"/), userRoutine=model_routine_Run, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & + specRoutine=SetClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_SetRunClock, & - specPhaseLabel="down", specRoutine=SetRunClock_down, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - -! RUN: UP sweep + +! RUN: DOWN sweep call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_RUN, & - phaseLabelList=(/"up"/), userRoutine=model_routine_Run, rc=rc) + phaseLabelList=(/"down"/), userRoutine=routine_Run, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_SetRunClock, & - specPhaseLabel="up", specRoutine=SetRunClock_up, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_SetRunClock, & + specPhaseLabel="down", specRoutine=SetRunClock_down, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_CheckImport, & - specPhaseLabel="up", specRoutine=CheckImport_up, rc=rc) + +! RUN: UP sweep + call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_RUN, & + phaseLabelList=(/"up"/), userRoutine=routine_Run, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! phase-independent specializing methods - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_SetRunClock, & + specPhaseLabel="up", specRoutine=SetRunClock_up, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_SetClock, & - specRoutine=SetClock, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_CheckImport, & + specPhaseLabel="up", specRoutine=CheckImport_up, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: sea_surface_temperature call NUOPC_Advertise(importState, & StandardName="sea_surface_temperature", name="sst", rc=rc) @@ -139,7 +139,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: air_pressure_at_sea_level call NUOPC_Advertise(exportState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -147,7 +147,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -157,22 +157,29 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/10, 100/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -225,21 +232,21 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -248,7 +255,7 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing ATM from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -260,7 +267,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -280,7 +287,7 @@ subroutine ModelAdvance(model, rc) subroutine SetRunClock_down(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock, driverClock type(ESMF_Time) :: checkCurrTime, currTime, stopTime @@ -288,14 +295,14 @@ subroutine SetRunClock_down(model, rc) type(ESMF_Direction_Flag) :: direction rc = ESMF_SUCCESS - - ! query component for clock and driver clock + + ! query for clock and driver clock call NUOPC_ModelGet(model, modelClock=clock, driverClock=driverClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! query driver clock for incoming information call ESMF_ClockGet(driverClock, currTime=checkCurrTime, & timeStep=checkTimeStep, direction=direction, rc=rc) @@ -310,7 +317,7 @@ subroutine SetRunClock_down(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! ensure the current times have the correct relationship if (currTime /= checkCurrTime) then call ESMF_LogSetError(ESMF_RC_ARG_BAD, & @@ -321,7 +328,7 @@ subroutine SetRunClock_down(model, rc) rcToReturn=rc) return ! bail out endif - + ! ensure that the driver timestep is a multiple of the component timestep if (ceiling(checkTimeStep/timeStep) /= floor(checkTimeStep/timeStep))& then @@ -333,7 +340,7 @@ subroutine SetRunClock_down(model, rc) rcToReturn=rc) return ! bail out endif - + ! set the new stopTime of the clock if (direction==ESMF_DIRECTION_FORWARD) then stopTime = currTime + checkTimeStep/2 @@ -344,8 +351,8 @@ subroutine SetRunClock_down(model, rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & - return ! bail out - + return ! bail out + end subroutine !----------------------------------------------------------------------------- @@ -353,7 +360,7 @@ subroutine SetRunClock_down(model, rc) subroutine SetRunClock_up(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock, driverClock type(ESMF_Time) :: checkCurrTime, currTime, stopTime @@ -361,14 +368,14 @@ subroutine SetRunClock_up(model, rc) type(ESMF_Direction_Flag) :: direction rc = ESMF_SUCCESS - - ! query component for clock and driver clock + + ! query for clock and driver clock call NUOPC_ModelGet(model, modelClock=clock, driverClock=driverClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! query driver clock for incoming information call ESMF_ClockGet(driverClock, currTime=checkCurrTime, & timeStep=checkTimeStep, direction=direction, rc=rc) @@ -383,7 +390,7 @@ subroutine SetRunClock_up(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! ensure the current times have the correct relationship if (currTime /= checkCurrTime + checkTimeStep/2) then call ESMF_LogSetError(ESMF_RC_ARG_BAD, & @@ -394,7 +401,7 @@ subroutine SetRunClock_up(model, rc) rcToReturn=rc) return ! bail out endif - + ! ensure that the driver timestep is a multiple of the component timestep if (ceiling(checkTimeStep/timeStep) /= floor(checkTimeStep/timeStep))& then @@ -406,7 +413,7 @@ subroutine SetRunClock_up(model, rc) rcToReturn=rc) return ! bail out endif - + ! set the new stopTime of the clock if (direction==ESMF_DIRECTION_FORWARD) then stopTime = currTime + checkTimeStep/2 @@ -417,8 +424,8 @@ subroutine SetRunClock_up(model, rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & - return ! bail out - + return ! bail out + end subroutine !----------------------------------------------------------------------------- @@ -426,11 +433,11 @@ subroutine SetRunClock_up(model, rc) subroutine CheckImport_up(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! This is the routine that enforces the implicit time dependence on the ! import fields: ! timeStamp == stopTime - + ! local variables type(ESMF_Clock) :: clock type(ESMF_Time) :: time @@ -438,8 +445,8 @@ subroutine CheckImport_up(model, rc) logical :: allCorrectTime rc = ESMF_SUCCESS - - ! query the Component for its clock and importState + + ! query for clock and importState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -452,14 +459,14 @@ subroutine CheckImport_up(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! check that Fields in the importState show correct timestamp allCorrectTime = NUOPC_IsAtTime(importState, time, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + if (.not.allCorrectTime) then !TODO: introduce and use INCOMPATIBILITY return codes!!!! call ESMF_LogSetError(ESMF_RC_ARG_BAD, & @@ -469,7 +476,7 @@ subroutine CheckImport_up(model, rc) rcToReturn=rc) return ! bail out endif - + end subroutine !----------------------------------------------------------------------------- @@ -477,20 +484,20 @@ subroutine CheckImport_up(model, rc) subroutine SetClock(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_TimeInterval) :: timeStep rc = ESMF_SUCCESS - - ! query the Component for its clock + + ! query for clock call NUOPC_ModelGet(model, modelClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! initialize internal clock ! - on entry, the component clock is a copy of the parent clock ! - reset the component clock to have a timeStep that is 1/6 of the parent @@ -506,7 +513,7 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- diff --git a/AtmOcnImplicitProto/esm.F90 b/AtmOcnImplicitProto/esm.F90 index 0791264d..1256daca 100644 --- a/AtmOcnImplicitProto/esm.F90 +++ b/AtmOcnImplicitProto/esm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -14,7 +14,7 @@ module ESM ! Code that specializes generic ESM Component code. !----------------------------------------------------------------------------- - ! Enabling the followng macro, i.e. setting it to WITHPETLISTS_on, will + ! Enabling the followng macro, i.e. setting it to WITHPETLISTS_on, will ! activate sections of code that demonstrate how ! the ATM and OCN components can run on exclusive sets of PETs. Turning this ! on/off does not affect how the Connector component is specialized. @@ -23,21 +23,19 @@ module ESM use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices, & - driver_label_SetRunSequence => label_SetRunSequence - + driverSS => SetServices + use ATM, only: atmSS => SetServices use OCN, only: ocnSS => SetServices - + use NUOPC_Connector, only: cplSS => SetServices - + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -45,30 +43,37 @@ module ESM subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & + + ! specialize driver + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetRunSequence, & + call NUOPC_CompSpecialize(driver, specLabel=label_SetRunSequence, & specRoutine=SetRunSequence, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + + ! set driver verbosity + call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + end subroutine !----------------------------------------------------------------------------- @@ -76,7 +81,7 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables type(ESMF_Grid) :: grid type(ESMF_Field) :: field @@ -90,14 +95,14 @@ subroutine SetModelServices(driver, rc) integer, allocatable :: petList(:) rc = ESMF_SUCCESS - + ! get the petCount call ESMF_GridCompGet(driver, petCount=petCount, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for ATM with petList on first half of PETs #ifdef WITHPETLISTS_on allocate(petList(petCount/2)) @@ -122,7 +127,7 @@ subroutine SetModelServices(driver, rc) #ifdef WITHPETLISTS_on deallocate(petList) #endif - + ! SetServices for OCN with petList on second half of PETs #ifdef WITHPETLISTS_on allocate(petList(petCount/2)) @@ -147,7 +152,7 @@ subroutine SetModelServices(driver, rc) #ifdef WITHPETLISTS_on deallocate(petList) #endif - + ! set the driver clock call ESMF_TimeIntervalSet(timeStep, m=15, rc=rc) ! 15 minute steps if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -177,7 +182,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- @@ -185,7 +190,7 @@ subroutine SetModelServices(driver, rc) subroutine SetRunSequence(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables character(ESMF_MAXSTR) :: name type(NUOPC_FreeFormat) :: runSeqFF @@ -195,12 +200,12 @@ subroutine SetRunSequence(driver, rc) type(ESMF_Clock) :: internalClock rc = ESMF_SUCCESS - + ! query the driver for its name call ESMF_GridCompGet(driver, name=name, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - + ! set up free format run sequence runSeqFF = NUOPC_FreeFormatCreate(stringList=(/ & " @* ", & diff --git a/AtmOcnImplicitProto/esmApp.F90 b/AtmOcnImplicitProto/esmApp.F90 index b80f7d5c..9e5e2ae8 100644 --- a/AtmOcnImplicitProto/esmApp.F90 +++ b/AtmOcnImplicitProto/esmApp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -21,7 +21,7 @@ program esmApp integer :: rc, urc type(ESMF_GridComp) :: esmComp - + ! Initialize ESMF call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, & defaultCalkind=ESMF_CALKIND_GREGORIAN, rc=rc) @@ -29,7 +29,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp STARTING", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -42,7 +42,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! SetServices for the earth system Component call ESMF_GridCompSetServices(esmComp, esmSS, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -53,7 +53,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Initialize for the earth system Component call ESMF_GridCompInitialize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -64,7 +64,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Run for earth the system Component call ESMF_GridCompRun(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -75,7 +75,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Finalize for the earth system Component call ESMF_GridCompFinalize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -86,14 +86,14 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Destroy the earth system Component call ESMF_GridCompDestroy(esmComp, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -102,5 +102,5 @@ program esmApp ! Finalize ESMF call ESMF_Finalize() - -end program + +end program diff --git a/AtmOcnImplicitProto/ocn.F90 b/AtmOcnImplicitProto/ocn.F90 index f92d484a..99a058a8 100644 --- a/AtmOcnImplicitProto/ocn.F90 +++ b/AtmOcnImplicitProto/ocn.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -28,19 +28,14 @@ module OCN use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_routine_Run => routine_Run, & - model_label_SetClock => label_SetClock, & - model_label_Advance => label_Advance, & - model_label_SetRunClock => label_SetRunClock, & - model_label_CheckImport => label_CheckImport - + modelSS => SetServices + implicit none - + private - + public SetServices - + type type_InternalStateStruct type(ESMF_Clock) :: slowClock type(ESMF_Clock) :: fastClock @@ -53,112 +48,115 @@ module OCN !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_FINALIZE, & - phaseLabelList=(/""/), userRoutine=Finalize, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & + specRoutine=SetClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_CompSpecialize(model, specLabel=label_Finalize, & + specRoutine=Finalize, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! RUN: FAST call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_RUN, & - phaseLabelList=(/"fast"/), userRoutine=model_routine_Run, rc=rc) + phaseLabelList=(/"fast"/), userRoutine=routine_Run, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_SetRunClock, & + call NUOPC_CompSpecialize(model, specLabel=label_SetRunClock, & specPhaseLabel="fast", specRoutine=SetRunClock_fast, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_CheckImport, & + call NUOPC_CompSpecialize(model, specLabel=label_CheckImport, & specPhaseLabel="fast", specRoutine=CheckImport_fast, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! RUN: slow call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_RUN, & - phaseLabelList=(/"slow"/), userRoutine=model_routine_Run, rc=rc) + phaseLabelList=(/"slow"/), userRoutine=routine_Run, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_SetRunClock, & + call NUOPC_CompSpecialize(model, specLabel=label_SetRunClock, & specPhaseLabel="slow", specRoutine=SetRunClock_slow, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_CheckImport, & + call NUOPC_CompSpecialize(model, specLabel=label_CheckImport, & specPhaseLabel="slow", specRoutine=CheckImport_slow, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - ! phase-independent specializing methods - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_SetClock, & - specRoutine=SetClock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState integer :: stat type(type_InternalState) :: is_local rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: air_pressure_at_sea_level call NUOPC_Advertise(importState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -196,13 +194,12 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_TimeInterval) :: stabilityTimeStep type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn @@ -210,6 +207,14 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/100, 20/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -336,7 +341,7 @@ subroutine SetClock(model, rc) !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc @@ -349,7 +354,7 @@ subroutine ModelAdvance(model, rc) rc = ESMF_SUCCESS - ! query the Component for its clock, importState and exportState + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -362,7 +367,7 @@ subroutine ModelAdvance(model, rc) ! Because of the way that the internal Clock was set in SetClock(), ! its timeStep is likely smaller than the parent timeStep. As a consequence ! the time interval covered by a single parent timeStep will result in - ! multiple calls to the ModelAdvance() routine. Every time the currTime + ! multiple calls to the Advance() routine. Every time the currTime ! will come in by one internal timeStep advanced. This goes until the ! stopTime of the internal Clock has been reached. @@ -464,7 +469,7 @@ subroutine CheckImport_fast(model, rc) rc = ESMF_SUCCESS - ! query the Component for its clock and importState + ! query for clock and importState call ESMF_GridCompGet(model, clock=clock, importState=importState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -563,7 +568,7 @@ subroutine CheckImport_slow(model, rc) rc = ESMF_SUCCESS - ! query the Component for its clock and importState + ! query for clock and importState call ESMF_GridCompGet(model, clock=clock, importState=importState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -598,10 +603,8 @@ subroutine CheckImport_slow(model, rc) !----------------------------------------------------------------------------- - subroutine Finalize(model, importState, exportState, clock, rc) + subroutine Finalize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc ! local variables diff --git a/AtmOcnLndProto/atm.F90 b/AtmOcnLndProto/atm.F90 index 324ef678..0c3ee36c 100644 --- a/AtmOcnLndProto/atm.F90 +++ b/AtmOcnLndProto/atm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,66 +17,72 @@ module ATM use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! Disabling the following macro, e.g. renaming to WITHIMPORTFIELDS_disable, ! will result in a model component that does not advertise any importable ! Fields. Use this if you want to drive the model independently. @@ -90,7 +96,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out #endif - + ! exportable field: air_pressure_at_sea_level call NUOPC_Advertise(exportState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -98,7 +104,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -108,22 +114,29 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/10, 100/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -178,21 +191,21 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -201,12 +214,12 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set by default, ! its timeStep is equal to the parent timeStep. As a consequence the ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. - + ! for this call of the Advance() routine. + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing ATM from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -218,7 +231,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -233,4 +246,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnLndProto/esm.F90 b/AtmOcnLndProto/esm.F90 index d8501c4c..0e4ce9c9 100644 --- a/AtmOcnLndProto/esm.F90 +++ b/AtmOcnLndProto/esm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,22 +17,20 @@ module ESM use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices, & - driver_label_SetRunSequence => label_SetRunSequence - + driverSS => SetServices + use ATM, only: atmSS => SetServices use OCN, only: ocnSS => SetServices use LND, only: lndSS => SetServices - + use NUOPC_Connector, only: cplSS => SetServices - + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -40,32 +38,32 @@ module ESM subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + type(ESMF_Config) :: config rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & + + ! specialize driver + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetRunSequence, & + call NUOPC_CompSpecialize(driver, specLabel=label_SetRunSequence, & specRoutine=SetRunSequence, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! create, open and set the config config = ESMF_ConfigCreate(rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -82,7 +80,14 @@ subroutine SetServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + + ! set driver verbosity + call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + end subroutine !----------------------------------------------------------------------------- @@ -90,7 +95,7 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables type(ESMF_GridComp) :: child type(ESMF_CplComp) :: connector @@ -100,9 +105,9 @@ subroutine SetModelServices(driver, rc) type(ESMF_Clock) :: internalClock type(ESMF_Config) :: config type(NUOPC_FreeFormat) :: attrFF - + rc = ESMF_SUCCESS - + ! read free format driver attributes call ESMF_GridCompGet(driver, config=config, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -114,7 +119,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + #if 1 print *, "-- start FreeFormatPrint(attrFF) of read in attributes --------" call NUOPC_FreeFormatPrint(attrFF, rc=rc) @@ -131,14 +136,14 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! clean-up call NUOPC_FreeFormatDestroy(attrFF, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + #if 1 ! pull out all the Attributes defined on the Driver in FreeFormat @@ -162,7 +167,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + #endif ! SetServices for ATM @@ -196,7 +201,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for OCN call NUOPC_DriverAddComp(driver, "OCN", ocnSS, comp=child, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -228,7 +233,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for LND call NUOPC_DriverAddComp(driver, "LND", lndSS, comp=child, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -263,7 +268,7 @@ subroutine SetModelServices(driver, rc) ! Disabling the following macro, e.g. renaming to WITHCONNECTORS_disable, ! will result in a driver that does not call connectors between the model - ! components. This mode can be used if all model components are driven + ! components. This mode can be used if all model components are driven ! as independent models. However, even for independent models the ! connectors can be set here, but will turn into no-ops. #define WITHCONNECTORS @@ -280,7 +285,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for ocn2atm call NUOPC_DriverAddComp(driver, srcCompLabel="OCN", dstCompLabel="ATM", & compSetServicesRoutine=cplSS, comp=connector, rc=rc) @@ -293,7 +298,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for atm2lnd call NUOPC_DriverAddComp(driver, srcCompLabel="ATM", dstCompLabel="LND", & compSetServicesRoutine=cplSS, comp=connector, rc=rc) @@ -320,7 +325,7 @@ subroutine SetModelServices(driver, rc) file=__FILE__)) & return ! bail out #endif - + ! set the driver clock call ESMF_TimeIntervalSet(timeStep, m=15, rc=rc) ! 15 minute default step if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -346,13 +351,13 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- @@ -360,19 +365,19 @@ subroutine SetModelServices(driver, rc) subroutine SetRunSequence(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables character(ESMF_MAXSTR) :: name type(ESMF_Config) :: config type(NUOPC_FreeFormat) :: runSeqFF rc = ESMF_SUCCESS - + ! query the Component for info call ESMF_GridCompGet(driver, name=name, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - + ! read free format run sequence from config call ESMF_GridCompGet(driver, config=config, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -380,7 +385,7 @@ subroutine SetRunSequence(driver, rc) runSeqFF = NUOPC_FreeFormatCreate(config, label="runSeq::", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - + #if 0 call NUOPC_FreeFormatPrint(runSeqFF, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -391,17 +396,17 @@ subroutine SetRunSequence(driver, rc) call NUOPC_DriverIngestRunSequence(driver, runSeqFF, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - + ! Diagnostic output call NUOPC_DriverPrint(driver, orderflag=.true., rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - + ! clean-up call NUOPC_FreeFormatDestroy(runSeqFF, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - + end subroutine !----------------------------------------------------------------------------- diff --git a/AtmOcnLndProto/esmApp.F90 b/AtmOcnLndProto/esmApp.F90 index b80f7d5c..9e5e2ae8 100644 --- a/AtmOcnLndProto/esmApp.F90 +++ b/AtmOcnLndProto/esmApp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -21,7 +21,7 @@ program esmApp integer :: rc, urc type(ESMF_GridComp) :: esmComp - + ! Initialize ESMF call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, & defaultCalkind=ESMF_CALKIND_GREGORIAN, rc=rc) @@ -29,7 +29,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp STARTING", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -42,7 +42,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! SetServices for the earth system Component call ESMF_GridCompSetServices(esmComp, esmSS, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -53,7 +53,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Initialize for the earth system Component call ESMF_GridCompInitialize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -64,7 +64,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Run for earth the system Component call ESMF_GridCompRun(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -75,7 +75,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Finalize for the earth system Component call ESMF_GridCompFinalize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -86,14 +86,14 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Destroy the earth system Component call ESMF_GridCompDestroy(esmComp, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -102,5 +102,5 @@ program esmApp ! Finalize ESMF call ESMF_Finalize() - -end program + +end program diff --git a/AtmOcnLndProto/lnd.F90 b/AtmOcnLndProto/lnd.F90 index 005edd70..a05fa041 100644 --- a/AtmOcnLndProto/lnd.F90 +++ b/AtmOcnLndProto/lnd.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -16,107 +16,99 @@ module LND use ESMF use NUOPC - use NUOPC_Model, only: & - model_routine_SS => SetServices, & - model_label_SetClock => label_SetClock, & - model_label_Advance => label_Advance - + use NUOPC_Model, & + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - - subroutine SetServices(gcomp, rc) - type(ESMF_GridComp) :: gcomp + + subroutine SetServices(model, rc) + type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(gcomp, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(gcomp, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(gcomp, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(gcomp, specLabel=model_label_SetClock, & + call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & specRoutine=SetClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(gcomp, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(gcomp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: gcomp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock + subroutine Advertise(model, rc) + type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(gcomp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: gcomp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock + subroutine Realize(model, rc) + type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - + end subroutine - + !----------------------------------------------------------------------------- subroutine SetClock(gcomp, rc) type(ESMF_GridComp) :: gcomp integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_TimeInterval) :: stabilityTimeStep rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock call ESMF_GridCompGet(gcomp, clock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! initialize internal clock ! here: parent Clock and stability timeStep determine actual model timeStep !TODO: stabilityTimeStep should be read in from configuation @@ -131,15 +123,15 @@ subroutine SetClock(gcomp, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(gcomp, rc) + subroutine Advance(gcomp, rc) type(ESMF_GridComp) :: gcomp integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -148,8 +140,8 @@ subroutine ModelAdvance(gcomp, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call ESMF_GridCompGet(gcomp, clock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -158,14 +150,14 @@ subroutine ModelAdvance(gcomp, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set in SetClock(), ! its timeStep is likely smaller than the parent timeStep. As a consequence - ! the time interval covered by a single parent timeStep will result in - ! multiple calls to the ModelAdvance() routine. Every time the currTime + ! the time interval covered by a single parent timeStep will result in + ! multiple calls to the Advance() routine. Every time the currTime ! will come in by one internal timeStep advanced. This goes until the ! stopTime of the internal Clock has been reached. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing LND from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -177,13 +169,13 @@ subroutine ModelAdvance(gcomp, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_TimePrint(currTime + timeStep, & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -198,4 +190,6 @@ subroutine ModelAdvance(gcomp, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnLndProto/ocn.F90 b/AtmOcnLndProto/ocn.F90 index 88aa9e00..14b8708d 100644 --- a/AtmOcnLndProto/ocn.F90 +++ b/AtmOcnLndProto/ocn.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,73 +17,78 @@ module OCN use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_SetClock => label_SetClock, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_SetClock, & + call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & specRoutine=SetClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! Disabling the following macro, e.g. renaming to WITHIMPORTFIELDS_disable, ! will result in a model component that does not advertise any importable ! Fields. Use this if you want to drive the model independently. @@ -96,7 +101,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(importState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -115,23 +120,30 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_TimeInterval) :: stabilityTimeStep type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/100, 10/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -157,7 +169,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux field = ESMF_FieldCreate(name="rsns", grid=gridIn, & typekind=ESMF_TYPEKIND_R8, rc=rc) @@ -186,26 +198,26 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- subroutine SetClock(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_TimeInterval) :: stabilityTimeStep rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock call NUOPC_ModelGet(model, modelClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! initialize internal clock ! here: parent Clock and stability timeStep determine actual model timeStep !TODO: stabilityTimeStep should be read in from configuation @@ -220,15 +232,15 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -237,8 +249,8 @@ subroutine ModelAdvance(model, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -247,14 +259,14 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set in SetClock(), ! its timeStep is likely smaller than the parent timeStep. As a consequence - ! the time interval covered by a single parent timeStep will result in - ! multiple calls to the ModelAdvance() routine. Every time the currTime + ! the time interval covered by a single parent timeStep will result in + ! multiple calls to the Advance() routine. Every time the currTime ! will come in by one internal timeStep advanced. This goes until the ! stopTime of the internal Clock has been reached. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing OCN from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -266,13 +278,13 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_TimePrint(currTime + timeStep, & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -287,4 +299,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnLogNoneProto/atm.F90 b/AtmOcnLogNoneProto/atm.F90 index 5e02da27..a1e82a22 100644 --- a/AtmOcnLogNoneProto/atm.F90 +++ b/AtmOcnLogNoneProto/atm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,66 +17,72 @@ module ATM use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! Disabling the following macro, e.g. renaming to WITHIMPORTFIELDS_disable, ! will result in a model component that does not advertise any importable ! Fields. Use this if you want to drive the model independently. @@ -90,7 +96,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out #endif - + ! exportable field: air_pressure_at_sea_level call NUOPC_Advertise(exportState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -98,7 +104,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -108,22 +114,29 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/10, 100/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -135,7 +148,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out gridOut = gridIn ! for now out same as in - + #ifdef WITHIMPORTFIELDS ! importable field: sea_surface_temperature field = ESMF_FieldCreate(name="sst", grid=gridIn, & @@ -178,13 +191,13 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -192,12 +205,12 @@ subroutine ModelAdvance(model, rc) #define NUOPC_TRACE__OFF #ifdef NUOPC_TRACE - call ESMF_TraceRegionEnter("ATM:ModelAdvance") + call ESMF_TraceRegionEnter("ATM:Advance") #endif rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -206,12 +219,12 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set by default, ! its timeStep is equal to the parent timeStep. As a consequence the ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. - + ! for this call of the Advance() routine. + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing ATM from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -223,7 +236,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -237,9 +250,11 @@ subroutine ModelAdvance(model, rc) return ! bail out #ifdef NUOPC_TRACE - call ESMF_TraceRegionExit("ATM:ModelAdvance") + call ESMF_TraceRegionExit("ATM:Advance") #endif - + end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnLogNoneProto/esm.F90 b/AtmOcnLogNoneProto/esm.F90 index cbfadd01..2364c70c 100644 --- a/AtmOcnLogNoneProto/esm.F90 +++ b/AtmOcnLogNoneProto/esm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,20 +17,19 @@ module ESM use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices - + driverSS => SetServices + use ATM, only: atmSS => SetServices use OCN, only: ocnSS => SetServices - + use NUOPC_Connector, only: cplSS => SetServices - + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -38,24 +37,31 @@ module ESM subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & + + ! specialize driver + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + + ! set driver verbosity + call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + end subroutine !----------------------------------------------------------------------------- @@ -63,7 +69,7 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables type(ESMF_Grid) :: grid type(ESMF_Field) :: field @@ -75,34 +81,34 @@ subroutine SetModelServices(driver, rc) type(ESMF_CplComp) :: connector rc = ESMF_SUCCESS - + ! SetServices for ATM call NUOPC_DriverAddComp(driver, "ATM", atmSS, comp=child, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompAttributeSet(child, name="Verbosity", value="1", rc=rc) + call NUOPC_CompAttributeSet(child, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for OCN call NUOPC_DriverAddComp(driver, "OCN", ocnSS, comp=child, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompAttributeSet(child, name="Verbosity", value="1", rc=rc) + call NUOPC_CompAttributeSet(child, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! Disabling the following macro, e.g. renaming to WITHCONNECTORS_disable, ! will result in a driver that does not call connectors between the model - ! components. This mode can be used if all model components are driven + ! components. This mode can be used if all model components are driven ! as independent models. However, even for independent models the ! connectors can be set here, but will turn into no-ops. #define WITHCONNECTORS @@ -114,12 +120,12 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompAttributeSet(connector, name="Verbosity", value="1", rc=rc) + call NUOPC_CompAttributeSet(connector, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for ocn2atm call NUOPC_DriverAddComp(driver, srcCompLabel="OCN", dstCompLabel="ATM", & compSetServicesRoutine=cplSS, comp=connector, rc=rc) @@ -127,14 +133,14 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompAttributeSet(connector, name="Verbosity", value="1", rc=rc) + call NUOPC_CompAttributeSet(connector, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + #endif - + ! set the driver clock call ESMF_TimeIntervalSet(timeStep, m=15, rc=rc) ! 15 minute steps if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -162,13 +168,15 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnLogNoneProto/esmApp.F90 b/AtmOcnLogNoneProto/esmApp.F90 index 5034eba0..caa2a4ab 100644 --- a/AtmOcnLogNoneProto/esmApp.F90 +++ b/AtmOcnLogNoneProto/esmApp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -22,14 +22,14 @@ program esmApp integer :: rc, urc type(ESMF_GridComp) :: esmComp - + ! Initialize ESMF call ESMF_Initialize(logkindflag=ESMF_LOGKIND_NONE, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp STARTING", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -54,7 +54,7 @@ program esmApp file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - ! Set Profiling Attribute + ! Set Profiling Attribute call NUOPC_CompAttributeSet(esmComp, name="Profiling", value="0", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -71,7 +71,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Run for earth the system Component call ESMF_GridCompRun(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -82,7 +82,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Finalize for the earth system Component call ESMF_GridCompFinalize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -93,14 +93,14 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Destroy the earth system Component call ESMF_GridCompDestroy(esmComp, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -111,5 +111,5 @@ program esmApp ! Finalize ESMF call ESMF_Finalize() - -end program + +end program diff --git a/AtmOcnLogNoneProto/ocn.F90 b/AtmOcnLogNoneProto/ocn.F90 index df44b999..afecd02a 100644 --- a/AtmOcnLogNoneProto/ocn.F90 +++ b/AtmOcnLogNoneProto/ocn.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,73 +17,78 @@ module OCN use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_SetClock => label_SetClock, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_SetClock, & + call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & specRoutine=SetClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! Disabling the following macro, e.g. renaming to WITHIMPORTFIELDS_disable, ! will result in a model component that does not advertise any importable ! Fields. Use this if you want to drive the model independently. @@ -96,7 +101,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(importState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -115,23 +120,30 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_TimeInterval) :: stabilityTimeStep type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/100, 10/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -157,7 +169,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux field = ESMF_FieldCreate(name="rsns", grid=gridIn, & typekind=ESMF_TYPEKIND_R8, rc=rc) @@ -186,26 +198,26 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- subroutine SetClock(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_TimeInterval) :: stabilityTimeStep rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock call NUOPC_ModelGet(model, modelClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! initialize internal clock ! here: parent Clock and stability timeStep determine actual model timeStep !TODO: stabilityTimeStep should be read in from configuation @@ -220,15 +232,15 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -238,12 +250,12 @@ subroutine ModelAdvance(model, rc) #define NUOPC_TRACE__OFF #ifdef NUOPC_TRACE - call ESMF_TraceRegionEnter("OCN:ModelAdvance") + call ESMF_TraceRegionEnter("OCN:Advance") #endif - + rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -252,14 +264,14 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set in SetClock(), ! its timeStep is likely smaller than the parent timeStep. As a consequence - ! the time interval covered by a single parent timeStep will result in - ! multiple calls to the ModelAdvance() routine. Every time the currTime + ! the time interval covered by a single parent timeStep will result in + ! multiple calls to the Advance() routine. Every time the currTime ! will come in by one internal timeStep advanced. This goes until the ! stopTime of the internal Clock has been reached. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing OCN from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -271,13 +283,13 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_TimePrint(currTime + timeStep, & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -291,8 +303,10 @@ subroutine ModelAdvance(model, rc) return ! bail out #ifdef NUOPC_TRACE - call ESMF_TraceRegionExit("OCN:ModelAdvance") + call ESMF_TraceRegionExit("OCN:Advance") #endif end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnMedIngestFromConfigProto/atm.F90 b/AtmOcnMedIngestFromConfigProto/atm.F90 index bbd6386f..a4ffea40 100644 --- a/AtmOcnMedIngestFromConfigProto/atm.F90 +++ b/AtmOcnMedIngestFromConfigProto/atm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -16,65 +16,73 @@ module ATM use ESMF use NUOPC - use NUOPC_Model, inheritModel => SetServices - + use NUOPC_Model, & + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, inheritModel, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) call NUOPC_CompSpecialize(model, specLabel=label_Advance, & - specRoutine=ModelAdvance, rc=rc) + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: sea_surface_temperature call NUOPC_Advertise(importState, & StandardName="sea_surface_temperature", name="sst", rc=rc) @@ -82,7 +90,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: air_pressure_at_sea_level call NUOPC_Advertise(exportState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -90,7 +98,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -100,22 +108,29 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/20, 100/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -168,21 +183,21 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -191,12 +206,12 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set by default, ! its timeStep is equal to the parent timeStep. As a consequence the ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. - + ! for this call of the Advance() routine. + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing ATM from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -208,7 +223,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -223,4 +238,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnMedIngestFromConfigProto/esm.F90 b/AtmOcnMedIngestFromConfigProto/esm.F90 index 1fd7a8e9..84a8bbd3 100644 --- a/AtmOcnMedIngestFromConfigProto/esm.F90 +++ b/AtmOcnMedIngestFromConfigProto/esm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -18,20 +18,21 @@ module ESM use ESMF use NUOPC - use NUOPC_Driver, inheritDriver => SetServices - + use NUOPC_Driver, & + driverSS => SetServices + use ATM, only: atmSS => SetServices use OCN, only: ocnSS => SetServices use MED, only: medSS => SetServices - + use NUOPC_Connector, only: cplSS => SetServices - + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -39,33 +40,33 @@ module ESM subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + + ! local variables type(ESMF_Config) :: config rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, inheritDriver, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) + + ! specialize driver call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(driver, specLabel=label_SetRunSequence, & specRoutine=SetRunSequence, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! create, open and set the config config = ESMF_ConfigCreate(rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -82,7 +83,14 @@ subroutine SetServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + + ! set driver verbosity + call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + end subroutine !----------------------------------------------------------------------------- @@ -90,7 +98,7 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables type(ESMF_GridComp) :: child type(ESMF_Time) :: startTime @@ -99,9 +107,9 @@ subroutine SetModelServices(driver, rc) type(ESMF_Clock) :: internalClock type(ESMF_Config) :: config type(NUOPC_FreeFormat) :: attrFF - + rc = ESMF_SUCCESS - + ! read free format driver attributes call ESMF_GridCompGet(driver, config=config, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -125,7 +133,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for ATM call NUOPC_DriverAddComp(driver, "ATM", atmSS, comp=child, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -133,7 +141,7 @@ subroutine SetModelServices(driver, rc) file=__FILE__)) & return ! bail out ! set default ATM attributes - call NUOPC_CompAttributeSet(child, name="Verbosity", value="1", rc=rc) + call NUOPC_CompAttributeSet(child, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -157,7 +165,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for OCN call NUOPC_DriverAddComp(driver, "OCN", ocnSS, comp=child, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -165,7 +173,7 @@ subroutine SetModelServices(driver, rc) file=__FILE__)) & return ! bail out ! set default OCN attributes - call NUOPC_CompAttributeSet(child, name="Verbosity", value="1", rc=rc) + call NUOPC_CompAttributeSet(child, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -189,7 +197,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for MED call NUOPC_DriverAddComp(driver, "MED", medSS, comp=child, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -197,7 +205,7 @@ subroutine SetModelServices(driver, rc) file=__FILE__)) & return ! bail out ! set default MED attributes - call NUOPC_CompAttributeSet(child, name="Verbosity", value="1", rc=rc) + call NUOPC_CompAttributeSet(child, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -230,7 +238,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for ocn2med call NUOPC_DriverAddComp(driver, srcCompLabel="OCN", dstCompLabel="MED", & compSetServicesRoutine=cplSS, rc=rc) @@ -238,7 +246,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for med2atm call NUOPC_DriverAddComp(driver, srcCompLabel="MED", dstCompLabel="ATM", & compSetServicesRoutine=cplSS, rc=rc) @@ -281,7 +289,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -295,7 +303,7 @@ subroutine SetModelServices(driver, rc) subroutine SetRunSequence(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables character(ESMF_MAXSTR) :: name, connName type(ESMF_Config) :: config @@ -304,12 +312,12 @@ subroutine SetRunSequence(driver, rc) integer :: i rc = ESMF_SUCCESS - + ! query the Component for info call ESMF_GridCompGet(driver, name=name, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - + ! read free format run sequence from config call ESMF_GridCompGet(driver, config=config, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -317,7 +325,7 @@ subroutine SetRunSequence(driver, rc) ff = NUOPC_FreeFormatCreate(config, label="runSeq::", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - + #if 1 call NUOPC_FreeFormatLog(ff, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -344,11 +352,11 @@ subroutine SetRunSequence(driver, rc) call NUOPC_FreeFormatDestroy(ff, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - + ! set Verbosity on Connectors no matter how they were added ! also read in potential connector attributes from config nullify(connectorList) - call NUOPC_DriverGetComp(driver, connectorList, rc=rc) + call NUOPC_DriverGetComp(driver, connectorList, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -356,7 +364,7 @@ subroutine SetRunSequence(driver, rc) do i=1, size(connectorList) ! default Verbosity, may be overridden from config below call NUOPC_CompAttributeSet(connectorList(i), name="Verbosity", & - value="4097", rc=rc) + value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -397,7 +405,7 @@ subroutine SetRunSequence(driver, rc) file=__FILE__)) & return ! bail out enddo - + end subroutine !----------------------------------------------------------------------------- diff --git a/AtmOcnMedIngestFromConfigProto/esmApp.F90 b/AtmOcnMedIngestFromConfigProto/esmApp.F90 index b80f7d5c..9e5e2ae8 100644 --- a/AtmOcnMedIngestFromConfigProto/esmApp.F90 +++ b/AtmOcnMedIngestFromConfigProto/esmApp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -21,7 +21,7 @@ program esmApp integer :: rc, urc type(ESMF_GridComp) :: esmComp - + ! Initialize ESMF call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, & defaultCalkind=ESMF_CALKIND_GREGORIAN, rc=rc) @@ -29,7 +29,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp STARTING", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -42,7 +42,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! SetServices for the earth system Component call ESMF_GridCompSetServices(esmComp, esmSS, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -53,7 +53,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Initialize for the earth system Component call ESMF_GridCompInitialize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -64,7 +64,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Run for earth the system Component call ESMF_GridCompRun(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -75,7 +75,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Finalize for the earth system Component call ESMF_GridCompFinalize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -86,14 +86,14 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Destroy the earth system Component call ESMF_GridCompDestroy(esmComp, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -102,5 +102,5 @@ program esmApp ! Finalize ESMF call ESMF_Finalize() - -end program + +end program diff --git a/AtmOcnMedIngestFromConfigProto/med.F90 b/AtmOcnMedIngestFromConfigProto/med.F90 index 814248d2..75b0044d 100644 --- a/AtmOcnMedIngestFromConfigProto/med.F90 +++ b/AtmOcnMedIngestFromConfigProto/med.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -16,72 +16,65 @@ module MED use ESMF use NUOPC - use NUOPC_Mediator, inheritMediator => SetServices - + use NUOPC_Mediator, & + mediatorSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(mediator, rc) type(ESMF_GridComp) :: mediator integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(mediator, inheritMediator, rc=rc) + + ! derive from NUOPC_Mediator + call NUOPC_CompDerive(mediator, mediatorSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(mediator, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize mediator + call NUOPC_CompSpecialize(mediator, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(mediator, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(mediator, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) call NUOPC_CompSpecialize(mediator, specLabel=label_Advance, & - specRoutine=MediatorAdvance, rc=rc) + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) call NUOPC_CompSpecialize(mediator, specLabel=label_CheckImport, & specRoutine=NUOPC_NoOp, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) call NUOPC_CompSpecialize(mediator, specLabel=label_SetRunClock, & specRoutine=SetRunClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - #define TEST_WITH_CONDITIONAL_SENDING_FIELDS_on #ifdef TEST_WITH_CONDITIONAL_SENDING_FIELDS_on - ! attach specializing method(s) call NUOPC_CompSpecialize(mediator, specLabel=label_TimestampExport, & specRoutine=TimestampExport, specPhaseLabel="RunPhase1", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -91,22 +84,29 @@ subroutine SetServices(mediator, rc) #endif end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(mediator, importState, exportState, clock, rc) + subroutine Advertise(mediator, rc) type(ESMF_GridComp) :: mediator - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_State) :: state rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_MediatorGet(mediator, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! do NOT use namespaces for import: - + ! importable field: sea_surface_temperature call NUOPC_Advertise(importState, & StandardName="sea_surface_temperature", name="sst", rc=rc) @@ -114,7 +114,7 @@ subroutine InitializeP1(mediator, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: air_pressure_at_sea_level call NUOPC_Advertise(importState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -122,7 +122,7 @@ subroutine InitializeP1(mediator, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(importState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -154,7 +154,7 @@ subroutine InitializeP1(mediator, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -164,23 +164,30 @@ subroutine InitializeP1(mediator, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(mediator, importState, exportState, clock, rc) + subroutine Realize(mediator, rc) type(ESMF_GridComp) :: mediator - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut type(ESMF_State) :: state - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_MediatorGet(mediator, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/20, 200/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -218,7 +225,7 @@ subroutine InitializeP2(mediator, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux field = ESMF_FieldCreate(name="rsns", grid=gridIn, & typekind=ESMF_TYPEKIND_R8, rc=rc) @@ -278,42 +285,42 @@ subroutine InitializeP2(mediator, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine MediatorAdvance(mediator, rc) + subroutine Advance(mediator, rc) type(ESMF_GridComp) :: mediator integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call ESMF_GridCompGet(mediator, clock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! HERE THE MEDIATOR does the mediation of Fields that come in on the - ! importState with a timestamp consistent to the currTime of the + ! importState with a timestamp consistent to the currTime of the ! mediators Clock. - + ! The Mediator uses the data on the import Fields to update the data ! held by Fields in the exportState. - + ! After this routine returns the generic Mediator will correctly ! timestamp the export Fields at currTime, and update the Mediator Clock to: ! ! currTime -> currTime + timeStep ! ! Where the timeStep is equal to the parent timeStep. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing MED from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -325,7 +332,7 @@ subroutine MediatorAdvance(mediator, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -337,7 +344,7 @@ subroutine MediatorAdvance(mediator, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- @@ -345,21 +352,21 @@ subroutine MediatorAdvance(mediator, rc) subroutine SetRunClock(mediator, rc) type(ESMF_GridComp) :: mediator integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: mediatorClock, driverClock type(ESMF_Time) :: currTime rc = ESMF_SUCCESS - - ! query the Mediator for clocks + + ! query for clocks call NUOPC_MediatorGet(mediator, mediatorClock=mediatorClock, & driverClock=driverClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! set the mediatorClock to have the current start time as the driverClock call ESMF_ClockGet(driverClock, currTime=currTime, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -371,7 +378,7 @@ subroutine SetRunClock(mediator, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! check and set the component clock against the driver clock call NUOPC_CompCheckSetClock(mediator, driverClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, & @@ -387,7 +394,7 @@ subroutine SetRunClock(mediator, rc) subroutine TimestampExport(mediator, rc) type(ESMF_GridComp) :: mediator integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_Time) :: currTime, invalidTime @@ -398,41 +405,41 @@ subroutine TimestampExport(mediator, rc) rc = ESMF_SUCCESS - ! query the Component for info + ! query for info call ESMF_GridCompGet(mediator, name=name, clock=clock, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) & return ! bail out - + ! get info out of clock call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) & return ! bail out - + ! recalc currTime for which mediation really happened, i.e. one timeStep - ! ago (because label_TimestampExport is called _after_ MED Clock is stepped + ! ago (because label_TimestampExport is called _after_ MED Clock is stepped ! forward!). currTime = currTime - timeStep - ! Here is where the TEST_WITH_CONDITIONAL_SENDING_FIELDS_on magic is + ! Here is where the TEST_WITH_CONDITIONAL_SENDING_FIELDS_on magic is ! really implemented. For purpose of demonstraction, every time that the - ! currTime is 30mins past the hour, ONLY send valid fields over to the + ! currTime is 30mins past the hour, ONLY send valid fields over to the ! ATM component. All other times valid fields are sent to ALL components. - + call ESMF_TimeGet(currTime, & yy=yy, mm=mm, dd=dd, h=h, m=m, s=s, ms=ms, us=us, ns=ns, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + if (m==30) then ! 30min past the hour -> only send valid fields to ATM - + ! FIRST: invalidate all of the fields in the exportState, because the - ! generic mediator code will have applied currTime stamp on all of + ! generic mediator code will have applied currTime stamp on all of ! them already. call ESMF_TimeSet(invalidTime, yy=99999999, mm=01, dd=01, & h=00, m=00, s=00, rc=rc) @@ -456,7 +463,7 @@ subroutine TimestampExport(mediator, rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) & return ! bail out - + else ! other times send valid fields to ALL components @@ -465,9 +472,9 @@ subroutine TimestampExport(mediator, rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) & return ! bail out - + endif - + end subroutine !----------------------------------------------------------------------------- diff --git a/AtmOcnMedIngestFromConfigProto/ocn.F90 b/AtmOcnMedIngestFromConfigProto/ocn.F90 index f6d6827d..244e44cd 100644 --- a/AtmOcnMedIngestFromConfigProto/ocn.F90 +++ b/AtmOcnMedIngestFromConfigProto/ocn.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -16,46 +16,45 @@ module OCN use ESMF use NUOPC - use NUOPC_Model, inheritModel => SetServices - + use NUOPC_Model, & + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, inheritModel, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & specRoutine=SetClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -63,13 +62,11 @@ subroutine SetServices(model, rc) file=__FILE__)) & return ! bail out call NUOPC_CompSpecialize(model, specLabel=label_Advance, & - specRoutine=ModelAdvance, rc=rc) + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) call NUOPC_CompSpecialize(model, specLabel=label_CheckImport, & specRoutine=CheckImport, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -78,17 +75,26 @@ subroutine SetServices(model, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: air_pressure_at_sea_level call NUOPC_Advertise(importState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -96,7 +102,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(importState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -114,23 +120,30 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_TimeInterval) :: stabilityTimeStep type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/100, 20/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -155,7 +168,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux field = ESMF_FieldCreate(name="rsns", grid=gridIn, & typekind=ESMF_TYPEKIND_R8, rc=rc) @@ -183,26 +196,26 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- subroutine SetClock(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_TimeInterval) :: stabilityTimeStep rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock call NUOPC_ModelGet(model, modelClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! initialize internal clock ! here: parent Clock and stability timeStep determine actual model timeStep !TODO: stabilityTimeStep should be read in from configuation @@ -217,15 +230,15 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -234,8 +247,8 @@ subroutine ModelAdvance(model, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -244,14 +257,14 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set in SetClock(), ! its timeStep is likely smaller than the parent timeStep. As a consequence - ! the time interval covered by a single parent timeStep will result in - ! multiple calls to the ModelAdvance() routine. Every time the currTime + ! the time interval covered by a single parent timeStep will result in + ! multiple calls to the Advance() routine. Every time the currTime ! will come in by one internal timeStep advanced. This goes until the ! stopTime of the internal Clock has been reached. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing OCN from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -263,13 +276,13 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_TimePrint(currTime + timeStep, & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -289,7 +302,7 @@ subroutine ModelAdvance(model, rc) subroutine CheckImport(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_Time) :: currTime, invalidTime @@ -297,16 +310,16 @@ subroutine CheckImport(model, rc) logical :: timeCheck type(ESMF_Field), pointer :: fieldList(:) integer :: i - + rc = ESMF_SUCCESS - ! query the Component for its clock and importState + ! query for clock and importState call ESMF_GridCompGet(model, clock=clock, importState=importState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! get the current time out of the clock call ESMF_ClockGet(clock, currTime=currTime, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -321,11 +334,11 @@ subroutine CheckImport(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! Loop through all the field in the importState, and test whether they ! are at invalidTime (ignore them for now), or at currTime. Any other ! time coming in would flag an incompatibility. - + nullify(fieldList) call NUOPC_GetStateMemberLists(importState, fieldList=fieldList, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -342,11 +355,11 @@ subroutine CheckImport(model, rc) if (timeCheck) then ! The field is at invalidTime - ! -> In a real application mark the field with a flag as invalid + ! -> In a real application mark the field with a flag as invalid ! so the actual model code can act accordingly. ! Here for purpose of demonstration just log a message and continue on. - + call ESMF_LogWrite("OCN: detected import field at invalidTime", & ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -356,7 +369,7 @@ subroutine CheckImport(model, rc) else ! The field is NOT at invalidTime -> it must then be at currTime or it ! is incompatible! - + ! check that Fields in the importState show correct timestamp timeCheck = NUOPC_IsAtTime(fieldList(i), currTime, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -372,12 +385,12 @@ subroutine CheckImport(model, rc) rcToReturn=rc) return ! bail out endif - + endif enddo - + end subroutine - + !----------------------------------------------------------------------------- end module diff --git a/AtmOcnMedIngestFromInternalProto/atm.F90 b/AtmOcnMedIngestFromInternalProto/atm.F90 index bbd6386f..a4ffea40 100644 --- a/AtmOcnMedIngestFromInternalProto/atm.F90 +++ b/AtmOcnMedIngestFromInternalProto/atm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -16,65 +16,73 @@ module ATM use ESMF use NUOPC - use NUOPC_Model, inheritModel => SetServices - + use NUOPC_Model, & + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, inheritModel, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) call NUOPC_CompSpecialize(model, specLabel=label_Advance, & - specRoutine=ModelAdvance, rc=rc) + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: sea_surface_temperature call NUOPC_Advertise(importState, & StandardName="sea_surface_temperature", name="sst", rc=rc) @@ -82,7 +90,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: air_pressure_at_sea_level call NUOPC_Advertise(exportState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -90,7 +98,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -100,22 +108,29 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/20, 100/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -168,21 +183,21 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -191,12 +206,12 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set by default, ! its timeStep is equal to the parent timeStep. As a consequence the ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. - + ! for this call of the Advance() routine. + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing ATM from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -208,7 +223,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -223,4 +238,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnMedIngestFromInternalProto/esm.F90 b/AtmOcnMedIngestFromInternalProto/esm.F90 index b0ebc89d..dfdda952 100644 --- a/AtmOcnMedIngestFromInternalProto/esm.F90 +++ b/AtmOcnMedIngestFromInternalProto/esm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -18,20 +18,21 @@ module ESM use ESMF use NUOPC - use NUOPC_Driver, inheritDriver => SetServices - + use NUOPC_Driver, & + driverSS => SetServices + use ATM, only: atmSS => SetServices use OCN, only: ocnSS => SetServices use MED, only: medSS => SetServices - + use NUOPC_Connector, only: cplSS => SetServices - + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -39,31 +40,37 @@ module ESM subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, inheritDriver, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) + + ! specialize driver call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(driver, specLabel=label_SetRunSequence, & specRoutine=SetRunSequence, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + + ! set driver verbosity + call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + end subroutine !----------------------------------------------------------------------------- @@ -71,7 +78,7 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables type(ESMF_GridComp) :: child type(ESMF_CplComp) :: connector @@ -82,9 +89,9 @@ subroutine SetModelServices(driver, rc) type(NUOPC_FreeFormat) :: attrFF integer :: verbosity character(len=10) :: attrStr - + rc = ESMF_SUCCESS - + ! set up free format driver attributes attrFF = NUOPC_FreeFormatCreate(stringList=(/ & "Verbosity = 1", & @@ -106,7 +113,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for ATM call NUOPC_DriverAddComp(driver, "ATM", atmSS, comp=child, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -114,12 +121,12 @@ subroutine SetModelServices(driver, rc) file=__FILE__)) & return ! bail out ! set default ATM attributes - call NUOPC_CompAttributeSet(child, name="Verbosity", value="1", rc=rc) + call NUOPC_CompAttributeSet(child, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for OCN call NUOPC_DriverAddComp(driver, "OCN", ocnSS, comp=child, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -127,12 +134,12 @@ subroutine SetModelServices(driver, rc) file=__FILE__)) & return ! bail out ! set default OCN attributes - call NUOPC_CompAttributeSet(child, name="Verbosity", value="1", rc=rc) + call NUOPC_CompAttributeSet(child, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for MED call NUOPC_DriverAddComp(driver, "MED", medSS, comp=child, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -140,7 +147,7 @@ subroutine SetModelServices(driver, rc) file=__FILE__)) & return ! bail out ! set default MED attributes - call NUOPC_CompAttributeSet(child, name="Verbosity", value="1", rc=rc) + call NUOPC_CompAttributeSet(child, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -165,7 +172,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for ocn2med call NUOPC_DriverAddComp(driver, srcCompLabel="OCN", dstCompLabel="MED", & compSetServicesRoutine=cplSS, comp=connector, rc=rc) @@ -179,7 +186,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for med2atm call NUOPC_DriverAddComp(driver, srcCompLabel="MED", dstCompLabel="ATM", & compSetServicesRoutine=cplSS, comp=connector, rc=rc) @@ -234,7 +241,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -248,18 +255,18 @@ subroutine SetModelServices(driver, rc) subroutine SetRunSequence(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables character(ESMF_MAXSTR) :: name type(NUOPC_FreeFormat) :: runSeqFF rc = ESMF_SUCCESS - + ! query the driver for its name call ESMF_GridCompGet(driver, name=name, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - + ! set up free format run sequence runSeqFF = NUOPC_FreeFormatCreate(stringList=(/ & " @1800 ", & @@ -275,7 +282,7 @@ subroutine SetRunSequence(driver, rc) rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - + #if 1 call NUOPC_FreeFormatPrint(runSeqFF, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -302,7 +309,7 @@ subroutine SetRunSequence(driver, rc) call NUOPC_FreeFormatDestroy(runSeqFF, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - + end subroutine !----------------------------------------------------------------------------- diff --git a/AtmOcnMedIngestFromInternalProto/esmApp.F90 b/AtmOcnMedIngestFromInternalProto/esmApp.F90 index b80f7d5c..9e5e2ae8 100644 --- a/AtmOcnMedIngestFromInternalProto/esmApp.F90 +++ b/AtmOcnMedIngestFromInternalProto/esmApp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -21,7 +21,7 @@ program esmApp integer :: rc, urc type(ESMF_GridComp) :: esmComp - + ! Initialize ESMF call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, & defaultCalkind=ESMF_CALKIND_GREGORIAN, rc=rc) @@ -29,7 +29,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp STARTING", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -42,7 +42,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! SetServices for the earth system Component call ESMF_GridCompSetServices(esmComp, esmSS, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -53,7 +53,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Initialize for the earth system Component call ESMF_GridCompInitialize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -64,7 +64,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Run for earth the system Component call ESMF_GridCompRun(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -75,7 +75,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Finalize for the earth system Component call ESMF_GridCompFinalize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -86,14 +86,14 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Destroy the earth system Component call ESMF_GridCompDestroy(esmComp, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -102,5 +102,5 @@ program esmApp ! Finalize ESMF call ESMF_Finalize() - -end program + +end program diff --git a/AtmOcnMedIngestFromInternalProto/med.F90 b/AtmOcnMedIngestFromInternalProto/med.F90 index 0aed284a..75b0044d 100644 --- a/AtmOcnMedIngestFromInternalProto/med.F90 +++ b/AtmOcnMedIngestFromInternalProto/med.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -16,72 +16,65 @@ module MED use ESMF use NUOPC - use NUOPC_Mediator, inheritMediator => SetServices - + use NUOPC_Mediator, & + mediatorSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(mediator, rc) type(ESMF_GridComp) :: mediator integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(mediator, inheritMediator, rc=rc) + + ! derive from NUOPC_Mediator + call NUOPC_CompDerive(mediator, mediatorSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(mediator, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize mediator + call NUOPC_CompSpecialize(mediator, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(mediator, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(mediator, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) call NUOPC_CompSpecialize(mediator, specLabel=label_Advance, & - specRoutine=MediatorAdvance, rc=rc) + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) call NUOPC_CompSpecialize(mediator, specLabel=label_CheckImport, & specRoutine=NUOPC_NoOp, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) call NUOPC_CompSpecialize(mediator, specLabel=label_SetRunClock, & specRoutine=SetRunClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - #define TEST_WITH_CONDITIONAL_SENDING_FIELDS_on #ifdef TEST_WITH_CONDITIONAL_SENDING_FIELDS_on - ! attach specializing method(s) call NUOPC_CompSpecialize(mediator, specLabel=label_TimestampExport, & specRoutine=TimestampExport, specPhaseLabel="RunPhase1", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -91,22 +84,29 @@ subroutine SetServices(mediator, rc) #endif end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(mediator, importState, exportState, clock, rc) + subroutine Advertise(mediator, rc) type(ESMF_GridComp) :: mediator - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_State) :: state rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_MediatorGet(mediator, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! do NOT use namespaces for import: - + ! importable field: sea_surface_temperature call NUOPC_Advertise(importState, & StandardName="sea_surface_temperature", name="sst", rc=rc) @@ -114,7 +114,7 @@ subroutine InitializeP1(mediator, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: air_pressure_at_sea_level call NUOPC_Advertise(importState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -122,7 +122,7 @@ subroutine InitializeP1(mediator, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(importState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -154,7 +154,7 @@ subroutine InitializeP1(mediator, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -164,23 +164,30 @@ subroutine InitializeP1(mediator, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(mediator, importState, exportState, clock, rc) + subroutine Realize(mediator, rc) type(ESMF_GridComp) :: mediator - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut type(ESMF_State) :: state - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_MediatorGet(mediator, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/20, 200/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -218,7 +225,7 @@ subroutine InitializeP2(mediator, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux field = ESMF_FieldCreate(name="rsns", grid=gridIn, & typekind=ESMF_TYPEKIND_R8, rc=rc) @@ -278,42 +285,42 @@ subroutine InitializeP2(mediator, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine MediatorAdvance(mediator, rc) + subroutine Advance(mediator, rc) type(ESMF_GridComp) :: mediator integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call ESMF_GridCompGet(mediator, clock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! HERE THE MEDIATOR does the mediation of Fields that come in on the - ! importState with a timestamp consistent to the currTime of the + ! importState with a timestamp consistent to the currTime of the ! mediators Clock. - + ! The Mediator uses the data on the import Fields to update the data ! held by Fields in the exportState. - + ! After this routine returns the generic Mediator will correctly ! timestamp the export Fields at currTime, and update the Mediator Clock to: ! ! currTime -> currTime + timeStep ! ! Where the timeStep is equal to the parent timeStep. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing MED from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -325,7 +332,7 @@ subroutine MediatorAdvance(mediator, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -345,21 +352,21 @@ subroutine MediatorAdvance(mediator, rc) subroutine SetRunClock(mediator, rc) type(ESMF_GridComp) :: mediator integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: mediatorClock, driverClock type(ESMF_Time) :: currTime rc = ESMF_SUCCESS - - ! query the Mediator for clocks + + ! query for clocks call NUOPC_MediatorGet(mediator, mediatorClock=mediatorClock, & driverClock=driverClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! set the mediatorClock to have the current start time as the driverClock call ESMF_ClockGet(driverClock, currTime=currTime, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -371,7 +378,7 @@ subroutine SetRunClock(mediator, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! check and set the component clock against the driver clock call NUOPC_CompCheckSetClock(mediator, driverClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, & @@ -387,7 +394,7 @@ subroutine SetRunClock(mediator, rc) subroutine TimestampExport(mediator, rc) type(ESMF_GridComp) :: mediator integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_Time) :: currTime, invalidTime @@ -398,41 +405,41 @@ subroutine TimestampExport(mediator, rc) rc = ESMF_SUCCESS - ! query the Component for info + ! query for info call ESMF_GridCompGet(mediator, name=name, clock=clock, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) & return ! bail out - + ! get info out of clock call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) & return ! bail out - + ! recalc currTime for which mediation really happened, i.e. one timeStep - ! ago (because label_TimestampExport is called _after_ MED Clock is stepped + ! ago (because label_TimestampExport is called _after_ MED Clock is stepped ! forward!). currTime = currTime - timeStep - ! Here is where the TEST_WITH_CONDITIONAL_SENDING_FIELDS_on magic is + ! Here is where the TEST_WITH_CONDITIONAL_SENDING_FIELDS_on magic is ! really implemented. For purpose of demonstraction, every time that the - ! currTime is 30mins past the hour, ONLY send valid fields over to the + ! currTime is 30mins past the hour, ONLY send valid fields over to the ! ATM component. All other times valid fields are sent to ALL components. - + call ESMF_TimeGet(currTime, & yy=yy, mm=mm, dd=dd, h=h, m=m, s=s, ms=ms, us=us, ns=ns, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + if (m==30) then ! 30min past the hour -> only send valid fields to ATM - + ! FIRST: invalidate all of the fields in the exportState, because the - ! generic mediator code will have applied currTime stamp on all of + ! generic mediator code will have applied currTime stamp on all of ! them already. call ESMF_TimeSet(invalidTime, yy=99999999, mm=01, dd=01, & h=00, m=00, s=00, rc=rc) @@ -456,7 +463,7 @@ subroutine TimestampExport(mediator, rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) & return ! bail out - + else ! other times send valid fields to ALL components @@ -465,9 +472,9 @@ subroutine TimestampExport(mediator, rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) & return ! bail out - + endif - + end subroutine !----------------------------------------------------------------------------- diff --git a/AtmOcnMedIngestFromInternalProto/ocn.F90 b/AtmOcnMedIngestFromInternalProto/ocn.F90 index f6d6827d..244e44cd 100644 --- a/AtmOcnMedIngestFromInternalProto/ocn.F90 +++ b/AtmOcnMedIngestFromInternalProto/ocn.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -16,46 +16,45 @@ module OCN use ESMF use NUOPC - use NUOPC_Model, inheritModel => SetServices - + use NUOPC_Model, & + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, inheritModel, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & specRoutine=SetClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -63,13 +62,11 @@ subroutine SetServices(model, rc) file=__FILE__)) & return ! bail out call NUOPC_CompSpecialize(model, specLabel=label_Advance, & - specRoutine=ModelAdvance, rc=rc) + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) call NUOPC_CompSpecialize(model, specLabel=label_CheckImport, & specRoutine=CheckImport, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -78,17 +75,26 @@ subroutine SetServices(model, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: air_pressure_at_sea_level call NUOPC_Advertise(importState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -96,7 +102,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(importState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -114,23 +120,30 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_TimeInterval) :: stabilityTimeStep type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/100, 20/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -155,7 +168,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux field = ESMF_FieldCreate(name="rsns", grid=gridIn, & typekind=ESMF_TYPEKIND_R8, rc=rc) @@ -183,26 +196,26 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- subroutine SetClock(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_TimeInterval) :: stabilityTimeStep rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock call NUOPC_ModelGet(model, modelClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! initialize internal clock ! here: parent Clock and stability timeStep determine actual model timeStep !TODO: stabilityTimeStep should be read in from configuation @@ -217,15 +230,15 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -234,8 +247,8 @@ subroutine ModelAdvance(model, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -244,14 +257,14 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set in SetClock(), ! its timeStep is likely smaller than the parent timeStep. As a consequence - ! the time interval covered by a single parent timeStep will result in - ! multiple calls to the ModelAdvance() routine. Every time the currTime + ! the time interval covered by a single parent timeStep will result in + ! multiple calls to the Advance() routine. Every time the currTime ! will come in by one internal timeStep advanced. This goes until the ! stopTime of the internal Clock has been reached. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing OCN from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -263,13 +276,13 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_TimePrint(currTime + timeStep, & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -289,7 +302,7 @@ subroutine ModelAdvance(model, rc) subroutine CheckImport(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_Time) :: currTime, invalidTime @@ -297,16 +310,16 @@ subroutine CheckImport(model, rc) logical :: timeCheck type(ESMF_Field), pointer :: fieldList(:) integer :: i - + rc = ESMF_SUCCESS - ! query the Component for its clock and importState + ! query for clock and importState call ESMF_GridCompGet(model, clock=clock, importState=importState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! get the current time out of the clock call ESMF_ClockGet(clock, currTime=currTime, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -321,11 +334,11 @@ subroutine CheckImport(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! Loop through all the field in the importState, and test whether they ! are at invalidTime (ignore them for now), or at currTime. Any other ! time coming in would flag an incompatibility. - + nullify(fieldList) call NUOPC_GetStateMemberLists(importState, fieldList=fieldList, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -342,11 +355,11 @@ subroutine CheckImport(model, rc) if (timeCheck) then ! The field is at invalidTime - ! -> In a real application mark the field with a flag as invalid + ! -> In a real application mark the field with a flag as invalid ! so the actual model code can act accordingly. ! Here for purpose of demonstration just log a message and continue on. - + call ESMF_LogWrite("OCN: detected import field at invalidTime", & ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -356,7 +369,7 @@ subroutine CheckImport(model, rc) else ! The field is NOT at invalidTime -> it must then be at currTime or it ! is incompatible! - + ! check that Fields in the importState show correct timestamp timeCheck = NUOPC_IsAtTime(fieldList(i), currTime, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -372,12 +385,12 @@ subroutine CheckImport(model, rc) rcToReturn=rc) return ! bail out endif - + endif enddo - + end subroutine - + !----------------------------------------------------------------------------- end module diff --git a/AtmOcnMedPetListProto/atm.F90 b/AtmOcnMedPetListProto/atm.F90 index 462a0d0f..a4ffea40 100644 --- a/AtmOcnMedPetListProto/atm.F90 +++ b/AtmOcnMedPetListProto/atm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,66 +17,72 @@ module ATM use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: sea_surface_temperature call NUOPC_Advertise(importState, & StandardName="sea_surface_temperature", name="sst", rc=rc) @@ -84,7 +90,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: air_pressure_at_sea_level call NUOPC_Advertise(exportState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -92,7 +98,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -102,22 +108,29 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/20, 100/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -170,21 +183,21 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -193,12 +206,12 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set by default, ! its timeStep is equal to the parent timeStep. As a consequence the ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. - + ! for this call of the Advance() routine. + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing ATM from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -210,7 +223,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -225,4 +238,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnMedPetListProto/esm.F90 b/AtmOcnMedPetListProto/esm.F90 index 9a88995a..2df6352f 100644 --- a/AtmOcnMedPetListProto/esm.F90 +++ b/AtmOcnMedPetListProto/esm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,22 +17,20 @@ module ESM use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices, & - driver_label_SetRunSequence => label_SetRunSequence - + driverSS => SetServices + use ATM, only: atmSS => SetServices use OCN, only: ocnSS => SetServices use MED, only: medSS => SetServices - + use NUOPC_Connector, only: cplSS => SetServices - + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -40,30 +38,37 @@ module ESM subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & + + ! specialize driver + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetRunSequence, & + call NUOPC_CompSpecialize(driver, specLabel=label_SetRunSequence, & specRoutine=SetRunSequence, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + + ! set driver verbosity + call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + end subroutine !----------------------------------------------------------------------------- @@ -71,7 +76,7 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables type(ESMF_Time) :: startTime type(ESMF_Time) :: stopTime @@ -83,14 +88,14 @@ subroutine SetModelServices(driver, rc) type(ESMF_CplComp) :: connector rc = ESMF_SUCCESS - + ! get the petCount call ESMF_GridCompGet(driver, petCount=petCount, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for ATM allocate(petList(petCount/2-1)) do i=1, petCount/2-1 @@ -103,12 +108,12 @@ subroutine SetModelServices(driver, rc) file=__FILE__)) & return ! bail out deallocate(petList) - call NUOPC_CompAttributeSet(child, name="Verbosity", value="1", rc=rc) + call NUOPC_CompAttributeSet(child, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for OCN allocate(petList(petCount/2-1)) do i=1, petCount/2-1 @@ -121,7 +126,7 @@ subroutine SetModelServices(driver, rc) file=__FILE__)) & return ! bail out deallocate(petList) - call NUOPC_CompAttributeSet(child, name="Verbosity", value="1", rc=rc) + call NUOPC_CompAttributeSet(child, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -133,7 +138,7 @@ subroutine SetModelServices(driver, rc) ! neither in size, nor the PETs that are included. ! In this example the petList for MED is set to some crazy combination, ! just to show that it can basically be set to anything: - ! -> first PET of each ATM and OCN and the two missed PETs + ! -> first PET of each ATM and OCN and the two missed PETs ! -> kind of strange, but hey this is just a feature demo allocate(petList(4)) ! makes 4 total PETs in the petList petList(1) = 0 @@ -147,7 +152,7 @@ subroutine SetModelServices(driver, rc) file=__FILE__)) & return ! bail out deallocate(petList) - call NUOPC_CompAttributeSet(child, name="Verbosity", value="1", rc=rc) + call NUOPC_CompAttributeSet(child, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -180,7 +185,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- @@ -188,18 +193,18 @@ subroutine SetModelServices(driver, rc) subroutine SetRunSequence(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables character(ESMF_MAXSTR) :: name type(NUOPC_FreeFormat) :: runSeqFF rc = ESMF_SUCCESS - + ! query the driver for its name call ESMF_GridCompGet(driver, name=name, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - + ! set up free format run sequence runSeqFF = NUOPC_FreeFormatCreate(stringList=(/ & " @* ", & diff --git a/AtmOcnMedPetListProto/esmApp.F90 b/AtmOcnMedPetListProto/esmApp.F90 index b80f7d5c..9e5e2ae8 100644 --- a/AtmOcnMedPetListProto/esmApp.F90 +++ b/AtmOcnMedPetListProto/esmApp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -21,7 +21,7 @@ program esmApp integer :: rc, urc type(ESMF_GridComp) :: esmComp - + ! Initialize ESMF call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, & defaultCalkind=ESMF_CALKIND_GREGORIAN, rc=rc) @@ -29,7 +29,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp STARTING", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -42,7 +42,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! SetServices for the earth system Component call ESMF_GridCompSetServices(esmComp, esmSS, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -53,7 +53,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Initialize for the earth system Component call ESMF_GridCompInitialize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -64,7 +64,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Run for earth the system Component call ESMF_GridCompRun(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -75,7 +75,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Finalize for the earth system Component call ESMF_GridCompFinalize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -86,14 +86,14 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Destroy the earth system Component call ESMF_GridCompDestroy(esmComp, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -102,5 +102,5 @@ program esmApp ! Finalize ESMF call ESMF_Finalize() - -end program + +end program diff --git a/AtmOcnMedPetListProto/med.F90 b/AtmOcnMedPetListProto/med.F90 index f8ce7484..570cfd5a 100644 --- a/AtmOcnMedPetListProto/med.F90 +++ b/AtmOcnMedPetListProto/med.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -16,67 +16,73 @@ module MED use ESMF use NUOPC - use NUOPC_Mediator, only: & - model_routine_SS => SetServices, & - model_label_Advance => label_Advance - + use NUOPC_Mediator, & + mediatorSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(mediator, rc) type(ESMF_GridComp) :: mediator integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(mediator, model_routine_SS, rc=rc) + + ! derive from NUOPC_Mediator + call NUOPC_CompDerive(mediator, mediatorSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(mediator, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize mediator + call NUOPC_CompSpecialize(mediator, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(mediator, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(mediator, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(mediator, specLabel=model_label_Advance, & - specRoutine=MediatorAdvance, rc=rc) + call NUOPC_CompSpecialize(mediator, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(mediator, importState, exportState, clock, rc) + subroutine Advertise(mediator, rc) type(ESMF_GridComp) :: mediator - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_MediatorGet(mediator, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: sea_surface_temperature call NUOPC_Advertise(importState, & StandardName="sea_surface_temperature", name="sst", rc=rc) @@ -84,7 +90,7 @@ subroutine InitializeP1(mediator, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: air_pressure_at_sea_level call NUOPC_Advertise(importState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -92,7 +98,7 @@ subroutine InitializeP1(mediator, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(importState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -116,7 +122,7 @@ subroutine InitializeP1(mediator, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -126,22 +132,29 @@ subroutine InitializeP1(mediator, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(mediator, importState, exportState, clock, rc) + subroutine Realize(mediator, rc) type(ESMF_GridComp) :: mediator - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_MediatorGet(mediator, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/20, 200/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -179,7 +192,7 @@ subroutine InitializeP2(mediator, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux field = ESMF_FieldCreate(name="rsns", grid=gridIn, & typekind=ESMF_TYPEKIND_R8, rc=rc) @@ -233,42 +246,42 @@ subroutine InitializeP2(mediator, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine MediatorAdvance(mediator, rc) + subroutine Advance(mediator, rc) type(ESMF_GridComp) :: mediator integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call ESMF_GridCompGet(mediator, clock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! HERE THE MEDIATOR does the mediation of Fields that come in on the - ! importState with a timestamp consistent to the currTime of the + ! importState with a timestamp consistent to the currTime of the ! mediators Clock. - + ! The Mediator uses the data on the import Fields to update the data ! held by Fields in the exportState. - + ! After this routine returns the generic Mediator will correctly ! timestamp the export Fields at currTime, and update the Mediator Clock to: ! ! currTime -> currTime + timeStep ! ! Where the timeStep is equal to the parent timeStep. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing MED from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -280,7 +293,7 @@ subroutine MediatorAdvance(mediator, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -295,4 +308,6 @@ subroutine MediatorAdvance(mediator, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnMedPetListProto/ocn.F90 b/AtmOcnMedPetListProto/ocn.F90 index 4043e256..57880baa 100644 --- a/AtmOcnMedPetListProto/ocn.F90 +++ b/AtmOcnMedPetListProto/ocn.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,73 +17,78 @@ module OCN use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_SetClock => label_SetClock, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_SetClock, & + call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & specRoutine=SetClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: air_pressure_at_sea_level call NUOPC_Advertise(importState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -91,7 +96,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(importState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -109,23 +114,29 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables - type(ESMF_TimeInterval) :: stabilityTimeStep + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/100, 20/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -150,7 +161,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux field = ESMF_FieldCreate(name="rsns", grid=gridIn, & typekind=ESMF_TYPEKIND_R8, rc=rc) @@ -178,26 +189,26 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- subroutine SetClock(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_TimeInterval) :: stabilityTimeStep rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock call NUOPC_ModelGet(model, modelClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! initialize internal clock ! here: parent Clock and stability timeStep determine actual model timeStep !TODO: stabilityTimeStep should be read in from configuation @@ -212,15 +223,15 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -229,8 +240,8 @@ subroutine ModelAdvance(model, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -239,14 +250,14 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set in SetClock(), ! its timeStep is likely smaller than the parent timeStep. As a consequence - ! the time interval covered by a single parent timeStep will result in - ! multiple calls to the ModelAdvance() routine. Every time the currTime + ! the time interval covered by a single parent timeStep will result in + ! multiple calls to the Advance() routine. Every time the currTime ! will come in by one internal timeStep advanced. This goes until the ! stopTime of the internal Clock has been reached. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing OCN from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -258,13 +269,13 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_TimePrint(currTime + timeStep, & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -279,4 +290,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnMedPetListTimescalesProto/atm.F90 b/AtmOcnMedPetListTimescalesProto/atm.F90 index 897782be..dee33710 100644 --- a/AtmOcnMedPetListTimescalesProto/atm.F90 +++ b/AtmOcnMedPetListTimescalesProto/atm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,73 +17,78 @@ module ATM use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_SetClock => label_SetClock, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_SetClock, & + call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & specRoutine=SetClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: sea_surface_temperature call NUOPC_Advertise(importState, & StandardName="sea_surface_temperature", name="sst", rc=rc) @@ -91,7 +96,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: air_pressure_at_sea_level call NUOPC_Advertise(exportState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -99,7 +104,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -109,22 +114,29 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/20, 100/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -177,30 +189,30 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- subroutine SetClock(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_TimeInterval) :: stabilityTimeStep rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock call NUOPC_ModelGet(model, modelClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! by default, the modelClock is a copy of the driverClock - ! here is the place to adjust the timeStep if it does not depend on + ! here is the place to adjust the timeStep if it does not depend on ! the driverClock handed to the model during run sequence execution - + ! here: parent Clock and stability timeStep determine actual model timeStep !TODO: stabilityTimeStep should be read in from configuation !TODO: or computed from internal Grid information @@ -214,23 +226,23 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -239,12 +251,12 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set by default, ! its timeStep is equal to the parent timeStep. As a consequence the ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. - + ! for this call of the Advance() routine. + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing ATM from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -256,7 +268,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -271,4 +283,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnMedPetListTimescalesProto/esm.F90 b/AtmOcnMedPetListTimescalesProto/esm.F90 index 32d0d5c8..d539cd40 100644 --- a/AtmOcnMedPetListTimescalesProto/esm.F90 +++ b/AtmOcnMedPetListTimescalesProto/esm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,22 +17,20 @@ module ESM use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices, & - driver_label_SetRunSequence => label_SetRunSequence - + driverSS => SetServices + use ATM, only: atmSS => SetServices use OCN, only: ocnSS => SetServices use MED, only: medSS => SetServices - + use NUOPC_Connector, only: cplSS => SetServices - + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -40,30 +38,37 @@ module ESM subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & + + ! specialize driver + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetRunSequence, & + call NUOPC_CompSpecialize(driver, specLabel=label_SetRunSequence, & specRoutine=SetRunSequence, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + + ! set driver verbosity + call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + end subroutine !----------------------------------------------------------------------------- @@ -71,7 +76,7 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables character(ESMF_MAXSTR) :: name type(ESMF_Time) :: startTime @@ -85,7 +90,7 @@ subroutine SetModelServices(driver, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - + ! query the driver for its name and petCount call ESMF_GridCompGet(driver, name=name, petCount=petCount, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -104,7 +109,7 @@ subroutine SetModelServices(driver, rc) call NUOPC_CompAttributeSet(child, name="Verbosity", value="1", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - + ! SetServices for OCN allocate(petList(petCount/2-1)) do i=1, petCount/2-1 @@ -150,7 +155,7 @@ subroutine SetModelServices(driver, rc) call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - + ! log the timeStep interval call ESMF_TimeIntervalGet(timeStep, m=minutes, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -160,7 +165,7 @@ subroutine SetModelServices(driver, rc) call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - + end subroutine !----------------------------------------------------------------------------- @@ -168,7 +173,7 @@ subroutine SetModelServices(driver, rc) subroutine SetRunSequence(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables character(ESMF_MAXSTR) :: name type(NUOPC_FreeFormat) :: runSeqFF @@ -180,12 +185,12 @@ subroutine SetRunSequence(driver, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - + ! query the driver for its name call ESMF_GridCompGet(driver, name=name, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - + ! set up free format run sequence runSeqFF = NUOPC_FreeFormatCreate(stringList=(/ & " @* ", & @@ -235,7 +240,7 @@ subroutine SetRunSequence(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! log the timeStep interval call ESMF_TimeIntervalGet(timeStep/2, m=minutes, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & diff --git a/AtmOcnMedPetListTimescalesProto/esmApp.F90 b/AtmOcnMedPetListTimescalesProto/esmApp.F90 index b80f7d5c..9e5e2ae8 100644 --- a/AtmOcnMedPetListTimescalesProto/esmApp.F90 +++ b/AtmOcnMedPetListTimescalesProto/esmApp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -21,7 +21,7 @@ program esmApp integer :: rc, urc type(ESMF_GridComp) :: esmComp - + ! Initialize ESMF call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, & defaultCalkind=ESMF_CALKIND_GREGORIAN, rc=rc) @@ -29,7 +29,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp STARTING", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -42,7 +42,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! SetServices for the earth system Component call ESMF_GridCompSetServices(esmComp, esmSS, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -53,7 +53,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Initialize for the earth system Component call ESMF_GridCompInitialize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -64,7 +64,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Run for earth the system Component call ESMF_GridCompRun(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -75,7 +75,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Finalize for the earth system Component call ESMF_GridCompFinalize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -86,14 +86,14 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Destroy the earth system Component call ESMF_GridCompDestroy(esmComp, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -102,5 +102,5 @@ program esmApp ! Finalize ESMF call ESMF_Finalize() - -end program + +end program diff --git a/AtmOcnMedPetListTimescalesProto/med.F90 b/AtmOcnMedPetListTimescalesProto/med.F90 index 783df9c3..c2d3bd55 100644 --- a/AtmOcnMedPetListTimescalesProto/med.F90 +++ b/AtmOcnMedPetListTimescalesProto/med.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -12,25 +12,19 @@ module MED !----------------------------------------------------------------------------- ! Mediator Component. - ! This mediator operates on two timescales and keeps two internal Clocks to + ! This mediator operates on two timescales and keeps two internal Clocks to ! do so. !----------------------------------------------------------------------------- use ESMF use NUOPC - use NUOPC_Mediator, only: & - mediator_routine_SS => SetServices, & - mediator_routine_Run => routine_Run, & - mediator_label_Advance => label_Advance, & - mediator_label_CheckImport => label_CheckImport, & - mediator_label_TimestampExport => label_TimestampExport, & - mediator_label_SetRunClock => label_SetRunClock, & - NUOPC_MediatorGet - + use NUOPC_Mediator, & + mediatorSS => SetServices + implicit none - + private - + ! private internal state to keep instance data type InternalStateStruct type(ESMF_Clock) :: clockSlow @@ -42,97 +36,106 @@ module MED end type public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(mediator, rc) type(ESMF_GridComp) :: mediator integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(mediator, mediator_routine_SS, rc=rc) + + ! derive from NUOPC_Mediator + call NUOPC_CompDerive(mediator, mediatorSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(mediator, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize mediator + call NUOPC_CompSpecialize(mediator, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(mediator, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(mediator, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! slow Mediation phase with OCN (use the default "RunPhase1" for slow) - call NUOPC_CompSpecialize(mediator, specLabel=mediator_label_SetRunClock, & + call NUOPC_CompSpecialize(mediator, specLabel=label_SetRunClock, & specPhaseLabel="RunPhase1", specRoutine=SetRunClock_slow, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(mediator, specLabel=mediator_label_Advance, & - specPhaseLabel="RunPhase1", specRoutine=MediatorAdvance_slow, rc=rc) + call NUOPC_CompSpecialize(mediator, specLabel=label_Advance, & + specPhaseLabel="RunPhase1", specRoutine=Advance_slow, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! fast Mediation phase with ATM call NUOPC_CompSetEntryPoint(mediator, ESMF_METHOD_RUN, & - phaseLabelList=(/"RunPhaseFast"/), userRoutine=mediator_routine_Run, & + phaseLabelList=(/"RunPhaseFast"/), userRoutine=routine_Run, & rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(mediator, specLabel=mediator_label_SetRunClock, & + call NUOPC_CompSpecialize(mediator, specLabel=label_SetRunClock, & specPhaseLabel="RunPhaseFast", specRoutine=SetRunClock_fast, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(mediator, specLabel=mediator_label_CheckImport, & + call NUOPC_CompSpecialize(mediator, specLabel=label_CheckImport, & specPhaseLabel="RunPhaseFast", specRoutine=CheckImport_fast, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(mediator, specLabel=mediator_label_TimestampExport, & + call NUOPC_CompSpecialize(mediator, specLabel=label_TimestampExport, & specPhaseLabel="RunPhaseFast", specRoutine=TimestampExport_fast, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(mediator, specLabel=mediator_label_Advance, & - specPhaseLabel="RunPhaseFast", specRoutine=MediatorAdvance_fast, rc=rc) + call NUOPC_CompSpecialize(mediator, specLabel=label_Advance, & + specPhaseLabel="RunPhaseFast", specRoutine=Advance_fast, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(mediator, importState, exportState, clock, rc) + subroutine Advertise(mediator, rc) type(ESMF_GridComp) :: mediator - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_MediatorGet(mediator, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: sea_surface_temperature call NUOPC_Advertise(importState, & StandardName="sea_surface_temperature", name="sst", rc=rc) @@ -140,7 +143,7 @@ subroutine InitializeP1(mediator, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: air_pressure_at_sea_level call NUOPC_Advertise(importState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -148,7 +151,7 @@ subroutine InitializeP1(mediator, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(importState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -172,7 +175,7 @@ subroutine InitializeP1(mediator, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -182,16 +185,16 @@ subroutine InitializeP1(mediator, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(mediator, importState, exportState, clock, rc) + subroutine Realize(mediator, rc) type(ESMF_GridComp) :: mediator - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState + type(ESMF_Clock) :: clock type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut @@ -200,7 +203,15 @@ subroutine InitializeP2(mediator, importState, exportState, clock, rc) type(ESMF_TimeInterval) :: timeStep rc = ESMF_SUCCESS - + + ! query for driverClock, importState and exportState + call NUOPC_MediatorGet(mediator, driverClock=clock, & + importState=importState, exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/20, 200/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -238,7 +249,7 @@ subroutine InitializeP2(mediator, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux field = ESMF_FieldCreate(name="rsns", grid=gridIn, & typekind=ESMF_TYPEKIND_R8, rc=rc) @@ -290,15 +301,15 @@ subroutine InitializeP2(mediator, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! The Fields in the exportState are going to be correctly timestamped by - ! the generic code. However, the Fields in the importState are not + ! the generic code. However, the Fields in the importState are not ! automatically time stamped. Instead it is expected that the customized ! initialization takes care of this aspect. Here just "blindly" time stamp ! the Fields in the importState, indicating to the first Run method that ! all is good. - - call NUOPC_SetTimestamp(importState, clock=clock, rc=rc) + + call NUOPC_SetTimestamp(importState, clock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -316,7 +327,7 @@ subroutine InitializeP2(mediator, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! Initialize the internal clocks: both slow and fast start as copies of in is%wrap%clockSlow = ESMF_ClockCreate(clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -350,21 +361,21 @@ subroutine InitializeP2(mediator, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + end subroutine - + !----------------------------------------------------------------------------- subroutine SetRunClock_slow(mediator, rc) type(ESMF_GridComp) :: mediator integer, intent(out) :: rc - + ! local variables type(InternalState) :: is type(ESMF_Clock) :: driverClock rc = ESMF_SUCCESS - + ! query component for its internal state nullify(is%wrap) call ESMF_GridCompGetInternalState(mediator, is, rc) @@ -379,14 +390,14 @@ subroutine SetRunClock_slow(mediator, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! query component for the driver Clock call NUOPC_MediatorGet(mediator, driverClock=driverClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! check and set the component clock against the driver clock call NUOPC_CompCheckSetClock(mediator, driverClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, & @@ -394,21 +405,21 @@ subroutine SetRunClock_slow(mediator, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine SetRunClock_slow !----------------------------------------------------------------------------- - + subroutine SetRunClock_fast(mediator, rc) type(ESMF_GridComp) :: mediator integer, intent(out) :: rc - + ! local variables type(InternalState) :: is type(ESMF_Clock) :: driverClock rc = ESMF_SUCCESS - + ! query component for its internal state nullify(is%wrap) call ESMF_GridCompGetInternalState(mediator, is, rc) @@ -423,14 +434,14 @@ subroutine SetRunClock_fast(mediator, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! query component for the driver Clock call NUOPC_MediatorGet(mediator, driverClock=driverClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! check and set the component clock against the driver clock call NUOPC_CompCheckSetClock(mediator, driverClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, & @@ -438,7 +449,7 @@ subroutine SetRunClock_fast(mediator, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine SetRunClock_fast !----------------------------------------------------------------------------- @@ -446,14 +457,14 @@ end subroutine SetRunClock_fast subroutine CheckImport_fast(mediator, rc) type(ESMF_GridComp) :: mediator integer, intent(out) :: rc - + ! This is the routine that ensures that the import Fields come in with - ! the correct time stamps during the "fast" cycle: + ! the correct time stamps during the "fast" cycle: ! -> Fields from the ATM must be at stopTime. This is because the ATM model ! has already advanced, and timestamped its export Fields. ! -> Fields from the OCN must not be checked. They are currently not used ! during the "fast" cycle of the MED. - + ! local variables type(ESMF_Clock) :: clock type(ESMF_Time) :: stopTime @@ -462,14 +473,14 @@ subroutine CheckImport_fast(mediator, rc) logical :: atCorrectTime rc = ESMF_SUCCESS - + ! query the Component for its Clock and importState call ESMF_GridCompGet(mediator, clock=clock, importState=importState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! get the current time out of the Clock call ESMF_ClockGet(clock, stopTime=stopTime, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -503,13 +514,13 @@ subroutine CheckImport_fast(mediator, rc) end subroutine CheckImport_fast !----------------------------------------------------------------------------- - + subroutine TimestampExport_fast(mediator, rc) type(ESMF_GridComp) :: mediator integer, intent(out) :: rc - + ! This is the routine that applies the time stamp on the export Fields - ! during the "fast" cycle: + ! during the "fast" cycle: ! -> By default the MED Run method time stamps the export Fields with the ! current time at the beginning of the advance step, however here, ! because the "fast" cycle runs after the ATM model, the correct time @@ -534,22 +545,22 @@ subroutine TimestampExport_fast(mediator, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine TimestampExport_fast !----------------------------------------------------------------------------- - subroutine MediatorAdvance_slow(mediator, rc) + subroutine Advance_slow(mediator, rc) type(ESMF_GridComp) :: mediator integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState character(len=160) :: msgString rc = ESMF_SUCCESS - + ! query the Component for its clock, importState and exportState call ESMF_GridCompGet(mediator, clock=clock, importState=importState, & exportState=exportState, rc=rc) @@ -557,21 +568,21 @@ subroutine MediatorAdvance_slow(mediator, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! HERE THE MEDIATOR does the mediation of Fields that come in on the - ! importState with a timestamp consistent to the currTime of the + ! importState with a timestamp consistent to the currTime of the ! mediators Clock. - + ! The Mediator uses the data on the import Fields to update the data ! held by Fields in the exportState. - + ! After this routine returns the generic Mediator will correctly ! timestamp the export Fields at currTime, and update the Mediator Clock to: ! ! currTime -> currTime + timeStep ! ! Where the timeStep is equal to the parent timeStep. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing MED slow() from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -583,7 +594,7 @@ subroutine MediatorAdvance_slow(mediator, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="----------------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -600,17 +611,17 @@ subroutine MediatorAdvance_slow(mediator, rc) !----------------------------------------------------------------------------- - subroutine MediatorAdvance_fast(mediator, rc) + subroutine Advance_fast(mediator, rc) type(ESMF_GridComp) :: mediator integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState character(len=160) :: msgString rc = ESMF_SUCCESS - + ! query the Component for its clock, importState and exportState call ESMF_GridCompGet(mediator, clock=clock, importState=importState, & exportState=exportState, rc=rc) @@ -618,21 +629,21 @@ subroutine MediatorAdvance_fast(mediator, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! HERE THE MEDIATOR does the mediation of Fields that come in on the - ! importState with a timestamp consistent to the currTime of the + ! importState with a timestamp consistent to the currTime of the ! mediators Clock. - + ! The Mediator uses the data on the import Fields to update the data ! held by Fields in the exportState. - + ! After this routine returns the generic Mediator will correctly ! timestamp the export Fields at currTime, and update the Mediator Clock to: ! ! currTime -> currTime + timeStep ! ! Where the timeStep is equal to the parent timeStep. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing MED fast() from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -644,7 +655,7 @@ subroutine MediatorAdvance_fast(mediator, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="----------------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -659,4 +670,6 @@ subroutine MediatorAdvance_fast(mediator, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnMedPetListTimescalesProto/ocn.F90 b/AtmOcnMedPetListTimescalesProto/ocn.F90 index c3e469cf..4ea7ca8e 100644 --- a/AtmOcnMedPetListTimescalesProto/ocn.F90 +++ b/AtmOcnMedPetListTimescalesProto/ocn.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,73 +17,78 @@ module OCN use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_SetClock => label_SetClock, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_SetClock, & + call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & specRoutine=SetClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: air_pressure_at_sea_level call NUOPC_Advertise(importState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -91,7 +96,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(importState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -109,23 +114,30 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_TimeInterval) :: stabilityTimeStep type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/100, 20/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -150,7 +162,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux field = ESMF_FieldCreate(name="rsns", grid=gridIn, & typekind=ESMF_TYPEKIND_R8, rc=rc) @@ -178,30 +190,30 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- subroutine SetClock(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_TimeInterval) :: stabilityTimeStep rc = ESMF_SUCCESS - - ! query the Component for its clock + + ! query for clock call NUOPC_ModelGet(model, modelClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! by default, the modelClock is a copy of the driverClock - ! here is the place to adjust the timeStep if it does not depend on + ! here is the place to adjust the timeStep if it does not depend on ! the driverClock handed to the model during run sequence execution - + ! here: parent Clock and stability timeStep determine actual model timeStep !TODO: stabilityTimeStep should be read in from configuation !TODO: or computed from internal Grid information @@ -215,15 +227,15 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -232,8 +244,8 @@ subroutine ModelAdvance(model, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -242,14 +254,14 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set in SetClock(), ! its timeStep is likely smaller than the parent timeStep. As a consequence - ! the time interval covered by a single parent timeStep will result in - ! multiple calls to the ModelAdvance() routine. Every time the currTime + ! the time interval covered by a single parent timeStep will result in + ! multiple calls to the Advance() routine. Every time the currTime ! will come in by one internal timeStep advanced. This goes until the ! stopTime of the internal Clock has been reached. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing OCN from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -261,13 +273,13 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_TimePrint(currTime + timeStep, & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -282,4 +294,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnMedPetListTimescalesSplitFastProto/atm.F90 b/AtmOcnMedPetListTimescalesSplitFastProto/atm.F90 index b5dc9c02..6831f7ca 100644 --- a/AtmOcnMedPetListTimescalesSplitFastProto/atm.F90 +++ b/AtmOcnMedPetListTimescalesSplitFastProto/atm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,73 +17,78 @@ module ATM use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_SetClock => label_SetClock, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_SetClock, & + call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & specRoutine=SetClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: sea_surface_temperature call NUOPC_Advertise(importState, & StandardName="sea_surface_temperature", name="sst", rc=rc) @@ -91,7 +96,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: air_pressure_at_sea_level call NUOPC_Advertise(exportState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -99,7 +104,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -109,22 +114,29 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/20, 100/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -177,26 +189,26 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- subroutine SetClock(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_TimeInterval) :: stabilityTimeStep rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock call NUOPC_ModelGet(model, modelClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! initialize internal clock ! here: parent Clock and stability timeStep determine actual model timeStep !TODO: stabilityTimeStep should be read in from configuation @@ -211,23 +223,23 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -236,12 +248,12 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set by default, ! its timeStep is equal to the parent timeStep. As a consequence the ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. - + ! for this call of the Advance() routine. + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing ATM from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -253,7 +265,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -268,4 +280,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnMedPetListTimescalesSplitFastProto/esm.F90 b/AtmOcnMedPetListTimescalesSplitFastProto/esm.F90 index 61d30b5e..6d8f80e0 100644 --- a/AtmOcnMedPetListTimescalesSplitFastProto/esm.F90 +++ b/AtmOcnMedPetListTimescalesSplitFastProto/esm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,22 +17,20 @@ module ESM use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices, & - driver_label_SetRunSequence => label_SetRunSequence - + driverSS => SetServices + use ATM, only: atmSS => SetServices use OCN, only: ocnSS => SetServices use MED, only: medSS => SetServices - + use NUOPC_Connector, only: cplSS => SetServices - + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -40,30 +38,37 @@ module ESM subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & + + ! specialize driver + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetRunSequence, & + call NUOPC_CompSpecialize(driver, specLabel=label_SetRunSequence, & specRoutine=SetRunSequence, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + + ! set driver verbosity + call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + end subroutine !----------------------------------------------------------------------------- @@ -71,7 +76,7 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables type(ESMF_Time) :: startTime type(ESMF_Time) :: stopTime @@ -80,9 +85,9 @@ subroutine SetModelServices(driver, rc) integer :: petCount, i integer, allocatable :: petList(:) type(ESMF_GridComp) :: child - + rc = ESMF_SUCCESS - + ! get the petCount call ESMF_GridCompGet(driver, petCount=petCount, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -107,7 +112,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for OCN allocate(petList(petCount/2-1)) do i=1, petCount/2-1 @@ -169,13 +174,13 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- @@ -183,7 +188,7 @@ subroutine SetModelServices(driver, rc) subroutine SetRunSequence(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables character(ESMF_MAXSTR) :: name type(NUOPC_FreeFormat) :: runSeqFF @@ -193,12 +198,12 @@ subroutine SetRunSequence(driver, rc) type(ESMF_Clock) :: internalClock rc = ESMF_SUCCESS - + ! query the driver for its name call ESMF_GridCompGet(driver, name=name, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - + ! set up free format run sequence runSeqFF = NUOPC_FreeFormatCreate(stringList=(/ & " @* ", & diff --git a/AtmOcnMedPetListTimescalesSplitFastProto/esmApp.F90 b/AtmOcnMedPetListTimescalesSplitFastProto/esmApp.F90 index b80f7d5c..9e5e2ae8 100644 --- a/AtmOcnMedPetListTimescalesSplitFastProto/esmApp.F90 +++ b/AtmOcnMedPetListTimescalesSplitFastProto/esmApp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -21,7 +21,7 @@ program esmApp integer :: rc, urc type(ESMF_GridComp) :: esmComp - + ! Initialize ESMF call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, & defaultCalkind=ESMF_CALKIND_GREGORIAN, rc=rc) @@ -29,7 +29,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp STARTING", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -42,7 +42,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! SetServices for the earth system Component call ESMF_GridCompSetServices(esmComp, esmSS, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -53,7 +53,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Initialize for the earth system Component call ESMF_GridCompInitialize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -64,7 +64,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Run for earth the system Component call ESMF_GridCompRun(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -75,7 +75,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Finalize for the earth system Component call ESMF_GridCompFinalize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -86,14 +86,14 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Destroy the earth system Component call ESMF_GridCompDestroy(esmComp, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -102,5 +102,5 @@ program esmApp ! Finalize ESMF call ESMF_Finalize() - -end program + +end program diff --git a/AtmOcnMedPetListTimescalesSplitFastProto/med.F90 b/AtmOcnMedPetListTimescalesSplitFastProto/med.F90 index effddd14..0868dd53 100644 --- a/AtmOcnMedPetListTimescalesSplitFastProto/med.F90 +++ b/AtmOcnMedPetListTimescalesSplitFastProto/med.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -12,25 +12,19 @@ module MED !----------------------------------------------------------------------------- ! Mediator Component. - ! This mediator operates on two timescales and keeps two internal Clocks to + ! This mediator operates on two timescales and keeps two internal Clocks to ! do so. !----------------------------------------------------------------------------- use ESMF use NUOPC - use NUOPC_Mediator, only: & - mediator_routine_SS => SetServices, & - mediator_routine_Run => routine_Run, & - mediator_label_Advance => label_Advance, & - mediator_label_CheckImport => label_CheckImport, & - mediator_label_TimestampExport => label_TimestampExport, & - mediator_label_SetRunClock => label_SetRunClock, & - NUOPC_MediatorGet - + use NUOPC_Mediator, & + mediatorSS => SetServices + implicit none - + private - + ! private internal state to keep instance data type InternalStateStruct type(ESMF_Clock) :: clockSlow @@ -42,138 +36,147 @@ module MED end type public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(mediator, rc) type(ESMF_GridComp) :: mediator integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(mediator, mediator_routine_SS, rc=rc) + + ! derive from NUOPC_Mediator + call NUOPC_CompDerive(mediator, mediatorSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(mediator, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize mediator + call NUOPC_CompSpecialize(mediator, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(mediator, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(mediator, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! slow Mediation phase with OCN (use the default "RunPhase1" for slow) - call NUOPC_CompSpecialize(mediator, specLabel=mediator_label_SetRunClock, & + call NUOPC_CompSpecialize(mediator, specLabel=label_SetRunClock, & specPhaseLabel="RunPhase1", specRoutine=SetRunClock_slow, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(mediator, specLabel=mediator_label_Advance, & - specPhaseLabel="RunPhase1", specRoutine=MediatorAdvance_slow, rc=rc) + call NUOPC_CompSpecialize(mediator, specLabel=label_Advance, & + specPhaseLabel="RunPhase1", specRoutine=Advance_slow, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! fast Mediation phase with ATM: before call NUOPC_CompSetEntryPoint(mediator, ESMF_METHOD_RUN, & phaseLabelList=(/"RunPhaseFastBefore"/), & - userRoutine=mediator_routine_Run, rc=rc) + userRoutine=routine_Run, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(mediator, specLabel=mediator_label_SetRunClock, & + call NUOPC_CompSpecialize(mediator, specLabel=label_SetRunClock, & specPhaseLabel="RunPhaseFastBefore", & specRoutine=SetRunClock_fast_before, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(mediator, specLabel=mediator_label_CheckImport, & + call NUOPC_CompSpecialize(mediator, specLabel=label_CheckImport, & specPhaseLabel="RunPhaseFastBefore", & specRoutine=CheckImport_fast_before, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(mediator, specLabel=mediator_label_TimestampExport, & + call NUOPC_CompSpecialize(mediator, specLabel=label_TimestampExport, & specPhaseLabel="RunPhaseFastBefore", & specRoutine=TimestampExport_fast_before, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(mediator, specLabel=mediator_label_Advance, & + call NUOPC_CompSpecialize(mediator, specLabel=label_Advance, & specPhaseLabel="RunPhaseFastBefore", & - specRoutine=MediatorAdvance_fast_before, rc=rc) + specRoutine=Advance_fast_before, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! fast Mediation phase with ATM: after call NUOPC_CompSetEntryPoint(mediator, ESMF_METHOD_RUN, & phaseLabelList=(/"RunPhaseFastAfter"/), & - userRoutine=mediator_routine_Run, rc=rc) + userRoutine=routine_Run, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(mediator, specLabel=mediator_label_SetRunClock, & + call NUOPC_CompSpecialize(mediator, specLabel=label_SetRunClock, & specPhaseLabel="RunPhaseFastAfter", & specRoutine=SetRunClock_fast_after, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(mediator, specLabel=mediator_label_CheckImport, & + call NUOPC_CompSpecialize(mediator, specLabel=label_CheckImport, & specPhaseLabel="RunPhaseFastAfter", & specRoutine=CheckImport_fast_after, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(mediator, specLabel=mediator_label_TimestampExport, & + call NUOPC_CompSpecialize(mediator, specLabel=label_TimestampExport, & specPhaseLabel="RunPhaseFastAfter", & specRoutine=TimestampExport_fast_after, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(mediator, specLabel=mediator_label_Advance, & + call NUOPC_CompSpecialize(mediator, specLabel=label_Advance, & specPhaseLabel="RunPhaseFastAfter", & - specRoutine=MediatorAdvance_fast_after, rc=rc) + specRoutine=Advance_fast_after, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(mediator, importState, exportState, clock, rc) + subroutine Advertise(mediator, rc) type(ESMF_GridComp) :: mediator - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_MediatorGet(mediator, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: sea_surface_temperature call NUOPC_Advertise(importState, & StandardName="sea_surface_temperature", name="sst", rc=rc) @@ -181,7 +184,7 @@ subroutine InitializeP1(mediator, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: air_pressure_at_sea_level call NUOPC_Advertise(importState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -189,7 +192,7 @@ subroutine InitializeP1(mediator, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(importState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -213,7 +216,7 @@ subroutine InitializeP1(mediator, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -223,16 +226,16 @@ subroutine InitializeP1(mediator, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(mediator, importState, exportState, clock, rc) + subroutine Realize(mediator, rc) type(ESMF_GridComp) :: mediator - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState + type(ESMF_Clock) :: clock type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut @@ -241,7 +244,15 @@ subroutine InitializeP2(mediator, importState, exportState, clock, rc) type(ESMF_TimeInterval) :: timeStep rc = ESMF_SUCCESS - + + ! query for driverClock, importState and exportState + call NUOPC_MediatorGet(mediator, driverClock=clock, & + importState=importState, exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/20, 100/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -279,7 +290,7 @@ subroutine InitializeP2(mediator, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux field = ESMF_FieldCreate(name="rsns", grid=gridIn, & typekind=ESMF_TYPEKIND_R8, rc=rc) @@ -331,15 +342,15 @@ subroutine InitializeP2(mediator, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! The Fields in the exportState are going to be correctly timestamped by - ! the generic code. However, the Fields in the importState are not + ! the generic code. However, the Fields in the importState are not ! automatically time stamped. Instead it is expected that the customized ! initialization takes care of this aspect. Here just "blindly" time stamp ! the Fields in the importState, indicating to the first Run method that ! all is good. - - call NUOPC_SetTimestamp(importState, clock=clock, rc=rc) + + call NUOPC_SetTimestamp(importState, clock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -357,7 +368,7 @@ subroutine InitializeP2(mediator, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! Initialize the internal clocks: both slow and fast start as copies of in is%wrap%clockSlow = ESMF_ClockCreate(clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -391,21 +402,21 @@ subroutine InitializeP2(mediator, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + end subroutine - + !----------------------------------------------------------------------------- subroutine SetRunClock_slow(mediator, rc) type(ESMF_GridComp) :: mediator integer, intent(out) :: rc - + ! local variables type(InternalState) :: is type(ESMF_Clock) :: driverClock rc = ESMF_SUCCESS - + ! query component for its internal state nullify(is%wrap) call ESMF_GridCompGetInternalState(mediator, is, rc) @@ -420,14 +431,14 @@ subroutine SetRunClock_slow(mediator, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! query component for the driver Clock call NUOPC_MediatorGet(mediator, driverClock=driverClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! check and set the component clock against the driver clock call NUOPC_CompCheckSetClock(mediator, driverClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, & @@ -435,21 +446,21 @@ subroutine SetRunClock_slow(mediator, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine SetRunClock_slow !----------------------------------------------------------------------------- - + subroutine SetRunClock_fast_before(mediator, rc) type(ESMF_GridComp) :: mediator integer, intent(out) :: rc - + ! local variables type(InternalState) :: is type(ESMF_Clock) :: driverClock rc = ESMF_SUCCESS - + ! query component for its internal state nullify(is%wrap) call ESMF_GridCompGetInternalState(mediator, is, rc) @@ -464,14 +475,14 @@ subroutine SetRunClock_fast_before(mediator, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! query component for the driver Clock call NUOPC_MediatorGet(mediator, driverClock=driverClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! check and set the component clock against the driver clock call NUOPC_CompCheckSetClock(mediator, driverClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, & @@ -479,7 +490,7 @@ subroutine SetRunClock_fast_before(mediator, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine SetRunClock_fast_before !----------------------------------------------------------------------------- @@ -487,13 +498,13 @@ end subroutine SetRunClock_fast_before subroutine SetRunClock_fast_after(mediator, rc) type(ESMF_GridComp) :: mediator integer, intent(out) :: rc - + ! local variables type(InternalState) :: is type(ESMF_Clock) :: driverClock rc = ESMF_SUCCESS - + ! query component for its internal state nullify(is%wrap) call ESMF_GridCompGetInternalState(mediator, is, rc) @@ -508,14 +519,14 @@ subroutine SetRunClock_fast_after(mediator, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! query component for the driver Clock call NUOPC_MediatorGet(mediator, driverClock=driverClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! check and set the component clock against the driver clock call NUOPC_CompCheckSetClock(mediator, driverClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, & @@ -523,7 +534,7 @@ subroutine SetRunClock_fast_after(mediator, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine SetRunClock_fast_after !----------------------------------------------------------------------------- @@ -531,14 +542,14 @@ end subroutine SetRunClock_fast_after subroutine CheckImport_fast_before(mediator, rc) type(ESMF_GridComp) :: mediator integer, intent(out) :: rc - + ! This is the routine that ensures that the import Fields come in with - ! the correct time stamps during the "fast" cycle: - ! -> Fields from the ATM are not used by the "before" phase and need not + ! the correct time stamps during the "fast" cycle: + ! -> Fields from the ATM are not used by the "before" phase and need not ! be checked. - ! -> Fields from the OCN must be at the startTime of the parent driver + ! -> Fields from the OCN must be at the startTime of the parent driver ! Clock - + ! local variables type(ESMF_Clock) :: clock type(ESMF_Time) :: startTime @@ -547,21 +558,21 @@ subroutine CheckImport_fast_before(mediator, rc) logical :: atCorrectTime rc = ESMF_SUCCESS - + ! query the Component for its importState call ESMF_GridCompGet(mediator, importState=importState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! query the Component for its driverClock call NUOPC_MediatorGet(mediator, driverClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! get the start time out of the driver Clock call ESMF_ClockGet(clock, startTime=startTime, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -595,18 +606,18 @@ subroutine CheckImport_fast_before(mediator, rc) end subroutine CheckImport_fast_before !----------------------------------------------------------------------------- - + subroutine CheckImport_fast_after(mediator, rc) type(ESMF_GridComp) :: mediator integer, intent(out) :: rc - + ! This is the routine that ensures that the import Fields come in with - ! the correct time stamps during the "fast" cycle: + ! the correct time stamps during the "fast" cycle: ! -> Fields from the ATM must be at stopTime because this mediator phase ! runs _after_ the ATM runs. - ! -> Fields from the OCN are not used by the "after" phase and need not + ! -> Fields from the OCN are not used by the "after" phase and need not ! be checked. - + ! local variables type(ESMF_Clock) :: clock type(ESMF_Time) :: stopTime @@ -615,14 +626,14 @@ subroutine CheckImport_fast_after(mediator, rc) logical :: atCorrectTime rc = ESMF_SUCCESS - + ! query the Component for its Clock and importState call ESMF_GridCompGet(mediator, clock=clock, importState=importState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! get the stop time out of the Clock call ESMF_ClockGet(clock, stopTime=stopTime, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -656,12 +667,12 @@ subroutine CheckImport_fast_after(mediator, rc) end subroutine CheckImport_fast_after !----------------------------------------------------------------------------- - + subroutine TimestampExport_fast_before(mediator, rc) type(ESMF_GridComp) :: mediator integer, intent(out) :: rc - - ! This is the routine that executes _after_ the "fast_before" mediator + + ! This is the routine that executes _after_ the "fast_before" mediator ! phase has been run. Timestamping does not need to be adjusted here, ! but the Clock needs to be stepped back because the "fast_after" phase ! will be updating the same Clock during the same driver cylce. @@ -678,7 +689,7 @@ subroutine TimestampExport_fast_before(mediator, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! get the timeStep out of Clock call ESMF_ClockGet(clock, timeStep=timeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -692,7 +703,7 @@ subroutine TimestampExport_fast_before(mediator, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine TimestampExport_fast_before !----------------------------------------------------------------------------- @@ -700,9 +711,9 @@ end subroutine TimestampExport_fast_before subroutine TimestampExport_fast_after(mediator, rc) type(ESMF_GridComp) :: mediator integer, intent(out) :: rc - + ! This is the routine that applies the time stamp on the export Fields - ! during the "fast" cycle: + ! during the "fast" cycle: ! -> By default the MED Run method time stamps the export Fields with the ! current time at the beginning of the advance step, however here, ! because the "fast" cycle runs after the ATM model, the correct time @@ -727,22 +738,22 @@ subroutine TimestampExport_fast_after(mediator, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine TimestampExport_fast_after !----------------------------------------------------------------------------- - subroutine MediatorAdvance_slow(mediator, rc) + subroutine Advance_slow(mediator, rc) type(ESMF_GridComp) :: mediator integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState character(len=160) :: msgString rc = ESMF_SUCCESS - + ! query the Component for its clock, importState and exportState call ESMF_GridCompGet(mediator, clock=clock, importState=importState, & exportState=exportState, rc=rc) @@ -750,21 +761,21 @@ subroutine MediatorAdvance_slow(mediator, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! HERE THE MEDIATOR does the mediation of Fields that come in on the - ! importState with a timestamp consistent to the currTime of the + ! importState with a timestamp consistent to the currTime of the ! mediators Clock. - + ! The Mediator uses the data on the import Fields to update the data ! held by Fields in the exportState. - + ! After this routine returns the generic Mediator will correctly ! timestamp the export Fields at currTime, and update the Mediator Clock to: ! ! currTime -> currTime + timeStep ! ! Where the timeStep is equal to the parent timeStep. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing MED slow() from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -776,7 +787,7 @@ subroutine MediatorAdvance_slow(mediator, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="----------------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -793,17 +804,17 @@ subroutine MediatorAdvance_slow(mediator, rc) !----------------------------------------------------------------------------- - subroutine MediatorAdvance_fast_before(mediator, rc) + subroutine Advance_fast_before(mediator, rc) type(ESMF_GridComp) :: mediator integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState character(len=160) :: msgString rc = ESMF_SUCCESS - + ! query the Component for its clock, importState and exportState call ESMF_GridCompGet(mediator, clock=clock, importState=importState, & exportState=exportState, rc=rc) @@ -811,21 +822,21 @@ subroutine MediatorAdvance_fast_before(mediator, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! HERE THE MEDIATOR does the mediation of Fields that come in on the - ! importState with a timestamp consistent to the currTime of the + ! importState with a timestamp consistent to the currTime of the ! mediators Clock. - + ! The Mediator uses the data on the import Fields to update the data ! held by Fields in the exportState. - + ! After this routine returns the generic Mediator will correctly ! timestamp the export Fields at currTime, and update the Mediator Clock to: ! ! currTime -> currTime + timeStep ! ! Where the timeStep is equal to the parent timeStep. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing MED fast_before() from: ", unit=msgString, & rc=rc) @@ -838,7 +849,7 @@ subroutine MediatorAdvance_fast_before(mediator, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="-----------------------------------> to: ", unit=msgString, & rc=rc) @@ -851,22 +862,22 @@ subroutine MediatorAdvance_fast_before(mediator, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- - subroutine MediatorAdvance_fast_after(mediator, rc) + subroutine Advance_fast_after(mediator, rc) type(ESMF_GridComp) :: mediator integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState character(len=160) :: msgString rc = ESMF_SUCCESS - + ! query the Component for its clock, importState and exportState call ESMF_GridCompGet(mediator, clock=clock, importState=importState, & exportState=exportState, rc=rc) @@ -874,21 +885,21 @@ subroutine MediatorAdvance_fast_after(mediator, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! HERE THE MEDIATOR does the mediation of Fields that come in on the - ! importState with a timestamp consistent to the currTime of the + ! importState with a timestamp consistent to the currTime of the ! mediators Clock. - + ! The Mediator uses the data on the import Fields to update the data ! held by Fields in the exportState. - + ! After this routine returns the generic Mediator will correctly ! timestamp the export Fields at currTime, and update the Mediator Clock to: ! ! currTime -> currTime + timeStep ! ! Where the timeStep is equal to the parent timeStep. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing MED fast_after() from: ", unit=msgString, & rc=rc) @@ -901,7 +912,7 @@ subroutine MediatorAdvance_fast_after(mediator, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="----------------------------------> to: ", unit=msgString, & rc=rc) @@ -914,9 +925,9 @@ subroutine MediatorAdvance_fast_after(mediator, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- end module diff --git a/AtmOcnMedPetListTimescalesSplitFastProto/ocn.F90 b/AtmOcnMedPetListTimescalesSplitFastProto/ocn.F90 index 4f5c582a..d5a0f0a5 100644 --- a/AtmOcnMedPetListTimescalesSplitFastProto/ocn.F90 +++ b/AtmOcnMedPetListTimescalesSplitFastProto/ocn.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,73 +17,78 @@ module OCN use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_SetClock => label_SetClock, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_SetClock, & + call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & specRoutine=SetClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: air_pressure_at_sea_level call NUOPC_Advertise(importState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -91,7 +96,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(importState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -109,23 +114,30 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_TimeInterval) :: stabilityTimeStep type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/100, 20/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -150,7 +162,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux field = ESMF_FieldCreate(name="rsns", grid=gridIn, & typekind=ESMF_TYPEKIND_R8, rc=rc) @@ -178,26 +190,26 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- subroutine SetClock(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_TimeInterval) :: stabilityTimeStep rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock call NUOPC_ModelGet(model, modelClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! initialize internal clock ! here: parent Clock and stability timeStep determine actual model timeStep !TODO: stabilityTimeStep should be read in from configuation @@ -212,15 +224,15 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -229,8 +241,8 @@ subroutine ModelAdvance(model, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -239,14 +251,14 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set in SetClock(), ! its timeStep is likely smaller than the parent timeStep. As a consequence - ! the time interval covered by a single parent timeStep will result in - ! multiple calls to the ModelAdvance() routine. Every time the currTime + ! the time interval covered by a single parent timeStep will result in + ! multiple calls to the Advance() routine. Every time the currTime ! will come in by one internal timeStep advanced. This goes until the ! stopTime of the internal Clock has been reached. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing OCN from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -258,13 +270,13 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_TimePrint(currTime + timeStep, & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -279,4 +291,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnMedProto/atm.F90 b/AtmOcnMedProto/atm.F90 index 462a0d0f..a4ffea40 100644 --- a/AtmOcnMedProto/atm.F90 +++ b/AtmOcnMedProto/atm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,66 +17,72 @@ module ATM use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: sea_surface_temperature call NUOPC_Advertise(importState, & StandardName="sea_surface_temperature", name="sst", rc=rc) @@ -84,7 +90,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: air_pressure_at_sea_level call NUOPC_Advertise(exportState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -92,7 +98,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -102,22 +108,29 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/20, 100/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -170,21 +183,21 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -193,12 +206,12 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set by default, ! its timeStep is equal to the parent timeStep. As a consequence the ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. - + ! for this call of the Advance() routine. + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing ATM from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -210,7 +223,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -225,4 +238,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnMedProto/esm.F90 b/AtmOcnMedProto/esm.F90 index 311cac73..3a2ec95a 100644 --- a/AtmOcnMedProto/esm.F90 +++ b/AtmOcnMedProto/esm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,22 +17,20 @@ module ESM use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices, & - driver_label_SetRunSequence => label_SetRunSequence - + driverSS => SetServices + use ATM, only: atmSS => SetServices use OCN, only: ocnSS => SetServices use MED, only: medSS => SetServices - + use NUOPC_Connector, only: cplSS => SetServices - + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -40,30 +38,37 @@ module ESM subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & + + ! specialize driver + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetRunSequence, & + call NUOPC_CompSpecialize(driver, specLabel=label_SetRunSequence, & specRoutine=SetRunSequence, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + + ! set driver verbosity + call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + end subroutine !----------------------------------------------------------------------------- @@ -71,7 +76,7 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables type(ESMF_Time) :: startTime type(ESMF_Time) :: stopTime @@ -80,26 +85,26 @@ subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: child rc = ESMF_SUCCESS - + ! SetServices for ATM call NUOPC_DriverAddComp(driver, "ATM", atmSS, comp=child, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompAttributeSet(child, name="Verbosity", value="1", rc=rc) + call NUOPC_CompAttributeSet(child, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for OCN call NUOPC_DriverAddComp(driver, "OCN", ocnSS, comp=child, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompAttributeSet(child, name="Verbosity", value="1", rc=rc) + call NUOPC_CompAttributeSet(child, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -111,7 +116,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompAttributeSet(child, name="Verbosity", value="1", rc=rc) + call NUOPC_CompAttributeSet(child, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -144,7 +149,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- @@ -152,18 +157,18 @@ subroutine SetModelServices(driver, rc) subroutine SetRunSequence(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables character(ESMF_MAXSTR) :: name type(NUOPC_FreeFormat) :: runSeqFF rc = ESMF_SUCCESS - + ! query the driver for its name call ESMF_GridCompGet(driver, name=name, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - + ! set up free format run sequence runSeqFF = NUOPC_FreeFormatCreate(stringList=(/ & " @* ", & diff --git a/AtmOcnMedProto/esmApp.F90 b/AtmOcnMedProto/esmApp.F90 index b80f7d5c..9e5e2ae8 100644 --- a/AtmOcnMedProto/esmApp.F90 +++ b/AtmOcnMedProto/esmApp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -21,7 +21,7 @@ program esmApp integer :: rc, urc type(ESMF_GridComp) :: esmComp - + ! Initialize ESMF call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, & defaultCalkind=ESMF_CALKIND_GREGORIAN, rc=rc) @@ -29,7 +29,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp STARTING", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -42,7 +42,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! SetServices for the earth system Component call ESMF_GridCompSetServices(esmComp, esmSS, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -53,7 +53,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Initialize for the earth system Component call ESMF_GridCompInitialize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -64,7 +64,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Run for earth the system Component call ESMF_GridCompRun(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -75,7 +75,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Finalize for the earth system Component call ESMF_GridCompFinalize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -86,14 +86,14 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Destroy the earth system Component call ESMF_GridCompDestroy(esmComp, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -102,5 +102,5 @@ program esmApp ! Finalize ESMF call ESMF_Finalize() - -end program + +end program diff --git a/AtmOcnMedProto/med.F90 b/AtmOcnMedProto/med.F90 index 5540ce3a..570cfd5a 100644 --- a/AtmOcnMedProto/med.F90 +++ b/AtmOcnMedProto/med.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -16,67 +16,73 @@ module MED use ESMF use NUOPC - use NUOPC_Mediator, only: & - mediator_routine_SS => SetServices, & - mediator_label_Advance => label_Advance - + use NUOPC_Mediator, & + mediatorSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(mediator, rc) type(ESMF_GridComp) :: mediator integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(mediator, mediator_routine_SS, rc=rc) + + ! derive from NUOPC_Mediator + call NUOPC_CompDerive(mediator, mediatorSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(mediator, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize mediator + call NUOPC_CompSpecialize(mediator, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(mediator, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(mediator, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(mediator, specLabel=mediator_label_Advance, & - specRoutine=MediatorAdvance, rc=rc) + call NUOPC_CompSpecialize(mediator, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(mediator, importState, exportState, clock, rc) + subroutine Advertise(mediator, rc) type(ESMF_GridComp) :: mediator - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_MediatorGet(mediator, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: sea_surface_temperature call NUOPC_Advertise(importState, & StandardName="sea_surface_temperature", name="sst", rc=rc) @@ -84,7 +90,7 @@ subroutine InitializeP1(mediator, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: air_pressure_at_sea_level call NUOPC_Advertise(importState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -92,7 +98,7 @@ subroutine InitializeP1(mediator, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(importState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -116,7 +122,7 @@ subroutine InitializeP1(mediator, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -126,22 +132,29 @@ subroutine InitializeP1(mediator, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(mediator, importState, exportState, clock, rc) + subroutine Realize(mediator, rc) type(ESMF_GridComp) :: mediator - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_MediatorGet(mediator, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/20, 200/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -179,7 +192,7 @@ subroutine InitializeP2(mediator, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux field = ESMF_FieldCreate(name="rsns", grid=gridIn, & typekind=ESMF_TYPEKIND_R8, rc=rc) @@ -233,42 +246,42 @@ subroutine InitializeP2(mediator, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine MediatorAdvance(mediator, rc) + subroutine Advance(mediator, rc) type(ESMF_GridComp) :: mediator integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call ESMF_GridCompGet(mediator, clock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! HERE THE MEDIATOR does the mediation of Fields that come in on the - ! importState with a timestamp consistent to the currTime of the + ! importState with a timestamp consistent to the currTime of the ! mediators Clock. - + ! The Mediator uses the data on the import Fields to update the data ! held by Fields in the exportState. - + ! After this routine returns the generic Mediator will correctly ! timestamp the export Fields at currTime, and update the Mediator Clock to: ! ! currTime -> currTime + timeStep ! ! Where the timeStep is equal to the parent timeStep. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing MED from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -280,7 +293,7 @@ subroutine MediatorAdvance(mediator, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -295,4 +308,6 @@ subroutine MediatorAdvance(mediator, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnMedProto/ocn.F90 b/AtmOcnMedProto/ocn.F90 index 4043e256..57880baa 100644 --- a/AtmOcnMedProto/ocn.F90 +++ b/AtmOcnMedProto/ocn.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,73 +17,78 @@ module OCN use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_SetClock => label_SetClock, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_SetClock, & + call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & specRoutine=SetClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: air_pressure_at_sea_level call NUOPC_Advertise(importState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -91,7 +96,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(importState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -109,23 +114,29 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables - type(ESMF_TimeInterval) :: stabilityTimeStep + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/100, 20/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -150,7 +161,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux field = ESMF_FieldCreate(name="rsns", grid=gridIn, & typekind=ESMF_TYPEKIND_R8, rc=rc) @@ -178,26 +189,26 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- subroutine SetClock(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_TimeInterval) :: stabilityTimeStep rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock call NUOPC_ModelGet(model, modelClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! initialize internal clock ! here: parent Clock and stability timeStep determine actual model timeStep !TODO: stabilityTimeStep should be read in from configuation @@ -212,15 +223,15 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -229,8 +240,8 @@ subroutine ModelAdvance(model, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -239,14 +250,14 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set in SetClock(), ! its timeStep is likely smaller than the parent timeStep. As a consequence - ! the time interval covered by a single parent timeStep will result in - ! multiple calls to the ModelAdvance() routine. Every time the currTime + ! the time interval covered by a single parent timeStep will result in + ! multiple calls to the Advance() routine. Every time the currTime ! will come in by one internal timeStep advanced. This goes until the ! stopTime of the internal Clock has been reached. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing OCN from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -258,13 +269,13 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_TimePrint(currTime + timeStep, & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -279,4 +290,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnMedTransferGridMakeMeshProto/README b/AtmOcnMedTransferGridMakeMeshProto/README index 3ecefd45..01898afb 100644 --- a/AtmOcnMedTransferGridMakeMeshProto/README +++ b/AtmOcnMedTransferGridMakeMeshProto/README @@ -22,11 +22,10 @@ Output: Code structure: - Makefile - Makefile that is based on the standard esmf.mk mechanism. - atm.F90 - The ATM component, specializing generic NUOPC_Model. - * Implements IPDv03 to accept Grids from OCN component. + * Accept Grids from OCN component. * Indicates "cannot provide" for some Grids * Indicates "can provide" for some Grids - ocn.F90 - The OCN component, specializing generic NUOPC_Model. - * Implements IPDv01. * Implicitly indicate "will provide" for all Grids. - esm.F90 - The Earth System Model (ESM) component, specializing generic NUOPC_Driver. Define partial petLists for ATM diff --git a/AtmOcnMirrorFieldsProto/atm.F90 b/AtmOcnMirrorFieldsProto/atm.F90 index 826a6901..fab0804d 100644 --- a/AtmOcnMirrorFieldsProto/atm.F90 +++ b/AtmOcnMirrorFieldsProto/atm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -34,16 +34,14 @@ module ATM use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_DataInitialize => label_DataInitialize, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetVM, SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -54,60 +52,50 @@ subroutine SetServices(model, rc) rc = ESMF_SUCCESS - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! -> switching to IPD version that supports field mirroring - call ESMF_GridCompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - userRoutine=InitializeP0, phase=0, rc=rc) + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv05p1"/), userRoutine=InitializeP1, rc=rc) + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out #ifdef TEST_FIELD_MIRRORING - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv05p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_ModifyAdvertised, & + specRoutine=ModifyAdvertised, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out #endif - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv05p4"/), userRoutine=InitializeP4, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=RealizeProvided, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out #ifdef TEST_ACCEPTING - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv05p6"/), userRoutine=InitializeP6, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeAccepted, & + specRoutine=RealizeAccepted, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out #endif - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_DataInitialize, & + specRoutine=DataInitialize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_DataInitialize, & - specRoutine=DataInitialize, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -117,34 +105,23 @@ subroutine SetServices(model, rc) !----------------------------------------------------------------------------- - subroutine InitializeP0(model, importState, exportState, clock, rc) - type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - + subroutine Advertise(model, rc) + type(ESMF_GridComp) :: model + integer, intent(out) :: rc + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - ! Switch to IPDv05 by filtering all other phaseMap entries - call NUOPC_CompFilterPhaseMap(model, ESMF_METHOD_INITIALIZE, & - acceptStringList=(/"IPDv05p"/), rc=rc) + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - end subroutine - - !----------------------------------------------------------------------------- - - subroutine InitializeP1(model, importState, exportState, clock, rc) - type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - ! importable field: sea_surface_temperature call NUOPC_Advertise(importState, & StandardName="sea_surface_temperature", name="sst", rc=rc) @@ -182,19 +159,25 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine ModifyAdvertised(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + ! local variables - type(ESMF_Field) :: field + type(ESMF_State) :: importState, exportState + type(ESMF_Field) :: field rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out #ifndef TEST_ACCEPTING - ! Field mirroring was requested on a the component's exportState by + ! Field mirroring was requested on the component's exportState by ! setting the "FieldTransferPolicy" attribute to "transferAll" during ! the Advertise phase. This triggers the Connector to automatically ! advertised all the fields in the exportState for the component that it @@ -292,19 +275,26 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) !----------------------------------------------------------------------------- - subroutine InitializeP4(model, importState, exportState, clock, rc) + subroutine RealizeProvided(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/10, 100/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -364,13 +354,12 @@ subroutine InitializeP4(model, importState, exportState, clock, rc) !----------------------------------------------------------------------------- - subroutine InitializeP6(model, importState, exportState, clock, rc) + subroutine RealizeAccepted(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field integer :: tk, count type(ESMF_TypeKind_Flag) :: tkf @@ -380,6 +369,14 @@ subroutine InitializeP6(model, importState, exportState, clock, rc) rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + #ifdef TEST_ACCEPTING ! With GeomTransfer, all empty fields already have the Grid set. Just need ! to complete them here. @@ -531,7 +528,7 @@ subroutine DataInitialize(model, rc) rc = ESMF_SUCCESS - ! query the Component for its exportState + ! query for exportState call NUOPC_ModelGet(model, exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -588,7 +585,7 @@ subroutine DataInitialize(model, rc) !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) !$ use omp_lib type(ESMF_GridComp) :: model integer, intent(out) :: rc @@ -603,7 +600,7 @@ subroutine ModelAdvance(model, rc) rc = ESMF_SUCCESS - ! query the Component for its clock, importState and exportState + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -648,7 +645,7 @@ subroutine ModelAdvance(model, rc) ! Because of the way that the internal Clock was set by default, ! its timeStep is equal to the parent timeStep. As a consequence the ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. + ! for this call of the Advance() routine. call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing ATM from: ", unit=msgString, rc=rc) @@ -691,4 +688,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnMirrorFieldsProto/esm.F90 b/AtmOcnMirrorFieldsProto/esm.F90 index 19e045d9..e2a25897 100644 --- a/AtmOcnMirrorFieldsProto/esm.F90 +++ b/AtmOcnMirrorFieldsProto/esm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -25,20 +25,19 @@ module ESM use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices + driverSS => SetServices use ATM, only: atmSVM => SetVM, atmSS => SetServices use OCN, only: ocnSVM => SetVM, ocnSS => SetServices - + use NUOPC_Connector, only: cplSS => SetServices - + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -48,16 +47,16 @@ subroutine SetServices(driver, rc) integer, intent(out) :: rc rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & + + ! specialize driver + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -78,7 +77,7 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables type(ESMF_Grid) :: grid type(ESMF_Field) :: field @@ -93,7 +92,7 @@ subroutine SetModelServices(driver, rc) type(ESMF_Info) :: info rc = ESMF_SUCCESS - + ! Create and set the info object that is used to pass hints into methods info = ESMF_InfoCreate(rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -113,7 +112,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for ATM with petList on first half of PETs allocate(petList(petCount/2)) do i=1, petCount/2 @@ -137,7 +136,7 @@ subroutine SetModelServices(driver, rc) file=__FILE__)) & return ! bail out deallocate(petList) - + ! SetServices for OCN with petList on second half of PETs call ESMF_InfoSet(info, key="/NUOPC/Instance/maxPeCountPerPet", value=4, & rc=rc) @@ -167,7 +166,7 @@ subroutine SetModelServices(driver, rc) file=__FILE__)) & return ! bail out deallocate(petList) - + ! SetServices for atm2ocn call NUOPC_DriverAddComp(driver, srcCompLabel="ATM", dstCompLabel="OCN", & compSetServicesRoutine=cplSS, comp=connector, rc=rc) @@ -180,7 +179,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for ocn2atm call NUOPC_DriverAddComp(driver, srcCompLabel="OCN", dstCompLabel="ATM", & compSetServicesRoutine=cplSS, comp=connector, rc=rc) @@ -193,7 +192,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! set the driver clock call ESMF_TimeIntervalSet(timeStep, m=15, rc=rc) ! 15 minute steps if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -221,13 +220,13 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- diff --git a/AtmOcnMirrorFieldsProto/esmApp.F90 b/AtmOcnMirrorFieldsProto/esmApp.F90 index ed302230..9e5e2ae8 100644 --- a/AtmOcnMirrorFieldsProto/esmApp.F90 +++ b/AtmOcnMirrorFieldsProto/esmApp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -21,7 +21,7 @@ program esmApp integer :: rc, urc type(ESMF_GridComp) :: esmComp - + ! Initialize ESMF call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, & defaultCalkind=ESMF_CALKIND_GREGORIAN, rc=rc) @@ -29,12 +29,6 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - - call ESMF_LogSet(flush=.true., rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) call ESMF_LogWrite("esmApp STARTING", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -48,7 +42,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! SetServices for the earth system Component call ESMF_GridCompSetServices(esmComp, esmSS, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -59,7 +53,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Initialize for the earth system Component call ESMF_GridCompInitialize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -70,7 +64,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Run for earth the system Component call ESMF_GridCompRun(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -81,7 +75,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Finalize for the earth system Component call ESMF_GridCompFinalize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -92,14 +86,14 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Destroy the earth system Component call ESMF_GridCompDestroy(esmComp, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -108,5 +102,5 @@ program esmApp ! Finalize ESMF call ESMF_Finalize() - -end program + +end program diff --git a/AtmOcnMirrorFieldsProto/ocn.F90 b/AtmOcnMirrorFieldsProto/ocn.F90 index 6ae27979..8790b61c 100644 --- a/AtmOcnMirrorFieldsProto/ocn.F90 +++ b/AtmOcnMirrorFieldsProto/ocn.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -19,73 +19,78 @@ module OCN use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_SetClock => label_SetClock, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetVM, SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeAdvertise, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeRealize, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_SetClock, & + call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & specRoutine=SetClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeAdvertise(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: air_pressure_at_sea_level call NUOPC_Advertise(importState, & StandardName="air_pressure_at_sea_level", name="pmsl", & @@ -97,7 +102,7 @@ subroutine InitializeAdvertise(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(importState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", & @@ -120,23 +125,30 @@ subroutine InitializeAdvertise(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeRealize(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_TimeInterval) :: stabilityTimeStep type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/100, 20/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -161,7 +173,7 @@ subroutine InitializeRealize(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux field = ESMF_FieldCreate(name="rsns", grid=gridIn, & typekind=ESMF_TYPEKIND_R8, rc=rc) @@ -194,26 +206,26 @@ subroutine InitializeRealize(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- subroutine SetClock(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_TimeInterval) :: stabilityTimeStep rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock call NUOPC_ModelGet(model, modelClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! initialize internal clock ! here: parent Clock and stability timeStep determine actual model timeStep !TODO: stabilityTimeStep should be read in from configuation @@ -228,16 +240,16 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) !$ use omp_lib type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -250,8 +262,8 @@ subroutine ModelAdvance(model, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -259,7 +271,7 @@ subroutine ModelAdvance(model, rc) file=__FILE__)) & return ! bail out - ! Query the VM of the component for the localPeCount and set OpenMP + ! Query the VM of the component for the localPeCount and set OpenMP ! num_threads accordingly. call ESMF_GridCompGet(model, vm=vm, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -292,14 +304,14 @@ subroutine ModelAdvance(model, rc) !$omp end parallel ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set in SetClock(), ! its timeStep is likely smaller than the parent timeStep. As a consequence - ! the time interval covered by a single parent timeStep will result in - ! multiple calls to the ModelAdvance() routine. Every time the currTime + ! the time interval covered by a single parent timeStep will result in + ! multiple calls to the Advance() routine. Every time the currTime ! will come in by one internal timeStep advanced. This goes until the ! stopTime of the internal Clock has been reached. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing OCN from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -311,13 +323,13 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_TimePrint(currTime + timeStep, & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -360,4 +372,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnPetListProto/atm.F90 b/AtmOcnPetListProto/atm.F90 index 84b7d737..a6c3ab52 100644 --- a/AtmOcnPetListProto/atm.F90 +++ b/AtmOcnPetListProto/atm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,66 +17,72 @@ module ATM use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetVM, SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! Disabling the following macro, e.g. renaming to WITHIMPORTFIELDS_disable, ! will result in a model component that does not advertise any importable ! Fields. Use this if you want to drive the model independently. @@ -90,7 +96,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out #endif - + ! exportable field: air_pressure_at_sea_level call NUOPC_Advertise(exportState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -98,7 +104,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -108,22 +114,29 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/10, 100/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -178,14 +191,14 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) !$ use omp_lib type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -194,8 +207,8 @@ subroutine ModelAdvance(model, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -203,7 +216,7 @@ subroutine ModelAdvance(model, rc) file=__FILE__)) & return ! bail out - ! Query the VM of the component for the localPeCount and set OpenMP + ! Query the VM of the component for the localPeCount and set OpenMP ! num_threads accordingly. call ESMF_GridCompGet(model, vm=vm, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -236,12 +249,12 @@ subroutine ModelAdvance(model, rc) !$omp end parallel ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set by default, ! its timeStep is equal to the parent timeStep. As a consequence the ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. - + ! for this call of the Advance() routine. + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing ATM from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -253,7 +266,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -268,4 +281,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnPetListProto/esm.F90 b/AtmOcnPetListProto/esm.F90 index 67a672b6..b78ba591 100644 --- a/AtmOcnPetListProto/esm.F90 +++ b/AtmOcnPetListProto/esm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -18,20 +18,19 @@ module ESM use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices + driverSS => SetServices use ATM, only: atmSVM => SetVM, atmSS => SetServices use OCN, only: ocnSVM => SetVM, ocnSS => SetServices - + use NUOPC_Connector, only: cplSS => SetServices - + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -41,16 +40,16 @@ subroutine SetServices(driver, rc) integer, intent(out) :: rc rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & + + ! specialize driver + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -71,7 +70,7 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables type(ESMF_Grid) :: grid type(ESMF_Field) :: field @@ -84,7 +83,7 @@ subroutine SetModelServices(driver, rc) integer :: petCount, i integer, allocatable :: petList(:) type(ESMF_Info) :: info - + ! - diagnostics - type(ESMF_VM) :: vm logical :: isFlag @@ -92,21 +91,21 @@ subroutine SetModelServices(driver, rc) integer :: mpiComm rc = ESMF_SUCCESS - + ! Create and set the info object that is used to pass hints into methods info = ESMF_InfoCreate(rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! get the petCount call ESMF_GridCompGet(driver, petCount=petCount, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for ATM with petList on first half of PETs allocate(petList(petCount/2)) do i=1, petCount/2 @@ -130,7 +129,7 @@ subroutine SetModelServices(driver, rc) file=__FILE__)) & return ! bail out deallocate(petList) - + ! - ATM diagnostics - isFlag = ESMF_GridCompIsPetLocal(child, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -143,7 +142,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call ESMF_GridCompGet(child, vm=vm, rc=rc) + call ESMF_GridCompGet(child, vm=vm, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -174,7 +173,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + #define ATTR_TEST_1_off #define ATTR_TEST_2_off @@ -195,7 +194,7 @@ subroutine SetModelServices(driver, rc) return ! bail out #endif #endif - + ! SetServices for OCN with petList on second half of PETs allocate(petList(petCount/2)) do i=1, petCount/2 @@ -219,7 +218,7 @@ subroutine SetModelServices(driver, rc) file=__FILE__)) & return ! bail out deallocate(petList) - + ! - OCN diagnostics - isFlag = ESMF_GridCompIsPetLocal(child, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -232,7 +231,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call ESMF_GridCompGet(child, vm=vm, rc=rc) + call ESMF_GridCompGet(child, vm=vm, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -263,7 +262,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for atm2ocn call NUOPC_DriverAddComp(driver, srcCompLabel="ATM", dstCompLabel="OCN", & compSetServicesRoutine=cplSS, comp=connector, rc=rc) @@ -276,7 +275,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for ocn2atm call NUOPC_DriverAddComp(driver, srcCompLabel="OCN", dstCompLabel="ATM", & compSetServicesRoutine=cplSS, comp=connector, rc=rc) @@ -289,7 +288,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! set the driver clock call ESMF_TimeIntervalSet(timeStep, m=15, rc=rc) ! 15 minute steps if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -317,13 +316,13 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- diff --git a/AtmOcnPetListProto/esmApp.F90 b/AtmOcnPetListProto/esmApp.F90 index ed302230..9e5e2ae8 100644 --- a/AtmOcnPetListProto/esmApp.F90 +++ b/AtmOcnPetListProto/esmApp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -21,7 +21,7 @@ program esmApp integer :: rc, urc type(ESMF_GridComp) :: esmComp - + ! Initialize ESMF call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, & defaultCalkind=ESMF_CALKIND_GREGORIAN, rc=rc) @@ -29,12 +29,6 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - - call ESMF_LogSet(flush=.true., rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) call ESMF_LogWrite("esmApp STARTING", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -48,7 +42,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! SetServices for the earth system Component call ESMF_GridCompSetServices(esmComp, esmSS, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -59,7 +53,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Initialize for the earth system Component call ESMF_GridCompInitialize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -70,7 +64,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Run for earth the system Component call ESMF_GridCompRun(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -81,7 +75,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Finalize for the earth system Component call ESMF_GridCompFinalize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -92,14 +86,14 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Destroy the earth system Component call ESMF_GridCompDestroy(esmComp, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -108,5 +102,5 @@ program esmApp ! Finalize ESMF call ESMF_Finalize() - -end program + +end program diff --git a/AtmOcnPetListProto/ocn.F90 b/AtmOcnPetListProto/ocn.F90 index eb0233f5..d8cf9b43 100644 --- a/AtmOcnPetListProto/ocn.F90 +++ b/AtmOcnPetListProto/ocn.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,73 +17,78 @@ module OCN use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_SetClock => label_SetClock, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetVM, SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_SetClock, & + call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & specRoutine=SetClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! Disabling the following macro, e.g. renaming to WITHIMPORTFIELDS_disable, ! will result in a model component that does not advertise any importable ! Fields. Use this if you want to drive the model independently. @@ -96,7 +101,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(importState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -115,23 +120,30 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_TimeInterval) :: stabilityTimeStep type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/100, 20/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -157,7 +169,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux field = ESMF_FieldCreate(name="rsns", grid=gridIn, & typekind=ESMF_TYPEKIND_R8, rc=rc) @@ -186,26 +198,26 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- subroutine SetClock(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_TimeInterval) :: stabilityTimeStep rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock call NUOPC_ModelGet(model, modelClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! initialize internal clock ! here: parent Clock and stability timeStep determine actual model timeStep !TODO: stabilityTimeStep should be read in from configuation @@ -220,16 +232,16 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) !$ use omp_lib type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -240,8 +252,8 @@ subroutine ModelAdvance(model, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -249,7 +261,7 @@ subroutine ModelAdvance(model, rc) file=__FILE__)) & return ! bail out - ! Query the VM of the component for the localPeCount and set OpenMP + ! Query the VM of the component for the localPeCount and set OpenMP ! num_threads accordingly. call ESMF_GridCompGet(model, vm=vm, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -282,14 +294,14 @@ subroutine ModelAdvance(model, rc) !$omp end parallel ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set in SetClock(), ! its timeStep is likely smaller than the parent timeStep. As a consequence - ! the time interval covered by a single parent timeStep will result in - ! multiple calls to the ModelAdvance() routine. Every time the currTime + ! the time interval covered by a single parent timeStep will result in + ! multiple calls to the Advance() routine. Every time the currTime ! will come in by one internal timeStep advanced. This goes until the ! stopTime of the internal Clock has been reached. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing OCN from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -301,13 +313,13 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_TimePrint(currTime + timeStep, & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -322,4 +334,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnProto/atm.F90 b/AtmOcnProto/atm.F90 index 3c64d026..8299589c 100644 --- a/AtmOcnProto/atm.F90 +++ b/AtmOcnProto/atm.F90 @@ -17,66 +17,72 @@ module ATM use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! Disabling the following macro, e.g. renaming to WITHIMPORTFIELDS_disable, ! will result in a model component that does not advertise any importable ! Fields. Use this if you want to drive the model independently. @@ -90,7 +96,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out #endif - + ! exportable field: air_pressure_at_sea_level call NUOPC_Advertise(exportState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -98,7 +104,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -108,22 +114,29 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/10, 100/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -135,7 +148,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out gridOut = gridIn ! for now out same as in - + #ifdef WITHIMPORTFIELDS ! importable field: sea_surface_temperature field = ESMF_FieldCreate(name="sst", grid=gridIn, & @@ -188,7 +201,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out #define WITH_FORMAL_REALIZE #ifdef WITH_FORMAL_REALIZE - ! There is not need to formally call Realize() when completing the + ! There is not need to formally call Realize() when completing the ! adverised field directly. However, calling Realize() also works. call NUOPC_Realize(exportState, field=field, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -212,13 +225,13 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -226,12 +239,12 @@ subroutine ModelAdvance(model, rc) #define NUOPC_TRACE__OFF #ifdef NUOPC_TRACE - call ESMF_TraceRegionEnter("ATM:ModelAdvance") + call ESMF_TraceRegionEnter("ATM:Advance") #endif rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -240,12 +253,12 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set by default, ! its timeStep is equal to the parent timeStep. As a consequence the ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. - + ! for this call of the Advance() routine. + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing ATM from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -257,7 +270,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -271,9 +284,11 @@ subroutine ModelAdvance(model, rc) return ! bail out #ifdef NUOPC_TRACE - call ESMF_TraceRegionExit("ATM:ModelAdvance") + call ESMF_TraceRegionExit("ATM:Advance") #endif - + end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnProto/esm.F90 b/AtmOcnProto/esm.F90 index d43a0f8f..2364c70c 100644 --- a/AtmOcnProto/esm.F90 +++ b/AtmOcnProto/esm.F90 @@ -17,20 +17,19 @@ module ESM use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices - + driverSS => SetServices + use ATM, only: atmSS => SetServices use OCN, only: ocnSS => SetServices - + use NUOPC_Connector, only: cplSS => SetServices - + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -38,26 +37,26 @@ module ESM subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & + + ! specialize driver + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! set driver verbosity - call NUOPC_CompAttributeSet(driver, name="Verbosity", value="low", rc=rc) + call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -70,7 +69,7 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables type(ESMF_Grid) :: grid type(ESMF_Field) :: field @@ -82,34 +81,34 @@ subroutine SetModelServices(driver, rc) type(ESMF_CplComp) :: connector rc = ESMF_SUCCESS - + ! SetServices for ATM call NUOPC_DriverAddComp(driver, "ATM", atmSS, comp=child, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompAttributeSet(child, name="Verbosity", value="low", rc=rc) + call NUOPC_CompAttributeSet(child, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for OCN call NUOPC_DriverAddComp(driver, "OCN", ocnSS, comp=child, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompAttributeSet(child, name="Verbosity", value="low", rc=rc) + call NUOPC_CompAttributeSet(child, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! Disabling the following macro, e.g. renaming to WITHCONNECTORS_disable, ! will result in a driver that does not call connectors between the model - ! components. This mode can be used if all model components are driven + ! components. This mode can be used if all model components are driven ! as independent models. However, even for independent models the ! connectors can be set here, but will turn into no-ops. #define WITHCONNECTORS @@ -121,12 +120,12 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompAttributeSet(connector, name="Verbosity", value="low", rc=rc) + call NUOPC_CompAttributeSet(connector, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for ocn2atm call NUOPC_DriverAddComp(driver, srcCompLabel="OCN", dstCompLabel="ATM", & compSetServicesRoutine=cplSS, comp=connector, rc=rc) @@ -134,14 +133,14 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompAttributeSet(connector, name="Verbosity", value="low", rc=rc) + call NUOPC_CompAttributeSet(connector, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + #endif - + ! set the driver clock call ESMF_TimeIntervalSet(timeStep, m=15, rc=rc) ! 15 minute steps if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -169,13 +168,15 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnProto/esmApp.F90 b/AtmOcnProto/esmApp.F90 index f22999b9..9e5e2ae8 100644 --- a/AtmOcnProto/esmApp.F90 +++ b/AtmOcnProto/esmApp.F90 @@ -15,21 +15,21 @@ program esmApp !----------------------------------------------------------------------------- use ESMF - use NUOPC use ESM, only: esmSS => SetServices implicit none integer :: rc, urc type(ESMF_GridComp) :: esmComp - + ! Initialize ESMF - call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, rc=rc) + call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, & + defaultCalkind=ESMF_CALKIND_GREGORIAN, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp STARTING", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -54,13 +54,6 @@ program esmApp file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - ! Set Profiling Attribute - call NUOPC_CompAttributeSet(esmComp, name="Profiling", value="0", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - ! Call Initialize for the earth system Component call ESMF_GridCompInitialize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -71,7 +64,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Run for earth the system Component call ESMF_GridCompRun(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -82,7 +75,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Finalize for the earth system Component call ESMF_GridCompFinalize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -93,14 +86,14 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Destroy the earth system Component call ESMF_GridCompDestroy(esmComp, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -109,5 +102,5 @@ program esmApp ! Finalize ESMF call ESMF_Finalize() - -end program + +end program diff --git a/AtmOcnProto/ocn.F90 b/AtmOcnProto/ocn.F90 index 4311c427..afecd02a 100644 --- a/AtmOcnProto/ocn.F90 +++ b/AtmOcnProto/ocn.F90 @@ -17,73 +17,78 @@ module OCN use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_SetClock => label_SetClock, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_SetClock, & + call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & specRoutine=SetClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! Disabling the following macro, e.g. renaming to WITHIMPORTFIELDS_disable, ! will result in a model component that does not advertise any importable ! Fields. Use this if you want to drive the model independently. @@ -96,7 +101,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(importState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -115,23 +120,30 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_TimeInterval) :: stabilityTimeStep type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/100, 10/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -157,7 +169,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux field = ESMF_FieldCreate(name="rsns", grid=gridIn, & typekind=ESMF_TYPEKIND_R8, rc=rc) @@ -186,26 +198,26 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- subroutine SetClock(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_TimeInterval) :: stabilityTimeStep rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock call NUOPC_ModelGet(model, modelClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! initialize internal clock ! here: parent Clock and stability timeStep determine actual model timeStep !TODO: stabilityTimeStep should be read in from configuation @@ -220,15 +232,15 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -238,12 +250,12 @@ subroutine ModelAdvance(model, rc) #define NUOPC_TRACE__OFF #ifdef NUOPC_TRACE - call ESMF_TraceRegionEnter("OCN:ModelAdvance") + call ESMF_TraceRegionEnter("OCN:Advance") #endif - + rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -252,14 +264,14 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set in SetClock(), ! its timeStep is likely smaller than the parent timeStep. As a consequence - ! the time interval covered by a single parent timeStep will result in - ! multiple calls to the ModelAdvance() routine. Every time the currTime + ! the time interval covered by a single parent timeStep will result in + ! multiple calls to the Advance() routine. Every time the currTime ! will come in by one internal timeStep advanced. This goes until the ! stopTime of the internal Clock has been reached. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing OCN from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -271,13 +283,13 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_TimePrint(currTime + timeStep, & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -291,8 +303,10 @@ subroutine ModelAdvance(model, rc) return ! bail out #ifdef NUOPC_TRACE - call ESMF_TraceRegionExit("OCN:ModelAdvance") + call ESMF_TraceRegionExit("OCN:Advance") #endif end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnRtmTwoTimescalesProto/atm.F90 b/AtmOcnRtmTwoTimescalesProto/atm.F90 index 2152d695..7b37bac9 100644 --- a/AtmOcnRtmTwoTimescalesProto/atm.F90 +++ b/AtmOcnRtmTwoTimescalesProto/atm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,73 +17,78 @@ module ATM use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_SetClock => label_SetClock, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_SetClock, & + call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & specRoutine=SetClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: sea_surface_temperature call NUOPC_Advertise(importState, & StandardName="sea_surface_temperature", name="sst", rc=rc) @@ -91,7 +96,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: air_pressure_at_sea_level call NUOPC_Advertise(exportState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -99,7 +104,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -117,22 +122,29 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/10, 100/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -198,26 +210,26 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- subroutine SetClock(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_TimeInterval) :: timeStep rc = ESMF_SUCCESS - - ! query the Component for its clock + + ! query for clock call NUOPC_ModelGet(model, modelClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! initialize internal clock ! - on entry, the component clock is a copy of the parent clock ! - the parent clock is on the slow timescale 1day timesteps @@ -233,23 +245,23 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -258,12 +270,12 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set by default, ! its timeStep is equal to the parent timeStep. As a consequence the ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. - + ! for this call of the Advance() routine. + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing ATM from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -275,7 +287,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & diff --git a/AtmOcnRtmTwoTimescalesProto/esm.F90 b/AtmOcnRtmTwoTimescalesProto/esm.F90 index 47e33f46..77d5d893 100644 --- a/AtmOcnRtmTwoTimescalesProto/esm.F90 +++ b/AtmOcnRtmTwoTimescalesProto/esm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,22 +17,20 @@ module ESM use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices, & - driver_label_SetRunSequence => label_SetRunSequence - + driverSS => SetServices + use ATM, only: atmSS => SetServices use OCN, only: ocnSS => SetServices use RTM, only: rtmSS => SetServices - + use NUOPC_Connector, only: cplSS => SetServices - + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -40,38 +38,45 @@ module ESM subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & + + ! specialize driver + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetRunSequence, & + call NUOPC_CompSpecialize(driver, specLabel=label_SetRunSequence, & specRoutine=SetRunSequence, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + + ! set driver verbosity + call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + end subroutine !----------------------------------------------------------------------------- - + subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables type(ESMF_Time) :: startTime type(ESMF_Time) :: stopTime @@ -82,14 +87,14 @@ subroutine SetModelServices(driver, rc) integer :: petCount rc = ESMF_SUCCESS - + ! get the petCount call ESMF_GridCompGet(driver, petCount=petCount, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for ATM call NUOPC_DriverAddComp(driver, "ATM", atmSS, & petList=(/0,1/), comp=child, rc=rc) @@ -102,7 +107,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for OCN call NUOPC_DriverAddComp(driver, "OCN", ocnSS, & petList=(/2/), comp=child, rc=rc) @@ -157,13 +162,13 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- @@ -171,7 +176,7 @@ subroutine SetModelServices(driver, rc) subroutine SetRunSequence(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables character(ESMF_MAXSTR) :: name type(NUOPC_FreeFormat) :: runSeqFF @@ -181,12 +186,12 @@ subroutine SetRunSequence(driver, rc) type(ESMF_Clock) :: internalClock rc = ESMF_SUCCESS - + ! query the driver for its name call ESMF_GridCompGet(driver, name=name, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - + ! set up free format run sequence runSeqFF = NUOPC_FreeFormatCreate(stringList=(/ & " @* ", & diff --git a/AtmOcnRtmTwoTimescalesProto/esmApp.F90 b/AtmOcnRtmTwoTimescalesProto/esmApp.F90 index 7782a06b..8f083c49 100644 --- a/AtmOcnRtmTwoTimescalesProto/esmApp.F90 +++ b/AtmOcnRtmTwoTimescalesProto/esmApp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -22,14 +22,15 @@ program esmApp integer :: rc, urc type(ESMF_GridComp) :: esmComp - + ! Initialize ESMF - call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, rc=rc) + call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, & + defaultCalkind=ESMF_CALKIND_GREGORIAN, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp STARTING", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -39,12 +40,12 @@ program esmApp !----------------------------------------------------------------------------- ! extend the NUOPC Field Dictionary to cover new "silly" Fields to/from RTM - call NUOPC_FieldDictionaryAddEntry("field_to_rtm", "sillyUnit", rc=rc); + call NUOPC_FieldDictionaryAddEntry("field_to_rtm", "sillyUnit", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - call NUOPC_FieldDictionaryAddEntry("field_from_rtm", "sillyUnit2", rc=rc); + call NUOPC_FieldDictionaryAddEntry("field_from_rtm", "sillyUnit2", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -58,7 +59,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! SetServices for the earth system Component call ESMF_GridCompSetServices(esmComp, esmSS, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -69,7 +70,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Initialize for the earth system Component call ESMF_GridCompInitialize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -80,7 +81,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Run for earth the system Component call ESMF_GridCompRun(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -91,7 +92,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Finalize for the earth system Component call ESMF_GridCompFinalize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -102,14 +103,14 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Destroy the earth system Component call ESMF_GridCompDestroy(esmComp, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -118,5 +119,5 @@ program esmApp ! Finalize ESMF call ESMF_Finalize() - -end program + +end program diff --git a/AtmOcnRtmTwoTimescalesProto/ocn.F90 b/AtmOcnRtmTwoTimescalesProto/ocn.F90 index f001242c..1af3350b 100644 --- a/AtmOcnRtmTwoTimescalesProto/ocn.F90 +++ b/AtmOcnRtmTwoTimescalesProto/ocn.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,80 +17,84 @@ module OCN use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_SetClock => label_SetClock, & - model_label_CheckImport => label_CheckImport, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_SetClock, & + call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & specRoutine=SetClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_CheckImport, & - specPhaseLabel="RunPhase1", specRoutine=CheckImport, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_CheckImport, & + specRoutine=CheckImport, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: air_pressure_at_sea_level call NUOPC_Advertise(importState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -98,7 +102,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(importState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -124,23 +128,30 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_TimeInterval) :: stabilityTimeStep type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/100, 10/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -165,7 +176,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux field = ESMF_FieldCreate(name="rsns", grid=gridIn, & typekind=ESMF_TYPEKIND_R8, rc=rc) @@ -206,26 +217,26 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- subroutine SetClock(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_TimeInterval) :: timeStep rc = ESMF_SUCCESS - - ! query the Component for its clock + + ! query for clock call NUOPC_ModelGet(model, modelClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! initialize internal clock ! - on entry, the component clock is a copy of the parent clock ! - the parent clock is on the slow timescale 1day timesteps @@ -241,15 +252,15 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -258,8 +269,8 @@ subroutine ModelAdvance(model, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -268,14 +279,14 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set in SetClock(), ! its timeStep is likely smaller than the parent timeStep. As a consequence - ! the time interval covered by a single parent timeStep will result in - ! multiple calls to the ModelAdvance() routine. Every time the currTime + ! the time interval covered by a single parent timeStep will result in + ! multiple calls to the Advance() routine. Every time the currTime ! will come in by one internal timeStep advanced. This goes until the ! stopTime of the internal Clock has been reached. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing OCN from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -287,13 +298,13 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_TimePrint(currTime + timeStep, & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -313,9 +324,9 @@ subroutine ModelAdvance(model, rc) subroutine CheckImport(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! This is the routine that enforces correct time stamps on import Fields - + ! local variables type(ESMF_Clock) :: driverClock type(ESMF_Time) :: startTime, currTime @@ -324,14 +335,14 @@ subroutine CheckImport(model, rc) logical :: atCorrectTime rc = ESMF_SUCCESS - - ! query Component for the driverClock + + ! query for driverClock call NUOPC_ModelGet(model, driverClock=driverClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! get the start time and current time out of the clock call ESMF_ClockGet(driverClock, startTime=startTime, & currTime=currTime, rc=rc) @@ -339,7 +350,7 @@ subroutine CheckImport(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! query the Component for its clock and importState call NUOPC_ModelGet(model, importState=importState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -367,7 +378,7 @@ subroutine CheckImport(model, rc) rcToReturn=rc) return ! bail out endif - + ! check timestamp on "surface_net_downward_shortwave_flux" == current time call ESMF_StateGet(importState, itemName="rsns", field=field, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -409,9 +420,9 @@ subroutine CheckImport(model, rc) rcToReturn=rc) return ! bail out endif - + end subroutine !----------------------------------------------------------------------------- - + end module diff --git a/AtmOcnRtmTwoTimescalesProto/rtm.F90 b/AtmOcnRtmTwoTimescalesProto/rtm.F90 index 42e34ce3..2922430e 100644 --- a/AtmOcnRtmTwoTimescalesProto/rtm.F90 +++ b/AtmOcnRtmTwoTimescalesProto/rtm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -16,67 +16,73 @@ module RTM use ESMF use NUOPC - use NUOPC_Model, only: & - model_routine_SS => SetServices, & - model_label_Advance => label_Advance - + use NUOPC_Model, & + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - - subroutine SetServices(gcomp, rc) - type(ESMF_GridComp) :: gcomp + + subroutine SetServices(model, rc) + type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(gcomp, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(gcomp, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(gcomp, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(gcomp, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(gcomp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: gcomp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock + subroutine Advertise(model, rc) + type(ESMF_GridComp) :: model integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: field_to_rtm call NUOPC_Advertise(importState, & StandardName="field_to_rtm", name="ftr", rc=rc) @@ -94,23 +100,30 @@ subroutine InitializeP1(gcomp, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(gcomp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: gcomp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock + subroutine Realize(model, rc) + type(ESMF_GridComp) :: model integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_TimeInterval) :: stabilityTimeStep type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/10, 100/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -122,7 +135,7 @@ subroutine InitializeP2(gcomp, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out gridOut = gridIn ! for now out same as in - + ! importable field: field_to_rtm field = ESMF_FieldCreate(name="ftr", grid=gridIn, & typekind=ESMF_TYPEKIND_R8, rc=rc) @@ -135,7 +148,7 @@ subroutine InitializeP2(gcomp, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: field_from_rtm field = ESMF_FieldCreate(name="ffr", grid=gridOut, & typekind=ESMF_TYPEKIND_R8, rc=rc) @@ -148,15 +161,15 @@ subroutine InitializeP2(gcomp, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine ModelAdvance(gcomp, rc) - type(ESMF_GridComp) :: gcomp + subroutine Advance(model, rc) + type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -165,9 +178,9 @@ subroutine ModelAdvance(gcomp, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState - call ESMF_GridCompGet(gcomp, clock=clock, importState=importState, & + + ! query for clock, importState and exportState + call ESMF_GridCompGet(model, clock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -175,7 +188,7 @@ subroutine ModelAdvance(gcomp, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing RTM from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -187,13 +200,13 @@ subroutine ModelAdvance(gcomp, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_TimePrint(currTime + timeStep, & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -208,4 +221,6 @@ subroutine ModelAdvance(gcomp, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnScalarProto/atm.F90 b/AtmOcnScalarProto/atm.F90 index d6f1ddd4..6e32c394 100644 --- a/AtmOcnScalarProto/atm.F90 +++ b/AtmOcnScalarProto/atm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,66 +17,72 @@ module ATM use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: sea_surface_temperature call NUOPC_Advertise(importState, & StandardName="sea_surface_temperature", name="sst", rc=rc) @@ -84,7 +90,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: air_pressure_at_sea_level call NUOPC_Advertise(exportState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -92,7 +98,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -109,27 +115,34 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + type(ESMF_ArraySpec) :: arrayspec !!!!!! TODO: remove arrayspec once !!!! FieldCreate is fixed to allow direct typekind spec with replicated dims type(ESMF_DistGrid) :: distgrid type(ESMF_Grid) :: grid rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/10, 100/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -223,13 +236,13 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -242,8 +255,8 @@ subroutine ModelAdvance(model, rc) type(ESMF_FileStatus_Flag) :: status rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -252,12 +265,12 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set by default, ! its timeStep is equal to the parent timeStep. As a consequence the ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. - + ! for this call of the Advance() routine. + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing ATM from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -269,7 +282,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -281,7 +294,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! update the scalar field call ESMF_StateGet(exportState, field=field, itemName="scalar_test", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -313,7 +326,9 @@ subroutine ModelAdvance(model, rc) return ! bail out #endif step=step+1 - + end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnScalarProto/esm.F90 b/AtmOcnScalarProto/esm.F90 index bc2f7c30..20325f10 100644 --- a/AtmOcnScalarProto/esm.F90 +++ b/AtmOcnScalarProto/esm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,21 +17,19 @@ module ESM use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices, & - driver_label_ModifyCplLists => label_ModifyCplLists + driverSS => SetServices use ATM, only: atmSS => SetServices use OCN, only: ocnSS => SetServices - + use NUOPC_Connector, only: cplSS => SetServices - + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -39,32 +37,32 @@ module ESM subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & + + ! specialize driver + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(driver, specLabel=driver_label_ModifyCplLists, & + call NUOPC_CompSpecialize(driver, specLabel=label_ModifyCplLists, & specRoutine=ModifyCplLists, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - ! set verbosity on driver - call NUOPC_CompAttributeSet(driver, name="Verbosity", value="1", rc=rc) + ! set driver verbosity + call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -77,7 +75,7 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables type(ESMF_Grid) :: grid type(ESMF_Field) :: field @@ -91,14 +89,14 @@ subroutine SetModelServices(driver, rc) integer, allocatable :: petList(:) rc = ESMF_SUCCESS - + ! get the petCount call ESMF_GridCompGet(driver, petCount=petCount, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for ATM with petList on first half of PETs allocate(petList(petCount/2)) do i=1, petCount/2 @@ -116,7 +114,7 @@ subroutine SetModelServices(driver, rc) file=__FILE__)) & return ! bail out deallocate(petList) - + ! SetServices for OCN with petList on second half of PETs allocate(petList(petCount/2)) do i=1, petCount/2 @@ -134,7 +132,7 @@ subroutine SetModelServices(driver, rc) file=__FILE__)) & return ! bail out deallocate(petList) - + ! SetServices for atm2ocn call NUOPC_DriverAddComp(driver, srcCompLabel="ATM", dstCompLabel="OCN", & compSetServicesRoutine=cplSS, comp=connector, rc=rc) @@ -147,7 +145,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for ocn2atm call NUOPC_DriverAddComp(driver, srcCompLabel="OCN", dstCompLabel="ATM", & compSetServicesRoutine=cplSS, comp=connector, rc=rc) @@ -160,7 +158,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! set the driver clock call ESMF_TimeIntervalSet(timeStep, m=15, rc=rc) ! 15 minute steps if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -188,13 +186,13 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- @@ -202,28 +200,28 @@ subroutine SetModelServices(driver, rc) subroutine ModifyCplLists(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables - character(len=160) :: msg + character(len=160) :: msg type(ESMF_CplComp), pointer :: connectorList(:) integer :: i, j, cplListSize character(len=160), allocatable :: cplList(:) - + rc = ESMF_SUCCESS - + call ESMF_LogWrite("Driver is in ModifyCplLists()", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + nullify(connectorList) call NUOPC_DriverGetComp(driver, compList=connectorList, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + write (msg,*) "Found ", size(connectorList), " Connectors."// & " Modifying CplList Attribute...." call ESMF_LogWrite(trim(msg), ESMF_LOGMSG_INFO, rc=rc) @@ -231,7 +229,7 @@ subroutine ModifyCplLists(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + do i=1, size(connectorList) ! query the cplList for connector i call NUOPC_CompAttributeGet(connectorList(i), name="CplList", & @@ -265,9 +263,9 @@ subroutine ModifyCplLists(driver, rc) deallocate(cplList) endif enddo - + deallocate(connectorList) - + end subroutine !----------------------------------------------------------------------------- diff --git a/AtmOcnScalarProto/esmApp.F90 b/AtmOcnScalarProto/esmApp.F90 index 1959dba9..5b9cf7c2 100644 --- a/AtmOcnScalarProto/esmApp.F90 +++ b/AtmOcnScalarProto/esmApp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -22,7 +22,7 @@ program esmApp integer :: rc, urc type(ESMF_GridComp) :: esmComp - + ! Initialize ESMF call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, & defaultCalkind=ESMF_CALKIND_GREGORIAN, rc=rc) @@ -30,7 +30,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp STARTING", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -54,7 +54,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! SetServices for the earth system Component call ESMF_GridCompSetServices(esmComp, esmSS, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -65,7 +65,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Initialize for the earth system Component call ESMF_GridCompInitialize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -76,7 +76,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Run for earth the system Component call ESMF_GridCompRun(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -87,7 +87,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Finalize for the earth system Component call ESMF_GridCompFinalize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -98,14 +98,14 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Destroy the earth system Component call ESMF_GridCompDestroy(esmComp, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -114,5 +114,5 @@ program esmApp ! Finalize ESMF call ESMF_Finalize() - -end program + +end program diff --git a/AtmOcnScalarProto/ocn.F90 b/AtmOcnScalarProto/ocn.F90 index 25a01b38..ae225afd 100644 --- a/AtmOcnScalarProto/ocn.F90 +++ b/AtmOcnScalarProto/ocn.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,73 +17,78 @@ module OCN use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_SetClock => label_SetClock, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_SetClock, & + call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & specRoutine=SetClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: air_pressure_at_sea_level call NUOPC_Advertise(importState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -91,7 +96,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(importState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -116,21 +121,20 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_TimeInterval) :: stabilityTimeStep type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + type(ESMF_ArraySpec) :: arrayspec !!!!!! TODO: remove arrayspec once !!!! FieldCreate is fixed to allow direct typekind spec with replicated dims type(ESMF_DELayout) :: delayout @@ -138,7 +142,15 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) type(ESMF_Grid) :: grid rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/100, 20/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -163,7 +175,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux field = ESMF_FieldCreate(name="rsns", grid=gridIn, & typekind=ESMF_TYPEKIND_R8, rc=rc) @@ -238,26 +250,26 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- subroutine SetClock(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_TimeInterval) :: stabilityTimeStep rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock call NUOPC_ModelGet(model, modelClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! initialize internal clock ! here: parent Clock and stability timeStep determine actual model timeStep !TODO: stabilityTimeStep should be read in from configuation @@ -272,15 +284,15 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -291,8 +303,8 @@ subroutine ModelAdvance(model, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -301,14 +313,14 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set in SetClock(), ! its timeStep is likely smaller than the parent timeStep. As a consequence - ! the time interval covered by a single parent timeStep will result in - ! multiple calls to the ModelAdvance() routine. Every time the currTime + ! the time interval covered by a single parent timeStep will result in + ! multiple calls to the Advance() routine. Every time the currTime ! will come in by one internal timeStep advanced. This goes until the ! stopTime of the internal Clock has been reached. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing OCN from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -320,13 +332,13 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_TimePrint(currTime + timeStep, & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -362,4 +374,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnSelectExternalProto/ATM-A/atmA.F90 b/AtmOcnSelectExternalProto/ATM-A/atmA.F90 index aa150a34..a85c94fb 100644 --- a/AtmOcnSelectExternalProto/ATM-A/atmA.F90 +++ b/AtmOcnSelectExternalProto/ATM-A/atmA.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,66 +17,72 @@ module atmA use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: sea_surface_temperature call NUOPC_Advertise(importState, & StandardName="sea_surface_temperature", name="sst", rc=rc) @@ -84,7 +90,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: air_pressure_at_sea_level call NUOPC_Advertise(exportState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -92,7 +98,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -100,7 +106,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! set Component name so it becomes identifiable call ESMF_GridCompSet(model, name="atmA", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -109,22 +115,29 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/10, 100/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -177,21 +190,21 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -200,12 +213,12 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set by default, ! its timeStep is equal to the parent timeStep. As a consequence the ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. - + ! for this call of the Advance() routine. + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing ATM from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -217,7 +230,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -232,4 +245,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnSelectExternalProto/ATM-B/atmB.F90 b/AtmOcnSelectExternalProto/ATM-B/atmB.F90 index b655d89b..beb57109 100644 --- a/AtmOcnSelectExternalProto/ATM-B/atmB.F90 +++ b/AtmOcnSelectExternalProto/ATM-B/atmB.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,66 +17,72 @@ module atmB use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: sea_surface_temperature call NUOPC_Advertise(importState, & StandardName="sea_surface_temperature", name="sst", rc=rc) @@ -84,7 +90,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: air_pressure_at_sea_level call NUOPC_Advertise(exportState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -92,7 +98,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -100,34 +106,41 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! set Component name so it becomes identifiable call ESMF_GridCompSet(model, name="atmB", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! call into a procedure F77 style, i.e. without explicit interface call procedure_f77style() end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/10, 100/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -180,21 +193,21 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -203,12 +216,12 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set by default, ! its timeStep is equal to the parent timeStep. As a consequence the ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. - + ! for this call of the Advance() routine. + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing ATM from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -220,7 +233,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -235,4 +248,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnSelectExternalProto/ATM-B/procedure.F90 b/AtmOcnSelectExternalProto/ATM-B/procedure.F90 index dab3518e..5f112b6e 100644 --- a/AtmOcnSelectExternalProto/ATM-B/procedure.F90 +++ b/AtmOcnSelectExternalProto/ATM-B/procedure.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== diff --git a/AtmOcnSelectExternalProto/ATM-C/atmC.F90 b/AtmOcnSelectExternalProto/ATM-C/atmC.F90 index 5bbb0b88..f417b30d 100644 --- a/AtmOcnSelectExternalProto/ATM-C/atmC.F90 +++ b/AtmOcnSelectExternalProto/ATM-C/atmC.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,66 +17,72 @@ module atmC use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: sea_surface_temperature call NUOPC_Advertise(importState, & StandardName="sea_surface_temperature", name="sst", rc=rc) @@ -84,7 +90,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: air_pressure_at_sea_level call NUOPC_Advertise(exportState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -92,7 +98,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -100,34 +106,41 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! set Component name so it becomes identifiable call ESMF_GridCompSet(model, name="atmC", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! call into a procedure F77 style, i.e. without explicit interface call procedure_f77style2() end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/10, 100/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -180,21 +193,21 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -203,12 +216,12 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set by default, ! its timeStep is equal to the parent timeStep. As a consequence the ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. - + ! for this call of the Advance() routine. + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing ATM from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -220,7 +233,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -235,4 +248,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnSelectExternalProto/ATM-C/procedure.F90 b/AtmOcnSelectExternalProto/ATM-C/procedure.F90 index 8a793ef5..6e1de3ae 100644 --- a/AtmOcnSelectExternalProto/ATM-C/procedure.F90 +++ b/AtmOcnSelectExternalProto/ATM-C/procedure.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== diff --git a/AtmOcnSelectExternalProto/ATM-D/atmD.F90 b/AtmOcnSelectExternalProto/ATM-D/atmD.F90 index 7583eeb9..5402999c 100644 --- a/AtmOcnSelectExternalProto/ATM-D/atmD.F90 +++ b/AtmOcnSelectExternalProto/ATM-D/atmD.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,66 +17,72 @@ module atmD use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: sea_surface_temperature call NUOPC_Advertise(importState, & StandardName="sea_surface_temperature", name="sst", rc=rc) @@ -84,7 +90,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: air_pressure_at_sea_level call NUOPC_Advertise(exportState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -92,7 +98,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -100,7 +106,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! set Component name so it becomes identifiable call ESMF_GridCompSet(model, name="atmD", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -109,22 +115,29 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/10, 100/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -177,21 +190,21 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -200,12 +213,12 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set by default, ! its timeStep is equal to the parent timeStep. As a consequence the ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. - + ! for this call of the Advance() routine. + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing ATM from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -217,7 +230,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -232,4 +245,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnSelectExternalProto/ATM-E/atmE.F90 b/AtmOcnSelectExternalProto/ATM-E/atmE.F90 index 1fdd197c..e03941b5 100644 --- a/AtmOcnSelectExternalProto/ATM-E/atmE.F90 +++ b/AtmOcnSelectExternalProto/ATM-E/atmE.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,66 +17,72 @@ module atmE use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: sea_surface_temperature call NUOPC_Advertise(importState, & StandardName="sea_surface_temperature", name="sst", rc=rc) @@ -84,7 +90,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: air_pressure_at_sea_level call NUOPC_Advertise(exportState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -92,7 +98,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -100,7 +106,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! set Component name so it becomes identifiable call ESMF_GridCompSet(model, name="atmE", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -109,22 +115,29 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/100, 100/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -177,21 +190,21 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -200,12 +213,12 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set by default, ! its timeStep is equal to the parent timeStep. As a consequence the ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. - + ! for this call of the Advance() routine. + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing ATM from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -217,7 +230,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -232,6 +245,8 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module ! External access to SetServices diff --git a/AtmOcnSelectExternalProto/OcnCommon/ocnCommon.F90 b/AtmOcnSelectExternalProto/OcnCommon/ocnCommon.F90 index 15cb1bcd..cf3efc32 100644 --- a/AtmOcnSelectExternalProto/OcnCommon/ocnCommon.F90 +++ b/AtmOcnSelectExternalProto/OcnCommon/ocnCommon.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -12,18 +12,18 @@ module OceanCommon use ESMF use NUOPC - + use subModule1 use subModule2 - + implicit none - + private - + public procedure_ocnCommon - + contains - + subroutine procedure_ocnCommon(rc) integer, intent(out) :: rc print *, "Executing procedure_ocnCommon()" @@ -31,5 +31,5 @@ subroutine procedure_ocnCommon(rc) call procedure_subModule2() rc=ESMF_SUCCESS end subroutine - + end module diff --git a/AtmOcnSelectExternalProto/OcnCommon/subModule1.F90 b/AtmOcnSelectExternalProto/OcnCommon/subModule1.F90 index c92aa687..c07ed7fa 100644 --- a/AtmOcnSelectExternalProto/OcnCommon/subModule1.F90 +++ b/AtmOcnSelectExternalProto/OcnCommon/subModule1.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -11,15 +11,15 @@ module subModule1 implicit none - + private - + public procedure_subModule1 - + contains - + subroutine procedure_subModule1() print *, "Executing procedure_subModule1()" end subroutine - + end module diff --git a/AtmOcnSelectExternalProto/OcnCommon/subModule2.F90 b/AtmOcnSelectExternalProto/OcnCommon/subModule2.F90 index 6ac11dcd..7126d52f 100644 --- a/AtmOcnSelectExternalProto/OcnCommon/subModule2.F90 +++ b/AtmOcnSelectExternalProto/OcnCommon/subModule2.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -11,15 +11,15 @@ module subModule2 implicit none - + private - + public procedure_subModule2 - + contains - + subroutine procedure_subModule2() print *, "Executing procedure_subModule2()" end subroutine - + end module diff --git a/AtmOcnSelectExternalProto/OcnModelA/ocn.F90 b/AtmOcnSelectExternalProto/OcnModelA/ocn.F90 index 5177ffd5..c6185f3b 100644 --- a/AtmOcnSelectExternalProto/OcnModelA/ocn.F90 +++ b/AtmOcnSelectExternalProto/OcnModelA/ocn.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,75 +17,80 @@ module ocnA use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_SetClock => label_SetClock, & - model_label_Advance => label_Advance - + modelSS => SetServices + use FRONT_OCNCOMMON - + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_SetClock, & + call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & specRoutine=SetClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: air_pressure_at_sea_level call NUOPC_Advertise(importState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -93,7 +98,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(importState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -116,32 +121,39 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! call into procedure from FRONT_OCNCOMMON module call procedure_ocnCommon(rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_TimeInterval) :: stabilityTimeStep type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/100, 10/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -166,7 +178,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux field = ESMF_FieldCreate(name="rsns", grid=gridIn, & typekind=ESMF_TYPEKIND_R8, rc=rc) @@ -194,26 +206,26 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- subroutine SetClock(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_TimeInterval) :: stabilityTimeStep rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock call NUOPC_ModelGet(model, modelClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! initialize internal clock ! here: parent Clock and stability timeStep determine actual model timeStep !TODO: stabilityTimeStep should be read in from configuation @@ -228,15 +240,15 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -245,8 +257,8 @@ subroutine ModelAdvance(model, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -255,14 +267,14 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set in SetClock(), ! its timeStep is likely smaller than the parent timeStep. As a consequence - ! the time interval covered by a single parent timeStep will result in - ! multiple calls to the ModelAdvance() routine. Every time the currTime + ! the time interval covered by a single parent timeStep will result in + ! multiple calls to the Advance() routine. Every time the currTime ! will come in by one internal timeStep advanced. This goes until the ! stopTime of the internal Clock has been reached. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing OCN from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -274,13 +286,13 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_TimePrint(currTime + timeStep, & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -295,4 +307,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnSelectExternalProto/OcnModelB/ocn.F90 b/AtmOcnSelectExternalProto/OcnModelB/ocn.F90 index 47d57ed4..3037d5df 100644 --- a/AtmOcnSelectExternalProto/OcnModelB/ocn.F90 +++ b/AtmOcnSelectExternalProto/OcnModelB/ocn.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,76 +17,81 @@ module ocnB use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_SetClock => label_SetClock, & - model_label_Advance => label_Advance - + modelSS => SetServices + use FRONT_OCNCOMMON use FRONT_OCNSUB, only: sub_SS => SetServices - + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_SetClock, & + call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & specRoutine=SetClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: air_pressure_at_sea_level call NUOPC_Advertise(importState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -94,7 +99,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(importState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -117,32 +122,39 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! call into procedure from FRONT_OCNCOMMON module call procedure_ocnCommon(rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_TimeInterval) :: stabilityTimeStep type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/100, 10/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -167,7 +179,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux field = ESMF_FieldCreate(name="rsns", grid=gridIn, & typekind=ESMF_TYPEKIND_R8, rc=rc) @@ -195,26 +207,26 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- subroutine SetClock(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_TimeInterval) :: stabilityTimeStep rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock call NUOPC_ModelGet(model, modelClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! initialize internal clock ! here: parent Clock and stability timeStep determine actual model timeStep !TODO: stabilityTimeStep should be read in from configuation @@ -229,15 +241,15 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -246,8 +258,8 @@ subroutine ModelAdvance(model, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -256,14 +268,14 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set in SetClock(), ! its timeStep is likely smaller than the parent timeStep. As a consequence - ! the time interval covered by a single parent timeStep will result in - ! multiple calls to the ModelAdvance() routine. Every time the currTime + ! the time interval covered by a single parent timeStep will result in + ! multiple calls to the Advance() routine. Every time the currTime ! will come in by one internal timeStep advanced. This goes until the ! stopTime of the internal Clock has been reached. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing OCN from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -275,13 +287,13 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_TimePrint(currTime + timeStep, & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -296,4 +308,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnSelectExternalProto/OcnModelC/ocn.F90 b/AtmOcnSelectExternalProto/OcnModelC/ocn.F90 index 0adabe4f..0bf4f2cc 100644 --- a/AtmOcnSelectExternalProto/OcnModelC/ocn.F90 +++ b/AtmOcnSelectExternalProto/OcnModelC/ocn.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,76 +17,81 @@ module ocnC use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_SetClock => label_SetClock, & - model_label_Advance => label_Advance - + modelSS => SetServices + use FRONT_OCNCOMMON use FRONT_OCNSUB, only: sub_SS => SetServices - + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_SetClock, & + call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & specRoutine=SetClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: air_pressure_at_sea_level call NUOPC_Advertise(importState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -94,7 +99,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(importState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -117,32 +122,39 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! call into procedure from FRONT_OCNCOMMON module call procedure_ocnCommon(rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_TimeInterval) :: stabilityTimeStep type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/100, 10/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -167,7 +179,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux field = ESMF_FieldCreate(name="rsns", grid=gridIn, & typekind=ESMF_TYPEKIND_R8, rc=rc) @@ -195,26 +207,26 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- subroutine SetClock(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_TimeInterval) :: stabilityTimeStep rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock call NUOPC_ModelGet(model, modelClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! initialize internal clock ! here: parent Clock and stability timeStep determine actual model timeStep !TODO: stabilityTimeStep should be read in from configuation @@ -229,15 +241,15 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -246,8 +258,8 @@ subroutine ModelAdvance(model, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -256,14 +268,14 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set in SetClock(), ! its timeStep is likely smaller than the parent timeStep. As a consequence - ! the time interval covered by a single parent timeStep will result in - ! multiple calls to the ModelAdvance() routine. Every time the currTime + ! the time interval covered by a single parent timeStep will result in + ! multiple calls to the Advance() routine. Every time the currTime ! will come in by one internal timeStep advanced. This goes until the ! stopTime of the internal Clock has been reached. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing OCN from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -275,13 +287,13 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_TimePrint(currTime + timeStep, & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -296,6 +308,8 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module ! External access to SetServices diff --git a/AtmOcnSelectExternalProto/esm.F90 b/AtmOcnSelectExternalProto/esm.F90 index 206ebb00..8766140e 100644 --- a/AtmOcnSelectExternalProto/esm.F90 +++ b/AtmOcnSelectExternalProto/esm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -25,10 +25,9 @@ module ESM use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices + driverSS => SetServices - !- select exactly one ATM component + !- select exactly one ATM component #if (defined FRONT_ATMA && !defined FRONT_ATMB && !defined FRONT_ATMC && !defined FRONT_ATMD && !defined FRONT_ATME && !defined FRONT_SO_ATME && !defined FRONT_ATMF && !defined FRONT_H_ATMF ) use FRONT_ATMA, only: atmSS => SetServices #elif (!defined FRONT_ATMA && defined FRONT_ATMB && !defined FRONT_ATMC && !defined FRONT_ATMD && !defined FRONT_ATME && !defined FRONT_SO_ATME && !defined FRONT_ATMF && !defined FRONT_H_ATMF ) @@ -56,15 +55,15 @@ module ESM #ifdef FRONT_OCNB use FRONT_OCNB, only: ocnB_SS => SetServices #endif - + use NUOPC_Connector, only: cplSS => SetServices - + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -72,24 +71,31 @@ module ESM subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call ESMF_MethodAdd(driver, label=driver_label_SetModelServices, & - userRoutine=SetModelServices, rc=rc) + + ! specialize driver + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & + specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + + ! set driver verbosity + call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + end subroutine !----------------------------------------------------------------------------- @@ -97,7 +103,7 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables type(ESMF_Grid) :: grid type(ESMF_Field) :: field @@ -135,7 +141,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for ATM #ifndef ATM_FRONT_SO call NUOPC_DriverAddComp(driver, "ATM", atmSS, comp=child, rc=rc) @@ -197,7 +203,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for atm2ocn call NUOPC_DriverAddComp(driver, srcCompLabel="ATM", dstCompLabel="OCN", & compSetServicesRoutine=cplSS, comp=connector, rc=rc) @@ -210,7 +216,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for ocn2atm call NUOPC_DriverAddComp(driver, srcCompLabel="OCN", dstCompLabel="ATM", & compSetServicesRoutine=cplSS, comp=connector, rc=rc) @@ -223,7 +229,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! set the driver clock call ESMF_TimeIntervalSet(timeStep, m=15, rc=rc) ! 15 minute steps if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -251,13 +257,15 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnSelectExternalProto/esmApp.F90 b/AtmOcnSelectExternalProto/esmApp.F90 index 9226f49a..9e5e2ae8 100644 --- a/AtmOcnSelectExternalProto/esmApp.F90 +++ b/AtmOcnSelectExternalProto/esmApp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -21,14 +21,15 @@ program esmApp integer :: rc, urc type(ESMF_GridComp) :: esmComp - + ! Initialize ESMF - call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, rc=rc) + call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, & + defaultCalkind=ESMF_CALKIND_GREGORIAN, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp STARTING", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -41,7 +42,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! SetServices for the earth system Component call ESMF_GridCompSetServices(esmComp, esmSS, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -52,7 +53,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Initialize for the earth system Component call ESMF_GridCompInitialize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -63,7 +64,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Run for earth the system Component call ESMF_GridCompRun(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -74,7 +75,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Finalize for the earth system Component call ESMF_GridCompFinalize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -85,14 +86,14 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Destroy the earth system Component call ESMF_GridCompDestroy(esmComp, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -101,5 +102,5 @@ program esmApp ! Finalize ESMF call ESMF_Finalize() - -end program + +end program diff --git a/AtmOcnSelectProto/atmA.F90 b/AtmOcnSelectProto/atmA.F90 index aa150a34..a85c94fb 100644 --- a/AtmOcnSelectProto/atmA.F90 +++ b/AtmOcnSelectProto/atmA.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,66 +17,72 @@ module atmA use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: sea_surface_temperature call NUOPC_Advertise(importState, & StandardName="sea_surface_temperature", name="sst", rc=rc) @@ -84,7 +90,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: air_pressure_at_sea_level call NUOPC_Advertise(exportState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -92,7 +98,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -100,7 +106,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! set Component name so it becomes identifiable call ESMF_GridCompSet(model, name="atmA", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -109,22 +115,29 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/10, 100/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -177,21 +190,21 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -200,12 +213,12 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set by default, ! its timeStep is equal to the parent timeStep. As a consequence the ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. - + ! for this call of the Advance() routine. + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing ATM from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -217,7 +230,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -232,4 +245,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnSelectProto/atmB.F90 b/AtmOcnSelectProto/atmB.F90 index f1933995..08cd6614 100644 --- a/AtmOcnSelectProto/atmB.F90 +++ b/AtmOcnSelectProto/atmB.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,66 +17,72 @@ module atmB use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: sea_surface_temperature call NUOPC_Advertise(importState, & StandardName="sea_surface_temperature", name="sst", rc=rc) @@ -84,7 +90,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: air_pressure_at_sea_level call NUOPC_Advertise(exportState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -92,7 +98,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -100,31 +106,38 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! set Component name so it becomes identifiable call ESMF_GridCompSet(model, name="atmB", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/10, 100/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -177,21 +190,21 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -200,12 +213,12 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set by default, ! its timeStep is equal to the parent timeStep. As a consequence the ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. - + ! for this call of the Advance() routine. + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing ATM from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -217,7 +230,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -232,4 +245,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnSelectProto/esm.F90 b/AtmOcnSelectProto/esm.F90 index f224e51f..ccf9299d 100644 --- a/AtmOcnSelectProto/esm.F90 +++ b/AtmOcnSelectProto/esm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,9 +17,8 @@ module ESM use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices - + driverSS => SetServices + #if (defined WITH_ATM_A && !defined WITH_ATM_B) use atmA, only: atmSS => SetServices #elif (!defined WITH_ATM_A && defined WITH_ATM_B) @@ -34,15 +33,15 @@ module ESM #ifdef WITH_OCN_B use ocnB, only: ocnB_SS => SetServices #endif - + use NUOPC_Connector, only: cplSS => SetServices - + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -50,24 +49,31 @@ module ESM subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call ESMF_MethodAdd(driver, label=driver_label_SetModelServices, & - userRoutine=SetModelServices, rc=rc) + + ! specialize driver + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & + specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + + ! set driver verbosity + call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + end subroutine !----------------------------------------------------------------------------- @@ -75,7 +81,7 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables type(ESMF_Grid) :: grid type(ESMF_Field) :: field @@ -113,7 +119,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for ATM call NUOPC_DriverAddComp(driver, "ATM", atmSS, comp=child, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -125,7 +131,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for OCN if (.false.) then #ifdef WITH_OCN_A @@ -157,7 +163,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for atm2ocn call NUOPC_DriverAddComp(driver, srcCompLabel="ATM", dstCompLabel="OCN", & compSetServicesRoutine=cplSS, comp=connector, rc=rc) @@ -170,7 +176,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for ocn2atm call NUOPC_DriverAddComp(driver, srcCompLabel="OCN", dstCompLabel="ATM", & compSetServicesRoutine=cplSS, comp=connector, rc=rc) @@ -183,7 +189,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! set the driver clock call ESMF_TimeIntervalSet(timeStep, m=15, rc=rc) ! 15 minute steps if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -211,13 +217,15 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnSelectProto/esmApp.F90 b/AtmOcnSelectProto/esmApp.F90 index 9226f49a..9e5e2ae8 100644 --- a/AtmOcnSelectProto/esmApp.F90 +++ b/AtmOcnSelectProto/esmApp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -21,14 +21,15 @@ program esmApp integer :: rc, urc type(ESMF_GridComp) :: esmComp - + ! Initialize ESMF - call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, rc=rc) + call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, & + defaultCalkind=ESMF_CALKIND_GREGORIAN, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp STARTING", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -41,7 +42,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! SetServices for the earth system Component call ESMF_GridCompSetServices(esmComp, esmSS, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -52,7 +53,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Initialize for the earth system Component call ESMF_GridCompInitialize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -63,7 +64,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Run for earth the system Component call ESMF_GridCompRun(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -74,7 +75,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Finalize for the earth system Component call ESMF_GridCompFinalize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -85,14 +86,14 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Destroy the earth system Component call ESMF_GridCompDestroy(esmComp, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -101,5 +102,5 @@ program esmApp ! Finalize ESMF call ESMF_Finalize() - -end program + +end program diff --git a/AtmOcnSelectProto/ocnA.F90 b/AtmOcnSelectProto/ocnA.F90 index 54c6a297..687a7e53 100644 --- a/AtmOcnSelectProto/ocnA.F90 +++ b/AtmOcnSelectProto/ocnA.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,73 +17,78 @@ module ocnA use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_SetClock => label_SetClock, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_SetClock, & + call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & specRoutine=SetClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: air_pressure_at_sea_level call NUOPC_Advertise(importState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -91,7 +96,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(importState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -114,25 +119,32 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_TimeInterval) :: stabilityTimeStep type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/100, 10/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -157,7 +169,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux field = ESMF_FieldCreate(name="rsns", grid=gridIn, & typekind=ESMF_TYPEKIND_R8, rc=rc) @@ -185,26 +197,26 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- subroutine SetClock(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_TimeInterval) :: stabilityTimeStep rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock call NUOPC_ModelGet(model, modelClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! initialize internal clock ! here: parent Clock and stability timeStep determine actual model timeStep !TODO: stabilityTimeStep should be read in from configuation @@ -219,15 +231,15 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -236,8 +248,8 @@ subroutine ModelAdvance(model, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -246,14 +258,14 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set in SetClock(), ! its timeStep is likely smaller than the parent timeStep. As a consequence - ! the time interval covered by a single parent timeStep will result in - ! multiple calls to the ModelAdvance() routine. Every time the currTime + ! the time interval covered by a single parent timeStep will result in + ! multiple calls to the Advance() routine. Every time the currTime ! will come in by one internal timeStep advanced. This goes until the ! stopTime of the internal Clock has been reached. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing OCN from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -265,13 +277,13 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_TimePrint(currTime + timeStep, & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -286,4 +298,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnSelectProto/ocnB.F90 b/AtmOcnSelectProto/ocnB.F90 index 502d25dc..f2996933 100644 --- a/AtmOcnSelectProto/ocnB.F90 +++ b/AtmOcnSelectProto/ocnB.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,73 +17,78 @@ module ocnB use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_SetClock => label_SetClock, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_SetClock, & + call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & specRoutine=SetClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: air_pressure_at_sea_level call NUOPC_Advertise(importState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -91,7 +96,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(importState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -114,25 +119,32 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_TimeInterval) :: stabilityTimeStep type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/100, 10/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -157,7 +169,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux field = ESMF_FieldCreate(name="rsns", grid=gridIn, & typekind=ESMF_TYPEKIND_R8, rc=rc) @@ -185,26 +197,26 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- subroutine SetClock(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_TimeInterval) :: stabilityTimeStep rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock call NUOPC_ModelGet(model, modelClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! initialize internal clock ! here: parent Clock and stability timeStep determine actual model timeStep !TODO: stabilityTimeStep should be read in from configuation @@ -219,15 +231,15 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -236,8 +248,8 @@ subroutine ModelAdvance(model, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -246,14 +258,14 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set in SetClock(), ! its timeStep is likely smaller than the parent timeStep. As a consequence - ! the time interval covered by a single parent timeStep will result in - ! multiple calls to the ModelAdvance() routine. Every time the currTime + ! the time interval covered by a single parent timeStep will result in + ! multiple calls to the Advance() routine. Every time the currTime ! will come in by one internal timeStep advanced. This goes until the ! stopTime of the internal Clock has been reached. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing OCN from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -265,13 +277,13 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_TimePrint(currTime + timeStep, & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -286,4 +298,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnSimpleImplicitProto/atm.F90 b/AtmOcnSimpleImplicitProto/atm.F90 index 8dadca92..89b857eb 100644 --- a/AtmOcnSimpleImplicitProto/atm.F90 +++ b/AtmOcnSimpleImplicitProto/atm.F90 @@ -1,25 +1,21 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== -! The ATM Component can either use default IPDv00, if the following macro is -! in the _off state, or use IPDv02 if in the _on state: +! Implement complex data dependency during initialize or not. Macro _on or _off #define WITHCOMPLEXDATADEPENDENCY_on -! When the IPDv02 option is selected, the ATM introduces a more complex -! initialize data dependency with the OCN component. In both modes (_on or _off) -! the OCN component depends on ATM's "pmsl" Field in order to initialize the -! OCN "sst" Field. However, the ATM component in IPDv00 mode does not depend on -! any OCN Fields - both ATM Fields are initialized without requiring valid input -! data Fields from OCN. When turning on Complex-Data-Dependency via the above -! macro, this changes, and the ATM component starts depending on the "sst" OCN -! Field for the initialization of the "rsns" ATM Field. The IPDv02 can handle -! these sort of complex data dependencies during initialize between components. +! In both modes (_on or _off) the OCN component depends on ATM's "pmsl" Field +! in order to initialize the OCN "sst" Field. However, the ATM component in +! (_off) mode does not depend on any OCN Fields - both ATM Fields are +! initialized without requiring valid input data Fields from OCN. When switching +! to _on, the ATM component starts depending on the "sst" OCN Field for the +! initialization of the "rsns" ATM Field. module ATM @@ -30,109 +26,80 @@ module ATM use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & -#ifdef WITHCOMPLEXDATADEPENDENCY_on - model_label_DataInitialize => label_DataInitialize, & -#endif - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - -#ifdef WITHCOMPLEXDATADEPENDENCY_on - ! overwrite the default IPDv00 with IPDv02 - call ESMF_GridCompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - userRoutine=InitializeP0, phase=0, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#endif - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1", "IPDv02p1"/), userRoutine=InitializeP1, rc=rc) + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2", "IPDv02p2"/), userRoutine=InitializeP2, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out #ifdef WITHCOMPLEXDATADEPENDENCY_on - call NUOPC_CompSpecialize(model, specLabel=model_label_DataInitialize, & + call NUOPC_CompSpecialize(model, specLabel=label_DataInitialize, & specRoutine=DataInitialize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out #endif - - end subroutine - - !----------------------------------------------------------------------------- - -#ifdef WITHCOMPLEXDATADEPENDENCY_on - subroutine InitializeP0(model, importState, exportState, clock, rc) - type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - - ! Switch to IPDv02 by filtering all other phaseMap entries - call NUOPC_CompFilterPhaseMap(model, ESMF_METHOD_INITIALIZE, & - acceptStringList=(/"IPDv02p"/), rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine -#endif !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: sea_surface_temperature call NUOPC_Advertise(importState, & StandardName="sea_surface_temperature", name="sst", rc=rc) @@ -140,7 +107,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: air_pressure_at_sea_level call NUOPC_Advertise(exportState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -148,7 +115,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -158,22 +125,29 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/10, 100/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -226,40 +200,40 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- #ifdef WITHCOMPLEXDATADEPENDENCY_on subroutine DataInitialize(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState type(ESMF_Time) :: time type(ESMF_Field) :: field - logical :: neededCurrent + logical :: isUpdated rc = ESMF_SUCCESS - + ! the ATM needs valid OCN export Fields to initialize its internal state - ! query the Component for its clock, importState and exportState + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! get the current time out of the clock call ESMF_ClockGet(clock, currTime=time, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! check that required Fields in the importState show correct timestamp ! -> here only "sst" is needed call ESMF_StateGet(importState, field=field, itemName="sst", rc=rc) @@ -267,13 +241,13 @@ subroutine DataInitialize(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - neededCurrent = NUOPC_IsAtTime(field, time, rc=rc) + isUpdated = NUOPC_IsAtTime(field, time, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - if (.not.neededCurrent) then + + if (.not.isUpdated) then call ESMF_LogWrite("ATM - Initialize-Data-Dependency NOT YET SATISFIED!!!", & ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -287,7 +261,7 @@ subroutine DataInitialize(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - ! -> set Updated Field Attribute to "true", indicating to the IPDv02p5 + ! -> set Updated Field Attribute to "true", indicating to the ! generic code to set the timestamp for this Field call ESMF_StateGet(exportState, field=field, itemName="rsns", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -301,9 +275,9 @@ subroutine DataInitialize(model, rc) file=__FILE__)) & return ! bail out endif - + ! the "pmsl" Field can be initialized without depending on "sst" - ! -> set Updated Field Attribute to "true", indicating to the IPDv02p5 + ! -> set Updated Field Attribute to "true", indicating to the ! generic code to set the timestamp for this Field call ESMF_StateGet(exportState, field=field, itemName="pmsl", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -316,7 +290,7 @@ subroutine DataInitialize(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! check whether all Fields in the exportState are "Updated" if (NUOPC_IsUpdated(exportState)) then ! This simple ATM component is only concerned with marking Fields in @@ -329,24 +303,24 @@ subroutine DataInitialize(model, rc) file=__FILE__)) & return ! bail out endif - + end subroutine #endif !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -355,12 +329,12 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set by default, ! its timeStep is equal to the parent timeStep. As a consequence the ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. - + ! for this call of the Advance() routine. + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing ATM from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -372,7 +346,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -387,4 +361,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnSimpleImplicitProto/esm.F90 b/AtmOcnSimpleImplicitProto/esm.F90 index 036ea8b6..1f87958a 100644 --- a/AtmOcnSimpleImplicitProto/esm.F90 +++ b/AtmOcnSimpleImplicitProto/esm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -14,7 +14,7 @@ module ESM ! Code that specializes generic ESM Component code. !----------------------------------------------------------------------------- - ! Enabling the followng macro, i.e. setting it to WITHPETLISTS_on, will + ! Enabling the followng macro, i.e. setting it to WITHPETLISTS_on, will ! activate sections of code that demonstrate how ! the ATM and OCN components can run on exclusive sets of PETs. Turning this ! on/off does not affect how the Connector component is specialized. @@ -23,21 +23,19 @@ module ESM use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices, & - driver_label_SetRunSequence => label_SetRunSequence - + driverSS => SetServices + use ATM, only: atmSS => SetServices use OCN, only: ocnSS => SetServices - + use NUOPC_Connector, only: cplSS => SetServices - + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -45,30 +43,37 @@ module ESM subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & + + ! specialize driver + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetRunSequence, & + call NUOPC_CompSpecialize(driver, specLabel=label_SetRunSequence, & specRoutine=SetRunSequence, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + + ! set driver verbosity + call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + end subroutine !----------------------------------------------------------------------------- @@ -76,7 +81,7 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables type(ESMF_Grid) :: grid type(ESMF_Field) :: field @@ -89,14 +94,14 @@ subroutine SetModelServices(driver, rc) integer, allocatable :: petList(:) rc = ESMF_SUCCESS - + ! get the petCount call ESMF_GridCompGet(driver, petCount=petCount, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for ATM with petList on first half of PETs #ifdef WITHPETLISTS_on allocate(petList(petCount/2)) @@ -121,7 +126,7 @@ subroutine SetModelServices(driver, rc) #ifdef WITHPETLISTS_on deallocate(petList) #endif - + ! SetServices for OCN with petList on second half of PETs #ifdef WITHPETLISTS_on allocate(petList(petCount/2)) @@ -146,7 +151,7 @@ subroutine SetModelServices(driver, rc) #ifdef WITHPETLISTS_on deallocate(petList) #endif - + ! set the driver clock call ESMF_TimeIntervalSet(timeStep, m=15, rc=rc) ! 15 minute steps if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -176,7 +181,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- @@ -184,18 +189,18 @@ subroutine SetModelServices(driver, rc) subroutine SetRunSequence(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables character(ESMF_MAXSTR) :: name type(NUOPC_FreeFormat) :: runSeqFF rc = ESMF_SUCCESS - + ! query the driver for its name call ESMF_GridCompGet(driver, name=name, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - + ! set up free format run sequence runSeqFF = NUOPC_FreeFormatCreate(stringList=(/ & " @* ", & diff --git a/AtmOcnSimpleImplicitProto/esmApp.F90 b/AtmOcnSimpleImplicitProto/esmApp.F90 index b80f7d5c..9e5e2ae8 100644 --- a/AtmOcnSimpleImplicitProto/esmApp.F90 +++ b/AtmOcnSimpleImplicitProto/esmApp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -21,7 +21,7 @@ program esmApp integer :: rc, urc type(ESMF_GridComp) :: esmComp - + ! Initialize ESMF call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, & defaultCalkind=ESMF_CALKIND_GREGORIAN, rc=rc) @@ -29,7 +29,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp STARTING", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -42,7 +42,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! SetServices for the earth system Component call ESMF_GridCompSetServices(esmComp, esmSS, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -53,7 +53,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Initialize for the earth system Component call ESMF_GridCompInitialize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -64,7 +64,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Run for earth the system Component call ESMF_GridCompRun(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -75,7 +75,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Finalize for the earth system Component call ESMF_GridCompFinalize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -86,14 +86,14 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Destroy the earth system Component call ESMF_GridCompDestroy(esmComp, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -102,5 +102,5 @@ program esmApp ! Finalize ESMF call ESMF_Finalize() - -end program + +end program diff --git a/AtmOcnSimpleImplicitProto/ocn.F90 b/AtmOcnSimpleImplicitProto/ocn.F90 index 2f1f4fea..d291a0ec 100644 --- a/AtmOcnSimpleImplicitProto/ocn.F90 +++ b/AtmOcnSimpleImplicitProto/ocn.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,116 +17,89 @@ module OCN use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_SetClock => label_SetClock, & - model_label_DataInitialize => label_DataInitialize, & - model_label_Advance => label_Advance, & - model_label_CheckImport => label_CheckImport - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! overwrite the default IPDv00 with IPDv02 - call ESMF_GridCompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - userRoutine=InitializeP0, phase=0, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv02p1"/), userRoutine=InitializeP1, rc=rc) + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv02p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & + specRoutine=SetClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_SetClock, & - specRoutine=SetClock, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_DataInitialize, & + specRoutine=DataInitialize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_DataInitialize, & - specRoutine=DataInitialize, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! overwrite default CheckImport method to replace explicit with implement check - call NUOPC_CompSpecialize(model, specLabel=model_label_CheckImport, & + call NUOPC_CompSpecialize(model, specLabel=label_CheckImport, & specRoutine=CheckImport, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP0(model, importState, exportState, clock, rc) - type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - + subroutine Advertise(model, rc) + type(ESMF_GridComp) :: model + integer, intent(out) :: rc + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - ! Switch to IPDv02 by filtering all other phaseMap entries - call NUOPC_CompFilterPhaseMap(model, ESMF_METHOD_INITIALIZE, & - acceptStringList=(/"IPDv02p"/), rc=rc) + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine InitializeP1(model, importState, exportState, clock, rc) - type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - rc = ESMF_SUCCESS ! importable field: air_pressure_at_sea_level call NUOPC_Advertise(importState, & @@ -135,7 +108,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(importState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -153,23 +126,30 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_TimeInterval) :: stabilityTimeStep type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/100, 10/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -194,7 +174,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux field = ESMF_FieldCreate(name="rsns", grid=gridIn, & typekind=ESMF_TYPEKIND_R8, rc=rc) @@ -222,26 +202,26 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- subroutine SetClock(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_TimeInterval) :: stabilityTimeStep rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock call NUOPC_ModelGet(model, modelClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! initialize internal clock ! here: parent Clock and stability timeStep determine actual model timeStep !TODO: stabilityTimeStep should be read in from configuation @@ -256,7 +236,7 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- @@ -264,7 +244,7 @@ subroutine SetClock(model, rc) subroutine DataInitialize(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -273,24 +253,24 @@ subroutine DataInitialize(model, rc) logical :: neededCurrent rc = ESMF_SUCCESS - + ! the OCN needs valid ATM export Fields to initialize its internal state - ! query the Component for its clock, importState and exportState + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! get the current time out of the clock call ESMF_ClockGet(clock, currTime=time, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! check that required Fields in the importState show correct timestamp ! -> here only "pmsl" is needed call ESMF_StateGet(importState, field=field, itemName="pmsl", rc=rc) @@ -303,7 +283,7 @@ subroutine DataInitialize(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + if (.not.neededCurrent) then call ESMF_LogWrite("OCN - Initialize-Data-Dependency NOT YET SATISFIED!!!", & ESMF_LOGMSG_INFO, rc=rc) @@ -318,8 +298,8 @@ subroutine DataInitialize(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - - ! -> set Updated Field Attribute to "true", indicating to the IPDv02p5 + + ! -> set Updated Field Attribute to "true", indicating to the ! generic code to set the timestamp for this Field call ESMF_StateGet(exportState, field=field, itemName="sst", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -332,9 +312,9 @@ subroutine DataInitialize(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! Since setting the "sst" field was the only thing to be done on the OCN - ! side, the component needs to indicate that it is fully done with + ! side, the component needs to indicate that it is fully done with ! initializing its data: ! -> set InitializeDataComplete Component Attribute to "true", indicating ! to the driver that this Component has fully initialized its data @@ -346,15 +326,15 @@ subroutine DataInitialize(model, rc) return ! bail out endif - + end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -363,8 +343,8 @@ subroutine ModelAdvance(model, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -373,14 +353,14 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set in SetClock(), ! its timeStep is likely smaller than the parent timeStep. As a consequence - ! the time interval covered by a single parent timeStep will result in - ! multiple calls to the ModelAdvance() routine. Every time the currTime + ! the time interval covered by a single parent timeStep will result in + ! multiple calls to the Advance() routine. Every time the currTime ! will come in by one internal timeStep advanced. This goes until the ! stopTime of the internal Clock has been reached. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing OCN from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -392,13 +372,13 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_TimePrint(currTime + timeStep, & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -414,18 +394,18 @@ subroutine ModelAdvance(model, rc) end subroutine !----------------------------------------------------------------------------- - + subroutine CheckImport(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! This is the routine that enforces the implicit time dependence on the ! import fields. This simply means that the timestamps on the Fields in the - ! importState are checked against the stopTime on the Component's + ! importState are checked against the stopTime on the Component's ! internalClock. Consequenty, this model starts out with forcing fields ! at the future stopTime, as it does its forward stepping from currentTime ! to stopTime. - + ! local variables type(ESMF_Clock) :: clock type(ESMF_Time) :: time @@ -433,8 +413,8 @@ subroutine CheckImport(model, rc) logical :: allCurrent rc = ESMF_SUCCESS - - ! query the Component for its clock and importState + + ! query for clock and importState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -447,14 +427,14 @@ subroutine CheckImport(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! check that Fields in the importState show correct timestamp allCurrent = NUOPC_IsAtTime(importState, time, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + if (.not.allCurrent) then !TODO: introduce and use INCOMPATIBILITY return codes!!!! call ESMF_LogSetError(ESMF_RC_ARG_BAD, & @@ -464,7 +444,7 @@ subroutine CheckImport(model, rc) rcToReturn=rc) return ! bail out endif - + end subroutine !----------------------------------------------------------------------------- diff --git a/AtmOcnTransferGridProto/README b/AtmOcnTransferGridProto/README index 7a4d9ee9..c894ee9c 100644 --- a/AtmOcnTransferGridProto/README +++ b/AtmOcnTransferGridProto/README @@ -44,11 +44,10 @@ Output: Code structure: - Makefile - Makefile that is based on the standard esmf.mk mechanism. - atm.F90 - The ATM component, specializing generic NUOPC_Model. - * Implements IPDv03 to accept Grids from OCN component. + * Accept Grids from OCN component. * Indicates "cannot provide" for some Grids * Indicates "can provide" for some Grids - ocn.F90 - The OCN component, specializing generic NUOPC_Model. - * Implements IPDv01. * Implicitly indicate "will provide" for all Grids. - esm.F90 - The Earth System Model (ESM) component, specializing generic NUOPC_Driver. Define partial petLists for ATM diff --git a/AtmOcnTransferGridProto/atm.F90 b/AtmOcnTransferGridProto/atm.F90 index 66381e39..3edbbc14 100644 --- a/AtmOcnTransferGridProto/atm.F90 +++ b/AtmOcnTransferGridProto/atm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -21,113 +21,90 @@ module ATM use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_DataInitialize => label_DataInitialize, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetVM, SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! -> switching to IPD version that supports GeomObject transfer - call ESMF_GridCompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - userRoutine=InitializeP0, phase=0, rc=rc) + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv03p1"/), userRoutine=InitializeP1, rc=rc) + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv03p3"/), userRoutine=InitializeP3, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=RealizeProvided, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv03p4"/), userRoutine=InitializeP4, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_AcceptTransfer, & + specRoutine=AcceptTransfer, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv03p5"/), userRoutine=InitializeP5, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeAccepted, & + specRoutine=RealizeAccepted, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_DataInitialize, & + specRoutine=DataInitialize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_DataInitialize, & - specRoutine=DataInitialize, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP0(model, importState, exportState, clock, rc) - type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - + subroutine Advertise(model, rc) + type(ESMF_GridComp) :: model + integer, intent(out) :: rc + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - ! Switch to IPDv03 by filtering all other phaseMap entries - call NUOPC_CompFilterPhaseMap(model, ESMF_METHOD_INITIALIZE, & - acceptStringList=(/"IPDv03p"/), rc=rc) + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) - type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - ! importable field: sea_surface_salinity ! -> marked as "cannot provide" call NUOPC_Advertise(importState, & @@ -174,7 +151,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux ! -> use default, i.e. marked as "will provide" call NUOPC_Advertise(exportState, & @@ -193,7 +170,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_LogWrite("Done advertising fields in ATM exportState", & ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -202,22 +179,29 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP3(model, importState, exportState, clock, rc) + subroutine RealizeProvided(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables - type(ESMF_Field) :: field - type(ESMF_Grid) :: gridIn, gridOut - character(ESMF_MAXSTR) :: transferAction - + + ! local variables + type(ESMF_State) :: importState, exportState + type(ESMF_Field) :: field + type(ESMF_Grid) :: gridIn, gridOut + character(ESMF_MAXSTR) :: transferAction + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create Grid objects for Fields gridIn = ESMF_GridCreate1PeriDimUfrm(maxIndex=(/100, 150/), & minCornerCoord=(/0._ESMF_KIND_R8, -50._ESMF_KIND_R8/), & @@ -227,7 +211,7 @@ subroutine InitializeP3(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + gridOut = gridIn ! for now out same as in ! importable field: sea_surface_temperature @@ -275,7 +259,7 @@ subroutine InitializeP3(model, importState, exportState, clock, rc) endif !NOTE: The sea_surface_salinity (sss) and air_pressure_at_sea_level (pmsl) - !NOTE: Fields are not realized here because they were marked with + !NOTE: Fields are not realized here because they were marked with !NOTE: TransferOfferGeomObject="cannot provide". !NOTE: Expect the Connector to fill in a Grid object for these Fields. @@ -306,16 +290,15 @@ subroutine InitializeP3(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP4(model, importState, exportState, clock, rc) + subroutine AcceptTransfer(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: grid integer :: localDeCount @@ -331,7 +314,15 @@ subroutine InitializeP4(model, importState, exportState, clock, rc) logical :: regDecompFlag rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + !NOTE: The air_pressure_at_sea_level (pmsl) Field should now have the !NOTE: accepted Grid available. It is still an empty Field, but with Grid, !NOTE: that contains a DistGrid with the provider decomposition. @@ -346,14 +337,14 @@ subroutine InitializeP4(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! while this is still an empty field, it does now hold a Grid with DistGrid call ESMF_FieldGet(field, grid=grid, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! inspect the Grid name call ESMF_GridGet(grid, name=name, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -366,25 +357,25 @@ subroutine InitializeP4(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! access localDeCount to show this is a real Grid call ESMF_GridGet(grid, localDeCount=localDeCount, distgrid=distgrid, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + write (msgString,*) "ATM - InitializeP4: localDeCount = ", localDeCount call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! Create a custom DistGrid, based on the minIndex, maxIndex of the + + ! Create a custom DistGrid, based on the minIndex, maxIndex of the ! accepted DistGrid, but with a default regDecomp for the current VM ! that leads to 1DE/PET (as long as there are more PETs than tiles). - + ! get dimCount and tileCount call ESMF_DistGridGet(distgrid, dimCount=dimCount, tileCount=tileCount, & connectionCount=connectionCount, rc=rc) @@ -392,12 +383,12 @@ subroutine InitializeP4(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! allocate minIndexPTile and maxIndexPTile accord. to dimCount and tileCount allocate(minIndexPTile(dimCount, tileCount), & maxIndexPTile(dimCount, tileCount)) allocate(connectionList(connectionCount)) - + ! get minIndex and maxIndex arrays call ESMF_DistGridGet(distgrid, minIndexPTile=minIndexPTile, & maxIndexPTile=maxIndexPTile, connectionList=connectionList, rc=rc) @@ -406,8 +397,8 @@ subroutine InitializeP4(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out -#if 0 - ! report on the connections +#if 0 + ! report on the connections print *, "connectionCount=", connectionCount do i=1, connectionCount call ESMF_DistGridConnectionPrint(connectionList(i)) @@ -433,14 +424,14 @@ subroutine InitializeP4(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! access localDeCount of the final Grid call ESMF_GridGet(grid, localDeCount=localDeCount, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + write (msgString,*) "ATM - InitializeP4: final Grid localDeCount = ", & localDeCount call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) @@ -450,12 +441,12 @@ subroutine InitializeP4(model, importState, exportState, clock, rc) return ! bail out ! Swap out the transferred for new Grid in "pmsl" Field - call ESMF_FieldEmptySet(field, grid=grid, rc=rc) + call ESMF_FieldEmptySet(field, grid=grid, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! -- deal with "precip" field in the exportState ! access the field call ESMF_StateGet(exportState, field=field, itemName="precip", rc=rc) @@ -518,7 +509,7 @@ subroutine InitializeP4(model, importState, exportState, clock, rc) ! ! Not setting the PRECIP_REGDECOMP macro will default into keeping the ! original arbDistr Grid. - + #define PRECIP_REGDECOMP #ifdef PRECIP_REGDECOMP @@ -554,7 +545,7 @@ subroutine InitializeP4(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out ! swap out the transferred grid for the newly created one - call ESMF_FieldEmptySet(field, grid=grid, rc=rc) + call ESMF_FieldEmptySet(field, grid=grid, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -615,7 +606,7 @@ subroutine InitializeP4(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out ! swap out the transferred grid for the newly created one - call ESMF_FieldEmptySet(field, grid=grid, rc=rc) + call ESMF_FieldEmptySet(field, grid=grid, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -630,7 +621,7 @@ subroutine InitializeP4(model, importState, exportState, clock, rc) ! entire index space, or also use a deBlock approach to only cover the ! exact index space covered by the provider grid. ! If a regDecomp scheme is used, Redist() between provider side and - ! acceptor side is still possible (both ways). It just means that + ! acceptor side is still possible (both ways). It just means that ! not all src/dst index points send/receive data. ! Using the regDecomp scheme is identical to the regDecompFlag branch ! of this if statement. @@ -640,24 +631,24 @@ subroutine InitializeP4(model, importState, exportState, clock, rc) ! Alternatively the DEs could be distributed differently by constructing ! a deBlockList out of the minIndexPDe and maxIndexPDe arrays here, and ! calling a deBlock DistGridCreate() and then build the Grid on it. - ! -> here we just accept the provided Grid without change (same number + ! -> here we just accept the provided Grid without change (same number ! of DEs with the same deBlocks). endif endif deallocate(minIndexPTile, maxIndexPTile, connectionList) - + !------------------------------------------------------------------------ ! Also must deal with transferred Grids in the importState call ESMF_LogWrite("ATM - InitializeP4: now dealing with importState", & ESMF_LOGMSG_INFO, rc=rc) - + ! access the "sss" field in the importState and set the Grid call ESMF_StateGet(importState, field=field, itemName="sss", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! construct a local Grid according to the transferred grid call ESMF_FieldGet(field, grid=grid, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -701,7 +692,7 @@ subroutine InitializeP4(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out ! swap out the transferred grid for the newly created one - call ESMF_FieldEmptySet(field, grid=grid, rc=rc) + call ESMF_FieldEmptySet(field, grid=grid, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -716,7 +707,7 @@ subroutine InitializeP4(model, importState, exportState, clock, rc) ! entire index space, or also use a deBlock approach to only cover the ! exact index space covered by the provider grid. ! If a regDecomp scheme is used, Redist() between provider side and - ! acceptor side is still possible (both ways). It just means that + ! acceptor side is still possible (both ways). It just means that ! not all src/dst index points send/receive data. ! Using the regDecomp scheme is identical to the regDecompFlag branch ! of this if statement. @@ -730,9 +721,9 @@ subroutine InitializeP4(model, importState, exportState, clock, rc) ! DEs with the same deBlocks). endif deallocate(minIndexPTile, maxIndexPTile, connectionList) - + ! Also must swap the Grid for the "sst" Field in the importState - ! if transferAction indicates "accept". Assume that SST is defined on + ! if transferAction indicates "accept". Assume that SST is defined on ! the same grid as SSS. ! access the "sst" field in the importState @@ -752,7 +743,7 @@ subroutine InitializeP4(model, importState, exportState, clock, rc) if (regDecompFlag) then ! for a regDecomp scheme, definitely the newly constructed Grid on the ! acceptor side makes a lot more sense. - call ESMF_FieldEmptySet(field, grid=grid, rc=rc) + call ESMF_FieldEmptySet(field, grid=grid, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -760,7 +751,7 @@ subroutine InitializeP4(model, importState, exportState, clock, rc) call ESMF_LogWrite("ATM - Just set Grid for 'sst' Field", & ESMF_LOGMSG_INFO, rc=rc) else - ! for deBlock scheme, just keep the provided Grid with the same + ! for deBlock scheme, just keep the provided Grid with the same ! deBlocks as provider defined. endif endif @@ -769,27 +760,34 @@ subroutine InitializeP4(model, importState, exportState, clock, rc) ESMF_LOGMSG_INFO, rc=rc) end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP5(model, importState, exportState, clock, rc) + subroutine RealizeAccepted(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + ! local variables - type(ESMF_Field) :: field - type(ESMF_Grid) :: grid - type(ESMF_Array) :: array - character(80) :: name - character(160) :: msgString - integer :: staggerEdgeLWidth(2) - integer :: staggerEdgeUWidth(2) - integer :: staggerAlign(2) + type(ESMF_State) :: importState, exportState + type(ESMF_Field) :: field + type(ESMF_Grid) :: grid + type(ESMF_Array) :: array + character(80) :: name + character(160) :: msgString + integer :: staggerEdgeLWidth(2) + integer :: staggerEdgeUWidth(2) + integer :: staggerAlign(2) rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! realize the "sss" field in the importState call NUOPC_Realize(importState, fieldName="sss", field=field, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -859,7 +857,7 @@ subroutine InitializeP5(model, importState, exportState, clock, rc) return ! bail out endif -#ifdef TEST_MULTI_TILE_GRID +#ifdef TEST_MULTI_TILE_GRID ! write cubed sphere grid out to VTK call ESMF_FieldGet(field, grid=grid, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -916,7 +914,7 @@ subroutine InitializeP5(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - ! check the staggerEdgeWidth of the transferred grid + ! check the staggerEdgeWidth of the transferred grid #ifdef TEST_GRID_EDGE_WIDTHS ! center stagger call ESMF_GridGet(grid, staggerloc=ESMF_STAGGERLOC_CENTER, & @@ -1037,10 +1035,10 @@ subroutine InitializeP5(model, importState, exportState, clock, rc) !TODO: ! Coords are currently written in 2D index space even if there is coordinate ! factorization used, e.g. in the Ufrm() GridCreate. Therefore the coord - ! arrays have replicated dims, and underlying allocation is only 1D. This + ! arrays have replicated dims, and underlying allocation is only 1D. This ! should be changed in the ArrayWrite() where Arrays with replicated dims - ! should write out only the non-degenerate data, i.e. according to the - ! actual data allocation. + ! should write out only the non-degenerate data, i.e. according to the + ! actual data allocation. ! -> here that would be a 1D array for each coordiante dim. ! center: call ESMF_GridGetCoord(grid, coordDim=1, array=array, rc=rc) @@ -1224,13 +1222,13 @@ subroutine InitializeP5(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- subroutine DataInitialize(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_State) :: exportState type(ESMF_Field) :: field @@ -1240,7 +1238,7 @@ subroutine DataInitialize(model, rc) rc = ESMF_SUCCESS - ! query the Component for its exportState + ! query for exportState call NUOPC_ModelGet(model, exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -1284,7 +1282,7 @@ subroutine DataInitialize(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! surface_net_downward_shortwave_flux call ESMF_StateGet(exportState, field=field, itemName="rsns", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -1322,7 +1320,7 @@ subroutine DataInitialize(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! precipitation_flux call ESMF_StateGet(exportState, field=field, itemName="precip", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -1353,7 +1351,7 @@ subroutine DataInitialize(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! indicate that data initialization is complete (breaking out of init-loop) call NUOPC_CompAttributeSet(model, & name="InitializeDataComplete", value="true", rc=rc) @@ -1361,15 +1359,15 @@ subroutine DataInitialize(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -1377,8 +1375,8 @@ subroutine ModelAdvance(model, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -1387,12 +1385,12 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set by default, ! its timeStep is equal to the parent timeStep. As a consequence the ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. - + ! for this call of the Advance() routine. + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing ATM from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -1404,7 +1402,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & diff --git a/AtmOcnTransferGridProto/esm.F90 b/AtmOcnTransferGridProto/esm.F90 index 370eade1..76c7956a 100644 --- a/AtmOcnTransferGridProto/esm.F90 +++ b/AtmOcnTransferGridProto/esm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,21 +17,19 @@ module ESM use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices, & - driver_label_ModifyCplLists => label_ModifyCplLists - + driverSS => SetServices + use ATM, only: atmSVM => SetVM, atmSS => SetServices use OCN, only: ocnSVM => SetVM, ocnSS => SetServices - + use NUOPC_Connector, only: cplSS => SetServices - + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -39,40 +37,31 @@ module ESM subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - - ! local variables - integer :: verbosity - character(len=10) :: attrStr rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & + + ! specialize driver + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(driver, specLabel=driver_label_ModifyCplLists, & + call NUOPC_CompSpecialize(driver, specLabel=label_ModifyCplLists, & specRoutine=ModifyCplLists, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set verbosity on driver - verbosity = 0 ! reset - verbosity = ibset(verbosity,0) ! log basic intro/extro with indentation - verbosity = ibset(verbosity,11) ! log info about data dependency during init - verbosity = ibset(verbosity,13) ! log component creation - write(attrStr,"(I10)") verbosity + + ! set driver verbosity call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -86,7 +75,7 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables type(ESMF_Time) :: startTime type(ESMF_Time) :: stopTime @@ -100,7 +89,7 @@ subroutine SetModelServices(driver, rc) type(ESMF_Info) :: info rc = ESMF_SUCCESS - + ! Create and set the info object that is used to pass hints into methods info = ESMF_InfoCreate(rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -126,7 +115,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! split up the PETs between ATM and OCN petCountOCN = min(2,petCount/2) ! don't give OCN more than 2 PETs petCountATM = petCount - petCountOCN @@ -148,7 +137,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + #define MORE_THAN_ONE_PE_PER_PET_WORKING_OCN #ifdef MORE_THAN_ONE_PE_PER_PET_WORKING_OCN call ESMF_InfoSet(info, key="/NUOPC/Instance/maxPeCountPerPet", value=2, & @@ -192,7 +181,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for ocn2atm call NUOPC_DriverAddComp(driver, srcCompLabel="OCN", dstCompLabel="ATM", & compSetServicesRoutine=cplSS, comp=conn, rc=rc) @@ -231,13 +220,13 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- @@ -245,29 +234,29 @@ subroutine SetModelServices(driver, rc) subroutine ModifyCplLists(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables - character(len=160) :: msg + character(len=160) :: msg type(ESMF_CplComp), pointer :: connectorList(:) integer :: i, j, cplListSize character(len=160), allocatable :: cplList(:) character(len=160) :: tempString - + rc = ESMF_SUCCESS - + call ESMF_LogWrite("Driver is in ModifyCplLists()", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + nullify(connectorList) call NUOPC_DriverGetComp(driver, compList=connectorList, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + write (msg,*) "Found ", size(connectorList), " Connectors."// & " Modifying CplList Attribute...." call ESMF_LogWrite(trim(msg), ESMF_LOGMSG_INFO, rc=rc) @@ -275,7 +264,7 @@ subroutine ModifyCplLists(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + do i=1, size(connectorList) ! query the cplList for connector i call NUOPC_CompAttributeGet(connectorList(i), name="CplList", & @@ -318,9 +307,9 @@ subroutine ModifyCplLists(driver, rc) deallocate(cplList) endif enddo - + deallocate(connectorList) - + end subroutine !----------------------------------------------------------------------------- diff --git a/AtmOcnTransferGridProto/esmApp.F90 b/AtmOcnTransferGridProto/esmApp.F90 index ed302230..9e5e2ae8 100644 --- a/AtmOcnTransferGridProto/esmApp.F90 +++ b/AtmOcnTransferGridProto/esmApp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -21,7 +21,7 @@ program esmApp integer :: rc, urc type(ESMF_GridComp) :: esmComp - + ! Initialize ESMF call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, & defaultCalkind=ESMF_CALKIND_GREGORIAN, rc=rc) @@ -29,12 +29,6 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - - call ESMF_LogSet(flush=.true., rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) call ESMF_LogWrite("esmApp STARTING", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -48,7 +42,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! SetServices for the earth system Component call ESMF_GridCompSetServices(esmComp, esmSS, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -59,7 +53,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Initialize for the earth system Component call ESMF_GridCompInitialize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -70,7 +64,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Run for earth the system Component call ESMF_GridCompRun(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -81,7 +75,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Finalize for the earth system Component call ESMF_GridCompFinalize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -92,14 +86,14 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Destroy the earth system Component call ESMF_GridCompDestroy(esmComp, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -108,5 +102,5 @@ program esmApp ! Finalize ESMF call ESMF_Finalize() - -end program + +end program diff --git a/AtmOcnTransferGridProto/ocn.F90 b/AtmOcnTransferGridProto/ocn.F90 index 13b8f1cf..f4cace93 100644 --- a/AtmOcnTransferGridProto/ocn.F90 +++ b/AtmOcnTransferGridProto/ocn.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -22,73 +22,78 @@ module OCN use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_SetClock => label_SetClock, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetVM, SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeAdvertise, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeRealize, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_SetClock, & + call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & specRoutine=SetClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeAdvertise(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: air_pressure_at_sea_level ! -> use default, i.e. marked as "will provide" call NUOPC_Advertise(importState, & @@ -97,7 +102,7 @@ subroutine InitializeAdvertise(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux ! -> use default, i.e. marked as "will provide" call NUOPC_Advertise(importState, & @@ -158,16 +163,15 @@ subroutine InitializeAdvertise(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeRealize(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Grid) :: gridIn, gridOut, gridArb, gridAux type(ESMF_DistGrid) :: distgrid integer :: deBlockList(2,2,0:1) ! 2 DEs @@ -191,7 +195,15 @@ subroutine InitializeRealize(model, importState, exportState, clock, rc) #endif rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + !--- regDecomp Grid ------------------------------------------------------- ! create Grid objects for import Fields gridIn = ESMF_GridCreate1PeriDimUfrm(maxIndex=(/100, 150/), & @@ -202,20 +214,20 @@ subroutine InitializeRealize(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + #ifdef TEST_GRID_EDGE_WIDTHS ! Test Grid created from DG -> test transfer of various pieces of info ! Note that the DG holds the topology info of the original GridCreate() ! short-cut, so here simple periodic connection along dim=1. - + gridAux = gridIn ! hold on to original gridIn - + call ESMF_GridGet(gridAux, distgrid=distgrid, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + #ifdef TEST_GRID_EDGE_WIDTHS_KEEP_FACTORIZED_COORDS coordDimMap(1,1) = 1 coordDimMap(1,2) = 1 @@ -236,7 +248,7 @@ subroutine InitializeRealize(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + #ifdef TEST_GRID_EDGE_WIDTHS_KEEP_FACTORIZED_COORDS call ESMF_GridGetCoord(gridAux, coordDim=1, array=array, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -317,16 +329,16 @@ subroutine InitializeRealize(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out #endif - + #if 1 ! testing the output of coord arrays !TODO: ! Coords are currently written in 2D index space even if there is coordinate ! factorization used, e.g. in the Ufrm() GridCreate. Therefore the coord - ! arrays have replicated dims, and underlying allocation is only 1D. This + ! arrays have replicated dims, and underlying allocation is only 1D. This ! should be changed in the ArrayWrite() where Arrays with replicated dims - ! should write out only the non-degenerate data, i.e. according to the - ! actual data allocation. + ! should write out only the non-degenerate data, i.e. according to the + ! actual data allocation. ! -> here that would be a 1D array for each coordiante dim. ! center: call ESMF_GridGetCoord(gridIn, coordDim=1, array=array, rc=rc) @@ -421,7 +433,7 @@ subroutine InitializeRealize(model, importState, exportState, clock, rc) return ! bail out #endif #endif - + #if 1 ! write out the Grid into VTK file for inspection call ESMF_GridWriteVTK(gridIn, staggerloc=ESMF_STAGGERLOC_CENTER, & @@ -470,7 +482,7 @@ subroutine InitializeRealize(model, importState, exportState, clock, rc) return ! bail out #define WITH_FORMAL_REALIZE #ifdef WITH_FORMAL_REALIZE - ! There is not need to formally call Realize() when completing the + ! There is not need to formally call Realize() when completing the ! adverised field directly. However, calling Realize() also works. call NUOPC_Realize(importState, field=field, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -479,7 +491,7 @@ subroutine InitializeRealize(model, importState, exportState, clock, rc) return ! bail out #endif #endif - + ! importable field: surface_net_downward_shortwave_flux call NUOPC_Realize(importState, gridIn, fieldName="rsns", & typekind=ESMF_TYPEKIND_R8, selection="realize_connected_remove_others", & @@ -506,7 +518,7 @@ subroutine InitializeRealize(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + #if 0 ! write out the Grid into VTK file for inspection ! -> This currently only works if there are no holes in the index space @@ -543,8 +555,8 @@ subroutine InitializeRealize(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - -#ifdef TEST_MULTI_TILE_GRID + +#ifdef TEST_MULTI_TILE_GRID !--- 6-tile cubed-sphere Grid: for ssh field below ------------------------ gridOut = ESMF_GridCreateCubedSphere(tileSize=16, name="OCN-CubedSphere", & staggerLocList=(/ESMF_STAGGERLOC_CENTER/), & @@ -561,7 +573,7 @@ subroutine InitializeRealize(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out #endif - + ! exportable field: sea_surface_height_above_sea_level call NUOPC_Realize(exportState, gridOut, fieldName="ssh", & typekind=ESMF_TYPEKIND_R8, selection="realize_connected_remove_others", & @@ -602,7 +614,7 @@ subroutine InitializeRealize(model, importState, exportState, clock, rc) ind = ind + 1 enddo endif - + ! create the grid gridArb = ESMF_GridCreate1PeriDim(maxIndex=(/iCount, jCount/), & arbIndexCount=arbIndexCount, arbIndexList=arbIndexList, & @@ -628,7 +640,7 @@ subroutine InitializeRealize(model, importState, exportState, clock, rc) do i=lbound(fptr,1),ubound(fptr,1) fptr(i) = real((arbIndexList(i,1)-1)) * 360.0 / real(iCount) enddo - + ! fill latitudes call ESMF_GridGetCoord(gridArb, coordDim=2, farrayPtr=fptr, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -638,7 +650,7 @@ subroutine InitializeRealize(model, importState, exportState, clock, rc) do i=lbound(fptr,1),ubound(fptr,1) fptr(i) = real((arbIndexList(i,2)-1)) * 160.0 / real(jCount) - 80.0 enddo - + ! create a field on the grid fieldArb = ESMF_FieldCreate(gridArb, typekind=ESMF_TYPEKIND_R8, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -663,7 +675,7 @@ subroutine InitializeRealize(model, importState, exportState, clock, rc) ! create an auxiliary regDecomp grid with the same index space as gridArb ! periodic along i (must set here explicitly to match the gridArb ! ESMF_GridCreate1PeriDim() from above). In the long run, - ! an arbDistr Grid will actually store a regDecomp auxiliary DistGrid + ! an arbDistr Grid will actually store a regDecomp auxiliary DistGrid ! internally which holds the correct connections. allocate(connectionList(1)) call ESMF_DistGridConnectionSet(connection=connectionList(1), & @@ -730,7 +742,7 @@ subroutine InitializeRealize(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! now use the regrid sparse matrix (factorList and factorIndexList) from ! above to precompute the routehandle for the arbDistr case. This works ! because the index space is identical. @@ -815,26 +827,26 @@ subroutine InitializeRealize(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- subroutine SetClock(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_TimeInterval) :: stabilityTimeStep rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock call NUOPC_ModelGet(model, modelClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! initialize internal clock ! here: parent Clock and stability timeStep determine actual model timeStep !TODO: stabilityTimeStep should be read in from configuation @@ -849,15 +861,15 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -868,8 +880,8 @@ subroutine ModelAdvance(model, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -878,14 +890,14 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set in SetClock(), ! its timeStep is likely smaller than the parent timeStep. As a consequence - ! the time interval covered by a single parent timeStep will result in - ! multiple calls to the ModelAdvance() routine. Every time the currTime + ! the time interval covered by a single parent timeStep will result in + ! multiple calls to the Advance() routine. Every time the currTime ! will come in by one internal timeStep advanced. This goes until the ! stopTime of the internal Clock has been reached. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing OCN from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -897,13 +909,13 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_TimePrint(currTime + timeStep, & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & diff --git a/AtmOcnTransferLocStreamProto/README b/AtmOcnTransferLocStreamProto/README index d0ff0a84..3c91cfef 100644 --- a/AtmOcnTransferLocStreamProto/README +++ b/AtmOcnTransferLocStreamProto/README @@ -44,11 +44,10 @@ Output: Code structure: - Makefile - Makefile that is based on the standard esmf.mk mechanism. - atm.F90 - The ATM component, specializing generic NUOPC_Model. - * Implements IPDv03 to accept LocStreams from OCN component. + * Accept LocStreams from OCN component. * Indicates "cannot provide" for LocStream on export Field "pmsl". * Indicates "can provide" for LocStream on import Field "sst". - ocn.F90 - The OCN component, specializing generic NUOPC_Model. - * Implements IPDv01. * Implicitly indicate "will provide" for LocStreams on all import and export Fields. - esm.F90 - The Earth System Model (ESM) component, specializing generic diff --git a/AtmOcnTransferLocStreamProto/atm.F90 b/AtmOcnTransferLocStreamProto/atm.F90 index 9c9ac400..d103a139 100644 --- a/AtmOcnTransferLocStreamProto/atm.F90 +++ b/AtmOcnTransferLocStreamProto/atm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,114 +17,90 @@ module ATM use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_DataInitialize => label_DataInitialize, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! set entry point for methods that require specific implementation - ! -> switching to IPD versions is done in InitializeP0 - call ESMF_GridCompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - userRoutine=InitializeP0, phase=0, rc=rc) + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv03p1"/), userRoutine=InitializeP1, rc=rc) + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv03p3"/), userRoutine=InitializeP3, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=RealizeProvided, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv03p4"/), userRoutine=InitializeP4, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_AcceptTransfer, & + specRoutine=AcceptTransfer, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv03p5"/), userRoutine=InitializeP5, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeAccepted, & + specRoutine=RealizeAccepted, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_DataInitialize, & + specRoutine=DataInitialize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_DataInitialize, & - specRoutine=DataInitialize, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP0(model, importState, exportState, clock, rc) - type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - + subroutine Advertise(model, rc) + type(ESMF_GridComp) :: model + integer, intent(out) :: rc + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - ! Switch to IPDv03 by filtering all other phaseMap entries - call NUOPC_CompFilterPhaseMap(model, ESMF_METHOD_INITIALIZE, & - acceptStringList=(/"IPDv03p"/), rc=rc) + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) - type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - ! importable field: sea_surface_temperature ! -> marked as "can provide" call NUOPC_Advertise(importState, & @@ -144,7 +120,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + #if 0 ! exportable field: surface_net_downward_shortwave_flux ! -> use default, i.e. marked as "will provide" @@ -157,24 +133,31 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) #endif end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP3(model, importState, exportState, clock, rc) + subroutine RealizeProvided(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn, gridOut integer :: i, j real(kind=ESMF_KIND_R8), pointer :: lonPtr(:,:), latPtr(:,:) character(ESMF_MAXSTR) :: transferAction - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create Grid objects for Fields gridIn = ESMF_GridCreate1PeriDim(minIndex=(/1,1/), maxIndex=(/200,100/), & indexflag=ESMF_INDEX_GLOBAL, coordSys=ESMF_COORDSYS_SPH_DEG, rc=rc) @@ -203,7 +186,7 @@ subroutine InitializeP3(model, importState, exportState, clock, rc) latPtr(i,j) = 100./real(100) * (j-1) - 50. enddo enddo - + gridOut = gridIn ! for now out same as in ! importable field: sea_surface_temperature @@ -270,16 +253,15 @@ subroutine InitializeP3(model, importState, exportState, clock, rc) #endif end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP4(model, importState, exportState, clock, rc) + subroutine AcceptTransfer(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_LocStream) :: locStream integer :: localDeCount @@ -295,9 +277,17 @@ subroutine InitializeP4(model, importState, exportState, clock, rc) type(ESMF_DistGridConnection), allocatable :: connectionList(:) rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + !NOTE: The air_pressure_at_sea_level (pmsl) Field should now have the - !NOTE: accepted LocStream available. It is still an empty Field, but with + !NOTE: accepted LocStream available. It is still an empty Field, but with !NOTE LocStream. !NOTE: If the decomposition and distribution of the accepted LocStream is to !NOTE: be changed on the acceptor side (i.e. the ATM here) then this @@ -310,14 +300,14 @@ subroutine InitializeP4(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! while this is still an empty field, it does now hold a LocStream with DistGrid call ESMF_FieldGet(field, locStream=locStream, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! inspect the LocStream name call ESMF_LocStreamGet(locStream, name=name, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -330,7 +320,7 @@ subroutine InitializeP4(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! access localDeCount to show this is a real LocStream call ESMF_LocStreamGet(locStream, localDeCount=localDeCount, & distgrid=distgrid, rc=rc) @@ -345,11 +335,11 @@ subroutine InitializeP4(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - - ! Create a custom DistGrid, based on the minIndex, maxIndex of the + + ! Create a custom DistGrid, based on the minIndex, maxIndex of the ! accepted DistGrid, but with a default regDecomp for the current VM ! that leads to 1DE/PET (as long as there are more PETs than tiles). - + ! get dimCount and tileCount call ESMF_DistGridGet(distgrid, dimCount=dimCount, tileCount=tileCount, & connectionCount=connectionCount, rc=rc) @@ -357,12 +347,12 @@ subroutine InitializeP4(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! allocate minIndexPTile and maxIndexPTile accord. to dimCount and tileCount allocate(minIndexPTile(dimCount, tileCount), & maxIndexPTile(dimCount, tileCount)) allocate(connectionList(connectionCount)) - + ! get minIndex and maxIndex arrays call ESMF_DistGridGet(distgrid, minIndexPTile=minIndexPTile, & maxIndexPTile=maxIndexPTile, connectionList=connectionList, rc=rc) @@ -372,7 +362,7 @@ subroutine InitializeP4(model, importState, exportState, clock, rc) return ! bail out #if 0 - ! report on the connections + ! report on the connections print *, "connectionCount=", connectionCount do i=1, connectionCount call ESMF_DistGridConnectionPrint(connectionList(i)) @@ -398,21 +388,21 @@ subroutine InitializeP4(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call ESMF_FieldEmptySet(field, locstream=locStream, rc=rc) + call ESMF_FieldEmptySet(field, locstream=locStream, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out ! Also must swap the LocStream for the "sst" Field in the importState - + ! access the "sst" field in the importState and set the LocStream call ESMF_StateGet(importState, field=field, itemName="sst", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call ESMF_FieldEmptySet(field, locstream=locStream, rc=rc) + call ESMF_FieldEmptySet(field, locstream=locStream, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -424,7 +414,7 @@ subroutine InitializeP4(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + write (msgString,*) "ATM - InitializeP4: final LocStream localDeCount = ", & localDeCount call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) @@ -432,25 +422,32 @@ subroutine InitializeP4(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP5(model, importState, exportState, clock, rc) + subroutine RealizeAccepted(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + ! local variables - type(ESMF_Field) :: field - type(ESMF_LocStream) :: locStream - character(80) :: name - character(160) :: msgString + type(ESMF_State) :: importState, exportState + type(ESMF_Field) :: field + type(ESMF_LocStream) :: locStream + character(80) :: name + character(160) :: msgString rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! realize the "sst" field in the importState call NUOPC_Realize(importState, fieldName="sst", field=field, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -517,13 +514,13 @@ subroutine InitializeP5(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- subroutine DataInitialize(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_State) :: exportState type(ESMF_Field) :: field @@ -533,7 +530,7 @@ subroutine DataInitialize(model, rc) rc = ESMF_SUCCESS - ! query the Component for its exportState + ! query for exportState call NUOPC_ModelGet(model, exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -614,7 +611,7 @@ subroutine DataInitialize(model, rc) file=__FILE__)) & return ! bail out #endif - + ! indicate that data initialization is complete (breaking out of init-loop) call NUOPC_CompAttributeSet(model, & name="InitializeDataComplete", value="true", rc=rc) @@ -622,23 +619,23 @@ subroutine DataInitialize(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -647,12 +644,12 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set by default, ! its timeStep is equal to the parent timeStep. As a consequence the ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. - + ! for this call of the Advance() routine. + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing ATM from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -664,7 +661,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -679,4 +676,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnTransferLocStreamProto/esm.F90 b/AtmOcnTransferLocStreamProto/esm.F90 index 4c8d2fb7..4751beaa 100644 --- a/AtmOcnTransferLocStreamProto/esm.F90 +++ b/AtmOcnTransferLocStreamProto/esm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,21 +17,19 @@ module ESM use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices, & - driver_label_ModifyCplLists => label_ModifyCplLists - + driverSS => SetServices + use ATM, only: atmSS => SetServices use OCN, only: ocnSS => SetServices - + use NUOPC_Connector, only: cplSS => SetServices - + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -39,30 +37,37 @@ module ESM subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & + + ! specialize driver + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(driver, specLabel=driver_label_ModifyCplLists, & + call NUOPC_CompSpecialize(driver, specLabel=label_ModifyCplLists, & specRoutine=ModifyCplLists, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + + ! set driver verbosity + call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + end subroutine !----------------------------------------------------------------------------- @@ -70,7 +75,7 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables type(ESMF_Time) :: startTime type(ESMF_Time) :: stopTime @@ -80,7 +85,7 @@ subroutine SetModelServices(driver, rc) integer, allocatable :: petList(:) rc = ESMF_SUCCESS - + ! get the petCount call ESMF_GridCompGet(driver, petCount=petCount, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -99,7 +104,7 @@ subroutine SetModelServices(driver, rc) file=__FILE__)) & return ! bail out deallocate(petList) - + ! SetServices for OCN with petList on second half of PETs allocate(petList(petCount/2)) do i=1, petCount/2 @@ -119,7 +124,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for ocn2atm call NUOPC_DriverAddComp(driver, srcCompLabel="OCN", dstCompLabel="ATM", & compSetServicesRoutine=cplSS, rc=rc) @@ -127,7 +132,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! set the driver clock call ESMF_TimeIntervalSet(timeStep, m=15, rc=rc) ! 15 minute steps if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -153,13 +158,13 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- @@ -167,29 +172,29 @@ subroutine SetModelServices(driver, rc) subroutine ModifyCplLists(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables - character(len=160) :: msg + character(len=160) :: msg type(ESMF_CplComp), pointer :: connectorList(:) integer :: i, j, cplListSize character(len=160), allocatable :: cplList(:) character(len=160) :: tempString - + rc = ESMF_SUCCESS - + call ESMF_LogWrite("Driver is in ModifyCplLists()", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + nullify(connectorList) call NUOPC_DriverGetComp(driver, compList=connectorList, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + write (msg,*) "Found ", size(connectorList), " Connectors."// & " Modifying CplList Attribute...." call ESMF_LogWrite(trim(msg), ESMF_LOGMSG_INFO, rc=rc) @@ -197,7 +202,7 @@ subroutine ModifyCplLists(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + do i=1, size(connectorList) ! query the cplList for connector i call NUOPC_CompAttributeGet(connectorList(i), name="CplList", & @@ -234,9 +239,9 @@ subroutine ModifyCplLists(driver, rc) deallocate(cplList) endif enddo - + deallocate(connectorList) - + end subroutine !----------------------------------------------------------------------------- diff --git a/AtmOcnTransferLocStreamProto/esmApp.F90 b/AtmOcnTransferLocStreamProto/esmApp.F90 index 1cb22710..9e5e2ae8 100644 --- a/AtmOcnTransferLocStreamProto/esmApp.F90 +++ b/AtmOcnTransferLocStreamProto/esmApp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -21,7 +21,7 @@ program esmApp integer :: rc, urc type(ESMF_GridComp) :: esmComp - + ! Initialize ESMF call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, & defaultCalkind=ESMF_CALKIND_GREGORIAN, rc=rc) @@ -29,8 +29,6 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - - call ESMF_LogSet(flush=.true.) call ESMF_LogWrite("esmApp STARTING", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -44,7 +42,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! SetServices for the earth system Component call ESMF_GridCompSetServices(esmComp, esmSS, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -55,7 +53,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Initialize for the earth system Component call ESMF_GridCompInitialize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -66,7 +64,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Run for earth the system Component call ESMF_GridCompRun(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -77,7 +75,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Finalize for the earth system Component call ESMF_GridCompFinalize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -88,14 +86,14 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Destroy the earth system Component call ESMF_GridCompDestroy(esmComp, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -104,5 +102,5 @@ program esmApp ! Finalize ESMF call ESMF_Finalize() - -end program + +end program diff --git a/AtmOcnTransferLocStreamProto/ocn.F90 b/AtmOcnTransferLocStreamProto/ocn.F90 index 768d946d..4f02a1c5 100644 --- a/AtmOcnTransferLocStreamProto/ocn.F90 +++ b/AtmOcnTransferLocStreamProto/ocn.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,74 +17,78 @@ module OCN use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_SetClock => label_SetClock, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeAdvertise, rc=rc) + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeRealize, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_SetClock, & + call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & specRoutine=SetClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeAdvertise(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: air_pressure_at_sea_level ! -> use default, i.e. marked as "will provide" call NUOPC_Advertise(importState, & @@ -115,24 +119,31 @@ subroutine InitializeAdvertise(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeRealize(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_LocStream) :: locStreamIn, locStreamOut type(ESMF_VM) :: vm integer :: localPet, petCount, numLocations integer :: i real(kind=ESMF_KIND_R8), pointer :: lon(:), lat(:) - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create LocStream objects for Fields call ESMF_VMGetCurrent(vm, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -144,7 +155,7 @@ subroutine InitializeRealize(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + !------------------------------------------------------------------- ! Allocate and set example location information. Locations on a PET ! are wrapped around sphere. Each PET occupies a different latitude @@ -168,7 +179,7 @@ subroutine InitializeRealize(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + !------------------------------------------------------------------- ! Add key data !------------------------------------------------------------------- @@ -188,7 +199,7 @@ subroutine InitializeRealize(model, importState, exportState, clock, rc) return ! bail out ! clean-up lon, lat arrays deallocate(lon, lat) - + ! for now out same as in locStreamOut = locStreamIn @@ -200,8 +211,8 @@ subroutine InitializeRealize(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - -#if 0 + +#if 0 ! importable field: surface_net_downward_shortwave_flux call NUOPC_Realize(importState, locStreamIn, fieldName="rsns", & typekind=ESMF_TYPEKIND_R8, selection="realize_connected_remove_others", & @@ -222,26 +233,26 @@ subroutine InitializeRealize(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- subroutine SetClock(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_TimeInterval) :: stabilityTimeStep rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock call NUOPC_ModelGet(model, modelClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! initialize internal clock ! here: parent Clock and stability timeStep determine actual model timeStep !TODO: stabilityTimeStep should be read in from configuation @@ -256,15 +267,15 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -273,8 +284,8 @@ subroutine ModelAdvance(model, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -283,14 +294,14 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set in SetClock(), ! its timeStep is likely smaller than the parent timeStep. As a consequence - ! the time interval covered by a single parent timeStep will result in - ! multiple calls to the ModelAdvance() routine. Every time the currTime + ! the time interval covered by a single parent timeStep will result in + ! multiple calls to the Advance() routine. Every time the currTime ! will come in by one internal timeStep advanced. This goes until the ! stopTime of the internal Clock has been reached. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing OCN from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -302,13 +313,13 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_TimePrint(currTime + timeStep, & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -323,4 +334,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnTransferMeshProto/README b/AtmOcnTransferMeshProto/README index 6a4d50d7..a4b02273 100644 --- a/AtmOcnTransferMeshProto/README +++ b/AtmOcnTransferMeshProto/README @@ -45,11 +45,10 @@ Output: Code structure: - Makefile - Makefile that is based on the standard esmf.mk mechanism. - atm.F90 - The ATM component, specializing generic NUOPC_Model. - * Implements IPDv03 to accept Mesh from OCN component. + * Accept Mesh from OCN component. * Indicates "cannot provide" for some Mesh * Indicates "can provide" for some Mesh - ocn.F90 - The OCN component, specializing generic NUOPC_Model. - * Implements IPDv01. * Implicitly indicate "will provide" for all Mesh. - esm.F90 - The Earth System Model (ESM) component, specializing generic NUOPC_Driver. Define partial petLists for ATM diff --git a/AtmOcnTransferMeshProto/atm.F90 b/AtmOcnTransferMeshProto/atm.F90 index 72389d82..65af1596 100644 --- a/AtmOcnTransferMeshProto/atm.F90 +++ b/AtmOcnTransferMeshProto/atm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,132 +17,89 @@ module ATM use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_DataInitialize => label_DataInitialize, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! set entry point for methods that require specific implementation - ! -> switching to IPD versions is done in InitializeP0 - call ESMF_GridCompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - userRoutine=InitializeP0, phase=0, rc=rc) + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv03p1"/), & - userRoutine=InitializeAdvertise, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv03p3"/), & - userRoutine=InitializeRealizeForProvide, rc=rc) + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv03p4"/), & - userRoutine=InitializeAcceptChangeDistGrid, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=RealizeProvided, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv03p5"/), & - userRoutine=InitializeAcceptMeshAndRealize, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_AcceptTransfer, & + specRoutine=AcceptTransfer, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeAccepted, & + specRoutine=RealizeAccepted, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_DataInitialize, & + call NUOPC_CompSpecialize(model, specLabel=label_DataInitialize, & specRoutine=DataInitialize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine InitializeP0(model, importState, exportState, clock, rc) - type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - - ! Switch to IPDv03 by filtering all other phaseMap entries - call NUOPC_CompFilterPhaseMap(model, ESMF_METHOD_INITIALIZE, & - acceptStringList=(/"IPDv03p"/), rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeAdvertise(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + ! local variables - character(*), parameter :: rName="InitializeAdvertise" - character(ESMF_MAXSTR) :: name - integer :: verbosity + type(ESMF_State) :: importState, exportState rc = ESMF_SUCCESS - - ! query the component for info - call NUOPC_CompGet(model, name=name, verbosity=verbosity, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - - ! intro - call NUOPC_LogIntro(name, rName, verbosity, rc=rc) + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out + line=__LINE__, & + file=__FILE__)) & + return ! bail out ! importable field: sea_surface_temperature ! -> marked as "can provide" @@ -173,23 +130,17 @@ subroutine InitializeAdvertise(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - - ! extro - call NUOPC_LogExtro(name, rName, verbosity, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeRealizeForProvide(model, importState, exportState, clock, rc) + subroutine RealizeProvided(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn, gridOut integer :: i, j @@ -200,17 +151,15 @@ subroutine InitializeRealizeForProvide(model, importState, exportState, clock, r integer :: verbosity rc = ESMF_SUCCESS - - ! query the component for info - call NUOPC_CompGet(model, name=name, verbosity=verbosity, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - - ! intro - call NUOPC_LogIntro(name, rName, verbosity, rc=rc) + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create Grid objects for Fields gridIn = ESMF_GridCreate1PeriDim(minIndex=(/1,1/), maxIndex=(/200,100/), & indexflag=ESMF_INDEX_GLOBAL, coordSys=ESMF_COORDSYS_SPH_DEG, rc=rc) @@ -239,7 +188,7 @@ subroutine InitializeRealizeForProvide(model, importState, exportState, clock, r latPtr(i,j) = 100./real(100) * (j-1) - 50. enddo enddo - + gridOut = gridIn ! for now out same as in ! importable field: sea_surface_temperature @@ -290,22 +239,16 @@ subroutine InitializeRealizeForProvide(model, importState, exportState, clock, r !NOTE: because it was marked with TransferOfferGeomObject="cannot provide". !NOTE: It is expected that the Connector will fill in a Grid object for it. - ! extro - call NUOPC_LogExtro(name, rName, verbosity, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeAcceptChangeDistGrid(model, importState, exportState, clock, rc) + subroutine AcceptTransfer(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Mesh) :: mesh integer :: localDeCount @@ -315,20 +258,17 @@ subroutine InitializeAcceptChangeDistGrid(model, importState, exportState, clock type(ESMF_DELayout) :: delayout character(*), parameter :: rName="InitializeAcceptChangeDistGrid" character(ESMF_MAXSTR) :: name - integer :: verbosity rc = ESMF_SUCCESS - - ! query the component for info - call NUOPC_CompGet(model, name=name, verbosity=verbosity, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - - ! intro - call NUOPC_LogIntro(name, rName, verbosity, rc=rc) + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - + line=__LINE__, & + file=__FILE__)) & + return ! bail out + !NOTE: The air_pressure_at_sea_level (pmsl) Field should now have the !NOTE: accepted Mesh available. It is still an empty Field, but with Mesh. !NOTE: If the decomposition and distribution of the accepted Mesh is to @@ -342,14 +282,14 @@ subroutine InitializeAcceptChangeDistGrid(model, importState, exportState, clock line=__LINE__, & file=__FILE__)) & return ! bail out - + ! while this is still an empty field, it does now hold a Mesh with DistGrid call ESMF_FieldGet(field, mesh=mesh, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! NOTE: ! cannot write the transferred Mesh here, because it does NOT contain ! coordinates yet @@ -361,20 +301,20 @@ subroutine InitializeAcceptChangeDistGrid(model, importState, exportState, clock line=__LINE__, & file=__FILE__)) & return ! bail out - + ! The acceptor side can either use the nodal DistGrid, or the element ! DistGrid, or both to define its own decomposition and distribution of - ! the transferred Mesh. Use the following two macros to define which + ! the transferred Mesh. Use the following two macros to define which ! DistGrid to use for defining the acceptor side decomposition. - + #define USE_NODAL_DG_off #define USE_ELEMENT_DG #ifdef USE_NODAL_DG - ! Create a custom DistGrid, based on the minIndex, maxIndex of the + ! Create a custom DistGrid, based on the minIndex, maxIndex of the ! accepted DistGrid, but with a default regDecomp for the current VM ! that leads to 1DE/PET (as long as there are more PETs than tiles). - + #if 1 ! inspect the transferred nodalDG call ESMF_DistGridGet(nodalDG, delayout=delayout, rc=rc) @@ -408,10 +348,10 @@ subroutine InitializeAcceptChangeDistGrid(model, importState, exportState, clock #endif #ifdef USE_ELEMENT_DG - ! Create a custom DistGrid, based on the minIndex, maxIndex of the + ! Create a custom DistGrid, based on the minIndex, maxIndex of the ! accepted DistGrid, but with a default regDecomp for the current VM ! that leads to 1DE/PET (as long as there are more PETs than tiles). - + #if 1 ! inspect the transferred elementDG call ESMF_DistGridGet(elementDG, delayout=delayout, rc=rc) @@ -467,9 +407,9 @@ subroutine InitializeAcceptChangeDistGrid(model, importState, exportState, clock file=__FILE__)) & return ! bail out #endif - + ! Swap Mesh in the "pmsl" field - call ESMF_FieldEmptySet(field, mesh=mesh, rc=rc) + call ESMF_FieldEmptySet(field, mesh=mesh, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -481,14 +421,14 @@ subroutine InitializeAcceptChangeDistGrid(model, importState, exportState, clock line=__LINE__, & file=__FILE__)) & return ! bail out - + ! while this is still an empty field, it does now hold a Mesh with DistGrid call ESMF_FieldGet(field, mesh=mesh, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! NOTE: ! cannot write the transferred Mesh here, because it does NOT contain ! coordinates yet @@ -500,22 +440,22 @@ subroutine InitializeAcceptChangeDistGrid(model, importState, exportState, clock line=__LINE__, & file=__FILE__)) & return ! bail out - + ! The acceptor side can either use the nodal DistGrid, or the element ! DistGrid, or both to define its own decomposition and distribution of - ! the transferred Mesh. Use the following two macros to define which + ! the transferred Mesh. Use the following two macros to define which ! DistGrid to use for defining the acceptor side decomposition. - + #undef USE_NODAL_DG #undef USE_ELEMENT_DG #define USE_NODAL_DG_off #define USE_ELEMENT_DG #ifdef USE_NODAL_DG - ! Create a custom DistGrid, based on the minIndex, maxIndex of the + ! Create a custom DistGrid, based on the minIndex, maxIndex of the ! accepted DistGrid, but with a default regDecomp for the current VM ! that leads to 1DE/PET (as long as there are more PETs than tiles). - + #if 1 ! inspect the transferred nodalDG call ESMF_DistGridGet(nodalDG, delayout=delayout, rc=rc) @@ -549,10 +489,10 @@ subroutine InitializeAcceptChangeDistGrid(model, importState, exportState, clock #endif #ifdef USE_ELEMENT_DG - ! Create a custom DistGrid, based on the minIndex, maxIndex of the + ! Create a custom DistGrid, based on the minIndex, maxIndex of the ! accepted DistGrid, but with a default regDecomp for the current VM ! that leads to 1DE/PET (as long as there are more PETs than tiles). - + #if 1 ! inspect the transferred elementDG call ESMF_DistGridGet(elementDG, delayout=delayout, rc=rc) @@ -608,9 +548,9 @@ subroutine InitializeAcceptChangeDistGrid(model, importState, exportState, clock file=__FILE__)) & return ! bail out #endif - + ! Swap Mesh in the "sst" field - call ESMF_FieldEmptySet(field, mesh=mesh, rc=rc) + call ESMF_FieldEmptySet(field, mesh=mesh, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -629,28 +569,22 @@ subroutine InitializeAcceptChangeDistGrid(model, importState, exportState, clock ! Mesh coordinates only once. ! If on the other hand a different distribution is desired for different ! fields, then construct separate Meshes and swap those into the field. - call ESMF_FieldEmptySet(field, mesh=mesh, rc=rc) + call ESMF_FieldEmptySet(field, mesh=mesh, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - ! extro - call NUOPC_LogExtro(name, rName, verbosity, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeAcceptMeshAndRealize(model, importState, exportState, clock, rc) + subroutine RealizeAccepted(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field character(160) :: msgString type(ESMF_Field) :: fieldIn, fieldOut @@ -662,17 +596,15 @@ subroutine InitializeAcceptMeshAndRealize(model, importState, exportState, clock integer :: verbosity rc = ESMF_SUCCESS - - ! query the component for info - call NUOPC_CompGet(model, name=name, verbosity=verbosity, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - - ! intro - call NUOPC_LogIntro(name, rName, verbosity, rc=rc) + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! realize "pmsl" field in the exportState, with transferred Mesh call NUOPC_Realize(exportState, fieldName="pmsl", field=field, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -700,7 +632,7 @@ subroutine InitializeAcceptMeshAndRealize(model, importState, exportState, clock #endif fieldOut = field ! keep field for RegridStore() test - + call ESMF_LogWrite("ATM - Just completed the 'pmsl' Field", & ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -745,7 +677,7 @@ subroutine InitializeAcceptMeshAndRealize(model, importState, exportState, clock file=__FILE__)) & return ! bail out - ! test a regrid between to fields that were created on transferred Meshes + ! test a regrid between to fields that were created on transferred Meshes call ESMF_FieldRegridStore(fieldIn, fieldOut, routehandle=rh, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -761,19 +693,14 @@ subroutine InitializeAcceptMeshAndRealize(model, importState, exportState, clock file=__FILE__)) & return ! bail out - ! extro - call NUOPC_LogExtro(name, rName, verbosity, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - end subroutine - + !----------------------------------------------------------------------------- subroutine DataInitialize(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_State) :: exportState type(ESMF_Field) :: field @@ -783,7 +710,7 @@ subroutine DataInitialize(model, rc) rc = ESMF_SUCCESS - ! query the Component for its exportState + ! query for exportState call NUOPC_ModelGet(model, exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -829,23 +756,23 @@ subroutine DataInitialize(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -854,12 +781,12 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set by default, ! its timeStep is equal to the parent timeStep. As a consequence the ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. - + ! for this call of the Advance() routine. + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing ATM from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -871,7 +798,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -886,4 +813,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnTransferMeshProto/esm.F90 b/AtmOcnTransferMeshProto/esm.F90 index 71932311..d4adad58 100644 --- a/AtmOcnTransferMeshProto/esm.F90 +++ b/AtmOcnTransferMeshProto/esm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,21 +17,19 @@ module ESM use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices, & - driver_label_ModifyCplLists => label_ModifyCplLists - + driverSS => SetServices + use ATM, only: atmSS => SetServices use OCN, only: ocnSS => SetServices - + use NUOPC_Connector, only: cplSS => SetServices - + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -39,31 +37,31 @@ module ESM subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & + + ! specialize driver + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(driver, specLabel=driver_label_ModifyCplLists, & + call NUOPC_CompSpecialize(driver, specLabel=label_ModifyCplLists, & specRoutine=ModifyCplLists, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set verbosity on driver + + ! set driver verbosity call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -77,7 +75,7 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables type(ESMF_Time) :: startTime type(ESMF_Time) :: stopTime @@ -92,14 +90,14 @@ subroutine SetModelServices(driver, rc) character(len=10) :: attrStr rc = ESMF_SUCCESS - + ! get the petCount call ESMF_GridCompGet(driver, petCount=petCount, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! split up the PETs between ATM and OCN petCountOCN = min(2,petCount/2) ! don't give OCN more than 2 PETs petCountATM = petCount - petCountOCN @@ -124,7 +122,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for OCN with petList on second half of PETs allocate(petList(petCountOCN)) do i=1, petCountOCN @@ -162,7 +160,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for ocn2atm call NUOPC_DriverAddComp(driver, srcCompLabel="OCN", dstCompLabel="ATM", & compSetServicesRoutine=cplSS, comp=conn, rc=rc) @@ -205,13 +203,13 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- @@ -219,29 +217,29 @@ subroutine SetModelServices(driver, rc) subroutine ModifyCplLists(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables - character(len=160) :: msg + character(len=160) :: msg type(ESMF_CplComp), pointer :: connectorList(:) integer :: i, j, cplListSize character(len=160), allocatable :: cplList(:) character(len=160) :: tempString - + rc = ESMF_SUCCESS - + call ESMF_LogWrite("Driver is in ModifyCplLists()", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + nullify(connectorList) call NUOPC_DriverGetComp(driver, compList=connectorList, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + write (msg,*) "Found ", size(connectorList), " Connectors."// & " Modifying CplList Attribute...." call ESMF_LogWrite(trim(msg), ESMF_LOGMSG_INFO, rc=rc) @@ -249,7 +247,7 @@ subroutine ModifyCplLists(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + do i=1, size(connectorList) ! query the cplList for connector i call NUOPC_CompAttributeGet(connectorList(i), name="CplList", & @@ -292,9 +290,9 @@ subroutine ModifyCplLists(driver, rc) deallocate(cplList) endif enddo - + deallocate(connectorList) - + end subroutine !----------------------------------------------------------------------------- diff --git a/AtmOcnTransferMeshProto/esmApp.F90 b/AtmOcnTransferMeshProto/esmApp.F90 index 1cb22710..9e5e2ae8 100644 --- a/AtmOcnTransferMeshProto/esmApp.F90 +++ b/AtmOcnTransferMeshProto/esmApp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -21,7 +21,7 @@ program esmApp integer :: rc, urc type(ESMF_GridComp) :: esmComp - + ! Initialize ESMF call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, & defaultCalkind=ESMF_CALKIND_GREGORIAN, rc=rc) @@ -29,8 +29,6 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - - call ESMF_LogSet(flush=.true.) call ESMF_LogWrite("esmApp STARTING", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -44,7 +42,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! SetServices for the earth system Component call ESMF_GridCompSetServices(esmComp, esmSS, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -55,7 +53,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Initialize for the earth system Component call ESMF_GridCompInitialize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -66,7 +64,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Run for earth the system Component call ESMF_GridCompRun(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -77,7 +75,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Finalize for the earth system Component call ESMF_GridCompFinalize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -88,14 +86,14 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Destroy the earth system Component call ESMF_GridCompDestroy(esmComp, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -104,5 +102,5 @@ program esmApp ! Finalize ESMF call ESMF_Finalize() - -end program + +end program diff --git a/AtmOcnTransferMeshProto/ocn.F90 b/AtmOcnTransferMeshProto/ocn.F90 index 06931c0b..38ad415b 100644 --- a/AtmOcnTransferMeshProto/ocn.F90 +++ b/AtmOcnTransferMeshProto/ocn.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,88 +17,77 @@ module OCN use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_SetClock => label_SetClock, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeAdvertise, rc=rc) + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeRealize, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_SetClock, & + call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & specRoutine=SetClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeAdvertise(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + ! local variables - character(*), parameter :: rName="InitializeAdvertise" - character(ESMF_MAXSTR) :: name - integer :: verbosity + type(ESMF_State) :: importState, exportState rc = ESMF_SUCCESS - - ! query the component for info - call NUOPC_CompGet(model, name=name, verbosity=verbosity, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - - ! intro - call NUOPC_LogIntro(name, rName, verbosity, rc=rc) + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out + line=__LINE__, & + file=__FILE__)) & + return ! bail out ! importable field: air_pressure_at_sea_level ! -> use default, i.e. marked as "will provide" @@ -127,23 +116,17 @@ subroutine InitializeAdvertise(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out - ! extro - call NUOPC_LogExtro(name, rName, verbosity, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - end subroutine - + !----------------------------------------------------------------------------- #define TEST_UNDIST_DIM - subroutine InitializeRealize(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Grid) :: gridIn, gridOut type(ESMF_Mesh) :: meshIn, meshOut #ifdef TEST_UNDIST_DIM @@ -152,21 +135,17 @@ subroutine InitializeRealize(model, importState, exportState, clock, rc) character(160) :: msgString integer :: dimCount, numOwnedElements, numOwnedNodes character(*), parameter :: rName="InitializeRealize" - character(ESMF_MAXSTR) :: name - integer :: verbosity rc = ESMF_SUCCESS - - ! query the component for info - call NUOPC_CompGet(model, name=name, verbosity=verbosity, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - - ! intro - call NUOPC_LogIntro(name, rName, verbosity, rc=rc) + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! --- IMPORT ------------------------------------------------------------- #define READ_MESHIN_FROM_FILE #ifdef READ_MESHIN_FROM_FILE @@ -280,7 +259,7 @@ subroutine InitializeRealize(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out #endif - + ! --- EXPORT ------------------------------------------------------------- #define READ_MESHOUT_FROM_FILE #ifdef READ_MESHOUT_FROM_FILE @@ -404,32 +383,27 @@ subroutine InitializeRealize(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out - ! extro - call NUOPC_LogExtro(name, rName, verbosity, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - end subroutine - + !----------------------------------------------------------------------------- subroutine SetClock(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_TimeInterval) :: stabilityTimeStep rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock call NUOPC_ModelGet(model, modelClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! initialize internal clock ! here: parent Clock and stability timeStep determine actual model timeStep !TODO: stabilityTimeStep should be read in from configuation @@ -444,15 +418,15 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -461,8 +435,8 @@ subroutine ModelAdvance(model, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -471,14 +445,14 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set in SetClock(), ! its timeStep is likely smaller than the parent timeStep. As a consequence - ! the time interval covered by a single parent timeStep will result in - ! multiple calls to the ModelAdvance() routine. Every time the currTime + ! the time interval covered by a single parent timeStep will result in + ! multiple calls to the Advance() routine. Every time the currTime ! will come in by one internal timeStep advanced. This goes until the ! stopTime of the internal Clock has been reached. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing OCN from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -490,13 +464,13 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_TimePrint(currTime + timeStep, & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -511,4 +485,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/ComponentExplorer/nuopcExplorerApp.F90 b/ComponentExplorer/nuopcExplorerApp.F90 index 2b0fa601..24f00df1 100644 --- a/ComponentExplorer/nuopcExplorerApp.F90 +++ b/ComponentExplorer/nuopcExplorerApp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -18,7 +18,7 @@ program explorerApp use NUOPC use nuopcExplorerDriver, only: explorerDriverSS => SetServices - + use NUOPC_Compliance_Driver, only: registerIC implicit none @@ -27,7 +27,7 @@ program explorerApp type(ESMF_GridComp) :: driver type(ESMF_VM) :: vm integer :: localPet, petCount - + type(ESMF_Config) :: config integer :: start_year integer :: start_month @@ -42,18 +42,18 @@ program explorerApp integer :: stop_minute integer :: stop_second integer :: step_seconds - + type(ESMF_Time) :: startTime type(ESMF_Time) :: stopTime type(ESMF_TimeInterval) :: timeStep type(ESMF_Clock) :: clock - + character(len=80) :: enable_run_string logical :: enable_run - + character(len=80) :: enable_finalize_string logical :: enable_finalize - + type(ESMF_State) :: importState, exportState ! Initialize ESMF @@ -63,7 +63,7 @@ program explorerApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogSet(flush=.true., rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -75,13 +75,13 @@ program explorerApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("explorerApp STARTING", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + if (localPet==0) then print * print *, "NUOPC Component Explorer App executing on ", petCount, "PETs" @@ -89,11 +89,11 @@ program explorerApp endif ! Set the clock according to the explorer.config file - + if (localPet==0) then print *, "Accessing start, stop, and step time info from 'explorer.config':" endif - + config = ESMF_ConfigCreate(rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -104,7 +104,7 @@ program explorerApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) ! bail out - + call ESMF_ConfigGetAttribute(config, start_year, label="start_year:", & rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -195,7 +195,7 @@ program explorerApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) ! bail out - + call ESMF_TimeSet(startTime, & yy = start_year, & mm = start_month, & @@ -234,7 +234,7 @@ program explorerApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + if (localPet==0) then print *, " start_year: ", start_year print *, " start_month: ", start_month @@ -252,7 +252,7 @@ program explorerApp print *, " - " print *, " step_seconds: ", step_seconds endif - + #if 0 call ESMF_ClockPrint(clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -267,31 +267,31 @@ program explorerApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) ! bail out - + enable_run = .false. ! initialize if (trim(enable_run_string)=="yes") then enable_run = .true. endif - + call ESMF_ConfigGetAttribute(config, enable_finalize_string, & label="enable_finalize:", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) ! bail out - + enable_finalize = .false. ! initialize if (trim(enable_finalize_string)=="yes") then enable_finalize = .true. endif - + ! Create the Driver Component driver = ESMF_GridCompCreate(name="explorerDriver", config=config, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! SetServices call ESMF_GridCompSetServices(driver, explorerDriverSS, userRc=urc, & rc=rc) @@ -310,7 +310,7 @@ program explorerApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call 0 phase Initialize call ESMF_GridCompInitialize(driver, phase=0, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -360,16 +360,16 @@ program explorerApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Change timeStep in Clock to be only a single timeStep from start to stop call ESMF_ClockSet(clock, timeStep=stopTime-startTime, rc=rc) if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + if (enable_run) then - ! Call Driver Run, + ! Call Driver Run, ! with Clock that steps from start to stop in one single timeStep if (localPet==0) print *, "Calling into Run()..." call ESMF_GridCompRun(driver, importState=importState, & @@ -383,7 +383,7 @@ program explorerApp file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) endif - + if (enable_finalize) then ! Call Driver Finalize if (localPet==0) print *, "Calling into Finalize()..." @@ -412,21 +412,21 @@ program explorerApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) ! bail out - + ! Destroy the importState call ESMF_StateDestroy(importState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Destroy the importState call ESMF_StateDestroy(ExportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Log call ESMF_LogWrite("explorerApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -439,8 +439,8 @@ program explorerApp print *, "See PET*.ESMF_LogFile's for additional information." print *, "------------------------------------------------------------" endif - + ! Finalize ESMF call ESMF_Finalize() - -end program + +end program diff --git a/ComponentExplorer/nuopcExplorerDriver.F90 b/ComponentExplorer/nuopcExplorerDriver.F90 index 96afc61c..e02bddb6 100644 --- a/ComponentExplorer/nuopcExplorerDriver.F90 +++ b/ComponentExplorer/nuopcExplorerDriver.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -25,10 +25,8 @@ module nuopcExplorerDriver use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices, & - driver_label_SetRunSequence => label_SetRunSequence - + driverSS => SetServices + #if defined(__GFORTRAN__) || defined(NAGFOR) # define STRINGIFY_START(X) "& # define STRINGIFY_END(X) &X" @@ -41,7 +39,7 @@ module nuopcExplorerDriver #ifdef FRONT_COMP use FRONT_COMP, only: compSS => SetServices #ifndef FRONT_COMP_LABEL -#define FRONT_COMP_LABEL FRONT_COMP +#define FRONT_COMP_LABEL FRONT_COMP #endif #elif (defined FRONT_H_COMP) use compFront, only: compSS => SetServices @@ -69,7 +67,8 @@ subroutine SetServices(driver, rc) rc = ESMF_SUCCESS - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -96,13 +95,13 @@ subroutine SetServices(driver, rc) return ! bail out ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetRunSequence, & + call NUOPC_CompSpecialize(driver, specLabel=label_SetRunSequence, & specRoutine=SetRunSequence, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -124,7 +123,7 @@ subroutine SetServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! set HierarchyProtocol on the driver call NUOPC_CompAttributeSet(driver, name="HierarchyProtocol", & value="Explorer", rc=rc) @@ -156,7 +155,7 @@ subroutine SetModelServices(driver, rc) character(len=160) :: soName #endif type(ESMF_GridComp) :: child - character(len=80) :: compName + character(len=80) :: compName type(ESMF_Config) :: config type(NUOPC_FreeFormat) :: attrFF @@ -289,7 +288,7 @@ subroutine InitReport(driver, importState, exportState, clock, rc) type(ESMF_GridComp), pointer :: compList(:) rc = ESMF_SUCCESS - + ! query Driver for localPet call ESMF_GridCompGet(driver, localPet=localPet, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -299,7 +298,7 @@ subroutine InitReport(driver, importState, exportState, clock, rc) ! query Driver for child components nullify(compList) - call NUOPC_DriverGetComp(driver, compList, rc=rc) + call NUOPC_DriverGetComp(driver, compList, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -311,10 +310,10 @@ subroutine InitReport(driver, importState, exportState, clock, rc) ! Models if (i > 0) then if (NUOPC_CompAreServicesSet(compList(i))) then - + write(iString, *) i comp = compList(i) ! alias to the component to be explored - + ! report name of the ESMF_GridComp object call ESMF_GridCompGet(comp, name=name, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -349,7 +348,7 @@ subroutine InitReport(driver, importState, exportState, clock, rc) print *, " "//trim(name)//": : "// & "Attribute is NOT present!" endif - + ! report GridComp level attribute: ShortName call ESMF_AttributeGet(comp, name="ShortName", & itemCount=guardCount, isPresent=isPresent, & @@ -401,7 +400,7 @@ subroutine InitReport(driver, importState, exportState, clock, rc) print *, " "//trim(name)//": : "// & "Attribute is NOT present!" endif - + ! report GridComp level attribute: Kind call ESMF_AttributeGet(comp, name="Kind", & itemCount=guardCount, isPresent=isPresent, & @@ -427,7 +426,7 @@ subroutine InitReport(driver, importState, exportState, clock, rc) print *, " "//trim(name)//": : "// & "Attribute is NOT present!" endif - + ! report GridComp level attribute: CompLabel call ESMF_AttributeGet(comp, name="CompLabel", & itemCount=guardCount, isPresent=isPresent, & @@ -453,7 +452,7 @@ subroutine InitReport(driver, importState, exportState, clock, rc) print *, " "//trim(name)//": : "// & "Attribute is NOT present!" endif - + ! report GridComp level attribute: InitializePhaseMap call ESMF_AttributeGet(comp, name="InitializePhaseMap", & itemCount=guardCount, isPresent=isPresent, & @@ -483,7 +482,7 @@ subroutine InitReport(driver, importState, exportState, clock, rc) print *, " "//trim(name)//": : "// & "Attribute is NOT present!" endif - + ! report GridComp level attribute: RunPhaseMap call ESMF_AttributeGet(comp, name="RunPhaseMap", & itemCount=guardCount, isPresent=isPresent, & @@ -513,7 +512,7 @@ subroutine InitReport(driver, importState, exportState, clock, rc) print *, " "//trim(name)//": : "// & "Attribute is NOT present!" endif - + ! report GridComp level attribute: FinalizePhaseMap call ESMF_AttributeGet(comp, name="FinalizePhaseMap", & itemCount=guardCount, isPresent=isPresent, & @@ -543,7 +542,7 @@ subroutine InitReport(driver, importState, exportState, clock, rc) print *, " "//trim(name)//": : "// & "Attribute is NOT present!" endif - + ! obtain import and export state call ESMF_GridCompGet(comp, importState=iState, & exportState=eState, rc=rc) @@ -571,7 +570,7 @@ subroutine InitReport(driver, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + endif endif ! Connectors @@ -583,7 +582,7 @@ subroutine InitReport(driver, importState, exportState, clock, rc) ! clean-up deallocate(compList) - + end subroutine !----------------------------------------------------------------------------- @@ -765,7 +764,7 @@ subroutine exploreState(state, stateIdentifier, compName, rc) trim(adjustl(valueString))//" // [NOTFOUND] name = "// & trim(itemNameList(item)) endif - enddo + enddo endif end subroutine @@ -774,7 +773,7 @@ subroutine exploreState(state, stateIdentifier, compName, rc) subroutine SetRunSequence(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables character(ESMF_MAXSTR) :: name type(NUOPC_FreeFormat) :: runSeqFF @@ -782,7 +781,7 @@ subroutine SetRunSequence(driver, rc) integer :: localPet rc = ESMF_SUCCESS - + compName = STRINGIFY_START(FRONT_COMP_LABEL) STRINGIFY_END(FRONT_COMP_LABEL) @@ -790,7 +789,7 @@ subroutine SetRunSequence(driver, rc) call ESMF_GridCompGet(driver, name=name, localPet=localPet, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - + ! set up free format run sequence runSeqFF = NUOPC_FreeFormatCreate(stringList=(/"@* "/), rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -813,13 +812,13 @@ subroutine SetRunSequence(driver, rc) call NUOPC_FreeFormatAdd(runSeqFF, stringList=(/"@ " /), rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - + if (localPet==0) then call NUOPC_FreeFormatPrint(runSeqFF, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out endif - + ! ingest FreeFormat run sequence call NUOPC_DriverIngestRunSequence(driver, runSeqFF, & autoAddConnectors=.true., rc=rc) @@ -830,7 +829,7 @@ subroutine SetRunSequence(driver, rc) call NUOPC_FreeFormatDestroy(runSeqFF, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - + end subroutine !----------------------------------------------------------------------------- @@ -840,24 +839,24 @@ subroutine RunTimestampImportState(driver, importState, exportState, clock, rc) type(ESMF_State) :: importState, exportState type(ESMF_Clock) :: clock integer, intent(out) :: rc - + type(ESMF_Clock) :: internalClock type(ESMF_Time) :: time type(ESMF_TimeInterval) :: timeStep rc = ESMF_SUCCESS - + ! update timestamp on all the import & export Fields call ESMF_GridCompGet(driver, clock=internalClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=__FILE__)) & return ! bail out - + call ESMF_ClockGet(internalClock, currTime=time, timeStep=timeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=__FILE__)) & return ! bail out - + ! must timestamp the fields in importState for the next timeStep time = time+timeStep call NUOPC_SetTimestamp(importState, time, rc=rc) diff --git a/ComponentExplorer/nuopcExplorerScript b/ComponentExplorer/nuopcExplorerScript index bb390198..dbef736a 100755 --- a/ComponentExplorer/nuopcExplorerScript +++ b/ComponentExplorer/nuopcExplorerScript @@ -2,10 +2,10 @@ #============================================================================== # Earth System Modeling Framework -# Copyright 2002-2020, University Corporation for Atmospheric Research, -# Massachusetts Institute of Technology, Geophysical Fluid Dynamics -# Laboratory, University of Michigan, National Centers for Environmental -# Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +# Copyright 2002-2020, University Corporation for Atmospheric Research, +# Massachusetts Institute of Technology, Geophysical Fluid Dynamics +# Laboratory, University of Michigan, National Centers for Environmental +# Prediction, Los Alamos National Laboratory, Argonne National Laboratory, # NASA Goddard Space Flight Center. # Licensed under the University of Illinois-NCSA License. #============================================================================== @@ -57,7 +57,7 @@ echo # - value of four standard makefile arguments echo "-- Obtaining values of the standard variables set in the .mk file ..." -gmake COMP=$1 output +gmake COMP=$1 output echo # - build explorer application diff --git a/CustomFieldDictionaryProto/driver.F90 b/CustomFieldDictionaryProto/driver.F90 index 57abb5ff..56c289ae 100644 --- a/CustomFieldDictionaryProto/driver.F90 +++ b/CustomFieldDictionaryProto/driver.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,22 +17,21 @@ module driver use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices - + driverSS => SetServices + use MODEL, only: modelSS => SetServices - + implicit none - + private - + ! private module data --> ONLY PARAMETERS integer, parameter :: stepCount = 5 real(ESMF_KIND_R8), parameter :: stepTime = 30.D0 ! step time [s] ! should be parent step public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -40,24 +39,31 @@ module driver subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & + + ! specialize driver + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out + ! set driver verbosity + call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + end subroutine !----------------------------------------------------------------------------- @@ -65,7 +71,7 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables type(ESMF_GridComp) :: child type(ESMF_CplComp) :: connector @@ -75,7 +81,7 @@ subroutine SetModelServices(driver, rc) type(ESMF_Clock) :: internalClock rc = ESMF_SUCCESS - + ! SetServices for MODEL component call NUOPC_DriverAddComp(driver, "MODEL", modelSS, comp=child, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -113,15 +119,17 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine + !----------------------------------------------------------------------------- + subroutine FieldDictionaryLog(label, iofmt, rc) character(len=*), intent(in) :: label @@ -162,4 +170,6 @@ subroutine FieldDictionaryLog(label, iofmt, rc) end subroutine FieldDictionaryLog + !----------------------------------------------------------------------------- + end module diff --git a/CustomFieldDictionaryProto/mainApp.F90 b/CustomFieldDictionaryProto/mainApp.F90 index 7bbf0cbd..b94ef4c9 100644 --- a/CustomFieldDictionaryProto/mainApp.F90 +++ b/CustomFieldDictionaryProto/mainApp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -24,7 +24,7 @@ program mainApp use util implicit none - + integer :: rc, userRc type(ESMF_GridComp) :: drvComp @@ -34,13 +34,13 @@ program mainApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("mainApp STARTING", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + !----------------------------------------------------------------------------- ! Operate on the NUOPC Field dictionary !----------------------------------------------------------------------------- @@ -58,7 +58,7 @@ program mainApp file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - ! Define the following macro if you would like to read in a + ! Define the following macro if you would like to read in a ! custom NUOPC Field dictionary from a YAML file. #define CUSTOMFIELDDICTIONARY #ifdef CUSTOMFIELDDICTIONARY @@ -85,14 +85,14 @@ program mainApp #endif !----------------------------------------------------------------------------- - + ! -> CREATE THE DRIVER drvComp = ESMF_GridCompCreate(name="driver", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! -> SET DRIVER SERVICES call ESMF_GridCompSetServices(drvComp, driver_SS, userRc=userRc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -114,7 +114,7 @@ program mainApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! RUN THE DRIVER call ESMF_GridCompRun(drvComp, userRc=userRc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -125,7 +125,7 @@ program mainApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! FINALIZE THE DRIVER call ESMF_GridCompFinalize(drvComp, userRc=userRc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -138,7 +138,7 @@ program mainApp call ESMF_Finalize(endflag=ESMF_END_ABORT) !----------------------------------------------------------------------------- - + call ESMF_LogWrite("mainApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -147,5 +147,5 @@ program mainApp ! Finalize ESMF call ESMF_Finalize() - -end program + +end program diff --git a/CustomFieldDictionaryProto/model.F90 b/CustomFieldDictionaryProto/model.F90 index 0fdedc67..1c520431 100644 --- a/CustomFieldDictionaryProto/model.F90 +++ b/CustomFieldDictionaryProto/model.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -16,67 +16,73 @@ module MODEL use ESMF use NUOPC - use NUOPC_Model, only: & - model_routine_SS => SetServices, & - model_label_Advance => label_Advance - + use NUOPC_Model, & + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! Enabeling the following macro, i.e. renaming it to WITHIMPORTFIELDS, ! will result in a model component that advertise import Field dependencies. ! In the single model case, where there isn't another model to satisfy these @@ -91,7 +97,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out #endif - + ! exportable field: air_pressure_at_sea_level call NUOPC_Advertise(exportState, & StandardName="air_pressure_at_sea_level", name="psl", rc=rc) @@ -99,7 +105,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -119,22 +125,29 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/10, 100/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -203,21 +216,21 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call ESMF_GridCompGet(model, clock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -226,12 +239,12 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set by default, ! its timeStep is equal to the parent timeStep. As a consequence the ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. - + ! for this call of the Advance() routine. + call ESMF_ClockPrint(clock, options="currTime", & preString="---->Advancing Model from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -243,7 +256,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -258,4 +271,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/CustomFieldDictionaryProto/util.F90 b/CustomFieldDictionaryProto/util.F90 index af95890d..13058f02 100644 --- a/CustomFieldDictionaryProto/util.F90 +++ b/CustomFieldDictionaryProto/util.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -16,13 +16,13 @@ module util use ESMF use NUOPC - + implicit none - + private - + public FieldDictionaryLog - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- diff --git a/DriverInDriverProtoIPDv02/Makefile b/DriverInDriverDataDepProto/Makefile similarity index 100% rename from DriverInDriverProtoIPDv02/Makefile rename to DriverInDriverDataDepProto/Makefile diff --git a/DriverInDriverProtoIPDv02/README b/DriverInDriverDataDepProto/README similarity index 87% rename from DriverInDriverProtoIPDv02/README rename to DriverInDriverDataDepProto/README index 24d6fbc3..9ec13af8 100644 --- a/DriverInDriverProtoIPDv02/README +++ b/DriverInDriverDataDepProto/README @@ -1,5 +1,5 @@ -README for Driver-in-Driver IPDv02 NUOPC prototype --------------------------------------------------- +README for Driver-in-Driver with Data Dependency NUOPC prototype +---------------------------------------------------------------- Show how a driver component can be driven as a child component of another driver component. @@ -21,9 +21,9 @@ Description: default run sequence to only drive the ATM component. Both ATM and OCN components use a simple two-phase initialization, - consisting of advertise and realize. However, use IPDv02, allowing to resolve - data dependencies during initialization. - + consisting of advertise and realize. However, there is also a data dependency + that is resolved during initialization. + Build: - Set environment variable ESMFMKFILE to point to the esmf.mk of your ESMF diff --git a/DriverInDriverProtoIPDv02/atm.F90 b/DriverInDriverDataDepProto/atm.F90 similarity index 82% rename from DriverInDriverProtoIPDv02/atm.F90 rename to DriverInDriverDataDepProto/atm.F90 index ae3484b5..bccaf466 100644 --- a/DriverInDriverProtoIPDv02/atm.F90 +++ b/DriverInDriverDataDepProto/atm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,103 +17,78 @@ module ATM use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_DataInitialize => label_DataInitialize, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! Provide InitializeP0 to switch to custom IPD version - call ESMF_GridCompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - userRoutine=InitializeP0, phase=0, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv01p1","IPDv02p1"/), userRoutine=InitializeAdvertise, rc=rc) + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv01p3","IPDv02p3"/), userRoutine=InitializeRealize, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_DataInitialize, & + specRoutine=DataInitialize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_DataInitialize, & - specRoutine=DataInitialize, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP0(gcomp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: gcomp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - + subroutine Advertise(model, rc) + type(ESMF_GridComp) :: model + integer, intent(out) :: rc + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - ! Switch to IPDv02 by filtering all other phaseMap entries - ! -> currently IPDv02 will cause issues because SST never makes it down - ! -> the component hierarchy. - call NUOPC_CompFilterPhaseMap(gcomp, ESMF_METHOD_INITIALIZE, & - acceptStringList=(/"IPDv02p"/), rc=rc) + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - subroutine InitializeAdvertise(model, importState, exportState, clock, rc) - type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - ! Disabling the following macro, e.g. renaming to WITHIMPORTFIELDS_disable, ! will result in a model component that does not advertise any importable ! Fields. Use this if you want to drive the model independently. @@ -127,7 +102,7 @@ subroutine InitializeAdvertise(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out #endif - + #define WITHEXPORTFIELDS #ifdef WITHEXPORTFIELDS ! exportable field: air_pressure_at_sea_level @@ -137,7 +112,7 @@ subroutine InitializeAdvertise(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -148,22 +123,29 @@ subroutine InitializeAdvertise(model, importState, exportState, clock, rc) #endif end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeRealize(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/100, 100/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -220,13 +202,13 @@ subroutine InitializeRealize(model, importState, exportState, clock, rc) #endif end subroutine - + !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -234,8 +216,8 @@ subroutine ModelAdvance(model, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -244,12 +226,12 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set by default, ! its timeStep is equal to the parent timeStep. As a consequence the ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. - + ! for this call of the Advance() routine. + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing ATM from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -261,7 +243,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -298,7 +280,7 @@ subroutine ModelAdvance(model, rc) subroutine DataInitialize(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -309,7 +291,7 @@ subroutine DataInitialize(model, rc) rc = ESMF_SUCCESS - ! query the Component for its clock, importState and exportState + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -334,7 +316,7 @@ subroutine DataInitialize(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_TimePrint(time, & preString="ATM DataInitialize time: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -356,7 +338,7 @@ subroutine DataInitialize(model, rc) file=__FILE__)) & return ! bail out endif - + ! write out the Fields in the importState call NUOPC_Write(importState, fileNamePrefix="field_atm_import_datainit_", & status=ESMF_FILESTATUS_REPLACE, relaxedFlag=.true., rc=rc) @@ -364,14 +346,14 @@ subroutine DataInitialize(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! must explicitly set time stamp on all export fields call NUOPC_SetTimestamp(exportState, clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- diff --git a/DriverInDriverProtoIPDv02/driverChildComp.F90 b/DriverInDriverDataDepProto/driverChildComp.F90 similarity index 86% rename from DriverInDriverProtoIPDv02/driverChildComp.F90 rename to DriverInDriverDataDepProto/driverChildComp.F90 index dfc30f2f..8cf6a4fa 100644 --- a/DriverInDriverProtoIPDv02/driverChildComp.F90 +++ b/DriverInDriverDataDepProto/driverChildComp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,19 +17,18 @@ module driverChildComp use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices - + driverSS => SetServices + use ATM, only: atmSS => SetServices use NUOPC_Connector, only: cplSS => SetServices implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -37,24 +36,25 @@ module driverChildComp subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & + + ! specialize driver + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out + ! set driver verbosity call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -68,13 +68,13 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables type(ESMF_GridComp) :: child type(ESMF_CplComp) :: connector rc = ESMF_SUCCESS - + ! SetServices for ATM call NUOPC_DriverAddComp(driver, "ATM", atmSS, comp=child, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -86,9 +86,9 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- end module diff --git a/DriverInDriverProtoIPDv02/driverParentComp.F90 b/DriverInDriverDataDepProto/driverParentComp.F90 similarity index 93% rename from DriverInDriverProtoIPDv02/driverParentComp.F90 rename to DriverInDriverDataDepProto/driverParentComp.F90 index c3cdc8d8..aa276eda 100644 --- a/DriverInDriverProtoIPDv02/driverParentComp.F90 +++ b/DriverInDriverDataDepProto/driverParentComp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,25 +17,24 @@ module driverParentComp use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices - + driverSS => SetServices + use driverChildComp, only: driver_SS => SetServices use OCN, only: ocnSS => SetServices - + use NUOPC_Connector, only: cplSS => SetServices implicit none - + private - + ! private module data --> ONLY PARAMETERS integer, parameter :: stepCount = 5 real(ESMF_KIND_R8), parameter :: stepTime = 30.D0 ! step time [s] ! should be parent step public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -43,24 +42,25 @@ module driverParentComp subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & + + ! specialize driver + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out + ! set driver verbosity call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -74,7 +74,7 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables type(ESMF_GridComp) :: child type(ESMF_CplComp) :: connector @@ -86,7 +86,7 @@ subroutine SetModelServices(driver, rc) integer, allocatable :: petList(:) rc = ESMF_SUCCESS - + ! get the petCount call ESMF_GridCompGet(driver, petCount=petCount, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -111,7 +111,7 @@ subroutine SetModelServices(driver, rc) file=__FILE__)) & return ! bail out deallocate(petList) - + ! SetServices for the OCN call NUOPC_DriverAddComp(driver, "OCN", ocnSS, comp=child, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -123,8 +123,6 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - - #if 1 ! turning this connector off will trigger an error in the driverChild ! InternalInitializeRealize() routine, detecting that there is no producer @@ -182,13 +180,15 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/DriverInDriverProtoIPDv02/mainApp.F90 b/DriverInDriverDataDepProto/mainApp.F90 similarity index 88% rename from DriverInDriverProtoIPDv02/mainApp.F90 rename to DriverInDriverDataDepProto/mainApp.F90 index 57aadf07..8f142702 100644 --- a/DriverInDriverProtoIPDv02/mainApp.F90 +++ b/DriverInDriverDataDepProto/mainApp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -20,9 +20,9 @@ program mainApp driver_SS => SetServices implicit none - + integer :: rc, userRc - type(ESMF_GridComp) :: driver + type(ESMF_GridComp) :: drvComp ! Initialize ESMF call ESMF_Initialize(defaultCalkind=ESMF_CALKIND_GREGORIAN, rc=rc) @@ -30,24 +30,24 @@ program mainApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("mainApp STARTING", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + !----------------------------------------------------------------------------- - + ! -> CREATE THE DRIVER - driver = ESMF_GridCompCreate(name="driverParent", rc=rc) + drvComp = ESMF_GridCompCreate(name="driver", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! -> SET DRIVER SERVICES - call ESMF_GridCompSetServices(driver, driver_SS, userRc=userRc, rc=rc) + call ESMF_GridCompSetServices(drvComp, driver_SS, userRc=userRc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -58,7 +58,7 @@ program mainApp call ESMF_Finalize(endflag=ESMF_END_ABORT) ! INITIALIZE THE DRIVER - call ESMF_GridCompInitialize(driver, userRc=userRc, rc=rc) + call ESMF_GridCompInitialize(drvComp, userRc=userRc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -67,9 +67,9 @@ program mainApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! RUN THE DRIVER - call ESMF_GridCompRun(driver, userRc=userRc, rc=rc) + call ESMF_GridCompRun(drvComp, userRc=userRc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -78,9 +78,9 @@ program mainApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! FINALIZE THE DRIVER - call ESMF_GridCompFinalize(driver, userRc=userRc, rc=rc) + call ESMF_GridCompFinalize(drvComp, userRc=userRc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -91,7 +91,7 @@ program mainApp call ESMF_Finalize(endflag=ESMF_END_ABORT) !----------------------------------------------------------------------------- - + call ESMF_LogWrite("mainApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -100,5 +100,5 @@ program mainApp ! Finalize ESMF call ESMF_Finalize() - -end program + +end program diff --git a/DriverInDriverProtoIPDv02/ocn.F90 b/DriverInDriverDataDepProto/ocn.F90 similarity index 82% rename from DriverInDriverProtoIPDv02/ocn.F90 rename to DriverInDriverDataDepProto/ocn.F90 index 2243eded..ee79e646 100644 --- a/DriverInDriverProtoIPDv02/ocn.F90 +++ b/DriverInDriverDataDepProto/ocn.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,109 +17,83 @@ module OCN use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_DataInitialize => label_DataInitialize, & - model_label_SetClock => label_SetClock, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! Provide InitializeP0 to switch to custom IPD version - call ESMF_GridCompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - userRoutine=InitializeP0, phase=0, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv02p1"/), userRoutine=InitializeAdvertise, rc=rc) + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv02p3"/), userRoutine=InitializeRealize, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_SetClock, & + call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & specRoutine=SetClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_DataInitialize, & + specRoutine=DataInitialize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_DataInitialize, & - specRoutine=DataInitialize, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP0(gcomp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: gcomp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - + subroutine Advertise(model, rc) + type(ESMF_GridComp) :: model + integer, intent(out) :: rc + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - ! Switch to IPDv02 by filtering all other phaseMap entries - ! -> currently IPDv02 will cause issues because SST never makes it down - ! -> the component hierarchy. - call NUOPC_CompFilterPhaseMap(gcomp, ESMF_METHOD_INITIALIZE, & - acceptStringList=(/"IPDv02p"/), rc=rc) + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine InitializeAdvertise(model, importState, exportState, clock, rc) - type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - rc = ESMF_SUCCESS ! Disabling the following macro, e.g. renaming to WITHIMPORTFIELDS_disable, ! will result in a model component that does not advertise any importable @@ -133,7 +107,7 @@ subroutine InitializeAdvertise(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(importState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -152,23 +126,30 @@ subroutine InitializeAdvertise(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeRealize(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_TimeInterval) :: stabilityTimeStep type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/200, 100/), & minCornerCoord=(/1._ESMF_KIND_R8, 1._ESMF_KIND_R8/), & @@ -194,7 +175,7 @@ subroutine InitializeRealize(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux field = ESMF_FieldCreate(name="rsns", grid=gridIn, & typekind=ESMF_TYPEKIND_R8, rc=rc) @@ -221,28 +202,28 @@ subroutine InitializeRealize(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- subroutine SetClock(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_TimeInterval) :: stabilityTimeStep rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock call NUOPC_ModelGet(model, modelClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! initialize internal clock ! here: parent Clock and stability timeStep determine actual model timeStep !TODO: stabilityTimeStep should be read in from configuation @@ -257,15 +238,15 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -276,8 +257,8 @@ subroutine ModelAdvance(model, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -286,14 +267,14 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set in SetClock(), ! its timeStep is likely smaller than the parent timeStep. As a consequence - ! the time interval covered by a single parent timeStep will result in - ! multiple calls to the ModelAdvance() routine. Every time the currTime + ! the time interval covered by a single parent timeStep will result in + ! multiple calls to the Advance() routine. Every time the currTime ! will come in by one internal timeStep advanced. This goes until the ! stopTime of the internal Clock has been reached. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing OCN from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -305,13 +286,13 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_TimePrint(currTime + timeStep, & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -329,7 +310,7 @@ subroutine ModelAdvance(model, rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & - return ! bail out + return ! bail out call ESMF_FieldFill(field, dataFillScheme="sincos", member=1, step=step, & rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -345,17 +326,17 @@ subroutine ModelAdvance(model, rc) subroutine DataInitialize(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState type(ESMF_Time) :: time type(ESMF_Field) :: field logical :: neededCurrent - + rc = ESMF_SUCCESS - ! query the Component for its clock, importState and exportState + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -374,14 +355,14 @@ subroutine DataInitialize(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! set the update attribute on the field call NUOPC_SetAttribute(field, name="Updated", value="true", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! write out the Fields in the exportState call NUOPC_Write(exportState, fileNamePrefix="field_ocn_export_datainit_", & status=ESMF_FILESTATUS_REPLACE, relaxedFlag=.true., rc=rc) @@ -397,7 +378,7 @@ subroutine DataInitialize(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- diff --git a/DriverInDriverProto/atm.F90 b/DriverInDriverProto/atm.F90 index aa98c4bf..27d3dff8 100644 --- a/DriverInDriverProto/atm.F90 +++ b/DriverInDriverProto/atm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,66 +17,72 @@ module ATM use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! Disabling the following macro, e.g. renaming to WITHIMPORTFIELDS_disable, ! will result in a model component that does not advertise any importable ! Fields. Use this if you want to drive the model independently. @@ -90,7 +96,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out #endif - + #define WITHEXPORTFIELDS #ifdef WITHEXPORTFIELDS ! exportable field: air_pressure_at_sea_level @@ -100,7 +106,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -111,22 +117,29 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) #endif end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/10, 100/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -183,21 +196,21 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) #endif end subroutine - + !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -206,12 +219,12 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set by default, ! its timeStep is equal to the parent timeStep. As a consequence the ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. - + ! for this call of the Advance() routine. + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing ATM from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -223,7 +236,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & diff --git a/DriverInDriverProto/driverChildComp.F90 b/DriverInDriverProto/driverChildComp.F90 index 20f4869b..8cf6a4fa 100644 --- a/DriverInDriverProto/driverChildComp.F90 +++ b/DriverInDriverProto/driverChildComp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,19 +17,18 @@ module driverChildComp use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices - + driverSS => SetServices + use ATM, only: atmSS => SetServices use NUOPC_Connector, only: cplSS => SetServices implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -37,24 +36,31 @@ module driverChildComp subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & + + ! specialize driver + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out + ! set driver verbosity + call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + end subroutine !----------------------------------------------------------------------------- @@ -62,13 +68,13 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables type(ESMF_GridComp) :: child type(ESMF_CplComp) :: connector rc = ESMF_SUCCESS - + ! SetServices for ATM call NUOPC_DriverAddComp(driver, "ATM", atmSS, comp=child, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -80,9 +86,9 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- - + end module diff --git a/DriverInDriverProto/driverParentComp.F90 b/DriverInDriverProto/driverParentComp.F90 index 5f1362a5..aa276eda 100644 --- a/DriverInDriverProto/driverParentComp.F90 +++ b/DriverInDriverProto/driverParentComp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,25 +17,24 @@ module driverParentComp use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices - + driverSS => SetServices + use driverChildComp, only: driver_SS => SetServices use OCN, only: ocnSS => SetServices - + use NUOPC_Connector, only: cplSS => SetServices implicit none - + private - + ! private module data --> ONLY PARAMETERS integer, parameter :: stepCount = 5 real(ESMF_KIND_R8), parameter :: stepTime = 30.D0 ! step time [s] ! should be parent step public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -43,18 +42,18 @@ module driverParentComp subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & + + ! specialize driver + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -75,7 +74,7 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables type(ESMF_GridComp) :: child type(ESMF_CplComp) :: connector @@ -87,7 +86,7 @@ subroutine SetModelServices(driver, rc) integer, allocatable :: petList(:) rc = ESMF_SUCCESS - + ! get the petCount call ESMF_GridCompGet(driver, petCount=petCount, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -112,7 +111,7 @@ subroutine SetModelServices(driver, rc) file=__FILE__)) & return ! bail out deallocate(petList) - + ! SetServices for the OCN call NUOPC_DriverAddComp(driver, "OCN", ocnSS, comp=child, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -181,13 +180,15 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/DriverInDriverProto/mainApp.F90 b/DriverInDriverProto/mainApp.F90 index 57aadf07..8f142702 100644 --- a/DriverInDriverProto/mainApp.F90 +++ b/DriverInDriverProto/mainApp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -20,9 +20,9 @@ program mainApp driver_SS => SetServices implicit none - + integer :: rc, userRc - type(ESMF_GridComp) :: driver + type(ESMF_GridComp) :: drvComp ! Initialize ESMF call ESMF_Initialize(defaultCalkind=ESMF_CALKIND_GREGORIAN, rc=rc) @@ -30,24 +30,24 @@ program mainApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("mainApp STARTING", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + !----------------------------------------------------------------------------- - + ! -> CREATE THE DRIVER - driver = ESMF_GridCompCreate(name="driverParent", rc=rc) + drvComp = ESMF_GridCompCreate(name="driver", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! -> SET DRIVER SERVICES - call ESMF_GridCompSetServices(driver, driver_SS, userRc=userRc, rc=rc) + call ESMF_GridCompSetServices(drvComp, driver_SS, userRc=userRc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -58,7 +58,7 @@ program mainApp call ESMF_Finalize(endflag=ESMF_END_ABORT) ! INITIALIZE THE DRIVER - call ESMF_GridCompInitialize(driver, userRc=userRc, rc=rc) + call ESMF_GridCompInitialize(drvComp, userRc=userRc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -67,9 +67,9 @@ program mainApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! RUN THE DRIVER - call ESMF_GridCompRun(driver, userRc=userRc, rc=rc) + call ESMF_GridCompRun(drvComp, userRc=userRc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -78,9 +78,9 @@ program mainApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! FINALIZE THE DRIVER - call ESMF_GridCompFinalize(driver, userRc=userRc, rc=rc) + call ESMF_GridCompFinalize(drvComp, userRc=userRc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -91,7 +91,7 @@ program mainApp call ESMF_Finalize(endflag=ESMF_END_ABORT) !----------------------------------------------------------------------------- - + call ESMF_LogWrite("mainApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -100,5 +100,5 @@ program mainApp ! Finalize ESMF call ESMF_Finalize() - -end program + +end program diff --git a/DriverInDriverProto/ocn.F90 b/DriverInDriverProto/ocn.F90 index 88aa9e00..3c0af461 100644 --- a/DriverInDriverProto/ocn.F90 +++ b/DriverInDriverProto/ocn.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,73 +17,78 @@ module OCN use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_SetClock => label_SetClock, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_SetClock, & + call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & specRoutine=SetClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! Disabling the following macro, e.g. renaming to WITHIMPORTFIELDS_disable, ! will result in a model component that does not advertise any importable ! Fields. Use this if you want to drive the model independently. @@ -96,7 +101,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(importState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -115,23 +120,29 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables - type(ESMF_TimeInterval) :: stabilityTimeStep + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/100, 10/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -157,7 +168,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux field = ESMF_FieldCreate(name="rsns", grid=gridIn, & typekind=ESMF_TYPEKIND_R8, rc=rc) @@ -186,26 +197,26 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- subroutine SetClock(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_TimeInterval) :: stabilityTimeStep rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock call NUOPC_ModelGet(model, modelClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! initialize internal clock ! here: parent Clock and stability timeStep determine actual model timeStep !TODO: stabilityTimeStep should be read in from configuation @@ -220,15 +231,15 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -237,8 +248,8 @@ subroutine ModelAdvance(model, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -247,14 +258,14 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set in SetClock(), ! its timeStep is likely smaller than the parent timeStep. As a consequence - ! the time interval covered by a single parent timeStep will result in - ! multiple calls to the ModelAdvance() routine. Every time the currTime + ! the time interval covered by a single parent timeStep will result in + ! multiple calls to the Advance() routine. Every time the currTime ! will come in by one internal timeStep advanced. This goes until the ! stopTime of the internal Clock has been reached. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing OCN from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -266,13 +277,13 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_TimePrint(currTime + timeStep, & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -287,4 +298,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/DynPhyProto/atm.F90 b/DynPhyProto/atm.F90 index 794fe0e7..870dbbb7 100644 --- a/DynPhyProto/atm.F90 +++ b/DynPhyProto/atm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,20 +17,19 @@ module ATM use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices - + driverSS => SetServices + use DYN, only: dynSS => SetServices use PHY, only: phySS => SetServices use NUOPC_Connector, only: cplSS => SetServices implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -38,24 +37,31 @@ module ATM subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & + + ! specialize driver + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out + ! set driver verbosity + call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + end subroutine !----------------------------------------------------------------------------- @@ -63,7 +69,7 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables type(ESMF_GridComp) :: child type(ESMF_CplComp) :: conn @@ -71,7 +77,7 @@ subroutine SetModelServices(driver, rc) character(len=10) :: attrStr rc = ESMF_SUCCESS - + ! Turn on profiling for driver component call NUOPC_CompAttributeSet(driver, name="Profiling", value="0", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -101,7 +107,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for PHY call NUOPC_DriverAddComp(driver, "PHY", phySS, comp=child, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -124,7 +130,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for PHY2DYN call NUOPC_DriverAddComp(driver, srcCompLabel="PHY", dstCompLabel="DYN", & compSetServicesRoutine=cplSS, comp=conn, rc=rc) diff --git a/DynPhyProto/dyn.F90 b/DynPhyProto/dyn.F90 index e2741f34..d7909091 100644 --- a/DynPhyProto/dyn.F90 +++ b/DynPhyProto/dyn.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,133 +17,77 @@ module DYN use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_DataInitialize => label_DataInitialize, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! Provide InitializeP0 to switch to custom IPD version - call ESMF_GridCompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - userRoutine=InitializeP0, phase=0, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv03p1"/), userRoutine=InitAdvertise, rc=rc) + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv03p3"/), userRoutine=InitRealize, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_DataInitialize, & + specRoutine=DataInitialize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_DataInitialize, & - specRoutine=DataInitialize, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine InitializeP0(gcomp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: gcomp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - ! local variables - character(*), parameter :: rName="InitializeP0" - character(ESMF_MAXSTR) :: name - integer :: verbosity - - rc = ESMF_SUCCESS - - ! query the component for info - call NUOPC_CompGet(gcomp, name=name, verbosity=verbosity, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - - ! intro - call NUOPC_LogIntro(name, rName, verbosity, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - - ! Switch to IPDv03 - call NUOPC_CompFilterPhaseMap(gcomp, ESMF_METHOD_INITIALIZE, & - acceptStringList=(/"IPDv03p"/), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - - ! extro - call NUOPC_LogExtro(name, rName, verbosity, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out end subroutine !----------------------------------------------------------------------------- - subroutine InitAdvertise(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + ! local variables - character(*), parameter :: rName="InitAdvertise" - character(ESMF_MAXSTR) :: name - integer :: verbosity + type(ESMF_State) :: importState, exportState rc = ESMF_SUCCESS - - ! query the component for info - call NUOPC_CompGet(model, name=name, verbosity=verbosity, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - - ! intro - call NUOPC_LogIntro(name, rName, verbosity, rc=rc) + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out + line=__LINE__, & + file=__FILE__)) & + return ! bail out ! Disabling the following macro, e.g. renaming to WITHIMPORTFIELDS_disable, ! will result in a model component that does not advertise any importable @@ -165,7 +109,7 @@ subroutine InitAdvertise(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out #endif - + #define WITHEXPORTFIELDS #ifdef WITHEXPORTFIELDS ! exportable field: air_pressure_at_sea_level @@ -175,7 +119,7 @@ subroutine InitAdvertise(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -185,25 +129,16 @@ subroutine InitAdvertise(model, importState, exportState, clock, rc) return ! bail out #endif - ! extro - call NUOPC_LogExtro(name, rName, verbosity, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - end subroutine - + !----------------------------------------------------------------------------- - subroutine InitRealize(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + ! local variables - character(*), parameter :: rName="InitRealize" - character(ESMF_MAXSTR) :: name - integer :: verbosity + type(ESMF_State) :: importState, exportState type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut type(ESMF_Field) :: field @@ -211,18 +146,16 @@ subroutine InitRealize(model, importState, exportState, clock, rc) type(ESMF_INDEX_FLAG) :: indexflag type(ESMF_Array) :: array character(len=160) :: msgString - + rc = ESMF_SUCCESS - - ! query the component for info - call NUOPC_CompGet(model, name=name, verbosity=verbosity, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - - ! intro - call NUOPC_LogIntro(name, rName, verbosity, rc=rc) + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out + line=__LINE__, & + file=__FILE__)) & + return ! bail out ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/100, 100/), & @@ -315,7 +248,7 @@ subroutine InitRealize(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out #endif - + #endif #ifdef WITHEXPORTFIELDS @@ -337,19 +270,14 @@ subroutine InitRealize(model, importState, exportState, clock, rc) return ! bail out #endif - ! extro - call NUOPC_LogExtro(name, rName, verbosity, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - end subroutine - + !----------------------------------------------------------------------------- subroutine DataInitialize(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -361,14 +289,14 @@ subroutine DataInitialize(model, rc) rc = ESMF_SUCCESS - ! query the Component for its clock, importState and exportState + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! get the current time out of the clock call ESMF_ClockGet(clock, currTime=time, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -394,7 +322,7 @@ subroutine DataInitialize(model, rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & - return ! bail out + return ! bail out #if 0 ! get a handle on the imported SST field call ESMF_StateGet(importState, itemName="sst", & @@ -402,7 +330,7 @@ subroutine DataInitialize(model, rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & - return ! bail out + return ! bail out if (itemType==ESMF_STATEITEM_FIELD) then call ESMF_StateGet(importState, field=field, itemName="sst", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -437,14 +365,14 @@ subroutine DataInitialize(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! data initialize the exported fields call ESMF_StateGet(exportState, itemName="pmsl", & itemType=itemType, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & - return ! bail out + return ! bail out if (itemType==ESMF_STATEITEM_FIELD) then call ESMF_StateGet(exportState, field=field, itemName="pmsl", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -462,13 +390,13 @@ subroutine DataInitialize(model, rc) file=__FILE__)) & return ! bail out endif - + call ESMF_StateGet(exportState, itemName="rsns", & itemType=itemType, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & - return ! bail out + return ! bail out if (itemType==ESMF_STATEITEM_FIELD) then call ESMF_StateGet(exportState, field=field, itemName="rsns", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -494,7 +422,7 @@ subroutine DataInitialize(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! must explicitly set time stamp on all export fields call NUOPC_SetTimestamp(exportState, clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -506,10 +434,10 @@ subroutine DataInitialize(model, rc) !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -518,8 +446,8 @@ subroutine ModelAdvance(model, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -528,12 +456,12 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set by default, ! its timeStep is equal to the parent timeStep. As a consequence the ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. - + ! for this call of the Advance() routine. + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing DYN from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -545,7 +473,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -578,4 +506,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/DynPhyProto/esmApp.F90 b/DynPhyProto/esmApp.F90 index dd7dd8ce..9eda6f13 100644 --- a/DynPhyProto/esmApp.F90 +++ b/DynPhyProto/esmApp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -36,7 +36,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogSet(flush=.true., rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -44,7 +44,7 @@ program esmApp call ESMF_Finalize(endflag=ESMF_END_ABORT) !----------------------------------------------------------------------------- - + ! need to add "PHYEX" to the NUOPC Field Dictionary call NUOPC_FieldDictionaryAddEntry("PHYEX", canonicalUnits="1", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -66,7 +66,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! SetServices for the ATM Component call ESMF_GridCompSetServices(atmComp, atmSS, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -77,7 +77,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! set driver verbosity verbosity = 0 ! reset verbosity = ibset(verbosity,0) ! log basic intro/extro and indentation @@ -120,7 +120,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Initialize for the ATM Component call ESMF_GridCompInitialize(atmComp, clock=clock, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -131,7 +131,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Run for earth the system Component call ESMF_GridCompRun(atmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -142,7 +142,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Finalize for the ATM Component call ESMF_GridCompFinalize(atmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -153,14 +153,14 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Destroy the ATM Component call ESMF_GridCompDestroy(atmComp, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -169,5 +169,5 @@ program esmApp ! Finalize ESMF call ESMF_Finalize() - -end program + +end program diff --git a/DynPhyProto/phy.F90 b/DynPhyProto/phy.F90 index 50252efb..0f9c60df 100644 --- a/DynPhyProto/phy.F90 +++ b/DynPhyProto/phy.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,133 +17,77 @@ module PHY use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_DataInitialize => label_DataInitialize, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! Provide InitializeP0 to switch to custom IPD version - call ESMF_GridCompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - userRoutine=InitializeP0, phase=0, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv03p1"/), userRoutine=InitAdvertise, rc=rc) + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv03p3"/), userRoutine=InitRealize, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_DataInitialize, & + specRoutine=DataInitialize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_DataInitialize, & - specRoutine=DataInitialize, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out end subroutine - - !----------------------------------------------------------------------------- - - subroutine InitializeP0(gcomp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: gcomp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - ! local variables - character(*), parameter :: rName="InitializeP0" - character(ESMF_MAXSTR) :: name - integer :: verbosity - - rc = ESMF_SUCCESS - - ! query the component for info - call NUOPC_CompGet(gcomp, name=name, verbosity=verbosity, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - - ! intro - call NUOPC_LogIntro(name, rName, verbosity, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - - ! Switch to IPDv03 - call NUOPC_CompFilterPhaseMap(gcomp, ESMF_METHOD_INITIALIZE, & - acceptStringList=(/"IPDv03p"/), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - - ! extro - call NUOPC_LogExtro(name, rName, verbosity, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - - end subroutine !----------------------------------------------------------------------------- - subroutine InitAdvertise(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + ! local variables - character(*), parameter :: rName="InitAdvertise" - character(ESMF_MAXSTR) :: name - integer :: verbosity + type(ESMF_State) :: importState, exportState rc = ESMF_SUCCESS - - ! query the component for info - call NUOPC_CompGet(model, name=name, verbosity=verbosity, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - - ! intro - call NUOPC_LogIntro(name, rName, verbosity, rc=rc) + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out + line=__LINE__, & + file=__FILE__)) & + return ! bail out ! Disabling the following macro, e.g. renaming to WITHIMPORTFIELDS_disable, ! will result in a model component that does not advertise any importable @@ -158,7 +102,7 @@ subroutine InitAdvertise(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out #endif - + #define WITHEXPORTFIELDS #ifdef WITHEXPORTFIELDS ! exportable field: precipitation_flux @@ -177,41 +121,30 @@ subroutine InitAdvertise(model, importState, exportState, clock, rc) return ! bail out #endif - ! extro - call NUOPC_LogExtro(name, rName, verbosity, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - end subroutine - + !----------------------------------------------------------------------------- - subroutine InitRealize(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + ! local variables - character(*), parameter :: rName="InitRealize" - character(ESMF_MAXSTR) :: name - integer :: verbosity + type(ESMF_State) :: importState, exportState type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut type(ESMF_Field) :: field type(ESMF_StateItem_Flag) :: itemType - + rc = ESMF_SUCCESS - - ! query the component for info - call NUOPC_CompGet(model, name=name, verbosity=verbosity, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - - ! intro - call NUOPC_LogIntro(name, rName, verbosity, rc=rc) + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out + line=__LINE__, & + file=__FILE__)) & + return ! bail out ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/1000, 100/), & @@ -255,13 +188,8 @@ subroutine InitRealize(model, importState, exportState, clock, rc) return ! bail out #endif - ! extro - call NUOPC_LogExtro(name, rName, verbosity, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - end subroutine - + !----------------------------------------------------------------------------- subroutine DataInitialize(model, rc) @@ -278,7 +206,7 @@ subroutine DataInitialize(model, rc) rc = ESMF_SUCCESS - ! query the Component for its clock, importState and exportState + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -312,14 +240,14 @@ subroutine DataInitialize(model, rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & - return ! bail out + return ! bail out if (itemType==ESMF_STATEITEM_FIELD) then call ESMF_StateGet(exportState, field=field, & itemName="precipitation_flux", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & - return ! bail out + return ! bail out call ESMF_FieldFill(field, dataFillScheme="sincos", member=4, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -331,19 +259,19 @@ subroutine DataInitialize(model, rc) file=__FILE__)) & return ! bail out endif - + call ESMF_StateGet(exportState, itemName="PHYEX", & itemType=itemType, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & - return ! bail out + return ! bail out if (itemType==ESMF_STATEITEM_FIELD) then call ESMF_StateGet(exportState, field=field, itemName="PHYEX", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & - return ! bail out + return ! bail out call ESMF_FieldFill(field, dataFillScheme="sincos", member=5, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -355,7 +283,7 @@ subroutine DataInitialize(model, rc) file=__FILE__)) & return ! bail out endif - + ! indicate that data initialization is complete (breaking out of init-loop) call NUOPC_CompAttributeSet(model, & name="InitializeDataComplete", value="true", rc=rc) @@ -376,10 +304,10 @@ subroutine DataInitialize(model, rc) !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -390,8 +318,8 @@ subroutine ModelAdvance(model, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -400,12 +328,12 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set by default, ! its timeStep is equal to the parent timeStep. As a consequence the ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. - + ! for this call of the Advance() routine. + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing PHY from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -417,7 +345,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -436,14 +364,14 @@ subroutine ModelAdvance(model, rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & - return ! bail out + return ! bail out if (itemType==ESMF_STATEITEM_FIELD) then call ESMF_StateGet(exportState, field=field, & itemName="precipitation_flux", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & - return ! bail out + return ! bail out call ESMF_FieldFill(field, dataFillScheme="sincos", member=4, step=step, & rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -456,13 +384,13 @@ subroutine ModelAdvance(model, rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & - return ! bail out + return ! bail out if (itemType==ESMF_STATEITEM_FIELD) then call ESMF_StateGet(exportState, field=field, itemName="PHYEX", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & - return ! bail out + return ! bail out call ESMF_FieldFill(field, dataFillScheme="sincos", member=5, step=step, & rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & diff --git a/ExternalDriverAPIProto/atm.F90 b/ExternalDriverAPIProto/atm.F90 index 2e9a937d..6725859d 100644 --- a/ExternalDriverAPIProto/atm.F90 +++ b/ExternalDriverAPIProto/atm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,114 +17,67 @@ module ATM use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! -> switching to IPD version that supports realize after connected - call ESMF_GridCompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - userRoutine=InitializeP0, phase=0, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv01p1"/), userRoutine=InitializeAdvertise, rc=rc) + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv01p3"/), userRoutine=InitializeRealize, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=label_CheckImport, & - specRoutine=NUOPC_Noop, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - subroutine InitializeP0(model, importState, exportState, clock, rc) - type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - - ! Switch to IPDv01 by filtering all other phaseMap entries - call NUOPC_CompFilterPhaseMap(model, ESMF_METHOD_INITIALIZE, & - acceptStringList=(/"IPDv01p"/), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeAdvertise(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + ! local variables - character(*), parameter :: rName="InitializeAdvertise" - character(ESMF_MAXSTR) :: name - integer :: verbosity + type(ESMF_State) :: importState, exportState rc = ESMF_SUCCESS - - ! query the component for info - call NUOPC_CompGet(model, name=name, verbosity=verbosity, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! intro - call NUOPC_LogIntro(name, rName, verbosity, rc=rc) + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -137,7 +90,7 @@ subroutine InitializeAdvertise(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: precipitation_flux call NUOPC_Advertise(importState, & StandardName="precipitation_flux", name="precip", rc=rc) @@ -145,7 +98,7 @@ subroutine InitializeAdvertise(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: air_pressure_at_sea_level call NUOPC_Advertise(exportState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -153,7 +106,7 @@ subroutine InitializeAdvertise(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & StandardName="surface_net_downward_longwave_flux", name="rsnl", rc=rc) @@ -178,49 +131,32 @@ subroutine InitializeAdvertise(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out - ! extro - call NUOPC_LogExtro(name, rName, verbosity, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeRealize(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + ! local variables - character(*), parameter :: rName="InitializeRealize" - character(ESMF_MAXSTR) :: name - integer :: verbosity + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut real(ESMF_KIND_R8), pointer :: dataPtr(:,:), lonPtr(:), latPtr(:) integer :: i,j - + rc = ESMF_SUCCESS - - ! query the component for info - call NUOPC_CompGet(model, name=name, verbosity=verbosity, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! intro - call NUOPC_LogIntro(name, rName, verbosity, rc=rc) + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! create a Grid object for Fields #if 0 gridIn = ESMF_GridCreate1PeriDimUfrm(maxIndex=(/100, 50/), & @@ -309,21 +245,14 @@ subroutine InitializeRealize(model, importState, exportState, clock, rc) ! fill export with some data call ESMF_FieldFill(field, dataFillScheme="sincos", member=4, rc=rc) - ! extro - call NUOPC_LogExtro(name, rName, verbosity, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - end subroutine - + !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -335,8 +264,8 @@ subroutine ModelAdvance(model, rc) integer, save :: slice=1 rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -345,12 +274,12 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set by default, ! its timeStep is equal to the parent timeStep. As a consequence the ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. - + ! for this call of the Advance() routine. + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing ATM from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -362,7 +291,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -399,7 +328,7 @@ subroutine ModelAdvance(model, rc) enddo enddo endif - + ! update the "rsns" field call ESMF_StateGet(exportState, itemName="rsns", itemType=itemType, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -424,7 +353,7 @@ subroutine ModelAdvance(model, rc) enddo enddo endif - + #if 0 ! cannot use NUOPC_Write() for fields on cubed sphere grid right now ! write out the Fields in the importState @@ -447,4 +376,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/ExternalDriverAPIProto/esm.F90 b/ExternalDriverAPIProto/esm.F90 index 358810c4..7e9d4823 100644 --- a/ExternalDriverAPIProto/esm.F90 +++ b/ExternalDriverAPIProto/esm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,20 +17,19 @@ module ESM use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices + driverSS => SetServices use ATM, only: atmSS => SetServices use OCN, only: ocnSS => SetServices - + use NUOPC_Connector, only: cplSS => SetServices - + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -38,25 +37,25 @@ module ESM subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & + + ! specialize driver + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! verbosity on driver + + ! set driver verbosity call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -70,7 +69,7 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables type(ESMF_Grid) :: grid type(ESMF_Field) :: field @@ -85,14 +84,14 @@ subroutine SetModelServices(driver, rc) integer, allocatable :: petList(:) rc = ESMF_SUCCESS - + ! get the petCount call ESMF_GridCompGet(driver, petCount=petCount, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for ATM with petList on first half of PETs allocate(petList(petCount/2)) do i=1, petCount/2 @@ -110,7 +109,7 @@ subroutine SetModelServices(driver, rc) file=__FILE__)) & return ! bail out deallocate(petList) - + ! SetServices for OCN with petList on second half of PETs allocate(petList(petCount/2)) do i=1, petCount/2 @@ -128,7 +127,7 @@ subroutine SetModelServices(driver, rc) file=__FILE__)) & return ! bail out deallocate(petList) - + ! SetServices for atm2ocn call NUOPC_DriverAddComp(driver, srcCompLabel="ATM", dstCompLabel="OCN", & compSetServicesRoutine=cplSS, comp=connector, rc=rc) @@ -141,7 +140,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for ocn2atm call NUOPC_DriverAddComp(driver, srcCompLabel="OCN", dstCompLabel="ATM", & compSetServicesRoutine=cplSS, comp=connector, rc=rc) @@ -161,7 +160,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + if (.not.clockIsPresent) then ! set the driver clock here call ESMF_TimeIntervalSet(timeStep, m=15, rc=rc) ! 15 minute steps @@ -190,7 +189,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & diff --git a/ExternalDriverAPIProto/externalApp.F90 b/ExternalDriverAPIProto/externalApp.F90 index 2957404d..819fc907 100644 --- a/ExternalDriverAPIProto/externalApp.F90 +++ b/ExternalDriverAPIProto/externalApp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -27,7 +27,7 @@ program externalApp type(ESMF_Clock) :: clock type(ESMF_State) :: esmImportState, esmExportState integer :: phase - + ! Initialize ESMF call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, & defaultCalkind=ESMF_CALKIND_GREGORIAN, rc=rc) @@ -35,7 +35,7 @@ program externalApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogSet(flush=.true., rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -47,7 +47,7 @@ program externalApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Create the application Clock call ESMF_TimeIntervalSet(timeStep, m=15, rc=rc) ! 15 minute steps if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -72,7 +72,7 @@ program externalApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Create the earth system import/export States esmImportState = ESMF_StateCreate(stateintent=ESMF_STATEINTENT_IMPORT, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -84,7 +84,7 @@ program externalApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! advertise field in the earth system export State call NUOPC_Advertise(esmExportState, & StandardNames=(/"air_pressure_at_sea_level ", & @@ -101,7 +101,7 @@ program externalApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! SetServices for the earth system Component call ESMF_GridCompSetServices(esmComp, esmSS, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -112,7 +112,7 @@ program externalApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call "ExternalAdvertise" Initialize for the earth system Component call NUOPC_CompSearchPhaseMap(esmComp, methodflag=ESMF_METHOD_INITIALIZE, & phaseLabel="ExternalAdvertise", phaseIndex=phase, rc=rc) @@ -130,7 +130,7 @@ program externalApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call "ExternalRealize" Initialize for the earth system Component call NUOPC_CompSearchPhaseMap(esmComp, methodflag=ESMF_METHOD_INITIALIZE, & phaseLabel="ExternalRealize", phaseIndex=phase, rc=rc) @@ -148,7 +148,7 @@ program externalApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call "ExternalDataInitialize" Initialize for the earth system Component call NUOPC_CompSearchPhaseMap(esmComp, methodflag=ESMF_METHOD_INITIALIZE, & phaseLabel="ExternalDataInitialize", phaseIndex=phase, rc=rc) @@ -166,8 +166,8 @@ program externalApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - - ! Call Run for earth the system Component + + ! Run the earth system Component call ESMF_GridCompRun(esmComp, clock=clock, & importState=esmImportState, exportState=esmExportState, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -178,8 +178,8 @@ program externalApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - - ! Call Finalize for the earth system Component + + ! Finalize the earth system Component call ESMF_GridCompFinalize(esmComp, clock=clock, & importState=esmImportState, exportState=esmExportState, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -190,14 +190,14 @@ program externalApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Destroy the earth system Component call ESMF_GridCompDestroy(esmComp, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("externalApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -206,5 +206,5 @@ program externalApp ! Finalize ESMF call ESMF_Finalize() - -end program + +end program diff --git a/ExternalDriverAPIProto/ocn.F90 b/ExternalDriverAPIProto/ocn.F90 index ac29963b..04dc9772 100644 --- a/ExternalDriverAPIProto/ocn.F90 +++ b/ExternalDriverAPIProto/ocn.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,87 +17,73 @@ module OCN use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_SetClock => label_SetClock, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeAdvertise, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeRealize, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_SetClock, & + call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & specRoutine=SetClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeAdvertise(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + ! local variables - character(*), parameter :: rName="InitializeAdvertise" - character(ESMF_MAXSTR) :: name - integer :: verbosity + type(ESMF_State) :: importState, exportState rc = ESMF_SUCCESS - ! query the component for info - call NUOPC_CompGet(model, name=name, verbosity=verbosity, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! intro - call NUOPC_LogIntro(name, rName, verbosity, rc=rc) + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -110,7 +96,7 @@ subroutine InitializeAdvertise(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(importState, & StandardName="surface_net_downward_longwave_flux", name="rsnl", rc=rc) @@ -143,27 +129,16 @@ subroutine InitializeAdvertise(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out - ! extro - call NUOPC_LogExtro(name, rName, verbosity, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeRealize(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + ! local variables - character(*), parameter :: rName="InitializeRealize" - character(ESMF_MAXSTR) :: name - integer :: verbosity + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut @@ -172,20 +147,14 @@ subroutine InitializeRealize(model, importState, exportState, clock, rc) rc = ESMF_SUCCESS - ! query the component for info - call NUOPC_CompGet(model, name=name, verbosity=verbosity, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! intro - call NUOPC_LogIntro(name, rName, verbosity, rc=rc) + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! create a Grid object for Fields gridIn = ESMF_GridCreate1PeriDimUfrm(maxIndex=(/100, 50/), & minCornerCoord=(/0._ESMF_KIND_R8, -60._ESMF_KIND_R8/), & @@ -209,7 +178,7 @@ subroutine InitializeRealize(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_longwave_flux field = ESMF_FieldCreate(name="rsnl", grid=gridIn, & typekind=ESMF_TYPEKIND_R8, rc=rc) @@ -261,7 +230,7 @@ subroutine InitializeRealize(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! fill export with some data call ESMF_GridGetCoord(gridOut, coordDim=1, farrayPtr=lonPtr, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -284,34 +253,27 @@ subroutine InitializeRealize(model, importState, exportState, clock, rc) enddo enddo - ! extro - call NUOPC_LogExtro(name, rName, verbosity, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - end subroutine - + !----------------------------------------------------------------------------- subroutine SetClock(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_TimeInterval) :: stabilityTimeStep rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock call NUOPC_ModelGet(model, modelClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! initialize internal clock ! here: parent Clock and stability timeStep determine actual model timeStep !TODO: stabilityTimeStep should be read in from configuation @@ -326,15 +288,15 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -348,8 +310,8 @@ subroutine ModelAdvance(model, rc) integer, save :: slice=1 rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -358,14 +320,14 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set in SetClock(), ! its timeStep is likely smaller than the parent timeStep. As a consequence - ! the time interval covered by a single parent timeStep will result in - ! multiple calls to the ModelAdvance() routine. Every time the currTime + ! the time interval covered by a single parent timeStep will result in + ! multiple calls to the Advance() routine. Every time the currTime ! will come in by one internal timeStep advanced. This goes until the ! stopTime of the internal Clock has been reached. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing OCN from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -377,13 +339,13 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_TimePrint(currTime + timeStep, & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -420,7 +382,7 @@ subroutine ModelAdvance(model, rc) enddo enddo endif - + ! write out the Fields in the importState call NUOPC_Write(importState, fileNamePrefix="field_ocn_import_", & timeslice=slice, overwrite=.true., relaxedFlag=.true., rc=rc) @@ -440,4 +402,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/GenericMediatorProto/app.F90 b/GenericMediatorProto/app.F90 index a1a087db..3ad01e78 100644 --- a/GenericMediatorProto/app.F90 +++ b/GenericMediatorProto/app.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -22,7 +22,7 @@ program esmApp integer :: rc, urc type(ESMF_GridComp) :: esmComp - + ! Initialize ESMF call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, & defaultCalkind=ESMF_CALKIND_GREGORIAN, rc=rc) @@ -30,7 +30,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp STARTING", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -54,7 +54,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! SetServices for the earth system Component call ESMF_GridCompSetServices(esmComp, driverSS, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -65,7 +65,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Initialize for the earth system Component call ESMF_GridCompInitialize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -76,7 +76,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Run for earth the system Component call ESMF_GridCompRun(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -87,7 +87,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Finalize for the earth system Component call ESMF_GridCompFinalize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -98,14 +98,14 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Destroy the earth system Component call ESMF_GridCompDestroy(esmComp, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -114,5 +114,5 @@ program esmApp ! Finalize ESMF call ESMF_Finalize() - -end program + +end program diff --git a/GenericMediatorProto/driver.F90 b/GenericMediatorProto/driver.F90 index 279ae908..bbc56e27 100644 --- a/GenericMediatorProto/driver.F90 +++ b/GenericMediatorProto/driver.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,23 +17,20 @@ module Driver use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices, & - driver_label_ModifyCplLists => label_ModifyCplLists, & - driver_label_SetRunSequence => label_SetRunSequence - + driverSS => SetServices + use Mediator, only: medSS => SetServices use ModelA, only: modASS => SetServices use ModelB, only: modBSS => SetServices - + use NUOPC_Connector, only: cplSS => SetServices - + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -41,36 +38,43 @@ module Driver subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & + + ! specialize driver + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetRunSequence, & + call NUOPC_CompSpecialize(driver, specLabel=label_SetRunSequence, & specRoutine=SetRunSequence, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(driver, specLabel=driver_label_ModifyCplLists, & + call NUOPC_CompSpecialize(driver, specLabel=label_ModifyCplLists, & specRoutine=ModifyCplLists, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + + ! set driver verbosity + call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + end subroutine !----------------------------------------------------------------------------- @@ -78,7 +82,7 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables type(ESMF_Time) :: startTime type(ESMF_Time) :: stopTime @@ -89,7 +93,7 @@ subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: child rc = ESMF_SUCCESS - + ! get the petCount call ESMF_GridCompGet(driver, petCount=petCount, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -114,7 +118,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for ModelA and ModelB with petList on second half of PETs allocate(petList(petCount/2)) do i=1, petCount/2 @@ -171,7 +175,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- @@ -179,18 +183,18 @@ subroutine SetModelServices(driver, rc) subroutine SetRunSequence(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables character(ESMF_MAXSTR) :: name type(NUOPC_FreeFormat) :: runSeqFF rc = ESMF_SUCCESS - + ! query the driver for its name call ESMF_GridCompGet(driver, name=name, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - + ! set up free format run sequence runSeqFF = NUOPC_FreeFormatCreate(stringList=(/ & " @* ", & @@ -219,29 +223,29 @@ subroutine SetRunSequence(driver, rc) subroutine ModifyCplLists(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables - character(len=160) :: msg + character(len=160) :: msg type(ESMF_CplComp), pointer :: connectorList(:) integer :: i, j, cplListSize character(len=160), allocatable :: cplList(:) character(len=160) :: tempString - + rc = ESMF_SUCCESS - + call ESMF_LogWrite("Driver is in ModifyCplLists()", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + nullify(connectorList) call NUOPC_DriverGetComp(driver, compList=connectorList, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + write (msg,*) "Found ", size(connectorList), " Connectors."// & " Modifying CplList Attribute...." call ESMF_LogWrite(trim(msg), ESMF_LOGMSG_INFO, rc=rc) @@ -281,9 +285,9 @@ subroutine ModifyCplLists(driver, rc) deallocate(cplList) endif enddo -#endif +#endif deallocate(connectorList) - + end subroutine !----------------------------------------------------------------------------- diff --git a/GenericMediatorProto/mediator.F90 b/GenericMediatorProto/mediator.F90 index c5df5023..cb1152b0 100644 --- a/GenericMediatorProto/mediator.F90 +++ b/GenericMediatorProto/mediator.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -16,126 +16,88 @@ module Mediator use ESMF use NUOPC - use NUOPC_Mediator, only: & - mediator_routine_SS => SetServices, & - mediator_label_DataInitialize => label_DataInitialize, & - mediator_label_Advance => label_Advance - + use NUOPC_Mediator, & + mediatorSS => SetServices + implicit none - + private - + type(ESMF_State), save :: frModelA, toModelA type(ESMF_State), save :: frModelB, toModelB - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(mediator, rc) type(ESMF_GridComp) :: mediator integer, intent(out) :: rc - - rc = ESMF_SUCCESS - - ! the NUOPC mediator component will register the generic methods - call NUOPC_CompDerive(mediator, mediator_routine_SS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! --- Initialization phases -------------------------------------- - ! Provide InitializeP0 to switch from default IPDv00 to IPDv03 - call ESMF_GridCompSetEntryPoint(mediator, ESMF_METHOD_INITIALIZE, & - userRoutine=InitializeP0, phase=0, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out + rc = ESMF_SUCCESS - ! IPDv03p1: advertise Fields - call NUOPC_CompSetEntryPoint(mediator, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv03p1"/), userRoutine=InitializeP1, rc=rc) + ! derive from NUOPC_Mediator + call NUOPC_CompDerive(mediator, mediatorSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - ! IPDv03p3: realize connected Fields with transfer action "provide" - call NUOPC_CompSetEntryPoint(mediator, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv03p3"/), userRoutine=InitializeP3, rc=rc) + ! specialize mediator + call NUOPC_CompSpecialize(mediator, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! IPDv03p4: optionally modify the decomp/distr of transferred Grid/Mesh - call NUOPC_CompSetEntryPoint(mediator, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv03p4"/), userRoutine=InitializeP4, rc=rc) + call NUOPC_CompSpecialize(mediator, specLabel=label_RealizeProvided, & + specRoutine=RealizeProvided, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! IPDv03p5: realize all Fields with transfer action "accept" - call NUOPC_CompSetEntryPoint(mediator, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv03p5"/), userRoutine=InitializeP5, rc=rc) + call NUOPC_CompSpecialize(mediator, specLabel=label_AcceptTransfer, & + specRoutine=AcceptTransfer, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(mediator, specLabel=mediator_label_Advance, & - specRoutine=MediatorAdvance, rc=rc) + call NUOPC_CompSpecialize(mediator, specLabel=label_RealizeAccepted, & + specRoutine=RealizeAccepted, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(mediator, specLabel=mediator_label_DataInitialize, & - specRoutine=DataInitialize, rc=rc) + call NUOPC_CompSpecialize(mediator, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP0(mediator, importState, exportState, clock, rc) - type(ESMF_GridComp) :: mediator - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - + subroutine Advertise(mediator, rc) + type(ESMF_GridComp) :: mediator + integer, intent(out) :: rc + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - ! Switch to IPDv03 by filtering all other phaseMap entries - call NUOPC_CompFilterPhaseMap(mediator, ESMF_METHOD_INITIALIZE, & - acceptStringList=(/"IPDv03p"/), rc=rc) + ! query for importState and exportState + call NUOPC_MediatorGet(mediator, importState=importState, & + exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - subroutine InitializeP1(mediator, importState, exportState, clock, rc) - ! IPDv03p1: advertise Fields - type(ESMF_GridComp) :: mediator - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - ! Fields from ModelA ! use namespace in the importState call NUOPC_AddNamespace(importState, namespace="ModelA", & @@ -153,7 +115,7 @@ subroutine InitializeP1(mediator, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! Fields to ModelA ! use namespace in the exportState call NUOPC_AddNamespace(exportState, namespace="ModelA", & @@ -173,7 +135,7 @@ subroutine InitializeP1(mediator, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! Fields from ModelB ! use namespace in the importState call NUOPC_AddNamespace(importState, namespace="ModelB", & @@ -193,7 +155,7 @@ subroutine InitializeP1(mediator, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! Fields to ModelB ! use namespace in the exportState call NUOPC_AddNamespace(exportState, namespace="ModelB", & @@ -211,21 +173,28 @@ subroutine InitializeP1(mediator, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP3(mediator, importState, exportState, clock, rc) - ! IPDv03p3: realize connected Fields with transfer action "provide" - ! and remove Fields that are not connected + subroutine RealizeProvided(mediator, rc) type(ESMF_GridComp) :: mediator - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_MediatorGet(mediator, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call checkConnectedFlagProvide(importState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -239,10 +208,10 @@ subroutine InitializeP3(mediator, importState, exportState, clock, rc) return ! bail out contains ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + subroutine checkConnectedFlagProvide(state, rc) ! Look at all of the fields in state, including in nested states. Error - ! out if a connected field is found for which geom object must be + ! out if a connected field is found for which geom object must be ! provided here. Remove all not connected fields. type(ESMF_State) :: state integer, optional :: rc @@ -254,18 +223,18 @@ subroutine checkConnectedFlagProvide(state, rc) character(len=20) :: transferAction character(len=80), allocatable :: itemNameList(:) type(ESMF_StateItem_Flag), allocatable :: itemTypeList(:) - + if (present(rc)) rc = ESMF_SUCCESS - + call ESMF_StateGet(state, name=stateName, nestedFlag=.true., & itemCount=itemCount, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + allocate(itemNameList(itemCount), itemTypeList(itemCount)) - + call ESMF_StateGet(state, nestedFlag=.true., & itemNameList=itemNameList, itemTypeList=itemTypeList, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -315,24 +284,32 @@ subroutine checkConnectedFlagProvide(state, rc) endif endif enddo - + deallocate(itemNameList, itemTypeList) - + end subroutine end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP4(mediator, importState, exportState, clock, rc) - ! IPDv03p4: optionally modify the decomp/distr of transferred Grid/Mesh + subroutine AcceptTransfer(mediator, rc) type(ESMF_GridComp) :: mediator - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_MediatorGet(mediator, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call adjustAcceptedGeom(importState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -346,7 +323,7 @@ subroutine InitializeP4(mediator, importState, exportState, clock, rc) return ! bail out contains ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + subroutine adjustAcceptedGeom(state, rc) ! Look at all of the fields in state, including in nested states. Adjust ! the distribution of the accepted geom object to a 1 DE/PET distribution. @@ -365,17 +342,17 @@ subroutine adjustAcceptedGeom(state, rc) type(ESMF_DistGrid) :: distgrid integer :: dimCount, tileCount integer, allocatable :: minIndexPTile(:,:), maxIndexPTile(:,:) - + if (present(rc)) rc = ESMF_SUCCESS - + call ESMF_StateGet(state, nestedFlag=.true., itemCount=itemCount, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + allocate(itemNameList(itemCount), itemTypeList(itemCount)) - + call ESMF_StateGet(state, nestedFlag=.true., & itemNameList=itemNameList, itemTypeList=itemTypeList, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -419,7 +396,7 @@ subroutine adjustAcceptedGeom(state, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - ! Create a custom DistGrid, based on the minIndex, maxIndex of the + ! Create a custom DistGrid, based on the minIndex, maxIndex of the ! accepted DistGrid, but with a default regDecomp for the current VM ! that leads to 1DE/PET. ! get dimCount and tileCount @@ -453,7 +430,7 @@ subroutine adjustAcceptedGeom(state, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call ESMF_FieldEmptySet(field, grid=grid, rc=rc) + call ESMF_FieldEmptySet(field, grid=grid, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -473,7 +450,7 @@ subroutine adjustAcceptedGeom(state, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - ! Create a custom DistGrid, based on the minIndex, maxIndex of the + ! Create a custom DistGrid, based on the minIndex, maxIndex of the ! accepted DistGrid, but with a default regDecomp for the current VM ! that leads to 1DE/PET. ! get dimCount and tileCount @@ -507,7 +484,7 @@ subroutine adjustAcceptedGeom(state, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call ESMF_FieldEmptySet(field, mesh=mesh, rc=rc) + call ESMF_FieldEmptySet(field, mesh=mesh, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -526,24 +503,32 @@ subroutine adjustAcceptedGeom(state, rc) endif endif enddo - + deallocate(itemNameList, itemTypeList) - + end subroutine - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP5(mediator, importState, exportState, clock, rc) - ! IPDv03p5: realize all Fields with transfer action "accept" + subroutine RealizeAccepted(mediator, rc) type(ESMF_GridComp) :: mediator - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_MediatorGet(mediator, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call realizeWithAcceptedGeom(importState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -555,9 +540,9 @@ subroutine InitializeP5(mediator, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + contains ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + subroutine realizeWithAcceptedGeom(state, rc) ! Look at all of the fields in state, including in nested states. Realize ! with the accepted and adjusted geom object. @@ -567,9 +552,9 @@ subroutine realizeWithAcceptedGeom(state, rc) integer :: itemCount, item character(len=80), allocatable :: itemNameList(:) type(ESMF_StateItem_Flag), allocatable :: itemTypeList(:) - + if (present(rc)) rc = ESMF_SUCCESS - + ! query info about the items in the state call ESMF_StateGet(state, nestedFlag=.true., itemCount=itemCount, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -595,36 +580,19 @@ subroutine realizeWithAcceptedGeom(state, rc) return ! bail out endif enddo - + deallocate(itemNameList, itemTypeList) - + end subroutine end subroutine - + !----------------------------------------------------------------------------- - subroutine DataInitialize(mediator, rc) + subroutine Advance(mediator, rc) type(ESMF_GridComp) :: mediator integer, intent(out) :: rc - - rc = ESMF_SUCCESS - - ! indicate that data initialization is complete (breaking out of init-loop) - call NUOPC_CompAttributeSet(mediator, & - name="InitializeDataComplete", value="true", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - !----------------------------------------------------------------------------- - subroutine MediatorAdvance(mediator, rc) - type(ESMF_GridComp) :: mediator - integer, intent(out) :: rc - ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -632,8 +600,8 @@ subroutine MediatorAdvance(mediator, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call ESMF_GridCompGet(mediator, clock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -642,7 +610,7 @@ subroutine MediatorAdvance(mediator, rc) return ! bail out ! HERE THE MEDIATOR ADVANCES: currTime -> currTime + timeStep - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing MED from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -654,7 +622,7 @@ subroutine MediatorAdvance(mediator, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -666,7 +634,7 @@ subroutine MediatorAdvance(mediator, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_StateGet(frModelA, itemCount=itemCount(1), rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -698,7 +666,9 @@ subroutine MediatorAdvance(mediator, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/GenericMediatorProto/modelA.F90 b/GenericMediatorProto/modelA.F90 index fad2c0cd..2c54c175 100644 --- a/GenericMediatorProto/modelA.F90 +++ b/GenericMediatorProto/modelA.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -16,68 +16,73 @@ module ModelA use ESMF use NUOPC - use NUOPC_Model, only: & - model_routine_SS => SetServices, & - model_label_Advance => label_Advance - + use NUOPC_Model, & + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - - subroutine SetServices(gcomp, rc) - type(ESMF_GridComp) :: gcomp + + subroutine SetServices(model, rc) + type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(gcomp, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(gcomp, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeAdvertise, rc=rc) + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(gcomp, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeRealize, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(gcomp, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: gcomp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock + subroutine Advertise(model, rc) + type(ESMF_GridComp) :: model integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: PINT call NUOPC_Advertise(importState, & StandardName="PINT", rc=rc) @@ -85,7 +90,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: air_pressure_at_sea_level call NUOPC_Advertise(importState, & StandardName="air_pressure_at_sea_level", rc=rc) @@ -93,7 +98,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(importState, & StandardName="surface_net_downward_shortwave_flux", rc=rc) @@ -111,23 +116,30 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: gcomp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock + subroutine Realize(model, rc) + type(ESMF_GridComp) :: model integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn, gridOut integer :: i, j real(kind=ESMF_KIND_R8), pointer :: lonPtr(:,:), latPtr(:,:) - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create Grid objects for Fields gridIn = ESMF_GridCreate1PeriDim(minIndex=(/1,1/), maxIndex=(/100,150/), & indexflag=ESMF_INDEX_GLOBAL, coordSys=ESMF_COORDSYS_SPH_DEG, rc=rc) @@ -156,7 +168,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) latPtr(i,j) = 100./real(150) * (j-1) - 50. enddo enddo - + gridOut = gridIn ! for now out same as in ! importable field: PINT @@ -172,7 +184,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: air_pressure_at_sea_level field = ESMF_FieldCreate(name="air_pressure_at_sea_level", & grid=gridIn, typekind=ESMF_TYPEKIND_R8, rc=rc) @@ -185,7 +197,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! importable field: surface_net_downward_shortwave_flux field = ESMF_FieldCreate(name="surface_net_downward_shortwave_flux", & grid=gridIn, typekind=ESMF_TYPEKIND_R8, rc=rc) @@ -213,13 +225,13 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine ModelAdvance(gcomp, rc) - type(ESMF_GridComp) :: gcomp + subroutine Advance(model, rc) + type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -228,9 +240,9 @@ subroutine ModelAdvance(gcomp, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState - call ESMF_GridCompGet(gcomp, clock=clock, importState=importState, & + + ! query for clock, importState and exportState + call ESMF_GridCompGet(model, clock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -238,7 +250,7 @@ subroutine ModelAdvance(gcomp, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing ModelA from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -250,13 +262,13 @@ subroutine ModelAdvance(gcomp, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_TimePrint(currTime + timeStep, & preString="------------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -271,4 +283,6 @@ subroutine ModelAdvance(gcomp, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/GenericMediatorProto/modelB.F90 b/GenericMediatorProto/modelB.F90 index a4ecbc22..b4612caa 100644 --- a/GenericMediatorProto/modelB.F90 +++ b/GenericMediatorProto/modelB.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -16,68 +16,73 @@ module ModelB use ESMF use NUOPC - use NUOPC_Model, only: & - model_routine_SS => SetServices, & - model_label_Advance => label_Advance - + use NUOPC_Model, & + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - - subroutine SetServices(gcomp, rc) - type(ESMF_GridComp) :: gcomp + + subroutine SetServices(model, rc) + type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(gcomp, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(gcomp, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeAdvertise, rc=rc) + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(gcomp, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeRealize, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(gcomp, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: gcomp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock + subroutine Advertise(model, rc) + type(ESMF_GridComp) :: model integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! exportable field: PINT call NUOPC_Advertise(exportState, & StandardName="PINT", rc=rc) @@ -93,7 +98,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & StandardName="surface_net_downward_shortwave_flux", rc=rc) @@ -111,23 +116,30 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: gcomp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock + subroutine Realize(model, rc) + type(ESMF_GridComp) :: model integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn, gridOut integer :: i, j real(kind=ESMF_KIND_R8), pointer :: lonPtr(:,:), latPtr(:,:) - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create Grid objects for Fields gridIn = ESMF_GridCreate1PeriDim(minIndex=(/1,1/), maxIndex=(/100,150/), & indexflag=ESMF_INDEX_GLOBAL, coordSys=ESMF_COORDSYS_SPH_DEG, rc=rc) @@ -156,7 +168,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) latPtr(i,j) = 100./real(150) * (j-1) - 50. enddo enddo - + gridOut = gridIn ! for now out same as in ! exportable field: PINT @@ -185,7 +197,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux field = ESMF_FieldCreate(name="surface_net_downward_shortwave_flux", & grid=gridIn, typekind=ESMF_TYPEKIND_R8, rc=rc) @@ -213,13 +225,13 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine ModelAdvance(gcomp, rc) - type(ESMF_GridComp) :: gcomp + subroutine Advance(model, rc) + type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -228,9 +240,9 @@ subroutine ModelAdvance(gcomp, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState - call ESMF_GridCompGet(gcomp, clock=clock, importState=importState, & + + ! query for clock, importState and exportState + call ESMF_GridCompGet(model, clock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -238,7 +250,7 @@ subroutine ModelAdvance(gcomp, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing ModelB from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -250,13 +262,13 @@ subroutine ModelAdvance(gcomp, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_TimePrint(currTime + timeStep, & preString="------------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -271,4 +283,6 @@ subroutine ModelAdvance(gcomp, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/HierarchyProto/atm.F90 b/HierarchyProto/atm.F90 index c6fd56ac..a49479e7 100644 --- a/HierarchyProto/atm.F90 +++ b/HierarchyProto/atm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -19,21 +19,19 @@ module ATM use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices, & - driver_label_SetRunSequence => label_SetRunSequence - + driverSS => SetServices + use DYN, only: dynSS => SetServices use PHY, only: phySS => SetServices use NUOPC_Connector, only: cplSS => SetServices implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -41,26 +39,25 @@ module ATM subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & + + ! specialize driver + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - #ifdef CUSTOMRUNSEQUENCE_on - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetRunSequence, & + call NUOPC_CompSpecialize(driver, specLabel=label_SetRunSequence, & specRoutine=SetRunSequence, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -68,6 +65,13 @@ subroutine SetServices(driver, rc) return ! bail out #endif + ! set driver verbosity + call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + end subroutine !----------------------------------------------------------------------------- @@ -75,7 +79,7 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables type(ESMF_GridComp) :: child type(ESMF_CplComp) :: conn @@ -83,7 +87,7 @@ subroutine SetModelServices(driver, rc) character(len=10) :: vString rc = ESMF_SUCCESS - + ! SetServices for DYN call NUOPC_DriverAddComp(driver, "DYN", dynSS, petList=(/0/), & comp=child, rc=rc) @@ -102,7 +106,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for PHY call NUOPC_DriverAddComp(driver, "PHY", phySS, petList=(/1/), & comp=child, rc=rc) @@ -143,18 +147,18 @@ subroutine SetModelServices(driver, rc) subroutine SetRunSequence(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables character(ESMF_MAXSTR) :: name type(NUOPC_FreeFormat) :: runSeqFF rc = ESMF_SUCCESS - + ! query the driver for its name call ESMF_GridCompGet(driver, name=name, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - + ! set up free format run sequence runSeqFF = NUOPC_FreeFormatCreate(stringList=(/ & " @* ", & @@ -165,7 +169,7 @@ subroutine SetRunSequence(driver, rc) rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - + ! ingest FreeFormat run sequence call NUOPC_DriverIngestRunSequence(driver, runSeqFF, & autoAddConnectors=.true., rc=rc) @@ -176,7 +180,7 @@ subroutine SetRunSequence(driver, rc) call NUOPC_FreeFormatDestroy(runSeqFF, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - + end subroutine !----------------------------------------------------------------------------- diff --git a/HierarchyProto/dyn.F90 b/HierarchyProto/dyn.F90 index 74808f86..636a55b1 100644 --- a/HierarchyProto/dyn.F90 +++ b/HierarchyProto/dyn.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,104 +17,79 @@ module DYN use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_DataInitialize => label_DataInitialize, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! Provide InitializeP0 to switch to custom IPD version - call ESMF_GridCompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - userRoutine=InitializeP0, phase=0, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv02p1"/), userRoutine=InitAdvertise, rc=rc) + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv02p3"/), userRoutine=InitRealize, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_DataInitialize, & + specRoutine=DataInitialize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_DataInitialize, & - specRoutine=DataInitialize, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP0(gcomp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: gcomp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - + subroutine Advertise(model, rc) + type(ESMF_GridComp) :: model + integer, intent(out) :: rc + + ! local variables + type(ESMF_State) :: importState, exportState + type(ESMF_State) :: nestedState + rc = ESMF_SUCCESS - ! Switch to IPDv02 (for datainitialize dependency loop) - ! by filtering all other phaseMap entries - call NUOPC_CompFilterPhaseMap(gcomp, ESMF_METHOD_INITIALIZE, & - acceptStringList=(/"IPDv02p"/), rc=rc) + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - subroutine InitAdvertise(model, importState, exportState, clock, rc) - type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - ! local variables - type(ESMF_State) :: nestedState - - rc = ESMF_SUCCESS - ! Disabling the following macro, e.g. renaming to WITHIMPORTFIELDS_disable, ! will result in a model component that does not advertise any importable ! Fields. Use this if you want to drive the model independently. @@ -135,7 +110,7 @@ subroutine InitAdvertise(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out #endif - + #define WITHEXPORTFIELDS #ifdef WITHEXPORTFIELDS ! exportable field: air_pressure_at_sea_level @@ -147,7 +122,7 @@ subroutine InitAdvertise(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", & @@ -157,7 +132,7 @@ subroutine InitAdvertise(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + #if 1 call NUOPC_AddNestedState(exportState, & CplSet="TestingSet", nestedState=nestedState, rc=rc) @@ -165,7 +140,7 @@ subroutine InitAdvertise(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call NUOPC_Advertise(nestedState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", & SharePolicyField="share", & @@ -175,25 +150,32 @@ subroutine InitAdvertise(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out #endif - + #endif end subroutine - + !----------------------------------------------------------------------------- - subroutine InitRealize(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/100, 100/), & minCornerCoord=(/0._ESMF_KIND_R8, -50._ESMF_KIND_R8/), & @@ -245,13 +227,13 @@ subroutine InitRealize(model, importState, exportState, clock, rc) #endif end subroutine - + !----------------------------------------------------------------------------- subroutine DataInitialize(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -263,14 +245,14 @@ subroutine DataInitialize(model, rc) rc = ESMF_SUCCESS - ! query the Component for its clock, importState and exportState + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! get the current time out of the clock call ESMF_ClockGet(clock, currTime=time, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -284,7 +266,7 @@ subroutine DataInitialize(model, rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & - return ! bail out + return ! bail out if (itemType==ESMF_STATEITEM_FIELD) then call ESMF_StateGet(importState, field=field, itemName="sst", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -300,7 +282,7 @@ subroutine DataInitialize(model, rc) else neededCurrent=.true. endif - + #if 1 call ESMF_TimePrint(time, & preString="DYN: DataInitialize time: ", unit=msgString, rc=rc) @@ -332,14 +314,14 @@ subroutine DataInitialize(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! data initialize the exported fields call ESMF_StateGet(exportState, itemName="pmsl", & itemType=itemType, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & - return ! bail out + return ! bail out if (itemType==ESMF_STATEITEM_FIELD) then call ESMF_StateGet(exportState, field=field, itemName="pmsl", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -353,13 +335,13 @@ subroutine DataInitialize(model, rc) file=__FILE__)) & return ! bail out endif - + call ESMF_StateGet(exportState, itemName="rsns", & itemType=itemType, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & - return ! bail out + return ! bail out if (itemType==ESMF_STATEITEM_FIELD) then call ESMF_StateGet(exportState, field=field, itemName="rsns", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -381,7 +363,7 @@ subroutine DataInitialize(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! must explicitly set time stamp on all export fields call NUOPC_SetTimestamp(exportState, clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -393,10 +375,10 @@ subroutine DataInitialize(model, rc) !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -407,8 +389,8 @@ subroutine ModelAdvance(model, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -417,12 +399,12 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set by default, ! its timeStep is equal to the parent timeStep. As a consequence the ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. - + ! for this call of the Advance() routine. + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing DYN from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -434,7 +416,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -453,14 +435,14 @@ subroutine ModelAdvance(model, rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & - return ! bail out + return ! bail out if (itemType==ESMF_STATEITEM_FIELD) then call ESMF_StateGet(exportState, field=field, & itemName="pmsl", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & - return ! bail out + return ! bail out call ESMF_FieldFill(field, dataFillScheme="sincos", & param1I4=step, param2I4=2, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -473,14 +455,14 @@ subroutine ModelAdvance(model, rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & - return ! bail out + return ! bail out if (itemType==ESMF_STATEITEM_FIELD) then call ESMF_StateGet(exportState, field=field, & itemName="rsns", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & - return ! bail out + return ! bail out call ESMF_FieldFill(field, dataFillScheme="sincos", & param1I4=step, param2I4=3, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -509,4 +491,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/HierarchyProto/esm.F90 b/HierarchyProto/esm.F90 index b0b1d00f..cbc4013c 100644 --- a/HierarchyProto/esm.F90 +++ b/HierarchyProto/esm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,20 +17,19 @@ module ESM use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices - + driverSS => SetServices + use ATM, only: atmSS => SetServices use OCN, only: ocnSVM => SetVM, ocnSS => SetServices - + use NUOPC_Connector, only: cplSS => SetServices - + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -38,24 +37,25 @@ module ESM subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & + + ! specialize driver + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + + ! set driver verbosity call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -69,7 +69,7 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables type(ESMF_Time) :: startTime type(ESMF_Time) :: stopTime @@ -99,7 +99,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! split up the PETs between ATM and OCN petCountOCN = min(2,petCount/2) ! don't give OCN more than 2 PETs petCountATM = petCount - petCountOCN @@ -128,7 +128,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for OCN with petList on second section of PETs allocate(petList(petCountOCN)) do i=1, petCountOCN @@ -170,7 +170,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for ocn2atm call NUOPC_DriverAddComp(driver, srcCompLabel="OCN", dstCompLabel="ATM", & compSetServicesRoutine=cplSS, comp=conn, rc=rc) @@ -209,13 +209,13 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- diff --git a/HierarchyProto/esmApp.F90 b/HierarchyProto/esmApp.F90 index cb487bdd..0b0e5775 100644 --- a/HierarchyProto/esmApp.F90 +++ b/HierarchyProto/esmApp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -22,7 +22,7 @@ program esmApp integer :: rc, urc type(ESMF_GridComp) :: esmComp - + ! Initialize ESMF call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, & defaultCalkind=ESMF_CALKIND_GREGORIAN, rc=rc) @@ -30,7 +30,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogSet(flush=.true., rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -60,7 +60,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! SetServices for the earth system Component call ESMF_GridCompSetServices(esmComp, esmSS, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -71,7 +71,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Initialize for the earth system Component call ESMF_GridCompInitialize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -82,7 +82,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Run for earth the system Component call ESMF_GridCompRun(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -93,7 +93,7 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Call Finalize for the earth system Component call ESMF_GridCompFinalize(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -104,14 +104,14 @@ program esmApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! Destroy the earth system Component call ESMF_GridCompDestroy(esmComp, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("esmApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -120,5 +120,5 @@ program esmApp ! Finalize ESMF call ESMF_Finalize() - -end program + +end program diff --git a/HierarchyProto/ocn.F90 b/HierarchyProto/ocn.F90 index 8db628e0..7d864222 100644 --- a/HierarchyProto/ocn.F90 +++ b/HierarchyProto/ocn.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,73 +17,78 @@ module OCN use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_SetClock => label_SetClock, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetVM, SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitAdvertise, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitRealize, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_SetClock, & + call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & specRoutine=SetClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitAdvertise(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! Disabling the following macro, e.g. renaming to WITHIMPORTFIELDS_disable, ! will result in a model component that does not advertise any importable ! Fields. Use this if you want to drive the model independently. @@ -121,23 +126,30 @@ subroutine InitAdvertise(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitRealize(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut type(ESMF_Field) :: field type(ESMF_StateItem_Flag) :: itemType - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/100, 50/), & minCornerCoord=(/0._ESMF_KIND_R8, -80._ESMF_KIND_R8/), & @@ -185,18 +197,18 @@ subroutine InitRealize(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_StateGet(exportState, itemName="sst", itemType=itemType, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & - return ! bail out + return ! bail out if (itemType==ESMF_STATEITEM_FIELD) then call ESMF_StateGet(exportState, field=field, itemName="sst", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & - return ! bail out + return ! bail out call ESMF_FieldFill(field, dataFillScheme="sincos", & param1I4=0, param2I4=1, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -214,26 +226,26 @@ subroutine InitRealize(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- subroutine SetClock(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_TimeInterval) :: stabilityTimeStep rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock call NUOPC_ModelGet(model, modelClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! initialize internal clock ! here: parent Clock and stability timeStep determine actual model timeStep !TODO: stabilityTimeStep should be read in from configuation @@ -248,15 +260,15 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -268,8 +280,8 @@ subroutine ModelAdvance(model, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -278,14 +290,14 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set in SetClock(), ! its timeStep is likely smaller than the parent timeStep. As a consequence - ! the time interval covered by a single parent timeStep will result in - ! multiple calls to the ModelAdvance() routine. Every time the currTime + ! the time interval covered by a single parent timeStep will result in + ! multiple calls to the Advance() routine. Every time the currTime ! will come in by one internal timeStep advanced. This goes until the ! stopTime of the internal Clock has been reached. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing OCN from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -297,13 +309,13 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_TimePrint(currTime + timeStep, & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -321,7 +333,7 @@ subroutine ModelAdvance(model, rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & - return ! bail out + return ! bail out call ESMF_FieldFill(field, dataFillScheme="sincos", & param1I4=step, param2I4=1, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -348,4 +360,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/HierarchyProto/phy.F90 b/HierarchyProto/phy.F90 index ad84fd71..4acc074f 100644 --- a/HierarchyProto/phy.F90 +++ b/HierarchyProto/phy.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,66 +17,72 @@ module PHY use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitAdvertise, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitRealize, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitAdvertise(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! Disabling the following macro, e.g. renaming to WITHIMPORTFIELDS_disable, ! will result in a model component that does not advertise any importable ! Fields. Use this if you want to drive the model independently. @@ -90,7 +96,7 @@ subroutine InitAdvertise(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out #endif - + #define WITHEXPORTFIELDS #ifdef WITHEXPORTFIELDS ! exportable field: precipitation_flux @@ -110,23 +116,30 @@ subroutine InitAdvertise(model, importState, exportState, clock, rc) #endif end subroutine - + !----------------------------------------------------------------------------- - subroutine InitRealize(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut type(ESMF_Field) :: field type(ESMF_StateItem_Flag) :: itemType - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/100, 100/), & minCornerCoord=(/0._ESMF_KIND_R8, -50._ESMF_KIND_R8/), & @@ -167,20 +180,20 @@ subroutine InitRealize(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_StateGet(exportState, itemName="precipitation_flux", & itemType=itemType, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & - return ! bail out + return ! bail out if (itemType==ESMF_STATEITEM_FIELD) then call ESMF_StateGet(exportState, field=field, & itemName="precipitation_flux", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & - return ! bail out + return ! bail out call ESMF_FieldFill(field, dataFillScheme="sincos", & param1I4=0, param2I4=4, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -188,19 +201,19 @@ subroutine InitRealize(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out endif - + call ESMF_StateGet(exportState, itemName="PHYEX", & itemType=itemType, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & - return ! bail out + return ! bail out if (itemType==ESMF_STATEITEM_FIELD) then call ESMF_StateGet(exportState, field=field, itemName="PHYEX", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & - return ! bail out + return ! bail out call ESMF_FieldFill(field, dataFillScheme="sincos", & param1I4=0, param2I4=5, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -208,7 +221,7 @@ subroutine InitRealize(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out endif - + ! write out the Fields in the exportState call NUOPC_Write(exportState, fileNamePrefix="field_phy_export_datainit_", & status=ESMF_FILESTATUS_REPLACE, relaxedFlag=.true., rc=rc) @@ -216,17 +229,17 @@ subroutine InitRealize(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + #endif end subroutine - + !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -237,8 +250,8 @@ subroutine ModelAdvance(model, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -247,12 +260,12 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set by default, ! its timeStep is equal to the parent timeStep. As a consequence the ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. - + ! for this call of the Advance() routine. + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing PHY from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -264,7 +277,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -283,14 +296,14 @@ subroutine ModelAdvance(model, rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & - return ! bail out + return ! bail out if (itemType==ESMF_STATEITEM_FIELD) then call ESMF_StateGet(exportState, field=field, & itemName="precipitation_flux", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & - return ! bail out + return ! bail out call ESMF_FieldFill(field, dataFillScheme="sincos", & param1I4=step, param2I4=4, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -303,13 +316,13 @@ subroutine ModelAdvance(model, rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & - return ! bail out + return ! bail out if (itemType==ESMF_STATEITEM_FIELD) then call ESMF_StateGet(exportState, field=field, itemName="PHYEX", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & - return ! bail out + return ! bail out call ESMF_FieldFill(field, dataFillScheme="sincos", & param1I4=step, param2I4=5, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -338,4 +351,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/NamespaceProto/atm.F90 b/NamespaceProto/atm.F90 index 73728c95..78257204 100644 --- a/NamespaceProto/atm.F90 +++ b/NamespaceProto/atm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,66 +17,72 @@ module ATM use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! importable field: sea_surface_temperature call NUOPC_Advertise(importState, & StandardName="sea_surface_temperature", name="sst", rc=rc) @@ -84,7 +90,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: air_pressure_at_sea_level call NUOPC_Advertise(exportState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -92,7 +98,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -102,22 +108,29 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/40, 15/), & minCornerCoord=(/0._ESMF_KIND_R8, -70._ESMF_KIND_R8/), & @@ -169,21 +182,21 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -192,12 +205,12 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set by default, ! its timeStep is equal to the parent timeStep. As a consequence the ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. - + ! for this call of the Advance() routine. + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing ATM from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -209,7 +222,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -224,4 +237,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/NamespaceProto/driver.F90 b/NamespaceProto/driver.F90 index e08eed18..224c7840 100644 --- a/NamespaceProto/driver.F90 +++ b/NamespaceProto/driver.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,25 +17,24 @@ module driver use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices - + driverSS => SetServices + use ATM, only: atmSS => SetServices use MED, only: medSS => SetServices - + use NUOPC_Connector, only: cplSS => SetServices implicit none - + private - + ! private module data --> ONLY PARAMETERS integer, parameter :: stepCount = 5 real(ESMF_KIND_R8), parameter :: stepTime = 30.D0 ! step time [s] ! should be parent step public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -43,24 +42,31 @@ module driver subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & + + ! specialize driver + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out + ! set driver verbosity + call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + end subroutine !----------------------------------------------------------------------------- @@ -68,7 +74,7 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables type(ESMF_GridComp) :: child type(ESMF_CplComp) :: connector @@ -78,7 +84,7 @@ subroutine SetModelServices(driver, rc) type(ESMF_Clock) :: internalClock rc = ESMF_SUCCESS - + ! SetServices for the 1st ATM instance call NUOPC_DriverAddComp(driver, "ATM1", atmSS, comp=child, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -90,7 +96,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for the 2nd ATM instance call NUOPC_DriverAddComp(driver, "ATM2", atmSS, comp=child, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -102,7 +108,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for the MED call NUOPC_DriverAddComp(driver, "MED", medSS, comp=child, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -114,7 +120,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for ATM1->MED call NUOPC_DriverAddComp(driver, srcCompLabel="ATM1", dstCompLabel="MED", & compSetServicesRoutine=cplSS, comp=connector, rc=rc) @@ -127,7 +133,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for MED->ATM1 call NUOPC_DriverAddComp(driver, srcCompLabel="MED", dstCompLabel="ATM1", & compSetServicesRoutine=cplSS, comp=connector, rc=rc) @@ -140,7 +146,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for ATM2->MED call NUOPC_DriverAddComp(driver, srcCompLabel="ATM2", dstCompLabel="MED", & compSetServicesRoutine=cplSS, comp=connector, rc=rc) @@ -153,7 +159,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for MED->ATM2 call NUOPC_DriverAddComp(driver, srcCompLabel="MED", dstCompLabel="ATM2", & compSetServicesRoutine=cplSS, comp=connector, rc=rc) @@ -166,7 +172,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! set the model clock call ESMF_TimeSet(startTime, s = 0, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -192,13 +198,15 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/NamespaceProto/mainApp.F90 b/NamespaceProto/mainApp.F90 index e05a761b..dcac5820 100644 --- a/NamespaceProto/mainApp.F90 +++ b/NamespaceProto/mainApp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -20,7 +20,7 @@ program mainApp driver_SS => SetServices implicit none - + integer :: rc, userRc type(ESMF_GridComp) :: drvComp @@ -30,22 +30,22 @@ program mainApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("mainApp STARTING", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + !----------------------------------------------------------------------------- - + ! -> CREATE THE DRIVER drvComp = ESMF_GridCompCreate(name="driver", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! -> SET DRIVER SERVICES call ESMF_GridCompSetServices(drvComp, driver_SS, userRc=userRc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -67,7 +67,7 @@ program mainApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! RUN THE DRIVER call ESMF_GridCompRun(drvComp, userRc=userRc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -78,7 +78,7 @@ program mainApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! FINALIZE THE DRIVER call ESMF_GridCompFinalize(drvComp, userRc=userRc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -91,7 +91,7 @@ program mainApp call ESMF_Finalize(endflag=ESMF_END_ABORT) !----------------------------------------------------------------------------- - + call ESMF_LogWrite("mainApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -100,5 +100,5 @@ program mainApp ! Finalize ESMF call ESMF_Finalize() - -end program + +end program diff --git a/NamespaceProto/med.F90 b/NamespaceProto/med.F90 index 86a0cabe..0158bea8 100644 --- a/NamespaceProto/med.F90 +++ b/NamespaceProto/med.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -16,81 +16,84 @@ module MED use ESMF use NUOPC - use NUOPC_Mediator, only: & - mediator_routine_SS => SetServices, & - mediator_label_TimestampExport => label_TimestampExport, & - mediator_label_Advance => label_Advance - + use NUOPC_Mediator, & + mediatorSS => SetServices + implicit none - + private - + integer, parameter :: atmCount=2 ! number of ATMs this MED expects to interact - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - - subroutine SetServices(gcomp, rc) - type(ESMF_GridComp) :: gcomp + + subroutine SetServices(mediator, rc) + type(ESMF_GridComp) :: mediator integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(gcomp, mediator_routine_SS, rc=rc) + + ! derive from NUOPC_Mediator + call NUOPC_CompDerive(mediator, mediatorSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(gcomp, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize mediator + call NUOPC_CompSpecialize(mediator, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(gcomp, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(mediator, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(gcomp, specLabel=mediator_label_Advance, & - specRoutine=MediatorAdvance, rc=rc) + call NUOPC_CompSpecialize(mediator, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(gcomp, specLabel=mediator_label_TimestampExport, & - specRoutine=TimestampExport, specPhaseLabel="RunPhase1", rc=rc) + call NUOPC_CompSpecialize(mediator, specLabel=label_TimeStampExport, & + specRoutine=TimeStampExport, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(gcomp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: gcomp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock + subroutine Advertise(mediator, rc) + type(ESMF_GridComp) :: mediator integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState integer :: i type(ESMF_State) :: state, deepState character(len=20) :: iString - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_MediatorGet(mediator, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! ATM input Fields come through namespaces do i=1, atmCount write (iString,*) i @@ -117,7 +120,7 @@ subroutine InitializeP1(gcomp, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + #define DEEP_TEST_off #ifdef DEEP_TEST call NUOPC_AddNamespace(state, & @@ -134,7 +137,7 @@ subroutine InitializeP1(gcomp, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out #endif - + enddo #define FLAT_TEST_off @@ -180,25 +183,32 @@ subroutine InitializeP1(gcomp, importState, exportState, clock, rc) #endif end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(gcomp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: gcomp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock + subroutine Realize(mediator, rc) + type(ESMF_GridComp) :: mediator integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState integer :: i type(ESMF_State) :: state character(len=20) :: iString type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_MediatorGet(mediator, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/50, 30/), & minCornerCoord=(/0._ESMF_KIND_R8, -70._ESMF_KIND_R8/), & @@ -287,13 +297,13 @@ subroutine InitializeP2(gcomp, importState, exportState, clock, rc) #endif end subroutine - + !----------------------------------------------------------------------------- - - subroutine TimestampExport(gcomp, rc) - type(ESMF_GridComp) :: gcomp + + subroutine TimestampExport(mediator, rc) + type(ESMF_GridComp) :: mediator integer, intent(out) :: rc - + ! This is the routine that applies the time stamp on the export Fields: ! -> By default the MED Run method time stamps the export Fields with the ! current time at the beginning of the advance step, however here, @@ -306,8 +316,8 @@ subroutine TimestampExport(gcomp, rc) rc = ESMF_SUCCESS - ! query the Component for info - call ESMF_GridCompGet(gcomp, clock=clock, exportState=exportState, rc=rc) + ! query for clock and exportState + call ESMF_GridCompGet(mediator, clock=clock, exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -319,44 +329,44 @@ subroutine TimestampExport(gcomp, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine TimestampExport !----------------------------------------------------------------------------- - subroutine MediatorAdvance(mediator, rc) + subroutine Advance(mediator, rc) type(ESMF_GridComp) :: mediator integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call ESMF_GridCompGet(mediator, clock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! HERE THE MEDIATOR does the mediation of Fields that come in on the - ! importState with a timestamp consistent to the currTime of the + ! importState with a timestamp consistent to the currTime of the ! mediators Clock. - + ! The Mediator uses the data on the import Fields to update the data ! held by Fields in the exportState. - + ! After this routine returns the generic Mediator will correctly ! timestamp the export Fields at currTime, and update the Mediator Clock to: ! ! currTime -> currTime + timeStep ! ! Where the timeStep is equal to the parent timeStep. - + call ESMF_ClockPrint(clock, options="currTime", & preString="------>Advancing MED from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -368,7 +378,7 @@ subroutine MediatorAdvance(mediator, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -383,4 +393,6 @@ subroutine MediatorAdvance(mediator, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/NestingMultipleProto/advectDiffComp.F90 b/NestingMultipleProto/advectDiffComp.F90 index fa87f258..fe6907f0 100644 --- a/NestingMultipleProto/advectDiffComp.F90 +++ b/NestingMultipleProto/advectDiffComp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -13,12 +13,10 @@ module advectDiffComp use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_SetClock => label_SetClock, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private ! private module data --> ONLY PARAMETERS @@ -39,11 +37,11 @@ module advectDiffComp real(ESMF_KIND_R8), parameter :: dxTop = 5.D3 ! grid spacing [m] real(ESMF_KIND_R8), parameter :: u = 5.D0 ! horiz. x velocity [m/s] real(ESMF_KIND_R8), parameter :: Kh = 2500.D0 ! horiz. diff coef [m2/s] - + ! real(ESMF_KIND_R8), parameter :: sbf = 30.D0 ! seconds between frames [s] real(ESMF_KIND_R8), parameter :: sbf = 120.D0 ! seconds between frames [s] ! real(ESMF_KIND_R8), parameter :: sbf = 300.D0 ! seconds between frames [s] - + ! internal state to keep instance private data type InternalStateStruct type(ESMF_Grid) :: grid @@ -66,69 +64,74 @@ module advectDiffComp !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=RealizeProvided, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_FINALIZE, & - phaseLabelList=(/""/), userRoutine=Finalize, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & + specRoutine=SetClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_SetClock, & - specRoutine=SetClock, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Finalize, & + specRoutine=Finalize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - !----------------------------------------------------------------------------- !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - integer :: nestingGeneration - + + ! local variables + type(ESMF_State) :: importState, exportState + integer :: nestingGeneration + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! look at the "NestingGeneration" Attribute of this instance call NUOPC_CompAttributeGet(model, name="NestingGeneration", & value=nestingGeneration, rc=rc) @@ -136,7 +139,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: density call NUOPC_Advertise(exportState, & StandardName="density", rc=rc) @@ -144,7 +147,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + if (nestingGeneration == 1) then ! Child Domain ! importable field: density @@ -155,17 +158,17 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out endif - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine RealizeProvided(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState type(InternalState) :: is real(ESMF_KIND_R8), pointer :: coordPtr(:) real(ESMF_KIND_R8), pointer :: dataPtr(:,:) @@ -176,6 +179,14 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! look at the "NestingGeneration" Attribute of this instance call NUOPC_CompAttributeGet(model, name="NestingGeneration", & value=nestingGeneration, rc=rc) @@ -190,7 +201,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! -> allocate memory for this internal state and set it in the Component allocate(is%wrap, stat=stat) if (ESMF_LogFoundAllocError(statusToCheck=stat, & @@ -206,7 +217,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) if (nestingGeneration == 0) then ! This is the parent domain - + dx = dxTop ! -> create the Grid is%wrap%grid = ESMF_GridCreate1PeriDim( & @@ -241,10 +252,10 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) do i=lbound(coordPtr,1),ubound(coordPtr,1) coordPtr(i) = i * dx enddo - + else if ((nestingGeneration == 1) .and. (nestling == 0)) then ! This is nestling 0 in the first nest generation - + dx = dxTop / 2.d0 ! twice the resolution in x ! -> create the Grid is%wrap%grid = ESMF_GridCreateNoPeriDim( & @@ -279,7 +290,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) do i=lbound(coordPtr,1),ubound(coordPtr,1) coordPtr(i) = i * dxTop enddo - + ! the child domain also needs a transfer Grid/Field for coupling to parent is%wrap%gridTrans = ESMF_GridCreateNoPeriDim( & ! Define a regular distribution (no regDecomp arg -> divide along i w/ DEs) @@ -315,7 +326,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) do i=lbound(coordPtr,1),ubound(coordPtr,1) coordPtr(i) = i * dxTop enddo - + ! -> create the transfer Field is%wrap%fieldTrans = ESMF_FieldCreate(grid=is%wrap%gridTrans, & typekind=ESMF_TYPEKIND_R8, & @@ -326,10 +337,10 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return - + else if ((nestingGeneration == 1) .and. (nestling == 1)) then ! This is nestling 1 in the first nest generation - + dx = dxTop / 3.d0 ! three times the resolution in x ! -> create the Grid is%wrap%grid = ESMF_GridCreateNoPeriDim( & @@ -364,7 +375,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) do i=lbound(coordPtr,1),ubound(coordPtr,1) coordPtr(i) = i * dxTop enddo - + ! the child domain also needs a transfer Grid/Field for coupling to parent is%wrap%gridTrans = ESMF_GridCreateNoPeriDim( & ! Define a regular distribution (no regDecomp arg -> divide along i w/ DEs) @@ -400,7 +411,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) do i=lbound(coordPtr,1),ubound(coordPtr,1) coordPtr(i) = i * dxTop enddo - + ! -> create the transfer Field is%wrap%fieldTrans = ESMF_FieldCreate(grid=is%wrap%gridTrans, & typekind=ESMF_TYPEKIND_R8, & @@ -411,7 +422,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return - + endif ! -> create the Field @@ -424,7 +435,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return - + ! -> precompute halo operation call ESMF_FieldHaloStore(is%wrap%field, routehandle=is%wrap%haloHandle, & rc=rc) @@ -432,7 +443,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return - + ! exportable field: density call NUOPC_Realize(exportState, field=is%wrap%field, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -442,7 +453,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) if (nestingGeneration == 0) then ! -> get pointer to Field data - call ESMF_FieldGet(is%wrap%field, farrayPtr=dataPtr, rc=rc) + call ESMF_FieldGet(is%wrap%field, farrayPtr=dataPtr, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -461,61 +472,10 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out endif - + ! intialize instance private slice counter is%wrap%slice = 1 - - end subroutine - - !----------------------------------------------------------------------------- - subroutine Finalize(model, importState, exportState, clock, rc) - type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - type(InternalState) :: is - integer :: stat - - rc = ESMF_SUCCESS - - ! -> get internal state from Component - nullify(is%wrap) - call ESMF_GridCompGetInternalState(model, is, rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! -> destroy objects inside of internal state - - call ESMF_FieldHaloRelease(routehandle=is%wrap%haloHandle, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return - - call ESMF_FieldDestroy(is%wrap%field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return - - call ESMF_GridDestroy(is%wrap%grid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return - - ! -> deallocate internal state memory - deallocate(is%wrap, stat=stat) - if (ESMF_LogFoundDeallocError(statusToCheck=stat, & - msg="Deallocation of internal state memory failed.", & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - end subroutine !----------------------------------------------------------------------------- @@ -523,7 +483,7 @@ subroutine Finalize(model, importState, exportState, clock, rc) subroutine SetClock(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_TimeInterval) :: callerTimeStep @@ -534,7 +494,7 @@ subroutine SetClock(model, rc) real(ESMF_KIND_R8) :: dt rc = ESMF_SUCCESS - + ! look at the "NestingGeneration" Attribute of this instance of the model component call NUOPC_CompAttributeGet(model, name="NestingGeneration", & value=nestingGeneration, rc=rc) @@ -542,20 +502,20 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + if (nestingGeneration == 0) then dt = dtTop ! parent domain time step else dt = dtTop / childSteps ! child domain time step endif - - ! query the Component for its clock + + ! query for clock call NUOPC_ModelGet(model, modelClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! -> get the caller's timeStep call ESMF_ClockGet(clock, timeStep=callerTimeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -575,7 +535,7 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! -> get internal state from Component nullify(is%wrap) call ESMF_GridCompGetInternalState(model, is, rc) @@ -583,14 +543,14 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! query the Component for its clock again, since it has changed call NUOPC_ModelGet(model, modelClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! -> set currTime call ESMF_ClockGet(clock, currTime=currTime, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -624,7 +584,7 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return - + ! -> create transfer Alarm if (nestingGeneration == 0) then ! This is the parent domain @@ -652,10 +612,10 @@ subroutine SetClock(model, rc) !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(InternalState) :: is type(ESMF_State) :: exportState @@ -671,19 +631,19 @@ subroutine ModelAdvance(model, rc) real(ESMF_KIND_R8) :: dt, dx rc = ESMF_SUCCESS - + ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep ! on the internal model Clock. This may be (and likely is) a smaller ! timeStep than the parent's timeStep on the incoming Clock, which is ! equal to the coupling timeStep. - - ! access exportState + + ! query for exportState call NUOPC_ModelGet(model, exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! -> get internal state from Component nullify(is%wrap) call ESMF_GridCompGetInternalState(model, is, rc) @@ -691,14 +651,14 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! -> get pointer to Field data - call ESMF_FieldGet(is%wrap%field, farrayPtr=dataPtr, rc=rc) + call ESMF_FieldGet(is%wrap%field, farrayPtr=dataPtr, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return - + ! See if this is a child nest domain first time coming in after coupling if (ESMF_AlarmIsRinging(is%wrap%timeToTransfer)) then ! -> need transfer @@ -713,7 +673,7 @@ subroutine ModelAdvance(model, rc) file=__FILE__)) & return ! -> get pointer to transfer Field data - call ESMF_FieldGet(is%wrap%fieldTrans, farrayPtr=dataTransPtr, rc=rc) + call ESMF_FieldGet(is%wrap%fieldTrans, farrayPtr=dataTransPtr, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -724,7 +684,7 @@ subroutine ModelAdvance(model, rc) dataPtr(i,j) = dataTransPtr(i,j) enddo enddo - + endif ! -> get the time step of the internal model Clock -->> dt @@ -743,7 +703,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! -> get x-coordinates from Grid to determine spacing -->> dx call ESMF_GridGetCoord(is%wrap%grid, coordDim=1, farrayPtr=coordPtr, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -751,21 +711,21 @@ subroutine ModelAdvance(model, rc) file=__FILE__)) & return ! bail out dx = coordPtr(lbound(coordPtr,1)+1) - coordPtr(lbound(coordPtr,1)) - + ! -> get pointer to Field data - call ESMF_FieldGet(is%wrap%field, farrayPtr=dataPtr, rc=rc) + call ESMF_FieldGet(is%wrap%field, farrayPtr=dataPtr, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return - + ! -> first update the halo region on each DE call ESMF_FieldHalo(is%wrap%field, routehandle=is%wrap%haloHandle, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return - + ! -> then apply simple forward Euler solver do j=lbound(dataPtr,2)+jHaloDepth, ubound(dataPtr,2)-jHaloDepth up1Flag = .false. @@ -786,7 +746,7 @@ subroutine ModelAdvance(model, rc) dataPtr(i-2,j) = up2Data dataPtr(i-1,j) = up1Data enddo - + ! see if it is time to write for I/O if (ESMF_AlarmIsRinging(is%wrap%timeToWriteAlarm)) then ! -> finally write a new timeslice to file @@ -814,7 +774,59 @@ subroutine ModelAdvance(model, rc) ! advance the time slice counter is%wrap%slice = is%wrap%slice + 1 endif - + end subroutine + !----------------------------------------------------------------------------- + + subroutine Finalize(model, rc) + type(ESMF_GridComp) :: model + integer, intent(out) :: rc + + ! local variables + type(InternalState) :: is + integer :: stat + + rc = ESMF_SUCCESS + + ! -> get internal state from Component + nullify(is%wrap) + call ESMF_GridCompGetInternalState(model, is, rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! -> destroy objects inside of internal state + + call ESMF_FieldHaloRelease(routehandle=is%wrap%haloHandle, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return + + call ESMF_FieldDestroy(is%wrap%field, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return + + call ESMF_GridDestroy(is%wrap%grid, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return + + ! -> deallocate internal state memory + deallocate(is%wrap, stat=stat) + if (ESMF_LogFoundDeallocError(statusToCheck=stat, & + msg="Deallocation of internal state memory failed.", & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + end subroutine + + !----------------------------------------------------------------------------- + end module diff --git a/NestingMultipleProto/driverComp.F90 b/NestingMultipleProto/driverComp.F90 index c2c0a9b1..02601c92 100644 --- a/NestingMultipleProto/driverComp.F90 +++ b/NestingMultipleProto/driverComp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,25 +17,24 @@ module driverComp use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices - + driverSS => SetServices + use advectDiffComp, only: & advectDiff_SS => SetServices - + use NUOPC_Connector, only: cplSS => SetServices implicit none - + private - + ! private module data --> ONLY PARAMETERS integer, parameter :: stepCount = 1000 real(ESMF_KIND_R8), parameter :: stepTime = 30.D0 ! step time [s] ! should be parent step - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -43,24 +42,31 @@ module driverComp subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & + + ! specialize driver + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out + ! set driver verbosity + call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + end subroutine !----------------------------------------------------------------------------- @@ -68,7 +74,7 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables type(ESMF_Grid) :: grid type(ESMF_Field) :: field @@ -83,7 +89,7 @@ subroutine SetModelServices(driver, rc) rc = ESMF_SUCCESS - ! get petCount + ! get petCount call ESMF_GridCompGet(driver, petCount=petCount, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -116,7 +122,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for NEST DOMAIN advectDiffComp allocate(petList(petCount/2)) do i=1, petCount/2 @@ -228,13 +234,15 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/NestingMultipleProto/mainApp.F90 b/NestingMultipleProto/mainApp.F90 index 2c9040d1..b4b352a4 100644 --- a/NestingMultipleProto/mainApp.F90 +++ b/NestingMultipleProto/mainApp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -16,12 +16,12 @@ program mainApp use ESMF use NUOPC - + use driverComp, only: & driver_SS => SetServices implicit none - + integer :: rc, userRc type(ESMF_GridComp) :: driver @@ -31,7 +31,7 @@ program mainApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("mainApp STARTING", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -55,7 +55,7 @@ program mainApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! -> SET DRIVER SERVICES call ESMF_GridCompSetServices(driver, driver_SS, userRc=userRc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -77,7 +77,7 @@ program mainApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! RUN THE DRIVER call ESMF_GridCompRun(driver, userRc=userRc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -88,7 +88,7 @@ program mainApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! FINALIZE THE DRIVER call ESMF_GridCompFinalize(driver, userRc=userRc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -101,7 +101,7 @@ program mainApp call ESMF_Finalize(endflag=ESMF_END_ABORT) !----------------------------------------------------------------------------- - + call ESMF_LogWrite("mainApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -110,5 +110,5 @@ program mainApp ! Finalize ESMF call ESMF_Finalize() - -end program + +end program diff --git a/NestingSingleProto/advectDiffComp.F90 b/NestingSingleProto/advectDiffComp.F90 index d398cb65..de129451 100644 --- a/NestingSingleProto/advectDiffComp.F90 +++ b/NestingSingleProto/advectDiffComp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -13,12 +13,10 @@ module advectDiffComp use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_SetClock => label_SetClock, & - model_label_Advance => label_Advance - + modelSS => SetServices + implicit none - + private ! private module data --> ONLY PARAMETERS @@ -39,11 +37,11 @@ module advectDiffComp real(ESMF_KIND_R8), parameter :: dxTop = 5.D3 ! grid spacing [m] real(ESMF_KIND_R8), parameter :: u = 5.D0 ! horiz. x velocity [m/s] real(ESMF_KIND_R8), parameter :: Kh = 2500.D0 ! horiz. diff coef [m2/s] - + ! real(ESMF_KIND_R8), parameter :: sbf = 30.D0 ! seconds between frames [s] real(ESMF_KIND_R8), parameter :: sbf = 120.D0 ! seconds between frames [s] ! real(ESMF_KIND_R8), parameter :: sbf = 300.D0 ! seconds between frames [s] - + ! internal state to keep instance private data type InternalStateStruct type(ESMF_Grid) :: grid @@ -66,69 +64,74 @@ module advectDiffComp !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=RealizeProvided, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_FINALIZE, & - phaseLabelList=(/""/), userRoutine=Finalize, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & + specRoutine=SetClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_SetClock, & - specRoutine=SetClock, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Finalize, & + specRoutine=Finalize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - !----------------------------------------------------------------------------- !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - integer :: nestingGeneration - + + ! local variables + type(ESMF_State) :: importState, exportState + integer :: nestingGeneration + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! look at the "NestingGeneration" Attribute of this instance call NUOPC_CompAttributeGet(model, name="NestingGeneration", & value=nestingGeneration, rc=rc) @@ -136,7 +139,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: density call NUOPC_Advertise(exportState, & StandardName="density", rc=rc) @@ -144,7 +147,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + if (nestingGeneration == 1) then ! Child Domain ! importable field: density @@ -155,17 +158,17 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out endif - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine RealizeProvided(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState type(InternalState) :: is real(ESMF_KIND_R8), pointer :: coordPtr(:) real(ESMF_KIND_R8), pointer :: dataPtr(:,:) @@ -176,6 +179,14 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! look at the "NestingGeneration" Attribute of this instance call NUOPC_CompAttributeGet(model, name="NestingGeneration", & value=nestingGeneration, rc=rc) @@ -190,7 +201,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! -> allocate memory for this internal state and set it in the Component allocate(is%wrap, stat=stat) if (ESMF_LogFoundAllocError(statusToCheck=stat, & @@ -206,7 +217,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) if (nestingGeneration == 0) then ! This is the parent domain - + dx = dxTop ! -> create the Grid is%wrap%grid = ESMF_GridCreate1PeriDim( & @@ -241,10 +252,10 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) do i=lbound(coordPtr,1),ubound(coordPtr,1) coordPtr(i) = i * dx enddo - + else if ((nestingGeneration == 1) .and. (nestling == 0)) then ! This is nestling 0 in the first nest generation - + dx = dxTop / 2.d0 ! twice the resolution in x ! -> create the Grid is%wrap%grid = ESMF_GridCreateNoPeriDim( & @@ -279,7 +290,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) do i=lbound(coordPtr,1),ubound(coordPtr,1) coordPtr(i) = i * dxTop enddo - + ! the child domain also needs a transfer Grid/Field for coupling to parent is%wrap%gridTrans = ESMF_GridCreateNoPeriDim( & ! Define a regular distribution (no regDecomp arg -> divide along i w/ DEs) @@ -315,7 +326,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) do i=lbound(coordPtr,1),ubound(coordPtr,1) coordPtr(i) = i * dxTop enddo - + ! -> create the transfer Field is%wrap%fieldTrans = ESMF_FieldCreate(grid=is%wrap%gridTrans, & typekind=ESMF_TYPEKIND_R8, & @@ -326,7 +337,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return - + endif ! -> create the Field @@ -339,7 +350,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return - + ! -> precompute halo operation call ESMF_FieldHaloStore(is%wrap%field, routehandle=is%wrap%haloHandle, & rc=rc) @@ -347,7 +358,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return - + ! exportable field: density call NUOPC_Realize(exportState, field=is%wrap%field, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -357,7 +368,7 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) if (nestingGeneration == 0) then ! -> get pointer to Field data - call ESMF_FieldGet(is%wrap%field, farrayPtr=dataPtr, rc=rc) + call ESMF_FieldGet(is%wrap%field, farrayPtr=dataPtr, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -376,61 +387,10 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out endif - + ! intialize instance private slice counter is%wrap%slice = 1 - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine Finalize(model, importState, exportState, clock, rc) - type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - type(InternalState) :: is - integer :: stat - - rc = ESMF_SUCCESS - - ! -> get internal state from Component - nullify(is%wrap) - call ESMF_GridCompGetInternalState(model, is, rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! -> destroy objects inside of internal state - call ESMF_FieldHaloRelease(routehandle=is%wrap%haloHandle, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return - - call ESMF_FieldDestroy(is%wrap%field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return - - call ESMF_GridDestroy(is%wrap%grid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return - - ! -> deallocate internal state memory - deallocate(is%wrap, stat=stat) - if (ESMF_LogFoundDeallocError(statusToCheck=stat, & - msg="Deallocation of internal state memory failed.", & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - end subroutine !----------------------------------------------------------------------------- @@ -438,7 +398,7 @@ subroutine Finalize(model, importState, exportState, clock, rc) subroutine SetClock(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_TimeInterval) :: callerTimeStep @@ -449,7 +409,7 @@ subroutine SetClock(model, rc) real(ESMF_KIND_R8) :: dt rc = ESMF_SUCCESS - + ! look at the "NestingGeneration" Attribute of this instance of the model component call NUOPC_CompAttributeGet(model, name="NestingGeneration", & value=nestingGeneration, rc=rc) @@ -457,20 +417,20 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + if (nestingGeneration == 0) then dt = dtTop ! parent domain time step else dt = dtTop / childSteps ! child domain time step endif - - ! query the Component for its clock + + ! query for clock call NUOPC_ModelGet(model, modelClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! -> get the caller's timeStep call ESMF_ClockGet(clock, timeStep=callerTimeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -490,7 +450,7 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! -> get internal state from Component nullify(is%wrap) call ESMF_GridCompGetInternalState(model, is, rc) @@ -498,14 +458,14 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! query the Component for its clock again, since it has changed call NUOPC_ModelGet(model, modelClock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! -> set currTime call ESMF_ClockGet(clock, currTime=currTime, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -539,7 +499,7 @@ subroutine SetClock(model, rc) line=__LINE__, & file=__FILE__)) & return - + ! -> create transfer Alarm if (nestingGeneration == 0) then ! This is the parent domain @@ -567,10 +527,10 @@ subroutine SetClock(model, rc) !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(InternalState) :: is type(ESMF_State) :: exportState @@ -586,19 +546,19 @@ subroutine ModelAdvance(model, rc) real(ESMF_KIND_R8) :: dt, dx rc = ESMF_SUCCESS - + ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep ! on the internal model Clock. This may be (and likely is) a smaller ! timeStep than the parent's timeStep on the incoming Clock, which is ! equal to the coupling timeStep. - - ! access exportState + + ! query for exportState call NUOPC_ModelGet(model, exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + ! -> get internal state from Component nullify(is%wrap) call ESMF_GridCompGetInternalState(model, is, rc) @@ -606,14 +566,14 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! -> get pointer to Field data - call ESMF_FieldGet(is%wrap%field, farrayPtr=dataPtr, rc=rc) + call ESMF_FieldGet(is%wrap%field, farrayPtr=dataPtr, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return - + ! See if this is a child nest domain first time coming in after coupling if (ESMF_AlarmIsRinging(is%wrap%timeToTransfer)) then ! -> need transfer @@ -628,7 +588,7 @@ subroutine ModelAdvance(model, rc) file=__FILE__)) & return ! -> get pointer to transfer Field data - call ESMF_FieldGet(is%wrap%fieldTrans, farrayPtr=dataTransPtr, rc=rc) + call ESMF_FieldGet(is%wrap%fieldTrans, farrayPtr=dataTransPtr, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -639,7 +599,7 @@ subroutine ModelAdvance(model, rc) dataPtr(i,j) = dataTransPtr(i,j) enddo enddo - + endif ! -> get the time step of the internal model Clock -->> dt @@ -658,7 +618,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! -> get x-coordinates from Grid to determine spacing -->> dx call ESMF_GridGetCoord(is%wrap%grid, coordDim=1, farrayPtr=coordPtr, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -666,21 +626,21 @@ subroutine ModelAdvance(model, rc) file=__FILE__)) & return ! bail out dx = coordPtr(lbound(coordPtr,1)+1) - coordPtr(lbound(coordPtr,1)) - + ! -> get pointer to Field data - call ESMF_FieldGet(is%wrap%field, farrayPtr=dataPtr, rc=rc) + call ESMF_FieldGet(is%wrap%field, farrayPtr=dataPtr, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return - + ! -> first update the halo region on each DE call ESMF_FieldHalo(is%wrap%field, routehandle=is%wrap%haloHandle, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return - + ! -> then apply simple forward Euler solver do j=lbound(dataPtr,2)+jHaloDepth, ubound(dataPtr,2)-jHaloDepth up1Flag = .false. @@ -701,7 +661,7 @@ subroutine ModelAdvance(model, rc) dataPtr(i-2,j) = up2Data dataPtr(i-1,j) = up1Data enddo - + ! see if it is time to write for I/O if (ESMF_AlarmIsRinging(is%wrap%timeToWriteAlarm)) then ! -> finally write a new timeslice to file @@ -729,7 +689,59 @@ subroutine ModelAdvance(model, rc) ! advance the time slice counter is%wrap%slice = is%wrap%slice + 1 endif - + end subroutine + !----------------------------------------------------------------------------- + + subroutine Finalize(model, rc) + type(ESMF_GridComp) :: model + integer, intent(out) :: rc + + ! local variables + type(InternalState) :: is + integer :: stat + + rc = ESMF_SUCCESS + + ! -> get internal state from Component + nullify(is%wrap) + call ESMF_GridCompGetInternalState(model, is, rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! -> destroy objects inside of internal state + + call ESMF_FieldHaloRelease(routehandle=is%wrap%haloHandle, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return + + call ESMF_FieldDestroy(is%wrap%field, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return + + call ESMF_GridDestroy(is%wrap%grid, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return + + ! -> deallocate internal state memory + deallocate(is%wrap, stat=stat) + if (ESMF_LogFoundDeallocError(statusToCheck=stat, & + msg="Deallocation of internal state memory failed.", & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + end subroutine + + !----------------------------------------------------------------------------- + end module diff --git a/NestingSingleProto/driverComp.F90 b/NestingSingleProto/driverComp.F90 index a6e6114c..f8886df6 100644 --- a/NestingSingleProto/driverComp.F90 +++ b/NestingSingleProto/driverComp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,25 +17,24 @@ module driverComp use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices - + driverSS => SetServices + use advectDiffComp, only: & advectDiff_SS => SetServices - + use NUOPC_Connector, only: cplSS => SetServices implicit none - + private - + ! private module data --> ONLY PARAMETERS integer, parameter :: stepCount = 1000 real(ESMF_KIND_R8), parameter :: stepTime = 30.D0 ! step time [s] ! should be parent step - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -43,24 +42,31 @@ module driverComp subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & + + ! specialize driver + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out + ! set driver verbosity + call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + end subroutine !----------------------------------------------------------------------------- @@ -68,7 +74,7 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables type(ESMF_Grid) :: grid type(ESMF_Field) :: field @@ -83,7 +89,7 @@ subroutine SetModelServices(driver, rc) rc = ESMF_SUCCESS - ! get petCount + ! get petCount call ESMF_GridCompGet(driver, petCount=petCount, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -116,7 +122,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for NEST DOMAIN advectDiffComp allocate(petList(petCount/2)) do i=1, petCount/2 @@ -189,13 +195,15 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/NestingSingleProto/mainApp.F90 b/NestingSingleProto/mainApp.F90 index 2c9040d1..b4b352a4 100644 --- a/NestingSingleProto/mainApp.F90 +++ b/NestingSingleProto/mainApp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -16,12 +16,12 @@ program mainApp use ESMF use NUOPC - + use driverComp, only: & driver_SS => SetServices implicit none - + integer :: rc, userRc type(ESMF_GridComp) :: driver @@ -31,7 +31,7 @@ program mainApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("mainApp STARTING", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -55,7 +55,7 @@ program mainApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! -> SET DRIVER SERVICES call ESMF_GridCompSetServices(driver, driver_SS, userRc=userRc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -77,7 +77,7 @@ program mainApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! RUN THE DRIVER call ESMF_GridCompRun(driver, userRc=userRc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -88,7 +88,7 @@ program mainApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! FINALIZE THE DRIVER call ESMF_GridCompFinalize(driver, userRc=userRc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -101,7 +101,7 @@ program mainApp call ESMF_Finalize(endflag=ESMF_END_ABORT) !----------------------------------------------------------------------------- - + call ESMF_LogWrite("mainApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -110,5 +110,5 @@ program mainApp ! Finalize ESMF call ESMF_Finalize() - -end program + +end program diff --git a/NestingTelescopeMultipleProto/advectDiffComp.F90 b/NestingTelescopeMultipleProto/advectDiffComp.F90 index 42910ba2..2c9ec59e 100644 --- a/NestingTelescopeMultipleProto/advectDiffComp.F90 +++ b/NestingTelescopeMultipleProto/advectDiffComp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -13,13 +13,10 @@ module advectDiffComp use ESMF use NUOPC use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_SetClock => label_SetClock, & - model_label_Advance => label_Advance, & - model_label_CheckImport => label_CheckImport - + modelSS => SetServices + implicit none - + private ! private module data --> ONLY PARAMETERS @@ -72,71 +69,77 @@ module advectDiffComp subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=RealizeProvided, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_FINALIZE, & - phaseLabelList=(/""/), userRoutine=Finalize, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & + specRoutine=SetClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_SetClock, & - specRoutine=SetClock, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_CheckImport, & + specRoutine=CheckImport, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_CheckImport, & - specPhaseLabel="RunPhase1", specRoutine=CheckImport, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Finalize, & + specRoutine=Finalize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - integer :: nestingGeneration + + ! local variables + type(ESMF_State) :: importState, exportState + integer :: nestingGeneration rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! look at the "NestingGeneration" Attribute of this instance call NUOPC_CompAttributeGet(model, name="NestingGeneration", & value=nestingGeneration, rc=rc) @@ -168,12 +171,12 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine RealizeProvided(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState type(InternalState) :: is real(ESMF_KIND_R8), pointer :: coordPtr(:) real(ESMF_KIND_R8), pointer :: dataPtr(:,:) @@ -184,6 +187,14 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) rc = ESMF_SUCCESS + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! look at the "NestingGeneration" Attribute of this instance call NUOPC_CompAttributeGet(model, name="NestingGeneration", & value=nestingGeneration, rc=rc) @@ -552,57 +563,6 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) !----------------------------------------------------------------------------- - subroutine Finalize(model, importState, exportState, clock, rc) - type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - type(InternalState) :: is - integer :: stat - - rc = ESMF_SUCCESS - - ! -> get internal state from Component - nullify(is%wrap) - call ESMF_GridCompGetInternalState(model, is, rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! -> destroy objects inside of internal state - - call ESMF_FieldHaloRelease(routehandle=is%wrap%haloHandle, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return - - call ESMF_FieldDestroy(is%wrap%field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return - - call ESMF_GridDestroy(is%wrap%grid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return - - ! -> deallocate internal state memory - deallocate(is%wrap, stat=stat) - if (ESMF_LogFoundDeallocError(statusToCheck=stat, & - msg="Deallocation of internal state memory failed.", & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - subroutine SetClock(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc @@ -740,7 +700,7 @@ subroutine SetClock(model, rc) !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc @@ -765,7 +725,7 @@ subroutine ModelAdvance(model, rc) ! timeStep than the parent's timeStep on the incoming Clock, which is ! equal to the coupling timeStep. - ! access exportState + ! query for exportState call NUOPC_ModelGet(model, exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -987,4 +947,54 @@ subroutine CheckImport(gcomp, rc) !----------------------------------------------------------------------------- + subroutine Finalize(model, rc) + type(ESMF_GridComp) :: model + integer, intent(out) :: rc + + ! local variables + type(InternalState) :: is + integer :: stat + + rc = ESMF_SUCCESS + + ! -> get internal state from Component + nullify(is%wrap) + call ESMF_GridCompGetInternalState(model, is, rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! -> destroy objects inside of internal state + + call ESMF_FieldHaloRelease(routehandle=is%wrap%haloHandle, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return + + call ESMF_FieldDestroy(is%wrap%field, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return + + call ESMF_GridDestroy(is%wrap%grid, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return + + ! -> deallocate internal state memory + deallocate(is%wrap, stat=stat) + if (ESMF_LogFoundDeallocError(statusToCheck=stat, & + msg="Deallocation of internal state memory failed.", & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + end subroutine + + !----------------------------------------------------------------------------- + end module diff --git a/NestingTelescopeMultipleProto/driverComp.F90 b/NestingTelescopeMultipleProto/driverComp.F90 index a572bece..0a2e8b96 100644 --- a/NestingTelescopeMultipleProto/driverComp.F90 +++ b/NestingTelescopeMultipleProto/driverComp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,28 +17,26 @@ module driverComp use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices, & - driver_label_SetRunSequence => label_SetRunSequence - + driverSS => SetServices + use advectDiffComp, only: & advectDiff_SS => SetServices - + use NUOPC_Connector, only: cplSS => SetServices implicit none - + private - + ! private module data --> ONLY PARAMETERS integer, parameter :: stepCount = 1000 real(ESMF_KIND_R8), parameter :: stepTime = 30.D0 ! step time [s] ! should be parent step - + real(ESMF_KIND_R8), parameter :: childSteps = 3.D0 ! child steps per parent step public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -46,30 +44,37 @@ module driverComp subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & + + ! specialize driver + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetRunSequence, & + call NUOPC_CompSpecialize(driver, specLabel=label_SetRunSequence, & specRoutine=SetRunSequence, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out + ! set driver verbosity + call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + end subroutine !----------------------------------------------------------------------------- @@ -77,7 +82,7 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables type(ESMF_Grid) :: grid type(ESMF_Field) :: field @@ -92,7 +97,7 @@ subroutine SetModelServices(driver, rc) rc = ESMF_SUCCESS - ! get petCount + ! get petCount call ESMF_GridCompGet(driver, petCount=petCount, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -125,7 +130,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for NEST DOMAIN advectDiffComp allocate(petList(petCount/2)) do i=1, petCount/2 @@ -244,13 +249,13 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine !----------------------------------------------------------------------------- @@ -258,7 +263,7 @@ subroutine SetModelServices(driver, rc) subroutine SetRunSequence(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables character(ESMF_MAXSTR) :: name type(NUOPC_FreeFormat) :: runSeqFF @@ -268,12 +273,12 @@ subroutine SetRunSequence(driver, rc) type(ESMF_Clock) :: internalClock rc = ESMF_SUCCESS - + ! query the driver for its name call ESMF_GridCompGet(driver, name=name, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - + ! set up free format run sequence runSeqFF = NUOPC_FreeFormatCreate(stringList=(/ & " @* ", & diff --git a/NestingTelescopeMultipleProto/mainApp.F90 b/NestingTelescopeMultipleProto/mainApp.F90 index 2c9040d1..b4b352a4 100644 --- a/NestingTelescopeMultipleProto/mainApp.F90 +++ b/NestingTelescopeMultipleProto/mainApp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -16,12 +16,12 @@ program mainApp use ESMF use NUOPC - + use driverComp, only: & driver_SS => SetServices implicit none - + integer :: rc, userRc type(ESMF_GridComp) :: driver @@ -31,7 +31,7 @@ program mainApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("mainApp STARTING", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -55,7 +55,7 @@ program mainApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! -> SET DRIVER SERVICES call ESMF_GridCompSetServices(driver, driver_SS, userRc=userRc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -77,7 +77,7 @@ program mainApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! RUN THE DRIVER call ESMF_GridCompRun(driver, userRc=userRc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -88,7 +88,7 @@ program mainApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! FINALIZE THE DRIVER call ESMF_GridCompFinalize(driver, userRc=userRc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -101,7 +101,7 @@ program mainApp call ESMF_Finalize(endflag=ESMF_END_ABORT) !----------------------------------------------------------------------------- - + call ESMF_LogWrite("mainApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -110,5 +110,5 @@ program mainApp ! Finalize ESMF call ESMF_Finalize() - -end program + +end program diff --git a/SingleModelOpenMPProto/driver.F90 b/SingleModelOpenMPProto/driver.F90 index 4e99623d..94be934f 100644 --- a/SingleModelOpenMPProto/driver.F90 +++ b/SingleModelOpenMPProto/driver.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -18,24 +18,23 @@ module driver use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices - + driverSS => SetServices + use MODEL, only: & modelSS => SetServices, & modelSVM => SetVM - + implicit none - + private - + ! private module data --> ONLY PARAMETERS integer, parameter :: stepCount = 5 real(ESMF_KIND_R8), parameter :: stepTime = 30.D0 ! step time [s] ! should be parent step public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -43,18 +42,18 @@ module driver subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & + + ! specialize driver + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -75,7 +74,7 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables type(ESMF_GridComp) :: child type(ESMF_CplComp) :: connector @@ -84,7 +83,7 @@ subroutine SetModelServices(driver, rc) type(ESMF_TimeInterval) :: timeStep type(ESMF_Clock) :: internalClock type(ESMF_Info) :: info - + ! - diagnostics - type(ESMF_VM) :: vm logical :: isFlag @@ -105,7 +104,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! SetServices for MODEL component call NUOPC_DriverAddComp(driver, "MODEL", modelSS, modelSVM, info=info, & comp=child, rc=rc) @@ -118,7 +117,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! - diagnostics - isFlag = ESMF_GridCompIsPetLocal(child, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -131,8 +130,8 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - - call ESMF_GridCompGet(child, vm=vm, rc=rc) + + call ESMF_GridCompGet(child, vm=vm, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -149,13 +148,13 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_VMGet(vm, mpiCommunicator=mpiComm, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + if (mpiComm==MPI_COMM_NULL) then write(msgString,*) "MPI_COMM_NULL" else @@ -193,13 +192,15 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/SingleModelOpenMPProto/mainApp.F90 b/SingleModelOpenMPProto/mainApp.F90 index ca55da2a..dcac5820 100644 --- a/SingleModelOpenMPProto/mainApp.F90 +++ b/SingleModelOpenMPProto/mainApp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -20,7 +20,7 @@ program mainApp driver_SS => SetServices implicit none - + integer :: rc, userRc type(ESMF_GridComp) :: drvComp @@ -30,28 +30,22 @@ program mainApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - - call ESMF_LogSet(flush=.true., rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) call ESMF_LogWrite("mainApp STARTING", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + !----------------------------------------------------------------------------- - + ! -> CREATE THE DRIVER drvComp = ESMF_GridCompCreate(name="driver", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! -> SET DRIVER SERVICES call ESMF_GridCompSetServices(drvComp, driver_SS, userRc=userRc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -73,7 +67,7 @@ program mainApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! RUN THE DRIVER call ESMF_GridCompRun(drvComp, userRc=userRc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -84,7 +78,7 @@ program mainApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! FINALIZE THE DRIVER call ESMF_GridCompFinalize(drvComp, userRc=userRc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -97,7 +91,7 @@ program mainApp call ESMF_Finalize(endflag=ESMF_END_ABORT) !----------------------------------------------------------------------------- - + call ESMF_LogWrite("mainApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -106,5 +100,5 @@ program mainApp ! Finalize ESMF call ESMF_Finalize() - -end program + +end program diff --git a/SingleModelOpenMPProto/model.F90 b/SingleModelOpenMPProto/model.F90 index f4279c8e..32c824ac 100644 --- a/SingleModelOpenMPProto/model.F90 +++ b/SingleModelOpenMPProto/model.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -16,103 +16,79 @@ module MODEL use ESMF use NUOPC - use NUOPC_Model, only: & - SetVM, & - model_routine_SS => SetServices, & - model_label_DataInitialize => label_DataInitialize, & - model_label_Advance => label_Advance - + use NUOPC_Model, & + modelSS => SetServices + implicit none - + private - + public SetVM, SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - - subroutine SetServices(model, rc) + + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! -> switching to IPD version to demonstrate DataInitialize - call ESMF_GridCompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - userRoutine=InitializeP0, phase=0, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv02p1"/), userRoutine=InitializeAdvertise, rc=rc) + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv02p3"/), userRoutine=InitializeRealize, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_DataInitialize, & + call NUOPC_CompSpecialize(model, specLabel=label_DataInitialize, & specRoutine=DataInitialize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP0(model, importState, exportState, clock, rc) - type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - + subroutine Advertise(model, rc) + type(ESMF_GridComp) :: model + integer, intent(out) :: rc + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - ! Switch to IPDv02 by filtering all other phaseMap entries - call NUOPC_CompFilterPhaseMap(model, ESMF_METHOD_INITIALIZE, & - acceptStringList=(/"IPDv02p"/), rc=rc) + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - subroutine InitializeAdvertise(model, importState, exportState, clock, rc) - type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - ! Enabeling the following macro, i.e. renaming it to WITHIMPORTFIELDS, ! will result in a model component that advertise import Field dependencies. ! In the single model case, where there isn't another model to satisfy these @@ -127,7 +103,7 @@ subroutine InitializeAdvertise(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out #endif - + ! exportable field: air_pressure_at_sea_level call NUOPC_Advertise(exportState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -135,7 +111,7 @@ subroutine InitializeAdvertise(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -145,22 +121,29 @@ subroutine InitializeAdvertise(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeRealize(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/10, 100/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -213,7 +196,7 @@ subroutine InitializeRealize(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_VMLogMemInfo(prefix="After Realize:", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -227,9 +210,9 @@ subroutine InitializeRealize(model, importState, exportState, clock, rc) subroutine DataInitialize(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + integer, save :: inHere=1 - + rc = ESMF_SUCCESS if (inHere > 1) then @@ -241,18 +224,18 @@ subroutine DataInitialize(model, rc) file=__FILE__)) & return ! bail out endif - + inHere = inHere + 1 - + end subroutine !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) !$ use omp_lib type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState @@ -261,16 +244,16 @@ subroutine ModelAdvance(model, rc) character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call ESMF_GridCompGet(model, clock=clock, importState=importState, & exportState=exportState, vm=vm, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! Query the VM of the component for the localPeCount and set OpenMP + + ! Query the VM of the component for the localPeCount and set OpenMP ! num_threads accordingly. call ESMF_VMGet(vm, localPet=localPet, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -301,12 +284,12 @@ subroutine ModelAdvance(model, rc) !$omp end parallel ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set by default, ! its timeStep is equal to the parent timeStep. As a consequence the ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. - + ! for this call of the Advance() routine. + call ESMF_ClockPrint(clock, options="currTime", & preString="---->Advancing Model from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -318,7 +301,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -333,4 +316,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/SingleModelProto/driver.F90 b/SingleModelProto/driver.F90 index f39606a3..1c0bbb0d 100644 --- a/SingleModelProto/driver.F90 +++ b/SingleModelProto/driver.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -17,22 +17,21 @@ module driver use ESMF use NUOPC use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices - + driverSS => SetServices + use MODEL, only: modelSS => SetServices - + implicit none - + private - + ! private module data --> ONLY PARAMETERS integer, parameter :: stepCount = 5 real(ESMF_KIND_R8), parameter :: stepTime = 30.D0 ! step time [s] ! should be parent step public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -40,18 +39,18 @@ module driver subroutine SetServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & + + ! specialize driver + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & specRoutine=SetModelServices, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -59,7 +58,7 @@ subroutine SetServices(driver, rc) return ! bail out ! set driver verbosity - call NUOPC_CompAttributeSet(driver, name="Verbosity", value="low", rc=rc) + call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -72,7 +71,7 @@ subroutine SetServices(driver, rc) subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: driver integer, intent(out) :: rc - + ! local variables type(ESMF_GridComp) :: child type(ESMF_CplComp) :: connector @@ -82,7 +81,7 @@ subroutine SetModelServices(driver, rc) type(ESMF_Clock) :: internalClock rc = ESMF_SUCCESS - + ! SetServices for MODEL component call NUOPC_DriverAddComp(driver, "MODEL", modelSS, comp=child, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -94,7 +93,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! set the driver clock call ESMF_TimeSet(startTime, s = 0, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -120,13 +119,15 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/SingleModelProto/mainApp.F90 b/SingleModelProto/mainApp.F90 index e05a761b..dcac5820 100644 --- a/SingleModelProto/mainApp.F90 +++ b/SingleModelProto/mainApp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -20,7 +20,7 @@ program mainApp driver_SS => SetServices implicit none - + integer :: rc, userRc type(ESMF_GridComp) :: drvComp @@ -30,22 +30,22 @@ program mainApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + call ESMF_LogWrite("mainApp STARTING", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + !----------------------------------------------------------------------------- - + ! -> CREATE THE DRIVER drvComp = ESMF_GridCompCreate(name="driver", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! -> SET DRIVER SERVICES call ESMF_GridCompSetServices(drvComp, driver_SS, userRc=userRc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -67,7 +67,7 @@ program mainApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! RUN THE DRIVER call ESMF_GridCompRun(drvComp, userRc=userRc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -78,7 +78,7 @@ program mainApp line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - + ! FINALIZE THE DRIVER call ESMF_GridCompFinalize(drvComp, userRc=userRc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -91,7 +91,7 @@ program mainApp call ESMF_Finalize(endflag=ESMF_END_ABORT) !----------------------------------------------------------------------------- - + call ESMF_LogWrite("mainApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -100,5 +100,5 @@ program mainApp ! Finalize ESMF call ESMF_Finalize() - -end program + +end program diff --git a/SingleModelProto/model.F90 b/SingleModelProto/model.F90 index 82a563eb..6c6832f4 100644 --- a/SingleModelProto/model.F90 +++ b/SingleModelProto/model.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== @@ -16,67 +16,73 @@ module MODEL use ESMF use NUOPC - use NUOPC_Model, only: & - model_routine_SS => SetServices, & - model_label_Advance => label_Advance - + use NUOPC_Model, & + modelSS => SetServices + implicit none - + private - + public SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- - + subroutine SetServices(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - + end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP1(model, importState, exportState, clock, rc) + subroutine Advertise(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - + + ! local variables + type(ESMF_State) :: importState, exportState + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! Enabeling the following macro, i.e. renaming it to WITHIMPORTFIELDS, ! will result in a model component that advertise import Field dependencies. ! In the single model case, where there isn't another model to satisfy these @@ -91,7 +97,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) file=__FILE__)) & return ! bail out #endif - + ! exportable field: air_pressure_at_sea_level call NUOPC_Advertise(exportState, & StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) @@ -99,7 +105,7 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + ! exportable field: surface_net_downward_shortwave_flux call NUOPC_Advertise(exportState, & StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) @@ -109,22 +115,29 @@ subroutine InitializeP1(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine InitializeP2(model, importState, exportState, clock, rc) + subroutine Realize(model, rc) type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock integer, intent(out) :: rc - - ! local variables + + ! local variables + type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - + rc = ESMF_SUCCESS - + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! create a Grid object for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/10, 100/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & @@ -179,21 +192,21 @@ subroutine InitializeP2(model, importState, exportState, clock, rc) return ! bail out end subroutine - + !----------------------------------------------------------------------------- - subroutine ModelAdvance(model, rc) + subroutine Advance(model, rc) type(ESMF_GridComp) :: model integer, intent(out) :: rc - + ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState character(len=160) :: msgString rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState + + ! query for clock, importState and exportState call ESMF_GridCompGet(model, clock=clock, importState=importState, & exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -202,12 +215,12 @@ subroutine ModelAdvance(model, rc) return ! bail out ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - + ! Because of the way that the internal Clock was set by default, ! its timeStep is equal to the parent timeStep. As a consequence the ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. - + ! for this call of the Advance() routine. + call ESMF_ClockPrint(clock, options="currTime", & preString="---->Advancing Model from: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -219,7 +232,7 @@ subroutine ModelAdvance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - + call ESMF_ClockPrint(clock, options="stopTime", & preString="---------------------> to: ", unit=msgString, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -234,4 +247,6 @@ subroutine ModelAdvance(model, rc) end subroutine + !----------------------------------------------------------------------------- + end module diff --git a/testProtos.sh b/testProtos.sh index 9f5de611..43a1a8f0 100755 --- a/testProtos.sh +++ b/testProtos.sh @@ -287,7 +287,7 @@ TestProto AtmOcnTransferMeshProto esmApp TestExplorer ComponentExplorer nuopcExplorerApp TestProto CustomFieldDictionaryProto mainApp TestProto DriverInDriverProto mainApp -TestProto DriverInDriverProtoIPDv02 mainApp +TestProto DriverInDriverDataDepProto mainApp TestProto DynPhyProto esmApp TestProto ExternalDriverAPIProto externalApp TestProto GenericMediatorProto app From c765e6e4d89a2836a2217407fc79a37799902a4c Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Tue, 18 Aug 2020 10:05:42 -0700 Subject: [PATCH 21/68] Update list of files to be ignored. --- .gitignore | 58 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 24 deletions(-) diff --git a/.gitignore b/.gitignore index dbc5b4fd..37c484bb 100644 --- a/.gitignore +++ b/.gitignore @@ -430,6 +430,11 @@ AtmOcnSimpleImplicitProto/esmApp.o AtmOcnSimpleImplicitProto/esmApp.stdout AtmOcnSimpleImplicitProto/ocn.mod AtmOcnSimpleImplicitProto/ocn.o +AtmOcnTransferGridProto/ATM-accepted-Grid-pmsl_centers.vtk +AtmOcnTransferGridProto/ATM-accepted-Grid-ssh_centers.vtk +AtmOcnTransferGridProto/OCN-GridAux_centers.vtk +AtmOcnTransferGridProto/OCN-GridCS_centers.vtk +AtmOcnTransferGridProto/OCN-GridIn_centers.vtk AtmOcnTransferGridProto/ATM-accepted-Grid-pmsl_centers.2.0.vtk AtmOcnTransferGridProto/ATM-accepted-Grid-pmsl_centers.2.1.vtk AtmOcnTransferGridProto/ATM-accepted-Grid-ssh_centers.2.0.vtk @@ -556,26 +561,26 @@ DriverInDriverProto/mainApp.o DriverInDriverProto/mainApp.stdout DriverInDriverProto/ocn.mod DriverInDriverProto/ocn.o -DriverInDriverProtoIPDv02/PET0.ESMF_LogFile -DriverInDriverProtoIPDv02/PET1.ESMF_LogFile -DriverInDriverProtoIPDv02/PET2.ESMF_LogFile -DriverInDriverProtoIPDv02/PET3.ESMF_LogFile -DriverInDriverProtoIPDv02/atm.mod -DriverInDriverProtoIPDv02/atm.o -DriverInDriverProtoIPDv02/driverChildComp.o -DriverInDriverProtoIPDv02/driverParentComp.o -DriverInDriverProtoIPDv02/driverchildcomp.mod -DriverInDriverProtoIPDv02/driverparentcomp.mod -DriverInDriverProtoIPDv02/field_atm_export_adv_pmsl.nc -DriverInDriverProtoIPDv02/field_atm_export_adv_rsns.nc -DriverInDriverProtoIPDv02/field_atm_import_adv_sst.nc -DriverInDriverProtoIPDv02/field_atm_import_datainit_sst.nc -DriverInDriverProtoIPDv02/field_ocn_export_datainit_sst.nc -DriverInDriverProtoIPDv02/mainApp -DriverInDriverProtoIPDv02/mainApp.o -DriverInDriverProtoIPDv02/mainApp.stdout -DriverInDriverProtoIPDv02/ocn.mod -DriverInDriverProtoIPDv02/ocn.o +DriverInDriverDataDepProto/PET0.ESMF_LogFile +DriverInDriverDataDepProto/PET1.ESMF_LogFile +DriverInDriverDataDepProto/PET2.ESMF_LogFile +DriverInDriverDataDepProto/PET3.ESMF_LogFile +DriverInDriverDataDepProto/atm.mod +DriverInDriverDataDepProto/atm.o +DriverInDriverDataDepProto/driverChildComp.o +DriverInDriverDataDepProto/driverParentComp.o +DriverInDriverDataDepProto/driverchildcomp.mod +DriverInDriverDataDepProto/driverparentcomp.mod +DriverInDriverDataDepProto/field_atm_export_adv_pmsl.nc +DriverInDriverDataDepProto/field_atm_export_adv_rsns.nc +DriverInDriverDataDepProto/field_atm_import_adv_sst.nc +DriverInDriverDataDepProto/field_atm_import_datainit_sst.nc +DriverInDriverDataDepProto/field_ocn_export_datainit_sst.nc +DriverInDriverDataDepProto/mainApp +DriverInDriverDataDepProto/mainApp.o +DriverInDriverDataDepProto/mainApp.stdout +DriverInDriverDataDepProto/ocn.mod +DriverInDriverDataDepProto/ocn.o DynPhyProto/PET0.ESMF_LogFile DynPhyProto/PET1.ESMF_LogFile DynPhyProto/PET2.ESMF_LogFile @@ -584,10 +589,15 @@ DynPhyProto/atm.mod DynPhyProto/atm.o DynPhyProto/diagnostic_DYN_Finalize_enter_import_2010_06_01_01_00_00_000_phyex_field.nc DynPhyProto/diagnostic_DYN_Finalize_exit_import_2010_06_01_01_00_00_000_phyex_field.nc -DynPhyProto/diagnostic_DYN_InitializeP3_enter_import_2010_06_01_00_00_00_000_phyex_field.nc -DynPhyProto/diagnostic_DYN_InitializeP3_exit_import_2010_06_01_00_00_00_000_phyex_field.nc -DynPhyProto/diagnostic_DYN_InitializeP5_enter_import_2010_06_01_00_00_00_000_phyex_field.nc -DynPhyProto/diagnostic_DYN_InitializeP5_exit_import_2010_06_01_00_00_00_000_phyex_field.nc +DynPhyProto/diagnostic_DYN_InitializeIPDvXp04_exit_import_2010_06_01_00_00_00_000_phyex_field.nc +DynPhyProto/diagnostic_DYN_InitializeIPDvXp07_enter_import_2010_06_01_00_00_00_000_phyex_field.nc +DynPhyProto/diagnostic_DYN_InitializeIPDvXp07_exit_import_2010_06_01_00_00_00_000_phyex_field.nc +DynPhyProto/diagnostic_DYN_InitializeIPDvXp08_enter_import_2010_06_01_00_00_00_000_phyex_field.nc +DynPhyProto/diagnostic_DYN_InitializeIPDvXp08_exit_import_2010_06_01_00_00_00_000_phyex_field.nc +DynPhyProto/diagnostic_PHY_InitializeIPDvXp07_enter_export_2010_06_01_00_00_00_000_PHYEX.nc +DynPhyProto/diagnostic_PHY_InitializeIPDvXp07_exit_export_2010_06_01_00_00_00_000_PHYEX.nc +DynPhyProto/diagnostic_PHY_InitializeIPDvXp08_enter_export_2010_06_01_00_00_00_000_PHYEX.nc +DynPhyProto/diagnostic_PHY_InitializeIPDvXp08_exit_export_2010_06_01_00_00_00_000_PHYEX.nc DynPhyProto/diagnostic_DYN_Run_enter_import_2010_06_01_00_00_00_000_phyex_field.nc DynPhyProto/diagnostic_DYN_Run_enter_import_2010_06_01_00_15_00_000_phyex_field.nc DynPhyProto/diagnostic_DYN_Run_enter_import_2010_06_01_00_30_00_000_phyex_field.nc From 5332e2758587b66d11194dae7365faa503d0fab5 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Tue, 18 Aug 2020 10:06:43 -0700 Subject: [PATCH 22/68] Remove outdated and unsupported prototype examples. --- PerformanceConnectorProto/Makefile | 73 ------- PerformanceConnectorProto/README | 29 --- PerformanceConnectorProto/atm.F90 | 209 ------------------ PerformanceConnectorProto/conn.F90 | 162 -------------- PerformanceConnectorProto/esm.F90 | 273 ----------------------- PerformanceConnectorProto/esmApp.F90 | 124 ----------- PerformanceConnectorProto/ocn.F90 | 262 ---------------------- PerformanceRunSequenceProto/Makefile | 73 ------- PerformanceRunSequenceProto/README | 26 --- PerformanceRunSequenceProto/driver.F90 | 260 ---------------------- PerformanceRunSequenceProto/mainApp.F90 | 175 --------------- PerformanceRunSequenceProto/model.F90 | 279 ------------------------ 12 files changed, 1945 deletions(-) delete mode 100644 PerformanceConnectorProto/Makefile delete mode 100644 PerformanceConnectorProto/README delete mode 100644 PerformanceConnectorProto/atm.F90 delete mode 100644 PerformanceConnectorProto/conn.F90 delete mode 100644 PerformanceConnectorProto/esm.F90 delete mode 100644 PerformanceConnectorProto/esmApp.F90 delete mode 100644 PerformanceConnectorProto/ocn.F90 delete mode 100644 PerformanceRunSequenceProto/Makefile delete mode 100644 PerformanceRunSequenceProto/README delete mode 100644 PerformanceRunSequenceProto/driver.F90 delete mode 100644 PerformanceRunSequenceProto/mainApp.F90 delete mode 100644 PerformanceRunSequenceProto/model.F90 diff --git a/PerformanceConnectorProto/Makefile b/PerformanceConnectorProto/Makefile deleted file mode 100644 index 1deea26a..00000000 --- a/PerformanceConnectorProto/Makefile +++ /dev/null @@ -1,73 +0,0 @@ -# GNU Makefile template for user ESMF application - -################################################################################ -################################################################################ -## This Makefile must be able to find the "esmf.mk" Makefile fragment in the ## -## 'include' line below. Following the ESMF User's Guide, a complete ESMF ## -## installation should ensure that a single environment variable "ESMFMKFILE" ## -## is made available on the system. This variable should point to the ## -## "esmf.mk" file. ## -## ## -## This example Makefile uses the "ESMFMKFILE" environment variable. ## -## ## -## If you notice that this Makefile cannot find variable ESMFMKFILE then ## -## please contact the person responsible for the ESMF installation on your ## -## system. ## -## As a work-around you can simply hardcode the path to "esmf.mk" in the ## -## include line below. However, doing so will render this Makefile a lot less ## -## flexible and non-portable. ## -################################################################################ - -ifneq ($(origin ESMFMKFILE), environment) -$(error Environment variable ESMFMKFILE was not set.) -endif - -include $(ESMFMKFILE) - -################################################################################ -################################################################################ - -.SUFFIXES: .f90 .F90 .c .C - -%.o : %.f90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREENOCPP) $< - -%.o : %.F90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $< - -%.o : %.c - $(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< - -%.o : %.C - $(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< - - -# ----------------------------------------------------------------------------- -esmApp: esmApp.o esm.o atm.o ocn.o conn.o - $(ESMF_F90LINKER) $(ESMF_F90LINKOPTS) $(ESMF_F90LINKPATHS) $(ESMF_F90LINKRPATHS) -o $@ $^ $(ESMF_F90ESMFLINKLIBS) - -# module dependencies: -esmApp.o: esm.o -esm.o: atm.o ocn.o conn.o - -# ----------------------------------------------------------------------------- -# ----------------------------------------------------------------------------- -.PHONY: dust clean distclean info edit -dust: - rm -f PET*.ESMF_LogFile *.nc *.stdout -clean: - rm -f esmApp *.o *.mod -distclean: dust clean - -info: - @echo ================================================================== - @echo ESMFMKFILE=$(ESMFMKFILE) - @echo ================================================================== - @cat $(ESMFMKFILE) - @echo ================================================================== - -edit: - nedit esmApp.F90 esm.F90 atm.F90 ocn.F90 conn.F90 & - -run: - mpirun -np 4 ./esmApp diff --git a/PerformanceConnectorProto/README b/PerformanceConnectorProto/README deleted file mode 100644 index 4de60267..00000000 --- a/PerformanceConnectorProto/README +++ /dev/null @@ -1,29 +0,0 @@ -README for NUOPC Connector performance test prototype ------------------------------------------------------ - -Dependencies: - - ESMF v7.0.0 beta - -Build: - - Set environment variable ESMFMKFILE to point to the esmf.mk of your ESMF - installation. - - gmake - -Execution: - - Optionally set environment variable ESMF_RUNTIME_COMPLIANCECHECK to ON. - - mpirun -np X ./esmApp (where X is the total number of PETs) - -Output: - - PET*.Log files containing compliance checker output if turned on. - - The prototype outputs time stepping information to stdout. - - - -Code structure: - - Makefile - Makefile that is based on the standard esmf.mk mechanism. - - atm.F90 - The ATM component, specializing generic NUOPC_Model. - - ocn.F90 - The OCN component, specializing generic NUOPC_Model. - - con.F90 - The Connector component, specializing generic NUOPC_Connector. - - esm.F90 - The Earth System Model (ESM) component, specializing generic - NUOPC_Driver. - - esmApp.F90 - ESM driver application. diff --git a/PerformanceConnectorProto/atm.F90 b/PerformanceConnectorProto/atm.F90 deleted file mode 100644 index d406e3e1..00000000 --- a/PerformanceConnectorProto/atm.F90 +++ /dev/null @@ -1,209 +0,0 @@ -!============================================================================== -! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, -! NASA Goddard Space Flight Center. -! Licensed under the University of Illinois-NCSA License. -!============================================================================== - -module ATM - - !----------------------------------------------------------------------------- - ! ATM Component. - !----------------------------------------------------------------------------- - - use ESMF - use NUOPC - use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_Advance => label_Advance - - implicit none - - private - - public SetServices - - ! - module parameter - integer, parameter :: importFieldCount = 20 - integer, parameter :: exportFieldCount = 20 - - !----------------------------------------------------------------------------- - contains - !----------------------------------------------------------------------------- - - subroutine SetServices(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine InitializeP1(model, importState, exportState, clock, rc) - type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - ! local variables - integer :: i - character(len=40) :: fieldName - - rc = ESMF_SUCCESS - - ! Import Fields - do i=1, importFieldCount - write(fieldName, "(A, I3.3)") "field_ocn2atm_", i - call NUOPC_Advertise(importState, & - StandardName=fieldName, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - enddo - - ! Export Fields - do i=1, exportFieldCount - write(fieldName, "(A, I3.3)") "field_atm2ocn_", i - call NUOPC_Advertise(exportState, & - StandardName=fieldName, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - enddo - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine InitializeP2(model, importState, exportState, clock, rc) - type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - ! local variables - type(ESMF_Field) :: field - type(ESMF_Grid) :: gridIn - type(ESMF_Grid) :: gridOut - - rc = ESMF_SUCCESS - - ! create a Grid object for Fields - gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/10, 100/), & - minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & - maxCornerCoord=(/100._ESMF_KIND_R8, 200._ESMF_KIND_R8/), & - coordSys=ESMF_COORDSYS_CART, staggerLocList=(/ESMF_STAGGERLOC_CENTER/), & - rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - gridOut = gridIn ! for now out same as in - - ! Import Fields - call NUOPC_Realize(importState, gridIn, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! Export Fields - call NUOPC_Realize(exportState, gridOut, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine ModelAdvance(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - ! local variables - type(ESMF_Clock) :: clock - type(ESMF_State) :: importState, exportState - character(len=160) :: msgString - - rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState - call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & - exportState=exportState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - - ! Because of the way that the internal Clock was set by default, - ! its timeStep is equal to the parent timeStep. As a consequence the - ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. - - call ESMF_ClockPrint(clock, options="currTime", & - preString="------>Advancing ATM from: ", unit=msgString, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_ClockPrint(clock, options="stopTime", & - preString="---------------------> to: ", unit=msgString, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - -end module diff --git a/PerformanceConnectorProto/conn.F90 b/PerformanceConnectorProto/conn.F90 deleted file mode 100644 index c63811dc..00000000 --- a/PerformanceConnectorProto/conn.F90 +++ /dev/null @@ -1,162 +0,0 @@ -!============================================================================== -! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, -! NASA Goddard Space Flight Center. -! Licensed under the University of Illinois-NCSA License. -!============================================================================== - -module CON - - !----------------------------------------------------------------------------- - ! Connector Component. - !----------------------------------------------------------------------------- - - - use ESMF - use NUOPC - use NUOPC_Connector, only: & - con_routine_SS => SetServices, & - con_label_ComputeRH => label_ComputeRouteHandle, & - con_label_ExecuteRH => label_ExecuteRouteHandle, & - con_label_ReleaseRH => label_ReleaseRouteHandle, & - NUOPC_ConnectorGet, NUOPC_ConnectorSet - - implicit none - - private - - public SetServices - - !----------------------------------------------------------------------------- - contains - !----------------------------------------------------------------------------- - - subroutine SetServices(connector, rc) - type(ESMF_CplComp) :: connector - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - - ! the NUOPC connector component will register the generic methods - call NUOPC_CompDerive(connector, con_routine_SS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! attach specializing method to compute the connection RouteHandle - call NUOPC_CompSpecialize(connector, specLabel=con_label_ComputeRH, & - specRoutine=ComputeRH, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSpecialize(connector, specLabel=con_label_ExecuteRH, & - specRoutine=ExecuteRH, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSpecialize(connector, specLabel=con_label_ReleaseRH, & - specRoutine=ReleaseRH, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! add "custom" run phase - call NUOPC_CompSetEntryPoint(connector, ESMF_METHOD_RUN, & - phaseLabelList=(/"custom"/), userRoutine=RunCustom, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine ComputeRH(connector, rc) - type(ESMF_CplComp) :: connector - integer, intent(out) :: rc - - ! local variables - type(ESMF_State) :: state - type(ESMF_FieldBundle) :: dstFields, srcFields - - rc = ESMF_SUCCESS - - call NUOPC_ConnectorGet(connector, srcFields=srcFields, & - dstFields=dstFields, state=state, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine ExecuteRH(connector, rc) - type(ESMF_CplComp) :: connector - integer, intent(out) :: rc - - ! local variables - type(ESMF_State) :: state - type(ESMF_FieldBundle) :: dstFields, srcFields - - rc = ESMF_SUCCESS - - call NUOPC_ConnectorGet(connector, srcFields=srcFields, & - dstFields=dstFields, state=state, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine ReleaseRH(connector, rc) - type(ESMF_CplComp) :: connector - integer, intent(out) :: rc - - ! local variables - type(ESMF_State) :: state - type(ESMF_FieldBundle) :: dstFields, srcFields - - rc = ESMF_SUCCESS - - call NUOPC_ConnectorGet(connector, srcFields=srcFields, & - dstFields=dstFields, state=state, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine RunCustom(connector, importState, exportState, clock, rc) - type(ESMF_CplComp) :: connector - type(ESMF_State) :: importState - type(ESMF_State) :: exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - - call ESMF_LogWrite("From inside RunCustom", ESMF_LOGMSG_INFO) - - end subroutine - - !----------------------------------------------------------------------------- - -end module - diff --git a/PerformanceConnectorProto/esm.F90 b/PerformanceConnectorProto/esm.F90 deleted file mode 100644 index 40aa20d6..00000000 --- a/PerformanceConnectorProto/esm.F90 +++ /dev/null @@ -1,273 +0,0 @@ -!============================================================================== -! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, -! NASA Goddard Space Flight Center. -! Licensed under the University of Illinois-NCSA License. -!============================================================================== - -module ESM - - !----------------------------------------------------------------------------- - ! Code that specializes generic ESM Component code. - !----------------------------------------------------------------------------- - - ! Enabling the followng macro, i.e. setting it to WITHPETLISTS_on, will - ! activate sections of code that demonstrate how - ! the ATM and OCN components can run on exclusive sets of PETs. Turning this - ! on/off does not affect how the Connector component is specialized. -#define WITHPETLISTS_off - - use ESMF - use NUOPC - use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices, & - driver_label_SetRunSequence => label_SetRunSequence - - use ATM, only: atmSS => SetServices - use OCN, only: ocnSS => SetServices - - use CON, only: cplSS => SetServices - - implicit none - - private - - public SetServices - - !----------------------------------------------------------------------------- - contains - !----------------------------------------------------------------------------- - - subroutine SetServices(driver, rc) - type(ESMF_GridComp) :: driver - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & - specRoutine=SetModelServices, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetRunSequence, & - specRoutine=SetRunSequence, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine SetModelServices(driver, rc) - type(ESMF_GridComp) :: driver - integer, intent(out) :: rc - - ! local variables - type(ESMF_Grid) :: grid - type(ESMF_Field) :: field - type(ESMF_Time) :: startTime - type(ESMF_Time) :: stopTime - type(ESMF_TimeInterval) :: timeStep - type(ESMF_Clock) :: internalClock - type(ESMF_GridComp) :: child - type(ESMF_CplComp) :: connector - integer :: petCount, i - integer, allocatable :: petList(:) - - rc = ESMF_SUCCESS - - ! get the petCount - call ESMF_GridCompGet(driver, petCount=petCount, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! SetServices for ATM with petList on first half of PETs -#ifdef WITHPETLISTS_on - allocate(petList(petCount/2)) - do i=1, petCount/2 - petList(i) = i-1 ! PET labeling goes from 0 to petCount-1 - enddo -#endif - call NUOPC_DriverAddComp(driver, "ATM", atmSS, & -#ifdef WITHPETLISTS_on - petList=petList, & -#endif - comp=child, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompAttributeSet(child, name="Verbosity", value="1", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#ifdef WITHPETLISTS_on - deallocate(petList) -#endif - - ! SetServices for OCN with petList on second half of PETs -#ifdef WITHPETLISTS_on - allocate(petList(petCount/2)) - do i=1, petCount/2 - petList(i) = petCount/2 + i-1 ! PET labeling goes from 0 to petCount-1 - enddo -#endif - call NUOPC_DriverAddComp(driver, "OCN", ocnSS, & -#ifdef WITHPETLISTS_on - petList=petList, & -#endif - comp=child, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompAttributeSet(child, name="Verbosity", value="1", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#ifdef WITHPETLISTS_on - deallocate(petList) -#endif - - ! SetServices for atm2ocn - call NUOPC_DriverAddComp(driver, srcCompLabel="ATM", dstCompLabel="OCN", & - compSetServicesRoutine=cplSS, comp=connector, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompAttributeSet(connector, name="Verbosity", value="1", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! SetServices for ocn2atm - call NUOPC_DriverAddComp(driver, srcCompLabel="OCN", dstCompLabel="ATM", & - compSetServicesRoutine=cplSS, comp=connector, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompAttributeSet(connector, name="Verbosity", value="1", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! set the driver clock - call ESMF_TimeIntervalSet(timeStep, m=15, rc=rc) ! 15 minute steps - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_TimeSet(startTime, yy=2010, mm=6, dd=1, h=0, m=0, & - calkindflag=ESMF_CALKIND_GREGORIAN, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_TimeSet(stopTime, yy=2010, mm=6, dd=2, h=0, m=0, & - calkindflag=ESMF_CALKIND_GREGORIAN, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - internalClock = ESMF_ClockCreate(name="Application Clock", & - timeStep=timeStep, startTime=startTime, stopTime=stopTime, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine SetRunSequence(driver, rc) - type(ESMF_GridComp) :: driver - integer, intent(out) :: rc - - ! local variables - type(NUOPC_FreeFormat) :: runSeqFF - character(len=NUOPC_FreeFormatLen) :: runSequence(7) - integer :: i - - rc = ESMF_SUCCESS - - ! set up run sequence in free format - data runSequence/& - "@900", & - " ATM -> OCN", & - " OCN -> ATM", & - " OCN -> ATM custom", & - " ATM", & - " OCN", & - "@"/ - - runSeqFF=NUOPC_FreeFormatCreate(runSequence, capacity=10, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call NUOPC_FreeFormatPrint(runSeqFF, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call NUOPC_DriverIngestRunSequence(driver, runSeqFF, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call NUOPC_FreeFormatDestroy(runSeqFF, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - -#define DRIVER_PRINT -#ifdef DRIVER_PRINT - call NUOPC_DriverPrint(driver, orderflag=.true., rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#endif - - end subroutine - - !----------------------------------------------------------------------------- - -end module diff --git a/PerformanceConnectorProto/esmApp.F90 b/PerformanceConnectorProto/esmApp.F90 deleted file mode 100644 index dbf229f4..00000000 --- a/PerformanceConnectorProto/esmApp.F90 +++ /dev/null @@ -1,124 +0,0 @@ -!============================================================================== -! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, -! NASA Goddard Space Flight Center. -! Licensed under the University of Illinois-NCSA License. -!============================================================================== - -program esmApp - - !----------------------------------------------------------------------------- - ! Generic ESM application driver - !----------------------------------------------------------------------------- - - use ESMF - use NUOPC - use ESM, only: esmSS => SetServices - - implicit none - - integer :: rc, urc - type(ESMF_GridComp) :: esmComp - - ! Initialize ESMF - call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - call ESMF_LogWrite("esmApp STARTING", ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - !----------------------------------------------------------------------------- - - ! Use an internal NUOPC Layer call to allow AutoAdd field dictionary entries - call NUOPC_FieldDictionarySetAutoAdd(.true., rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - !----------------------------------------------------------------------------- - - ! Create the earth system Component - esmComp = ESMF_GridCompCreate(name="esm", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - ! SetServices for the earth system Component - call ESMF_GridCompSetServices(esmComp, esmSS, userRc=urc, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - ! Call Initialize for the earth system Component - call ESMF_GridCompInitialize(esmComp, userRc=urc, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - ! Turn on Profiling in order to get Run Sequence timing info from Driver - call NUOPC_CompAttributeSet(esmComp, name="Profiling", value="high", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - ! Call Run for earth the system Component - call ESMF_GridCompRun(esmComp, userRc=urc, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - ! Call Finalize for the earth system Component - call ESMF_GridCompFinalize(esmComp, userRc=urc, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - ! Destroy the earth system Component - call ESMF_GridCompDestroy(esmComp, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - call ESMF_LogWrite("esmApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - ! Finalize ESMF - call ESMF_Finalize() - -end program diff --git a/PerformanceConnectorProto/ocn.F90 b/PerformanceConnectorProto/ocn.F90 deleted file mode 100644 index 7fe0fb9f..00000000 --- a/PerformanceConnectorProto/ocn.F90 +++ /dev/null @@ -1,262 +0,0 @@ -!============================================================================== -! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, -! NASA Goddard Space Flight Center. -! Licensed under the University of Illinois-NCSA License. -!============================================================================== - -module OCN - - !----------------------------------------------------------------------------- - ! OCN Component. - !----------------------------------------------------------------------------- - - use ESMF - use NUOPC - use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_SetClock => label_SetClock, & - model_label_Advance => label_Advance - - implicit none - - private - - public SetServices - - ! - module parameter - integer, parameter :: importFieldCount = 20 - integer, parameter :: exportFieldCount = 20 - - !----------------------------------------------------------------------------- - contains - !----------------------------------------------------------------------------- - - subroutine SetServices(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_SetClock, & - specRoutine=SetClock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine InitializeP1(model, importState, exportState, clock, rc) - type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - ! local variables - integer :: i - character(len=40) :: fieldName - - rc = ESMF_SUCCESS - - ! Import Fields - do i=1, importFieldCount - write(fieldName, "(A, I3.3)") "field_atm2ocn_", i - call NUOPC_Advertise(importState, & - StandardName=fieldName, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - enddo - - ! Export Fields - do i=1, exportFieldCount - write(fieldName, "(A, I3.3)") "field_ocn2atm_", i - call NUOPC_Advertise(exportState, & - StandardName=fieldName, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - enddo - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine InitializeP2(model, importState, exportState, clock, rc) - type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - ! local variables - type(ESMF_Field) :: field - type(ESMF_Grid) :: gridIn - type(ESMF_Grid) :: gridOut - - rc = ESMF_SUCCESS - - ! create a Grid object for Fields - gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/10, 100/), & - minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & - maxCornerCoord=(/100._ESMF_KIND_R8, 200._ESMF_KIND_R8/), & - coordSys=ESMF_COORDSYS_CART, staggerLocList=(/ESMF_STAGGERLOC_CENTER/), & - rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - gridOut = gridIn ! for now out same as in - - ! Import Fields - call NUOPC_Realize(importState, gridIn, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! Export Fields - call NUOPC_Realize(exportState, gridOut, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine SetClock(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - ! local variables - type(ESMF_Clock) :: clock - type(ESMF_TimeInterval) :: stabilityTimeStep - - rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState - call NUOPC_ModelGet(model, modelClock=clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! initialize internal clock - ! here: parent Clock and stability timeStep determine actual model timeStep - !TODO: stabilityTimeStep should be read in from configuation - !TODO: or computed from internal Grid information - call ESMF_TimeIntervalSet(stabilityTimeStep, m=5, rc=rc) ! 5 minute steps - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSetClock(model, clock, stabilityTimeStep, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine ModelAdvance(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - ! local variables - type(ESMF_Clock) :: clock - type(ESMF_State) :: importState, exportState - type(ESMF_Time) :: currTime - type(ESMF_TimeInterval) :: timeStep - character(len=160) :: msgString - - rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState - call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & - exportState=exportState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - - ! Because of the way that the internal Clock was set in SetClock(), - ! its timeStep is likely smaller than the parent timeStep. As a consequence - ! the time interval covered by a single parent timeStep will result in - ! multiple calls to the ModelAdvance() routine. Every time the currTime - ! will come in by one internal timeStep advanced. This goes until the - ! stopTime of the internal Clock has been reached. - - call ESMF_ClockPrint(clock, options="currTime", & - preString="------>Advancing OCN from: ", unit=msgString, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_TimePrint(currTime + timeStep, & - preString="---------------------> to: ", unit=msgString, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - -end module diff --git a/PerformanceRunSequenceProto/Makefile b/PerformanceRunSequenceProto/Makefile deleted file mode 100644 index e73aa632..00000000 --- a/PerformanceRunSequenceProto/Makefile +++ /dev/null @@ -1,73 +0,0 @@ -# GNU Makefile template for user ESMF application - -################################################################################ -################################################################################ -## This Makefile must be able to find the "esmf.mk" Makefile fragment in the ## -## 'include' line below. Following the ESMF User's Guide, a complete ESMF ## -## installation should ensure that a single environment variable "ESMFMKFILE" ## -## is made available on the system. This variable should point to the ## -## "esmf.mk" file. ## -## ## -## This example Makefile uses the "ESMFMKFILE" environment variable. ## -## ## -## If you notice that this Makefile cannot find variable ESMFMKFILE then ## -## please contact the person responsible for the ESMF installation on your ## -## system. ## -## As a work-around you can simply hardcode the path to "esmf.mk" in the ## -## include line below. However, doing so will render this Makefile a lot less ## -## flexible and non-portable. ## -################################################################################ - -ifneq ($(origin ESMFMKFILE), environment) -$(error Environment variable ESMFMKFILE was not set.) -endif - -include $(ESMFMKFILE) - -################################################################################ -################################################################################ - -.SUFFIXES: .f90 .F90 .c .C - -%.o : %.f90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREENOCPP) $< - -%.o : %.F90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) -DESMF_VERSION_MAJOR=$(ESMF_VERSION_MAJOR) $< - -%.o : %.c - $(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< - -%.o : %.C - $(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< - - -# ----------------------------------------------------------------------------- -mainApp: mainApp.o driver.o model.o - $(ESMF_F90LINKER) $(ESMF_F90LINKOPTS) $(ESMF_F90LINKPATHS) $(ESMF_F90LINKRPATHS) -o $@ $^ $(ESMF_F90ESMFLINKLIBS) - -# module dependencies: -mainApp.o: driver.o -driver.o: model.o - -# ----------------------------------------------------------------------------- -# ----------------------------------------------------------------------------- -.PHONY: dust clean distclean info edit -dust: - rm -f PET*.ESMF_LogFile *.nc *.stdout -clean: - rm -f mainApp *.o *.mod -distclean: dust clean - -info: - @echo ================================================================== - @echo ESMFMKFILE=$(ESMFMKFILE) - @echo ================================================================== - @cat $(ESMFMKFILE) - @echo ================================================================== - -edit: - nedit mainApp.F90 driver.F90 model.F90 & - -run: - mpirun -np 4 ./mainApp diff --git a/PerformanceRunSequenceProto/README b/PerformanceRunSequenceProto/README deleted file mode 100644 index 29195e51..00000000 --- a/PerformanceRunSequenceProto/README +++ /dev/null @@ -1,26 +0,0 @@ -README for single Model NUOPC prototype ---------------------------------------- - -Dependencies: - - ESMF v7.0.0 beta - -Build: - - Set environment variable ESMFMKFILE to point to the esmf.mk of your ESMF - installation. - - gmake - -Execution: - - Optionally set environment variable ESMF_RUNTIME_COMPLIANCECHECK to ON. - - mpirun -np X ./esmApp (where X is the total number of PETs) - -Output: - - PET*.Log files containing compliance checker output if turned on. - - The prototype outputs time stepping information to stdout. - - - -Code structure: - - Makefile - Makefile that is based on the standard esmf.mk mechanism. - - model.F90 - The MODEL component, specializing generic NUOPC_Model. - - driver.F90 - Driver specializing NUOPC_Driver, driving the single MODEL. - - mainApp.F90 - Main application cap. diff --git a/PerformanceRunSequenceProto/driver.F90 b/PerformanceRunSequenceProto/driver.F90 deleted file mode 100644 index 0ca1e1f5..00000000 --- a/PerformanceRunSequenceProto/driver.F90 +++ /dev/null @@ -1,260 +0,0 @@ -!============================================================================== -! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, -! NASA Goddard Space Flight Center. -! Licensed under the University of Illinois-NCSA License. -!============================================================================== - -module driver - - !----------------------------------------------------------------------------- - ! Code that specializes generic NUOPC_Driver - !----------------------------------------------------------------------------- - - use ESMF - use NUOPC - use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_routine_Run => routine_Run, & - driver_label_SetModelServices => label_SetModelServices, & - driver_label_SetRunSequence => label_SetRunSequence - - use MODEL, only: modelSS => SetServices - - implicit none - - private - - ! private module data --> ONLY PARAMETERS - integer, parameter :: stepCount = 100 - real(ESMF_KIND_R8), parameter :: stepTime = 30.D0 ! step time [s] - ! should be parent step - - type(ESMF_GridComp) :: model10 - - public SetServices - public stepCount - - !----------------------------------------------------------------------------- - contains - !----------------------------------------------------------------------------- - - subroutine SetServices(driver, rc) - type(ESMF_GridComp) :: driver - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & - specRoutine=SetModelServices, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetRunSequence, & - specRoutine=SetRunSequence, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! explicit entry point -> use generic routine_Run - call ESMF_GridCompSetEntryPoint(driver, ESMF_METHOD_RUN, & - driver_routine_Run, phase=2, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! explicit entry point -> use generic routine_Run - call ESMF_GridCompSetEntryPoint(driver, ESMF_METHOD_RUN, & - driver_routine_Run, phase=3, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! explicit entry point -> use pureESMFrun - call ESMF_GridCompSetEntryPoint(driver, ESMF_METHOD_RUN, & - pureESMFrun, phase=10, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine SetModelServices(driver, rc) - type(ESMF_GridComp) :: driver - integer, intent(out) :: rc - - ! local variables - type(ESMF_GridComp) :: child - type(ESMF_Time) :: startTime - type(ESMF_Time) :: stopTime - type(ESMF_TimeInterval) :: timeStep - type(ESMF_Clock) :: internalClock - - rc = ESMF_SUCCESS - - ! SetServices for MODEL component - call NUOPC_DriverAddComp(driver, "MODEL", modelSS, comp=child, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -! call NUOPC_CompAttributeSet(child, name="Verbosity", value="1", rc=rc) -! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & -! line=__LINE__, & -! file=__FILE__)) & -! return ! bail out - - ! set the driver clock - call ESMF_TimeSet(startTime, s = 0, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - call ESMF_TimeSet(stopTime, s_r8 = stepTime * stepCount, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - call ESMF_TimeIntervalSet(timeStep, s_r8 = stepTime, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - internalClock = ESMF_ClockCreate(name="Driver Clock", & - timeStep=timeStep, startTime=startTime, stopTime=stopTime, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! -- for explicit ESMF Run - model10 = child - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine SetRunSequence(driver, rc) - type(ESMF_GridComp) :: driver - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - - ! Replace the default RunSequence with a customized sequence, one time slot - call NUOPC_DriverNewRunSequence(driver, slotCount=1, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_DriverAddRunElement(driver, slot=1, compLabel="MODEL", & - phaseLabel="myRunLabel001", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine pureESMFrun(driver, importState, exportState, clock, rc) - type(ESMF_GridComp) :: driver - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - type(ESMF_Time) :: startTime - type(ESMF_Time) :: stopTime - type(ESMF_TimeInterval) :: timeStep - type(ESMF_Clock) :: internalClock, fakeClock - integer :: userrc - - rc = ESMF_SUCCESS - - !print *, "In pureESMFrun()" - - ! set the driver clock - call ESMF_TimeSet(startTime, s = 0, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_TimeSet(stopTime, s_r8 = stepTime * stepCount, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_TimeIntervalSet(timeStep, s_r8 = stepTime, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - internalClock = ESMF_ClockCreate(name="Driver Clock", & - timeStep=timeStep, startTime=startTime, stopTime=stopTime, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - do while (.not. ESMF_ClockIsStopTime(internalClock, rc=rc)) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - -#if 1 - call ESMF_GridCompRun(model10, phase=999, userrc=userrc, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - if (ESMF_LogFoundError(rcToCheck=userrc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#endif - - call ESMF_ClockAdvance(internalClock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - enddo - - - end subroutine - - !----------------------------------------------------------------------------- - -end module diff --git a/PerformanceRunSequenceProto/mainApp.F90 b/PerformanceRunSequenceProto/mainApp.F90 deleted file mode 100644 index c2a42dc7..00000000 --- a/PerformanceRunSequenceProto/mainApp.F90 +++ /dev/null @@ -1,175 +0,0 @@ -!============================================================================== -! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, -! NASA Goddard Space Flight Center. -! Licensed under the University of Illinois-NCSA License. -!============================================================================== - -program mainApp - - !----------------------------------------------------------------------------- - ! Generic ESMF Main - !----------------------------------------------------------------------------- - - use ESMF - - use driver, only: & - driver_SS => SetServices, & - stepCount - - implicit none - - integer :: rc, userRc - type(ESMF_GridComp) :: drvComp - real(ESMF_KIND_R8) :: timeStart(10), timeEnd(10) - - ! Initialize ESMF - call ESMF_Initialize(defaultCalkind=ESMF_CALKIND_GREGORIAN, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - call ESMF_LogWrite("mainApp STARTING", ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - !----------------------------------------------------------------------------- - - ! -> CREATE THE DRIVER - drvComp = ESMF_GridCompCreate(name="driver", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - ! -> SET DRIVER SERVICES - call ESMF_GridCompSetServices(drvComp, driver_SS, userRc=userRc, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - if (ESMF_LogFoundError(rcToCheck=userRc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - ! INITIALIZE THE DRIVER - call ESMF_GridCompInitialize(drvComp, userRc=userRc, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - if (ESMF_LogFoundError(rcToCheck=userRc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - !----------------------------------------------------------------------------- - call ESMF_VMWtime(timeStart(1)) - - ! RUN THE DRIVER - call ESMF_GridCompRun(drvComp, userRc=userRc, phase=1, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - if (ESMF_LogFoundError(rcToCheck=userRc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - call ESMF_VMWtime(timeEnd(1)) - - print *, "timer1: / per step:", timeEnd(1)-timeStart(1), & - (timeEnd(1)-timeStart(1))/real(stepCount) - !----------------------------------------------------------------------------- - - !----------------------------------------------------------------------------- - call ESMF_VMWtime(timeStart(2)) - - ! RUN THE DRIVER - call ESMF_GridCompRun(drvComp, userRc=userRc, phase=2, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - if (ESMF_LogFoundError(rcToCheck=userRc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - call ESMF_VMWtime(timeEnd(2)) - - print *, "timer2: / per step:", timeEnd(2)-timeStart(2), & - (timeEnd(2)-timeStart(2))/real(stepCount) - !----------------------------------------------------------------------------- - - !----------------------------------------------------------------------------- - call ESMF_VMWtime(timeStart(3)) - - ! RUN THE DRIVER - call ESMF_GridCompRun(drvComp, userRc=userRc, phase=3, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - if (ESMF_LogFoundError(rcToCheck=userRc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - call ESMF_VMWtime(timeEnd(3)) - - print *, "timer3: / per step:", timeEnd(3)-timeStart(3), & - (timeEnd(3)-timeStart(3))/real(stepCount) - !----------------------------------------------------------------------------- - - !----------------------------------------------------------------------------- - call ESMF_VMWtime(timeStart(10)) - - ! RUN THE DRIVER - call ESMF_GridCompRun(drvComp, userRc=userRc, phase=10, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - if (ESMF_LogFoundError(rcToCheck=userRc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - call ESMF_VMWtime(timeEnd(10)) - - print *, "timer10: / per step:", timeEnd(10)-timeStart(10), & - (timeEnd(10)-timeStart(10))/real(stepCount) - !----------------------------------------------------------------------------- - - ! FINALIZE THE DRIVER - call ESMF_GridCompFinalize(drvComp, userRc=userRc, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - if (ESMF_LogFoundError(rcToCheck=userRc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - !----------------------------------------------------------------------------- - - call ESMF_LogWrite("mainApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - ! Finalize ESMF - call ESMF_Finalize() - -end program diff --git a/PerformanceRunSequenceProto/model.F90 b/PerformanceRunSequenceProto/model.F90 deleted file mode 100644 index f2758755..00000000 --- a/PerformanceRunSequenceProto/model.F90 +++ /dev/null @@ -1,279 +0,0 @@ -!============================================================================== -! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, -! NASA Goddard Space Flight Center. -! Licensed under the University of Illinois-NCSA License. -!============================================================================== - -module MODEL - - !----------------------------------------------------------------------------- - ! MODEL Component. - !----------------------------------------------------------------------------- - - use ESMF - use NUOPC - use NUOPC_Model, only: & - model_routine_SS => SetServices, & - model_routine_Run => routine_Run, & - model_label_Advance => label_Advance - - implicit none - - private - - public SetServices - - !----------------------------------------------------------------------------- - contains - !----------------------------------------------------------------------------- - - subroutine SetServices(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - integer :: i - character(len=30) :: runLabel - - rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeP1, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeP2, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - do i=1, 100 - - write (runLabel, "(A,I3.3)") "myRunLabel", i - - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_RUN, & -! phaseLabelList=(/trim(runLabel)/), userRoutine=myRunRoutine, rc=rc) - phaseLabelList=(/trim(runLabel)/), userRoutine=model_routine_Run, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - enddo - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! pure ESMF call of model - call ESMF_GridCompSetEntryPoint(model, ESMF_METHOD_RUN, myRunRoutine, & - phase=999, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine InitializeP1(model, importState, exportState, clock, rc) - type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - - ! Enabeling the following macro, i.e. renaming it to WITHIMPORTFIELDS, - ! will result in a model component that advertise import Field dependencies. - ! In the single model case, where there isn't another model to satisfy these - ! dependencies, it is expected to be caught by the compatability checking. -#define WITHIMPORTFIELDS___disable -#ifdef WITHIMPORTFIELDS - ! importable field: sea_surface_temperature - call NUOPC_Advertise(importState, & - StandardName="sea_surface_temperature", name="sst", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#endif - - ! exportable field: air_pressure_at_sea_level - call NUOPC_Advertise(exportState, & - StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! exportable field: surface_net_downward_shortwave_flux - call NUOPC_Advertise(exportState, & - StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine InitializeP2(model, importState, exportState, clock, rc) - type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - ! local variables - type(ESMF_Field) :: field - type(ESMF_Grid) :: gridIn - type(ESMF_Grid) :: gridOut - - rc = ESMF_SUCCESS - - ! create a Grid object for Fields - gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/10, 100/), & - minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & - maxCornerCoord=(/100._ESMF_KIND_R8, 200._ESMF_KIND_R8/), & - coordSys=ESMF_COORDSYS_CART, staggerLocList=(/ESMF_STAGGERLOC_CENTER/), & - rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - gridOut = gridIn ! for now out same as in - -#ifdef WITHIMPORTFIELDS - ! importable field: sea_surface_temperature - field = ESMF_FieldCreate(name="sst", grid=gridIn, & - typekind=ESMF_TYPEKIND_R8, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_Realize(importState, field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#endif - - ! exportable field: air_pressure_at_sea_level - field = ESMF_FieldCreate(name="pmsl", grid=gridOut, & - typekind=ESMF_TYPEKIND_R8, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_Realize(exportState, field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! exportable field: surface_net_downward_shortwave_flux - field = ESMF_FieldCreate(name="rsns", grid=gridOut, & - typekind=ESMF_TYPEKIND_R8, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_Realize(exportState, field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine ModelAdvance(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - ! local variables - type(ESMF_Clock) :: clock - type(ESMF_State) :: importState, exportState - character(len=160) :: msgString - - rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState - call ESMF_GridCompGet(model, clock=clock, importState=importState, & - exportState=exportState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - - ! Because of the way that the internal Clock was set by default, - ! its timeStep is equal to the parent timeStep. As a consequence the - ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. - - call ESMF_ClockPrint(clock, options="currTime", & - preString="---->Advancing Model from: ", unit=msgString, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_ClockPrint(clock, options="stopTime", & - preString="---------------------> to: ", unit=msgString, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine myRunRoutine(model, importState, exportState, clock, rc) - type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - - ! print *, "In myRunRoutine()" - - end subroutine - - !----------------------------------------------------------------------------- - -end module From a7b71a82fc0c1174de5879f75932df32ebe8a6df Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Wed, 19 Aug 2020 16:19:53 -0700 Subject: [PATCH 23/68] Use the new external interface label_'s. --- ExternalDriverAPIProto/externalApp.F90 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ExternalDriverAPIProto/externalApp.F90 b/ExternalDriverAPIProto/externalApp.F90 index 819fc907..bbc856b4 100644 --- a/ExternalDriverAPIProto/externalApp.F90 +++ b/ExternalDriverAPIProto/externalApp.F90 @@ -115,7 +115,7 @@ program externalApp ! Call "ExternalAdvertise" Initialize for the earth system Component call NUOPC_CompSearchPhaseMap(esmComp, methodflag=ESMF_METHOD_INITIALIZE, & - phaseLabel="ExternalAdvertise", phaseIndex=phase, rc=rc) + phaseLabel=label_ExternalAdvertise, phaseIndex=phase, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -133,7 +133,7 @@ program externalApp ! Call "ExternalRealize" Initialize for the earth system Component call NUOPC_CompSearchPhaseMap(esmComp, methodflag=ESMF_METHOD_INITIALIZE, & - phaseLabel="ExternalRealize", phaseIndex=phase, rc=rc) + phaseLabel=label_ExternalRealize, phaseIndex=phase, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -149,9 +149,9 @@ program externalApp file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - ! Call "ExternalDataInitialize" Initialize for the earth system Component + ! Call "ExternalDataInit" Initialize for the earth system Component call NUOPC_CompSearchPhaseMap(esmComp, methodflag=ESMF_METHOD_INITIALIZE, & - phaseLabel="ExternalDataInitialize", phaseIndex=phase, rc=rc) + phaseLabel=label_ExternalDataInit, phaseIndex=phase, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & From bba5a9267330d78eb0fe7a8a9c92d22e2256e1a4 Mon Sep 17 00:00:00 2001 From: bekozi Date: Sun, 30 Aug 2020 12:25:34 -0600 Subject: [PATCH 24/68] Add test start/stop echos --- testProtos.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/testProtos.sh b/testProtos.sh index 43a1a8f0..9426eff7 100755 --- a/testProtos.sh +++ b/testProtos.sh @@ -299,12 +299,14 @@ TestProto NestingTelescopeMultipleProto mainApp TestProto SingleModelProto mainApp TestProto SingleModelOpenMPProto mainApp +echo "== TEST SUMMARY START ==" i=1 while [[ $i -le $count ]] do echo ${testResult[i]}: ${testList[i]} ((i++)) done +echo "== TEST SUMMARY STOP ==" echo echo --------------------------------------------------------------------------- From ebb4336a8310f57b279c6e70ab21cb4eb5704dde Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Fri, 4 Sep 2020 18:52:41 -0700 Subject: [PATCH 25/68] Fix typo in comment. --- AtmOcnMirrorFieldsProto/atm.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AtmOcnMirrorFieldsProto/atm.F90 b/AtmOcnMirrorFieldsProto/atm.F90 index fab0804d..ae7f85db 100644 --- a/AtmOcnMirrorFieldsProto/atm.F90 +++ b/AtmOcnMirrorFieldsProto/atm.F90 @@ -14,7 +14,7 @@ #ifdef TEST_FIELD_MIRRORING ! By default mirroring triggers TransferOffer="cannot provide" if the other ! side of the mirror will or can provide. -! This can be overwritten my unsetting the macro below: +! This can be overwritten by unsetting the macro below: #define TEST_ACCEPTING #endif From 76270f8ae1e254639fbf3ff866781e7137404fd7 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Thu, 1 Oct 2020 14:55:19 -0700 Subject: [PATCH 26/68] Correct outdated attribute. This was an oversight before and has now been flagged by more strict attribute checking. --- AsyncIONonblockingProto/io.F90 | 46 ++++++++++++++++++++++++++-- AtmOcnTransferGridProto/atm.F90 | 2 +- AtmOcnTransferLocStreamProto/atm.F90 | 2 +- AtmOcnTransferMeshProto/atm.F90 | 2 +- GenericMediatorProto/mediator.F90 | 46 ++++++++++++++++++++++++++-- 5 files changed, 91 insertions(+), 7 deletions(-) diff --git a/AsyncIONonblockingProto/io.F90 b/AsyncIONonblockingProto/io.F90 index e7943b8a..6b81c1af 100644 --- a/AsyncIONonblockingProto/io.F90 +++ b/AsyncIONonblockingProto/io.F90 @@ -164,9 +164,30 @@ subroutine checkConnectedFlagProvide(state, rc) character(len=20) :: transferAction character(len=80), allocatable :: itemNameList(:) type(ESMF_StateItem_Flag), allocatable :: itemTypeList(:) + type(ESMF_StateIntent_Flag) :: stateIntent + character(len=80) :: transferActionAttr if (present(rc)) rc = ESMF_SUCCESS + call ESMF_StateGet(state, stateIntent=stateIntent, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + if (stateIntent==ESMF_STATEINTENT_EXPORT) then + transferActionAttr="ProducerTransferAction" + elseif (stateIntent==ESMF_STATEINTENT_IMPORT) then + transferActionAttr="ConsumerTransferAction" + else + call ESMF_LogSetError(ESMF_RC_ARG_BAD, & + msg="The stateIntent must either be IMPORT or EXPORT here.", & + line=__LINE__, & + file=__FILE__, & + rcToReturn=rc) + return ! bail out + endif + call ESMF_StateGet(state, name=stateName, nestedFlag=.true., & itemCount=itemCount, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -206,7 +227,7 @@ subroutine checkConnectedFlagProvide(state, rc) file=__FILE__)) & return ! bail out else - call NUOPC_GetAttribute(field, name="TransferActionGeomObject", & + call NUOPC_GetAttribute(field, name=transferActionAttr, & value=transferAction, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -283,9 +304,30 @@ subroutine adjustAcceptedGeom(state, rc) type(ESMF_DistGrid) :: distgrid integer :: dimCount, tileCount integer, allocatable :: minIndexPTile(:,:), maxIndexPTile(:,:) + type(ESMF_StateIntent_Flag) :: stateIntent + character(len=80) :: transferActionAttr if (present(rc)) rc = ESMF_SUCCESS + call ESMF_StateGet(state, stateIntent=stateIntent, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + if (stateIntent==ESMF_STATEINTENT_EXPORT) then + transferActionAttr="ProducerTransferAction" + elseif (stateIntent==ESMF_STATEINTENT_IMPORT) then + transferActionAttr="ConsumerTransferAction" + else + call ESMF_LogSetError(ESMF_RC_ARG_BAD, & + msg="The stateIntent must either be IMPORT or EXPORT here.", & + line=__LINE__, & + file=__FILE__, & + rcToReturn=rc) + return ! bail out + endif + call ESMF_StateGet(state, nestedFlag=.true., itemCount=itemCount, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -310,7 +352,7 @@ subroutine adjustAcceptedGeom(state, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_GetAttribute(field, name="TransferActionGeomObject", & + call NUOPC_GetAttribute(field, name=transferActionAttr, & value=transferAction, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & diff --git a/AtmOcnTransferGridProto/atm.F90 b/AtmOcnTransferGridProto/atm.F90 index 3edbbc14..e06fdf3e 100644 --- a/AtmOcnTransferGridProto/atm.F90 +++ b/AtmOcnTransferGridProto/atm.F90 @@ -216,7 +216,7 @@ subroutine RealizeProvided(model, rc) ! importable field: sea_surface_temperature ! This Field was marked with TransferOfferGeomObject="can provide", so here - ! we need to see what TransferActionGeomObject the Connector determined for + ! we need to see what ConsumerTransferAction the Connector determined for ! this Field: call ESMF_StateGet(importState, field=field, itemName="sst", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & diff --git a/AtmOcnTransferLocStreamProto/atm.F90 b/AtmOcnTransferLocStreamProto/atm.F90 index d103a139..5cfeb935 100644 --- a/AtmOcnTransferLocStreamProto/atm.F90 +++ b/AtmOcnTransferLocStreamProto/atm.F90 @@ -191,7 +191,7 @@ subroutine RealizeProvided(model, rc) ! importable field: sea_surface_temperature ! This Field was marked with TransferOfferGeomObject="can provide", so here - ! we need to see what TransferActionGeomObject the Connector determined for + ! we need to see what ConsumerTransferAction the Connector determined for ! this Field: call ESMF_StateGet(importState, field=field, itemName="sst", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & diff --git a/AtmOcnTransferMeshProto/atm.F90 b/AtmOcnTransferMeshProto/atm.F90 index 65af1596..a6a674bb 100644 --- a/AtmOcnTransferMeshProto/atm.F90 +++ b/AtmOcnTransferMeshProto/atm.F90 @@ -193,7 +193,7 @@ subroutine RealizeProvided(model, rc) ! importable field: sea_surface_temperature ! This Field was marked with TransferOfferGeomObject="can provide", so here - ! we need to see what TransferActionGeomObject the Connector determined for + ! we need to see what ConsumerTransferAction the Connector determined for ! this Field: call ESMF_StateGet(importState, field=field, itemName="sst", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & diff --git a/GenericMediatorProto/mediator.F90 b/GenericMediatorProto/mediator.F90 index cb1152b0..15ee081a 100644 --- a/GenericMediatorProto/mediator.F90 +++ b/GenericMediatorProto/mediator.F90 @@ -223,9 +223,30 @@ subroutine checkConnectedFlagProvide(state, rc) character(len=20) :: transferAction character(len=80), allocatable :: itemNameList(:) type(ESMF_StateItem_Flag), allocatable :: itemTypeList(:) + type(ESMF_StateIntent_Flag) :: stateIntent + character(len=80) :: transferActionAttr if (present(rc)) rc = ESMF_SUCCESS + call ESMF_StateGet(state, stateIntent=stateIntent, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + if (stateIntent==ESMF_STATEINTENT_EXPORT) then + transferActionAttr="ProducerTransferAction" + elseif (stateIntent==ESMF_STATEINTENT_IMPORT) then + transferActionAttr="ConsumerTransferAction" + else + call ESMF_LogSetError(ESMF_RC_ARG_BAD, & + msg="The stateIntent must either be IMPORT or EXPORT here.", & + line=__LINE__, & + file=__FILE__, & + rcToReturn=rc) + return ! bail out + endif + call ESMF_StateGet(state, name=stateName, nestedFlag=.true., & itemCount=itemCount, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -265,7 +286,7 @@ subroutine checkConnectedFlagProvide(state, rc) file=__FILE__)) & return ! bail out else - call NUOPC_GetAttribute(field, name="TransferActionGeomObject", & + call NUOPC_GetAttribute(field, name=transferActionAttr, & value=transferAction, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -342,9 +363,30 @@ subroutine adjustAcceptedGeom(state, rc) type(ESMF_DistGrid) :: distgrid integer :: dimCount, tileCount integer, allocatable :: minIndexPTile(:,:), maxIndexPTile(:,:) + type(ESMF_StateIntent_Flag) :: stateIntent + character(len=80) :: transferActionAttr if (present(rc)) rc = ESMF_SUCCESS + call ESMF_StateGet(state, stateIntent=stateIntent, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + if (stateIntent==ESMF_STATEINTENT_EXPORT) then + transferActionAttr="ProducerTransferAction" + elseif (stateIntent==ESMF_STATEINTENT_IMPORT) then + transferActionAttr="ConsumerTransferAction" + else + call ESMF_LogSetError(ESMF_RC_ARG_BAD, & + msg="The stateIntent must either be IMPORT or EXPORT here.", & + line=__LINE__, & + file=__FILE__, & + rcToReturn=rc) + return ! bail out + endif + call ESMF_StateGet(state, nestedFlag=.true., itemCount=itemCount, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -369,7 +411,7 @@ subroutine adjustAcceptedGeom(state, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_GetAttribute(field, name="TransferActionGeomObject", & + call NUOPC_GetAttribute(field, name=transferActionAttr, & value=transferAction, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & From ff64902390e77b677326373c6eb1c57ab0264b5e Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Tue, 6 Oct 2020 14:44:07 -0700 Subject: [PATCH 27/68] Adjust to localPe -> currentSsiPe change. --- SingleModelOpenMPProto/model.F90 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SingleModelOpenMPProto/model.F90 b/SingleModelOpenMPProto/model.F90 index 32c824ac..cfa57c02 100644 --- a/SingleModelOpenMPProto/model.F90 +++ b/SingleModelOpenMPProto/model.F90 @@ -240,7 +240,7 @@ subroutine Advance(model, rc) type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState type(ESMF_VM) :: vm - integer :: localPet, localPeCount, localPe + integer :: localPet, localPeCount, currentSsiPe character(len=160) :: msgString rc = ESMF_SUCCESS @@ -270,12 +270,12 @@ subroutine Advance(model, rc) ! Now can use OpenMP for fine grained parallelism... ! Here just write info about the PET-local OpenMP threads to Log. -!$omp parallel private(msgString, localPe) +!$omp parallel private(msgString, currentSsiPe) !$omp critical -!$ call ESMF_VMGet(vm, localPe=localPe) +!$ call ESMF_VMGet(vm, currentSsiPe=currentSsiPe) !$ write(msgString,'(A,I4,A,I4,A,I4,A,I4,A,I4)') & !$ "thread_num=", omp_get_thread_num(), & -!$ " localPe=", localPe, & +!$ " currentSsiPe=", currentSsiPe, & !$ " num_threads=", omp_get_num_threads(), & !$ " max_threads=", omp_get_max_threads(), & !$ " num_procs=", omp_get_num_procs() From a1aea7e88029b9b5b1b454526749f8d33567bd98 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Wed, 9 Dec 2020 16:36:28 -0800 Subject: [PATCH 28/68] Correct code and clarify comments with respect to import/exportStates. Add diagnostic dumping of fields in states. Test and demonstrate sharing of field. --- ExternalDriverAPIProto/externalApp.F90 | 63 ++++++++++++++++++-------- ExternalDriverAPIProto/ocn.F90 | 3 +- 2 files changed, 46 insertions(+), 20 deletions(-) diff --git a/ExternalDriverAPIProto/externalApp.F90 b/ExternalDriverAPIProto/externalApp.F90 index bbc856b4..3abdd23f 100644 --- a/ExternalDriverAPIProto/externalApp.F90 +++ b/ExternalDriverAPIProto/externalApp.F90 @@ -11,7 +11,7 @@ program externalApp !----------------------------------------------------------------------------- - ! Generic ESM application driver + ! Generic external application driver !----------------------------------------------------------------------------- use ESMF @@ -25,7 +25,7 @@ program externalApp type(ESMF_Time) :: startTime, stopTime type(ESMF_TimeInterval) :: timeStep type(ESMF_Clock) :: clock - type(ESMF_State) :: esmImportState, esmExportState + type(ESMF_State) :: externalExportState, externalImportState integer :: phase ! Initialize ESMF @@ -74,22 +74,16 @@ program externalApp call ESMF_Finalize(endflag=ESMF_END_ABORT) ! Create the earth system import/export States - esmImportState = ESMF_StateCreate(stateintent=ESMF_STATEINTENT_IMPORT, rc=rc) + ! NOTE: The "stateintent" must be specified, and it must be set from the + ! perspective of the external level! + externalExportState = ESMF_StateCreate(stateintent=ESMF_STATEINTENT_EXPORT, & + rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - esmExportState = ESMF_StateCreate(stateintent=ESMF_STATEINTENT_EXPORT, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - ! advertise field in the earth system export State - call NUOPC_Advertise(esmExportState, & - StandardNames=(/"air_pressure_at_sea_level ", & - "surface_net_downward_shortwave_flux "/), & - TransferOfferGeomObject="cannot provide", rc=rc) + externalImportState = ESMF_StateCreate(stateintent=ESMF_STATEINTENT_IMPORT, & + rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -113,6 +107,15 @@ program externalApp file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) + ! Advertise field(s) in external import state in order to receive from ESM + call NUOPC_Advertise(externalImportState, & + StandardNames=(/"sea_surface_temperature"/), & + TransferOfferGeomObject="cannot provide", SharePolicyField="share", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + ! Call "ExternalAdvertise" Initialize for the earth system Component call NUOPC_CompSearchPhaseMap(esmComp, methodflag=ESMF_METHOD_INITIALIZE, & phaseLabel=label_ExternalAdvertise, phaseIndex=phase, rc=rc) @@ -121,7 +124,8 @@ program externalApp file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) call ESMF_GridCompInitialize(esmComp, phase=phase, clock=clock, & - importState=esmImportState, exportState=esmExportState, userRc=urc, rc=rc) + importState=externalExportState, exportState=externalImportState, & + userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -139,7 +143,8 @@ program externalApp file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) call ESMF_GridCompInitialize(esmComp, phase=phase, clock=clock, & - importState=esmImportState, exportState=esmExportState, userRc=urc, rc=rc) + importState=externalExportState, exportState=externalImportState, & + userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -157,7 +162,8 @@ program externalApp file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) call ESMF_GridCompInitialize(esmComp, phase=phase, clock=clock, & - importState=esmImportState, exportState=esmExportState, userRc=urc, rc=rc) + importState=externalExportState, exportState=externalImportState, & + userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -167,9 +173,27 @@ program externalApp file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) + ! write out the Fields in the externalImportState + call NUOPC_Write(externalImportState, & + fileNamePrefix="field_externalImportState_", & + overwrite=.true., relaxedFlag=.true., rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + ! write out the Fields in the externalExportState + call NUOPC_Write(externalExportState, & + fileNamePrefix="field_externalExportState_", & + overwrite=.true., relaxedFlag=.true., rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + ! Run the earth system Component call ESMF_GridCompRun(esmComp, clock=clock, & - importState=esmImportState, exportState=esmExportState, userRc=urc, rc=rc) + importState=externalExportState, exportState=externalImportState, & + userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -181,7 +205,8 @@ program externalApp ! Finalize the earth system Component call ESMF_GridCompFinalize(esmComp, clock=clock, & - importState=esmImportState, exportState=esmExportState, userRc=urc, rc=rc) + importState=externalExportState, exportState=externalImportState, & + userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & diff --git a/ExternalDriverAPIProto/ocn.F90 b/ExternalDriverAPIProto/ocn.F90 index 04dc9772..aa71b3ea 100644 --- a/ExternalDriverAPIProto/ocn.F90 +++ b/ExternalDriverAPIProto/ocn.F90 @@ -123,7 +123,8 @@ subroutine Advertise(model, rc) ! exportable field: sea_surface_temperature call NUOPC_Advertise(exportState, & - StandardName="sea_surface_temperature", name="sst", rc=rc) + StandardName="sea_surface_temperature", name="sst", & + SharePolicyField="share", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & From 7501c8b848e1c809ad55ba0467e7687a0c686937 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Thu, 10 Dec 2020 10:31:40 -0800 Subject: [PATCH 29/68] Add demonstration of time stepping on the external level. --- ExternalDriverAPIProto/externalApp.F90 | 80 ++++++++++++++++++++------ 1 file changed, 61 insertions(+), 19 deletions(-) diff --git a/ExternalDriverAPIProto/externalApp.F90 b/ExternalDriverAPIProto/externalApp.F90 index 3abdd23f..e7b51e5e 100644 --- a/ExternalDriverAPIProto/externalApp.F90 +++ b/ExternalDriverAPIProto/externalApp.F90 @@ -27,6 +27,8 @@ program externalApp type(ESMF_Clock) :: clock type(ESMF_State) :: externalExportState, externalImportState integer :: phase + character(40) :: sharePolicy + integer, save :: slice=1 ! Initialize ESMF call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, & @@ -73,15 +75,17 @@ program externalApp file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - ! Create the earth system import/export States + ! Create the external level import/export States ! NOTE: The "stateintent" must be specified, and it must be set from the - ! perspective of the external level! + ! perspective of the external level: + ! -> state holding fields exported by the external level to the ESM component externalExportState = ESMF_StateCreate(stateintent=ESMF_STATEINTENT_EXPORT, & rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) + ! -> state holding fields imported by the external level from the ESM component externalImportState = ESMF_StateCreate(stateintent=ESMF_STATEINTENT_IMPORT, & rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -108,9 +112,20 @@ program externalApp call ESMF_Finalize(endflag=ESMF_END_ABORT) ! Advertise field(s) in external import state in order to receive from ESM +#define SHARED +#ifdef SHARED + ! request reference sharing for field and geomobject + ! -> still the child component may not allow sharing and we end up with copy + sharePolicy = "share" +#else + ! prevent reference sharing for field and geomobject + ! -> definitely create local copy of the field here + sharePolicy = "not share" +#endif call NUOPC_Advertise(externalImportState, & StandardNames=(/"sea_surface_temperature"/), & - TransferOfferGeomObject="cannot provide", SharePolicyField="share", rc=rc) + TransferOfferGeomObject="cannot provide", SharePolicyField=sharePolicy, & + rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -173,35 +188,62 @@ program externalApp file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - ! write out the Fields in the externalImportState + ! Write out the Fields in the externalImportState after initialize call NUOPC_Write(externalImportState, & - fileNamePrefix="field_externalImportState_", & + fileNamePrefix="field_externalImportState_init_", & overwrite=.true., relaxedFlag=.true., rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - ! write out the Fields in the externalExportState + ! Write out the Fields in the externalExportState after initialize call NUOPC_Write(externalExportState, & - fileNamePrefix="field_externalExportState_", & + fileNamePrefix="field_externalExportState_init_", & overwrite=.true., relaxedFlag=.true., rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - ! Run the earth system Component - call ESMF_GridCompRun(esmComp, clock=clock, & - importState=externalExportState, exportState=externalImportState, & - userRc=urc, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) + ! Explicit time stepping loop on the external level, here based on ESMF_Clock + do while (.not.ESMF_ClockIsStopTime(clock, rc=rc)) + ! Run the earth system Component: i.e. step ESM forward by timestep=15min + call ESMF_GridCompRun(esmComp, clock=clock, & + importState=externalExportState, exportState=externalImportState, & + userRc=urc, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + ! Write out the Fields in the externalImportState as a time slice + call NUOPC_Write(externalImportState, & + fileNamePrefix="field_externalImportState_", & + timeslice=slice, overwrite=.true., relaxedFlag=.true., rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + ! Write out the Fields in the externalExportState as a time slice + call NUOPC_Write(externalExportState, & + fileNamePrefix="field_externalExportState_", & + timeslice=slice, overwrite=.true., relaxedFlag=.true., rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + ! Increment the time slice counter + slice = slice + 1 + ! Advance the clock + call ESMF_ClockAdvance(clock, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + end do ! Finalize the earth system Component call ESMF_GridCompFinalize(esmComp, clock=clock, & From 36f16ae58cce4bb7c41b3a14695ae5fc8e6d67ab Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Mon, 14 Dec 2020 15:07:22 -0800 Subject: [PATCH 30/68] Demonstrate the use of ESMF_InitializePreMPI() in case of explicit call to MPI_Init*(), and ESMF-aware resource management for threading. --- SingleModelOpenMPProto/mainApp.F90 | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/SingleModelOpenMPProto/mainApp.F90 b/SingleModelOpenMPProto/mainApp.F90 index dcac5820..27058fc8 100644 --- a/SingleModelOpenMPProto/mainApp.F90 +++ b/SingleModelOpenMPProto/mainApp.F90 @@ -8,6 +8,8 @@ ! Licensed under the University of Illinois-NCSA License. !============================================================================== +#define EXPLICIT_MPI_INIT + program mainApp !----------------------------------------------------------------------------- @@ -15,6 +17,9 @@ program mainApp !----------------------------------------------------------------------------- use ESMF +#ifdef EXPLICIT_MPI_INIT + use MPI +#endif use driver, only: & driver_SS => SetServices @@ -24,7 +29,18 @@ program mainApp integer :: rc, userRc type(ESMF_GridComp) :: drvComp - ! Initialize ESMF + ! Initialize MPI/ESMF +#ifdef EXPLICIT_MPI_INIT + ! This prototype implements ESMF-aware resource management for threading. + ! Therefore must call ESMF_InitializePreMPI() before MPI_Init*() if later is + ! called explicitly from user level! + call ESMF_InitializePreMPI(rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + call MPI_Init_thread(MPI_THREAD_MULTIPLE, userRc, rc) +#endif call ESMF_Initialize(defaultCalkind=ESMF_CALKIND_GREGORIAN, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & From e23290e2ed8f7811d92fa65290c14a08207a7009 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Wed, 23 Dec 2020 09:41:54 -0800 Subject: [PATCH 31/68] Add new output files. --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 37c484bb..254b87cf 100644 --- a/.gitignore +++ b/.gitignore @@ -677,6 +677,8 @@ ExternalDriverAPIProto/esm.o ExternalDriverAPIProto/externalApp ExternalDriverAPIProto/externalApp.o ExternalDriverAPIProto/externalApp.stdout +ExternalDriverAPIProto/field_externalImportState_init_sea_surface_temperature.nc +ExternalDriverAPIProto/field_externalImportState_sea_surface_temperature.nc ExternalDriverAPIProto/field_ocn_export_sst.nc ExternalDriverAPIProto/field_ocn_import_pmsl.nc ExternalDriverAPIProto/field_ocn_import_rsnl.nc From 3026bb49b558151974f260b2284179a20c71edd4 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Wed, 23 Dec 2020 14:24:05 -0800 Subject: [PATCH 32/68] Switch over to the new /NUOPC/Hint/PePerPet for resource management. --- AtmOcnMirrorFieldsProto/esm.F90 | 4 ++-- AtmOcnPetListProto/README | 4 ++-- AtmOcnPetListProto/esm.F90 | 4 ++-- AtmOcnTransferGridProto/esm.F90 | 8 ++++---- HierarchyProto/esm.F90 | 2 +- SingleModelOpenMPProto/README | 4 ++-- SingleModelOpenMPProto/driver.F90 | 10 ++++++++-- 7 files changed, 21 insertions(+), 15 deletions(-) diff --git a/AtmOcnMirrorFieldsProto/esm.F90 b/AtmOcnMirrorFieldsProto/esm.F90 index e2a25897..2b1f11db 100644 --- a/AtmOcnMirrorFieldsProto/esm.F90 +++ b/AtmOcnMirrorFieldsProto/esm.F90 @@ -99,7 +99,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call ESMF_InfoSet(info, key="/NUOPC/Instance/maxPeCountPerPet", value=2, & + call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/maxCount", value=2, & rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -138,7 +138,7 @@ subroutine SetModelServices(driver, rc) deallocate(petList) ! SetServices for OCN with petList on second half of PETs - call ESMF_InfoSet(info, key="/NUOPC/Instance/maxPeCountPerPet", value=4, & + call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/maxCount", value=4, & rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & diff --git a/AtmOcnPetListProto/README b/AtmOcnPetListProto/README index 2471987d..91ad7a77 100644 --- a/AtmOcnPetListProto/README +++ b/AtmOcnPetListProto/README @@ -3,7 +3,7 @@ README for ATM-OCN with petList NUOPC prototype A simple two model system, where the Model components run on assigned PETs. Demonstrate the Driver instructing the Model components to configure their -VMs according to the "maxPeCountPerPet" hint. +VMs according to /NUOPC/Hint/PePerPet hints. Description: @@ -13,7 +13,7 @@ Description: The ESM driver uses explicitly constructed petLists when adding the two model components. - The ESM driver constructs an Info object and sets the maxPeCountPerPet" hint. + The ESM driver constructs an Info object and sets /NUOPC/Hint/PePerPet hints. Passes the Info object into NUOPC_DriverAddComp() when adding the ATM and OCN components. diff --git a/AtmOcnPetListProto/esm.F90 b/AtmOcnPetListProto/esm.F90 index b78ba591..d3ff5ca4 100644 --- a/AtmOcnPetListProto/esm.F90 +++ b/AtmOcnPetListProto/esm.F90 @@ -111,7 +111,7 @@ subroutine SetModelServices(driver, rc) do i=1, petCount/2 petList(i) = i-1 ! PET labeling goes from 0 to petCount-1 enddo - call ESMF_InfoSet(info, key="/NUOPC/Instance/maxPeCountPerPet", value=2, & + call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/maxCount", value=2, & rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -200,7 +200,7 @@ subroutine SetModelServices(driver, rc) do i=1, petCount/2 petList(i) = petCount/2 + i-1 ! PET labeling goes from 0 to petCount-1 enddo - call ESMF_InfoSet(info, key="/NUOPC/Instance/maxPeCountPerPet", value=2, & + call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/maxCount", value=2, & rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & diff --git a/AtmOcnTransferGridProto/esm.F90 b/AtmOcnTransferGridProto/esm.F90 index 76c7956a..39ddb348 100644 --- a/AtmOcnTransferGridProto/esm.F90 +++ b/AtmOcnTransferGridProto/esm.F90 @@ -98,10 +98,10 @@ subroutine SetModelServices(driver, rc) return ! bail out #define MORE_THAN_ONE_PE_PER_PET_WORKING_ATM #ifdef MORE_THAN_ONE_PE_PER_PET_WORKING_ATM - call ESMF_InfoSet(info, key="/NUOPC/Instance/maxPeCountPerPet", value=2, & + call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/maxCount", value=2, & rc=rc) #else - call ESMF_InfoSet(info, key="/NUOPC/Instance/maxPeCountPerPet", value=1, & + call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/maxCount", value=1, & rc=rc) #endif if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -140,10 +140,10 @@ subroutine SetModelServices(driver, rc) #define MORE_THAN_ONE_PE_PER_PET_WORKING_OCN #ifdef MORE_THAN_ONE_PE_PER_PET_WORKING_OCN - call ESMF_InfoSet(info, key="/NUOPC/Instance/maxPeCountPerPet", value=2, & + call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/maxCount", value=2, & rc=rc) #else - call ESMF_InfoSet(info, key="/NUOPC/Instance/maxPeCountPerPet", value=1, & + call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/maxCount", value=1, & rc=rc) #endif if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & diff --git a/HierarchyProto/esm.F90 b/HierarchyProto/esm.F90 index cbc4013c..a68e0c13 100644 --- a/HierarchyProto/esm.F90 +++ b/HierarchyProto/esm.F90 @@ -134,7 +134,7 @@ subroutine SetModelServices(driver, rc) do i=1, petCountOCN petList(i) = petCountATM + i-1 ! PET labeling goes from 0 to petCount-1 enddo - call ESMF_InfoSet(info, key="/NUOPC/Instance/maxPeCountPerPet", value=2, & + call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/maxCount", value=2, & rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & diff --git a/SingleModelOpenMPProto/README b/SingleModelOpenMPProto/README index fdfbec33..6e702e51 100644 --- a/SingleModelOpenMPProto/README +++ b/SingleModelOpenMPProto/README @@ -13,8 +13,8 @@ Description: The driver specifies the model component SetVM() method during NUOPC_DriverAddComp() when adding the model component. - The driver sets up an info object with the "maxPeCountPerPet" hint and passes - it into NUOPC_DriverAddComp() when adding the model component. + The driver sets up an info object with "/NUOPC/Hint/PePerPet/maxCount" + and passes it into NUOPC_DriverAddComp() when adding the model component. If compiled with OpenMP support, the model component will use the 2 PEs per PET to utilize OpenMP threading. diff --git a/SingleModelOpenMPProto/driver.F90 b/SingleModelOpenMPProto/driver.F90 index 94be934f..7e0623e2 100644 --- a/SingleModelOpenMPProto/driver.F90 +++ b/SingleModelOpenMPProto/driver.F90 @@ -98,8 +98,14 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call ESMF_InfoSet(info, key="/NUOPC/Instance/maxPeCountPerPet", value=2, & - rc=rc) + call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/maxCount", value=2, & + rc=rc) ! expect 2 PEs per PET in the child VM + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/minStackSize", & + value=16*1024*1024, rc=rc) ! stack size no less than 16MiB if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & From e78f10e7180055ecc0309ad14285f15c7c3b8974 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Wed, 23 Dec 2020 15:49:49 -0800 Subject: [PATCH 33/68] Rely on ESMF internal OpenMP handling. --- AtmOcnMirrorFieldsProto/atm.F90 | 1 - AtmOcnMirrorFieldsProto/ocn.F90 | 1 - AtmOcnPetListProto/atm.F90 | 1 - AtmOcnPetListProto/ocn.F90 | 1 - SingleModelOpenMPProto/driver.F90 | 6 ++++++ SingleModelOpenMPProto/model.F90 | 2 -- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/AtmOcnMirrorFieldsProto/atm.F90 b/AtmOcnMirrorFieldsProto/atm.F90 index ae7f85db..c6f67f04 100644 --- a/AtmOcnMirrorFieldsProto/atm.F90 +++ b/AtmOcnMirrorFieldsProto/atm.F90 @@ -625,7 +625,6 @@ subroutine Advance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out -!$ call omp_set_num_threads(localPeCount) ! Now can use OpenMP for fine grained parallelism... ! Here just write info about the PET-local OpenMP threads to Log. diff --git a/AtmOcnMirrorFieldsProto/ocn.F90 b/AtmOcnMirrorFieldsProto/ocn.F90 index 8790b61c..27dda2c4 100644 --- a/AtmOcnMirrorFieldsProto/ocn.F90 +++ b/AtmOcnMirrorFieldsProto/ocn.F90 @@ -288,7 +288,6 @@ subroutine Advance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out -!$ call omp_set_num_threads(localPeCount) ! Now can use OpenMP for fine grained parallelism... ! Here just write info about the PET-local OpenMP threads to Log. diff --git a/AtmOcnPetListProto/atm.F90 b/AtmOcnPetListProto/atm.F90 index a6c3ab52..2122806c 100644 --- a/AtmOcnPetListProto/atm.F90 +++ b/AtmOcnPetListProto/atm.F90 @@ -233,7 +233,6 @@ subroutine Advance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out -!$ call omp_set_num_threads(localPeCount) ! Now can use OpenMP for fine grained parallelism... ! Here just write info about the PET-local OpenMP threads to Log. diff --git a/AtmOcnPetListProto/ocn.F90 b/AtmOcnPetListProto/ocn.F90 index d8cf9b43..74955cae 100644 --- a/AtmOcnPetListProto/ocn.F90 +++ b/AtmOcnPetListProto/ocn.F90 @@ -278,7 +278,6 @@ subroutine Advance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out -!$ call omp_set_num_threads(localPeCount) ! Now can use OpenMP for fine grained parallelism... ! Here just write info about the PET-local OpenMP threads to Log. diff --git a/SingleModelOpenMPProto/driver.F90 b/SingleModelOpenMPProto/driver.F90 index 7e0623e2..c2cc6a12 100644 --- a/SingleModelOpenMPProto/driver.F90 +++ b/SingleModelOpenMPProto/driver.F90 @@ -110,6 +110,12 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out + call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/openMP", value="pin", & + rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out ! SetServices for MODEL component call NUOPC_DriverAddComp(driver, "MODEL", modelSS, modelSVM, info=info, & diff --git a/SingleModelOpenMPProto/model.F90 b/SingleModelOpenMPProto/model.F90 index cfa57c02..2a6c106f 100644 --- a/SingleModelOpenMPProto/model.F90 +++ b/SingleModelOpenMPProto/model.F90 @@ -266,8 +266,6 @@ subroutine Advance(model, rc) file=__FILE__)) & return ! bail out -!$ call omp_set_num_threads(localPeCount) - ! Now can use OpenMP for fine grained parallelism... ! Here just write info about the PET-local OpenMP threads to Log. !$omp parallel private(msgString, currentSsiPe) From 3af25e261594802c8bc771fe876e725da3bda94e Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Mon, 4 Jan 2021 15:02:38 -0800 Subject: [PATCH 34/68] Adjust to the further refined /NUOPC/Hint/PePerPet hint approach. --- AtmOcnMirrorFieldsProto/esm.F90 | 4 ++-- AtmOcnPetListProto/esm.F90 | 4 ++-- AtmOcnTransferGridProto/esm.F90 | 8 ++++---- HierarchyProto/esm.F90 | 2 +- SingleModelOpenMPProto/driver.F90 | 18 ++++++++++++++---- 5 files changed, 23 insertions(+), 13 deletions(-) diff --git a/AtmOcnMirrorFieldsProto/esm.F90 b/AtmOcnMirrorFieldsProto/esm.F90 index 2b1f11db..bf4846a4 100644 --- a/AtmOcnMirrorFieldsProto/esm.F90 +++ b/AtmOcnMirrorFieldsProto/esm.F90 @@ -99,7 +99,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/maxCount", value=2, & + call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/MaxCount", value=2, & rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -138,7 +138,7 @@ subroutine SetModelServices(driver, rc) deallocate(petList) ! SetServices for OCN with petList on second half of PETs - call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/maxCount", value=4, & + call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/MaxCount", value=4, & rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & diff --git a/AtmOcnPetListProto/esm.F90 b/AtmOcnPetListProto/esm.F90 index d3ff5ca4..086e3fb5 100644 --- a/AtmOcnPetListProto/esm.F90 +++ b/AtmOcnPetListProto/esm.F90 @@ -111,7 +111,7 @@ subroutine SetModelServices(driver, rc) do i=1, petCount/2 petList(i) = i-1 ! PET labeling goes from 0 to petCount-1 enddo - call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/maxCount", value=2, & + call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/MaxCount", value=2, & rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -200,7 +200,7 @@ subroutine SetModelServices(driver, rc) do i=1, petCount/2 petList(i) = petCount/2 + i-1 ! PET labeling goes from 0 to petCount-1 enddo - call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/maxCount", value=2, & + call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/MaxCount", value=2, & rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & diff --git a/AtmOcnTransferGridProto/esm.F90 b/AtmOcnTransferGridProto/esm.F90 index 39ddb348..ae86ac6f 100644 --- a/AtmOcnTransferGridProto/esm.F90 +++ b/AtmOcnTransferGridProto/esm.F90 @@ -98,10 +98,10 @@ subroutine SetModelServices(driver, rc) return ! bail out #define MORE_THAN_ONE_PE_PER_PET_WORKING_ATM #ifdef MORE_THAN_ONE_PE_PER_PET_WORKING_ATM - call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/maxCount", value=2, & + call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/MaxCount", value=2, & rc=rc) #else - call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/maxCount", value=1, & + call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/MaxCount", value=1, & rc=rc) #endif if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -140,10 +140,10 @@ subroutine SetModelServices(driver, rc) #define MORE_THAN_ONE_PE_PER_PET_WORKING_OCN #ifdef MORE_THAN_ONE_PE_PER_PET_WORKING_OCN - call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/maxCount", value=2, & + call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/MaxCount", value=2, & rc=rc) #else - call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/maxCount", value=1, & + call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/MaxCount", value=1, & rc=rc) #endif if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & diff --git a/HierarchyProto/esm.F90 b/HierarchyProto/esm.F90 index a68e0c13..1e54b2b3 100644 --- a/HierarchyProto/esm.F90 +++ b/HierarchyProto/esm.F90 @@ -134,7 +134,7 @@ subroutine SetModelServices(driver, rc) do i=1, petCountOCN petList(i) = petCountATM + i-1 ! PET labeling goes from 0 to petCount-1 enddo - call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/maxCount", value=2, & + call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/MaxCount", value=2, & rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & diff --git a/SingleModelOpenMPProto/driver.F90 b/SingleModelOpenMPProto/driver.F90 index c2cc6a12..a27b4a94 100644 --- a/SingleModelOpenMPProto/driver.F90 +++ b/SingleModelOpenMPProto/driver.F90 @@ -98,24 +98,34 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/maxCount", value=2, & + call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/MaxCount", value=2, & rc=rc) ! expect 2 PEs per PET in the child VM if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/minStackSize", & + call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/MinStackSize", & value=16*1024*1024, rc=rc) ! stack size no less than 16MiB if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/openMP", value="pin", & - rc=rc) +#if 1 + call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/OpenMpHandling", & + value="SET", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out +#endif +#if 1 + call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/OpenMpNumThreads", & + value=4, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out +#endif ! SetServices for MODEL component call NUOPC_DriverAddComp(driver, "MODEL", modelSS, modelSVM, info=info, & From 085f44d48db9041ee863f1d205d44d4806d7c78e Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Fri, 8 Jan 2021 13:41:07 -0800 Subject: [PATCH 35/68] Additional output to help analyze and validate Grid Transfer. --- AtmOcnTransferGridProto/ocn.F90 | 102 ++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/AtmOcnTransferGridProto/ocn.F90 b/AtmOcnTransferGridProto/ocn.F90 index f4cace93..ae157bf9 100644 --- a/AtmOcnTransferGridProto/ocn.F90 +++ b/AtmOcnTransferGridProto/ocn.F90 @@ -190,6 +190,7 @@ subroutine Realize(model, rc) integer :: dimCount, rank integer :: coordDimMap(2,2) character(160) :: msgString + character(80) :: name #ifdef TEST_MULTI_TILE_GRID type(ESMF_GridComp) :: ioComp #endif @@ -450,6 +451,21 @@ subroutine Realize(model, rc) return ! bail out #endif +#if 1 + ! analyze the Grid and log some info + call ESMF_GridGet(gridIn, name=name, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_PointerLog(gridIn%this, & + prefix="OCN gridIn: name="//trim(name)//": ", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out +#endif + ! importable field: air_pressure_at_sea_level #ifdef CREATE_AND_REALIZE ! This branch shows the standard procedure of calling Realize(). @@ -538,6 +554,21 @@ subroutine Realize(model, rc) return ! bail out #endif +#if 1 + ! analyze the Grid and log some info + call ESMF_GridGet(gridOut, name=name, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_PointerLog(gridOut%this, & + prefix="OCN gridOut: name="//trim(name)//": ", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out +#endif + ! exportable field: sea_surface_temperature call NUOPC_Realize(exportState, gridOut, fieldName="sst", & typekind=ESMF_TYPEKIND_R4, selection="realize_connected_remove_others", & @@ -572,6 +603,20 @@ subroutine Realize(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out +#if 1 + ! analyze the Grid and log some info + call ESMF_GridGet(gridOut, name=name, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_PointerLog(gridOut%this, & + prefix="OCN gridOut: name="//trim(name)//": ", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out +#endif #endif ! exportable field: sea_surface_height_above_sea_level @@ -651,6 +696,21 @@ subroutine Realize(model, rc) fptr(i) = real((arbIndexList(i,2)-1)) * 160.0 / real(jCount) - 80.0 enddo +#if 1 + ! analyze the Grid and log some info + call ESMF_GridGet(gridArb, name=name, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_PointerLog(gridArb%this, & + prefix="OCN gridArb: name="//trim(name)//": ", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out +#endif + ! create a field on the grid fieldArb = ESMF_FieldCreate(gridArb, typekind=ESMF_TYPEKIND_R8, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -874,10 +934,12 @@ subroutine Advance(model, rc) type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field + type(ESMF_Grid) :: grid type(ESMF_Time) :: currTime type(ESMF_TimeInterval) :: timeStep integer, save :: slice=1 character(len=160) :: msgString + character(80) :: fieldName, gridName rc = ESMF_SUCCESS @@ -940,6 +1002,26 @@ subroutine Advance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out +#if 1 + ! analyze the Grid on which this field is created + call ESMF_FieldGet(field, grid=grid, name=fieldName, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_GridGet(grid, name=gridName, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_PointerLog(grid%this, & + prefix="OCN Grid: fieldName="//trim(fieldName)// & + " gridName="//trim(gridName)//": ", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out +#endif call ESMF_StateGet(exportState, itemName="sst", field=field, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -951,6 +1033,26 @@ subroutine Advance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out +#if 1 + ! analyze the Grid on which this field is created + call ESMF_FieldGet(field, grid=grid, name=fieldName, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_GridGet(grid, name=gridName, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_PointerLog(grid%this, & + prefix="OCN Grid: fieldName="//trim(fieldName)// & + " gridName="//trim(gridName)//": ", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out +#endif ! write out the Fields in the importState and exportState call NUOPC_Write(importState, fileNamePrefix="field_ocn_import_", & From 38f15e950f146e7850851829c37960d6bae35f96 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Fri, 8 Jan 2021 16:50:38 -0800 Subject: [PATCH 36/68] Add more logging to see more clearly various aspects of MeshTransfer. --- AtmOcnTransferMeshProto/atm.F90 | 93 ++++++++++++++++++++++++--------- AtmOcnTransferMeshProto/ocn.F90 | 20 +++---- 2 files changed, 79 insertions(+), 34 deletions(-) diff --git a/AtmOcnTransferMeshProto/atm.F90 b/AtmOcnTransferMeshProto/atm.F90 index a6a674bb..ed6c8b03 100644 --- a/AtmOcnTransferMeshProto/atm.F90 +++ b/AtmOcnTransferMeshProto/atm.F90 @@ -146,9 +146,6 @@ subroutine RealizeProvided(model, rc) integer :: i, j real(kind=ESMF_KIND_R8), pointer :: lonPtr(:,:), latPtr(:,:) character(ESMF_MAXSTR) :: transferAction - character(*), parameter :: rName="InitializeRealizeForProvide" - character(ESMF_MAXSTR) :: name - integer :: verbosity rc = ESMF_SUCCESS @@ -256,8 +253,7 @@ subroutine AcceptTransfer(model, rc) type(ESMF_DistGrid) :: elementDG, nodalDG type(ESMF_DistGrid) :: newElementDG, newNodalDG type(ESMF_DELayout) :: delayout - character(*), parameter :: rName="InitializeAcceptChangeDistGrid" - character(ESMF_MAXSTR) :: name + character(80) :: name rc = ESMF_SUCCESS @@ -296,12 +292,16 @@ subroutine AcceptTransfer(model, rc) ! get distgrids out of mesh call ESMF_MeshGet(mesh, nodalDistgrid=nodalDG, elementDistgrid=elementDG, & - rc=rc) + name=name, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out + call ESMF_PointerLog(mesh%this, & + prefix="ATM - AcceptTransfer: exportState Mesh name="//trim(name)//": ",& + rc=rc) + ! The acceptor side can either use the nodal DistGrid, or the element ! DistGrid, or both to define its own decomposition and distribution of ! the transferred Mesh. Use the following two macros to define which @@ -330,8 +330,8 @@ subroutine AcceptTransfer(model, rc) return ! bail out ! report localDeCount to log write (msgString,"(A,I3)") & - "ATM - InitializeAcceptChangeDistGrid: nodal DistGrid "// & - "localDeCount = ", localDeCount + "ATM - AcceptTransfer: exportState Mesh="//trim(name)// & + " nodal DistGrid localDeCount = ", localDeCount call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -367,8 +367,8 @@ subroutine AcceptTransfer(model, rc) return ! bail out ! report localDeCount to log write (msgString,"(A,I3)") & - "ATM - InitializeAcceptChangeDistGrid: element DistGrid "// & - "localDeCount = ", localDeCount + "ATM - AcceptTransfer: exportState Mesh="//trim(name)// & + " element DistGrid localDeCount = ", localDeCount call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -387,21 +387,21 @@ subroutine AcceptTransfer(model, rc) #if (defined USE_NODAL_DG && defined USE_ELEMENT_DG) ! Create a new Mesh on both new DistGrid mesh = ESMF_MeshEmptyCreate(nodalDistGrid=newNodalDG, & - elementDistGrid=newElementDG, rc=rc) + elementDistGrid=newElementDG, name=name, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out #elif (defined USE_NODAL_DG) ! Create a new Mesh on new nodal DistGrid - mesh = ESMF_MeshEmptyCreate(nodalDistGrid=newNodalDG, rc=rc) + mesh = ESMF_MeshEmptyCreate(nodalDistGrid=newNodalDG, name=name, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out #elif (defined USE_ELEMENT_DG) ! Create a new Mesh on new element DistGrid - mesh = ESMF_MeshEmptyCreate(elementDistGrid=newElementDG, rc=rc) + mesh = ESMF_MeshEmptyCreate(elementDistGrid=newElementDG, name=name, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -435,12 +435,16 @@ subroutine AcceptTransfer(model, rc) ! get distgrids out of mesh call ESMF_MeshGet(mesh, nodalDistgrid=nodalDG, elementDistgrid=elementDG, & - rc=rc) + name=name, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out + call ESMF_PointerLog(mesh%this, & + prefix="ATM - AcceptTransfer: importState Mesh name="//trim(name)//": ",& + rc=rc) + ! The acceptor side can either use the nodal DistGrid, or the element ! DistGrid, or both to define its own decomposition and distribution of ! the transferred Mesh. Use the following two macros to define which @@ -471,8 +475,8 @@ subroutine AcceptTransfer(model, rc) return ! bail out ! report localDeCount to log write (msgString,"(A,I3)") & - "ATM - InitializeAcceptChangeDistGrid: nodal DistGrid "// & - "localDeCount = ", localDeCount + "ATM - AcceptTransfer: importState Mesh="//trim(name)// & + " nodal DistGrid localDeCount = ", localDeCount call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -508,8 +512,8 @@ subroutine AcceptTransfer(model, rc) return ! bail out ! report localDeCount to log write (msgString,"(A,I3)") & - "ATM - InitializeAcceptChangeDistGrid: element DistGrid "// & - "localDeCount = ", localDeCount + "ATM - AcceptTransfer: importState Mesh="//trim(name)// & + " element DistGrid localDeCount = ", localDeCount call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -528,21 +532,21 @@ subroutine AcceptTransfer(model, rc) #if (defined USE_NODAL_DG && defined USE_ELEMENT_DG) ! Create a new Mesh on both new DistGrid mesh = ESMF_MeshEmptyCreate(nodalDistGrid=newNodalDG, & - elementDistGrid=newElementDG, rc=rc) + elementDistGrid=newElementDG, name=name, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out #elif (defined USE_NODAL_DG) ! Create a new Mesh on new nodal DistGrid - mesh = ESMF_MeshEmptyCreate(nodalDistGrid=newNodalDG, rc=rc) + mesh = ESMF_MeshEmptyCreate(nodalDistGrid=newNodalDG, name=name, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out #elif (defined USE_ELEMENT_DG) ! Create a new Mesh on new element DistGrid - mesh = ESMF_MeshEmptyCreate(elementDistGrid=newElementDG, rc=rc) + mesh = ESMF_MeshEmptyCreate(elementDistGrid=newElementDG, name=name, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -590,10 +594,7 @@ subroutine RealizeAccepted(model, rc) type(ESMF_Field) :: fieldIn, fieldOut type(ESMF_RouteHandle) :: rh type(ESMF_Mesh) :: mesh - - character(*), parameter :: rName="InitializeAcceptMeshAndRealize" - character(ESMF_MAXSTR) :: name - integer :: verbosity + character(80) :: fieldName, meshName rc = ESMF_SUCCESS @@ -631,6 +632,27 @@ subroutine RealizeAccepted(model, rc) return ! bail out #endif +#if 1 + ! analyze the Mesh on which this field is created + call ESMF_FieldGet(field, mesh=mesh, name=fieldName, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_MeshGet(mesh, name=meshName, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_PointerLog(mesh%this, & + prefix="Atm-exportState Mesh fieldName="//trim(fieldName)// & + " meshName="//trim(meshName)//": ", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out +#endif + fieldOut = field ! keep field for RegridStore() test call ESMF_LogWrite("ATM - Just completed the 'pmsl' Field", & @@ -668,6 +690,27 @@ subroutine RealizeAccepted(model, rc) return ! bail out #endif +#if 1 + ! analyze the Mesh on which this field is created + call ESMF_FieldGet(field, mesh=mesh, name=fieldName, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_MeshGet(mesh, name=meshName, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_PointerLog(mesh%this, & + prefix="Atm-importState Mesh fieldName="//trim(fieldName)// & + " meshName="//trim(meshName)//": ", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out +#endif + fieldIn = field ! keep field for RegridStore() test call ESMF_LogWrite("ATM - Just completed the 'sst' Field", & diff --git a/AtmOcnTransferMeshProto/ocn.F90 b/AtmOcnTransferMeshProto/ocn.F90 index 38ad415b..40855733 100644 --- a/AtmOcnTransferMeshProto/ocn.F90 +++ b/AtmOcnTransferMeshProto/ocn.F90 @@ -133,8 +133,8 @@ subroutine Realize(model, rc) type(ESMF_Field) :: field #endif character(160) :: msgString + character(80) :: name integer :: dimCount, numOwnedElements, numOwnedNodes - character(*), parameter :: rName="InitializeRealize" rc = ESMF_SUCCESS @@ -151,7 +151,7 @@ subroutine Realize(model, rc) #ifdef READ_MESHIN_FROM_FILE ! create from file meshIn = ESMF_MeshCreate("./gx3v7_unstructured.nc", & - fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) + fileformat=ESMF_FILEFORMAT_ESMFMESH, name="OCN-MeshIn", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -198,7 +198,7 @@ subroutine Realize(model, rc) #endif ! convert the Grid into a Mesh - meshIn = ESMF_MeshCreate(grid=gridIn, rc=rc) + meshIn = ESMF_MeshCreate(grid=gridIn, name="OCN-MeshIn", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -221,13 +221,14 @@ subroutine Realize(model, rc) #if 1 ! analyze the Mesh and log some info - call ESMF_MeshGet(meshIn, spatialDim=dimCount, & + call ESMF_MeshGet(meshIn, name=name, spatialDim=dimCount, & numOwnedElements=numOwnedElements, numOwnedNodes=numOwnedNodes, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - write(msgString,*) "OCN meshIn: numOwnedElements=", numOwnedElements, & + write(msgString,*) "OCN meshIn: name=", trim(name), & + " numOwnedElements=", numOwnedElements, & "numOwnedNodes=", numOwnedNodes, "dimCount=", dimCount call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -265,7 +266,7 @@ subroutine Realize(model, rc) #ifdef READ_MESHOUT_FROM_FILE ! create from file meshOut = ESMF_MeshCreate("./fv1.9x2.5_unstructured.nc", & - fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) + fileformat=ESMF_FILEFORMAT_ESMFMESH, name="OCN-GridOut", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -312,7 +313,7 @@ subroutine Realize(model, rc) #endif ! convert the Grid into a Mesh - meshOut = ESMF_MeshCreate(grid=gridOut, rc=rc) + meshOut = ESMF_MeshCreate(grid=gridOut, name="OCN-MeshOut", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -335,13 +336,14 @@ subroutine Realize(model, rc) #if 1 ! analyze the Mesh and log some info - call ESMF_MeshGet(meshOut, spatialDim=dimCount, & + call ESMF_MeshGet(meshOut, name=name, spatialDim=dimCount, & numOwnedElements=numOwnedElements, numOwnedNodes=numOwnedNodes, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - write(msgString,*) "OCN meshOut: numOwnedElements=", numOwnedElements, & + write(msgString,*) "OCN meshOut: name=", trim(name), & + " numOwnedElements=", numOwnedElements, & "numOwnedNodes=", numOwnedNodes, "dimCount=", dimCount call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & From 49833d72e9add0ec864ff196853434b3082f2c0a Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Tue, 26 Jan 2021 18:33:33 -0800 Subject: [PATCH 37/68] Update copyright date for 2021. --- AsyncIOBlockingProto/asyncIOApp.F90 | 2 +- AsyncIOBlockingProto/asyncIODriver.F90 | 2 +- AsyncIOBlockingProto/io.F90 | 2 +- AsyncIOBlockingProto/model.F90 | 2 +- AsyncIONonblockingProto/asyncIOApp.F90 | 2 +- AsyncIONonblockingProto/asyncIODriver.F90 | 2 +- AsyncIONonblockingProto/conn.F90 | 2 +- AsyncIONonblockingProto/io.F90 | 2 +- AsyncIONonblockingProto/model.F90 | 2 +- AtmOcnConOptsProto/atm.F90 | 2 +- AtmOcnConOptsProto/esm.F90 | 2 +- AtmOcnConOptsProto/esmApp.F90 | 2 +- AtmOcnConOptsProto/ocn.F90 | 2 +- AtmOcnConProto/atm.F90 | 2 +- AtmOcnConProto/conn.F90 | 2 +- AtmOcnConProto/esm.F90 | 2 +- AtmOcnConProto/esmApp.F90 | 2 +- AtmOcnConProto/ocn.F90 | 2 +- AtmOcnCplListProto/atm.F90 | 2 +- AtmOcnCplListProto/esm.F90 | 2 +- AtmOcnCplListProto/esmApp.F90 | 2 +- AtmOcnCplListProto/ocn.F90 | 2 +- AtmOcnCplSetProto/atm.F90 | 2 +- AtmOcnCplSetProto/esm.F90 | 2 +- AtmOcnCplSetProto/esmApp.F90 | 2 +- AtmOcnCplSetProto/ocn.F90 | 2 +- AtmOcnFDSynoProto/atm.F90 | 2 +- AtmOcnFDSynoProto/esm.F90 | 2 +- AtmOcnFDSynoProto/esmApp.F90 | 2 +- AtmOcnFDSynoProto/ocn.F90 | 2 +- AtmOcnIceSimpleImplicitProto/atm.F90 | 2 +- AtmOcnIceSimpleImplicitProto/esm.F90 | 2 +- AtmOcnIceSimpleImplicitProto/esmApp.F90 | 2 +- AtmOcnIceSimpleImplicitProto/ice.F90 | 2 +- AtmOcnIceSimpleImplicitProto/ocn.F90 | 2 +- AtmOcnImplicitProto/atm.F90 | 2 +- AtmOcnImplicitProto/esm.F90 | 2 +- AtmOcnImplicitProto/esmApp.F90 | 2 +- AtmOcnImplicitProto/ocn.F90 | 2 +- AtmOcnLndProto/atm.F90 | 2 +- AtmOcnLndProto/esm.F90 | 2 +- AtmOcnLndProto/esmApp.F90 | 2 +- AtmOcnLndProto/lnd.F90 | 2 +- AtmOcnLndProto/ocn.F90 | 2 +- AtmOcnLogNoneProto/atm.F90 | 2 +- AtmOcnLogNoneProto/esm.F90 | 2 +- AtmOcnLogNoneProto/esmApp.F90 | 2 +- AtmOcnLogNoneProto/ocn.F90 | 2 +- AtmOcnMedIngestFromConfigProto/atm.F90 | 2 +- AtmOcnMedIngestFromConfigProto/esm.F90 | 2 +- AtmOcnMedIngestFromConfigProto/esmApp.F90 | 2 +- AtmOcnMedIngestFromConfigProto/med.F90 | 2 +- AtmOcnMedIngestFromConfigProto/ocn.F90 | 2 +- AtmOcnMedIngestFromInternalProto/atm.F90 | 2 +- AtmOcnMedIngestFromInternalProto/esm.F90 | 2 +- AtmOcnMedIngestFromInternalProto/esmApp.F90 | 2 +- AtmOcnMedIngestFromInternalProto/med.F90 | 2 +- AtmOcnMedIngestFromInternalProto/ocn.F90 | 2 +- AtmOcnMedPetListProto/atm.F90 | 2 +- AtmOcnMedPetListProto/esm.F90 | 2 +- AtmOcnMedPetListProto/esmApp.F90 | 2 +- AtmOcnMedPetListProto/med.F90 | 2 +- AtmOcnMedPetListProto/ocn.F90 | 2 +- AtmOcnMedPetListTimescalesProto/atm.F90 | 2 +- AtmOcnMedPetListTimescalesProto/esm.F90 | 2 +- AtmOcnMedPetListTimescalesProto/esmApp.F90 | 2 +- AtmOcnMedPetListTimescalesProto/med.F90 | 2 +- AtmOcnMedPetListTimescalesProto/ocn.F90 | 2 +- AtmOcnMedPetListTimescalesSplitFastProto/atm.F90 | 2 +- AtmOcnMedPetListTimescalesSplitFastProto/esm.F90 | 2 +- AtmOcnMedPetListTimescalesSplitFastProto/esmApp.F90 | 2 +- AtmOcnMedPetListTimescalesSplitFastProto/med.F90 | 2 +- AtmOcnMedPetListTimescalesSplitFastProto/ocn.F90 | 2 +- AtmOcnMedProto/atm.F90 | 2 +- AtmOcnMedProto/esm.F90 | 2 +- AtmOcnMedProto/esmApp.F90 | 2 +- AtmOcnMedProto/med.F90 | 2 +- AtmOcnMedProto/ocn.F90 | 2 +- AtmOcnMedTransferGridMakeMeshProto/atm.F90 | 8 ++++---- AtmOcnMedTransferGridMakeMeshProto/esm.F90 | 8 ++++---- AtmOcnMedTransferGridMakeMeshProto/esmApp.F90 | 8 ++++---- AtmOcnMedTransferGridMakeMeshProto/med.F90 | 8 ++++---- AtmOcnMedTransferGridMakeMeshProto/ocn.F90 | 8 ++++---- AtmOcnMirrorFieldsProto/atm.F90 | 2 +- AtmOcnMirrorFieldsProto/esm.F90 | 2 +- AtmOcnMirrorFieldsProto/esmApp.F90 | 2 +- AtmOcnMirrorFieldsProto/ocn.F90 | 2 +- AtmOcnPetListProto/atm.F90 | 2 +- AtmOcnPetListProto/esm.F90 | 2 +- AtmOcnPetListProto/esmApp.F90 | 2 +- AtmOcnPetListProto/ocn.F90 | 2 +- AtmOcnProto/atm.F90 | 2 +- AtmOcnProto/esm.F90 | 2 +- AtmOcnProto/esmApp.F90 | 2 +- AtmOcnProto/ocn.F90 | 2 +- AtmOcnRtmTwoTimescalesProto/atm.F90 | 2 +- AtmOcnRtmTwoTimescalesProto/esm.F90 | 2 +- AtmOcnRtmTwoTimescalesProto/esmApp.F90 | 2 +- AtmOcnRtmTwoTimescalesProto/ocn.F90 | 2 +- AtmOcnRtmTwoTimescalesProto/rtm.F90 | 2 +- AtmOcnScalarProto/atm.F90 | 2 +- AtmOcnScalarProto/esm.F90 | 2 +- AtmOcnScalarProto/esmApp.F90 | 2 +- AtmOcnScalarProto/ocn.F90 | 2 +- AtmOcnSelectExternalProto/ATM-A/atmA.F90 | 2 +- AtmOcnSelectExternalProto/ATM-B/atmB.F90 | 2 +- AtmOcnSelectExternalProto/ATM-B/procedure.F90 | 2 +- AtmOcnSelectExternalProto/ATM-C/atmC.F90 | 2 +- AtmOcnSelectExternalProto/ATM-C/procedure.F90 | 2 +- AtmOcnSelectExternalProto/ATM-D/atmD.F90 | 2 +- AtmOcnSelectExternalProto/ATM-E/atmE.F90 | 2 +- AtmOcnSelectExternalProto/ATM-F/atmF.C | 8 ++++---- AtmOcnSelectExternalProto/OcnCommon/ocnCommon.F90 | 2 +- AtmOcnSelectExternalProto/OcnCommon/subModule1.F90 | 2 +- AtmOcnSelectExternalProto/OcnCommon/subModule2.F90 | 2 +- AtmOcnSelectExternalProto/OcnModelA/ocn.F90 | 2 +- AtmOcnSelectExternalProto/OcnModelB/ocn.F90 | 2 +- AtmOcnSelectExternalProto/OcnModelC/ocn.F90 | 2 +- AtmOcnSelectExternalProto/esm.F90 | 2 +- AtmOcnSelectExternalProto/esmApp.F90 | 2 +- AtmOcnSelectProto/atmA.F90 | 2 +- AtmOcnSelectProto/atmB.F90 | 2 +- AtmOcnSelectProto/esm.F90 | 2 +- AtmOcnSelectProto/esmApp.F90 | 2 +- AtmOcnSelectProto/ocnA.F90 | 2 +- AtmOcnSelectProto/ocnB.F90 | 2 +- AtmOcnSimpleImplicitProto/atm.F90 | 2 +- AtmOcnSimpleImplicitProto/esm.F90 | 2 +- AtmOcnSimpleImplicitProto/esmApp.F90 | 2 +- AtmOcnSimpleImplicitProto/ocn.F90 | 2 +- AtmOcnTransferGridProto/atm.F90 | 2 +- AtmOcnTransferGridProto/esm.F90 | 2 +- AtmOcnTransferGridProto/esmApp.F90 | 2 +- AtmOcnTransferGridProto/ocn.F90 | 2 +- AtmOcnTransferLocStreamProto/atm.F90 | 2 +- AtmOcnTransferLocStreamProto/esm.F90 | 2 +- AtmOcnTransferLocStreamProto/esmApp.F90 | 2 +- AtmOcnTransferLocStreamProto/ocn.F90 | 2 +- AtmOcnTransferMeshProto/atm.F90 | 2 +- AtmOcnTransferMeshProto/esm.F90 | 2 +- AtmOcnTransferMeshProto/esmApp.F90 | 2 +- AtmOcnTransferMeshProto/ocn.F90 | 2 +- ComponentExplorer/nuopcExplorerApp.F90 | 2 +- ComponentExplorer/nuopcExplorerDriver.F90 | 2 +- ComponentExplorer/nuopcExplorerScript | 2 +- CustomFieldDictionaryProto/driver.F90 | 2 +- CustomFieldDictionaryProto/mainApp.F90 | 2 +- CustomFieldDictionaryProto/model.F90 | 2 +- CustomFieldDictionaryProto/util.F90 | 2 +- DriverInDriverDataDepProto/atm.F90 | 2 +- DriverInDriverDataDepProto/driverChildComp.F90 | 2 +- DriverInDriverDataDepProto/driverParentComp.F90 | 2 +- DriverInDriverDataDepProto/mainApp.F90 | 2 +- DriverInDriverDataDepProto/ocn.F90 | 2 +- DriverInDriverProto/atm.F90 | 2 +- DriverInDriverProto/driverChildComp.F90 | 2 +- DriverInDriverProto/driverParentComp.F90 | 2 +- DriverInDriverProto/mainApp.F90 | 2 +- DriverInDriverProto/ocn.F90 | 2 +- DynPhyProto/atm.F90 | 2 +- DynPhyProto/dyn.F90 | 2 +- DynPhyProto/esmApp.F90 | 2 +- DynPhyProto/phy.F90 | 2 +- ExternalDriverAPIProto/atm.F90 | 2 +- ExternalDriverAPIProto/esm.F90 | 2 +- ExternalDriverAPIProto/externalApp.F90 | 2 +- ExternalDriverAPIProto/ocn.F90 | 2 +- GenericMediatorProto/app.F90 | 2 +- GenericMediatorProto/driver.F90 | 2 +- GenericMediatorProto/mediator.F90 | 2 +- GenericMediatorProto/modelA.F90 | 2 +- GenericMediatorProto/modelB.F90 | 2 +- HierarchyProto/atm.F90 | 2 +- HierarchyProto/dyn.F90 | 2 +- HierarchyProto/esm.F90 | 2 +- HierarchyProto/esmApp.F90 | 2 +- HierarchyProto/ocn.F90 | 2 +- HierarchyProto/phy.F90 | 2 +- NamespaceProto/atm.F90 | 2 +- NamespaceProto/driver.F90 | 2 +- NamespaceProto/mainApp.F90 | 2 +- NamespaceProto/med.F90 | 2 +- NestingMultipleProto/advectDiffComp.F90 | 2 +- NestingMultipleProto/driverComp.F90 | 2 +- NestingMultipleProto/mainApp.F90 | 2 +- NestingSingleProto/advectDiffComp.F90 | 2 +- NestingSingleProto/driverComp.F90 | 2 +- NestingSingleProto/mainApp.F90 | 2 +- NestingTelescopeMultipleProto/advectDiffComp.F90 | 2 +- NestingTelescopeMultipleProto/driverComp.F90 | 2 +- NestingTelescopeMultipleProto/mainApp.F90 | 2 +- SingleModelOpenMPProto/driver.F90 | 2 +- SingleModelOpenMPProto/mainApp.F90 | 2 +- SingleModelOpenMPProto/model.F90 | 2 +- SingleModelProto/driver.F90 | 2 +- SingleModelProto/mainApp.F90 | 2 +- SingleModelProto/model.F90 | 2 +- testProtos.sh | 8 ++++---- 198 files changed, 219 insertions(+), 219 deletions(-) diff --git a/AsyncIOBlockingProto/asyncIOApp.F90 b/AsyncIOBlockingProto/asyncIOApp.F90 index a3ca829d..e8eef94f 100644 --- a/AsyncIOBlockingProto/asyncIOApp.F90 +++ b/AsyncIOBlockingProto/asyncIOApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AsyncIOBlockingProto/asyncIODriver.F90 b/AsyncIOBlockingProto/asyncIODriver.F90 index 2ae7d5b4..262bc93e 100644 --- a/AsyncIOBlockingProto/asyncIODriver.F90 +++ b/AsyncIOBlockingProto/asyncIODriver.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AsyncIOBlockingProto/io.F90 b/AsyncIOBlockingProto/io.F90 index 3ff5ad7a..d48e6ac6 100644 --- a/AsyncIOBlockingProto/io.F90 +++ b/AsyncIOBlockingProto/io.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AsyncIOBlockingProto/model.F90 b/AsyncIOBlockingProto/model.F90 index 82841367..2bce9bc0 100644 --- a/AsyncIOBlockingProto/model.F90 +++ b/AsyncIOBlockingProto/model.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AsyncIONonblockingProto/asyncIOApp.F90 b/AsyncIONonblockingProto/asyncIOApp.F90 index 42f324c6..14bfffd7 100644 --- a/AsyncIONonblockingProto/asyncIOApp.F90 +++ b/AsyncIONonblockingProto/asyncIOApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AsyncIONonblockingProto/asyncIODriver.F90 b/AsyncIONonblockingProto/asyncIODriver.F90 index 9fd5ad85..b0e74eaa 100644 --- a/AsyncIONonblockingProto/asyncIODriver.F90 +++ b/AsyncIONonblockingProto/asyncIODriver.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AsyncIONonblockingProto/conn.F90 b/AsyncIONonblockingProto/conn.F90 index 70ef9bab..04cf5cc9 100644 --- a/AsyncIONonblockingProto/conn.F90 +++ b/AsyncIONonblockingProto/conn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AsyncIONonblockingProto/io.F90 b/AsyncIONonblockingProto/io.F90 index 6b81c1af..90383df3 100644 --- a/AsyncIONonblockingProto/io.F90 +++ b/AsyncIONonblockingProto/io.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AsyncIONonblockingProto/model.F90 b/AsyncIONonblockingProto/model.F90 index 508fe560..6a3a1e7f 100644 --- a/AsyncIONonblockingProto/model.F90 +++ b/AsyncIONonblockingProto/model.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnConOptsProto/atm.F90 b/AtmOcnConOptsProto/atm.F90 index 88817231..184c4f8c 100644 --- a/AtmOcnConOptsProto/atm.F90 +++ b/AtmOcnConOptsProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnConOptsProto/esm.F90 b/AtmOcnConOptsProto/esm.F90 index 122a5a81..6bbe2666 100644 --- a/AtmOcnConOptsProto/esm.F90 +++ b/AtmOcnConOptsProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnConOptsProto/esmApp.F90 b/AtmOcnConOptsProto/esmApp.F90 index 60b17a2a..ccf43d1e 100644 --- a/AtmOcnConOptsProto/esmApp.F90 +++ b/AtmOcnConOptsProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnConOptsProto/ocn.F90 b/AtmOcnConOptsProto/ocn.F90 index e089bfae..88793575 100644 --- a/AtmOcnConOptsProto/ocn.F90 +++ b/AtmOcnConOptsProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnConProto/atm.F90 b/AtmOcnConProto/atm.F90 index 4543bc34..8a4bb50b 100644 --- a/AtmOcnConProto/atm.F90 +++ b/AtmOcnConProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnConProto/conn.F90 b/AtmOcnConProto/conn.F90 index 71dc652a..9df9cd11 100644 --- a/AtmOcnConProto/conn.F90 +++ b/AtmOcnConProto/conn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnConProto/esm.F90 b/AtmOcnConProto/esm.F90 index 9e306ae2..cd1bdc9c 100644 --- a/AtmOcnConProto/esm.F90 +++ b/AtmOcnConProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnConProto/esmApp.F90 b/AtmOcnConProto/esmApp.F90 index 85a857f3..024f9509 100644 --- a/AtmOcnConProto/esmApp.F90 +++ b/AtmOcnConProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnConProto/ocn.F90 b/AtmOcnConProto/ocn.F90 index 14b8708d..6cf33ffe 100644 --- a/AtmOcnConProto/ocn.F90 +++ b/AtmOcnConProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnCplListProto/atm.F90 b/AtmOcnCplListProto/atm.F90 index 2dccad5e..04a8271b 100644 --- a/AtmOcnCplListProto/atm.F90 +++ b/AtmOcnCplListProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnCplListProto/esm.F90 b/AtmOcnCplListProto/esm.F90 index da35142a..0cfce629 100644 --- a/AtmOcnCplListProto/esm.F90 +++ b/AtmOcnCplListProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnCplListProto/esmApp.F90 b/AtmOcnCplListProto/esmApp.F90 index 85a857f3..024f9509 100644 --- a/AtmOcnCplListProto/esmApp.F90 +++ b/AtmOcnCplListProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnCplListProto/ocn.F90 b/AtmOcnCplListProto/ocn.F90 index d824dce7..fc33bfb5 100644 --- a/AtmOcnCplListProto/ocn.F90 +++ b/AtmOcnCplListProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnCplSetProto/atm.F90 b/AtmOcnCplSetProto/atm.F90 index 741c8592..e5bfa5e6 100644 --- a/AtmOcnCplSetProto/atm.F90 +++ b/AtmOcnCplSetProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnCplSetProto/esm.F90 b/AtmOcnCplSetProto/esm.F90 index 24b82266..f4f4ef60 100644 --- a/AtmOcnCplSetProto/esm.F90 +++ b/AtmOcnCplSetProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnCplSetProto/esmApp.F90 b/AtmOcnCplSetProto/esmApp.F90 index 9e5e2ae8..2aaba819 100644 --- a/AtmOcnCplSetProto/esmApp.F90 +++ b/AtmOcnCplSetProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnCplSetProto/ocn.F90 b/AtmOcnCplSetProto/ocn.F90 index 65c5be4a..1ee90f5c 100644 --- a/AtmOcnCplSetProto/ocn.F90 +++ b/AtmOcnCplSetProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnFDSynoProto/atm.F90 b/AtmOcnFDSynoProto/atm.F90 index 1d7ae2c8..c13c2a9f 100644 --- a/AtmOcnFDSynoProto/atm.F90 +++ b/AtmOcnFDSynoProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnFDSynoProto/esm.F90 b/AtmOcnFDSynoProto/esm.F90 index 2364c70c..f40660e4 100644 --- a/AtmOcnFDSynoProto/esm.F90 +++ b/AtmOcnFDSynoProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnFDSynoProto/esmApp.F90 b/AtmOcnFDSynoProto/esmApp.F90 index bc057eac..56222553 100644 --- a/AtmOcnFDSynoProto/esmApp.F90 +++ b/AtmOcnFDSynoProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnFDSynoProto/ocn.F90 b/AtmOcnFDSynoProto/ocn.F90 index 14b8708d..6cf33ffe 100644 --- a/AtmOcnFDSynoProto/ocn.F90 +++ b/AtmOcnFDSynoProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnIceSimpleImplicitProto/atm.F90 b/AtmOcnIceSimpleImplicitProto/atm.F90 index e8655aa6..48f6de2c 100644 --- a/AtmOcnIceSimpleImplicitProto/atm.F90 +++ b/AtmOcnIceSimpleImplicitProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnIceSimpleImplicitProto/esm.F90 b/AtmOcnIceSimpleImplicitProto/esm.F90 index e090b139..15840e78 100644 --- a/AtmOcnIceSimpleImplicitProto/esm.F90 +++ b/AtmOcnIceSimpleImplicitProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnIceSimpleImplicitProto/esmApp.F90 b/AtmOcnIceSimpleImplicitProto/esmApp.F90 index 9e5e2ae8..2aaba819 100644 --- a/AtmOcnIceSimpleImplicitProto/esmApp.F90 +++ b/AtmOcnIceSimpleImplicitProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnIceSimpleImplicitProto/ice.F90 b/AtmOcnIceSimpleImplicitProto/ice.F90 index 4818adb6..39ae826b 100644 --- a/AtmOcnIceSimpleImplicitProto/ice.F90 +++ b/AtmOcnIceSimpleImplicitProto/ice.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnIceSimpleImplicitProto/ocn.F90 b/AtmOcnIceSimpleImplicitProto/ocn.F90 index 7fb44c8b..a250f7aa 100644 --- a/AtmOcnIceSimpleImplicitProto/ocn.F90 +++ b/AtmOcnIceSimpleImplicitProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnImplicitProto/atm.F90 b/AtmOcnImplicitProto/atm.F90 index 50965622..25df558a 100644 --- a/AtmOcnImplicitProto/atm.F90 +++ b/AtmOcnImplicitProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnImplicitProto/esm.F90 b/AtmOcnImplicitProto/esm.F90 index 1256daca..19b24bef 100644 --- a/AtmOcnImplicitProto/esm.F90 +++ b/AtmOcnImplicitProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnImplicitProto/esmApp.F90 b/AtmOcnImplicitProto/esmApp.F90 index 9e5e2ae8..2aaba819 100644 --- a/AtmOcnImplicitProto/esmApp.F90 +++ b/AtmOcnImplicitProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnImplicitProto/ocn.F90 b/AtmOcnImplicitProto/ocn.F90 index 99a058a8..7a6f7670 100644 --- a/AtmOcnImplicitProto/ocn.F90 +++ b/AtmOcnImplicitProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnLndProto/atm.F90 b/AtmOcnLndProto/atm.F90 index 0c3ee36c..ce1a34d9 100644 --- a/AtmOcnLndProto/atm.F90 +++ b/AtmOcnLndProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnLndProto/esm.F90 b/AtmOcnLndProto/esm.F90 index 0e4ce9c9..7cce9210 100644 --- a/AtmOcnLndProto/esm.F90 +++ b/AtmOcnLndProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnLndProto/esmApp.F90 b/AtmOcnLndProto/esmApp.F90 index 9e5e2ae8..2aaba819 100644 --- a/AtmOcnLndProto/esmApp.F90 +++ b/AtmOcnLndProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnLndProto/lnd.F90 b/AtmOcnLndProto/lnd.F90 index a05fa041..710b781f 100644 --- a/AtmOcnLndProto/lnd.F90 +++ b/AtmOcnLndProto/lnd.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnLndProto/ocn.F90 b/AtmOcnLndProto/ocn.F90 index 14b8708d..6cf33ffe 100644 --- a/AtmOcnLndProto/ocn.F90 +++ b/AtmOcnLndProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnLogNoneProto/atm.F90 b/AtmOcnLogNoneProto/atm.F90 index a1e82a22..f351ab65 100644 --- a/AtmOcnLogNoneProto/atm.F90 +++ b/AtmOcnLogNoneProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnLogNoneProto/esm.F90 b/AtmOcnLogNoneProto/esm.F90 index 2364c70c..f40660e4 100644 --- a/AtmOcnLogNoneProto/esm.F90 +++ b/AtmOcnLogNoneProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnLogNoneProto/esmApp.F90 b/AtmOcnLogNoneProto/esmApp.F90 index caa2a4ab..c37d10d5 100644 --- a/AtmOcnLogNoneProto/esmApp.F90 +++ b/AtmOcnLogNoneProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnLogNoneProto/ocn.F90 b/AtmOcnLogNoneProto/ocn.F90 index afecd02a..34cb1fdb 100644 --- a/AtmOcnLogNoneProto/ocn.F90 +++ b/AtmOcnLogNoneProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedIngestFromConfigProto/atm.F90 b/AtmOcnMedIngestFromConfigProto/atm.F90 index a4ffea40..e7eadeff 100644 --- a/AtmOcnMedIngestFromConfigProto/atm.F90 +++ b/AtmOcnMedIngestFromConfigProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedIngestFromConfigProto/esm.F90 b/AtmOcnMedIngestFromConfigProto/esm.F90 index 84a8bbd3..1b9e72e4 100644 --- a/AtmOcnMedIngestFromConfigProto/esm.F90 +++ b/AtmOcnMedIngestFromConfigProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedIngestFromConfigProto/esmApp.F90 b/AtmOcnMedIngestFromConfigProto/esmApp.F90 index 9e5e2ae8..2aaba819 100644 --- a/AtmOcnMedIngestFromConfigProto/esmApp.F90 +++ b/AtmOcnMedIngestFromConfigProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedIngestFromConfigProto/med.F90 b/AtmOcnMedIngestFromConfigProto/med.F90 index 75b0044d..54582918 100644 --- a/AtmOcnMedIngestFromConfigProto/med.F90 +++ b/AtmOcnMedIngestFromConfigProto/med.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedIngestFromConfigProto/ocn.F90 b/AtmOcnMedIngestFromConfigProto/ocn.F90 index 244e44cd..6338c0e9 100644 --- a/AtmOcnMedIngestFromConfigProto/ocn.F90 +++ b/AtmOcnMedIngestFromConfigProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedIngestFromInternalProto/atm.F90 b/AtmOcnMedIngestFromInternalProto/atm.F90 index a4ffea40..e7eadeff 100644 --- a/AtmOcnMedIngestFromInternalProto/atm.F90 +++ b/AtmOcnMedIngestFromInternalProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedIngestFromInternalProto/esm.F90 b/AtmOcnMedIngestFromInternalProto/esm.F90 index dfdda952..d0ac5807 100644 --- a/AtmOcnMedIngestFromInternalProto/esm.F90 +++ b/AtmOcnMedIngestFromInternalProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedIngestFromInternalProto/esmApp.F90 b/AtmOcnMedIngestFromInternalProto/esmApp.F90 index 9e5e2ae8..2aaba819 100644 --- a/AtmOcnMedIngestFromInternalProto/esmApp.F90 +++ b/AtmOcnMedIngestFromInternalProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedIngestFromInternalProto/med.F90 b/AtmOcnMedIngestFromInternalProto/med.F90 index 75b0044d..54582918 100644 --- a/AtmOcnMedIngestFromInternalProto/med.F90 +++ b/AtmOcnMedIngestFromInternalProto/med.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedIngestFromInternalProto/ocn.F90 b/AtmOcnMedIngestFromInternalProto/ocn.F90 index 244e44cd..6338c0e9 100644 --- a/AtmOcnMedIngestFromInternalProto/ocn.F90 +++ b/AtmOcnMedIngestFromInternalProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedPetListProto/atm.F90 b/AtmOcnMedPetListProto/atm.F90 index a4ffea40..e7eadeff 100644 --- a/AtmOcnMedPetListProto/atm.F90 +++ b/AtmOcnMedPetListProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedPetListProto/esm.F90 b/AtmOcnMedPetListProto/esm.F90 index 2df6352f..d3eede3d 100644 --- a/AtmOcnMedPetListProto/esm.F90 +++ b/AtmOcnMedPetListProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedPetListProto/esmApp.F90 b/AtmOcnMedPetListProto/esmApp.F90 index 9e5e2ae8..2aaba819 100644 --- a/AtmOcnMedPetListProto/esmApp.F90 +++ b/AtmOcnMedPetListProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedPetListProto/med.F90 b/AtmOcnMedPetListProto/med.F90 index 570cfd5a..fc331d6e 100644 --- a/AtmOcnMedPetListProto/med.F90 +++ b/AtmOcnMedPetListProto/med.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedPetListProto/ocn.F90 b/AtmOcnMedPetListProto/ocn.F90 index 57880baa..f9e2c55d 100644 --- a/AtmOcnMedPetListProto/ocn.F90 +++ b/AtmOcnMedPetListProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedPetListTimescalesProto/atm.F90 b/AtmOcnMedPetListTimescalesProto/atm.F90 index dee33710..c1ba942f 100644 --- a/AtmOcnMedPetListTimescalesProto/atm.F90 +++ b/AtmOcnMedPetListTimescalesProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedPetListTimescalesProto/esm.F90 b/AtmOcnMedPetListTimescalesProto/esm.F90 index d539cd40..8a9f93fb 100644 --- a/AtmOcnMedPetListTimescalesProto/esm.F90 +++ b/AtmOcnMedPetListTimescalesProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedPetListTimescalesProto/esmApp.F90 b/AtmOcnMedPetListTimescalesProto/esmApp.F90 index 9e5e2ae8..2aaba819 100644 --- a/AtmOcnMedPetListTimescalesProto/esmApp.F90 +++ b/AtmOcnMedPetListTimescalesProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedPetListTimescalesProto/med.F90 b/AtmOcnMedPetListTimescalesProto/med.F90 index c2d3bd55..25e2584c 100644 --- a/AtmOcnMedPetListTimescalesProto/med.F90 +++ b/AtmOcnMedPetListTimescalesProto/med.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedPetListTimescalesProto/ocn.F90 b/AtmOcnMedPetListTimescalesProto/ocn.F90 index 4ea7ca8e..4a65fc57 100644 --- a/AtmOcnMedPetListTimescalesProto/ocn.F90 +++ b/AtmOcnMedPetListTimescalesProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedPetListTimescalesSplitFastProto/atm.F90 b/AtmOcnMedPetListTimescalesSplitFastProto/atm.F90 index 6831f7ca..5298364d 100644 --- a/AtmOcnMedPetListTimescalesSplitFastProto/atm.F90 +++ b/AtmOcnMedPetListTimescalesSplitFastProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedPetListTimescalesSplitFastProto/esm.F90 b/AtmOcnMedPetListTimescalesSplitFastProto/esm.F90 index 6d8f80e0..10108717 100644 --- a/AtmOcnMedPetListTimescalesSplitFastProto/esm.F90 +++ b/AtmOcnMedPetListTimescalesSplitFastProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedPetListTimescalesSplitFastProto/esmApp.F90 b/AtmOcnMedPetListTimescalesSplitFastProto/esmApp.F90 index 9e5e2ae8..2aaba819 100644 --- a/AtmOcnMedPetListTimescalesSplitFastProto/esmApp.F90 +++ b/AtmOcnMedPetListTimescalesSplitFastProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedPetListTimescalesSplitFastProto/med.F90 b/AtmOcnMedPetListTimescalesSplitFastProto/med.F90 index 0868dd53..5b7283d9 100644 --- a/AtmOcnMedPetListTimescalesSplitFastProto/med.F90 +++ b/AtmOcnMedPetListTimescalesSplitFastProto/med.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedPetListTimescalesSplitFastProto/ocn.F90 b/AtmOcnMedPetListTimescalesSplitFastProto/ocn.F90 index d5a0f0a5..33026f93 100644 --- a/AtmOcnMedPetListTimescalesSplitFastProto/ocn.F90 +++ b/AtmOcnMedPetListTimescalesSplitFastProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedProto/atm.F90 b/AtmOcnMedProto/atm.F90 index a4ffea40..e7eadeff 100644 --- a/AtmOcnMedProto/atm.F90 +++ b/AtmOcnMedProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedProto/esm.F90 b/AtmOcnMedProto/esm.F90 index 3a2ec95a..31dd53d3 100644 --- a/AtmOcnMedProto/esm.F90 +++ b/AtmOcnMedProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedProto/esmApp.F90 b/AtmOcnMedProto/esmApp.F90 index 9e5e2ae8..2aaba819 100644 --- a/AtmOcnMedProto/esmApp.F90 +++ b/AtmOcnMedProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedProto/med.F90 b/AtmOcnMedProto/med.F90 index 570cfd5a..fc331d6e 100644 --- a/AtmOcnMedProto/med.F90 +++ b/AtmOcnMedProto/med.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedProto/ocn.F90 b/AtmOcnMedProto/ocn.F90 index 57880baa..f9e2c55d 100644 --- a/AtmOcnMedProto/ocn.F90 +++ b/AtmOcnMedProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMedTransferGridMakeMeshProto/atm.F90 b/AtmOcnMedTransferGridMakeMeshProto/atm.F90 index c5f2cbcb..14db2547 100644 --- a/AtmOcnMedTransferGridMakeMeshProto/atm.F90 +++ b/AtmOcnMedTransferGridMakeMeshProto/atm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2021, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== diff --git a/AtmOcnMedTransferGridMakeMeshProto/esm.F90 b/AtmOcnMedTransferGridMakeMeshProto/esm.F90 index 84db8a51..2551b1f9 100644 --- a/AtmOcnMedTransferGridMakeMeshProto/esm.F90 +++ b/AtmOcnMedTransferGridMakeMeshProto/esm.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2021, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== diff --git a/AtmOcnMedTransferGridMakeMeshProto/esmApp.F90 b/AtmOcnMedTransferGridMakeMeshProto/esmApp.F90 index ed302230..817b65c9 100644 --- a/AtmOcnMedTransferGridMakeMeshProto/esmApp.F90 +++ b/AtmOcnMedTransferGridMakeMeshProto/esmApp.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2021, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== diff --git a/AtmOcnMedTransferGridMakeMeshProto/med.F90 b/AtmOcnMedTransferGridMakeMeshProto/med.F90 index 6a0bbf1e..46c3e9f2 100644 --- a/AtmOcnMedTransferGridMakeMeshProto/med.F90 +++ b/AtmOcnMedTransferGridMakeMeshProto/med.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2021, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== diff --git a/AtmOcnMedTransferGridMakeMeshProto/ocn.F90 b/AtmOcnMedTransferGridMakeMeshProto/ocn.F90 index 9a718daf..2b3c8a8d 100644 --- a/AtmOcnMedTransferGridMakeMeshProto/ocn.F90 +++ b/AtmOcnMedTransferGridMakeMeshProto/ocn.F90 @@ -1,9 +1,9 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! Copyright 2002-2021, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, ! NASA Goddard Space Flight Center. ! Licensed under the University of Illinois-NCSA License. !============================================================================== diff --git a/AtmOcnMirrorFieldsProto/atm.F90 b/AtmOcnMirrorFieldsProto/atm.F90 index c6f67f04..8ec34e8d 100644 --- a/AtmOcnMirrorFieldsProto/atm.F90 +++ b/AtmOcnMirrorFieldsProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMirrorFieldsProto/esm.F90 b/AtmOcnMirrorFieldsProto/esm.F90 index bf4846a4..e3b5e179 100644 --- a/AtmOcnMirrorFieldsProto/esm.F90 +++ b/AtmOcnMirrorFieldsProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMirrorFieldsProto/esmApp.F90 b/AtmOcnMirrorFieldsProto/esmApp.F90 index 9e5e2ae8..2aaba819 100644 --- a/AtmOcnMirrorFieldsProto/esmApp.F90 +++ b/AtmOcnMirrorFieldsProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnMirrorFieldsProto/ocn.F90 b/AtmOcnMirrorFieldsProto/ocn.F90 index 27dda2c4..f9b91701 100644 --- a/AtmOcnMirrorFieldsProto/ocn.F90 +++ b/AtmOcnMirrorFieldsProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnPetListProto/atm.F90 b/AtmOcnPetListProto/atm.F90 index 2122806c..9ccf6e87 100644 --- a/AtmOcnPetListProto/atm.F90 +++ b/AtmOcnPetListProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnPetListProto/esm.F90 b/AtmOcnPetListProto/esm.F90 index 086e3fb5..94f7d084 100644 --- a/AtmOcnPetListProto/esm.F90 +++ b/AtmOcnPetListProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnPetListProto/esmApp.F90 b/AtmOcnPetListProto/esmApp.F90 index 9e5e2ae8..2aaba819 100644 --- a/AtmOcnPetListProto/esmApp.F90 +++ b/AtmOcnPetListProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnPetListProto/ocn.F90 b/AtmOcnPetListProto/ocn.F90 index 74955cae..64e027c1 100644 --- a/AtmOcnPetListProto/ocn.F90 +++ b/AtmOcnPetListProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnProto/atm.F90 b/AtmOcnProto/atm.F90 index 8299589c..a7f7d8e4 100644 --- a/AtmOcnProto/atm.F90 +++ b/AtmOcnProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnProto/esm.F90 b/AtmOcnProto/esm.F90 index 2364c70c..f40660e4 100644 --- a/AtmOcnProto/esm.F90 +++ b/AtmOcnProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnProto/esmApp.F90 b/AtmOcnProto/esmApp.F90 index 9e5e2ae8..2aaba819 100644 --- a/AtmOcnProto/esmApp.F90 +++ b/AtmOcnProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnProto/ocn.F90 b/AtmOcnProto/ocn.F90 index afecd02a..34cb1fdb 100644 --- a/AtmOcnProto/ocn.F90 +++ b/AtmOcnProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnRtmTwoTimescalesProto/atm.F90 b/AtmOcnRtmTwoTimescalesProto/atm.F90 index 7b37bac9..5545094c 100644 --- a/AtmOcnRtmTwoTimescalesProto/atm.F90 +++ b/AtmOcnRtmTwoTimescalesProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnRtmTwoTimescalesProto/esm.F90 b/AtmOcnRtmTwoTimescalesProto/esm.F90 index 77d5d893..734cb75c 100644 --- a/AtmOcnRtmTwoTimescalesProto/esm.F90 +++ b/AtmOcnRtmTwoTimescalesProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnRtmTwoTimescalesProto/esmApp.F90 b/AtmOcnRtmTwoTimescalesProto/esmApp.F90 index 8f083c49..d31ea8ab 100644 --- a/AtmOcnRtmTwoTimescalesProto/esmApp.F90 +++ b/AtmOcnRtmTwoTimescalesProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnRtmTwoTimescalesProto/ocn.F90 b/AtmOcnRtmTwoTimescalesProto/ocn.F90 index 1af3350b..680ed4c8 100644 --- a/AtmOcnRtmTwoTimescalesProto/ocn.F90 +++ b/AtmOcnRtmTwoTimescalesProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnRtmTwoTimescalesProto/rtm.F90 b/AtmOcnRtmTwoTimescalesProto/rtm.F90 index 2922430e..452daad2 100644 --- a/AtmOcnRtmTwoTimescalesProto/rtm.F90 +++ b/AtmOcnRtmTwoTimescalesProto/rtm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnScalarProto/atm.F90 b/AtmOcnScalarProto/atm.F90 index 6e32c394..ae0b10d9 100644 --- a/AtmOcnScalarProto/atm.F90 +++ b/AtmOcnScalarProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnScalarProto/esm.F90 b/AtmOcnScalarProto/esm.F90 index 20325f10..a68d0772 100644 --- a/AtmOcnScalarProto/esm.F90 +++ b/AtmOcnScalarProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnScalarProto/esmApp.F90 b/AtmOcnScalarProto/esmApp.F90 index 5b9cf7c2..f172f40c 100644 --- a/AtmOcnScalarProto/esmApp.F90 +++ b/AtmOcnScalarProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnScalarProto/ocn.F90 b/AtmOcnScalarProto/ocn.F90 index ae225afd..5a2f92ce 100644 --- a/AtmOcnScalarProto/ocn.F90 +++ b/AtmOcnScalarProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectExternalProto/ATM-A/atmA.F90 b/AtmOcnSelectExternalProto/ATM-A/atmA.F90 index a85c94fb..68d3f52b 100644 --- a/AtmOcnSelectExternalProto/ATM-A/atmA.F90 +++ b/AtmOcnSelectExternalProto/ATM-A/atmA.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectExternalProto/ATM-B/atmB.F90 b/AtmOcnSelectExternalProto/ATM-B/atmB.F90 index beb57109..965baa78 100644 --- a/AtmOcnSelectExternalProto/ATM-B/atmB.F90 +++ b/AtmOcnSelectExternalProto/ATM-B/atmB.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectExternalProto/ATM-B/procedure.F90 b/AtmOcnSelectExternalProto/ATM-B/procedure.F90 index 5f112b6e..c5df33a6 100644 --- a/AtmOcnSelectExternalProto/ATM-B/procedure.F90 +++ b/AtmOcnSelectExternalProto/ATM-B/procedure.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectExternalProto/ATM-C/atmC.F90 b/AtmOcnSelectExternalProto/ATM-C/atmC.F90 index f417b30d..72877fef 100644 --- a/AtmOcnSelectExternalProto/ATM-C/atmC.F90 +++ b/AtmOcnSelectExternalProto/ATM-C/atmC.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectExternalProto/ATM-C/procedure.F90 b/AtmOcnSelectExternalProto/ATM-C/procedure.F90 index 6e1de3ae..9cde09c2 100644 --- a/AtmOcnSelectExternalProto/ATM-C/procedure.F90 +++ b/AtmOcnSelectExternalProto/ATM-C/procedure.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectExternalProto/ATM-D/atmD.F90 b/AtmOcnSelectExternalProto/ATM-D/atmD.F90 index 5402999c..85001b2c 100644 --- a/AtmOcnSelectExternalProto/ATM-D/atmD.F90 +++ b/AtmOcnSelectExternalProto/ATM-D/atmD.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectExternalProto/ATM-E/atmE.F90 b/AtmOcnSelectExternalProto/ATM-E/atmE.F90 index e03941b5..1a5b8781 100644 --- a/AtmOcnSelectExternalProto/ATM-E/atmE.F90 +++ b/AtmOcnSelectExternalProto/ATM-E/atmE.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectExternalProto/ATM-F/atmF.C b/AtmOcnSelectExternalProto/ATM-F/atmF.C index 3a9d4d73..982d3f3d 100644 --- a/AtmOcnSelectExternalProto/ATM-F/atmF.C +++ b/AtmOcnSelectExternalProto/ATM-F/atmF.C @@ -1,9 +1,9 @@ //============================================================================== // Earth System Modeling Framework -// Copyright 2002-2020, University Corporation for Atmospheric Research, -// Massachusetts Institute of Technology, Geophysical Fluid Dynamics -// Laboratory, University of Michigan, National Centers for Environmental -// Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +// Copyright 2002-2021, University Corporation for Atmospheric Research, +// Massachusetts Institute of Technology, Geophysical Fluid Dynamics +// Laboratory, University of Michigan, National Centers for Environmental +// Prediction, Los Alamos National Laboratory, Argonne National Laboratory, // NASA Goddard Space Flight Center. // Licensed under the University of Illinois-NCSA License. //============================================================================== diff --git a/AtmOcnSelectExternalProto/OcnCommon/ocnCommon.F90 b/AtmOcnSelectExternalProto/OcnCommon/ocnCommon.F90 index cf3efc32..0a8448ac 100644 --- a/AtmOcnSelectExternalProto/OcnCommon/ocnCommon.F90 +++ b/AtmOcnSelectExternalProto/OcnCommon/ocnCommon.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectExternalProto/OcnCommon/subModule1.F90 b/AtmOcnSelectExternalProto/OcnCommon/subModule1.F90 index c07ed7fa..65a4b4bf 100644 --- a/AtmOcnSelectExternalProto/OcnCommon/subModule1.F90 +++ b/AtmOcnSelectExternalProto/OcnCommon/subModule1.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectExternalProto/OcnCommon/subModule2.F90 b/AtmOcnSelectExternalProto/OcnCommon/subModule2.F90 index 7126d52f..120898cb 100644 --- a/AtmOcnSelectExternalProto/OcnCommon/subModule2.F90 +++ b/AtmOcnSelectExternalProto/OcnCommon/subModule2.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectExternalProto/OcnModelA/ocn.F90 b/AtmOcnSelectExternalProto/OcnModelA/ocn.F90 index c6185f3b..4cebb243 100644 --- a/AtmOcnSelectExternalProto/OcnModelA/ocn.F90 +++ b/AtmOcnSelectExternalProto/OcnModelA/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectExternalProto/OcnModelB/ocn.F90 b/AtmOcnSelectExternalProto/OcnModelB/ocn.F90 index 3037d5df..882346da 100644 --- a/AtmOcnSelectExternalProto/OcnModelB/ocn.F90 +++ b/AtmOcnSelectExternalProto/OcnModelB/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectExternalProto/OcnModelC/ocn.F90 b/AtmOcnSelectExternalProto/OcnModelC/ocn.F90 index 0bf4f2cc..e81f1dde 100644 --- a/AtmOcnSelectExternalProto/OcnModelC/ocn.F90 +++ b/AtmOcnSelectExternalProto/OcnModelC/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectExternalProto/esm.F90 b/AtmOcnSelectExternalProto/esm.F90 index 8766140e..0000bc33 100644 --- a/AtmOcnSelectExternalProto/esm.F90 +++ b/AtmOcnSelectExternalProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectExternalProto/esmApp.F90 b/AtmOcnSelectExternalProto/esmApp.F90 index 9e5e2ae8..2aaba819 100644 --- a/AtmOcnSelectExternalProto/esmApp.F90 +++ b/AtmOcnSelectExternalProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectProto/atmA.F90 b/AtmOcnSelectProto/atmA.F90 index a85c94fb..68d3f52b 100644 --- a/AtmOcnSelectProto/atmA.F90 +++ b/AtmOcnSelectProto/atmA.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectProto/atmB.F90 b/AtmOcnSelectProto/atmB.F90 index 08cd6614..44de5aa1 100644 --- a/AtmOcnSelectProto/atmB.F90 +++ b/AtmOcnSelectProto/atmB.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectProto/esm.F90 b/AtmOcnSelectProto/esm.F90 index ccf9299d..becaf293 100644 --- a/AtmOcnSelectProto/esm.F90 +++ b/AtmOcnSelectProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectProto/esmApp.F90 b/AtmOcnSelectProto/esmApp.F90 index 9e5e2ae8..2aaba819 100644 --- a/AtmOcnSelectProto/esmApp.F90 +++ b/AtmOcnSelectProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectProto/ocnA.F90 b/AtmOcnSelectProto/ocnA.F90 index 687a7e53..b1740e11 100644 --- a/AtmOcnSelectProto/ocnA.F90 +++ b/AtmOcnSelectProto/ocnA.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSelectProto/ocnB.F90 b/AtmOcnSelectProto/ocnB.F90 index f2996933..bf5efba9 100644 --- a/AtmOcnSelectProto/ocnB.F90 +++ b/AtmOcnSelectProto/ocnB.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSimpleImplicitProto/atm.F90 b/AtmOcnSimpleImplicitProto/atm.F90 index 89b857eb..dc3f55ed 100644 --- a/AtmOcnSimpleImplicitProto/atm.F90 +++ b/AtmOcnSimpleImplicitProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSimpleImplicitProto/esm.F90 b/AtmOcnSimpleImplicitProto/esm.F90 index 1f87958a..ce1b2cdc 100644 --- a/AtmOcnSimpleImplicitProto/esm.F90 +++ b/AtmOcnSimpleImplicitProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSimpleImplicitProto/esmApp.F90 b/AtmOcnSimpleImplicitProto/esmApp.F90 index 9e5e2ae8..2aaba819 100644 --- a/AtmOcnSimpleImplicitProto/esmApp.F90 +++ b/AtmOcnSimpleImplicitProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnSimpleImplicitProto/ocn.F90 b/AtmOcnSimpleImplicitProto/ocn.F90 index d291a0ec..d4cee067 100644 --- a/AtmOcnSimpleImplicitProto/ocn.F90 +++ b/AtmOcnSimpleImplicitProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnTransferGridProto/atm.F90 b/AtmOcnTransferGridProto/atm.F90 index e06fdf3e..1aeba592 100644 --- a/AtmOcnTransferGridProto/atm.F90 +++ b/AtmOcnTransferGridProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnTransferGridProto/esm.F90 b/AtmOcnTransferGridProto/esm.F90 index ae86ac6f..f2ca4706 100644 --- a/AtmOcnTransferGridProto/esm.F90 +++ b/AtmOcnTransferGridProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnTransferGridProto/esmApp.F90 b/AtmOcnTransferGridProto/esmApp.F90 index 9e5e2ae8..2aaba819 100644 --- a/AtmOcnTransferGridProto/esmApp.F90 +++ b/AtmOcnTransferGridProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnTransferGridProto/ocn.F90 b/AtmOcnTransferGridProto/ocn.F90 index ae157bf9..cffcd676 100644 --- a/AtmOcnTransferGridProto/ocn.F90 +++ b/AtmOcnTransferGridProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnTransferLocStreamProto/atm.F90 b/AtmOcnTransferLocStreamProto/atm.F90 index 5cfeb935..8cf1e698 100644 --- a/AtmOcnTransferLocStreamProto/atm.F90 +++ b/AtmOcnTransferLocStreamProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnTransferLocStreamProto/esm.F90 b/AtmOcnTransferLocStreamProto/esm.F90 index 4751beaa..1064bdfd 100644 --- a/AtmOcnTransferLocStreamProto/esm.F90 +++ b/AtmOcnTransferLocStreamProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnTransferLocStreamProto/esmApp.F90 b/AtmOcnTransferLocStreamProto/esmApp.F90 index 9e5e2ae8..2aaba819 100644 --- a/AtmOcnTransferLocStreamProto/esmApp.F90 +++ b/AtmOcnTransferLocStreamProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnTransferLocStreamProto/ocn.F90 b/AtmOcnTransferLocStreamProto/ocn.F90 index 4f02a1c5..933649ed 100644 --- a/AtmOcnTransferLocStreamProto/ocn.F90 +++ b/AtmOcnTransferLocStreamProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnTransferMeshProto/atm.F90 b/AtmOcnTransferMeshProto/atm.F90 index ed6c8b03..aceb506b 100644 --- a/AtmOcnTransferMeshProto/atm.F90 +++ b/AtmOcnTransferMeshProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnTransferMeshProto/esm.F90 b/AtmOcnTransferMeshProto/esm.F90 index d4adad58..2332fceb 100644 --- a/AtmOcnTransferMeshProto/esm.F90 +++ b/AtmOcnTransferMeshProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnTransferMeshProto/esmApp.F90 b/AtmOcnTransferMeshProto/esmApp.F90 index 9e5e2ae8..2aaba819 100644 --- a/AtmOcnTransferMeshProto/esmApp.F90 +++ b/AtmOcnTransferMeshProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/AtmOcnTransferMeshProto/ocn.F90 b/AtmOcnTransferMeshProto/ocn.F90 index 40855733..ca643640 100644 --- a/AtmOcnTransferMeshProto/ocn.F90 +++ b/AtmOcnTransferMeshProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/ComponentExplorer/nuopcExplorerApp.F90 b/ComponentExplorer/nuopcExplorerApp.F90 index 24f00df1..a5d12380 100644 --- a/ComponentExplorer/nuopcExplorerApp.F90 +++ b/ComponentExplorer/nuopcExplorerApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/ComponentExplorer/nuopcExplorerDriver.F90 b/ComponentExplorer/nuopcExplorerDriver.F90 index e02bddb6..086f9584 100644 --- a/ComponentExplorer/nuopcExplorerDriver.F90 +++ b/ComponentExplorer/nuopcExplorerDriver.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/ComponentExplorer/nuopcExplorerScript b/ComponentExplorer/nuopcExplorerScript index dbef736a..dce04b5a 100755 --- a/ComponentExplorer/nuopcExplorerScript +++ b/ComponentExplorer/nuopcExplorerScript @@ -2,7 +2,7 @@ #============================================================================== # Earth System Modeling Framework -# Copyright 2002-2020, University Corporation for Atmospheric Research, +# Copyright 2002-2021, University Corporation for Atmospheric Research, # Massachusetts Institute of Technology, Geophysical Fluid Dynamics # Laboratory, University of Michigan, National Centers for Environmental # Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/CustomFieldDictionaryProto/driver.F90 b/CustomFieldDictionaryProto/driver.F90 index 56c289ae..a69685f1 100644 --- a/CustomFieldDictionaryProto/driver.F90 +++ b/CustomFieldDictionaryProto/driver.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/CustomFieldDictionaryProto/mainApp.F90 b/CustomFieldDictionaryProto/mainApp.F90 index b94ef4c9..6cb5b643 100644 --- a/CustomFieldDictionaryProto/mainApp.F90 +++ b/CustomFieldDictionaryProto/mainApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/CustomFieldDictionaryProto/model.F90 b/CustomFieldDictionaryProto/model.F90 index 1c520431..666bcfb5 100644 --- a/CustomFieldDictionaryProto/model.F90 +++ b/CustomFieldDictionaryProto/model.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/CustomFieldDictionaryProto/util.F90 b/CustomFieldDictionaryProto/util.F90 index 13058f02..5f4f386b 100644 --- a/CustomFieldDictionaryProto/util.F90 +++ b/CustomFieldDictionaryProto/util.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/DriverInDriverDataDepProto/atm.F90 b/DriverInDriverDataDepProto/atm.F90 index bccaf466..3cb63f21 100644 --- a/DriverInDriverDataDepProto/atm.F90 +++ b/DriverInDriverDataDepProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/DriverInDriverDataDepProto/driverChildComp.F90 b/DriverInDriverDataDepProto/driverChildComp.F90 index 8cf6a4fa..209d7a17 100644 --- a/DriverInDriverDataDepProto/driverChildComp.F90 +++ b/DriverInDriverDataDepProto/driverChildComp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/DriverInDriverDataDepProto/driverParentComp.F90 b/DriverInDriverDataDepProto/driverParentComp.F90 index aa276eda..3a37ef77 100644 --- a/DriverInDriverDataDepProto/driverParentComp.F90 +++ b/DriverInDriverDataDepProto/driverParentComp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/DriverInDriverDataDepProto/mainApp.F90 b/DriverInDriverDataDepProto/mainApp.F90 index 8f142702..e9b614d1 100644 --- a/DriverInDriverDataDepProto/mainApp.F90 +++ b/DriverInDriverDataDepProto/mainApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/DriverInDriverDataDepProto/ocn.F90 b/DriverInDriverDataDepProto/ocn.F90 index ee79e646..ac1f1186 100644 --- a/DriverInDriverDataDepProto/ocn.F90 +++ b/DriverInDriverDataDepProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/DriverInDriverProto/atm.F90 b/DriverInDriverProto/atm.F90 index 27d3dff8..c656aa51 100644 --- a/DriverInDriverProto/atm.F90 +++ b/DriverInDriverProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/DriverInDriverProto/driverChildComp.F90 b/DriverInDriverProto/driverChildComp.F90 index 8cf6a4fa..209d7a17 100644 --- a/DriverInDriverProto/driverChildComp.F90 +++ b/DriverInDriverProto/driverChildComp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/DriverInDriverProto/driverParentComp.F90 b/DriverInDriverProto/driverParentComp.F90 index aa276eda..3a37ef77 100644 --- a/DriverInDriverProto/driverParentComp.F90 +++ b/DriverInDriverProto/driverParentComp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/DriverInDriverProto/mainApp.F90 b/DriverInDriverProto/mainApp.F90 index 8f142702..e9b614d1 100644 --- a/DriverInDriverProto/mainApp.F90 +++ b/DriverInDriverProto/mainApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/DriverInDriverProto/ocn.F90 b/DriverInDriverProto/ocn.F90 index 3c0af461..ed25dba1 100644 --- a/DriverInDriverProto/ocn.F90 +++ b/DriverInDriverProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/DynPhyProto/atm.F90 b/DynPhyProto/atm.F90 index 870dbbb7..faf4ee5c 100644 --- a/DynPhyProto/atm.F90 +++ b/DynPhyProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/DynPhyProto/dyn.F90 b/DynPhyProto/dyn.F90 index d7909091..a2329350 100644 --- a/DynPhyProto/dyn.F90 +++ b/DynPhyProto/dyn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/DynPhyProto/esmApp.F90 b/DynPhyProto/esmApp.F90 index 9eda6f13..efc205c3 100644 --- a/DynPhyProto/esmApp.F90 +++ b/DynPhyProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/DynPhyProto/phy.F90 b/DynPhyProto/phy.F90 index 0f9c60df..7199ffd0 100644 --- a/DynPhyProto/phy.F90 +++ b/DynPhyProto/phy.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/ExternalDriverAPIProto/atm.F90 b/ExternalDriverAPIProto/atm.F90 index 6725859d..45661559 100644 --- a/ExternalDriverAPIProto/atm.F90 +++ b/ExternalDriverAPIProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/ExternalDriverAPIProto/esm.F90 b/ExternalDriverAPIProto/esm.F90 index 7e9d4823..91fd57c9 100644 --- a/ExternalDriverAPIProto/esm.F90 +++ b/ExternalDriverAPIProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/ExternalDriverAPIProto/externalApp.F90 b/ExternalDriverAPIProto/externalApp.F90 index e7b51e5e..60a7a30c 100644 --- a/ExternalDriverAPIProto/externalApp.F90 +++ b/ExternalDriverAPIProto/externalApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/ExternalDriverAPIProto/ocn.F90 b/ExternalDriverAPIProto/ocn.F90 index aa71b3ea..eafeb595 100644 --- a/ExternalDriverAPIProto/ocn.F90 +++ b/ExternalDriverAPIProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/GenericMediatorProto/app.F90 b/GenericMediatorProto/app.F90 index 3ad01e78..ac2f3d3b 100644 --- a/GenericMediatorProto/app.F90 +++ b/GenericMediatorProto/app.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/GenericMediatorProto/driver.F90 b/GenericMediatorProto/driver.F90 index bbc56e27..011e7b73 100644 --- a/GenericMediatorProto/driver.F90 +++ b/GenericMediatorProto/driver.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/GenericMediatorProto/mediator.F90 b/GenericMediatorProto/mediator.F90 index 15ee081a..e9e82aa8 100644 --- a/GenericMediatorProto/mediator.F90 +++ b/GenericMediatorProto/mediator.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/GenericMediatorProto/modelA.F90 b/GenericMediatorProto/modelA.F90 index 2c54c175..50969c33 100644 --- a/GenericMediatorProto/modelA.F90 +++ b/GenericMediatorProto/modelA.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/GenericMediatorProto/modelB.F90 b/GenericMediatorProto/modelB.F90 index b4612caa..0399bca4 100644 --- a/GenericMediatorProto/modelB.F90 +++ b/GenericMediatorProto/modelB.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/HierarchyProto/atm.F90 b/HierarchyProto/atm.F90 index a49479e7..5d710589 100644 --- a/HierarchyProto/atm.F90 +++ b/HierarchyProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/HierarchyProto/dyn.F90 b/HierarchyProto/dyn.F90 index 636a55b1..f758061f 100644 --- a/HierarchyProto/dyn.F90 +++ b/HierarchyProto/dyn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/HierarchyProto/esm.F90 b/HierarchyProto/esm.F90 index 1e54b2b3..25d65728 100644 --- a/HierarchyProto/esm.F90 +++ b/HierarchyProto/esm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/HierarchyProto/esmApp.F90 b/HierarchyProto/esmApp.F90 index 0b0e5775..b9619e52 100644 --- a/HierarchyProto/esmApp.F90 +++ b/HierarchyProto/esmApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/HierarchyProto/ocn.F90 b/HierarchyProto/ocn.F90 index 7d864222..215fdaa6 100644 --- a/HierarchyProto/ocn.F90 +++ b/HierarchyProto/ocn.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/HierarchyProto/phy.F90 b/HierarchyProto/phy.F90 index 4acc074f..1bc2a1ed 100644 --- a/HierarchyProto/phy.F90 +++ b/HierarchyProto/phy.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/NamespaceProto/atm.F90 b/NamespaceProto/atm.F90 index 78257204..5f7242a1 100644 --- a/NamespaceProto/atm.F90 +++ b/NamespaceProto/atm.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/NamespaceProto/driver.F90 b/NamespaceProto/driver.F90 index 224c7840..cf4a9649 100644 --- a/NamespaceProto/driver.F90 +++ b/NamespaceProto/driver.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/NamespaceProto/mainApp.F90 b/NamespaceProto/mainApp.F90 index dcac5820..f2fbd953 100644 --- a/NamespaceProto/mainApp.F90 +++ b/NamespaceProto/mainApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/NamespaceProto/med.F90 b/NamespaceProto/med.F90 index 0158bea8..087e4c34 100644 --- a/NamespaceProto/med.F90 +++ b/NamespaceProto/med.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/NestingMultipleProto/advectDiffComp.F90 b/NestingMultipleProto/advectDiffComp.F90 index fe6907f0..4538145a 100644 --- a/NestingMultipleProto/advectDiffComp.F90 +++ b/NestingMultipleProto/advectDiffComp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/NestingMultipleProto/driverComp.F90 b/NestingMultipleProto/driverComp.F90 index 02601c92..1a1fb954 100644 --- a/NestingMultipleProto/driverComp.F90 +++ b/NestingMultipleProto/driverComp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/NestingMultipleProto/mainApp.F90 b/NestingMultipleProto/mainApp.F90 index b4b352a4..ebcabbf7 100644 --- a/NestingMultipleProto/mainApp.F90 +++ b/NestingMultipleProto/mainApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/NestingSingleProto/advectDiffComp.F90 b/NestingSingleProto/advectDiffComp.F90 index de129451..a67fd963 100644 --- a/NestingSingleProto/advectDiffComp.F90 +++ b/NestingSingleProto/advectDiffComp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/NestingSingleProto/driverComp.F90 b/NestingSingleProto/driverComp.F90 index f8886df6..2424e0c9 100644 --- a/NestingSingleProto/driverComp.F90 +++ b/NestingSingleProto/driverComp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/NestingSingleProto/mainApp.F90 b/NestingSingleProto/mainApp.F90 index b4b352a4..ebcabbf7 100644 --- a/NestingSingleProto/mainApp.F90 +++ b/NestingSingleProto/mainApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/NestingTelescopeMultipleProto/advectDiffComp.F90 b/NestingTelescopeMultipleProto/advectDiffComp.F90 index 2c9ec59e..e6013e0f 100644 --- a/NestingTelescopeMultipleProto/advectDiffComp.F90 +++ b/NestingTelescopeMultipleProto/advectDiffComp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/NestingTelescopeMultipleProto/driverComp.F90 b/NestingTelescopeMultipleProto/driverComp.F90 index 0a2e8b96..ae72d633 100644 --- a/NestingTelescopeMultipleProto/driverComp.F90 +++ b/NestingTelescopeMultipleProto/driverComp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/NestingTelescopeMultipleProto/mainApp.F90 b/NestingTelescopeMultipleProto/mainApp.F90 index b4b352a4..ebcabbf7 100644 --- a/NestingTelescopeMultipleProto/mainApp.F90 +++ b/NestingTelescopeMultipleProto/mainApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/SingleModelOpenMPProto/driver.F90 b/SingleModelOpenMPProto/driver.F90 index a27b4a94..0b58f118 100644 --- a/SingleModelOpenMPProto/driver.F90 +++ b/SingleModelOpenMPProto/driver.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/SingleModelOpenMPProto/mainApp.F90 b/SingleModelOpenMPProto/mainApp.F90 index 27058fc8..eb5ee6ff 100644 --- a/SingleModelOpenMPProto/mainApp.F90 +++ b/SingleModelOpenMPProto/mainApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/SingleModelOpenMPProto/model.F90 b/SingleModelOpenMPProto/model.F90 index 2a6c106f..2ba08aa6 100644 --- a/SingleModelOpenMPProto/model.F90 +++ b/SingleModelOpenMPProto/model.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/SingleModelProto/driver.F90 b/SingleModelProto/driver.F90 index 1c0bbb0d..03e47beb 100644 --- a/SingleModelProto/driver.F90 +++ b/SingleModelProto/driver.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/SingleModelProto/mainApp.F90 b/SingleModelProto/mainApp.F90 index dcac5820..f2fbd953 100644 --- a/SingleModelProto/mainApp.F90 +++ b/SingleModelProto/mainApp.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/SingleModelProto/model.F90 b/SingleModelProto/model.F90 index 6c6832f4..2549baee 100644 --- a/SingleModelProto/model.F90 +++ b/SingleModelProto/model.F90 @@ -1,6 +1,6 @@ !============================================================================== ! Earth System Modeling Framework -! Copyright 2002-2020, University Corporation for Atmospheric Research, +! Copyright 2002-2021, University Corporation for Atmospheric Research, ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics ! Laboratory, University of Michigan, National Centers for Environmental ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, diff --git a/testProtos.sh b/testProtos.sh index 9426eff7..9f4be0e6 100755 --- a/testProtos.sh +++ b/testProtos.sh @@ -2,10 +2,10 @@ #============================================================================== # Earth System Modeling Framework -# Copyright 2002-2020, University Corporation for Atmospheric Research, -# Massachusetts Institute of Technology, Geophysical Fluid Dynamics -# Laboratory, University of Michigan, National Centers for Environmental -# Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +# Copyright 2002-2021, University Corporation for Atmospheric Research, +# Massachusetts Institute of Technology, Geophysical Fluid Dynamics +# Laboratory, University of Michigan, National Centers for Environmental +# Prediction, Los Alamos National Laboratory, Argonne National Laboratory, # NASA Goddard Space Flight Center. # Licensed under the University of Illinois-NCSA License. #============================================================================== From 1f85c6ebe977dd9b9ebb552261cc7211a293e162 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Thu, 28 Jan 2021 12:35:59 -0800 Subject: [PATCH 38/68] Cleanup around OpenMP section. --- AtmOcnMirrorFieldsProto/atm.F90 | 18 +++++------------- AtmOcnMirrorFieldsProto/ocn.F90 | 18 +++++------------- SingleModelOpenMPProto/model.F90 | 15 +-------------- 3 files changed, 11 insertions(+), 40 deletions(-) diff --git a/AtmOcnMirrorFieldsProto/atm.F90 b/AtmOcnMirrorFieldsProto/atm.F90 index c6f67f04..ecfeb824 100644 --- a/AtmOcnMirrorFieldsProto/atm.F90 +++ b/AtmOcnMirrorFieldsProto/atm.F90 @@ -594,7 +594,7 @@ subroutine Advance(model, rc) type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState type(ESMF_VM) :: vm - integer :: localPet, localPeCount + integer :: currentSsiPe integer, save :: slice=1 character(len=160) :: msgString @@ -611,16 +611,6 @@ subroutine Advance(model, rc) ! Query the VM of the component for the localPeCount and set OpenMP ! num_threads accordingly. call ESMF_GridCompGet(model, vm=vm, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_VMGet(vm, localPet=localPet, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_VMGet(vm, pet=localPet, peCount=localPeCount, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -628,10 +618,12 @@ subroutine Advance(model, rc) ! Now can use OpenMP for fine grained parallelism... ! Here just write info about the PET-local OpenMP threads to Log. -!$omp parallel private(msgString) +!$omp parallel private(msgString, currentSsiPe) !$omp critical -!$ write(msgString,'(A,I4,A,I4,A,I4,A,I4)') & +!$ call ESMF_VMGet(vm, currentSsiPe=currentSsiPe) +!$ write(msgString,'(A,I4,A,I4,A,I4,A,I4,A,I4)') & !$ "thread_num=", omp_get_thread_num(), & +!$ " currentSsiPe=", currentSsiPe, & !$ " num_threads=", omp_get_num_threads(), & !$ " max_threads=", omp_get_max_threads(), & !$ " num_procs=", omp_get_num_procs() diff --git a/AtmOcnMirrorFieldsProto/ocn.F90 b/AtmOcnMirrorFieldsProto/ocn.F90 index 27dda2c4..bc08a6de 100644 --- a/AtmOcnMirrorFieldsProto/ocn.F90 +++ b/AtmOcnMirrorFieldsProto/ocn.F90 @@ -257,7 +257,7 @@ subroutine Advance(model, rc) type(ESMF_Time) :: currTime type(ESMF_TimeInterval) :: timeStep type(ESMF_VM) :: vm - integer :: localPet, localPeCount + integer :: currentSsiPe integer, save :: slice=1 character(len=160) :: msgString @@ -274,16 +274,6 @@ subroutine Advance(model, rc) ! Query the VM of the component for the localPeCount and set OpenMP ! num_threads accordingly. call ESMF_GridCompGet(model, vm=vm, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_VMGet(vm, localPet=localPet, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_VMGet(vm, pet=localPet, peCount=localPeCount, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -291,10 +281,12 @@ subroutine Advance(model, rc) ! Now can use OpenMP for fine grained parallelism... ! Here just write info about the PET-local OpenMP threads to Log. -!$omp parallel private(msgString) +!$omp parallel private(msgString, currentSsiPe) !$omp critical -!$ write(msgString,'(A,I4,A,I4,A,I4,A,I4)') & +!$ call ESMF_VMGet(vm, currentSsiPe=currentSsiPe) +!$ write(msgString,'(A,I4,A,I4,A,I4,A,I4,A,I4)') & !$ "thread_num=", omp_get_thread_num(), & +!$ " currentSsiPe=", currentSsiPe, & !$ " num_threads=", omp_get_num_threads(), & !$ " max_threads=", omp_get_max_threads(), & !$ " num_procs=", omp_get_num_procs() diff --git a/SingleModelOpenMPProto/model.F90 b/SingleModelOpenMPProto/model.F90 index 2a6c106f..653e02a4 100644 --- a/SingleModelOpenMPProto/model.F90 +++ b/SingleModelOpenMPProto/model.F90 @@ -240,7 +240,7 @@ subroutine Advance(model, rc) type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState type(ESMF_VM) :: vm - integer :: localPet, localPeCount, currentSsiPe + integer :: currentSsiPe character(len=160) :: msgString rc = ESMF_SUCCESS @@ -253,19 +253,6 @@ subroutine Advance(model, rc) file=__FILE__)) & return ! bail out - ! Query the VM of the component for the localPeCount and set OpenMP - ! num_threads accordingly. - call ESMF_VMGet(vm, localPet=localPet, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_VMGet(vm, pet=localPet, peCount=localPeCount, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! Now can use OpenMP for fine grained parallelism... ! Here just write info about the PET-local OpenMP threads to Log. !$omp parallel private(msgString, currentSsiPe) From c846754e33f76d1bae686c1263896f7f026c89ec Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Thu, 28 Jan 2021 12:47:12 -0800 Subject: [PATCH 39/68] Cleanup around OpenMP section. --- AtmOcnPetListProto/atm.F90 | 21 ++++++--------------- AtmOcnPetListProto/ocn.F90 | 21 ++++++--------------- 2 files changed, 12 insertions(+), 30 deletions(-) diff --git a/AtmOcnPetListProto/atm.F90 b/AtmOcnPetListProto/atm.F90 index 2122806c..4cb85226 100644 --- a/AtmOcnPetListProto/atm.F90 +++ b/AtmOcnPetListProto/atm.F90 @@ -203,7 +203,7 @@ subroutine Advance(model, rc) type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState type(ESMF_VM) :: vm - integer :: localPet, localPeCount + integer :: currentSsiPe character(len=160) :: msgString rc = ESMF_SUCCESS @@ -216,19 +216,8 @@ subroutine Advance(model, rc) file=__FILE__)) & return ! bail out - ! Query the VM of the component for the localPeCount and set OpenMP - ! num_threads accordingly. + ! Query for VM call ESMF_GridCompGet(model, vm=vm, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_VMGet(vm, localPet=localPet, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_VMGet(vm, pet=localPet, peCount=localPeCount, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -236,10 +225,12 @@ subroutine Advance(model, rc) ! Now can use OpenMP for fine grained parallelism... ! Here just write info about the PET-local OpenMP threads to Log. -!$omp parallel private(msgString) +!$omp parallel private(msgString, currentSsiPe) !$omp critical -!$ write(msgString,'(A,I4,A,I4,A,I4,A,I4)') & +!$ call ESMF_VMGet(vm, currentSsiPe=currentSsiPe) +!$ write(msgString,'(A,I4,A,I4,A,I4,A,I4,A,I4)') & !$ "thread_num=", omp_get_thread_num(), & +!$ " currentSsiPe=", currentSsiPe, & !$ " num_threads=", omp_get_num_threads(), & !$ " max_threads=", omp_get_max_threads(), & !$ " num_procs=", omp_get_num_procs() diff --git a/AtmOcnPetListProto/ocn.F90 b/AtmOcnPetListProto/ocn.F90 index 74955cae..d3291e3e 100644 --- a/AtmOcnPetListProto/ocn.F90 +++ b/AtmOcnPetListProto/ocn.F90 @@ -248,7 +248,7 @@ subroutine Advance(model, rc) type(ESMF_Time) :: currTime type(ESMF_TimeInterval) :: timeStep type(ESMF_VM) :: vm - integer :: localPet, localPeCount + integer :: currentSsiPe character(len=160) :: msgString rc = ESMF_SUCCESS @@ -261,19 +261,8 @@ subroutine Advance(model, rc) file=__FILE__)) & return ! bail out - ! Query the VM of the component for the localPeCount and set OpenMP - ! num_threads accordingly. + ! Query for VM call ESMF_GridCompGet(model, vm=vm, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_VMGet(vm, localPet=localPet, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_VMGet(vm, pet=localPet, peCount=localPeCount, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -281,10 +270,12 @@ subroutine Advance(model, rc) ! Now can use OpenMP for fine grained parallelism... ! Here just write info about the PET-local OpenMP threads to Log. -!$omp parallel private(msgString) +!$omp parallel private(msgString, currentSsiPe) !$omp critical -!$ write(msgString,'(A,I4,A,I4,A,I4,A,I4)') & +!$ call ESMF_VMGet(vm, currentSsiPe=currentSsiPe) +!$ write(msgString,'(A,I4,A,I4,A,I4,A,I4,A,I4)') & !$ "thread_num=", omp_get_thread_num(), & +!$ " currentSsiPe=", currentSsiPe, & !$ " num_threads=", omp_get_num_threads(), & !$ " max_threads=", omp_get_max_threads(), & !$ " num_procs=", omp_get_num_procs() From 40af7534471321c00024d0ae8ef74168c3d46317 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Fri, 29 Jan 2021 14:30:35 -0800 Subject: [PATCH 40/68] Fix alphabetization of test order. --- testProtos.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testProtos.sh b/testProtos.sh index 9f4be0e6..dab835f8 100755 --- a/testProtos.sh +++ b/testProtos.sh @@ -258,8 +258,8 @@ echo # function # proto directory # executable TestProto AsyncIOBlockingProto asyncIOApp TestProto AsyncIONonblockingProto asyncIOApp -TestProto AtmOcnConProto esmApp TestProto AtmOcnConOptsProto esmApp +TestProto AtmOcnConProto esmApp TestProto AtmOcnCplListProto esmApp TestProto AtmOcnCplSetProto esmApp TestProto AtmOcnFDSynoProto esmApp @@ -286,8 +286,8 @@ TestProto AtmOcnTransferLocStreamProto esmApp TestProto AtmOcnTransferMeshProto esmApp TestExplorer ComponentExplorer nuopcExplorerApp TestProto CustomFieldDictionaryProto mainApp -TestProto DriverInDriverProto mainApp TestProto DriverInDriverDataDepProto mainApp +TestProto DriverInDriverProto mainApp TestProto DynPhyProto esmApp TestProto ExternalDriverAPIProto externalApp TestProto GenericMediatorProto app From cbb807aca264d88f25408448a4a3c06d9e5eef13 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Fri, 29 Jan 2021 14:48:25 -0800 Subject: [PATCH 41/68] Remove protos that are still experimental from develop. --- AtmOcnMedTransferGridMakeMeshProto/Makefile | 75 - AtmOcnMedTransferGridMakeMeshProto/README | 35 - AtmOcnMedTransferGridMakeMeshProto/atm.F90 | 1421 ----- AtmOcnMedTransferGridMakeMeshProto/esm.F90 | 324 -- AtmOcnMedTransferGridMakeMeshProto/esmApp.F90 | 112 - AtmOcnMedTransferGridMakeMeshProto/med.F90 | 1044 ---- AtmOcnMedTransferGridMakeMeshProto/ocn.F90 | 911 --- GeosCtmProto/CAP.rc | 36 - GeosCtmProto/CTM_GridComp.rc | 30 - GeosCtmProto/GEOSCTM.rc | 125 - GeosCtmProto/KNOWNPROBLEMS | 32 - GeosCtmProto/MAPL_ExtData.rc | 123 - GeosCtmProto/Makefile | 86 - GeosCtmProto/NUOPC_Generic.F90 | 943 --- GeosCtmProto/README | 153 - GeosCtmProto/advcore.F90 | 1255 ---- GeosCtmProto/ctm.F90 | 872 --- GeosCtmProto/ctmApp.F90 | 110 - GeosCtmProto/driver.F90 | 399 -- GeosCtmProto/ectm.F90 | 1980 ------- GeosCtmProto/extdata.F90 | 5129 ----------------- GeosCtmProto/fvcore_layout.rc | 29 - GeosCtmProto/input.nml | 3 - GeosCtmProto/pTracers_GridComp.rc | 48 - GeosCtmProto/ptracer.F90 | 1472 ----- 25 files changed, 16747 deletions(-) delete mode 100644 AtmOcnMedTransferGridMakeMeshProto/Makefile delete mode 100644 AtmOcnMedTransferGridMakeMeshProto/README delete mode 100644 AtmOcnMedTransferGridMakeMeshProto/atm.F90 delete mode 100644 AtmOcnMedTransferGridMakeMeshProto/esm.F90 delete mode 100644 AtmOcnMedTransferGridMakeMeshProto/esmApp.F90 delete mode 100644 AtmOcnMedTransferGridMakeMeshProto/med.F90 delete mode 100644 AtmOcnMedTransferGridMakeMeshProto/ocn.F90 delete mode 100644 GeosCtmProto/CAP.rc delete mode 100644 GeosCtmProto/CTM_GridComp.rc delete mode 100644 GeosCtmProto/GEOSCTM.rc delete mode 100644 GeosCtmProto/KNOWNPROBLEMS delete mode 100755 GeosCtmProto/MAPL_ExtData.rc delete mode 100644 GeosCtmProto/Makefile delete mode 100644 GeosCtmProto/NUOPC_Generic.F90 delete mode 100644 GeosCtmProto/README delete mode 100644 GeosCtmProto/advcore.F90 delete mode 100644 GeosCtmProto/ctm.F90 delete mode 100644 GeosCtmProto/ctmApp.F90 delete mode 100644 GeosCtmProto/driver.F90 delete mode 100644 GeosCtmProto/ectm.F90 delete mode 100644 GeosCtmProto/extdata.F90 delete mode 100644 GeosCtmProto/fvcore_layout.rc delete mode 100755 GeosCtmProto/input.nml delete mode 100644 GeosCtmProto/pTracers_GridComp.rc delete mode 100644 GeosCtmProto/ptracer.F90 diff --git a/AtmOcnMedTransferGridMakeMeshProto/Makefile b/AtmOcnMedTransferGridMakeMeshProto/Makefile deleted file mode 100644 index 5f739700..00000000 --- a/AtmOcnMedTransferGridMakeMeshProto/Makefile +++ /dev/null @@ -1,75 +0,0 @@ -# GNU Makefile template for user ESMF application - -################################################################################ -################################################################################ -## This Makefile must be able to find the "esmf.mk" Makefile fragment in the ## -## 'include' line below. Following the ESMF User's Guide, a complete ESMF ## -## installation should ensure that a single environment variable "ESMFMKFILE" ## -## is made available on the system. This variable should point to the ## -## "esmf.mk" file. ## -## ## -## This example Makefile uses the "ESMFMKFILE" environment variable. ## -## ## -## If you notice that this Makefile cannot find variable ESMFMKFILE then ## -## please contact the person responsible for the ESMF installation on your ## -## system. ## -## As a work-around you can simply hardcode the path to "esmf.mk" in the ## -## include line below. However, doing so will render this Makefile a lot less ## -## flexible and non-portable. ## -################################################################################ - -ifneq ($(origin ESMFMKFILE), environment) -$(error Environment variable ESMFMKFILE was not set.) -endif - -include $(ESMFMKFILE) - -################################################################################ -################################################################################ - -.SUFFIXES: .f90 .F90 .c .C - -%.o : %.f90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREENOCPP) $< - -%.o : %.F90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $< - -%.o : %.c - $(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< - -%.o : %.C - $(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< - - -# ----------------------------------------------------------------------------- -esmApp: esmApp.o esm.o atm.o ocn.o med.o - $(ESMF_F90LINKER) $(ESMF_F90LINKOPTS) $(ESMF_F90LINKPATHS) $(ESMF_F90LINKRPATHS) -o $@ $^ $(ESMF_F90ESMFLINKLIBS) - -# module dependencies: -esmApp.o: esm.o -esm.o: atm.o ocn.o med.o - -# ----------------------------------------------------------------------------- -# ----------------------------------------------------------------------------- -.PHONY: dust clean distclean info edit -dust: - rm -f PET*.ESMF_LogFile *.nc *.vtk *.stdout -clean: - rm -f esmApp *.o *.mod -shred: - rm -f array*.nc field_gridArb.nc field_gridAux.nc field_ocn*.nc field_atm*.nc -distclean: dust clean - -info: - @echo ================================================================== - @echo ESMFMKFILE=$(ESMFMKFILE) - @echo ================================================================== - @cat $(ESMFMKFILE) - @echo ================================================================== - -edit: - nedit esmApp.F90 esm.F90 atm.F90 ocn.F90 med.F90 & - -run: - mpirun -np 4 ./esmApp diff --git a/AtmOcnMedTransferGridMakeMeshProto/README b/AtmOcnMedTransferGridMakeMeshProto/README deleted file mode 100644 index 01898afb..00000000 --- a/AtmOcnMedTransferGridMakeMeshProto/README +++ /dev/null @@ -1,35 +0,0 @@ -README for ATM-OCN with transferred Grids between ATM and OCN Components ------------------------------------------------------------------------- - -Dependencies: - - ESMF v7.1.0 beta - -Build: - - Set environment variable ESMFMKFILE to point to the esmf.mk of your ESMF - installation. - - gmake - -Execution: - - Optionally set environment variable ESMF_RUNTIME_COMPLIANCECHECK to ON. - - mpirun -np X ./esmApp (where X is the total number of PETs) - -Output: - - PET*.Log files containing compliance checker output if turned on. - - The prototype outputs time stepping information to stdout. - - - -Code structure: - - Makefile - Makefile that is based on the standard esmf.mk mechanism. - - atm.F90 - The ATM component, specializing generic NUOPC_Model. - * Accept Grids from OCN component. - * Indicates "cannot provide" for some Grids - * Indicates "can provide" for some Grids - - ocn.F90 - The OCN component, specializing generic NUOPC_Model. - * Implicitly indicate "will provide" for all Grids. - - esm.F90 - The Earth System Model (ESM) component, specializing generic - NUOPC_Driver. Define partial petLists for ATM - and OCN. - - med.F90 - Mediator that swaps Grid to Mesh - - esmApp.F90 - ESM driver application. - diff --git a/AtmOcnMedTransferGridMakeMeshProto/atm.F90 b/AtmOcnMedTransferGridMakeMeshProto/atm.F90 deleted file mode 100644 index 14db2547..00000000 --- a/AtmOcnMedTransferGridMakeMeshProto/atm.F90 +++ /dev/null @@ -1,1421 +0,0 @@ -!============================================================================== -! Earth System Modeling Framework -! Copyright 2002-2021, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, -! NASA Goddard Space Flight Center. -! Licensed under the University of Illinois-NCSA License. -!============================================================================== - -! Make sure to define test macros consistently across all source files: -#define TEST_GRID_EDGE_WIDTHS -#define TEST_MULTI_TILE_GRID - -module ATM - - !----------------------------------------------------------------------------- - ! ATM Component. - !----------------------------------------------------------------------------- - - use ESMF - use NUOPC - use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_DataInitialize => label_DataInitialize, & - model_label_CheckImport => label_CheckImport, & - model_label_Advance => label_Advance - - implicit none - - private - - public SetServices - - !----------------------------------------------------------------------------- - contains - !----------------------------------------------------------------------------- - - subroutine SetServices(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! -> switching to IPD version that supports GeomObject transfer - call ESMF_GridCompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - userRoutine=InitializeP0, phase=0, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv03p1"/), userRoutine=InitializeP1, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv03p3"/), userRoutine=InitializeP3, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -! call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & -! phaseLabelList=(/"IPDv03p4"/), userRoutine=InitializeP4, rc=rc) -! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & -! line=__LINE__, & -! file=__FILE__)) & -! return ! bail out -! call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & -! phaseLabelList=(/"IPDv03p5"/), userRoutine=InitializeP5, rc=rc) -! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & -! line=__LINE__, & -! file=__FILE__)) & -! return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_DataInitialize, & - specRoutine=DataInitialize, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_CheckImport, & - specRoutine=NUOPC_NoOp, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine InitializeP0(model, importState, exportState, clock, rc) - type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - - ! Switch to IPDv03 by filtering all other phaseMap entries - call NUOPC_CompFilterPhaseMap(model, ESMF_METHOD_INITIALIZE, & - acceptStringList=(/"IPDv03p"/), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine InitializeP1(model, importState, exportState, clock, rc) - type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - -! ! importable field: sea_surface_salinity -! ! -> marked as "cannot provide" -! call NUOPC_Advertise(importState, & -! StandardName="sea_surface_salinity", name="sss", & -! TransferOfferGeomObject="will provide", rc=rc) -! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & -! line=__LINE__, & -! file=__FILE__)) & -! return ! bail out - - ! importable field: sea_surface_temperature - ! -> marked as "can provide" - call NUOPC_Advertise(importState, & - StandardName="sea_surface_temperature", name="sst", & - TransferOfferGeomObject="will provide", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - -! ! importable field: sea_surface_height_above_sea_level -! ! -> marked as "can provide" -! call NUOPC_Advertise(importState, & -! StandardName="sea_surface_height_above_sea_level", name="ssh", & -! TransferOfferGeomObject="will provide", rc=rc) -! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & -! line=__LINE__, & -! file=__FILE__)) & -! return ! bail out - - call ESMF_LogWrite("Done advertising fields in ATM importState", & - ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - -! ! exportable field: air_pressure_at_sea_level -! ! -> marked as "cannot provide" -! call NUOPC_Advertise(exportState, & -! StandardName="air_pressure_at_sea_level", name="pmsl", & -! TransferOfferGeomObject="will provide", rc=rc) -! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & -! line=__LINE__, & -! file=__FILE__)) & -! return ! bail out - - ! exportable field: surface_net_downward_shortwave_flux - ! -> use default, i.e. marked as "will provide" - call NUOPC_Advertise(exportState, & - StandardName="surface_net_downward_shortwave_flux", name="rsns", & - TransferOfferGeomObject="will provide", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - -! ! exportable field: precipitation_flux -! ! -> marked as "cannot provide" -! call NUOPC_Advertise(exportState, & -! StandardName="precipitation_flux", name="precip", & -! TransferOfferGeomObject="will provide", rc=rc) -! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & -! line=__LINE__, & -! file=__FILE__)) & -! return ! bail out - - call ESMF_LogWrite("Done advertising fields in ATM exportState", & - ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine InitializeP3(model, importState, exportState, clock, rc) - type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - ! local variables - type(ESMF_Field) :: field - type(ESMF_Grid) :: gridIn, gridOut - character(ESMF_MAXSTR) :: transferAction - - rc = ESMF_SUCCESS - - ! create Grid objects for Fields - gridIn = ESMF_GridCreate1PeriDimUfrm(maxIndex=(/100, 150/), & - minCornerCoord=(/0._ESMF_KIND_R8, -50._ESMF_KIND_R8/), & - maxCornerCoord=(/360._ESMF_KIND_R8, 70._ESMF_KIND_R8/), & - staggerLocList=(/ESMF_STAGGERLOC_CENTER, ESMF_STAGGERLOC_CORNER/), name="ATM-Grid", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - gridOut = gridIn ! for now out same as in - - ! importable field: sea_surface_temperature - ! This Field was marked with TransferOfferGeomObject="can provide", so here - ! we need to see what ConsumerTransferAction the Connector determined for - ! this Field: - call ESMF_StateGet(importState, field=field, itemName="sst", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_GetAttribute(field, name="ConsumerTransferAction", & - value=transferAction, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - if (trim(transferAction)=="provide") then - ! the Connector instructed the ATM to provide the Grid object for "sst" - call ESMF_LogWrite("ATM is providing Grid for Field 'sst'.", & - ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - field = ESMF_FieldCreate(name="sst", grid=gridIn, & - typekind=ESMF_TYPEKIND_R8, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_Realize(importState, field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - else ! transferAction=="accept" - ! the Connector instructed the ATM to accept the Grid from OCN for "sst" - call ESMF_LogWrite("ATM is accepting Grid for Field 'sst'.", & - ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - endif - - !NOTE: The sea_surface_salinity and air_pressure_at_sea_level Fields are - !NOTE: not realized here because they were marked with - !NOTE: TransferOfferGeomObject="cannot provide". - !NOTE: Expect the Connector to fill in a Grid object for these Fields. - - ! exportable field: surface_net_downward_shortwave_flux - field = ESMF_FieldCreate(name="rsns", grid=gridOut, & - typekind=ESMF_TYPEKIND_R8, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_Realize(exportState, field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_LogWrite("Done realizing fields in ATM import/exportStates "// & - "that do not need grid transfer", ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine InitializeP4(model, importState, exportState, clock, rc) - type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - ! local variables - type(ESMF_Field) :: field - type(ESMF_Grid) :: grid - integer :: localDeCount - character(80) :: name - character(160) :: msgString - - type(ESMF_DistGrid) :: distgrid - integer :: dimCount, tileCount, arbDimCount - integer, allocatable :: minIndexPTile(:,:), maxIndexPTile(:,:) - integer :: connectionCount - type(ESMF_DistGridConnection), allocatable :: connectionList(:) - character(ESMF_MAXSTR) :: transferAction - logical :: regDecompFlag - - rc = ESMF_SUCCESS - - !NOTE: The air_pressure_at_sea_level (pmsl) Field should now have the - !NOTE: accepted Grid available. It is still an empty Field, but with Grid, - !NOTE: that contains a DistGrid with the provider decomposition. - !NOTE: If the decomposition and distribution of the provided Grid is to - !NOTE: be changed on the acceptor side (i.e. the ATM here) then this - !NOTE: phase of Initialize is the place to do so and make the changes to - !NOTE: the Grid object that is referenced by the "pmsl" Field. - - ! access the "pmsl" field in the exportState - call ESMF_StateGet(exportState, field=field, itemName="pmsl", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! while this is still an empty field, it does now hold a Grid with DistGrid - call ESMF_FieldGet(field, grid=grid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! inspect the Grid name - call ESMF_GridGet(grid, name=name, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - write (msgString,*) "ATM - InitializeP4: transferred Grid name = ", name - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! access localDeCount to show this is a real Grid - call ESMF_GridGet(grid, localDeCount=localDeCount, distgrid=distgrid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - write (msgString,*) "ATM - InitializeP4: localDeCount = ", localDeCount - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! Create a custom DistGrid, based on the minIndex, maxIndex of the - ! accepted DistGrid, but with a default regDecomp for the current VM - ! that leads to 1DE/PET (as long as there are more PETs than tiles). - - ! get dimCount and tileCount - call ESMF_DistGridGet(distgrid, dimCount=dimCount, tileCount=tileCount, & - connectionCount=connectionCount, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! allocate minIndexPTile and maxIndexPTile accord. to dimCount and tileCount - allocate(minIndexPTile(dimCount, tileCount), & - maxIndexPTile(dimCount, tileCount)) - allocate(connectionList(connectionCount)) - - ! get minIndex and maxIndex arrays - call ESMF_DistGridGet(distgrid, minIndexPTile=minIndexPTile, & - maxIndexPTile=maxIndexPTile, connectionList=connectionList, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - -#if 0 - ! report on the connections - print *, "connectionCount=", connectionCount - do i=1, connectionCount - call ESMF_DistGridConnectionPrint(connectionList(i)) - enddo -#endif - - ! create the new DistGrid with the same minIndexPTile and maxIndexPTile, - ! but use default multi-tile regDecomp - ! If the default regDecomp is not suitable, a custome one could be set - ! up here and used. - distgrid = ESMF_DistGridCreate(minIndexPTile=minIndexPTile, & - maxIndexPTile=maxIndexPTile, connectionList=connectionList, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - deallocate(minIndexPTile, maxIndexPTile, connectionList) - - ! Create a new Grid on the new DistGrid - grid = ESMF_GridCreate(distgrid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! access localDeCount of the final Grid - call ESMF_GridGet(grid, localDeCount=localDeCount, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - write (msgString,*) "ATM - InitializeP4: final Grid localDeCount = ", & - localDeCount - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! Swap out the transferred for new Grid in "pmsl" Field - call ESMF_FieldEmptySet(field, grid=grid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! -- deal with "precip" field in the exportState - ! access the field - call ESMF_StateGet(exportState, field=field, itemName="precip", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! access the grid - call ESMF_FieldGet(field, grid=grid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! log the grid name - call ESMF_GridGet(grid, name=name, distgrid=distgrid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - write (msgString,*) "ATM - InitializeP4: transferred Grid name = ", name - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! get basic information out of the transferred DistGrid - call ESMF_DistGridGet(distgrid, dimCount=dimCount, tileCount=tileCount, & - connectionCount=connectionCount, regDecompFlag=regDecompFlag, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - allocate(minIndexPTile(dimCount, tileCount), & - maxIndexPTile(dimCount, tileCount)) - allocate(connectionList(connectionCount)) - call ESMF_DistGridGet(distgrid, minIndexPTile=minIndexPTile, & - maxIndexPTile=maxIndexPTile, connectionList=connectionList, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! right now the ArbDimCount is transferred as an attribute on each field - ! This should change in the future to be a propoerty that can be natively - ! be queried of the transferred Grid, but that is not currently implemented. - call ESMF_AttributeGet(field, name="ArbDimCount", value=arbDimCount, & - convention="NUOPC", purpose="Instance", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! make decision on whether the incoming Grid is arbDistr or not - if (arbDimCount>0) then - ! The provider defined an arbDistr grid - ! - ! Need to make a choice here to either represent the grid as a - ! regDecomp grid on the acceptor side, or to stay with arbDistr grid: - ! - ! Setting the PRECIP_REGDECOMP macro will set up a regDecomp grid on the - ! acceptor side. - ! - ! Not setting the PRECIP_REGDECOMP macro will default into keeping the - ! original arbDistr Grid. - -#define PRECIP_REGDECOMP - -#ifdef PRECIP_REGDECOMP - ! Use a regDecomp representation for the grid - ! first get tile min/max, only single tile supported for arbDistr Grid - deallocate(minIndexPTile,maxIndexPTile) - allocate(minIndexPTile(arbDimCount,1),maxIndexPTile(arbDimCount,1)) - call ESMF_AttributeGet(field, name="MinIndex", & - valueList=minIndexPTile(:,1), & - convention="NUOPC", purpose="Instance", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_AttributeGet(field, name="MaxIndex", & - valueList=maxIndexPTile(:,1), & - convention="NUOPC", purpose="Instance", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! create default regDecomp DistGrid - distgrid = ESMF_DistGridCreate(minIndexPTile=minIndexPTile, & - maxIndexPTile=maxIndexPTile, connectionList=connectionList, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! Create default regDecomp Grid - grid = ESMF_GridCreate(distgrid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! swap out the transferred grid for the newly created one - call ESMF_FieldEmptySet(field, grid=grid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#if 1 - write (msgString,*) "ATM - 'precip' minIndex = ", minIndexPTile, & - "maxIndex = ", maxIndexPTile - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#endif - call ESMF_LogWrite("ATM - Just set Grid for 'precip' Field", & - ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#else - ! Stick with the arbDistr representation of the grid: - ! There is nothing to do here if the same number of DEs is kept on the - ! acceptor side. Alternatively, the acceptor side could set up a more - ! natural number of DEs (maybe same number as acceptor PETs), and then - ! redistribute the arbSeqIndexList. Here simply keep the DEs of the - ! provider Grid. - call ESMF_GridGet(grid, localDeCount=localDeCount, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - write (msgString,*) & - "ATM - InitializeP4: arbDistr: precip localDeCount = ", & - localDeCount - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - -#endif - else - ! Not arbDistr grid, so either regDecomp or deBlock grid - if (regDecompFlag) then - ! The provider used a regDecomp scheme for DistGrid creation: - ! This means that the entire index space is covered (no holes), and - ! it the easieast is just to use a regDecomp scheme on the acceptor - ! side as well. - distgrid = ESMF_DistGridCreate(minIndexPTile=minIndexPTile, & - maxIndexPTile=maxIndexPTile, connectionList=connectionList, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - grid = ESMF_GridCreate(distgrid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! swap out the transferred grid for the newly created one - call ESMF_FieldEmptySet(field, grid=grid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_LogWrite("ATM - Just set regDecomp Grid for 'precip' Field", & - ESMF_LOGMSG_INFO, rc=rc) - else - ! The provider did NOT use a regDecomp scheme for DistGrid creation: - ! This means that the provider was using deBlock lists to decompose the - ! index space, which can lead to holes in the coverage. - ! The acceptor side can either ignore holes, and use a regDecomp of the - ! entire index space, or also use a deBlock approach to only cover the - ! exact index space covered by the provider grid. - ! If a regDecomp scheme is used, Redist() between provider side and - ! acceptor side is still possible (both ways). It just means that - ! not all src/dst index points send/receive data. - ! Using the regDecomp scheme is identical to the regDecompFlag branch - ! of this if statement. - ! Using the deBlock scheme can either mean that the transferred grid is - ! directly used. It just means that the number provider DEs are using a - ! default distribution across the acceptor PETs. - ! Alternatively the DEs could be distributed differently by constructing - ! a deBlockList out of the minIndexPDe and maxIndexPDe arrays here, and - ! calling a deBlock DistGridCreate() and then build the Grid on it. - ! -> here we just accept the provided Grid without change (same number - ! of DEs with the same deBlocks). - endif - endif - deallocate(minIndexPTile, maxIndexPTile, connectionList) - - !------------------------------------------------------------------------ - ! Also must deal with transferred Grids in the importState - call ESMF_LogWrite("ATM - InitializeP4: now dealing with importState", & - ESMF_LOGMSG_INFO, rc=rc) - - ! access the "sss" field in the importState and set the Grid - call ESMF_StateGet(importState, field=field, itemName="sss", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! construct a local Grid according to the transferred grid - call ESMF_FieldGet(field, grid=grid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_GridGet(grid, distgrid=distgrid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_DistGridGet(distgrid, dimCount=dimCount, tileCount=tileCount, & - connectionCount=connectionCount, regDecompFlag=regDecompFlag, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - allocate(minIndexPTile(dimCount, tileCount), & - maxIndexPTile(dimCount, tileCount)) - allocate(connectionList(connectionCount)) - call ESMF_DistGridGet(distgrid, minIndexPTile=minIndexPTile, & - maxIndexPTile=maxIndexPTile, connectionList=connectionList, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - if (regDecompFlag) then - ! The provider used a regDecomp scheme for DistGrid creation: - ! This means that the entire index space is covered (no holes), and - ! it the easieast is just to use a regDecomp scheme on the acceptor - ! side as well. - distgrid = ESMF_DistGridCreate(minIndexPTile=minIndexPTile, & - maxIndexPTile=maxIndexPTile, connectionList=connectionList, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - grid = ESMF_GridCreate(distgrid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! swap out the transferred grid for the newly created one - call ESMF_FieldEmptySet(field, grid=grid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_LogWrite("ATM - Just set Grid for 'sss' Field", & - ESMF_LOGMSG_INFO, rc=rc) - else - ! The provider did NOT use a regDecomp scheme for DistGrid creation: - ! This means that the provider was using deBlock lists to decompose the - ! index space, which can lead to holes in the coverage. - ! The acceptor side can either ignore holes, and use a regDecomp of the - ! entire index space, or also use a deBlock approach to only cover the - ! exact index space covered by the provider grid. - ! If a regDecomp scheme is used, Redist() between provider side and - ! acceptor side is still possible (both ways). It just means that - ! not all src/dst index points send/receive data. - ! Using the regDecomp scheme is identical to the regDecompFlag branch - ! of this if statement. - ! Using the deBlock scheme can either mean that the transferred grid is - ! directly used. It just means that the number provider DEs are using a - ! default distribution across the acceptor PETs. - ! Alternatively the DEs could be distributed differently by constructing - ! a deBlockList out of the minIndexPDe and maxIndexPDe arrays here, and - ! calling a deBlock DistGridCreate() and then build the Grid on it. - ! -> here we just accept the provided Grid without change (same number of - ! DEs with the same deBlocks). - endif - deallocate(minIndexPTile, maxIndexPTile, connectionList) - - ! Also must swap the Grid for the "sst" Field in the importState - ! if transferAction indicates "accept". Assume that SST is defined on - ! the same grid as SSS. - - ! access the "sst" field in the importState - call ESMF_StateGet(importState, field=field, itemName="sst", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_GetAttribute(field, name="ConsumerTransferAction", & - value=transferAction, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - if (trim(transferAction)=="accept") then - ! accept the incoming Grid object for the "sst" Field - if (regDecompFlag) then - ! for a regDecomp scheme, definitely the newly constructed Grid on the - ! acceptor side makes a lot more sense. - call ESMF_FieldEmptySet(field, grid=grid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_LogWrite("ATM - Just set Grid for 'sst' Field", & - ESMF_LOGMSG_INFO, rc=rc) - else - ! for deBlock scheme, just keep the provided Grid with the same - ! deBlocks as provider defined. - endif - endif - - call ESMF_LogWrite("ATM - InitializeP4: DONE", & - ESMF_LOGMSG_INFO, rc=rc) - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine InitializeP5(model, importState, exportState, clock, rc) - type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - ! local variables - type(ESMF_Field) :: field - type(ESMF_Grid) :: grid - type(ESMF_Array) :: array - character(80) :: name - character(160) :: msgString - type(ESMF_FieldStatus_Flag) :: fieldStatus - integer :: staggerEdgeLWidth(2) - integer :: staggerEdgeUWidth(2) - integer :: staggerAlign(2) - - rc = ESMF_SUCCESS - - ! realize the "sss" field in the importState - call NUOPC_Realize(importState, fieldName="sss", field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! log a message - if (ESMF_FieldIsCreated(field,rc=rc)) then - write (msgString,*)"ATM - Just realized the 'sss' Field in importState." - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - else - write (msgString,*)"ATM - 'sss' Field not realized in importState here." - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - endif - - ! realize the "sst" field in the importState - call NUOPC_Realize(importState, fieldName="sst", field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! log a message - if (ESMF_FieldIsCreated(field,rc=rc)) then - write (msgString,*)"ATM - Just realized the 'sst' Field in importState." - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - else - write (msgString,*)"ATM - 'sst' Field not realized in importState here." - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - endif - - ! realize the "ssh" field in the importState - call NUOPC_Realize(importState, fieldName="ssh", field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! log a message - if (ESMF_FieldIsCreated(field,rc=rc)) then - write (msgString,*)"ATM - Just realized the 'ssh' Field in importState." - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - else - write (msgString,*)"ATM - 'ssh' Field not realized in importState here." - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - endif - -#ifdef TEST_MULTI_TILE_GRID - ! write cubed sphere grid out to VTK - call ESMF_FieldGet(field, grid=grid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_GridWriteVTK(grid, staggerloc=ESMF_STAGGERLOC_CENTER, & - filename="ATM-accepted-Grid-ssh_centers", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#endif - - ! realize the "pmsl" field in the exportState - ! ... but with specified totalLWidth/totalUWidth - call NUOPC_Realize(exportState, fieldName="pmsl", & - totalLWidth=(/1,1/), totalUWidth=(/1,1/), field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! log a message - if (ESMF_FieldIsCreated(field,rc=rc)) then - write (msgString,*)"ATM - Just realized the 'pmsl' Field in exportState." - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - else - write (msgString,*)"ATM - 'pmsl' Field not realized in exportState here." - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - endif - - ! inspect the Grid name - call ESMF_FieldGet(field, grid=grid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_GridGet(grid, name=name, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - write (msgString,*) "ATM - InitializeP5: transferred Grid name = ", name - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! check the staggerEdgeWidth of the transferred grid -#ifdef TEST_GRID_EDGE_WIDTHS - ! center stagger - call ESMF_GridGet(grid, staggerloc=ESMF_STAGGERLOC_CENTER, & - staggerEdgeLWidth=staggerEdgeLWidth, & - staggerEdgeUWidth=staggerEdgeUWidth, & - staggerAlign=staggerAlign, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - print *, "staggerEdgeLWidth", staggerEdgeLWidth - print *, "staggerEdgeUWidth", staggerEdgeUWidth - print *, "staggerAlign", staggerAlign - if (any(staggerEdgeLWidth /= (/0,0/))) then - call ESMF_LogSetError(ESMF_RC_VAL_WRONG, & - msg="Wrong staggerEdgeLWidth for ESMF_STAGGERLOC_CENTER", & - line=__LINE__, & - file=__FILE__, & - rcToReturn=rc) - return ! bail out - endif - if (any(staggerEdgeUWidth /= (/0,0/))) then - call ESMF_LogSetError(ESMF_RC_VAL_WRONG, & - msg="Wrong staggerEdgeUWidth for ESMF_STAGGERLOC_CENTER", & - line=__LINE__, & - file=__FILE__, & - rcToReturn=rc) - return ! bail out - endif - ! corner stagger - call ESMF_GridGet(grid, staggerloc=ESMF_STAGGERLOC_CORNER, & - staggerEdgeLWidth=staggerEdgeLWidth, & - staggerEdgeUWidth=staggerEdgeUWidth, & - staggerAlign=staggerAlign, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - print *, "staggerEdgeLWidth", staggerEdgeLWidth - print *, "staggerEdgeUWidth", staggerEdgeUWidth - print *, "staggerAlign", staggerAlign - if (any(staggerEdgeLWidth /= (/1,1/))) then - call ESMF_LogSetError(ESMF_RC_VAL_WRONG, & - msg="Wrong staggerEdgeLWidth for ESMF_STAGGERLOC_CORNER", & - line=__LINE__, & - file=__FILE__, & - rcToReturn=rc) - return ! bail out - endif - if (any(staggerEdgeUWidth /= (/0,0/))) then - call ESMF_LogSetError(ESMF_RC_VAL_WRONG, & - msg="Wrong staggerEdgeuWidth for ESMF_STAGGERLOC_CORNER", & - line=__LINE__, & - file=__FILE__, & - rcToReturn=rc) - return ! bail out - endif - ! edge1 stagger - call ESMF_GridGet(grid, staggerloc=ESMF_STAGGERLOC_EDGE1, & - staggerEdgeLWidth=staggerEdgeLWidth, & - staggerEdgeUWidth=staggerEdgeUWidth, & - staggerAlign=staggerAlign, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - print *, "staggerEdgeLWidth", staggerEdgeLWidth - print *, "staggerEdgeUWidth", staggerEdgeUWidth - print *, "staggerAlign", staggerAlign - if (any(staggerEdgeLWidth /= (/0,1/))) then - call ESMF_LogSetError(ESMF_RC_VAL_WRONG, & - msg="Wrong staggerEdgeLWidth for ESMF_STAGGERLOC_EDGE1", & - line=__LINE__, & - file=__FILE__, & - rcToReturn=rc) - return ! bail out - endif - if (any(staggerEdgeUWidth /= (/1,1/))) then - call ESMF_LogSetError(ESMF_RC_VAL_WRONG, & - msg="Wrong staggerEdgeUWidth for ESMF_STAGGERLOC_EDGE1", & - line=__LINE__, & - file=__FILE__, & - rcToReturn=rc) - return ! bail out - endif - ! edge2 stagger - call ESMF_GridGet(grid, staggerloc=ESMF_STAGGERLOC_EDGE2, & - staggerEdgeLWidth=staggerEdgeLWidth, & - staggerEdgeUWidth=staggerEdgeUWidth, & - staggerAlign=staggerAlign, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - print *, "staggerEdgeLWidth", staggerEdgeLWidth - print *, "staggerEdgeUWidth", staggerEdgeUWidth - print *, "staggerAlign", staggerAlign - if (any(staggerEdgeLWidth /= (/1,0/))) then - call ESMF_LogSetError(ESMF_RC_VAL_WRONG, & - msg="Wrong staggerEdgeLWidth for ESMF_STAGGERLOC_EDGE2", & - line=__LINE__, & - file=__FILE__, & - rcToReturn=rc) - return ! bail out - endif - if (any(staggerEdgeUWidth /= (/0,1/))) then - call ESMF_LogSetError(ESMF_RC_VAL_WRONG, & - msg="Wrong staggerEdgeUWidth for ESMF_STAGGERLOC_EDGE2", & - line=__LINE__, & - file=__FILE__, & - rcToReturn=rc) - return ! bail out - endif -#endif - -#if 1 - ! testing the output of coord arrays - !TODO: - ! Coords are currently written in 2D index space even if there is coordinate - ! factorization used, e.g. in the Ufrm() GridCreate. Therefore the coord - ! arrays have replicated dims, and underlying allocation is only 1D. This - ! should be changed in the ArrayWrite() where Arrays with replicated dims - ! should write out only the non-degenerate data, i.e. according to the - ! actual data allocation. - ! -> here that would be a 1D array for each coordiante dim. - ! center: - call ESMF_GridGetCoord(grid, coordDim=1, array=array, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_ArrayWrite(array, "array_ATM-grid_center_coord1.nc", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_GridGetCoord(grid, coordDim=2, array=array, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_ArrayWrite(array, "array_ATM-grid_center_coord2.nc", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#ifdef TEST_GRID_EDGE_WIDTHS - ! corner: - call ESMF_GridGetCoord(grid, staggerloc=ESMF_STAGGERLOC_CORNER, & - coordDim=1, array=array, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_ArrayWrite(array, "array_ATM-grid_corner_coord1.nc", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_GridGetCoord(grid, staggerloc=ESMF_STAGGERLOC_CORNER, & - coordDim=2, array=array, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_ArrayWrite(array, "array_ATM-grid_corner_coord2.nc", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! edge1: - call ESMF_GridGetCoord(grid, staggerloc=ESMF_STAGGERLOC_EDGE1, & - coordDim=1, array=array, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_ArrayWrite(array, "array_ATM-grid_edge1_coord1.nc", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_GridGetCoord(grid, staggerloc=ESMF_STAGGERLOC_EDGE1, & - coordDim=2, array=array, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_ArrayWrite(array, "array_ATM-grid_edge1_coord2.nc", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! edge2: - call ESMF_GridGetCoord(grid, staggerloc=ESMF_STAGGERLOC_EDGE2, & - coordDim=1, array=array, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_ArrayWrite(array, "array_ATM-grid_edge2_coord1.nc", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_GridGetCoord(grid, staggerloc=ESMF_STAGGERLOC_EDGE2, & - coordDim=2, array=array, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_ArrayWrite(array, "array_ATM-grid_edge2_coord2.nc", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#endif -#endif - -#if 1 - ! write out the Grid into VTK file for inspection - call ESMF_GridWriteVTK(grid, staggerloc=ESMF_STAGGERLOC_CENTER, & - filename="ATM-accepted-Grid-pmsl_centers", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_LogWrite("Done writing ATM-accepted-Grid-pmsl_centers VTK", & - ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#endif - - ! realize the "precip" field in the exportState - ! ... but with specified typekind - call NUOPC_Realize(exportState, fieldName="precip", & - typekind=ESMF_TYPEKIND_R4, field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! log a message - if (ESMF_FieldIsCreated(field,rc=rc)) then - write (msgString,*)"ATM - Just realized the 'precip' Field in exportState." - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - else - write (msgString,*)"ATM - 'precip' Field not realized in exportState here." - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - endif -#if 0 - ! This does NOT currently work if precip on acceptor side stays arbGrid - call ESMF_FieldGet(field, grid=grid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! write out the Grid into VTK file for inspection - call ESMF_GridWriteVTK(grid, staggerloc=ESMF_STAGGERLOC_CENTER, & - filename="ATM-accepted-Grid-precip_centers", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#endif - ! log a message - call ESMF_LogWrite("ATM - Just completed the 'precip' Field", & - ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine DataInitialize(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - ! local variables - type(ESMF_State) :: exportState - type(ESMF_Field) :: field - real(kind=ESMF_KIND_R8), pointer :: dataPtr(:,:) - integer :: i, j - integer :: localDe, localDeCount - - rc = ESMF_SUCCESS - - ! query the Component for its exportState - call NUOPC_ModelGet(model, exportState=exportState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - -! ! air_pressure_at_sea_level -! call ESMF_StateGet(exportState, field=field, itemName="pmsl", rc=rc) -! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & -! line=__LINE__, & -! file=__FILE__)) & -! return ! bail out -! ! initialize data -! call ESMF_FieldGet(field, localDeCount=localDeCount, rc=rc) -! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & -! line=__LINE__, & -! file=__FILE__)) & -! return ! bail out -! do localDe=0, localDeCount-1 -! call ESMF_FieldGet(field, localDe=localDe, farrayPtr=dataPtr, rc=rc) -! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & -! line=__LINE__, & -! file=__FILE__)) & -! return ! bail out -! do j=lbound(dataPtr,2),ubound(dataPtr,2) -! do i=lbound(dataPtr,1),ubound(dataPtr,1) -! dataPtr(i,j) = real(i) -! enddo -! enddo -! enddo -! ! output to file -! call NUOPC_Write(field, fileName="field_atm_init_export_pmsl.nc", & -! status=ESMF_FILESTATUS_REPLACE, relaxedflag=.true., rc=rc) -! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & -! line=__LINE__, & -! file=__FILE__)) & -! return ! bail out -! ! set "Updated" -! call NUOPC_SetAttribute(field, name="Updated", value="true", rc=rc) -! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & -! line=__LINE__, & -! file=__FILE__)) & -! return ! bail out - - ! surface_net_downward_shortwave_flux - call ESMF_StateGet(exportState, field=field, itemName="rsns", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! initialize data - call ESMF_FieldGet(field, localDeCount=localDeCount, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - do localDe=0, localDeCount-1 - call ESMF_FieldGet(field, localDe=localDe, farrayPtr=dataPtr, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - do j=lbound(dataPtr,2),ubound(dataPtr,2) - do i=lbound(dataPtr,1),ubound(dataPtr,1) - dataPtr(i,j) = real(j) - enddo - enddo - enddo - ! output to file - call NUOPC_Write(field, fileName="field_atm_init_export_rsns.nc", & - status=ESMF_FILESTATUS_REPLACE, relaxedflag=.true., rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! set "Updated" - call NUOPC_SetAttribute(field, name="Updated", value="true", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - -! ! precipitation_flux -! call ESMF_StateGet(exportState, field=field, itemName="precip", rc=rc) -! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & -! line=__LINE__, & -! file=__FILE__)) & -! return ! bail out -! ! initialize data -! call ESMF_FieldGet(field, localDeCount=localDeCount, rc=rc) -! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & -! line=__LINE__, & -! file=__FILE__)) & -! return ! bail out -! call ESMF_FieldFill(field, dataFillScheme="sincos", member=10, rc=rc) -! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & -! line=__LINE__, & -! file=__FILE__)) & -! return ! bail out -! ! output to file -! call NUOPC_Write(field, fileName="field_atm_init_export_precip.nc", & -! status=ESMF_FILESTATUS_REPLACE, relaxedflag=.true., rc=rc) -! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & -! line=__LINE__, & -! file=__FILE__)) & -! return ! bail out -! ! set "Updated" -! call NUOPC_SetAttribute(field, name="Updated", value="true", rc=rc) -! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & -! line=__LINE__, & -! file=__FILE__)) & -! return ! bail out - - ! indicate that data initialization is complete (breaking out of init-loop) - call NUOPC_CompAttributeSet(model, & - name="InitializeDataComplete", value="true", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine ModelAdvance(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - ! local variables - type(ESMF_Clock) :: clock - type(ESMF_State) :: importState, exportState - integer, save :: slice=1 - character(len=160) :: msgString - - rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState - call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & - exportState=exportState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - - ! Because of the way that the internal Clock was set by default, - ! its timeStep is equal to the parent timeStep. As a consequence the - ! currTime + timeStep is equal to the stopTime of the internal Clock - ! for this call of the ModelAdvance() routine. - - call ESMF_ClockPrint(clock, options="currTime", & - preString="------>Advancing ATM from: ", unit=msgString, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_ClockPrint(clock, options="stopTime", & - preString="---------------------> to: ", unit=msgString, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! write out the Fields in the importState and exportState -#ifndef TEST_MULTI_TILE_GRID -! Write() does not currently support fields on multi-tile grids - call NUOPC_Write(importState, fileNamePrefix="field_atm_import_", & - timeslice=slice, overwrite=.true., relaxedFlag=.true., rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#endif - call NUOPC_Write(exportState, fileNamePrefix="field_atm_export_", & - timeslice=slice, overwrite=.true., relaxedFlag=.true., rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - slice = slice+1 - - end subroutine - - !----------------------------------------------------------------------------- - -end module diff --git a/AtmOcnMedTransferGridMakeMeshProto/esm.F90 b/AtmOcnMedTransferGridMakeMeshProto/esm.F90 deleted file mode 100644 index 2551b1f9..00000000 --- a/AtmOcnMedTransferGridMakeMeshProto/esm.F90 +++ /dev/null @@ -1,324 +0,0 @@ -!============================================================================== -! Earth System Modeling Framework -! Copyright 2002-2021, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, -! NASA Goddard Space Flight Center. -! Licensed under the University of Illinois-NCSA License. -!============================================================================== - -module ESM - - !----------------------------------------------------------------------------- - ! Code that specializes generic ESM Component code. - !----------------------------------------------------------------------------- - - use ESMF - use NUOPC - use NUOPC_Driver, & - driver_routine_SS => SetServices, & - driver_label_SetModelServices => label_SetModelServices, & - driver_label_ModifyCplLists => label_ModifyCplLists - - use ATM, only: atmSS => SetServices - use OCN, only: ocnSS => SetServices - use MED, only: medSS => SetServices - - use NUOPC_Connector, only: cplSS => SetServices - - implicit none - - private - - public SetServices - - !----------------------------------------------------------------------------- - contains - !----------------------------------------------------------------------------- - - subroutine SetServices(driver, rc) - type(ESMF_GridComp) :: driver - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=driver_label_SetModelServices, & - specRoutine=SetModelServices, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSpecialize(driver, specLabel=driver_label_ModifyCplLists, & - specRoutine=ModifyCplLists, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! set Verbosity - call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine SetModelServices(driver, rc) - type(ESMF_GridComp) :: driver - integer, intent(out) :: rc - - ! local variables - integer :: localrc - type(ESMF_Time) :: startTime - type(ESMF_Time) :: stopTime - type(ESMF_TimeInterval) :: timeStep - type(ESMF_Clock) :: internalClock - integer :: petCount, i - integer :: petCountATM, petCountOCN - integer, allocatable :: petList(:) - type(ESMF_GridComp) :: child - type(ESMF_CplComp) :: conn - - rc = ESMF_SUCCESS - - ! get the petCount - call ESMF_GridCompGet(driver, petCount=petCount, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! split up the PETs between ATM and OCN - petCountOCN = min(2,petCount/2) ! don't give OCN more than 2 PETs - petCountATM = petCount - petCountOCN - - ! SetServices for ATM with petList on first half of PETs - allocate(petList(petCountATM)) - do i=1, petCountATM - petList(i) = i-1 ! PET labeling goes from 0 to petCount-1 - enddo - call NUOPC_DriverAddComp(driver, "ATM", atmSS, petList=petList, & - comp=child, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - deallocate(petList) - call NUOPC_CompAttributeSet(child, name="Verbosity", value="high", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! SetServices for OCN with petList on second half of PETs - allocate(petList(petCountOCN)) - do i=1, petCountOCN - petList(i) = petCountATM + i-1 ! PET labeling goes from 0 to petCount-1 - enddo - call NUOPC_DriverAddComp(driver, "OCN", ocnSS, petList=petList, & - comp=child, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - deallocate(petList) - call NUOPC_CompAttributeSet(child, name="Verbosity", value="high", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call NUOPC_DriverAddComp(driver, "MED", medSS, & - comp=child, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompAttributeSet(child, name="Verbosity", value="high", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! SetServices for atm2ocn - call NUOPC_DriverAddComp(driver, srcCompLabel="ATM", dstCompLabel="MED", & - compSetServicesRoutine=cplSS, comp=conn, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompAttributeSet(conn, name="Verbosity", value="high", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call NUOPC_DriverAddComp(driver, srcCompLabel="MED", dstCompLabel="OCN", & - compSetServicesRoutine=cplSS, comp=conn, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompAttributeSet(conn, name="Verbosity", value="high", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! SetServices for ocn2atm - call NUOPC_DriverAddComp(driver, srcCompLabel="OCN", dstCompLabel="MED", & - compSetServicesRoutine=cplSS, comp=conn, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompAttributeSet(conn, name="Verbosity", value="high", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_DriverAddComp(driver, srcCompLabel="MED", dstCompLabel="ATM", & - compSetServicesRoutine=cplSS, comp=conn, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompAttributeSet(conn, name="Verbosity", value="high", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! set the model clock - call ESMF_TimeIntervalSet(timeStep, m=15, rc=rc) ! 15 minute steps - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_TimeSet(startTime, yy=2010, mm=6, dd=1, h=0, m=0, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_TimeSet(stopTime, yy=2010, mm=6, dd=1, h=1, m=0, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - internalClock = ESMF_ClockCreate(name="Application Clock", & - timeStep=timeStep, startTime=startTime, stopTime=stopTime, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine ModifyCplLists(driver, rc) - type(ESMF_GridComp) :: driver - integer, intent(out) :: rc - - ! local variables - character(len=160) :: msg - type(ESMF_CplComp), pointer :: connectorList(:) - integer :: i, j, cplListSize - character(len=160), allocatable :: cplList(:) - character(len=160) :: tempString - - rc = ESMF_SUCCESS - - call ESMF_LogWrite("Driver is in ModifyCplLists()", ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - nullify(connectorList) - call NUOPC_DriverGetComp(driver, compList=connectorList, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - write (msg,*) "Found ", size(connectorList), " Connectors."// & - " Modifying CplList Attribute...." - call ESMF_LogWrite(trim(msg), ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - do i=1, size(connectorList) - ! query the cplList for connector i - call NUOPC_CompAttributeGet(connectorList(i), name="CplList", & - itemCount=cplListSize, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - if (cplListSize>0) then - allocate(cplList(cplListSize)) - call NUOPC_CompAttributeGet(connectorList(i), name="CplList", & - valueList=cplList, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! go through all of the entries in the cplList - do j=1, cplListSize -#if 0 - if (trim(cplList(j))=="precipitation_flux") then - ! switch remapping to redist, b/c arbDistr Grid - cplList(j) = trim(cplList(j))//":REMAPMETHOD=redist" - elseif (trim(cplList(j))=="sea_surface_salinity") then - ! switch remapping to redist, b/c holes in index space - cplList(j) = trim(cplList(j))//":REMAPMETHOD=redist" - elseif (trim(cplList(j))=="sea_surface_temperature") then - ! switch remapping to redist, b/c can have holes in index space - cplList(j) = trim(cplList(j))//":REMAPMETHOD=redist" - elseif (trim(cplList(j))=="sea_surface_height_above_sea_level") then - ! switch remapping to redist, b/c can have holes in index space - cplList(j) = trim(cplList(j))//":REMAPMETHOD=redist" - endif -#endif - enddo - ! store the modified cplList in CplList attribute of connector i - call NUOPC_CompAttributeSet(connectorList(i), & - name="CplList", valueList=cplList, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - deallocate(cplList) - endif - enddo - - deallocate(connectorList) - - end subroutine - - !----------------------------------------------------------------------------- - -end module diff --git a/AtmOcnMedTransferGridMakeMeshProto/esmApp.F90 b/AtmOcnMedTransferGridMakeMeshProto/esmApp.F90 deleted file mode 100644 index 817b65c9..00000000 --- a/AtmOcnMedTransferGridMakeMeshProto/esmApp.F90 +++ /dev/null @@ -1,112 +0,0 @@ -!============================================================================== -! Earth System Modeling Framework -! Copyright 2002-2021, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, -! NASA Goddard Space Flight Center. -! Licensed under the University of Illinois-NCSA License. -!============================================================================== - -program esmApp - - !----------------------------------------------------------------------------- - ! Generic ESM application driver - !----------------------------------------------------------------------------- - - use ESMF - use ESM, only: esmSS => SetServices - - implicit none - - integer :: rc, urc - type(ESMF_GridComp) :: esmComp - - ! Initialize ESMF - call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, & - defaultCalkind=ESMF_CALKIND_GREGORIAN, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - call ESMF_LogSet(flush=.true., rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - call ESMF_LogWrite("esmApp STARTING", ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - ! Create the earth system Component - esmComp = ESMF_GridCompCreate(name="esm", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - ! SetServices for the earth system Component - call ESMF_GridCompSetServices(esmComp, esmSS, userRc=urc, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - ! Call Initialize for the earth system Component - call ESMF_GridCompInitialize(esmComp, userRc=urc, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - ! Call Run for earth the system Component - call ESMF_GridCompRun(esmComp, userRc=urc, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - ! Call Finalize for the earth system Component - call ESMF_GridCompFinalize(esmComp, userRc=urc, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - ! Destroy the earth system Component - call ESMF_GridCompDestroy(esmComp, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - call ESMF_LogWrite("esmApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - ! Finalize ESMF - call ESMF_Finalize() - -end program diff --git a/AtmOcnMedTransferGridMakeMeshProto/med.F90 b/AtmOcnMedTransferGridMakeMeshProto/med.F90 deleted file mode 100644 index 46c3e9f2..00000000 --- a/AtmOcnMedTransferGridMakeMeshProto/med.F90 +++ /dev/null @@ -1,1044 +0,0 @@ -!============================================================================== -! Earth System Modeling Framework -! Copyright 2002-2021, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, -! NASA Goddard Space Flight Center. -! Licensed under the University of Illinois-NCSA License. -!============================================================================== - -module MED - - !----------------------------------------------------------------------------- - ! Mediator Component. - !----------------------------------------------------------------------------- - - use ESMF - use NUOPC - use NUOPC_Mediator, only: & - mediator_routine_SS => SetServices, & - mediator_routine_Run => routine_Run, & - mediator_label_CheckImport => label_CheckImport, & - mediator_label_DataInitialize => label_DataInitialize, & - mediator_label_SetRunClock => label_SetRunClock, & - mediator_label_Advance => label_Advance, & - NUOPC_MediatorGet - - implicit none - - private - - type(ESMF_State), save :: frOCN, toOCN - type(ESMF_State), save :: frATM, toATM - - public SetServices - - !----------------------------------------------------------------------------- - contains - !----------------------------------------------------------------------------- - - subroutine SetServices(mediator, rc) - type(ESMF_GridComp) :: mediator - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - - ! the NUOPC mediator component will register the generic methods - call NUOPC_CompDerive(mediator, mediator_routine_SS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! --- Initialization phases -------------------------------------- - - ! Provide InitializeP0 to switch from default IPDv00 to IPDv03 - call ESMF_GridCompSetEntryPoint(mediator, ESMF_METHOD_INITIALIZE, & - userRoutine=InitializeP0, phase=0, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! IPDv03p1: advertise Fields - call NUOPC_CompSetEntryPoint(mediator, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv03p1"/), userRoutine=InitializeP1, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! IPDv03p3: realize connected Fields with transfer action "provide" - call NUOPC_CompSetEntryPoint(mediator, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv03p3"/), userRoutine=InitializeP3, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! IPDv03p4: optionally modify the decomp/distr of transferred Grid/Mesh - call NUOPC_CompSetEntryPoint(mediator, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv03p4"/), userRoutine=InitializeP4, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! IPDv03p5: realize all Fields with transfer action "accept" - call NUOPC_CompSetEntryPoint(mediator, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv03p5"/), userRoutine=InitializeP5, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(mediator, specLabel=mediator_label_Advance, & - specRoutine=MediatorAdvance, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSpecialize(mediator, specLabel=mediator_label_DataInitialize, & - specRoutine=DataInitialize, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! Register all the run phases - call NUOPC_CompSetEntryPoint(mediator, ESMF_METHOD_RUN, & - phaseLabelList=(/"generate_xgrid"/), & - userRoutine=mediator_routine_Run, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSpecialize(mediator, specLabel=mediator_label_Advance, & - specPhaseLabel="generate_xgrid", specRoutine=generate_xgrid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! Handle the clocks when multiple run phases exist - call NUOPC_CompSpecialize(mediator, specLabel=mediator_label_CheckImport, & - specRoutine=NUOPC_NoOp, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=__FILE__)) return ! bail out - - call NUOPC_CompSpecialize(mediator, specLabel=mediator_label_SetRunClock, & - specRoutine=SetRunClock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=__FILE__)) return ! bail out - - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine InitializeP0(mediator, importState, exportState, clock, rc) - type(ESMF_GridComp) :: mediator - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - - ! Switch to IPDv03 by filtering all other phaseMap entries - call NUOPC_CompFilterPhaseMap(mediator, ESMF_METHOD_INITIALIZE, & - acceptStringList=(/"IPDv03p"/), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine InitializeP1(mediator, importState, exportState, clock, rc) - ! IPDv03p1: advertise Fields - type(ESMF_GridComp) :: mediator - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - - ! Fields from OCN - ! use namespace in the importState - call NUOPC_AddNamespace(importState, namespace="OCN", & - nestedState=frOCN, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! advertise fields in the nested state - call NUOPC_Advertise(frOCN, & - StandardNames=(/ & -! "sea_surface_salinity ", & -! "sea_surface_height_above_sea_level", & - "sea_surface_temperature "/), & - TransferOfferGeomObject="cannot provide", & - rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! Fields to OCN - ! use namespace in the exportState - call NUOPC_AddNamespace(exportState, namespace="OCN", & - nestedState=toOCN, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! advertise fields in the nested state - call NUOPC_Advertise(toOCN, & - StandardNames=(/ & -! "air_pressure_at_sea_level ", & -! "precipitation_flux ", & - "surface_net_downward_shortwave_flux"/), & - TransferOfferGeomObject="cannot provide", & - rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! Fields from ATM - ! use namespace in the importState - call NUOPC_AddNamespace(importState, namespace="ATM", & - nestedState=frATM, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! advertise fields in the nested state - call NUOPC_Advertise(frATM, & - StandardNames=(/ & -! "air_pressure_at_sea_level ", & -! "precipitation_flux ", & - "surface_net_downward_shortwave_flux"/), & - TransferOfferGeomObject="cannot provide", & - rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! Fields to ATM - ! use namespace in the exportState - call NUOPC_AddNamespace(exportState, namespace="ATM", & - nestedState=toATM, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! advertise fields in the nested state - call NUOPC_Advertise(toATM, & - StandardNames=(/ & -! "sea_surface_salinity ", & -! "sea_surface_height_above_sea_level", & - "sea_surface_temperature "/), & - TransferOfferGeomObject="cannot provide", & - rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine InitializeP3(mediator, importState, exportState, clock, rc) - ! IPDv03p3: realize connected Fields with transfer action "provide" - ! and remove Fields that are not connected - type(ESMF_GridComp) :: mediator - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - - call checkConnectedFlagProvide(importState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call checkConnectedFlagProvide(exportState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - contains ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - subroutine checkConnectedFlagProvide(state, rc) - ! Look at all of the fields in state, including in nested states. Error - ! out if a connected field is found for which geom object must be - ! provided here. Remove all not connected fields. - type(ESMF_State) :: state - integer, optional :: rc - ! local variables - integer :: itemCount, item - character(len=80) :: stateName - type(ESMF_Field) :: field - character(len=80) :: connectedValue - character(len=80) :: transferAction - character(len=80), allocatable :: itemNameList(:) - type(ESMF_StateItem_Flag), allocatable :: itemTypeList(:) - type(ESMF_StateIntent_Flag) :: stateIntent - character(len=80) :: transferActionAttr - - if (present(rc)) rc = ESMF_SUCCESS - - call ESMF_StateGet(state, stateIntent=stateIntent, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - if (stateIntent==ESMF_STATEINTENT_EXPORT) then - transferActionAttr="ProducerTransferAction" - elseif (stateIntent==ESMF_STATEINTENT_IMPORT) then - transferActionAttr="ConsumerTransferAction" - else - call ESMF_LogSetError(ESMF_RC_ARG_BAD, & - msg="The stateIntent must either be IMPORT or EXPORT here.", & - line=__LINE__, & - file=__FILE__, & - rcToReturn=rc) - return ! bail out - endif - - call ESMF_StateGet(state, name=stateName, nestedFlag=.true., & - itemCount=itemCount, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - allocate(itemNameList(itemCount), itemTypeList(itemCount)) - - call ESMF_StateGet(state, nestedFlag=.true., & - itemNameList=itemNameList, itemTypeList=itemTypeList, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - do item=1, itemCount - if (itemTypeList(item)==ESMF_STATEITEM_FIELD) then - ! this is a field -> get more info - call ESMF_StateGet(state, field=field, itemName=itemNameList(item), & - rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_GetAttribute(field, name="Connected", & - value=connectedValue, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - if (connectedValue=="false") then - ! remove the field from the state - call ESMF_StateRemove(state, (/itemNameList(item)/), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - else - call NUOPC_GetAttribute(field, name=transferActionAttr, & - value=transferAction, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - if (trim(transferAction)=="provide") then - ! the Connector instructed the Mediator to provide geom object - call ESMF_LogSetError(ESMF_RC_NOT_VALID, & - msg="Cannot fulfill request to provide geom object for "// & - trim(itemNameList(item))//" in State "//trim(stateName), & - line=__LINE__, & - file=__FILE__, & - rcToReturn=rc) - return ! bail out - endif - endif - endif - enddo - - deallocate(itemNameList, itemTypeList) - - end subroutine - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine InitializeP4(mediator, importState, exportState, clock, rc) - ! IPDv03p4: optionally modify the decomp/distr of transferred Grid/Mesh - type(ESMF_GridComp) :: mediator - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - - call adjustAcceptedGeom(importState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call adjustAcceptedGeom(exportState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - contains ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - subroutine adjustAcceptedGeom(state, rc) - ! Look at all of the fields in state, including in nested states. Adjust - ! the distribution of the accepted geom object to a 1 DE/PET distribution. - type(ESMF_State) :: state - integer, optional :: rc - ! local variables - integer :: itemCount, item - type(ESMF_Field) :: field - character(len=80) :: transferAction - character(len=80), allocatable :: itemNameList(:) - type(ESMF_StateItem_Flag), allocatable :: itemTypeList(:) - type(ESMF_GeomType_Flag) :: geomtype - type(ESMF_Grid) :: grid - type(ESMF_Mesh) :: mesh - character(160) :: msgString - type(ESMF_DistGrid) :: distgrid - integer :: dimCount, tileCount, petCount - integer :: deCountPTile, extraDEs - integer, allocatable :: minIndexPTile(:,:), maxIndexPTile(:,:) - integer, allocatable :: regDecompPTile(:,:) - integer :: i, j - type(ESMF_StateIntent_Flag) :: stateIntent - character(len=80) :: transferActionAttr - - if (present(rc)) rc = ESMF_SUCCESS - - call ESMF_StateGet(state, stateIntent=stateIntent, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - if (stateIntent==ESMF_STATEINTENT_EXPORT) then - transferActionAttr="ProducerTransferAction" - elseif (stateIntent==ESMF_STATEINTENT_IMPORT) then - transferActionAttr="ConsumerTransferAction" - else - call ESMF_LogSetError(ESMF_RC_ARG_BAD, & - msg="The stateIntent must either be IMPORT or EXPORT here.", & - line=__LINE__, & - file=__FILE__, & - rcToReturn=rc) - return ! bail out - endif - - call ESMF_StateGet(state, nestedFlag=.true., itemCount=itemCount, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - allocate(itemNameList(itemCount), itemTypeList(itemCount)) - - call ESMF_StateGet(state, nestedFlag=.true., & - itemNameList=itemNameList, itemTypeList=itemTypeList, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - do item=1, itemCount - if (itemTypeList(item)==ESMF_STATEITEM_FIELD) then - ! this is a field -> get more info - call ESMF_StateGet(state, field=field, itemName=itemNameList(item), & - rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_GetAttribute(field, name=transferActionAttr, & - value=transferAction, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - if (trim(transferAction)=="accept") then - ! the Connector instructed the Mediator to accept geom object - ! -> find out which type geom object the field holds - call ESMF_FieldGet(field, geomtype=geomtype, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - if (geomtype==ESMF_GEOMTYPE_GRID) then - ! empty field holds a Grid with DistGrid - call ESMF_FieldGet(field, grid=grid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! access the DistGrid - call ESMF_GridGet(grid, distgrid=distgrid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! Create a custom DistGrid, based on the minIndex, maxIndex of the - ! accepted DistGrid, but with a default regDecomp for the current VM - ! that leads to 1DE/PET. - ! get dimCount and tileCount - call ESMF_DistGridGet(distgrid, dimCount=dimCount, & - tileCount=tileCount, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! allocate minIndexPTile and maxIndexPTile accord. to dimCount and tileCount - allocate(minIndexPTile(dimCount, tileCount), & - maxIndexPTile(dimCount, tileCount)) - ! get minIndex and maxIndex arrays - call ESMF_DistGridGet(distgrid, minIndexPTile=minIndexPTile, & - maxIndexPTile=maxIndexPTile, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! construct a default regDecompPTile -> TODO: move this into ESMF as default - call ESMF_GridCompGet(mediator, petCount=petCount, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - allocate(regDecompPTile(dimCount, tileCount)) - deCountPTile = petCount/tileCount - extraDEs = max(0, petCount-deCountPTile) - do i=1, tileCount - if (i<=extraDEs) then - regDecompPTile(1, i) = deCountPTile + 1 - else - regDecompPTile(1, i) = deCountPTile - endif - do j=2, dimCount - regDecompPTile(j, i) = 1 - enddo - enddo - ! create the new DistGrid with the same minIndexPTile and maxIndexPTile, - ! but with a default regDecompPTile - distgrid = ESMF_DistGridCreate(minIndexPTile=minIndexPTile, & - maxIndexPTile=maxIndexPTile, regDecompPTile=regDecompPTile, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! Create a new Grid on the new DistGrid and swap it in the Field - grid = ESMF_GridCreate(distgrid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_FieldEmptySet(field, grid=grid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! local clean-up - deallocate(minIndexPTile, maxIndexPTile, regDecompPTile) - elseif (geomtype==ESMF_GEOMTYPE_MESH) then - ! empty field holds a Mesh with DistGrid - call ESMF_FieldGet(field, mesh=mesh, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! access the DistGrid - call ESMF_MeshGet(mesh, elementDistgrid=distgrid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! Create a custom DistGrid, based on the minIndex, maxIndex of the - ! accepted DistGrid, but with a default regDecomp for the current VM - ! that leads to 1DE/PET. - ! get dimCount and tileCount - call ESMF_DistGridGet(distgrid, dimCount=dimCount, & - tileCount=tileCount, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! allocate minIndexPTile and maxIndexPTile accord. to dimCount and tileCount - allocate(minIndexPTile(dimCount, tileCount), & - maxIndexPTile(dimCount, tileCount)) - ! get minIndex and maxIndex arrays - call ESMF_DistGridGet(distgrid, minIndexPTile=minIndexPTile, & - maxIndexPTile=maxIndexPTile, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! construct a default regDecompPTile -> TODO: move this into ESMF as default - call ESMF_GridCompGet(mediator, petCount=petCount, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - allocate(regDecompPTile(dimCount, tileCount)) - deCountPTile = petCount/tileCount - extraDEs = max(0, petCount-deCountPTile) - do i=1, tileCount - if (i<=extraDEs) then - regDecompPTile(1, i) = deCountPTile + 1 - else - regDecompPTile(1, i) = deCountPTile - endif - do j=2, dimCount - regDecompPTile(j, i) = 1 - enddo - enddo - ! create the new DistGrid with the same minIndexPTile and maxIndexPTile, - ! but with a default regDecompPTile - distgrid = ESMF_DistGridCreate(minIndexPTile=minIndexPTile, & - maxIndexPTile=maxIndexPTile, regDecompPTile=regDecompPTile, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! Create a new Grid on the new DistGrid and swap it in the Field - mesh = ESMF_MeshCreate(distgrid, distgrid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_FieldEmptySet(field, mesh=mesh, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! local clean-up - deallocate(minIndexPTile, maxIndexPTile, regDecompPTile) - else - call ESMF_LogSetError(ESMF_RC_NOT_VALID, & - msg="Unsupported geom object found in "// & - trim(itemNameList(item)), & - line=__LINE__, & - file=__FILE__, & - rcToReturn=rc) - return ! bail out - endif - endif - endif - enddo - - deallocate(itemNameList, itemTypeList) - - end subroutine - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine InitializeP5(mediator, importState, exportState, clock, rc) - ! IPDv03p5: realize all Fields with transfer action "accept" - type(ESMF_GridComp) :: mediator - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - - call realizeWithAcceptedGeom(importState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call realizeWithAcceptedGeom(exportState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - contains ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - subroutine realizeWithAcceptedGeom(state, rc) - ! Look at all of the fields in state, including in nested states. Realize - ! with the accepted and adjusted geom object. - type(ESMF_State) :: state - integer, optional :: rc - ! local variables - integer :: itemCount, item, stat, idxns, ii - type(ESMF_State) :: nestedState - type(ESMF_State) :: nestedStates(4) - type(ESMF_Field) :: field, fieldOnMesh - type(ESMF_Grid) :: grid - type(ESMF_Mesh) :: mesh - character(len=80) :: fieldName - type(ESMF_FieldStatus_Flag) :: fieldStatus - character(len=80), allocatable :: itemNameList(:) - type(ESMF_StateItem_Flag), allocatable :: itemTypeList(:) - integer, pointer :: ugLBound(:), ugUBound(:) - integer, pointer :: gridToFieldMap(:) - type(ESMF_StateItem_Flag) :: itemType - - if (present(rc)) rc = ESMF_SUCCESS - - call ESMF_StateGet(state, nestedFlag=.true., itemCount=itemCount, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - allocate(itemNameList(itemCount), itemTypeList(itemCount)) - - call ESMF_StateGet(state, nestedFlag=.true., & - itemNameList=itemNameList, itemTypeList=itemTypeList, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - idxns = 0 - do item =1, itemCount - if(itemTypeList(item) == ESMF_STATEITEM_STATE) then - call ESMF_StateGet(state, itemName=itemNameList(item), nestedState=nestedState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - idxns = idxns + 1 - nestedStates(idxns) = nestedState - endif - enddo - - do item=1, itemCount - if (itemTypeList(item)==ESMF_STATEITEM_FIELD) then - ! this is a field -> get more info - call ESMF_StateGet(state, field=field, itemName=itemNameList(item), & - rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_FieldGet(field, status=fieldStatus, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - if (fieldStatus==ESMF_FIELDSTATUS_GRIDSET) then - ! the Connector instructed the Mediator to accept geom object - ! the transferred geom object is already set, allocate memory - ! for data by complete - - !!! - call ESMF_FieldGet(field, grid=grid, name=fieldName, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - Write(*, '(I5 A A A A)') item, ' ', itemNameList(item), ' ', fieldName - - ! Convert grid to mesh - mesh = ESMF_GridToMeshCell(grid,rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - fieldOnMesh = ESMF_FieldCreate(mesh, typekind=ESMF_TYPEKIND_R8, name=FieldName, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - do ii = 1, idxns - call ESMF_StateGet(nestedStates(ii), itemName=fieldName, itemType=itemType, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - if(itemType /= ESMF_STATEITEM_NOTFOUND) exit - enddo - - ! Swap grid for mesh, at this point, only connected fields are in the state - !call NUOPC_Realize(State, mesh=mesh, selection="realize_connected_remove_others", fieldName=fieldName, rc=rc) - !call NUOPC_Realize(State, mesh=mesh, fieldName=fieldName, rc=rc) - !call NUOPC_Realize(State, mesh=mesh, fieldName=itemNameList(item), rc=rc) - call NUOPC_Realize(nestedStates(ii), field=fieldOnMesh, rc=rc) - !call NUOPC_Realize(nestedStates(ii), mesh=mesh, fieldName=fieldName, rc=rc) - !call NUOPC_Realize(State, mesh=mesh, fieldName=fieldName, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#if 0 - nullify(ugLBound, ugUBound, gridToFieldMap) - ! deal with gridToFieldMap - call ESMF_AttributeGet(field, name="GridToFieldMap", & - convention="NUOPC", purpose="Instance", & - itemCount=itemCount, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - if (itemCount > 0) then - allocate(gridToFieldMap(itemCount)) - call ESMF_AttributeGet(field, name="GridToFieldMap", & - convention="NUOPC", purpose="Instance", & - valueList=gridToFieldMap, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - endif - ! deal with ungriddedLBound - call ESMF_AttributeGet(field, name="UngriddedLBound", & - convention="NUOPC", purpose="Instance", & - itemCount=itemCount, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - if (itemCount > 0) then - allocate(ugLBound(itemCount)) - call ESMF_AttributeGet(field, name="UngriddedLBound", & - convention="NUOPC", purpose="Instance", & - valueList=ugLBound, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - endif - ! deal with ungriddedUBound - call ESMF_AttributeGet(field, name="UngriddedUBound", & - convention="NUOPC", purpose="Instance", & - itemCount=itemCount, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - if (itemCount > 0) then - allocate(ugUBound(itemCount)) - call ESMF_AttributeGet(field, name="UngriddedUBound", & - convention="NUOPC", purpose="Instance", & - valueList=ugUBound, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - endif - - if (associated(ugLBound).and.associated(ugUBound)) then - call ESMF_FieldEmptyComplete(field, typekind=ESMF_TYPEKIND_R8, & - ungriddedLBound=ugLBound, ungriddedUBound=ugUBound, & - gridToFieldMap=gridToFieldMap, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - deallocate(ugLBound, ugUBound) - else - call ESMF_FieldEmptyComplete(field, typekind=ESMF_TYPEKIND_R8, & - gridToFieldMap=gridToFieldMap, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - endif - deallocate(gridToFieldMap) -#endif - endif - endif - enddo - - deallocate(itemNameList, itemTypeList) - - end subroutine - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine DataInitialize(mediator, rc) - type(ESMF_GridComp) :: mediator - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - - ! indicate that data initialization is complete (breaking out of init-loop) - call NUOPC_CompAttributeSet(mediator, & - name="InitializeDataComplete", value="true", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - subroutine MediatorAdvance(mediator, rc) - type(ESMF_GridComp) :: mediator - integer, intent(out) :: rc - - ! local variables - type(ESMF_Clock) :: clock - type(ESMF_State) :: importState, exportState - integer :: itemCount(4) - character(len=160) :: msgString - - rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState - call ESMF_GridCompGet(mediator, clock=clock, importState=importState, & - exportState=exportState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! HERE THE MEDIATOR ADVANCES: currTime -> currTime + timeStep - - call ESMF_ClockPrint(clock, options="currTime", & - preString="------>Advancing MED from: ", unit=msgString, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_ClockPrint(clock, options="stopTime", & - preString="---------------------> to: ", unit=msgString, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_StateGet(frOCN, itemCount=itemCount(1), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_StateGet(toOCN, itemCount=itemCount(2), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_StateGet(frATM, itemCount=itemCount(3), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_StateGet(toATM, itemCount=itemCount(4), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - - print *, "item counts for: frOCN, toOCN, frATM, toATM:", & - itemCount - - end subroutine - - subroutine generate_xgrid(mediator, rc) - type(ESMF_GridComp) :: mediator - integer, intent(out) :: rc - - ! local variables - type(ESMF_Clock) :: clock - type(ESMF_Time) :: time - character(len=64) :: timestr - type(ESMF_State) :: importState, exportState - - rc = ESMF_SUCCESS - - end subroutine - - subroutine SetRunClock(gcomp, rc) - type(ESMF_GridComp) :: gcomp - integer, intent(out) :: rc - - ! local variables - type(ESMF_Clock) :: mediatorClock, driverClock - type(ESMF_Time) :: currTime - type(ESMF_TimeInterval) :: timeStep - - rc = ESMF_SUCCESS - - ! query the Mediator for clocks - call NUOPC_MediatorGet(gcomp, mediatorClock=mediatorClock, & - driverClock=driverClock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=__FILE__)) return ! bail out - - ! set the mediatorClock to have the current start time as the driverClock - call ESMF_ClockGet(driverClock, currTime=currTime, timeStep=timeStep, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_ClockSet(mediatorClock, currTime=currTime, timeStep=timeStep, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=__FILE__)) return ! bail out - - ! check and set the component clock against the driver clock - call NUOPC_CompCheckSetClock(gcomp, driverClock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=__FILE__)) return ! bail out - - end subroutine SetRunClock - - subroutine ClockTimePrint(clock,string,rc) - - type(ESMF_Clock),intent(in) :: clock - character(len=*),intent(in),optional :: string - integer, intent(out) :: rc - - type(ESMF_Time) :: time - type(ESMF_TimeInterval) :: timeStep - character(len=64) :: timestr - character(len=512) :: lstring - - rc = ESMF_SUCCESS - - call ESMF_ClockGet(clock,currtime=time,rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_TimeGet(time,timestring=timestr,rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(trim("currtime = ")//trim(timestr), ESMF_LOGMSG_INFO, rc=rc) - - end subroutine ClockTimePrint - -end module diff --git a/AtmOcnMedTransferGridMakeMeshProto/ocn.F90 b/AtmOcnMedTransferGridMakeMeshProto/ocn.F90 deleted file mode 100644 index 2b3c8a8d..00000000 --- a/AtmOcnMedTransferGridMakeMeshProto/ocn.F90 +++ /dev/null @@ -1,911 +0,0 @@ -!============================================================================== -! Earth System Modeling Framework -! Copyright 2002-2021, University Corporation for Atmospheric Research, -! Massachusetts Institute of Technology, Geophysical Fluid Dynamics -! Laboratory, University of Michigan, National Centers for Environmental -! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, -! NASA Goddard Space Flight Center. -! Licensed under the University of Illinois-NCSA License. -!============================================================================== - -! Make sure to define test macros consistently across all source files: -#define TEST_GRID_EDGE_WIDTHS_off -#define TEST_GRID_EDGE_WIDTHS_KEEP_FACTORIZED_COORDS___off -#define TEST_MULTI_TILE_GRID - -module OCN - - !----------------------------------------------------------------------------- - ! OCN Component. - !----------------------------------------------------------------------------- - - use ESMF - use NUOPC - use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_SetClock => label_SetClock, & - model_label_CheckImport => label_CheckImport, & - model_label_Advance => label_Advance - - implicit none - - private - - public SetServices - - !----------------------------------------------------------------------------- - contains - !----------------------------------------------------------------------------- - - subroutine SetServices(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(model, model_routine_SS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeAdvertise, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSetEntryPoint(model, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeRealize, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(model, specLabel=model_label_SetClock, & - specRoutine=SetClock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSpecialize(model, specLabel=model_label_CheckImport, & - specRoutine=NUOPC_NoOp, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine InitializeAdvertise(model, importState, exportState, clock, rc) - type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - -! ! importable field: air_pressure_at_sea_level -! ! -> use default, i.e. marked as "will provide" -! call NUOPC_Advertise(importState, & -! StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) -! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & -! line=__LINE__, & -! file=__FILE__)) & -! return ! bail out - - ! importable field: surface_net_downward_shortwave_flux - ! -> use default, i.e. marked as "will provide" - call NUOPC_Advertise(importState, & - StandardName="surface_net_downward_shortwave_flux", name="rsns", & - TransferOfferGeomObject="will provide", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - -! ! importable field: precipitation_flux -! ! -> use default, i.e. marked as "will provide" -! call NUOPC_Advertise(importState, & -! StandardName="precipitation_flux", name="precip", rc=rc) -! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & -! line=__LINE__, & -! file=__FILE__)) & -! return ! bail out - - call ESMF_LogWrite("Done advertising fields in OCN importState", & - ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! exportable field: sea_surface_temperature - ! -> use default, i.e. marked as "will provide" - call NUOPC_Advertise(exportState, & - StandardName="sea_surface_temperature", name="sst", & - TransferOfferGeomObject="will provide", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - -! ! exportable field: sea_surface_salinity -! ! -> use default, i.e. marked as "will provide" -! call NUOPC_Advertise(exportState, & -! StandardName="sea_surface_salinity", name="sss", rc=rc) -! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & -! line=__LINE__, & -! file=__FILE__)) & -! return ! bail out - -! ! exportable field: sea_surface_height_above_sea_level -! ! -> use default, i.e. marked as "will provide" -! call NUOPC_Advertise(exportState, & -! StandardName="sea_surface_height_above_sea_level", name="ssh", rc=rc) -! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & -! line=__LINE__, & -! file=__FILE__)) & -! return ! bail out - - call ESMF_LogWrite("Done advertising fields in OCN exportState", & - ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine InitializeRealize(model, importState, exportState, clock, rc) - type(ESMF_GridComp) :: model - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - ! local variables - type(ESMF_Grid) :: gridIn, gridOut, gridArb, gridAux - type(ESMF_DistGrid) :: distgrid - integer :: deBlockList(2,2,0:1) ! 2 DEs - integer :: arbIndexCount, extra - integer, allocatable :: arbIndexList(:,:) - integer :: iCount, jCount, petCount, localPet, ind, i - type(ESMF_Field) :: fieldArb, fieldAux, sstField - real(ESMF_KIND_R8), pointer :: fptr(:), dataPtr(:) - real(ESMF_KIND_R8), pointer :: coordPtr(:,:) - type(ESMF_RouteHandle):: rh - real(ESMF_KIND_R8), pointer :: factorList(:) - integer(ESMF_KIND_I4),pointer :: factorIndexList(:,:) - type(ESMF_DistGridConnection), allocatable :: connectionList(:) - type(ESMF_Array) :: array - integer :: dimCount, rank - integer :: coordDimMap(2,2) - character(160) :: msgString - - rc = ESMF_SUCCESS - - !--- regDecomp Grid ------------------------------------------------------- - ! create Grid objects for import Fields - gridIn = ESMF_GridCreate1PeriDimUfrm(maxIndex=(/100, 150/), & - minCornerCoord=(/0._ESMF_KIND_R8, -60._ESMF_KIND_R8/), & - maxCornerCoord=(/360._ESMF_KIND_R8, 80._ESMF_KIND_R8/), & - staggerLocList=(/ESMF_STAGGERLOC_CENTER, ESMF_STAGGERLOC_CORNER/), name="OCN-GridIn", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - -#ifdef TEST_GRID_EDGE_WIDTHS - ! Test Grid created from DG -> test transfer of various pieces of info - ! Note that the DG holds the topology info of the original GridCreate() - ! short-cut, so here simple periodic connection along dim=1. - - gridAux = gridIn ! hold on to original gridIn - - call ESMF_GridGet(gridAux, distgrid=distgrid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - -#ifdef TEST_GRID_EDGE_WIDTHS_KEEP_FACTORIZED_COORDS - coordDimMap(1,1) = 1 - coordDimMap(1,2) = 1 - coordDimMap(2,1) = 2 - coordDimMap(2,2) = 2 -#endif - - gridIn = ESMF_GridCreate(distgrid, & -#ifdef TEST_GRID_EDGE_WIDTHS_KEEP_FACTORIZED_COORDS - coordDimCount=(/1,1/), coordDimMap=coordDimMap, & -#endif - indexflag=ESMF_INDEX_GLOBAL, & - gridEdgeLWidth=(/1,1/), & - gridEdgeUWidth=(/1,1/), & - name="OCN-GridInFromDG", & - rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - -#ifdef TEST_GRID_EDGE_WIDTHS_KEEP_FACTORIZED_COORDS - call ESMF_GridGetCoord(gridAux, coordDim=1, array=array, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_GridSetCoord(gridIn, coordDim=1, array=array, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_GridGetCoord(gridAux, coordDim=2, array=array, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_GridSetCoord(gridIn, coordDim=2, array=array, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#else - ! Caution: make sure to choose staggerEdge widths that are consistent - ! with the topology. Here because of periodicity in dim=1, there cannot - ! be any staggerEdge L/U width along the 1st dimension! - ! - actually let CENTER just default to its typical (/0,0/) edge widths - call ESMF_GridAddCoord(gridIn, staggerloc=ESMF_STAGGERLOC_CENTER, & - rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! - set some values in the coordinates so that output does look messed up - call ESMF_GridGetCoord(gridIn, coordDim=1, farrayPtr=coordPtr, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - do i=lbound(coordPtr,1), ubound(coordPtr,1) - coordPtr(i,:) = real(i, ESMF_KIND_R8) - enddo - call ESMF_GridGetCoord(gridIn, coordDim=2, farrayPtr=coordPtr, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - do i=lbound(coordPtr,2), ubound(coordPtr,2) - coordPtr(:,i) = real(i, ESMF_KIND_R8) - enddo -#endif - - ! add CORNER stagger with edge width - call ESMF_GridAddCoord(gridIn, staggerloc=ESMF_STAGGERLOC_CORNER, & - staggerEdgeLWidth = (/1,1/), & - staggerEdgeUWidth = (/0,0/), & - rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! add EDGE1 stagger with edge width - call ESMF_GridAddCoord(gridIn, staggerloc=ESMF_STAGGERLOC_EDGE1, & - staggerEdgeLWidth = (/0,1/), & - staggerEdgeUWidth = (/1,1/), & - rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! add EDGE2 stagger with edge width - call ESMF_GridAddCoord(gridIn, staggerloc=ESMF_STAGGERLOC_EDGE2, & - staggerEdgeLWidth = (/1,0/), & - staggerEdgeUWidth = (/0,1/), & - rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#endif - -#if 1 - ! testing the output of coord arrays - !TODO: - ! Coords are currently written in 2D index space even if there is coordinate - ! factorization used, e.g. in the Ufrm() GridCreate. Therefore the coord - ! arrays have replicated dims, and underlying allocation is only 1D. This - ! should be changed in the ArrayWrite() where Arrays with replicated dims - ! should write out only the non-degenerate data, i.e. according to the - ! actual data allocation. - ! -> here that would be a 1D array for each coordiante dim. - ! center: - call ESMF_GridGetCoord(gridIn, coordDim=1, array=array, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_ArrayWrite(array, "array_OCN-gridIn_center_coord1.nc", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_GridGetCoord(gridIn, coordDim=2, array=array, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_ArrayWrite(array, "array_OCN-gridIn_center_coord2.nc", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#ifdef TEST_GRID_EDGE_WIDTHS - ! corner: - call ESMF_GridGetCoord(gridIn, staggerloc=ESMF_STAGGERLOC_CORNER, & - coordDim=1, array=array, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_ArrayWrite(array, "array_OCN-gridIn_corner_coord1.nc", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_GridGetCoord(gridIn, staggerloc=ESMF_STAGGERLOC_CORNER, & - coordDim=2, array=array, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_ArrayWrite(array, "array_OCN-gridIn_corner_coord2.nc", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! edge1: - call ESMF_GridGetCoord(gridIn, staggerloc=ESMF_STAGGERLOC_EDGE1, & - coordDim=1, array=array, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_ArrayWrite(array, "array_OCN-gridIn_edge1_coord1.nc", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_GridGetCoord(gridIn, staggerloc=ESMF_STAGGERLOC_EDGE1, & - coordDim=2, array=array, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_ArrayWrite(array, "array_OCN-gridIn_edge1_coord2.nc", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! edge2: - call ESMF_GridGetCoord(gridIn, staggerloc=ESMF_STAGGERLOC_EDGE2, & - coordDim=1, array=array, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_ArrayWrite(array, "array_OCN-gridIn_edge2_coord1.nc", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_GridGetCoord(gridIn, staggerloc=ESMF_STAGGERLOC_EDGE2, & - coordDim=2, array=array, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_ArrayWrite(array, "array_OCN-gridIn_edge2_coord2.nc", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#endif -#endif - -#if 1 - ! write out the Grid into VTK file for inspection - call ESMF_GridWriteVTK(gridIn, staggerloc=ESMF_STAGGERLOC_CENTER, & - filename="OCN-GridIn_centers", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_LogWrite("Done writing OCN-GridIn_centers VTK", & - ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#endif - -! ! importable field: air_pressure_at_sea_level -! call NUOPC_Realize(importState, gridIn, fieldName="pmsl", & -! typekind=ESMF_TYPEKIND_R8, selection="realize_connected_remove_others", & -! dataFillScheme="sincos", rc=rc) -! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & -! line=__LINE__, & -! file=__FILE__)) & -! return ! bail out - - ! importable field: surface_net_downward_shortwave_flux - call NUOPC_Realize(importState, gridIn, fieldName="rsns", & - typekind=ESMF_TYPEKIND_R8, selection="realize_connected_remove_others", & - dataFillScheme="sincos", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - !--- deBlock Grid ------------------------------------------------------- - ! create Grid objects for export Fields - ! DE 0 - deBlockList(:,1,0) = (/1,1/) ! min - deBlockList(:,2,0) = (/100,20/) ! max - ! DE 1 - deBlockList(:,1,1) = (/61,31/) ! min - deBlockList(:,2,1) = (/100,120/) ! max - gridOut = ESMF_GridCreate1PeriDimUfrm(maxIndex=(/100, 120/), & - minCornerCoord=(/0._ESMF_KIND_R8, -50._ESMF_KIND_R8/), & - maxCornerCoord=(/360._ESMF_KIND_R8, 60._ESMF_KIND_R8/), & - deBlockList=deBlockList, & - staggerLocList=(/ESMF_STAGGERLOC_CENTER, ESMF_STAGGERLOC_CORNER/), name="OCN-GridOut", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - -#if 0 - ! write out the Grid into VTK file for inspection - ! -> This currently only works if there are no holes in the index space - ! -> coverage. If the deBlocks do not fully cover the index space, the - ! -> GridToMesh conversion fails: therefore no VTK output or regrid. - call ESMF_GridWriteVTK(gridOut, staggerloc=ESMF_STAGGERLOC_CENTER, & - filename="OCN-GridOut_centers", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_LogWrite("Done writing OCN-GridOut_centers VTK", & - ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#endif - - ! exportable field: sea_surface_temperature - call NUOPC_Realize(exportState, gridOut, fieldName="sst", & - typekind=ESMF_TYPEKIND_R8, selection="realize_connected_remove_others", & - dataFillScheme="sincos", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - -! ! exportable field: sea_surface_salinity -! call NUOPC_Realize(exportState, gridOut, fieldName="sss", & -! typekind=ESMF_TYPEKIND_R8, selection="realize_connected_remove_others", & -! dataFillScheme="sincos", rc=rc) -! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & -! line=__LINE__, & -! file=__FILE__)) & -! return ! bail out - -#ifdef TEST_MULTI_TILE_GRID - !--- 6-tile cubed-sphere Grid: for ssh field below ------------------------ - gridOut = ESMF_GridCreateCubedSphere(tileSize=16, name="OCN-CubedSphere", & - staggerLocList=(/ESMF_STAGGERLOC_CENTER, ESMF_STAGGERLOC_CORNER/), & - rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! write cubed sphere grid out to VTK - call ESMF_GridWriteVTK(gridOut, staggerloc=ESMF_STAGGERLOC_CENTER, & - filename="OCN-GridCS_centers", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#endif - -! ! exportable field: sea_surface_height_above_sea_level -! call NUOPC_Realize(exportState, gridOut, fieldName="ssh", & -! typekind=ESMF_TYPEKIND_R8, selection="realize_connected_remove_others", & -! dataFillScheme="sincos", rc=rc) -! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & -! line=__LINE__, & -! file=__FILE__)) & -! return ! bail out - - - !--- arbDistr Grid: for precip field below ------------------------------- - ! set up the index space - iCount = 120 - jCount = 180 - ! set up arbitrary distribution scheme - call ESMF_GridCompGet(model, petCount=petCount, localPet=localPet, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - arbIndexCount = (iCount*jCount)/petCount - extra = (iCount*jCount) - arbIndexCount*petCount - ! add extra elements to the last PET - if (localPet==petCount-1) arbIndexCount = arbIndexCount + extra - ! distributed via "card dealing" scheme across the PETs - allocate(arbIndexList(arbIndexCount,2)) - ind = localPet - do i=1, arbIndexCount - arbIndexList(i,1)=ind/jCount + 1 - arbIndexList(i,2)=mod(ind,jCount)+1 - ind = ind + petCount - enddo - if (localPet == petCount-1) then - ind = iCount*jCount-extra+1 - do i=arbIndexCount-extra+1,arbIndexCount - arbIndexList(i,1)=ind/jCount+1 - arbIndexList(i,2)=mod(ind,jCount)+1 - ind = ind + 1 - enddo - endif - - ! create the grid - gridArb = ESMF_GridCreate1PeriDim(maxIndex=(/iCount, jCount/), & - arbIndexCount=arbIndexCount, arbIndexList=arbIndexList, & - name="OCN-GridArb", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! add the center stagger coordinates - call ESMF_GridAddCoord(gridArb, staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! fill longitudes - call ESMF_GridGetCoord(gridArb, coordDim=1, farrayPtr=fptr, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - do i=lbound(fptr,1),ubound(fptr,1) - fptr(i) = real((arbIndexList(i,1)-1)) * 360.0 / real(iCount) - enddo - - ! fill latitudes - call ESMF_GridGetCoord(gridArb, coordDim=2, farrayPtr=fptr, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - do i=lbound(fptr,1),ubound(fptr,1) - fptr(i) = real((arbIndexList(i,2)-1)) * 160.0 / real(jCount) - 80.0 - enddo - - ! create a field on the grid - fieldArb = ESMF_FieldCreate(gridArb, typekind=ESMF_TYPEKIND_R8, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! fill the field with some easy to visualize data - call ESMF_FieldFill(fieldArb, dataFillScheme="sincos", member=2, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! write the field out to file, which will be 1d and with the arbitrary order - call ESMF_FieldWrite(fieldArb, fileName="field_gridArb.nc", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! create an auxiliary regDecomp grid with the same index space as gridArb - ! periodic along i (must set here explicitly to match the gridArb - ! ESMF_GridCreate1PeriDim() from above). In the long run, - ! an arbDistr Grid will actually store a regDecomp auxiliary DistGrid - ! internally which holds the correct connections. - allocate(connectionList(1)) - call ESMF_DistGridConnectionSet(connection=connectionList(1), & - tileIndexA=1, tileIndexB=1, positionVector=(/iCount, 0/), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - distgrid = ESMF_DistGridCreate(minIndex=(/1, 1/), & - maxIndex=(/iCount, jCount/), connectionList=connectionList, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! now create a regDecomp grid from arbDistr Grid, with auto redist coords - gridAux = ESMF_GridCreate(gridArb, distgrid=distgrid, & - name="OCN-GridAux", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#if 1 - ! since this is simple regDecomp grid, it can be written to VTK - call ESMF_GridWriteVTK(gridAux, staggerloc=ESMF_STAGGERLOC_CENTER, & - filename="OCN-GridAux_centers", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#endif - ! ceate an auxiliary field on gridAux to be used in RegridStore - fieldAux = ESMF_FieldCreate(gridAux, typekind=ESMF_TYPEKIND_R8, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - -#if 0 - ! test the fieldAux - call ESMF_FieldFill(fieldAux, dataFillScheme="sincos", member=3, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_FieldWrite(fieldAux, fileName="field_gridAux.nc", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#endif - - ! pull out the sst field from exportState for testing regridding to it - call ESMF_StateGet(exportState, itemName="sst", field=sstField, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! compute sparse matrix (factorList and factorIndexList) for a substitute - ! call to RegridStore(), neither side is arbDistr - call ESMF_FieldRegridStore(fieldAux, sstField, factorList=factorList, & - factorIndexList=factorIndexList, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! now use the regrid sparse matrix (factorList and factorIndexList) from - ! above to precompute the routehandle for the arbDistr case. This works - ! because the index space is identical. - call ESMF_FieldSMMStore(fieldArb, sstField, factorList=factorList, & - factorIndexList=factorIndexList, routehandle=rh, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! for final test fill the arbDistr side with identifiable data - call ESMF_FieldFill(fieldArb, dataFillScheme="sincos", member=5, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! execute the sparse matrix to do the regrid (could have called FieldRegrid - ! for clarity if desired) - call ESMF_FieldSMM(fieldArb, sstField, routehandle=rh, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - -#ifndef TEST_MULTI_TILE_GRID -! Write() does not currently support fields on multi-tile grids - ! finally write the destination side (which is located in the exportState) - ! to file for inspection - call NUOPC_Write(exportState, fileNamePrefix="field_ocn_init_export_", & - relaxedFlag=.true., rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#endif - - ! -->> use the arbDistr grid for "precip" field in the importState - ! This is to test how a arbDistr grid gets handled during the transfer - ! protocol. Search for "precip" in the ATM component to see the other side. - - ! importable field: surface_net_downward_shortwave_flux -! call NUOPC_Realize(importState, gridArb, fieldName="precip", & -! typekind=ESMF_TYPEKIND_R8, selection="realize_connected_remove_others", & -! dataFillScheme="sincos", rc=rc) -! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & -! line=__LINE__, & -! file=__FILE__)) & -! return ! bail out -! - call ESMF_LogWrite("Done realizing fields in OCN import/exportStates", & - ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine SetClock(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - ! local variables - type(ESMF_Clock) :: clock - type(ESMF_TimeInterval) :: stabilityTimeStep - - rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState - call NUOPC_ModelGet(model, modelClock=clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! initialize internal clock - ! here: parent Clock and stability timeStep determine actual model timeStep - !TODO: stabilityTimeStep should be read in from configuation - !TODO: or computed from internal Grid information - call ESMF_TimeIntervalSet(stabilityTimeStep, m=5, rc=rc) ! 5 minute steps - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSetClock(model, clock, stabilityTimeStep, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine ModelAdvance(model, rc) - type(ESMF_GridComp) :: model - integer, intent(out) :: rc - - ! local variables - type(ESMF_Clock) :: clock - type(ESMF_State) :: importState, exportState - type(ESMF_Field) :: field - type(ESMF_Time) :: currTime - type(ESMF_TimeInterval) :: timeStep - integer, save :: slice=1 - character(len=160) :: msgString - - rc = ESMF_SUCCESS - - ! query the Component for its clock, importState and exportState - call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & - exportState=exportState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep - - ! Because of the way that the internal Clock was set in SetClock(), - ! its timeStep is likely smaller than the parent timeStep. As a consequence - ! the time interval covered by a single parent timeStep will result in - ! multiple calls to the ModelAdvance() routine. Every time the currTime - ! will come in by one internal timeStep advanced. This goes until the - ! stopTime of the internal Clock has been reached. - - call ESMF_ClockPrint(clock, options="currTime", & - preString="------>Advancing OCN from: ", unit=msgString, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_TimePrint(currTime + timeStep, & - preString="---------------------> to: ", unit=msgString, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - -! ! - update the export fields -! call ESMF_StateGet(exportState, itemName="sss", field=field, rc=rc) -! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & -! line=__LINE__, & -! file=__FILE__)) & -! return ! bail out -! call ESMF_FieldFill(field, dataFillScheme="sincos", member=1, step=slice, & -! rc=rc) -! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & -! line=__LINE__, & -! file=__FILE__)) & -! return ! bail out - call ESMF_StateGet(exportState, itemName="sst", field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_FieldFill(field, dataFillScheme="sincos", member=2, step=slice, & - rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! write out the Fields in the importState and exportState - call NUOPC_Write(importState, fileNamePrefix="field_ocn_import_", & - timeslice=slice, overwrite=.true., relaxedFlag=.true., rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#ifndef TEST_MULTI_TILE_GRID -! Write() does not currently support fields on multi-tile grids - call NUOPC_Write(exportState, fileNamePrefix="field_ocn_export_", & - timeslice=slice, overwrite=.true., relaxedFlag=.true., rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#endif - slice = slice+1 - - end subroutine - - !----------------------------------------------------------------------------- - -end module diff --git a/GeosCtmProto/CAP.rc b/GeosCtmProto/CAP.rc deleted file mode 100644 index a0234fa5..00000000 --- a/GeosCtmProto/CAP.rc +++ /dev/null @@ -1,36 +0,0 @@ - -MAPLROOT_COMPNAME: GEOSctm - ROOT_NAME: GEOSctm - ROOT_CF: GEOSCTM.rc - HIST_CF: HISTORY.rc - EXTDATA_CF: MAPL_ExtData.rc - -BEG_DATE: 20000414 000000 -END_DATE: 20000415 000000 -JOB_SGMT: 00000015 000000 -NUM_SGMT: 20 -HEARTBEAT_DT: 900 - -USE_SHMEM: 0 - -#PERPETUAL_YEAR: YYYY -#PERPETUAL_MONTH: MM -#PERPETUAL_DAY: DD - -MAPL_ENABLE_TIMERS: NO -MAPL_ENABLE_MEMUTILS: NO -PRINTSPEC: 0 # (0: OFF, 1: IMPORT & EXPORT, 2: IMPORT, 3: EXPORT) - -############################################### -#### GeosCtmProto Top-level RunSequence ##### -############################################### - -# Encoding a simple run sequence -runSeq:: - @900 - ExtData - ExtData -> CTM - CTM - @ -:: - diff --git a/GeosCtmProto/CTM_GridComp.rc b/GeosCtmProto/CTM_GridComp.rc deleted file mode 100644 index 84ae878c..00000000 --- a/GeosCtmProto/CTM_GridComp.rc +++ /dev/null @@ -1,30 +0,0 @@ - -#--------------------------- -# Setting for Passive Tracer -#--------------------------- -ENABLE_pTracers: T - -#----------------------- -# Setting for Convection -#----------------------- -do_ctmConvection: F - convec_opt: 2 - met_opt: 3 - chem_opt: 2 - do_drydep: T - do_wetdep: T - convecType: 1 - # 2: for GMI only (default) - # 1: generic with no scaveging (for GOCART, pTracer, ...) -#---------------------- -# Setting for Diffusion -#---------------------- -do_ctmDiffusion: F - diffu_opt: 1 -vert_diffu_coef: 1.0d0 - -#--------------------------- -# Setting for metFields Type -#--------------------------- -metType: MERRA2 - # MERRA2 (default) or MERRA1 or FPIT diff --git a/GeosCtmProto/GEOSCTM.rc b/GeosCtmProto/GEOSCTM.rc deleted file mode 100644 index 94121a18..00000000 --- a/GeosCtmProto/GEOSCTM.rc +++ /dev/null @@ -1,125 +0,0 @@ - -# Model Resolution and Timestep Parameters -# ---------------------------------------- - NX: 1 - NY: 6 - IM: 48 - JM: 288 - LM: 72 - GRIDNAME: PE48x288-CF -AdvCore_Advection: 1 - DYCORE: OFF - HEARTBEAT_DT: 900 - - GRID_TYPE: Cubed-Sphere - IM_WORLD: 48 - -# Print Resource Parameters (0: Non-Default values, 1: ALL values) -#----------------------------------------------------------------- -PRINTRC: 1 - -# Set the number of parallel I/O processes to use when -# RESTART_TYPE and or CHECKPOINT_TYPE are set to pbinary or pnc4 -#--------------------------------------------------------------- -PARALLEL_READFORCING: 1 -NUM_READERS: 1 -NUM_WRITERS: 1 - -MAPL_ENABLE_BOOTSTRAP: YES - -#GEOSCTM RunSequence -runSeq:: - @900 # 15min time step - DYNAMICS -> CTMenv - PTRACERS -> DYNAMICS - DYNAMICS -> PTRACERS - CTMenv - CTMenv -> DYNAMICS - CTMenv -> PTRACERS - DYNAMICS - PTRACERS - @ -:: - - -# GEOSCTM Model Restart Files -# --------------------------------- - -#PCHEM_INTERNAL_RESTART_FILE: pchem_internal_rst -#PCHEM_INTERNAL_CHECKPOINT_FILE: pchem_internal_checkpoint -#PCHEM_INTERNAL_CHECKPOINT_TYPE: default - - -##GOCART_INTERNAL_RESTART_FILE: gocart_internal_rst -##GOCART_INTERNAL_CHECKPOINT_FILE: gocart_internal_checkpoint -##GOCART_INTERNAL_CHECKPOINT_TYPE: default - -##CARMA_INTERNAL_RESTART_FILE: carma_internal_rst -##CARMA_INTERNAL_CHECKPOINT_FILE: carma_internal_checkpoint -##CARMA_INTERNAL_CHECKPOINT_TYPE: default - -##STRATCHEM_INTERNAL_RESTART_FILE: stratchem_internal_rst -##STRATCHEM_INTERNAL_CHECKPOINT_FILE: stratchem_internal_checkpoint -##STRATCHEM_INTERNAL_CHECKPOINT_TYPE: default - -##GMICHEM_INTERNAL_RESTART_FILE: gmichem_internal_rst -##GMICHEM_INTERNAL_CHECKPOINT_FILE: gmichem_internal_checkpoint -##GMICHEM_INTERNAL_CHECKPOINT_TYPE: default - -##GMICHEM_IMPORT_RESTART_FILE: gmichem_import_rst -##GMICHEM_IMPORT_CHECKPOINT_FILE: gmichem_import_checkpoint -##GMICHEM_IMPORT_CHECKPOINT_TYPE: default - -##MAM_INTERNAL_RESTART_FILE: mam_internal_rst -##MAM_INTERNAL_CHECKPOINT_FILE: mam_internal_checkpoint -##MAM_INTERNAL_CHECKPOINT_TYPE: default - -#TR_INTERNAL_RESTART_FILE: tr_internal_rst -#TR_INTERNAL_CHECKPOINT_FILE: tr_internal_checkpoint -#TR_INTERNAL_CHECKPOINT_TYPE: default - -PTRACERS_INTERNAL_RESTART_FILE: -pTracers_internal_rst -PTRACERS_INTERNAL_CHECKPOINT_FILE: pTracers_internal_checkpoint -PTRACERS_INTERNAL_CHECKPOINT_TYPE: default - - -# AeroChem Environment -# -------------------- - OX_RELAXTIME: 259200. # Standard Options: GCM: 259200., DAS: 0.000 - CH4_RELAXTIME: 259200. - N2O_RELAXTIME: 259200. - CFC11_RELAXTIME: 259200. - CFC12_RELAXTIME: 259200. - HCFC22_RELAXTIME: 259200. - H2O_RELAXTIME: 259200. - OX_FRIENDLIES: ANALYSIS:DYNAMICS:TURBULENCE:MOIST - CH4_FRIENDLIES: DYNAMICS:TURBULENCE:MOIST - N2O_FRIENDLIES: DYNAMICS:TURBULENCE:MOIST - CFC11_FRIENDLIES: DYNAMICS:TURBULENCE:MOIST - CFC12_FRIENDLIES: DYNAMICS:TURBULENCE:MOIST - H2O_FRIENDLIES: DYNAMICS:TURBULENCE:MOIST -HCFC22_FRIENDLIES: DYNAMICS:TURBULENCE:MOIST - pchem_clim: species.data - pchem_clim_years: 228 - -# Age-of-Air Parameters -# --------------------- -#AOA_FRIENDLIES: DYNAMICS:TURBULENCE:MOIST - - -# GOCART broadband aerosol optics tables -# ----------------------------------------------------- -DU_OPTICS: ExtData/g5chem/x/opticsBands_DU.v15_3.nc -SS_OPTICS: ExtData/g5chem/x/opticsBands_SS.v3_3.nc -SU_OPTICS: ExtData/g5chem/x/opticsBands_SU.v1_3.nc -OC_OPTICS: ExtData/g5chem/x/opticsBands_OC.v1_3.nc -BC_OPTICS: ExtData/g5chem/x/opticsBands_BC.v1_3.nc -NI_OPTICS: ExtData/g5chem/x/opticsBands_NI.v2_5.nc -NUM_BANDS: 18 - -DIURNAL_BIOMASS_BURNING: yes - - RATS_PROVIDER: # options: PCHEM, GMICHEM, STRATCHEM (Radiatively active tracers) - AERO_PROVIDER: # options: GOCART.data, GOCART, MAM (Radiatively active aerosols) -ANALYSIS_OX_PROVIDER: # options: PCHEM, GMICHEM, STRATCHEM, GOCART - diff --git a/GeosCtmProto/KNOWNPROBLEMS b/GeosCtmProto/KNOWNPROBLEMS deleted file mode 100644 index a6781bd5..00000000 --- a/GeosCtmProto/KNOWNPROBLEMS +++ /dev/null @@ -1,32 +0,0 @@ -1. The new grid factory code requires the following attributes in CTM's config -object: GRID_TYPE and IM_WORLD. These two values can be derived from the -GRIDNAME attribute (PE48x288-CF). But, ESMF Config library does not support -adding a non-integer attribute such as "GRID_TYPE". Also, -ESMF_ConfigSetAttribute somehow doesn't work properly when adding IM_WORLD. -So, I added GRID_TYPE and IM_WORLD into GEOSCTM.rc - -2. In fvcore_layout.rc (the config file for AdvCore component), there are -attributes npx and npy. In the earlier version of GEOSctm_lite, the values -are both 48, but the new code expected npy to be 6*npx. So I changed it to -288. - -3. Extdata export fields are mirrored from the import fields of CTM. But, the -attributes of the fields are not copied when the fields are mirrored. What it -is looking for includes: PRECISION, STAGGERING, ROTATION - -4. Extdata needs to know the value of NX and NY from its config. But, NX and -NY are defined in GEOSCTM.rc, which is the ROOT_CF defined in CAP.rc. I -currently set the config for the Extdata component to be CAP.rc. - -5. The Makefile has to be changed to link with MAPL libraries in the -GEOSctm_lite directory. The changes are: - -MAPL_INSTALL_ROOT = /gpfsm/dnb31/pli/GEOSctm_lite/Linux -MAPL_INCDIR = $(MAPL_INSTALL_ROOT)/include -MAPL_INCLUDEPATHS = -I$(MAPL_INCDIR)/MAPL_cfio_r4 -I$(MAPL_INCDIR)/MAPL_Base -I$(MAPL_INCDIR)/FVdycoreCubed_GridComp -I$(MAPL_INCDIR)/fvdycore -I$(MAPL_INCDIR)/GFDL_fms -I$(NEWBASEDIR)/include/esmf -MAPL_LINKPATHS = -L$(MAPL_INSTALL_ROOT)/lib -MAPL_LINKLIBS = -lMAPL_Base -lMAPL_cfio_r4 -lFVdycoreCubed_GridComp -lfvdycore -lGEOS_Shared -lGMAO_mpeu -lGFDL_fms - -Also $(MAPL_LINKLIBS) has to come before $(ESMF_F90ESMFLINKLIBS) in the -linking process - diff --git a/GeosCtmProto/MAPL_ExtData.rc b/GeosCtmProto/MAPL_ExtData.rc deleted file mode 100755 index 9971dde3..00000000 --- a/GeosCtmProto/MAPL_ExtData.rc +++ /dev/null @@ -1,123 +0,0 @@ -PrimaryExports%% -# ---------|-------------|-------|--------|----------------------|--------|--------|-------------|----------| -# Import | | | Regrid | Refresh | OffSet | Scale | Variable On | File | -# Name | Units | Clim | Method | Time Template | Factor | Factor | File | Template | -# ---------|-------------|-------|--------|----------------------|--------|--------|-------------|----------| -# -#------------ -# Climatilogy -#------------ -FRLAND '1' Y N 0 0.0 1.0 FRLAND /discover/nobackup/projects/gmi/gmidata2/input/metfields/rawMERRA2/MERRA2_400.const_2d_asm_Nx.climatology.nc4 -FRLAKE '1' Y N 0 0.0 1.0 FRLAKE /discover/nobackup/projects/gmi/gmidata2/input/metfields/rawMERRA2/MERRA2_400.const_2d_asm_Nx.climatology.nc4 -FRLANDICE '1' Y N 0 0.0 1.0 FRLANDICE /discover/nobackup/projects/gmi/gmidata2/input/metfields/rawMERRA2/MERRA2_400.const_2d_asm_Nx.climatology.nc4 -FROCEAN '1' Y N 0 0.0 1.0 FROCEAN /discover/nobackup/projects/gmi/gmidata2/input/metfields/rawMERRA2/MERRA2_400.const_2d_asm_Nx.climatology.nc4 - -#------------- -# 2D Variables -#------------- -FRACI '1' N N 0 0.0 1.0 FRSEAICE /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg1_2d_flx_Nx.%y4%m2%d2.nc4 -ZPBL 'm' N N 0 0.0 1.0 PBLH /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg1_2d_flx_Nx.%y4%m2%d2.nc4 -CN_PRCP 'kg m-2 s-1' N N 0 0.0 1.0 PRECCON /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg1_2d_flx_Nx.%y4%m2%d2.nc4 -TPREC 'kg m-2 s-1' N N 0 0.0 1.0 PRECTOT /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg1_2d_flx_Nx.%y4%m2%d2.nc4 -USTAR 'm s-1' N N 0 0.0 1.0 USTAR /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg1_2d_flx_Nx.%y4%m2%d2.nc4 -Z0H 'm' N N 0 0.0 1.0 Z0H /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg1_2d_flx_Nx.%y4%m2%d2.nc4 -DZ 'm' N N 0 0.0 1.0 HLML /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg1_2d_flx_Nx.%y4%m2%d2.nc4 -SH 'W m-2' N N 0 0.0 1.0 HFLUX /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg1_2d_flx_Nx.%y4%m2%d2.nc4 -LWI '1' N N 0 0.0 1.0 LWI /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg1_2d_chm_Nx.%y4%m2%d2.nc4 - -SNOMAS 'kg m-2' N N 0 0.0 1.0 SNOMAS /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg1_2d_lnd_Nx.%y4%m2%d2.nc4 -SNOWDP 'kg m-2' N N 0 0.0 1.0 SNODP /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg1_2d_lnd_Nx.%y4%m2%d2.nc4 - -ALBVF '1' N N 0 0.0 1.0 ALBVISDF /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg1_2d_rad_Nx.%y4%m2%d2.nc4 -SWNDSRF 'W m-2' N N 0 0.0 1.0 SWGNT /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg1_2d_rad_Nx.%y4%m2%d2.nc4 -CLDTT '1' N N 0 0.0 1.0 CLDTOT /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg1_2d_rad_Nx.%y4%m2%d2.nc4 -DFPAR 'W m-2' N N 0 0.0 1.0 PARDFLAND /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg1_2d_lnd_Nx.%y4%m2%d2.nc4 -DRPAR 'W m-2' N N 0 0.0 1.0 PARDRLAND /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg1_2d_lnd_Nx.%y4%m2%d2.nc4 -GRN '1' N N 0 0.0 1.0 GRN /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg1_2d_lnd_Nx.%y4%m2%d2.nc4 -LAI '1' N N 0 0.0 1.0 LAI /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg1_2d_lnd_Nx.%y4%m2%d2.nc4 -TSOIL1 'K' N N 0 0.0 1.0 TSOIL1 /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg1_2d_lnd_Nx.%y4%m2%d2.nc4 -ASNOW '1' N N 0 0.0 1.0 FRSNO /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg1_2d_lnd_Nx.%y4%m2%d2.nc4 -WET1 '1' N N 0 0.0 1.0 GWETTOP /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg1_2d_lnd_Nx.%y4%m2%d2.nc4 -WET2 '1' N N 0 0.0 1.0 GWETROOT /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg1_2d_lnd_Nx.%y4%m2%d2.nc4 -RHOA '1' N N 0 0.0 1.0 RHOA /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg1_2d_flx_Nx.%y4%m2%d2.nc4 -CM '1' N N 0 0.0 1.0 CDM /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg1_2d_flx_Nx.%y4%m2%d2.nc4 -CN '1' N N 0 0.0 1.0 CN /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg1_2d_flx_Nx.%y4%m2%d2.nc4 -TA 'K' N N 0 0.0 1.0 TLML /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg1_2d_flx_Nx.%y4%m2%d2.nc4 -PS 'Pa' N N 0 0.0 1.0 PS /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg1_2d_slv_Nx.%y4%m2%d2.nc4 -SLP 'Pa' N N 0 0.0 1.0 SLP /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg1_2d_slv_Nx.%y4%m2%d2.nc4 -TROPP 'Pa' N N 0 0.0 1.0 TROPPB /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg1_2d_slv_Nx.%y4%m2%d2.nc4 -U10M 'm s-1' N N 0 0.0 1.0 U10M /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg1_2d_slv_Nx.%y4%m2%d2.nc4 -V10M 'm s-1' N N 0 0.0 1.0 V10M /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg1_2d_slv_Nx.%y4%m2%d2.nc4 -U2M 'm s-1' N N 0 0.0 1.0 U2M /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg1_2d_slv_Nx.%y4%m2%d2.nc4 -V2M 'm s-1' N N 0 0.0 1.0 V2M /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg1_2d_slv_Nx.%y4%m2%d2.nc4 -U10N 'm s-1' N N 0 0.0 1.0 U10M /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg1_2d_slv_Nx.%y4%m2%d2.nc4 -V10N 'm s-1' N N 0 0.0 1.0 V10M /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg1_2d_slv_Nx.%y4%m2%d2.nc4 -TS 'K' N N 0 0.0 1.0 TS /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg1_2d_slv_Nx.%y4%m2%d2.nc4 -T2M 'K' N N 0 0.0 1.0 T2M /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg1_2d_slv_Nx.%y4%m2%d2.nc4 -PHIS 'm+2 s-2' N N 0 0.0 1.0 PHIS /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.inst3_3d_asm_Nv.%y4%m2%d2.nc4 - -#--------------------- -# 3D variables at edge -#--------------------- -PLE 'Pa' N N 0 0.0 1.0 PLE /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg3_3d_nav_Ne.%y4%m2%d2.nc4 -ZLE 'm' N N 0 0.0 1.0 ZLE /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg3_3d_nav_Ne.%y4%m2%d2.nc4 -KH 'm+2 s-1' N N 0 0.0 1.0 KH /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg3_3d_trb_Ne.%y4%m2%d2.nc4 -CNV_MFC 'kg m-2 s-1' N N 0 0.0 1.0 CMFMC /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg3_3d_mst_Ne.%y4%m2%d2.nc4 -PFI_CN 'kg m-2 s-1' N N 0 0.0 1.0 PFICU /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg3_3d_mst_Ne.%y4%m2%d2.nc4 -PFL_CN 'kg m-2 s-1' N N 0 0.0 1.0 PFLCU /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg3_3d_mst_Ne.%y4%m2%d2.nc4 -PFI_LSAN 'kg m-2 s-1' N N 0 0.0 1.0 PFILSAN /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg3_3d_mst_Ne.%y4%m2%d2.nc4 -PFL_LSAN 'kg m-2 s-1' N N 0 0.0 1.0 PFLLSAN /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg3_3d_mst_Ne.%y4%m2%d2.nc4 -PFICU 'kg m-2 s-1' N N 0 0.0 1.0 PFICU /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg3_3d_mst_Ne.%y4%m2%d2.nc4 -PFILSAN 'kg m-2 s-1' N N 0 0.0 1.0 PFILSAN /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg3_3d_mst_Ne.%y4%m2%d2.nc4 - -#----------------------- -# 3D variables at center -#----------------------- -T 'K' N N 0 0.0 1.0 T /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.inst3_3d_asm_Nv.%y4%m2%d2.nc4 -RH2 '1' N N 0 0.0 1.0 RH /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.inst3_3d_asm_Nv.%y4%m2%d2.nc4 -Q 'kg kg-1' N N 0 0.0 1.0 QV /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.inst3_3d_asm_Nv.%y4%m2%d2.nc4 -QL 'kg kg-1' N N 0 0.0 1.0 QL /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.inst3_3d_asm_Nv.%y4%m2%d2.nc4 -QI 'kg kg-1' N N 0 0.0 1.0 QI /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.inst3_3d_asm_Nv.%y4%m2%d2.nc4 -QLTOT 'kg kg-1' N N 0 0.0 1.0 QL /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.inst3_3d_asm_Nv.%y4%m2%d2.nc4 -QITOT 'kg kg-1' N N 0 0.0 1.0 QI /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.inst3_3d_asm_Nv.%y4%m2%d2.nc4 -FCLD '1' N N 0 0.0 1.0 CLOUD /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.inst3_3d_asm_Nv.%y4%m2%d2.nc4 -CNV_MFD 'kg m-2 s-1' N N 0 0.0 1.0 DTRAIN /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg3_3d_cld_Nv.%y4%m2%d2.nc4 -TAUCLW '1' N N 0 0.0 1.0 TAUCLW /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg3_3d_cld_Nv.%y4%m2%d2.nc4 -TAUCLI '1' N N 0 0.0 1.0 TAUCLI /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg3_3d_cld_Nv.%y4%m2%d2.nc4 -DQDT 'kg/kg/s' N N 0 0.0 1.0 DQRCU /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg3_3d_mst_Nv.%y4%m2%d2.nc4 -DQRL 'kg/kg/s' N N 0 0.0 1.0 DQRLSAN /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg3_3d_mst_Nv.%y4%m2%d2.nc4 -DQRC 'kg/kg/s' N N 0 0.0 1.0 DQRCU /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg3_3d_mst_Nv.%y4%m2%d2.nc4 -DQIDT 'kg/kg/s' N N 0 0.0 1.0 DQIDTMST /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg3_3d_mst_Nv.%y4%m2%d2.nc4 -DQLDT 'kg/kg/s' N N 0 0.0 1.0 DQLDTMST /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg3_3d_mst_Nv.%y4%m2%d2.nc4 -REV_CN 'kg/kg/s' N N 0 0.0 1.0 REEVAPCN /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.tavg3_3d_mst_Nv.%y4%m2%d2.nc4 - -QLTOT1 'kg kg-1' N N 0;-3000 0.0 1.0 QL /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.inst3_3d_asm_Nv.%y4%m2%d2.nc4 -QITOT1 'kg kg-1' N N 0;-3000 0.0 1.0 QI /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.inst3_3d_asm_Nv.%y4%m2%d2.nc4 -U 'm s-1' N N 0 0.0 1.0 U /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.inst3_3d_asm_Nv.%y4%m2%d2.nc4 -V 'm s-1' N N 0 0.0 1.0 V /discover/nobackup/projects/gmao/merra2/data/products/d5124_m2_jan00/Y%y4/M%m2/MERRA2_300.inst3_3d_asm_Nv.%y4%m2%d2.nc4 - -#---------------- -#AdvCore Specific -#---------------- -pressure_at_layer_edges_before_advection 'Pa' N N 0 0.0 1.0 PLE /discover/nobackup/jkouatch/TICKETS/forPeggy/MERRA2_300.tavg3_3d_nav_Ne.%y4%m2%d2.nc4 -pressure_at_layer_edges_after_advection 'Pa' N N 0;3000 0.0 1.0 PLE /discover/nobackup/jkouatch/TICKETS/forPeggy/MERRA2_300.tavg3_3d_nav_Ne.%y4%m2%d2.nc4 -eastward_wind_on_C-Grid_before_advection;northward_wind_on_C-Grid_before_advection 'm s-1' N N 0 0.0 1.0 U;V /discover/nobackup/jkouatch/TICKETS/forPeggy/MERRA2_300.inst3_3d_asm_Nv.%y4%m2%d2.nc4 -eastward_wind_on_C-Grid_after_advection;northward_wind_on_C-Grid_after_advection 'm s-1' N N 0;3000 0.0 1.0 U;V /discover/nobackup/jkouatch/TICKETS/forPeggy/MERRA2_300.inst3_3d_asm_Nv.%y4%m2%d2.nc4 -%% - -Masks%% -# ---------|------------------------------------------------------| -# Name | Template File Name | -# ---------|------------------------------------------------------| -# | | -# ---------|------------------------------------------------------| -%% - -DerivedExports%% -# ---------|---------|--------------------------------------------| -# Export | Primary |_________________ Mask _____________________| -# Name | Name | Name | Expression | -# ---------|---------|------------|-------------------------------| -# ---------|---------|------------|-------------------------------| -%% - diff --git a/GeosCtmProto/Makefile b/GeosCtmProto/Makefile deleted file mode 100644 index 05645555..00000000 --- a/GeosCtmProto/Makefile +++ /dev/null @@ -1,86 +0,0 @@ -# GNU Makefile template for user ESMF application - -################################################################################ -################################################################################ -## This Makefile must be able to find the "esmf.mk" Makefile fragment in the ## -## 'include' line below. Following the ESMF User's Guide, a complete ESMF ## -## installation should ensure that a single environment variable "ESMFMKFILE" ## -## is made available on the system. This variable should point to the ## -## "esmf.mk" file. ## -## ## -## This example Makefile uses the "ESMFMKFILE" environment variable. ## -## ## -## If you notice that this Makefile cannot find variable ESMFMKFILE then ## -## please contact the person responsible for the ESMF installation on your ## -## system. ## -## As a work-around you can simply hardcode the path to "esmf.mk" in the ## -## include line below. However, doing so will render this Makefile a lot less ## -## flexible and non-portable. ## -################################################################################ - -NEWBASEDIR = $(BASEDIR)/Linux -ESMFMKFILE = $(NEWBASEDIR)/lib/esmf.mk - -include $(ESMFMKFILE) -# add MAPL includes and libs -MAPL_INSTALL_ROOT = $(ESMADIR)/Linux -MAPL_INCDIR = $(MAPL_INSTALL_ROOT)/include -MAPL_INCLUDEPATHS = -I$(MAPL_INCDIR)/MAPL_cfio_r4 -I$(MAPL_INCDIR)/MAPL_Base -I$(MAPL_INCDIR)/FVdycoreCubed_GridComp -I$(MAPL_INCDIR)/fvdycore -I$(MAPL_INCDIR)/GFDL_fms -I$(MAPL_INCDIR)/GMAO_hermes -I$(NEWBASEDIR)/include/esmf -MAPL_LINKPATHS = -L$(MAPL_INSTALL_ROOT)/lib -MAPL_LINKLIBS = -lMAPL_Base -lMAPL_cfio_r4 -lFVdycoreCubed_GridComp -lfvdycore -lGEOS_Shared -lGMAO_mpeu -lGFDL_fms -lGMAO_hermes - -ESMF_F90COMPILEPATHS += $(MAPL_INCLUDEPATHS) $(SUBDIR) -ESMF_F90LINKPATHS += $(MAPL_LINKPATHS) -#ESMF_F90ESMFLINKLIBS += $(MAPL_LINKLIBS) - -################################################################################ -################################################################################ - - -.SUFFIXES: .f90 .F90 .c .C - -%.o : %.f90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREENOCPP) $< - -%.o : %.F90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $< - -%.o : %.c - $(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< - -%.o : %.C - $(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< - - -# ----------------------------------------------------------------------------- -#ctmApp: ctmApp.o driver.o ctm.o history.o extdata.o ectm.o ptracer.o advcore.o NUOPC_Generic.o - -ctmApp: ctmApp.o driver.o extdata.o ctm.o ectm.o ptracer.o advcore.o NUOPC_Generic.o - $(ESMF_F90LINKER) $(ESMF_F90LINKOPTS) $(ESMF_F90LINKPATHS) $(ESMF_F90LINKRPATHS) -o $@ $^ $(MAPL_LINKLIBS) $(ESMF_F90ESMFLINKLIBS) - -# module dependencies: -ctmApp.o: driver.o -#driver.o: ctm.o history.o extdata.o -driver.o: ctm.o extdata.o -#ctm.o: ectm.o ptracer.o advcore.o -ctm.o: ectm.o ptracer.o advcore.o -ectm.o: NUOPC_Generic.o -ptracer.o: NUOPC_Generic.o -advcore.o: NUOPC_Generic.o - -# ----------------------------------------------------------------------------- -# ----------------------------------------------------------------------------- -.PHONY: dust clean distclean info edit -dust: - rm -f PET*.ESMF_LogFile *.nc *.stdout -clean: - rm -f ctmApp *.o *.mod -distclean: dust clean - -info: - @echo ================================================================== - @echo ESMFMKFILE=$(ESMFMKFILE) - @echo ================================================================== - @cat $(ESMFMKFILE) - @echo ================================================================== - diff --git a/GeosCtmProto/NUOPC_Generic.F90 b/GeosCtmProto/NUOPC_Generic.F90 deleted file mode 100644 index 8ed614f0..00000000 --- a/GeosCtmProto/NUOPC_Generic.F90 +++ /dev/null @@ -1,943 +0,0 @@ -#include "MAPL_Generic.h" -!------------------------------------------------------------------------- -!BOP -! -! !MODULE: NUOPC_Generic -- Mimicking some MAPL subroutines handling MAPL_VarSpec -! -! !INTERFACE: -! -module NUOPC_Generic - - use ESMF - use MAPL_mod - use NUOPC - implicit none - -! !PUBLIC TYPES: - public my_States - public mystates_WRAP - -! !PUBLIC MEMBER FUNCTIONS: - - public NUOPC_AddImportSpec - public NUOPC_AddExportSpec - public NUOPC_AddInternalSpec - public NUOPC_FieldCreateFromSpec - public AppGridCreateF - - type my_States - type (MAPL_VarSpec), pointer :: ImportSpec(:) => null() - type (MAPL_VarSpec), pointer :: ExportSpec(:) => null() - type (MAPL_VarSpec), pointer :: InternalSpec(:) => null() - end type my_States - - type mystates_WRAP - type (my_States), pointer :: PTR - end type mystates_WRAP - -contains - - !BOPI - ! !IROUTINE: NUOPC_AddImportSpec --- Sets the specifications for an item in the {\tt IMPORT} state. - - !INTERFACE: - subroutine NUOPC_AddImportSpec(GC, SHORT_NAME, LONG_NAME, & - UNITS, Dims, VLocation, & - DATATYPE,NUM_SUBTILES, REFRESH_INTERVAL, & - AVERAGING_INTERVAL, HALOWIDTH, PRECISION, DEFAULT, & - RESTART, UNGRIDDED_DIMS, FIELD_TYPE, & - STAGGERING, ROTATION, RC) - - !ARGUMENTS: - type (ESMF_GridComp) , intent(INOUT) :: GC - character (len=*) , intent(IN) :: SHORT_NAME - character (len=*) , optional , intent(IN) :: LONG_NAME - character (len=*) , optional , intent(IN) :: UNITS - integer , optional , intent(IN) :: DIMS - integer , optional , intent(IN) :: DATATYPE - integer , optional , intent(IN) :: NUM_SUBTILES - integer , optional , intent(IN) :: VLOCATION - integer , optional , intent(IN) :: REFRESH_INTERVAL - integer , optional , intent(IN) :: AVERAGING_INTERVAL - integer , optional , intent(IN) :: HALOWIDTH - integer , optional , intent(IN) :: PRECISION - real , optional , intent(IN) :: DEFAULT - integer , optional , intent(IN) :: RESTART - integer , optional , intent(IN) :: UNGRIDDED_DIMS(:) - integer , optional , intent(IN) :: FIELD_TYPE - integer , optional , intent(IN) :: STAGGERING - integer , optional , intent(IN) :: ROTATION - integer , optional , intent(OUT) :: RC - !EOPI - - type (mystates_WRAP) :: mystate - type (MAPL_VarSpec) , pointer :: STATE(:) - - RC = ESMF_SUCCESS - - call ESMF_UserCompGetInternalState(GC, 'MAPL_VarSpec', mystate, rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - STATE => mystate%ptr%importSpec - - call NUOPC_AddVarSpec(GC, STATE, SHORT_NAME, & - LONG_NAME=LONG_NAME, & - UNITS=UNITS, & - DIMS=Dims, VLOCATION=VLocation, & - DATATYPE=DATATYPE, & - NUM_SUBTILES=NUM_SUBTILES, & - REFRESH_INTERVAL=REFRESH_INTERVAL, & - AVERAGING_INTERVAL=AVERAGING_INTERVAL, & - HALOWIDTH=HALOWIDTH, & - PRECISION=PRECISION, & - DEFAULT=DEFAULT, & - RESTART=RESTART, & - UNGRIDDED_DIMS=UNGRIDDED_DIMS, & - FIELD_TYPE=FIELD_TYPE, & - STAGGERING=STAGGERING, & - ROTATION=ROTATION, RC=RC) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - mystate%ptr%importSpec => STATE - - return - end subroutine NUOPC_AddImportSpec - - !BOPI - ! !IROUTINE: NUOPC_AddExportSpec --- Sets the specifications for an item in the {\tt IMPORT} state. - - !INTERFACE: - subroutine NUOPC_AddExportSpec(GC, SHORT_NAME, LONG_NAME, & - UNITS, Dims, VLocation, & - DATATYPE,NUM_SUBTILES, REFRESH_INTERVAL, & - AVERAGING_INTERVAL, HALOWIDTH, PRECISION, DEFAULT, & - RESTART, UNGRIDDED_DIMS, FIELD_TYPE, & - STAGGERING, ROTATION, RC) - - !ARGUMENTS: - type (ESMF_GridComp) , intent(INOUT) :: GC - character (len=*) , intent(IN) :: SHORT_NAME - character (len=*) , optional , intent(IN) :: LONG_NAME - character (len=*) , optional , intent(IN) :: UNITS - integer , optional , intent(IN) :: DIMS - integer , optional , intent(IN) :: DATATYPE - integer , optional , intent(IN) :: NUM_SUBTILES - integer , optional , intent(IN) :: VLOCATION - integer , optional , intent(IN) :: REFRESH_INTERVAL - integer , optional , intent(IN) :: AVERAGING_INTERVAL - integer , optional , intent(IN) :: HALOWIDTH - integer , optional , intent(IN) :: PRECISION - real , optional , intent(IN) :: DEFAULT - integer , optional , intent(IN) :: RESTART - integer , optional , intent(IN) :: UNGRIDDED_DIMS(:) - integer , optional , intent(IN) :: FIELD_TYPE - integer , optional , intent(IN) :: STAGGERING - integer , optional , intent(IN) :: ROTATION - integer , optional , intent(OUT) :: RC - !EOPI - - type (mystates_WRAP) :: mystate - type (MAPL_VarSpec) , pointer :: STATE(:) - - RC = ESMF_SUCCESS - - call ESMF_UserCompGetInternalState(GC, 'MAPL_VarSpec', mystate, rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - STATE => mystate%ptr%exportSpec - - call NUOPC_AddVarSpec(GC, STATE, SHORT_NAME, & - LONG_NAME=LONG_NAME, & - UNITS=UNITS, & - DIMS=Dims, VLOCATION=VLocation, & - DATATYPE=DATATYPE, & - NUM_SUBTILES=NUM_SUBTILES, & - REFRESH_INTERVAL=REFRESH_INTERVAL, & - AVERAGING_INTERVAL=AVERAGING_INTERVAL, & - HALOWIDTH=HALOWIDTH, & - PRECISION=PRECISION, & - DEFAULT=DEFAULT, & - RESTART=RESTART, & - UNGRIDDED_DIMS=UNGRIDDED_DIMS, & - FIELD_TYPE=FIELD_TYPE, & - STAGGERING=STAGGERING, & - ROTATION=ROTATION, RC=RC) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - mystate%ptr%exportSpec => STATE - - return - end subroutine NUOPC_AddExportSpec - -!BOPI -! !IROUTINE: MAPL_AddInternalSpec -! !IIROUTINE: MAPL_AddInternalSpec --- Sets specifications for an item in the \texttt{INTERNAL} state - -! !INTERFACE: - subroutine NUOPC_AddInternalSpec(GC, & - SHORT_NAME, & - LONG_NAME, & - UNITS, & - DIMS, & - VLOCATION, & - DATATYPE, & - NUM_SUBTILES, & - REFRESH_INTERVAL, & - AVERAGING_INTERVAL, & - DEFAULT, & - RESTART, & - HALOWIDTH, & - PRECISION, & - FRIENDLYTO, & - ADD2EXPORT, & - ATTR_RNAMES, & - ATTR_INAMES, & - ATTR_RVALUES, & - ATTR_IVALUES, & - UNGRIDDED_DIMS, & - FIELD_TYPE, & - STAGGERING, & - ROTATION, & - RC) - -! !ARGUMENTS: - - type (ESMF_GridComp) , intent(INOUT) :: GC - character (len=*) , intent(IN) :: SHORT_NAME - character (len=*) , optional , intent(IN) :: LONG_NAME - character (len=*) , optional , intent(IN) :: UNITS - integer , optional , intent(IN) :: DIMS - integer , optional , intent(IN) :: DATATYPE - integer , optional , intent(IN) :: VLOCATION - integer , optional , intent(IN) :: NUM_SUBTILES - integer , optional , intent(IN) :: REFRESH_INTERVAL - integer , optional , intent(IN) :: AVERAGING_INTERVAL - integer , optional , intent(IN) :: PRECISION - real , optional , intent(IN) :: DEFAULT - integer , optional , intent(IN) :: RESTART - character (len=*) , optional , intent(IN) :: HALOWIDTH - character (len=*) , optional , intent(IN) :: FRIENDLYTO - logical , optional , intent(IN) :: ADD2EXPORT - character (len=*) , optional , intent(IN) :: ATTR_INAMES(:) - character (len=*) , optional , intent(IN) :: ATTR_RNAMES(:) - integer , optional , intent(IN) :: ATTR_IVALUES(:) - real , optional , intent(IN) :: ATTR_RVALUES(:) - integer , optional , intent(IN) :: UNGRIDDED_DIMS(:) - integer , optional , intent(IN) :: FIELD_TYPE - integer , optional , intent(IN) :: STAGGERING - integer , optional , intent(IN) :: ROTATION - integer , optional , intent(OUT) :: RC - -! !DESCRIPTION: - -! Sets the specifications for an item in the {\tt INTERNAL} state. - -!EOPI - - character(len=ESMF_MAXSTR), parameter :: IAm="MAPL_AddInternalSpec" - integer :: STATUS - integer :: usable_RS - integer :: usable_HW - integer :: I - type (MAPL_VarSpec), pointer :: SPEC - integer :: default_dt - integer :: interval - real :: dt - type (mystates_WRAP) :: mystate - type (MAPL_VarSpec) , pointer :: STATE(:) - - if (present(RC)) RC = ESMF_SUCCESS - - call ESMF_UserCompGetInternalState(GC, 'MAPL_VarSpec', mystate, rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - STATE => mystate%ptr%internalSpec - - if (present(HALOWIDTH)) then - read(HALOWIDTH,'(I1)') usable_HW - else - usable_HW = 0 - endif - - call NUOPC_AddVarSpec(GC, STATE, & - LONG_NAME = LONG_NAME, & - UNITS = UNITS, & - SHORT_NAME = SHORT_NAME, & - DIMS = DIMS, & - DATATYPE = DATATYPE, & - NUM_SUBTILES=NUM_SUBTILES, & - AVERAGING_INTERVAL= AVERAGING_INTERVAL, & - REFRESH_INTERVAL= REFRESH_INTERVAL, & - VLOCATION = VLOCATION, & - DEFAULT = DEFAULT, FRIENDLYTO = FRIENDLYTO, & - HALOWIDTH = usable_HW, PRECISION=PRECISION, & - RESTART = usable_RS, & - ATTR_RNAMES=ATTR_RNAMES, ATTR_INAMES=ATTR_INAMES, & - ATTR_RVALUES=ATTR_RVALUES, ATTR_IVALUES=ATTR_IVALUES, & - UNGRIDDED_DIMS=UNGRIDDED_DIMS, & - FIELD_TYPE = FIELD_TYPE, & - STAGGERING = STAGGERING, & - ROTATION = ROTATION, & - RC=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - -!ALT: the next section is added here upon the request of Arlindo: -! if FRIENDLYTO is set, we automatically -! add the spec/field to the export - - if (present(FRIENDLYTO) .or. present(ADD2EXPORT)) then - - I=MAPL_VarSpecGetIndex(STATE, SHORT_NAME, RC=RC) - if (I == -1) then - RETURN_(ESMF_FAILURE) - endif - - call MAPL_VarSpecAddRefToList(mystate%ptr%exportSpec, STATE(I), RC=RC) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - endif - mystate%ptr%internalSpec => STATE - - RETURN - - end subroutine NUOPC_AddInternalSpec - - subroutine NUOPC_AddVarSpec(GC, STATE, SHORT_NAME, LONG_NAME, & - UNITS, Dims, VLocation, & - DATATYPE,NUM_SUBTILES, REFRESH_INTERVAL, & - AVERAGING_INTERVAL, HALOWIDTH, PRECISION, FRIENDLYTO, & - ATTR_RNAMES, ATTR_INAMES, ATTR_RVALUES, ATTR_IVALUES, & - DEFAULT, RESTART, UNGRIDDED_DIMS, FIELD_TYPE, & - STAGGERING, ROTATION, RC) - - !ARGUMENTS: - type (ESMF_GridComp) , intent(INOUT) :: GC - type (MAPL_VarSpec), pointer , intent(INOUT) :: STATE(:) - character (len=*) , intent(IN) :: SHORT_NAME - character (len=*) , optional , intent(IN) :: LONG_NAME - character (len=*) , optional , intent(IN) :: UNITS - integer , optional , intent(IN) :: DIMS - integer , optional , intent(IN) :: DATATYPE - integer , optional , intent(IN) :: NUM_SUBTILES - integer , optional , intent(IN) :: VLOCATION - integer , optional , intent(IN) :: REFRESH_INTERVAL - integer , optional , intent(IN) :: AVERAGING_INTERVAL - integer , optional , intent(IN) :: HALOWIDTH - integer , optional , intent(IN) :: PRECISION - character (len=*) , optional , intent(IN) :: FRIENDLYTO - real , optional , intent(IN) :: DEFAULT - integer , optional , intent(IN) :: RESTART - character (len=*) , optional , intent(IN) :: ATTR_INAMES(:) - character (len=*) , optional , intent(IN) :: ATTR_RNAMES(:) - integer , optional , intent(IN) :: ATTR_IVALUES(:) - real , optional , intent(IN) :: ATTR_RVALUES(:) - integer , optional , intent(IN) :: UNGRIDDED_DIMS(:) - integer , optional , intent(IN) :: FIELD_TYPE - integer , optional , intent(IN) :: STAGGERING - integer , optional , intent(IN) :: ROTATION - integer , optional , intent(OUT) :: RC - !EOPI - - character(len=ESMF_MAXSTR), parameter :: IAm="NUOPC_AddVarSpec" - integer :: STATUS - integer :: usable_AI - integer :: usable_RI - integer :: usable_RS - integer(ESMF_KIND_I4) :: dt - type (ESMF_Config) :: CF - - ! Get the clock increment interval - call ESMF_AttributeGet( GC, "RUN_DT:", dt, RC=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - - if (present(REFRESH_INTERVAL)) then - usable_RI = REFRESH_INTERVAL - else - usable_RI = dt - endif - - if (present(AVERAGING_INTERVAL)) then - usable_AI = AVERAGING_INTERVAL - else - usable_AI = dt - endif - - if (present(Restart)) then - usable_RS = Restart - else - usable_RS = MAPL_RestartOptional - endif - - if (present(DIMS)) then - ASSERT_(DIMS /= MAPL_DimsNone) - end if - - call MAPL_VarSpecCreateInList(STATE, & - LONG_NAME = LONG_NAME, & - UNITS = UNITS, & - SHORT_NAME = SHORT_NAME, & - DIMS = DIMS, & - STAT = DATATYPE, & - NUM_SUBTILES=NUM_SUBTILES, & - ACCMLT_INTERVAL= usable_AI, & - COUPLE_INTERVAL= usable_RI, & - VLOCATION = VLOCATION, & - HALOWIDTH = HALOWIDTH, & - PRECISION = PRECISION, & - FRIENDLYTO = FRIENDLYTO, & - RESTART = usable_RS, & - DEFAULT = DEFAULT, & - ATTR_RNAMES=ATTR_RNAMES, & - ATTR_INAMES=ATTR_INAMES, & - ATTR_RVALUES=ATTR_RVALUES, & - ATTR_IVALUES=ATTR_IVALUES, & - UNGRIDDED_DIMS = UNGRIDDED_DIMS, & - FIELD_TYPE = FIELD_TYPE, & - STAGGERING = STAGGERING, & - ROTATION = ROTATION, & - RC=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - -! print *, "NUOPC_AddVarSpec ", LONG_NAME - - ! If DATATYPE is MAPL_Bundleitem, we need to do something different:: what?? - ! ignore it for now - !! if (.not. present(DATATYPE) .or. (DATATYPE .ne. MAPL_Bundleitem)) then - if (.not. NUOPC_FieldDictionaryHasEntry(LONG_NAME)) then - call NUOPC_FieldDictionaryAddEntry( & - standardName=LONG_NAME, & - canonicalUnits=UNITS, & - rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -! print *, "NUOPC_AddVarSpec, #585" - endif - !!! endif - - RETURN_(ESMF_SUCCESS) - end subroutine NUOPC_AddVarSpec - - function NUOPC_FieldCreateFromSpec(SPEC,DEFER,RC) - type(MAPL_VarSpec), intent(INOUT) :: SPEC - logical, optional, intent(IN ) :: DEFER - integer, optional, intent( OUT) :: RC - -! Return value - type(ESMF_Field) :: NUOPC_FieldCreateFromSpec - - character(len=ESMF_MAXSTR), parameter :: IAm="NUOPC_FieldCreateFromSpec" - integer :: STATUS - - integer :: COUNTS(ESMF_MAXDIM) - integer :: L - type(ESMF_DistGrid) :: distgrid - type (ESMF_Array) :: Array - type (ESMF_Field) :: FIELD - type (ESMF_FieldBundle) :: BUNDLE - type (ESMF_Field) :: SPEC_FIELD - type (ESMF_FieldBundle) :: SPEC_BUNDLE - real(kind=ESMF_KIND_R4), pointer :: VAR_1D(:), VAR_2D(:,:), VAR_3D(:,:,:) - real(kind=ESMF_KIND_R8), pointer :: VR8_1D(:), VR8_2D(:,:), VR8_3D(:,:,:) - logical :: usableDEFER - logical :: deferAlloc - integer :: RANK - integer :: DIMS - integer :: STAT - integer :: KND = ESMF_KIND_R4 - integer :: LOCATION - character(ESMF_MAXSTR):: SHORT_NAME - character(ESMF_MAXSTR):: LONG_NAME - character(ESMF_MAXSTR):: UNITS - character(ESMF_MAXSTR):: FRIENDLYTO - integer :: REFRESH - integer :: AVGINT - real :: DEFAULT_VALUE - type(ESMF_Grid) :: GRD, GRID - integer :: I - logical :: done - integer :: N, N1, N2, NE - integer :: HW - integer :: RESTART - integer :: maplist(ESMF_MAXDIM) ! mapping between array and grid - character(len=ESMF_MAXSTR), pointer :: ATTR_INAMES(:) - character(len=ESMF_MAXSTR), pointer :: ATTR_RNAMES(:) - integer, pointer :: ATTR_IVALUES(:) - real, pointer :: ATTR_RVALUES(:) - integer, pointer :: UNGRD(:) - integer :: attr - integer :: initStatus - logical :: defaultProvided - integer :: fieldRank - real(kind=ESMF_KIND_R8) :: def_val_8 - type(ESMF_TypeKind_Flag) :: typekind - logical :: has_ungrd - logical :: doNotAllocate=.false. - logical :: alwaysAllocate - integer :: field_type - integer :: staggering - integer :: rotation - type(ESMF_State) :: SPEC_STATE - type(ESMF_State) :: nestSTATE - character(ESMF_MAXSTR) :: ungridded_unit - character(ESMF_MAXSTR) :: ungridded_name - real, pointer :: ungridded_coords(:) - integer :: szUngrd - integer :: rstReq - -#define DEBUGPRINT__OFF -#ifdef DEBUGPRINT - integer :: fieldDimCount, gridDimCount, arbDimCount - integer, allocatable :: ungriddedLBound(:), ungriddedUBound(:) -#endif - - if (present(DEFER)) then - usableDEFER = DEFER - else - usableDEFER = .false. - end if - - attr = 0 - rstReq = 0 - - call MAPL_VarSpecGet(SPEC,DIMS=DIMS,VLOCATION=LOCATION, & - SHORT_NAME=SHORT_NAME, LONG_NAME=LONG_NAME, UNITS=UNITS,& - FIELD=SPEC_FIELD, & - BUNDLE=SPEC_BUNDLE, & - STATE=SPEC_STATE, & - STAT=STAT, DEFAULT = DEFAULT_VALUE, & - defaultProvided = defaultProvided, & - FRIENDLYTO=FRIENDLYTO, & - COUPLE_INTERVAL=REFRESH, & - ACCMLT_INTERVAL=AVGINT, & - HALOWIDTH=HW, & - RESTART=RESTART, & - PRECISION=KND, & - ATTR_RNAMES=ATTR_RNAMES, & - ATTR_INAMES=ATTR_INAMES, & - ATTR_RVALUES=ATTR_RVALUES, & - ATTR_IVALUES=ATTR_IVALUES, & - UNGRIDDED_DIMS=UNGRD, & - UNGRIDDED_UNIT=UNGRIDDED_UNIT, & - UNGRIDDED_NAME=UNGRIDDED_NAME, & - UNGRIDDED_COORDS=UNGRIDDED_COORDS, & - GRID=GRID, & - doNotAllocate=doNotAllocate, & - alwaysAllocate=alwaysAllocate, & - FIELD_TYPE=FIELD_TYPE, & - STAGGERING=STAGGERING, & - ROTATION=ROTATION, & - RC=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - if (RESTART == MAPL_RestartRequired) then - rstReq = 1 - end if - - if (DIMS == MAPL_DimsTileOnly .OR. DIMS == MAPL_DimsTileTile) then - ATTR = IOR(ATTR, MAPL_AttrTile) - else - ATTR = IOR(ATTR, MAPL_AttrGrid) - end if - - deferAlloc = usableDefer - if (usableDefer) deferAlloc = .not. alwaysAllocate - -! Create the appropriate ESMF FIELD -! --------------------------------- - - field = MAPL_FieldCreateEmpty(name=SHORT_NAME, grid=grid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - - has_ungrd = associated(UNGRD) - - if (.not. deferAlloc) then - -!ALT we check if doNotAllocate is set only for fields that are not deferred - if (.not. doNotAllocate) then - if (has_ungrd) then - - if (defaultProvided) then - call MAPL_FieldAllocCommit(field, dims=dims, location=location, typekind=knd, & - hw=hw, ungrid=ungrd, default_value=default_value, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - else - call MAPL_FieldAllocCommit(field, dims=dims, location=location, typekind=knd, & - hw=hw, ungrid=ungrd, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - endif - else - - if (defaultProvided) then - call MAPL_FieldAllocCommit(field, dims=dims, location=location, typekind=knd, & - hw=hw, default_value=default_value, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - else - call MAPL_FieldAllocCommit(field, dims=dims, location=location, typekind=knd, & - hw=hw, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end if - end if !has_ungrd - call ESMF_AttributeSet(FIELD, NAME='PRECISION', VALUE=KND, RC=RC) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - else !doNotAllocate - call ESMF_AttributeSet(FIELD, NAME='doNotAllocate', VALUE=1, RC=RC) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end if - else ! deferAlloc - call ESMF_AttributeSet(FIELD, NAME='PRECISION', VALUE=KND, RC=RC) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_AttributeSet(FIELD, NAME='HAS_UNGRIDDED_DIMS', & - value=has_ungrd, RC=RC) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_AttributeSet(FIELD, NAME='DEFAULT_PROVIDED', & - value=defaultProvided, RC=RC) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - if (defaultProvided) then - call ESMF_AttributeSet(FIELD, NAME='DEFAULT_VALUE', & - value=default_value, RC=RC) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - end if - if (has_ungrd) then - call ESMF_AttributeSet(FIELD, NAME='UNGRIDDED_DIMS', valueList=UNGRD, RC=RC) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - end if - - end if - -! Put the FIELD in the MAPL FIELD (VAR SPEC) -! -------------------------------- - - call MAPL_VarSpecSet(SPEC,FIELD=FIELD,RC=RC) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - -! and in the FIELD in the state -! -------------------------- - - if (deferAlloc) then - initStatus = MAPL_Uninitialized - else - if (defaultProvided) initStatus = MAPL_InitialDefault - end if - -! Add SPECs to the FIELD - - call ESMF_AttributeSet(FIELD, NAME='STAT', VALUE=STAT, RC=RC) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_AttributeSet(FIELD, NAME='DIMS', VALUE=DIMS, RC=RC) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_AttributeSet(FIELD, NAME='VLOCATION', VALUE=LOCATION, RC=RC) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_AttributeSet(FIELD, NAME='LONG_NAME', VALUE=LONG_NAME, RC=RC) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_AttributeSet(FIELD, NAME='UNITS', VALUE=UNITS, RC=RC) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - - call ESMF_AttributeSet(FIELD, NAME='REFRESH_INTERVAL', VALUE=REFRESH, RC=RC) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_AttributeSet(FIELD, NAME='AVERAGING_INTERVAL', VALUE=AVGINT, RC=RC) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_AttributeSet(FIELD, NAME='HALOWIDTH', VALUE=HW, RC=RC) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_AttributeSet(FIELD, NAME='RESTART', VALUE=RESTART, RC=RC) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_AttributeSet(FIELD, NAME='FIELD_TYPE', VALUE=FIELD_TYPE, RC=RC) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_AttributeSet(FIELD, NAME='STAGGERING', VALUE=STAGGERING, RC=RC) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_AttributeSet(FIELD, NAME='ROTATION', VALUE=ROTATION, RC=RC) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - if (associated(UNGRD)) Then - call ESMF_AttributeSet(FIELD, NAME='UNGRIDDED_NAME', VALUE=UNGRIDDED_NAME, RC=RC) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_AttributeSet(FIELD, NAME='UNGRIDDED_UNIT', VALUE=UNGRIDDED_UNIT, RC=RC) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - if (associated(UNGRIDDED_COORDS)) then - szUngrd = size(ungridded_coords) - call ESMF_AttributeSet(FIELD, NAME='UNGRIDDED_COORDS', itemCount=szUngrd, & - valuelist=ungridded_coords, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end if - end if - - if (associated(ATTR_RNAMES)) then - DO N = 1, size(ATTR_RNAMES) - call ESMF_AttributeSet(FIELD, NAME=trim(ATTR_RNAMES(N)), & - VALUE=ATTR_RVALUES(N), RC=RC) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - END DO - end if - - if (associated(ATTR_INAMES)) then - DO N = 1, size(ATTR_INAMES) - call ESMF_AttributeSet(FIELD, NAME=trim(ATTR_INAMES(N)), & - VALUE=ATTR_IVALUES(N), RC=RC) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - END DO - end if - -10 if (FRIENDLYTO /= "") then - -! parse the string for ":" word delimiters - done = .false. - n1 = 1 - NE = len(FRIENDLYTO) - - DO WHILE(.not. DONE) - N = INDEX(FRIENDLYTO(N1:NE), ':') - IF (N == 0) then - DONE = .TRUE. - N2 = NE - ELSE - N2 = N1 + N - 2 - END IF - if (N1 <= N2 .and. N2 > 0) then -!print *,"DEBUG: setting FieldAttr:FriendlyTo"//trim(FRIENDLYTO(N1:N2)) - call ESMF_AttributeSet(FIELD, & - NAME='FriendlyTo'//trim(FRIENDLYTO(N1:N2)), & - VALUE=.TRUE., RC=RC) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end if - - N1 = N1 + N - END DO - - end if - -#ifdef DEBUGPRINT - ! debug print - call ESMF_FieldGet(FIELD, grid=GRID, & - dimCount=fieldDimCount, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_GridGet(grid, dimCount=gridDimCount, & - arbDimCount=arbDimCount, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=__FILE__)) return ! bail out - - print *, "NUOPC_FieldCreateFromSpec: fieldDimCount=", fieldDimCount, & - " gridDimCount=", gridDimCount, " arbDimCount=", arbDimCount - - if (fieldDimCount - gridDimCount > 0) then - ! query ungridded dim bounds - allocate(ungriddedLBound(fieldDimCount-gridDimCount),stat=stat) - if (ESMF_LogFoundAllocError(statusToCheck=stat, & - msg="Allocation of internal ungriddedLBound failed.", & - line=__LINE__, file=__FILE__, rcToReturn=rc)) & - return ! bail out - allocate(ungriddedUBound(fieldDimCount-gridDimCount),stat=stat) - if (ESMF_LogFoundAllocError(statusToCheck=stat, & - msg="Allocation of internal ungriddedUBound failed.", & - line=__LINE__, file=__FILE__, rcToReturn=rc)) & - return ! bail out - call ESMF_FieldGet(FIELD, ungriddedLBound=ungriddedLBound, & - ungriddedUBound=ungriddedUBound, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=__FILE__)) return ! bail out - print *, "ungriddedLBound = ", ungriddedLBound(:) - print *, "ungriddedUBound = ", ungriddedUBound(:) - deallocate(ungriddedLBound) - deallocate(ungriddedUBound) - endif -#endif - - NUOPC_FieldCreateFromSpec = FIELD - - RETURN - - end function NUOPC_FieldCreateFromSpec - -! Create a cubed sphere grid with NX x NY decomposition and JM_WORLD = IM_WORLD*6 -! don't know if this is the right place to put it -function AppGridCreateF(IM_WORLD, JM_WORLD, LM, NX, NY, rc) - -! return value: - type(ESMF_Grid) :: AppGridCreateF - - integer :: IM_WORLD - integer :: JM_WORLD - integer :: LM - integer :: NX - integer :: NY - integer :: rc - - integer, allocatable :: regDecomp(:,:) - type(ESMF_Grid) :: grid - - allocate(regDecomp(2,6)) - regDecomp(1,:)=NX - regDecomp(2,:)=NY/6 - !print *, regDecomp(:,1), IM_WORLD, trim(Gridname) - grid = ESMF_GridCreateCubedSphere(IM_WORLD, regDecompPTile = regDecomp, & - staggerLocList=(/ESMF_STAGGERLOC_CENTER, ESMF_STAGGERLOC_CORNER/), & - rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_AttributeSet(grid, name='GRID_LM', value=LM, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - AppGridCreateF = grid - - rc=ESMF_SUCCESS - -end function AppGridCreateF - -end module NUOPC_Generic diff --git a/GeosCtmProto/README b/GeosCtmProto/README deleted file mode 100644 index d956a615..00000000 --- a/GeosCtmProto/README +++ /dev/null @@ -1,153 +0,0 @@ -How to compile and run GeosCtmProto using Peggy's BASELIB and GEOSctm_lite on discover - -Peggy Li, 6/5/2018 - -1. Load the following modules - -module load other/comp/gcc-5.3-sp3 -module load comp/intel-17.0.4.196 -module load mpi/impi-18.0.0.128 -module load lib/mkl-17.0.4.196 -module load other/SIVO-PyD/spd_1.24.0_gcc-5.3-sp3_mkl-16.0.1.150 -module load other/git -module load other/cmake - -2. Define the following environment variables - -setenv BASEDIR /gpfsm/dnb31/pli/ESMA-Baselibs-5.0.5/x86_64-unknown-linux-gnu/ifort_17.0.4.196-intelmpi_18.0.0.128 -setenv ESMADIR /gpfsm/dnb31/pli/GEOSctm_lite - -3. Get GeosCtmProto using - % svn co https://svn.code.sf.net/p/esmfcontrib/svn/NUOPC/trunk/GeosCtmProto - and compile it in the GeosCtmProto directory by %gmake - -4. Run it using %mpirun -np 6 ./ctmApp - --------------------------------------- - -How to compile GeosCtmProto with the latest GEOSctm_lite that contains Tom -Clune's latest MAPL code and the new CubedSphereFactory code - -Peggy Li, 1/10/2018 - -(the first three steps are the same as below) - -1. Load the following modules - -module load other/comp/gcc-5.3-sp3 -module load comp/intel-17.0.4.196 -module load mpi/impi-18.0.0.128 -module load lib/mkl-17.0.4.196 -module load other/SIVO-PyD/spd_1.24.0_gcc-5.3-sp3_mkl-16.0.1.150 -module load other/git -module load other/cmake - -2. Build the Baselibs used to compile MAPL following the instruction in -https://geos5.org/wiki/index.php?title=Building_Baselibs - - 1) use the following command to clone: - - % git clone -b 5.0.5 --recursive git@developer.nasa.gov:mathomp4/ESMA-Baselibs.git ESMA-Baselibs-5.0.5/src - - 2) before building the libraries, replace the ESMF library in ESMA-Baselibs-5.0.5/src/esmf with the latest esmf library from ESMF git - repro - - 3) cd ESMA-Baselibs-5.0.5/src/ and run make: - - % make install ESMF_COMM=intelmpi CONFIG_SETUP=ifort_17.0.4.196-intelmpi_18.0.0.128 |& tee makeinstall.ifort_17.0.4.196-intelmpi_18.0.0.128.log - - -3. Set BASELIB environment variable -setenv BASEDIR ..../ESMA-Baselibs-5.0.5/x86_64-unknown-linux-gnu/ifort_17.0.4.196-intelmpi_18.0.0.128 - -4. Get the latest GOESctm_lite and compile it: - - %git clone /discover/swdev/adasilva/bridge/GEOSctm_lite - -5. Modify some scripts and compile GOESctm_lite - - First set environment variable ESMADIR to the GEOSctm_lite top directory: - - %setenv ESMADIR /discover/nobackup/pli/GEOSctm_lite - - then cd $ESMADIR/src and edit g5_modules - in line 138,replace basedir with my own basedir: - - set basedir = /gpfsm/dnb31/pli/ESMA-Baselibs-5.0.5/x86_64-unknown-linux-gnu/ifort_17.0.4.196-intelmpi_18.0.0.128 - - Now, do the following to compile GOESctm_lite: - - % source g5_modules - % gmake install - - The default install directory is $ESMADIR/Linux - -6. Check out GeosCtmProto from esmfcontriv svn repro - - % svn co https://svn.code.sf.net/p/esmfcontrib/svn/NUOPC/trunk/GeosCtmProto - -7. Make sure envirment variables ESMADIR and BASEDIR are set, then just cd to -GeosCtmProto directory to do %gmake - -8. To run the code, do %mpirun -np 6 ./ctmApp - ------------------------------------------- - -How to compile GeosCtmProto with Tom Clune's MAPL repro on discover - -Peggy Li, 11/17/2017 - -1. Load the following modules - -module load other/comp/gcc-5.3-sp3 -module load comp/intel-17.0.4.196 -module load mpi/impi-18.0.0.128 -module load lib/mkl-17.0.4.196 -module load other/SIVO-PyD/spd_1.24.0_gcc-5.3-sp3_mkl-16.0.1.150 -module load other/git -module load other/cmake - -2. Build the Baselibs used to compile MAPL following the instruction in -https://geos5.org/wiki/index.php?title=Building_Baselibs - - 1) use the following command to clone: - - % git clone -b 5.0.5 --recursive git@developer.nasa.gov:mathomp4/ESMA-Baselibs.git ESMA-Baselibs-5.0.5/src - - 2) before building the libraries, replace the ESMF library in ESMA-Baselibs-5.0.5/src/esmf with the latest esmf library from ESMF git - repro - - 3) cd ESMA-Baselibs-5.0.5/src/ and run make: - - % make install ESMF_COMM=intelmpi CONFIG_SETUP=ifort_17.0.4.196-intelmpi_18.0.0.128 |& tee makeinstall.ifort_17.0.4.196-intelmpi_18.0.0.128.log - - -3. Set BASELIB environment variable -setenv BASEDIR ..../ESMA-Baselibs-5.0.5/x86_64-unknown-linux-gnu/ifort_17.0.4.196-intelmpi_18.0.0.128 - -4. Now get MAPL develop branch: - - % git clone git@developer.nasa.gov:tclune/MAPL.git - % cd MAPL - % git checkout develop - -5. Make MAPL using the BASEDIR - - create a build directory and cd to build - % cmake ../MAPL/src -DBASEDIR=$BASEDIR/Linux - % gmake -j MAPL_Base - - MAPL makefile does not have an install target. The libraries are located - in the subdirectories under build. I created a subdirectory called lib - and create a target to copy all the .a files to lib/ - -6. Check out GeosCtmProto from esmfcontriv svn repro - - % svn co https://svn.code.sf.net/p/esmfcontrib/svn/NUOPC/trunk/GeosCtmProto - -7. modify MAPL_INSTALL_ROOT in Makefile to point to the MAPL build directory,then do %make - -There are some changes to be made in the ESMF library and in the MAPL code in -order to run ctmApp. - - diff --git a/GeosCtmProto/advcore.F90 b/GeosCtmProto/advcore.F90 deleted file mode 100644 index 771a3037..00000000 --- a/GeosCtmProto/advcore.F90 +++ /dev/null @@ -1,1255 +0,0 @@ -!------------------------------------------------------------------------------ -#include "MAPL_Generic.h" -!#define PRINT_MASS -! -!------------------------------------------------------------------------------ -!BOP -! -! !MODULE: ADVCORE -! -! !DESCRIPTION: -! This a MAPL component that can be used in -! either with offline or online applications to advect an arbitrary set -! of constituents. -! -! \paragraph{Scientific Description:} -! -! The advection scheme used is that from the FVdycore grid-point -! dynamical core. It runs on a sphere and uses finite-volume -! discretization techniques. The advection is time split into a -! horizontal phase that is assumed to be vertically Lagrangian and a -! vertical remap phase. A complete description of the core from -! which this component is taken may be found in: -! -! \begin{quote} -! Lin, S.-J. 2004, A vertically Lagrangian Finite-Volume Dynamical -! Core for Global Models. {\em Mon. Wea. Rev.}, {\bf 132}, 2293-2307. -! \end{quote} -! -! \paragraph{Code Implementation:} -! -! It code uses the MAPL (http://MAPLCode.org/maplwiki/) to -! encapsulate the FV advection scheme as an ESMF gridded component -! using the ESMF paradigm of initialize, run and finalize methods, -! and their SetServices routine. As in all ESMF codes, only -! SetServices is public and the interface consists of of a Clock -! and Import and Export states. The import state includes a -! specialized description of the motion field in terms of C-grid -! winds and mass fluxes. These are assumed to have been accumulated -! over the time interval specified in the resource file. The -! default of this interval is 1800 seconds. The layer pressure -! thicknesses in the import state are assumed to be the -! instantaneous values valid at the beginning of this interval. If -! these thicknesses are friendly they will be updated to values -! valid at the end of the interval, consistent with the given -! motion field. Mixing ratios of the constituents to be advected -! are placed ESMF Fields within an ESMF Bundle in the Import -! state. Each Field in the Bundle is tested for ``Friendliness'' to -! advection; if friendly it is advected and its values updated. -! -! Currently no Export capability is implemented. -! -! !INTERFACE: - -module ADVCORE - -! -! !USES: - - use ESMF - use MAPL_Mod - use NUOPC - use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_DataInitialize => label_DataInitialize, & - model_label_Advance => label_Advance, & - model_label_CheckImport => label_CheckImport - - use NUOPC_Generic - - use m_set_eta, only: set_eta - use fv_arrays_mod, only: fv_atmos_type, FVPRC, REAL4, REAL8 - use fms_mod, only: fms_init, set_domain, nullify_domain - use fv_control_mod, only: fv_init1, fv_init2, fv_end - use fv_mp_mod, only: is,ie, js,je, tile - use mpp_mod, only: mpp_pe, mpp_root_pe - use fv_tracer2d_mod, only: offline_tracer_advection - use fv_grid_utils_mod, only: g_sum - - USE FV_StateMod, only: AdvCoreTracers => T_TRACERS - USE FV_StateMod, only: FV_Atm - - implicit none - private - - integer :: nx, ny - integer :: hord_tr, kord_tr - integer :: q_split - logical :: z_tracer - logical :: fill - real(FVPRC) :: dt - logical :: FV3_DynCoreIsRunning=.false. - integer :: AdvCore_Advection=1 - logical :: chk_mass=.false. - - integer, parameter :: ntiles_per_pe = 1 - -! Tracer I/O History stuff -! ------------------------------------- - integer, parameter :: ntracers=9 - integer :: ntracer - character(len=ESMF_MAXSTR) :: myTracer - character(len=ESMF_MAXSTR) :: tMassStr - real(FVPRC), SAVE :: TMASS0(ntracers) - real(ESMF_KIND_R8), SAVE :: MASS0 - logical , SAVE :: firstRun=.true. - integer , SAVE :: steps=0 -! !PUBLIC MEMBER FUNCTIONS: - - public SetServices - logical, allocatable, save :: grids_on_my_pe(:) - -!EOP - -!------------------------------------------------------------------------------ -contains -!------------------------------------------------------------------------------ -!BOP -! !IROUTINE: SetServices - Externally visible registration routine -! -! !INTERFACE: -! - subroutine SetServices(GC, rc) -! -! !ARGUMENTS: - type(ESMF_GridComp) :: GC - integer, intent( out) :: RC -! -! !DESCRIPTION: -! -! User-supplied setservices routine. -! The register routine sets the subroutines to be called -! as the init, run, and finalize routines. Note that those are -! private to the module. -! -!EOP - - character(len=ESMF_MAXSTR) :: IAm - character(len=ESMF_MAXSTR) :: COMP_NAME - character(len=ESMF_MAXSTR) :: DYCORE - type (mystates_WRAP) :: mystates_ptr - type (my_States), pointer :: mystates - type(ESMF_VM) :: VM - integer :: STATUS - integer :: comm -!============================================================================= - -! Begin... - - ! Get my name and set-up traceback handle - ! --------------------------------------- - - call ESMF_GridCompGet( GC, NAME=COMP_NAME, RC=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - Iam = trim(COMP_NAME) // '::SetServices' - - call ESMF_LogWrite(Iam, ESMF_LOGMSG_INFO, rc=rc) - - allocate(mystates) - mystates_ptr%ptr => mystates - call ESMF_UserCompSetInternalState(GC, 'MAPL_VarSpec', mystates_ptr, rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(GC, model_routine_SS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! Register services for this component - ! ------------------------------------ - ! Provide InitializeP0 to switch to custom IPD version - call ESMF_GridCompSetEntryPoint(GC, ESMF_METHOD_INITIALIZE, & - userRoutine=InitializeP0, phase=0, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(GC, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv02p1"/), userRoutine=InitAdvertise, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSetEntryPoint(GC, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv02p3"/), userRoutine=InitRealize, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call NUOPC_CompSpecialize(GC, specLabel=model_label_DataInitialize, & - specRoutine=dataInitialize, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - -#if 0 - call ESMF_MethodRemove(GC, label=model_label_CheckImport,rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSpecialize(GC, specLabel=model_label_CheckImport, & - specRoutine=NUOPC_NoOp, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#endif - - call NUOPC_CompSpecialize(GC, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! Original AdvCore code - ! Start up FMS/MPP - !------------------------------------------- - call ESMF_VMGetCurrent(vm,rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_VMGet(VM,mpiCommunicator=comm,rc=STATUS) - VERIFY_(STATUS) - call fms_init(comm) - VERIFY_(STATUS) - -!BOS - - end subroutine SetServices - - !----------------------------------------------------------------------------- - - subroutine InitializeP0(gcomp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: gcomp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - character(len=ESMF_MAXSTR) :: IAm - type(ESMF_Config) :: rootConfig ! GEOSCTM.rc - integer :: STATUS - integer :: comm, ndt - integer :: p_split=1 - - Iam = 'DYNAMICS::InitializeP0' - - rc = ESMF_SUCCESS - call ESMF_LogWrite(trim(Iam), ESMF_LOGMSG_INFO, rc=rc) - - ! Switch to IPDv02 (for datainitialize dependency loop) - ! by filtering all other phaseMap entries - call NUOPC_CompFilterPhaseMap(gcomp, ESMF_METHOD_INITIALIZE, & - acceptStringList=(/"IPDv02p"/), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! FV3 setup code from SetServices -- - if (.NOT. FV3_DynCoreIsRunning) then - call fv_init1(FV_Atm, dt, grids_on_my_pe, p_split) - endif - - ! ----------------------- - ! Get Domain decomposition - !------------------------- - call ESMF_GridCompGet(gcomp, config=rootConfig, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_ConfigGetAttribute( rootConfig, nx, label='NX:', default=0, RC=STATUS ) - VERIFY_(STATUS) - FV_Atm(1)%layout(1) = nx - call ESMF_ConfigGetAttribute(rootConfig, ny, label='NY:', default=0, RC=STATUS ) - VERIFY_(STATUS) - if (FV_Atm(1)%flagstruct%grid_type == 4) then - FV_Atm(1)%layout(2) = ny - else - FV_Atm(1)%layout(2) = ny / 6 - end if - - ! Make sure FV3 is setup - ! ----------------------- - - ! Get Resolution Information - !--------------------------- -! FV grid dimensions setup from MAPL - call ESMF_ConfigGetAttribute( rootConfig, FV_Atm(1)%flagstruct%npx, label='IM:', default= 32, RC=STATUS ) - VERIFY_(STATUS) - call ESMF_ConfigGetAttribute( rootConfig, FV_Atm(1)%flagstruct%npy, label='JM:', default=192, RC=STATUS ) - VERIFY_(STATUS) - call ESMF_ConfigGetAttribute( rootConfig, FV_Atm(1)%flagstruct%npz, label='LM:', default= 72, RC=STATUS ) - VERIFY_(STATUS) - -! FV likes npx;npy in terms of cell vertices - if (FV_Atm(1)%flagstruct%npy == 6*FV_Atm(1)%flagstruct%npx) then - FV_Atm(1)%flagstruct%ntiles = 6 - FV_Atm(1)%flagstruct%npy = FV_Atm(1)%flagstruct%npx+1 - FV_Atm(1)%flagstruct%npx = FV_Atm(1)%flagstruct%npx+1 - else - FV_Atm(1)%flagstruct%ntiles = 1 - FV_Atm(1)%flagstruct%npy = FV_Atm(1)%flagstruct%npy+1 - FV_Atm(1)%flagstruct%npx = FV_Atm(1)%flagstruct%npx+1 - endif - - call ESMF_AttributeGet( gcomp, 'RUN_DT:', ndt, RC=STATUS ) - VERIFY_(STATUS) - DT = ndt - - ! Start up FV if AdvCore is running without FV3_DynCoreIsRunning - !-------------------------------------------------- - if (.NOT. FV3_DynCoreIsRunning) then - call fv_init2(FV_Atm, dt, grids_on_my_pe, p_split) - endif - - end subroutine initializeP0 - - !----------------------------------------------------------------------------- - - subroutine InitAdvertise(GC, IMPORT, EXPORT, CLOCK, rc) - type(ESMF_GridComp) :: GC - type(ESMF_State) :: IMPORT - type(ESMF_State) :: EXPORT - type(ESMF_Clock) :: CLOCK - integer, intent(out) :: rc - - type (mystates_WRAP) :: mystates_ptr - type(MAPL_VarSpec), pointer :: importSpec(:) - type(MAPL_VarSpec), pointer :: exportSpec(:) - character(len=ESMF_MAXSTR) :: short_name - character(len=ESMF_MAXSTR) :: long_name - character(len=ESMF_MAXSTR) :: units - integer :: mytype - integer :: i, ic - integer :: numTracers - character(len=2) :: id - -! !IMPORT STATE: -! - call ESMF_LogWrite("ADVCORE:InitAdvertise", ESMF_LOGMSG_INFO, rc=rc) - - call NUOPC_AddImportSpec ( gc, & - SHORT_NAME = 'MFX', & - LONG_NAME = 'pressure_weighted_eastward_mass_flux', & - UNITS = 'Pa m+2 s-1', & - PRECISION = FVPRC, & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, RC=RC ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call NUOPC_AddImportSpec ( gc, & - SHORT_NAME = 'MFY', & - LONG_NAME = 'pressure_weighted_northward_mass_flux', & - UNITS = 'Pa m+2 s-1', & - PRECISION = FVPRC, & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, RC=RC ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call NUOPC_AddImportSpec ( gc, & - SHORT_NAME = 'CX', & - LONG_NAME = 'eastward_accumulated_courant_number', & - UNITS = '1', & - PRECISION = FVPRC, & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, RC=RC ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call NUOPC_AddImportSpec ( gc, & - SHORT_NAME = 'CY', & - LONG_NAME = 'northward_accumulated_courant_number', & - UNITS = '1', & - PRECISION = FVPRC, & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, RC=RC ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call NUOPC_AddImportSpec ( gc, & - SHORT_NAME = 'PLE0', & - LONG_NAME = 'pressure_at_layer_edges_before_advection', & - UNITS = 'Pa', & - PRECISION = FVPRC, & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationEdge, RC=RC ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call NUOPC_AddImportSpec ( gc, & - SHORT_NAME = 'PLE1', & - LONG_NAME = 'pressure_at_layer_edges_after_advection', & - UNITS = 'Pa', & - PRECISION = FVPRC, & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationEdge, RC=RC ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! Changed TRADV into five import fields with long_name "advected_quantities_n" -#if 0 - call NUOPC_AddImportSpec(GC, & - SHORT_NAME = 'TRADV', & - LONG_NAME = 'advected_quantities', & - units = 'X', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & -! DATATYPE = MAPL_BundleItem, & - RC=RC ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#else - numTracers = 5 - do ic=1, numTracers - write (id ,'(i2.2)') ic-1 - call NUOPC_AddImportSpec(GC, & - SHORT_NAME = 'TRADV'//id, & - LONG_NAME = 'advected_quantity_'//id, & - units = 'mol/mol', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RC=RC ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - enddo -#endif - call ESMF_UserCompGetInternalState(gc, 'MAPL_VarSpec', mystates_ptr, rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - !Advertize the import fields - importSpec => mystates_ptr%ptr%importSpec - !print *, 'ADVCORE number of import fields: ', size(importSpec) - do i=1,size(importSpec) - call MAPL_VarSpecGet(importSpec(i), SHORT_NAME=short_name, LONG_NAME=long_name, & - STAT=mytype, UNITS=units, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - !!! Need to do something different if mytype is MAPL_BundleItem, Nothing has been added into - !!! the bundle yet. Ignore it for now - !!! if (mytype .ne. MAPL_BundleItem) then - if (short_name(1:5) .eq. "TRADV") then - call NUOPC_Advertise(IMPORT, & - StandardName=long_name, name=short_name, units=units, & - SharePolicyField="share", TransferOfferField="can provide", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - else - call NUOPC_Advertise(IMPORT, & - StandardName=long_name, name=short_name, units=units, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - endif - !print *, 'ADVCORE: advertise import field ', long_name - !!! endif - end do - -! !EXPORT STATE: - - call NUOPC_AddExportSpec ( gc, & - SHORT_NAME = 'AREA', & - LONG_NAME = 'agrid_cell_area', & - UNITS = 'm+2' , & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, RC=RC ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - -! 3D Tracers - do ntracer=1,ntracers - write(myTracer, "('TEST_TRACER',i1.1)") ntracer-1 - call NUOPC_AddExportSpec ( gc, & - SHORT_NAME = TRIM(myTracer), & - LONG_NAME = TRIM(myTracer), & - UNITS = '1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, RC=RC ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - enddo - - !Advertize the import fields - exportSpec => mystates_ptr%ptr%exportSpec - !print *, 'ADVCORE number of export fields: ', size(exportSpec) - - do i=1,size(exportSpec) - call MAPL_VarSpecGet(exportSpec(i), SHORT_NAME=short_name, LONG_NAME=long_name, & - STAT=mytype, UNITS=units, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - !!! Need to do something different if mytype is MAPL_BundleItem, Nothing has been added into - !!! the bundle yet. Ignore it for now - !!! if (mytype .ne. MAPL_BundleItem) then - call NUOPC_Advertise(EXPORT, & - StandardName=long_name, name=short_name, units=units, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - !print *, 'ADVCORE: advertise export field ', long_name - !!! endif - end do - -!EOS - -#if 0 - ! Set the Profiling timers - !------------------------- - call MAPL_TimerAdd(GC, name="INITIALIZE" ,RC=RC) - VERIFY_(STATUS) - call MAPL_TimerAdd(GC, name="RUN" ,RC=RC) - VERIFY_(STATUS) - call MAPL_TimerAdd(GC, name="FINALIZE" ,RC=RC) - VERIFY_(STATUS) - call MAPL_TimerAdd(GC, name="TOTAL" ,RC=RC) - VERIFY_(STATUS) - - ! Ending with a Generic SetServices call is a MAPL requirement - !------------------------------------------------------------- - call MAPL_GenericSetServices ( GC, rc=STATUS) - VERIFY_(STATUS) -#endif - - RC=ESMF_SUCCESS - - RETURN - - end subroutine InitAdvertise - -!------------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: InitRealize - initialization routine -! -! !INTERFACE: -! - subroutine InitRealize(GC, IMPORT, EXPORT, CLOCK, RC) -! -! !INPUT/OUTPUT PARAMETERS: - type(ESMF_GridComp) :: GC ! Gridded component - type(ESMF_State) :: IMPORT ! Import state - type(ESMF_State) :: EXPORT ! Export state - type(ESMF_Clock) :: CLOCK ! The clock -! -! !OUTPUT PARAMETERS: - integer, intent( out) :: RC ! Error code -! -! !DESCRIPTION: -! This initialization routine creates the import and export states, -! as well as the internal state, which is attached to the component. -! It also determines the distribution (and therefore the grid) -! and performs allocations of persistent data, -! -!EOP -!============================================================================= -!BOC - - character(len=ESMF_MAXSTR) :: IAm - integer :: STATUS - character(len=ESMF_MAXSTR) :: COMP_NAME - CHARACTER(LEN=ESMF_MAXSTR) :: rcfilen = 'fvcore_layout.rc' - type(ESMF_Config) :: CF - type (MAPL_MetaComp), pointer :: MAPL - character (len=ESMF_MAXSTR) :: LAYOUT_FILE - type (ESMF_VM) :: VM - integer :: ndt, comm - real, pointer :: temp2d(:,:) - integer :: IS, IE, JS, JE - integer :: dt - type(ESMF_Grid) :: esmfGrid - type(mystates_wrap) :: mystates_ptr - type(MAPL_VarSpec), pointer :: importSpec(:) - type(MAPL_VarSpec), pointer :: exportSpec(:) - -! Begin... - -! Get the target components name and set-up traceback handle. -! ----------------------------------------------------------- - - Iam = "::InitRealize" - - ! Get my name and set-up traceback handle - ! --------------------------------------- - call ESMF_GridCompGet( GC, NAME=COMP_NAME, GRID=esmfGrid, RC=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - Iam = trim(COMP_NAME) // trim(Iam) - - call ESMF_LogWrite(Iam, ESMF_LOGMSG_INFO, rc=rc) - - !call MAPL_TimerOn(ggSTATE,"TOTAL") - !call MAPL_TimerOn(ggSTATE,"INITIALIZE") - -#if 0 - CF = ESMF_ConfigCreate(rc=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_ConfigLoadFile(CF, TRIM(rcfilen), rc=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#endif - - !Get VarSpec info - call ESMF_UserCompGetInternalState(GC, "MAPL_VarSpec", mystates_ptr, rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - importSpec => mystates_ptr%ptr%importSpec - exportSpec => mystates_ptr%ptr%exportSpec - - ! Create the fields in the import and export state - !--------------------------------- - ! realize connected Fields in the importState - call realizeConnectedFields(IMPORT, importSpec, esmfGrid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! realize connected Fields in the importState - call realizeConnectedFields(EXPORT, exportSpec, esmfGrid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - -#if 0 - call MAPL_TimerOn(MAPL,"TOTAL") - call MAPL_TimerOn(MAPL,"INITIALIZE") -#endif - - ! Get the time-step - ! ----------------------- - ! call MAPL_GetResource( MAPL, ndt, 'RUN_DT:', default=0, RC=STATUS ) - call ESMF_AttributeGet ( GC, "RUN_DT:", dt, RC=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! Compute Grid-Cell Area - ! ---------------------- - ! Moved from initialize() in AdvCore_GridCompMod.F90 - !------------------------------------------------------- - if (.NOT. FV3_DynCoreIsRunning) then - IS = FV_Atm(1)%bd%isc - IE = FV_Atm(1)%bd%iec - JS = FV_Atm(1)%bd%jsc - JE = FV_Atm(1)%bd%jec - - call MAPL_GetPointer(EXPORT, temp2d, 'AREA', ALLOC=.TRUE., rc=status) - VERIFY_(STATUS) - temp2d = FV_Atm(1)%gridstruct%area(IS:IE,JS:JE) - if (MAPL_am_I_root()) then - print *, trim(Iam), ": area ", temp2d(1,1), temp2d(IE-IS, JE-IS) - endif - endif - - !call MAPL_TimerOff(MAPL,"INITIALIZE") - !call MAPL_TimerOff(MAPL,"TOTAL") - - if ( MAPL_am_I_root() ) then - print *, trim(Iam)//": IMPORT State" - call ESMF_StatePrint ( IMPORT) -! print *, trim(Iam)//": INTERNAL State" -! call ESMF_StatePrint ( WRAP ) - print *, trim(Iam)//": EXPORT State" - call ESMF_StatePrint ( EXPORT ) - end if - - RETURN_(ESMF_SUCCESS) - - contains !-------------------------------------------------------- - - subroutine realizeConnectedFields(state, spec, grid, rc) - ! TODO: this method may move into the NUOPC_ utility layer - type(ESMF_State) :: state - type(MAPL_VarSpec), pointer :: spec(:) - type(ESMF_Grid) :: grid - integer, intent(out), optional :: rc - ! local variables - character(len=ESMF_MAXSTR) :: fieldName - character(len=ESMF_MAXSTR) :: name, value - integer :: i, itemCount, k - type(ESMF_Field) :: field - real(ESMF_KIND_R8), pointer :: fptr(:) - integer :: ungriddedLBound(1), ungriddedUBound(1) - type(ESMF_TypeKind_Flag) :: typekind - - if (present(rc)) rc = ESMF_SUCCESS - - itemCount=size(spec) - - k=1 ! initialize - do i=1, itemCount - ! find the VarSpec with matching long_name - call MAPL_VarSpecGet(spec(i),LONG_NAME=fieldName, SHORT_NAME=name, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call MAPL_VarSpecSet(spec(i), GRID=grid,rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - if (NUOPC_IsConnected(state, fieldName=name)) then - ! Check if the field is a shared field - if (name(1:5) .eq. "TRADV") then - call NUOPC_Realize(state, grid=grid, fieldName = name, & - selection="realize_connected+provide_remove_others", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - else - ! create a Field - field = NUOPC_FieldCreateFromSpec(spec(i),rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! realize the connected Field using the just created Field - ! print the field dimension and name - call ESMF_FieldGet(FIELD, ungriddedLBound=ungriddedLBound, & - ungriddedUBound=ungriddedUBound, typekind=typekind, & - rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=__FILE__)) return ! bail out - call NUOPC_Realize(state, field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! print *, 'ADVCORE Realize field ', name - endif - else - ! remove a not connected Field from State - call ESMF_StateRemove(state, (/name/), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - print *, 'ADVCORE remove field ', name - endif - enddo - - end subroutine realizeConnectedFields - - end subroutine initRealize - -!---------------------------------------------------------------------- - subroutine dataInitialize ( GC, RC ) -! - type(ESMF_GridComp) :: GC ! Gridded component - integer, intent( out) :: RC ! Error code -! - ! local variables - type(ESMF_Clock) :: clock - type(ESMF_State) :: importState, exportState - - RC = ESMF_SUCCESS - - call ESMF_LogWrite("ADVCORE:dataInitialize", ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! query the Component for its clock, importState and exportState - call NUOPC_ModelGet(GC, modelClock=clock, importState=importState, & - exportState=exportState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! must explicitly set time stamp on all export fields - call NUOPC_SetTimestamp(exportState, clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! indicate that data initialization is complete (breaking out of init-loop) - call NUOPC_CompAttributeSet(GC, & - name="InitializeDataComplete", value="true", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - return - end subroutine dataInitialize - -! -!EOC -!------------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: Run - run routine -! -! !INTERFACE: -! - subroutine ModelAdvance(GC, RC) -! - type(ESMF_GridComp) :: GC ! Gridded component - integer, intent( out) :: RC ! Error code -! -! !DESCRIPTION: -! -! The Run method advanced the advection one long time step, as -! specified in the configuration. This may be broken down int a -! number of internal, small steps, also configurable. -! -!EOP -!============================================================================= -!BOC -! !LOCAL VARIABLES: - type(ESMF_Clock) :: clock - type(ESMF_State) :: import, export - character(len=ESMF_MAXSTR) :: IAm - integer :: STATUS - character(len=ESMF_MAXSTR) :: COMP_NAME - type (ESMF_Grid) :: ESMFGRID - !type (MAPL_MetaComp), pointer :: MAPL - type (ESMF_Alarm) :: ALARM - type(ESMF_Config) :: CF ! Universal Config - -! Imports - REAL(FVPRC), POINTER, DIMENSION(:,:,:) :: CX - REAL(FVPRC), POINTER, DIMENSION(:,:,:) :: CY - REAL(FVPRC), POINTER, DIMENSION(:,:,:) :: MFX - REAL(FVPRC), POINTER, DIMENSION(:,:,:) :: MFY - REAL(FVPRC), POINTER, DIMENSION(:,:,:) :: PLE0 - REAL(FVPRC), POINTER, DIMENSION(:,:,:) :: PLE1 - -! Locals - REAL(REAL8), POINTER, DIMENSION(:) :: AK - REAL(REAL8), POINTER, DIMENSION(:) :: BK - REAL(FVPRC), POINTER, DIMENSION(:,:,:,:) :: TRACERS - REAL(FVPRC) :: tmassL, MASSfac, MASS1, TMASS1(ntracers) - TYPE(AdvCoreTracers), POINTER :: advTracers(:) - type(ESMF_FieldBundle) :: TRADV - type(ESMF_Field) :: field - type(ESMF_Array) :: array - INTEGER :: IM, JM, LM, N, NQ, I,J,L, LS - REAL(FVPRC) :: PTOP, PINT - REAL(REAL8) :: ptop_r8,pint_r8 -! Temporaries for exports/tracers - REAL, POINTER :: temp3D(:,:,:) - REAL, POINTER :: ptArray3D(:,:,:) - real(REAL4), pointer :: tracer_r4 (:,:,:) - real(REAL8), pointer :: tracer_r8 (:,:,:) - character(len=ESMF_MAXSTR) :: fieldName - type(ESMF_TypeKind_Flag) :: kind - integer :: gid, masterproc - character(len=2) :: id - - integer :: AGCM_YY, AGCM_MM, AGCM_DD, AGCM_H, AGCM_M, AGCM_S - type(ESMF_Time) :: CurrTime - integer :: is, js, ie, je - -! Get my name and set-up traceback handle -! --------------------------------------- - - Iam = 'Run' - call ESMF_GridCompGet( GC, name=COMP_NAME, grid=ESMFGRID, RC=STATUS ) - VERIFY_(STATUS) - Iam = trim(COMP_NAME) // Iam - call NUOPC_ModelGet(GC, modelClock=clock, importState=IMPORT, & - exportState=EXPORT, rc=STATUS) - VERIFY_(STATUS) - -#if 1 -!WMP if (AdvCore_Advection>0) then - - gid = mpp_pe() - masterproc = mpp_root_pe() - - call ESMF_GridCompGet(GC, config=CF, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_ConfigGetAttribute(CF, IM, label='IM:', RC=STATUS ) - VERIFY_(STATUS) - call ESMF_ConfigGetAttribute(CF, JM, label='JM:', RC=STATUS ) - VERIFY_(STATUS) - call ESMF_ConfigGetAttribute(CF, LM, label='LM:', RC=STATUS ) - VERIFY_(STATUS) - JM = JM/6 - -! Get parameters from generic state. -!----------------------------------- - !call MAPL_GetObjectFromGC ( GC, MAPL, RC=STATUS) - !VERIFY_(STATUS) - !call MAPL_Get( MAPL, IM=IM, JM=JM, LM=LM, & - ! RUNALARM = ALARM, & - ! RC = STATUS ) - !VERIFY_(STATUS) - - !call MAPL_TimerOn(MAPL,"TOTAL") - !call MAPL_TimerOn(MAPL,"RUN") - -! Get AKs and BKs for vertical grid -!---------------------------------- - AllOCATE( AK(LM+1) ,stat=STATUS ) - VERIFY_(STATUS) - AllOCATE( BK(LM+1) ,stat=STATUS ) - VERIFY_(STATUS) - ptop=0.0 - pint=0.0 - ak=0.0 - bk=0.0 - call set_eta(LM,LS,ptop_r8,pint_r8,AK,BK) - ptop = ptop_r8 - pint = pint_r8 - - CALL MAPL_GetPointer(IMPORT, PLE0, 'PLE0', ALLOC = .TRUE., RC=STATUS) - VERIFY_(STATUS) - CALL MAPL_GetPointer(IMPORT, PLE1, 'PLE1', ALLOC = .TRUE., RC=STATUS) - VERIFY_(STATUS) - CALL MAPL_GetPointer(IMPORT, MFX, 'MFX', ALLOC = .TRUE., RC=STATUS) - VERIFY_(STATUS) - CALL MAPL_GetPointer(IMPORT, MFY, 'MFY', ALLOC = .TRUE., RC=STATUS) - VERIFY_(STATUS) - CALL MAPL_GetPointer(IMPORT, CX, 'CX', ALLOC = .TRUE., RC=STATUS) - VERIFY_(STATUS) - CALL MAPL_GetPointer(IMPORT, CY, 'CY', ALLOC = .TRUE., RC=STATUS) - VERIFY_(STATUS) - - is = lbound(PLE0,1); ie = ubound(PLE0,1) - js = lbound(PLE0,2); je = ubound(PLE0,2) - - ! The quantities to be advected come as friendlies in a bundle - ! in the import state. - !-------------------------------------------------------------- - - ! NUOPC does not support bundle in the import/export state, changed to - ! five TRADV fields with names TRADV00, to TRADV04 - - !call ESMF_StateGet(IMPORT, "TRADV", TRADV, rc=STATUS) - !VERIFY_(STATUS) - !call ESMF_FieldBundleGet(TRADV, fieldCount=NQ, rc=STATUS) - !VERIFY_(STATUS) - - NQ = 5 - if (NQ > 0) then - ! We allocate a list of tracers big enough to hold all items in the bundle - !------------------------------------------------------------------------- - ALLOCATE( TRACERS(IM,JM,LM,NQ),stat=STATUS ) - VERIFY_(STATUS) - ALLOCATE( advTracers(NQ),stat=STATUS ) - VERIFY_(STATUS) - - ! Go through the bundle copying the friendlies into the tracer list. - !------------------------------------------------------------------------- - do N=1,NQ - - !call ESMF_FieldBundleGet (TRADV, fieldIndex=N, field=FIELD, RC=STATUS) - !VERIFY_(STATUS) - - write (id ,'(i2.2)') N-1 - call ESMF_StateGet(IMPORT, "TRADV"//id, FIELD, rc=STATUS) - VERIFY_(STATUS) - call ESMF_FieldGet (field, array=array, name=fieldName, RC=STATUS) - VERIFY_(STATUS) - call ESMF_ArrayGet(array,typekind=kind, rc=status ) - VERIFY_(STATUS) - advTracers(N)%is_r4 = (kind == ESMF_TYPEKIND_R4) ! Is real*4? - advTracers(N)%tName = fieldName - - if (advTracers(N)%is_r4) then - call ESMF_ArrayGet(array,farrayptr=tracer_r4, rc=status ) - VERIFY_(STATUS) - advTracers(N)%content_r4 => tracer_r4 - TRACERS(:,:,:,N) = advTracers(N)%content_r4 - else - call ESMF_ArrayGet(array,farrayptr=tracer_r8, rc=status ) - VERIFY_(STATUS) - advTracers(N)%content => tracer_r8 - TRACERS(:,:,:,N) = advTracers(N)%content - end if - end do - TMASS0=0.0 - TMASS1=0.0 - if (chk_mass) then - ! Check Mass conservation - if (firstRun .and. AdvCore_Advection>0) then - MASS0 = g_sum(FV_Atm(1)%domain, PLE0(:,:,LM), is,ie, js,je, FV_Atm(1)%ng, FV_Atm(1)%gridstruct%area_64, 1, .true.) - call global_integral(TMASS0, TRACERS, PLE0, IM,JM,LM,NQ) - if (MASS0 /= 0.0) TMASS0=TMASS0/MASS0 - elseif (firstRun) then - MASS0 = g_sum(FV_Atm(1)%domain, PLE1(:,:,LM), is,ie, js,je, FV_Atm(1)%ng, FV_Atm(1)%gridstruct%area_64, 1, .true.) - call global_integral(TMASS0, TRACERS, PLE1, IM,JM,LM,NQ) - if (MASS0 /= 0.0) TMASS0=TMASS0/MASS0 - endif - firstrun = .false. - endif - - call ESMF_ClockGet ( clock, CurrTime=currTime, rc=status ) - VERIFY_(STATUS) - call ESMF_TimeGet ( CurrTime, YY = AGCM_YY, & - MM = AGCM_MM, & - DD = AGCM_DD, & - H = AGCM_H , & - M = AGCM_M , & - S = AGCM_S, rc=status ) - VERIFY_(STATUS) - - if ( MAPL_am_I_root() ) then - - write(6,1000) AGCM_YY,AGCM_MM,AGCM_DD,AGCM_H,AGCM_M,AGCM_S - 1000 format(1x,'ADVCORE Date: ',i4.4,'/',i2.2,'/',i2.2,2x,'Time: ',i2.2,':',i2.2,':',i2.2) - endif - - ! Run FV3 advection - !------------------ - if (AdvCore_Advection>0) then - call WRITE_PARALLEL("offline_tracer_advection") - call offline_tracer_advection(TRACERS, PLE0, PLE1, MFX, MFY, CX, CY, & - fv_atm(1)%gridstruct, fv_atm(1)%flagstruct, fv_atm(1)%bd, & - fv_atm(1)%domain, AK, BK, PTOP, FV_Atm(1)%npx, FV_Atm(1)%npy, FV_Atm(1)%npz, & - NQ, fv_atm(1)%flagstruct%hord_tr, fv_atm(1)%flagstruct%kord_tr, & - fv_atm(1)%flagstruct%q_split, fv_atm(1)%flagstruct%k_split, dt, & - fv_atm(1)%flagstruct%z_tracer, fill) - - endif - - ! Update tracer mass conservation - !------------------------------------------------------------------------- - if (chk_mass) then - MASS1 = g_sum(FV_Atm(1)%domain, PLE1(:,:,LM), is,ie, js,je, FV_Atm(1)%ng, FV_Atm(1)%gridstruct%area_64, 1, .true.) - call global_integral(TMASS1, TRACERS, PLE1, IM,JM,LM,NQ) - if (MASS1 /= 0.0) TMASS1=TMASS1/MASS1 - endif - - if (chk_mass .and. gid==masterproc) then -#ifdef PRINT_MASS - write(6,100) MASS0 , & - TMASS0(2), & - TMASS0(3), & - TMASS0(4), & - TMASS0(5) - write(6,102) MASS1 , & - TMASS1(2), & - TMASS1(3), & - TMASS1(4), & - TMASS1(5) -#endif - write(6,103) ( MASS1 - MASS0 )/ MASS0 , & - (TMASS1(2)-TMASS0(2))/TMASS0(2), & - (TMASS1(3)-TMASS0(3))/TMASS0(3), & - (TMASS1(4)-TMASS0(4))/TMASS0(4), & - (TMASS1(5)-TMASS0(5))/TMASS0(5) - 100 format('Tracer M0 : ',e21.14,' ',e21.14,' ',e21.14,' ',e21.14,' ',e21.14) - 101 format('Tracer Ma : ',e21.14,' ',e21.14,' ',e21.14,' ',e21.14,' ',e21.14) - 102 format('Tracer M1 : ',e21.14,' ',e21.14,' ',e21.14,' ',e21.14,' ',e21.14) - 103 format('Tracer Mdif: ',e21.14,' ',e21.14,' ',e21.14,' ',e21.14,' ',e21.14) - endif - - ! Go through the bundle copying tracers back to the bundle. - !------------------------------------------------------------------------- - do N=1,NQ - if (advTracers(N)%is_r4) then - advTracers(N)%content_r4 = TRACERS(:,:,:,N) - else - advTracers(N)%content = TRACERS(:,:,:,N) - end if - -! Fill Export States - write(myTracer, "('TEST_TRACER',i1.1)") N-1 - call MAPL_GetPointer(EXPORT, temp3D, TRIM(myTracer), rc=status) - VERIFY_(STATUS) - if ((associated(temp3D)) .and. (N<=ntracers)) then - temp3D = TRACERS(:,:,:,N) - endif - enddo - - ! Deallocate the list of tracers - !------------------------------------------------------------------------- - DEALLOCATE( TRACERS,stat=STATUS ) - VERIFY_(STATUS) - - end if ! NQ > 0 - - deallocate( advTracers, stat=STATUS ) - VERIFY_(STATUS) - DEALLOCATE( AK ,stat=STATUS ) - VERIFY_(STATUS) - DEALLOCATE( BK ,stat=STATUS ) - VERIFY_(STATUS) - - !call MAPL_TimerOff(MAPL,"RUN") - !call MAPL_TimerOff(MAPL,"TOTAL") - -!WMP end if ! AdvCore_Advection -#endif - steps = steps+1 - RETURN_(ESMF_SUCCESS) - - end subroutine modelAdvance - -#if 0 -!------------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: Finalize - user supplied finalize routine -! -! !INTERFACE: -! - subroutine Finalize(GC, IMPORT, EXPORT, CLOCK, RC) -! -! !INPUT/OUTPUT PARAMETERS: - type(ESMF_GridComp), intent(inout) :: GC ! Gridded component - type(ESMF_State), intent(inout) :: IMPORT ! Import state - type(ESMF_State), intent(inout) :: EXPORT ! Export state - type(ESMF_Clock), intent(inout) :: CLOCK ! The clock -! -! !OUTPUT PARAMETERS: - integer, optional, intent( out) :: RC ! Error code -! -! !DESCRIPTION: -! Finalize merely destroys the FVadv object that was created in Initialize -! and releases the space for the persistent data . -! -!EOP -!============================================================================= -!BOC -! !LOCAL VARIABLES: - - character(len=ESMF_MAXSTR) :: IAm - integer :: STATUS - character(len=ESMF_MAXSTR) :: COMP_NAME - -! Get my name and set-up traceback handle -! --------------------------------------- - - Iam = 'Finalize' - call ESMF_GridCompGet( GC, NAME=COMP_NAME, RC=STATUS ) - VERIFY_(STATUS) - Iam = trim(COMP_NAME) // TRIM(Iam) - - ! Clean up FV if AdvCore is running without FV3_DynCoreIsRunning - !-------------------------------------------------- - if (.NOT. FV3_DynCoreIsRunning) then - call fv_end(FV_Atm) - endif - - call MAPL_GenericFinalize(GC, IMPORT, EXPORT, CLOCK, RC) - VERIFY_(STATUS) - - RETURN_(ESMF_SUCCESS) - end subroutine Finalize -#endif - -subroutine global_integral (QG,Q,PLE,IM,JM,KM,NQ) - - real(FVPRC), intent(OUT) :: QG(NQ) - real(FVPRC), intent(IN) :: Q(IM,JM,KM,NQ) - real(FVPRC), intent(IN) :: PLE(IM,JM,KM+1) - integer, intent(IN) :: IM,JM,KM,NQ -! Locals - integer :: k,n - real(REAL8), allocatable :: dp(:,:,:) - real(FVPRC), allocatable :: qsum1(:,:) - - allocate( dp(im,jm,km) ) - allocate( qsum1(im,jm) ) - -! Compute Pressure Thickness -! -------------------------- - do k=1,KM - dp(:,:,k) = PLE(:,:,k+1)-PLE(:,:,k) - enddo - -! Loop over Tracers -! ----------------- - do n=1,NQ - qsum1(:,:) = 0.d0 - do k=1,KM - qsum1(:,:) = qsum1(:,:) + Q(:,:,k,n)*dp(:,:,k) - enddo - qg(n) = g_sum(FV_Atm(1)%domain, qsum1, is,ie, js,je, FV_Atm(1)%ng, FV_Atm(1)%gridstruct%area_64, 1, .true.) - enddo - - deallocate( dp ) - deallocate( qsum1 ) - -end subroutine global_integral - -!EOC -!------------------------------------------------------------------------------ - -end module ADVCORE diff --git a/GeosCtmProto/ctm.F90 b/GeosCtmProto/ctm.F90 deleted file mode 100644 index 4cc90d61..00000000 --- a/GeosCtmProto/ctm.F90 +++ /dev/null @@ -1,872 +0,0 @@ -#include "MAPL_Generic.h" -#define PRINT_STATES - -!------------------------------------------------------------------------- -! NASA/GSFC, Software Systems Support Office, Code 610.3 ! -!------------------------------------------------------------------------- -!BOP - -! !MODULE: CTM -- A Module to combine Chemistry, -! advCore (Transport), Convection and -! Diffusion Gridded Components -! -! !INTERFACE: -! - module CTM -! -! !USES: - use ESMF - use MAPL_Mod - use NUOPC - use NUOPC_Driver, driver_routine_SS => SetServices - use NUOPC_Connector, only : cplSS => SetServices - use ENVCTM, only : EctmSetServices => SetServices - use ADVCORE, only : AdvCSetServices => SetServices - use PTRACER, only : pTraSetServices => SetServices -! - implicit none - private -! -! !PUBLIC MEMBER FUNCTIONS: - - public SetServices - -! -! !DESCRIPTION: -! This gridded component (GC) combines Transport (AdvCore), -! Convection, GEOSchem, and Diffusion GCs into a new -! composite GEOSctm GC. -! The friendly tracers are variables from GEOSchem. -! -! \paragraph{Runnng the Code:} -! -! The code acn be run in two main configurations: -! \begin{enumerate} -! \item \textbf{Passive Tracer Run:} This experiment is done to verify how well -! AdvCore transports the tracers. We want to find out if the advection -! module conserves the mass of each tracer over time. To carry out this -! experiment, you need to initialize the tracers. This can be done in -! two possibe ways: -! \begin{enumerate} -! \item Idealized tracers which concentrations are computed in the -! initialize method of the pTracer component. To select this -! option, set \emph{do\_AdvColdStart: T} in the resource file -! \texttt{pTracer\_GridComp.rc}. -! \item User provided restart file (on the cubed sphere grid) with -! concentration of each tracer. -! \end{enumerate} -! \item \textbf{ Chemistry Run:} Here we exercise any Chemistry configuration -! (GOCART, GMI, GEOS CHEM). -! We have the option to determine if we want to do Convection and/or -! Diffusion by setting the variables \emph{do\_ctmConvection} and -! \emph{do\_ctmDiffusion} in the resource file \texttt{CTM\_GridComp.rc}. -! \end{enumerate} -! -! \paragraph{External Data Files:} -! -! To run this code, you need to have data files that have at least -! the following variables: -! -! \begin{description} -! \item[PLE]: edge pressure -! \item[U]: eastward wind -! \item[V]: northward wind -! \item[ZLE]: geopotential height -! \item[Q]: specific humidity -! \item[T]: temperatute -! \end{description} -! -! The above variables are required to for passive tracer experiments. -! More variables should be provided for other experiments. -! Regarless of the type of run you choose to carry out, you will need -! to edit a resource file (named \texttt{MAPL_ExtData_state.rc}) that -! lists (among other information) each variable and the external file -! which contains the variable. -! -! -!EOP -!------------------------------------------------------------------------------ - - logical :: enable_pTracers = .FALSE. - logical :: do_ctmConvection = .FALSE. - logical :: do_ctmDiffusion = .FALSE. - character(len=ESMF_MAXSTR) :: metType ! MERRA2 or MERRA1 or FPIT - -!------------------------------------------------------------------------------ - contains -!------------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: SetServices -- Sets ESMF services for this component -! -! !INTERFACE: -! - subroutine SetServices ( GC, RC ) -! -! !INPUT/OUTPUT PARAMETERS: - type(ESMF_GridComp) :: GC ! gridded component -! -! !OUTPUT PARAMETERS: - integer, intent( OUT) :: RC ! return code -! -! !DESCRIPTION: -! The SetServices for the GEOSctm GC needs to register its -! Initialize and Run. It uses the MAPL\_Generic construct for defining -! state specs and couplings among its children. In addition, it creates the -! children GCs (CHEM, Diffusion, Convection, advCore) and runs their -! respective SetServices. -!EOP -!------------------------------------------------------------------------------ -!BOC -! -! !LOCAL VARIABLES: - integer :: STATUS - integer :: I - character(len=ESMF_MAXSTR) :: COMP_NAME - character(len=ESMF_MAXSTR) :: IAm = 'SetServices' - - ! Get my name and set-up traceback handle - ! --------------------------------------- - RC=ESMF_SUCCESS - - Iam = 'SetServices' - call ESMF_GridCompGet( GC, NAME=COMP_NAME, RC=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - Iam = trim(COMP_NAME) // "::" // Iam - - call ESMF_LogWrite(Iam, ESMF_LOGMSG_INFO, rc=rc) - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(GC, driver_routine_SS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! Register services for this component - ! ------------------------------------ - - ! attach specializing method(s) - call NUOPC_CompSpecialize(GC, specLabel=label_SetModelServices, & - specRoutine=SetModelServices, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call NUOPC_CompSpecialize(GC, specLabel=label_SetRunSequence, & - specRoutine=SetRunSequence, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - -#if 0 - call NUOPC_CompSetEntryPoint (GC, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv02p2"/), userRoutine=Initialize, RC=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call NUOPC_CompSetEntryPoint (GC, ESMF_METHOD_RUN, & - phaseLabelList=(/'RunPhase1'/), userRoutine=Run, RC=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - -#endif - - return - end subroutine SetServices - - !----------------------------------------------------------------------------- - - subroutine SetModelServices(GC, rc) - type(ESMF_GridComp) :: GC - integer, intent(out) :: rc - - type (ESMF_Config) :: configFile - CHARACTER(LEN=ESMF_MAXSTR) :: rcfilen = 'CTM_GridComp.rc' - CHARACTER(LEN=ESMF_MAXSTR) :: rootfile - type (ESMF_CplComp) :: conn - type (ESMF_GridComp) :: comp - integer :: i - - rc = ESMF_SUCCESS - - call ESMF_LogWrite("CTM::SetModelServices", ESMF_LOGMSG_INFO, rc=rc) - - ! Choose children to birth and which children not to conceive - ! ----------------------------------------------------------- - configFile = ESMF_ConfigCreate(rc=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_ConfigLoadFile(configFile, TRIM(rcfilen), rc=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_ConfigGetAttribute(configFile, enable_pTracers, & - Default = .FALSE., & - Label = "ENABLE_pTracers:", rc=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_ConfigGetAttribute(configFile, do_ctmConvection, & - Default = .FALSE., & - Label = "do_ctmConvection:", rc=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_ConfigGetAttribute(configFile, do_ctmDiffusion, & - Default = .FALSE., & - Label = "do_ctmDiffusion:", rc=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! Type of meteological fields (MERRA2 or MERRA1 or FPIT) - call ESMF_ConfigGetAttribute(configFile, metType, & - Default = 'MERRA2', & - Label = "metType:", rc=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - IF ( MAPL_am_I_root() ) THEN - PRINT* - PRINT*, "---------------------------------------------------" - PRINT*, "----- GEOS CTM Settings -----" - PRINT*, "---------------------------------------------------" - PRINT*,' Doing Passive Tracer?: ', enable_pTracers - PRINT*,' Convection: ', do_ctmConvection - PRINT*,' Diffusion: ', do_ctmDiffusion - PRINT*,' Meteological Fields: ', TRIM(metType) - PRINT*, "---------------------------------------------------" - PRINT* - END IF - - ! ----------------------------------------------------------------- - ! Create children`s gridded components and invoke their SetServices - ! ----------------------------------------------------------------- - - call ESMF_GridCompGet(GC, configFile=rootfile, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - print *, 'CTM config file:', trim(rootfile) - IF (enable_pTracers) THEN - ! Doing passive tracer experiment - !-------------------------------- - call NUOPC_DriverAddComp(GC, 'CTMenv', EctmSetServices, & - comp=comp, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_GridCompSet(comp, configfile=trim(rootfile), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call NUOPC_DriverAddComp(GC, 'DYNAMICS', AdvCSetServices, & - comp=comp, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_GridCompSet(comp, configfile=trim(rootfile), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call NUOPC_DriverAddComp(GC, 'PTRACERS', pTraSetServices, & - comp=comp, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_GridCompSet(comp, configfile=rootfile, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! Add connectors to connect the components - ! ECTM -> ADVCORE - call NUOPC_DriverAddComp(GC, srcCompLabel="CTMenv", dstCompLabel="DYNAMICS", & - compSetServicesRoutine=cplSS, comp=conn, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompAttributeSet(conn, name="Verbosity", value="65521", & - rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! Add connectors to connect the components - ! ADVCORE -> ECTM - call NUOPC_DriverAddComp(GC, srcCompLabel="DYNAMICS", dstCompLabel="CTMenv", & - compSetServicesRoutine=cplSS, comp=conn, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompAttributeSet(conn, name="Verbosity", value="65521", & - rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! Add connectors to connect the components - ! ECTM -> PTRACER - call NUOPC_DriverAddComp(GC, srcCompLabel="CTMenv", dstCompLabel="PTRACERS", & - compSetServicesRoutine=cplSS, comp=conn, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompAttributeSet(conn, name="Verbosity", value="65521", & - rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! Add connectors to connect the components - ! PTRACERS -> ADVCORE - ! This is the friendly fields TRACER_Q00 to Q04from PTRACER to the fieldbundle TRADV - call NUOPC_DriverAddComp(GC, srcCompLabel="PTRACERS", dstCompLabel="DYNAMICS", & - compSetServicesRoutine=cplSS, comp=conn, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompAttributeSet(conn, name="Verbosity", value="65521", & - rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! Add connectors to connect the components - ! ADVCORE -> PTRACERS - call NUOPC_DriverAddComp(GC, srcCompLabel="DYNAMICS", dstCompLabel="PTRACERS", & - compSetServicesRoutine=cplSS, comp=conn, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompAttributeSet(conn, name="Verbosity", value="65521", & - rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - END IF - -#if 0 - call MAPL_TimerAdd(GC, name="INITIALIZE" ,RC=rc) - VERIFY_(STATUS) - - call MAPL_TimerAdd(GC, name="RUN" ,RC=rc) - VERIFY_(STATUS) - - ! ------------------------------- - ! Connectivities between Children - ! ------------------------------- - CALL MAPL_AddConnectivity ( GC, & - SHORT_NAME = (/'AREA'/), & - DST_ID = ECTM, SRC_ID = ADV3, __RC__ ) - - CALL MAPL_AddConnectivity ( GC, & - SRC_NAME = (/ 'CXr8 ', 'CYr8 ', 'MFXr8 ', 'MFYr8 ', 'PLE0r8', 'PLE1r8' /), & - DST_NAME = (/ 'CX ', 'CY ', 'MFX ', 'MFY ', 'PLE0 ', 'PLE1 ' /), & - DST_ID = ADV3, SRC_ID = ECTM, __RC__ ) - CALL MAPL_TerminateImport ( GC, & - SHORT_NAME = (/'TRADV'/), & - CHILD = ADV3, __RC__ ) - - - IF (enable_pTracers) THEN - CALL MAPL_AddConnectivity ( GC, & - SHORT_NAME = (/'AREA'/), & - DST_ID = PTRA, SRC_ID = ADV3, __RC__ ) - - CALL MAPL_AddConnectivity ( GC, & - SHORT_NAME = (/'PLE'/), & - DST_ID = PTRA, SRC_ID = ECTM, __RC__ ) - END IF - - call MAPL_GenericSetServices ( GC, RC=STATUS ) - VERIFY_(STATUS) -#endif - -! Move grid creation code from Initialize to here - call Initialize(GC, RC) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - RETURN - - end subroutine SetModelServices - - subroutine SetRunSequence(driver, rc) - type(ESMF_GridComp) :: driver - integer, intent(out) :: rc - - ! local variables - character(ESMF_MAXSTR) :: name - type(ESMF_Config) :: config - type(NUOPC_FreeFormat) :: runSeqFF - - rc = ESMF_SUCCESS - - ! query the Component for info - call ESMF_GridCompGet(driver, name=name, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - - ! read free format run sequence from config - call ESMF_GridCompGet(driver, config=config, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - - runSeqFF = NUOPC_FreeFormatCreate(config, label="runSeq::", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - -#if 0 - call NUOPC_FreeFormatPrint(runSeqFF, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out -#endif - - ! ingest FreeFormat run sequence - call NUOPC_DriverIngestRunSequence(driver, runSeqFF, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - -#if 0 - ! Diagnostic output - call NUOPC_DriverPrint(driver, orderflag=.true., rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out -#endif - - ! clean-up - call NUOPC_FreeFormatDestroy(runSeqFF, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - - end subroutine - -!EOC -!------------------------------------------------------------------------------ -!BOP -! !IROUTINE: Initialize -- Initialize method for the GEOS CTM Gridded Component -! -! !INTERFACE: -! - subroutine Initialize ( GC, RC ) -! -! !INPUT/OUTPUT PARAMETERS: - type(ESMF_GridComp), intent(inout) :: GC ! Gridded component -! type(ESMF_State) :: IMPORT -! type(ESMF_State) :: EXPORT -! type(ESMF_Clock) :: CLOCK - -! !INPUT/OUTPUT PARAMETERS: - integer, intent( out) :: RC ! Error code - -! !DESCRIPTION: -! The Initialize method of the GEOS CTM Gridded Component. -! It acts as a driver for the initializtion of the four children: -! GEOSchem, advCore, Diffusion and Convection. -! It also sets up the frieldly connections between the children. -!EOP -!------------------------------------------------------------------------------ -!BOC -! -! !LOCAL VARIABLES: - integer :: STATUS - type (ESMF_Config) :: CF - type (ESMF_FieldBundle) :: BUNDLE, iBUNDLE - type (ESMF_Field) :: FIELD - type (ESMF_State) :: DUMMY - type (ESMF_Grid) :: grid - type (ESMF_GridComp), pointer :: childcomp(:) - integer :: NUM_TRACERS - integer :: I - integer :: NA - character(len=ESMF_MAXSTR), pointer :: NAMES(:) - character(len=ESMF_MAXSTR) :: myNAME - character(len=ESMF_MAXSTR) :: iNAME - character(len=ESMF_MAXSTR) :: COMP_NAME - type(ESMF_Config) :: config - character(len=ESMF_MAXSTR) :: IAm = "Initialize" - integer(ESMF_KIND_I4) :: heartbeat_dt - integer(ESMF_KIND_I4) :: dt - logical :: existDT - - - ! Get the target components name and set-up traceback handle. - ! ----------------------------------------------------------- - - RC = ESMF_SUCCESS - - call ESMF_GridCompGet ( GC, name=COMP_NAME, RC=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - Iam = trim(COMP_NAME) // "::" // TRIM(Iam) - call ESMF_LogWrite(Iam, ESMF_LOGMSG_INFO, rc=rc) - - !call MAPL_TimerOn(STATE,"TOTAL") - !call MAPL_TimerOn(STATE,"INITIALIZE") - - call ESMF_GridCompGet ( GC, config=config, RC=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_ConfigFindLabel(config, "RUN_DT:", isPresent=existDT, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - if (existDT) then - call ESMF_ConfigGetAttribute(config, dt, & - Label = "RUN_DT:", rc=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - else - call ESMF_ConfigGetAttribute(config, heartbeat_dt, & - Label = "HEARTBEAT_DT:", rc=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - dt = heartbeat_dt - call ESMF_ConfigSetAttribute(config, dt, & - Label = "RUN_DT:", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - endif - - ! Create grid for this GC - !------------------------ - call My_GridCreate (GC, rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! Set the children component's grid to be parent's grid - ! also pass the vertical layer information down to child components by setting it as an - ! attribute to the component. - call ESMF_GridCompGet(GC, grid=grid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - nullify(childcomp) - call NUOPC_DriverGetComp(GC, compList=childcomp, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - do i=1, size(childcomp) - call ESMF_GridCompSet(childcomp(i), grid=grid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - !!! Set dt as RUN_DT to children component's attribute - call ESMF_AttributeSet(childcomp(i), "RUN_DT:", dt, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - enddo - - ! Call Initialize for every Child - !-------------------------------- - ! call MAPL_GenericInitialize ( GC, IMPORT, EXPORT, CLOCK, RC=rc) - ! VERIFY_(STATUS) - - - -#if DOMAPL - ! Get children and their im/ex states from my generic state. - !---------------------------------------------------------- - - !call MAPL_Get ( STATE, GCS=GCS, GIM=GIM, GEX=GEX, RC=STATUS ) - !VERIFY_(STATUS) - - ! Extract the friendly tracers - !----------------------------- - IF (enable_pTracers) THEN - !---------------- - ! AdvCore Tracers - !---------------- - call ESMF_StateGet (GIM(ADV3), 'TRADV', BUNDLE, RC=STATUS ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call MAPL_GridCompGetFriendlies(GCS(PTRA), "DYNAMICS", BUNDLE, RC=STATUS ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - -#ifdef PRINT_STATES - call WRITE_PARALLEL ( trim(Iam)//": AdvCore Tracer Bundle" ) - if ( MAPL_am_I_root() ) call ESMF_FieldBundlePrint ( BUNDLE, rc=STATUS ) -#endif - - call ESMF_FieldBundleGet(BUNDLE,FieldCount=NUM_TRACERS, RC=STATUS) - VERIFY_(STATUS) - - ! Get the names of all tracers to fill other turbulence bundles. - !--------------------------------------------------------------- - - allocate(NAMES(NUM_TRACERS),STAT=STATUS) - VERIFY_(STATUS) - - call ESMF_FieldBundleGet(BUNDLE, fieldNameList=NAMES, RC=STATUS) - VERIFY_(STATUS) - - ENDIF -#endif - -#if 0 - call MAPL_TimerOff(STATE,"INITIALIZE") - call MAPL_TimerOff(STATE,"TOTAL") -#endif - ! All Done - !--------- - - RETURN - - end subroutine Initialize - - -! Mimicking the MAPL_GridCreate() by using the grid definition in the config file, example: -! NX: 4 -! NY: 24 -! GEOSCTM_IM: 48 -! GEOSCTM_JM: 288 -! LM: 72 -! GRIDNAME: PE48x288-CF - -subroutine My_GridCreate(GC, rc) - use CubedSphereGridFactoryMod, only: CubedSphereGridFactory - use MAPL_GridManagerMod, only: grid_manager - - type(ESMF_GridComp) :: GC - integer :: rc - - ! local variables - type(ESMF_Config) :: config - integer :: NX, NY - character(len=ESMF_MAXSTR) :: Gridname - type (ESMF_Grid) :: GRID - integer :: IM_WORLD, val - integer :: JM_WORLD - integer :: LM,L,NN - character(len=4) :: imsz - character(len=5) :: jmsz - character(len=2) :: date - character(len=2) :: pole - integer, allocatable :: regDecomp(:,:) - type(CubedSphereGridFactory) :: factory - - rc = ESMF_SUCCESS - - call ESMF_GridCompGet(GC, config=config, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_ConfigGetAttribute(config, value=NX, label='NX:', rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_ConfigGetAttribute(config, value=NY, label='NY:', rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_ConfigGetAttribute(config, value=Gridname, label='GRIDNAME:', rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_ConfigGetAttribute(config, value=LM, label='LM:', default=1, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - Gridname = AdjustL(Gridname) - nn = len_trim(Gridname) - imsz = Gridname(3:index(Gridname,'x')-1) - jmsz = Gridname(index(Gridname,'x')+1:nn-3) - pole = Gridname(1:2) - date = Gridname(nn-1:nn) - - read(IMSZ,*) IM_WORLD - read(JMSZ,*) JM_WORLD - -! The new code set NY=NX - ! date='CF' for cubed sphere - if (date=='CF' .or. date=='DP') then -#if 1 - ! make sure NY is divisble by 6 and JM_WORLD is IM_WORLD*6 - if (mod(NY, 6) /= 0) then - call ESMF_LogSetError(ESMF_RC_ARG_BAD, msg='NY has to be multiple of 6', & - line=__LINE__, & - file=__FILE__, rcToReturn=rc) - return - endif - ! change NY value in the config to be NY/6 - call ESMF_ConfigSetAttribute(config, value=NY/6, label='NY:', rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - -#endif - -#if 0 - ! Need "IM_WORLD:" in the config, but the following code does not work. - ! Somehow the standalone test program works (adding a new attribute in the - ! config) So, as a workaround, I added IM_WORLD: 48 in GEOSCTM.rc - - call ESMF_ConfigSetAttribute(config, value=IM_WORLD, label='IM_WORLD:', rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_ConfigGetAttribute(config, value=val, label='IM_WORLD:', rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! print *, 'IM_WORLD:', val -#endif - - ! Register to the MAPL GridManager and MAPL RegridderManager - call register_grid_and_regridders() - ! create ESMF cubed sphere grid using the new MAPL and FV3 code - grid = grid_manager%make_grid(config, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - -#if 0 - allocate(regDecomp(2,6)) - regDecomp(1,:)=NX - regDecomp(2,:)=NY/6 - !print *, regDecomp(:,1), IM_WORLD, trim(Gridname) - grid = ESMF_GridCreateCubedSphere(IM_WORLD, regDecompPTile = regDecomp, & - staggerLocList=(/ESMF_STAGGERLOC_CENTER, ESMF_STAGGERLOC_CORNER/), & - name=trim(Gridname), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_AttributeSet(grid, name='GRID_LM', value=LM, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_AttributeSet(grid, name='GridType', value='Cubed-Sphere', rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - -#endif - endif - - ! Set grid to the GridComp - call ESMF_GridCompSet(GC, grid=grid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - return -end subroutine My_GridCreate - - subroutine register_grid_and_regridders() - use MAPL_GridManagerMod, only: grid_manager - use MAPL_RegridderManagerMod, only: regridder_manager - use MAPL_RegridderSpecMod, only: REGRID_METHOD_BILINEAR - use CubedSphereGridFactoryMod, only: CubedSphereGridFactory - use LatLonToCubeRegridderMod - use CubeToLatLonRegridderMod - use CubeToCubeRegridderMod - - type (CubedSphereGridFactory) :: factory - - type (CubeToLatLonRegridder) :: cube_to_latlon_prototype - type (LatLonToCubeRegridder) :: latlon_to_cube_prototype - type (CubeToCubeRegridder) :: cube_to_cube_prototype - - call grid_manager%add_prototype('Cubed-Sphere',factory) - associate (method => REGRID_METHOD_BILINEAR, mgr => regridder_manager) - call mgr%add_prototype('Cubed-Sphere', 'LatLon', method, cube_to_latlon_prototype) - call mgr%add_prototype('LatLon', 'Cubed-Sphere', method, latlon_to_cube_prototype) - call mgr%add_prototype('Cubed-Sphere', 'Cubed-Sphere', method, cube_to_cube_prototype) - end associate - - end subroutine register_grid_and_regridders - - -!EOC -!------------------------------------------------------------------------------ - end module CTM diff --git a/GeosCtmProto/ctmApp.F90 b/GeosCtmProto/ctmApp.F90 deleted file mode 100644 index 6af19ba3..00000000 --- a/GeosCtmProto/ctmApp.F90 +++ /dev/null @@ -1,110 +0,0 @@ -program ctmApp - -! ********************************************************************* -! ***** Main Program **** -! ***** GEOS-5 as a CTM **** -! ********************************************************************* - -#define I_AM_MAIN - - use ESMF - !use MAPL_Mod - use driverCTM, only: ROOT_SetServices => SetServices - - implicit none - - integer :: rc, urc - logical :: am_I_root - - character(len=*), parameter :: Iam = 'GEOSctm_App' - - type(ESMF_GridComp) :: driver - - ! Initialize ESMF - call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, & - defaultCalkind=ESMF_CALKIND_GREGORIAN, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - call ESMF_LogSet(flush=.true., rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - call ESMF_LogWrite("ctmApp STARTING", ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - ! Create the driver Component - driver = ESMF_GridCompCreate(name="driver", configfile = 'CAP.rc', rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - ! SetServices for the earth system Component - call ESMF_GridCompSetServices(driver, ROOT_SetServices, userRc=urc, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - ! Call Initialize for the earth system Component - call ESMF_GridCompInitialize(driver, userRc=urc, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - ! Call Run for earth the system Component - call ESMF_GridCompRun(driver, userRc=urc, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - ! Call Finalize for the earth system Component - call ESMF_GridCompFinalize(driver, userRc=urc, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - ! Destroy the earth system Component - call ESMF_GridCompDestroy(driver, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - call ESMF_LogWrite("esmApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - ! Finalize ESMF - call ESMF_Finalize() - -end program diff --git a/GeosCtmProto/driver.F90 b/GeosCtmProto/driver.F90 deleted file mode 100644 index b07de65c..00000000 --- a/GeosCtmProto/driver.F90 +++ /dev/null @@ -1,399 +0,0 @@ -module driverCTM - - !----------------------------------------------------------------------------- - ! The driver component that has three children: ExtData, CTM, and HISTORY - !----------------------------------------------------------------------------- - - use ESMF - use NUOPC - use NUOPC_Driver, driver_routine_SS => SetServices - use CTM, only: ctmSS => SetServices - use ExtData, only: extDataSS => SetServices -! use HISTORY, only: historySS => SetServices - - use NUOPC_Connector, only: cplSS => SetServices - - implicit none - - private - - public SetServices - - !----------------------------------------------------------------------------- - contains - !----------------------------------------------------------------------------- - - subroutine SetServices(driver, rc) - type(ESMF_GridComp) :: driver - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - call ESMF_LogWrite("driver SetServices", ESMF_LOGMSG_INFO, rc=rc) - - ! NUOPC_Driver registers the generic methods - call NUOPC_CompDerive(driver, driver_routine_SS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! attach specializing method(s) - call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & - specRoutine=SetModelServices, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call NUOPC_CompSpecialize(driver, specLabel=label_SetRunSequence, & - specRoutine=SetRunSequence, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - end subroutine - - !----------------------------------------------------------------------------- - - subroutine SetModelServices(driver, rc) - type(ESMF_GridComp) :: driver - integer, intent(out) :: rc - - ! local variables - type(ESMF_Time) :: startTime - type(ESMF_Time) :: stopTime - type(ESMF_TimeInterval) :: timeStep - type(ESMF_Clock) :: internalClock - integer :: petCount, i - integer :: petCountATM, petCountOCN - integer, allocatable :: petList(:) - type(ESMF_GridComp) :: comp - type(ESMF_CplComp) :: conn - type(ESMF_Config) :: config - type(ESMF_Config) :: ctmconfig - type(ESMF_Config) :: extconfig - character(len=ESMF_MAXSTR) :: hisConfigfile - character(len=ESMF_MAXSTR) :: extConfigfile - character(len=ESMF_MAXSTR) :: ctmConfigfile - character(len=ESMF_MAXSTR) :: name - logical :: AmIRoot_ - integer :: HEARTBEAT_DT - integer :: RUN_DT - - integer :: BEG_YY - integer :: BEG_MM - integer :: BEG_DD - integer :: BEG_H - integer :: BEG_M - integer :: BEG_S - - integer :: END_YY - integer :: END_MM - integer :: END_DD - integer :: END_H - integer :: END_M - integer :: END_S - - rc = ESMF_SUCCESS - - call ESMF_LogWrite("driver setModelService", ESMF_LOGMSG_INFO, rc=rc); - - ! Get config - call ESMF_GridCompGet(driver, config=config, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_ConfigGetAttribute(config, value=name, label='ROOT_NAME:',default='ROOT', rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_ConfigGetAttribute(config, value=ctmConfigfile, label='ROOT_CF:',default='ROOT.cf', rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_ConfigGetAttribute(config, value=hisConfigfile, label='HISTORY_CF:',default='HIST.rc', rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_ConfigGetAttribute(config, value=extConfigfile, label='EXTDATA_CF:',default='ExtData.rc', rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! set driver verbosity - call NUOPC_CompAttributeSet(driver, name="Verbosity", value="65521", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call NUOPC_DriverAddComp(driver, "ExtData", extDataSS, & - comp=comp, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! Set the config to be the root config as done by MAPL Cap ! -! call ESMF_GridCompSet(comp, configfile=trim(extConfigfile), rc=rc) - call ESMF_GridCompSet(comp, config=config, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call NUOPC_CompAttributeSet(comp, name="Verbosity", value="65521", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - - call NUOPC_DriverAddComp(driver, "CTM", ctmSS, & - comp=comp, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ctmconfig = ESMF_ConfigCreate(rc=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_GridCompSet(comp, configfile=TRIM(ctmConfigfile), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call NUOPC_CompAttributeSet(comp, name="Verbosity", value="65521", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - -#if 0 - ! SetServices for OCN with petList on second section of PETs - call NUOPC_DriverAddComp(driver, "HISTORY", historySS, & - comp=comp, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_GridCompSet(comp, configFile=hisConfigfile, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompAttributeSet(comp, name="Verbosity", value="65521", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#endif - - ! SetServices for ExtData to CTM - call NUOPC_DriverAddComp(driver, srcCompLabel="ExtData", dstCompLabel="CTM", & - compSetServicesRoutine=cplSS, comp=conn, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompAttributeSet(conn, name="Verbosity", value="65521", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - -#if 0 - ! SetServices for CTM to HISTORY - call NUOPC_DriverAddComp(driver, srcCompLabel="CTM", dstCompLabel="HISTORY", & - compSetServicesRoutine=cplSS, comp=conn, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompAttributeSet(conn, name="Verbosity", value="65521", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#endif - - call ESMF_ConfigGetAttribute(config, value=HEARTBEAT_DT, Label="HEARTBEAT_DT:", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call GetUnpackTime(config, "BEG_DATE:", BEG_YY, BEG_MM, BEG_DD, BEG_H, BEG_M, BEG_S, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call GetUnpackTime(config, "END_DATE:", END_YY, END_MM, END_DD, END_H, END_M, END_S, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! set the model clock - call ESMF_TimeIntervalSet(timeStep, s=HEARTBEAT_DT, rc=rc) ! 15 minute steps - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_TimeSet( startTime, YY = BEG_YY, & - MM = BEG_MM, & - DD = BEG_DD, & - H = BEG_H , & - M = BEG_M , & - S = BEG_S , & - rc = rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_TimeSet( stopTime, YY = END_YY, & - MM = END_MM, & - DD = END_DD, & - H = END_H , & - M = END_M , & - S = END_S , & - rc = rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - internalClock = ESMF_ClockCreate(name="Application Clock", & - timeStep=timeStep, startTime=startTime, stopTime=stopTime, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine SetRunSequence(driver, rc) - type(ESMF_GridComp) :: driver - integer, intent(out) :: rc - - ! local variables - character(ESMF_MAXSTR) :: name - type(ESMF_Config) :: config - type(NUOPC_FreeFormat) :: runSeqFF - - rc = ESMF_SUCCESS - - ! query the Component for info - call ESMF_GridCompGet(driver, name=name, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - - ! read free format run sequence from config - call ESMF_GridCompGet(driver, config=config, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - - runSeqFF = NUOPC_FreeFormatCreate(config, label="runSeq::", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - -#if 0 - call NUOPC_FreeFormatPrint(runSeqFF, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out -#endif - - ! ingest FreeFormat run sequence - call NUOPC_DriverIngestRunSequence(driver, runSeqFF, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - -#if 0 - ! Diagnostic output - call NUOPC_DriverPrint(driver, orderflag=.true., rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out -#endif - - ! clean-up - call NUOPC_FreeFormatDestroy(runSeqFF, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - ! Routine to get BEG_DATE and END_DATE from CAP.rc and unpack them - ! The format looks like this: - ! BEG_DATE: 18910301 000000 - ! END_DATE: 20000415 000000 - - - subroutine GetUnpackTime(config, label, YY, MM, DD, H, M, S, rc) - type(ESMF_Config) :: config - character(len=*) :: label - integer, intent( OUT) :: YY, MM, DD, H, M, S - integer :: rc - logical :: ispresent - integer :: datetime(2) - - rc=ESMF_SUCCESS - - call ESMF_ConfigFindLabel(config, label, isPresent=ispresent, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - if (.not. ispresent) then - print *, label, ' is not present' - rc=ESMF_FAILURE - return - endif - - call ESMF_ConfigGetAttribute(config, datetime(1), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_ConfigGetAttribute(config, datetime(2), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - YY = datetime(1)/10000 - MM = mod(datetime(1),10000)/100 - DD = mod(datetime(1),100) - H = datetime(2)/10000 - M = mod(datetime(2),10000)/100 - S = mod(datetime(2),100) - return - - end subroutine GetUnpackTime - -end module driverCTM diff --git a/GeosCtmProto/ectm.F90 b/GeosCtmProto/ectm.F90 deleted file mode 100644 index 3a1a410b..00000000 --- a/GeosCtmProto/ectm.F90 +++ /dev/null @@ -1,1980 +0,0 @@ -#include "MAPL_Generic.h" -!------------------------------------------------------------------------- -! NASA/GSFC, Software Systems Support Office, Code 610.3 ! -!------------------------------------------------------------------------- -!BOP -! -! !MODULE: ENVCTM -- Prepares derived variables for GEOSctm -! -! !INTERFACE: -! - module ENVCTM -! -! !USES: - use ESMF - use MAPL_mod - use NUOPC - use NUOPC_Mediator, & - model_routine_SS => SetServices -! model_label_DataInitialize => label_DataInitialize, & -! model_label_Advance => label_Advance - use NUOPC_Generic - use FV_StateMod, only : calcCourantNumberMassFlux => fv_computeMassFluxes - use m_set_eta, only : set_eta - implicit none - private - -! !PUBLIC MEMBER FUNCTIONS: - - public SetServices - public compAreaWeightedAverage - - interface compAreaWeightedAverage - module procedure compAreaWeightedAverage_2d - module procedure compAreaWeightedAverage_3d - end interface - -! -! !DESCRIPTION: -! This GC is used to derive variables needed by the CTM GC children. - -! !AUTHORS: -! Jules.Kouatchou-1@nasa.gov -! -!EOP -!------------------------------------------------------------------------- - integer, parameter :: r8 = 8 - integer, parameter :: r4 = 4 - - INTEGER, PARAMETER :: sp = SELECTED_REAL_KIND(6,30) - INTEGER, PARAMETER :: dp = SELECTED_REAL_KIND(14,300) - INTEGER, PARAMETER :: qp = SELECTED_REAL_KIND(18,400) - - real(r8), parameter :: RADIUS = MAPL_RADIUS - real(r8), parameter :: PI = MAPL_PI_R8 - real(r8), parameter :: D0_0 = 0.0_r8 - real(r8), parameter :: D0_5 = 0.5_r8 - real(r8), parameter :: D1_0 = 1.0_r8 - real(r8), parameter :: GPKG = 1000.0d0 - real(r8), parameter :: MWTAIR = 28.96d0 - real(r8), parameter :: SecondsPerMinute = 60.0d0 - - logical :: enable_pTracers = .FALSE. - character(len=ESMF_MAXSTR) :: metType ! MERRA2 or MERRA1 or FPIT - -!------------------------------------------------------------------------- - CONTAINS -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: SetServices -- Sets ESMF services for this component -! -! !INTERFACE: -! - subroutine SetServices ( GC, RC ) -! -! !INPUT/OUTPUT PARAMETERS: - type(ESMF_GridComp) :: GC ! gridded component -! -! !OUTPUT PARAMETERS: - integer, intent(OUT) :: RC ! return code -! -! !DESCRIPTION: -! The SetServices for the CTM Der GC needs to register its -! Initialize and Run. -! -!EOP -!------------------------------------------------------------------------- -!BOC -! -! !LOCAL VARIABLES: - integer :: STATUS - integer :: I - type (ESMF_Config) :: configFile - character(len=ESMF_MAXSTR) :: COMP_NAME - character(len=ESMF_MAXSTR) :: IAm = '::SetServices' - type (mystates_WRAP) :: mystates_ptr - type (my_States), pointer :: mystates - - rc = ESMF_SUCCESS - - ! Get my name and set-up traceback handle - ! --------------------------------------- - call ESMF_GridCompGet( GC, NAME=COMP_NAME, RC=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - Iam = trim(COMP_NAME) // TRIM(Iam) - - call ESMF_LogWrite(Iam, ESMF_LOGMSG_INFO, rc=rc) - - allocate(mystates) - mystates_ptr%ptr => mystates - call ESMF_UserCompSetInternalState(GC, 'MAPL_VarSpec', mystates_ptr, rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(GC, model_routine_SS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! Register services for this component - ! ------------------------------------ - ! Provide InitializeP0 to switch to custom IPD version - call ESMF_GridCompSetEntryPoint(GC, ESMF_METHOD_INITIALIZE, & - userRoutine=InitializeP0, phase=0, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(GC, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv02p1"/), userRoutine=InitAdvertise, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSetEntryPoint(GC, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv02p3"/), userRoutine=InitRealize, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call NUOPC_CompSpecialize(GC, specLabel=label_DataInitialize, & - specRoutine=dataInitialize, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_MethodRemove(GC, label=label_CheckImport,rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSpecialize(GC, specLabel=label_CheckImport, & - specRoutine=NUOPC_NoOp, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! attach specializing method(s) - ! -> NUOPC specializes by default --->>> first need to remove the default - call ESMF_MethodRemove(GC, label_SetRunClock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSpecialize(GC, specLabel=label_SetRunClock, & - specRoutine=SetRunClock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - - call NUOPC_CompSpecialize(GC, specLabel=label_Advance, & - specRoutine=ModelAdvance, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine SetServices - - !----------------------------------------------------------------------------- - - subroutine InitializeP0(gcomp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: gcomp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - call ESMF_LogWrite("dyn InitializeP0", ESMF_LOGMSG_INFO, rc=rc) - - ! Switch to IPDv02 (for datainitialize dependency loop) - ! by filtering all other phaseMap entries - call NUOPC_CompFilterPhaseMap(gcomp, ESMF_METHOD_INITIALIZE, & - acceptStringList=(/"IPDv02p"/), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - subroutine InitAdvertise(GC, importState, exportState, clock, rc) - type(ESMF_GridComp) :: GC - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - - CHARACTER(LEN=ESMF_MAXSTR) :: rcfilen = 'CTM_GridComp.rc' - character(len=ESMF_MAXSTR) :: IAm = 'SetServices' - type(ESMF_Config) :: configFile - type(mystates_wrap) :: mystates_ptr - type(MAPL_VarSpec), pointer :: importSpec(:), exportSpec(:) - character(len=ESMF_MAXSTR) :: short_name, long_name - character(len=ESMF_MAXSTR) :: units - integer :: i - - rc = ESMF_SUCCESS - - call ESMF_LogWrite("ECTM:InitAdvertise", ESMF_LOGMSG_INFO, rc=rc) - - configFile = ESMF_ConfigCreate(rc=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_ConfigLoadFile(configFile, TRIM(rcfilen), rc=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_ConfigGetAttribute(configFile, enable_pTracers, & - Default = .FALSE., & - Label = "ENABLE_pTracers:", rc=rc ) - - ! Type of meteological fields (MERRA2 or MERRA1 or FPIT) - call ESMF_ConfigGetAttribute(configFile, metType, & - Default = 'MERRA2', & - Label = "metType:", rc=rc ) - -! !IMPORT STATE: - - call NUOPC_AddImportSpec(GC, & - SHORT_NAME = 'AREA', & - LONG_NAME = 'agrid_cell_area', & - UNITS = 'm+2', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, RC=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - - call NUOPC_AddImportSpec ( GC, & - SHORT_NAME = 'PLE0', & - LONG_NAME = 'pressure_at_layer_edges_before_advection', & - UNITS = 'Pa', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationEdge, RC=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - - call NUOPC_AddImportSpec ( GC, & - SHORT_NAME = 'PLE1', & - LONG_NAME = 'pressure_at_layer_edges_after_advection', & - UNITS = 'Pa', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationEdge, RC=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call NUOPC_AddImportSpec ( GC, & - SHORT_NAME = 'UC0', & - LONG_NAME = 'eastward_wind_on_C-Grid_before_advection', & - UNITS = 'm s-1', & - STAGGERING = MAPL_CGrid, & - ROTATION = MAPL_RotateCube, & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, RC=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - - call NUOPC_AddImportSpec ( GC, & - SHORT_NAME = 'UC1', & - LONG_NAME = 'eastward_wind_on_C-Grid_after_advection', & - UNITS = 'm s-1', & - STAGGERING = MAPL_CGrid, & - ROTATION = MAPL_RotateCube, & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, RC=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - - call NUOPC_AddImportSpec ( GC, & - SHORT_NAME = 'VC0', & - LONG_NAME = 'northward_wind_on_C-Grid_before_advection', & - UNITS = 'm s-1', & - STAGGERING = MAPL_CGrid, & - ROTATION = MAPL_RotateCube, & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, RC=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - - call NUOPC_AddImportSpec ( GC, & - SHORT_NAME = 'VC1', & - LONG_NAME = 'northward_wind_on_C-Grid_after_advection', & - UNITS = 'm s-1', & - STAGGERING = MAPL_CGrid, & - ROTATION = MAPL_RotateCube, & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, RC=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - !Advertize the import fields - call ESMF_UserCompGetInternalState(GC, "MAPL_VarSpec", mystates_ptr, rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - importSpec => mystates_ptr%ptr%importSpec - - do i=1,size(importSpec) - call MAPL_VarSpecGet(importSpec(i), SHORT_NAME=short_name, & - UNITS=units, LONG_NAME=long_name,rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_Advertise(importState, & - StandardName=long_name, name=short_name, units = units, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - !print *, 'ECTM: advertise import field ', long_name - - end do - -! !EXPORT STATE: - - ! Default exports - !---------------- - call NUOPC_AddExportSpec ( GC, & - SHORT_NAME = 'CXr8', & - LONG_NAME = 'eastward_accumulated_courant_number', & - UNITS = '1', & - PRECISION = ESMF_KIND_R8, & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, RC=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - - call NUOPC_AddExportSpec ( GC, & - SHORT_NAME = 'CYr8', & - LONG_NAME = 'northward_accumulated_courant_number', & - UNITS = '1', & - PRECISION = ESMF_KIND_R8, & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, RC=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - - call NUOPC_AddExportSpec ( GC, & - SHORT_NAME = 'MFXr8', & -! name inconsistent with the name used in ADVCORE -! LONG_NAME = 'pressure_weighted_accumulated_eastward_mass_flux', & - LONG_NAME = 'pressure_weighted_eastward_mass_flux', & - UNITS = 'Pa m+2 s-1', & - PRECISION = ESMF_KIND_R8, & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, RC=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - - call NUOPC_AddExportSpec ( GC, & - SHORT_NAME = 'MFYr8', & -! name inconsistent with the name used in ADVCORE -! LONG_NAME = 'pressure_weighted_accumulated_northward_mass_flux', & - LONG_NAME = 'pressure_weighted_northward_mass_flux', & - UNITS = 'Pa m+2 s-1', & - PRECISION = ESMF_KIND_R8, & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, RC=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - - call NUOPC_AddExportSpec ( GC, & - SHORT_NAME = 'PLE1r8', & - LONG_NAME = 'pressure_at_layer_edges_after_advection', & - UNITS = 'Pa', & - PRECISION = ESMF_KIND_R8, & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationEdge, RC=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - - call NUOPC_AddExportSpec ( GC, & - SHORT_NAME = 'PLE0r8', & - LONG_NAME = 'pressure_at_layer_edges_before_advection', & - UNITS = 'Pa', & - PRECISION = ESMF_KIND_R8, & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationEdge, RC=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - - call NUOPC_AddExportSpec ( GC, & - SHORT_NAME = 'PLE', & - LONG_NAME = 'pressure_at_layer_edges', & - UNITS = 'Pa', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationEdge, RC=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - - call NUOPC_AddExportSpec ( GC, & - SHORT_NAME = 'TH', & - LONG_NAME = 'potential_temperature', & - UNITS = 'K', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, RC=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - - call NUOPC_AddExportSpec(GC, & - SHORT_NAME = 'AIRDENS', & - LONG_NAME = 'air_density', & - UNITS = 'kg m-3', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, RC=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call NUOPC_AddExportSpec(GC, & - SHORT_NAME = 'LWI', & - LONG_NAME = 'land-ocean-ice_mask', & - UNITS = '1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call NUOPC_AddExportSpec(GC, & - SHORT_NAME = 'MASS', & - LONG_NAME = 'total_mass', & - UNITS = 'kg', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, RC=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - IF ( TRIM(metType) == 'MERRA1' ) THEN - call NUOPC_AddExportSpec(GC, & - SHORT_NAME = 'RH2', & - LONG_NAME = 'relative_humidity_after_moist', & - UNITS = '1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RC=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - END IF - - call NUOPC_AddExportSpec(GC, & - SHORT_NAME = 'ZLE', & - LONG_NAME = 'geopotential_height', & - UNITS = 'm', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationEdge, RC=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - !Advertize the export fields - exportSpec => mystates_ptr%ptr%exportSpec - - do i=1,size(exportSpec) - call MAPL_VarSpecGet(exportSpec(i), SHORT_NAME=short_name, LONG_NAME=long_name, & - units = units, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! use long_name for both StandardName and name as a workaround - call NUOPC_Advertise(exportState, & - StandardName=long_name, name=short_name, Units=units, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - !print *, 'ECTM: advertise export field ', long_name - end do - -#if 0 - ! Set the Profiling timers - !------------------------- - call MAPL_TimerAdd(GC, name="INITIALIZE" ,RC=rc) - - call MAPL_TimerAdd(GC, name="RUN" ,RC=rc) -#endif - - ! Create children's gridded components and invoke their SetServices - ! ----------------------------------------------------------------- - !call MAPL_GenericSetServices ( GC, RC=rc ) - !VERIFY_(rc) - - call ESMF_ConfigDestroy(configfile, rc=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - RETURN_(ESMF_SUCCESS) - - end subroutine initAdvertise -! -!EOC -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: InitRealize -- Initialized method for composite the CTMder -! -! !INTERFACE: -! - subroutine InitRealize(GC, importState, exportState, clock, rc) - type(ESMF_GridComp) :: GC - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc -! -! !DESCRIPTION: -! The Initialize method of the CTM Cinderella Component. -! -!EOP -!------------------------------------------------------------------------- -!BOC -! -! !LOCAL VARIABLES: - __Iam__('Initialize') - character(len=ESMF_MAXSTR) :: COMP_NAME - type(ESMF_Grid) :: esmfGrid - type(mystates_wrap) :: mystates_ptr - type(MAPL_VarSpec), pointer :: importSpec(:) - type(MAPL_VarSpec), pointer :: exportSpec(:) - - ! Get my name and set-up traceback handle - ! --------------------------------------- - call ESMF_GridCompGet( GC, NAME=COMP_NAME, GRID=esmfGrid, RC=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - Iam = TRIM(COMP_NAME)//"::InitRealize" - - call ESMF_LogWrite("ECTM:InitRealize", ESMF_LOGMSG_INFO, rc=rc) - - !call MAPL_TimerOn(ggSTATE,"TOTAL") - !call MAPL_TimerOn(ggSTATE,"INITIALIZE") - - !Get VarSpec info - call ESMF_UserCompGetInternalState(GC, "MAPL_VarSpec", mystates_ptr, rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - importSpec => mystates_ptr%ptr%importSpec - exportSpec => mystates_ptr%ptr%exportSpec - - ! Create the fields in the import and export state - !--------------------------------- - ! realize connected Fields in the importState - call realizeConnectedFields(importState, importSpec, esmfGrid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! realize connected Fields in the importState - call realizeConnectedFields(exportState, exportSpec, esmfGrid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - if ( MAPL_am_I_root() ) then - print *, trim(Iam)//": IMPORT State" - call ESMF_StatePrint ( importState) - print *, trim(Iam)//": EXPORT State" - call ESMF_StatePrint ( exportState ) - end if - - contains !-------------------------------------------------------- - - subroutine realizeConnectedFields(state, spec, grid, rc) - ! TODO: this method may move into the NUOPC_ utility layer - type(ESMF_State) :: state - type(MAPL_VarSpec), pointer :: spec(:) - type(ESMF_Grid) :: grid - integer, intent(out), optional :: rc - ! local variables - character(len=ESMF_MAXSTR) :: fieldName - character(len=ESMF_MAXSTR) :: name - integer :: i, itemCount, k - type(ESMF_Field) :: field - real(ESMF_KIND_R8), pointer :: fptr(:) - - if (present(rc)) rc = ESMF_SUCCESS - - itemCount=size(spec) - - k=1 ! initialize - do i=1, itemCount - ! find the VarSpec with matching long_name - call MAPL_VarSpecGet(spec(i),LONG_NAME=fieldName, SHORT_NAME=name, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call MAPL_VarSpecSet(spec(i), GRID=grid,rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - if (NUOPC_IsConnected(state, fieldName=name)) then - ! create a Field - field = NUOPC_FieldCreateFromSpec(spec(i),rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! realize the connected Field using the just created Field - call NUOPC_Realize(state, field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - else - ! remove a not connected Field from State - call ESMF_StateRemove(state, (/name/), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - if ( MAPL_am_I_root() ) then - print *, 'ECTM Remove field ', name - endif - endif - enddo - - end subroutine realizeConnectedFields - - end subroutine initRealize - -!---------------------------------------------------------------------- - subroutine dataInitialize ( GC, RC ) -! - type(ESMF_GridComp) :: GC ! Gridded component - integer, intent( out) :: RC ! Error code -! - - ! local variables - type(ESMF_Clock) :: clock - type(ESMF_State) :: importState, exportState - - RC = ESMF_SUCCESS - call ESMF_LogWrite("ECTM:dataInitialize", ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! query the Component for its clock, importState and exportState - !call NUOPC_ModelGet(GC, modelClock=clock, importState=importState, & - call ESMF_GridCompGet(GC, clock=clock, importState=importState, & - exportState=exportState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! must explicitly set time stamp on all export fields - call NUOPC_SetTimestamp(exportState, clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! indicate that data initialization is complete (breaking out of init-loop) - call NUOPC_CompAttributeSet(GC, & - name="InitializeDataComplete", value="true", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - return - end subroutine dataInitialize - - subroutine SetRunClock(mediator, rc) - type(ESMF_GridComp) :: mediator - integer, intent(out) :: rc - - ! local variables - type(ESMF_Clock) :: mediatorClock, driverClock - type(ESMF_Time) :: currTime - - rc = ESMF_SUCCESS - - ! query the Mediator for clocks - call NUOPC_MediatorGet(mediator, mediatorClock=mediatorClock, & - driverClock=driverClock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! set the mediatorClock to have the current start time as the driverClock - call ESMF_ClockGet(driverClock, currTime=currTime, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_ClockSet(mediatorClock, currTime=currTime, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! check and set the component clock against the driver clock - call NUOPC_CompCheckSetClock(mediator, driverClock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, & - msg="NUOPC INCOMPATIBILITY DETECTED: between model and driver clocks", & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - -!EOC -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: Run -- Run method -! -! !INTERFACE: -! - subroutine modelAdvance( GC, RC ) -! -! !INPUT/OUTPUT PARAMETERS: - type(ESMF_GridComp) :: GC ! Gridded component -! -! !OUTPUT PARAMETERS: - integer, intent( out) :: RC ! Error code -! -! !DESCRIPTION: -! The Run method of the CTM Cinderalla Component. -! -!EOP -!------------------------------------------------------------------------- -!BOC -! -! !LOCAL VARIABLES: - character(len=ESMF_MAXSTR) :: IAm = "Run" - integer :: STATUS - character(len=ESMF_MAXSTR) :: COMP_NAME - !type (MAPL_MetaComp), pointer :: ggState - type (ESMF_Grid) :: esmfGrid - CHARACTER(LEN=ESMF_MAXSTR) :: rcfilen = 'CTM_GridComp.rc' - type(ESMF_Config) :: configFile - -#if 1 - ! Imports - !-------- - real, pointer, dimension(:,:,:) :: PLE1 => null() - real, pointer, dimension(:,:,:) :: PLE0 => null() - real, pointer, dimension(:,:,:) :: UC0 => null() - real, pointer, dimension(:,:,:) :: UC1 => null() - real, pointer, dimension(:,:,:) :: VC0 => null() - real, pointer, dimension(:,:,:) :: VC1 => null() - real, pointer, dimension(:,:,:) :: T => null() - real, pointer, dimension(:,:,:) :: Q => null() - real, pointer, dimension(:,:,:) :: ZLE => null() - real, pointer, dimension(:,:,:) :: QITOT => null() - real, pointer, dimension(:,:,:) :: QLTOT => null() - real, pointer, dimension(:,:,:) :: QITOT1 => null() - real, pointer, dimension(:,:,:) :: QLTOT1 => null() - real, pointer, dimension(:,:) :: cellArea => null() - - real, pointer, dimension(:,:) :: TS => null() - real, pointer, dimension(:,:) :: FROCEAN => null() - real, pointer, dimension(:,:) :: CN_PRCP => null() - real, pointer, dimension(:,:,:) :: CNV_MFC => null() - real, pointer, dimension(:,:) :: FRLAKE => null() - real, pointer, dimension(:,:,:) :: PFLCU => null() - real, pointer, dimension(:,:,:) :: PFICU => null() - real, pointer, dimension(:,:,:) :: PFLLSAN => null() - real, pointer, dimension(:,:,:) :: PFILSAN => null() - - ! Exports - !-------- - real, pointer, dimension(:,:,:) :: TH => null() - real, pointer, dimension(:,:,:) :: PLE => null() - real, pointer, dimension(:,:,:) :: AIRDENS => null() - real, pointer, dimension(:,:,:) :: MASS => null() - real(r8), pointer, dimension(:,:,:) :: CXr8 => null() - real(r8), pointer, dimension(:,:,:) :: CYr8 => null() - real(r8), pointer, dimension(:,:,:) :: PLE1r8 => null() - real(r8), pointer, dimension(:,:,:) :: PLE0r8 => null() - real(r8), pointer, dimension(:,:,:) :: MFXr8 => null() - real(r8), pointer, dimension(:,:,:) :: MFYr8 => null() - - real(r8), pointer, dimension(:,:,:) :: UCr8 => null() - real(r8), pointer, dimension(:,:,:) :: VCr8 => null() - real(r8), pointer, dimension(:,:,:) :: PLEr8 => null() - - real, pointer, dimension(:,:,:) :: U => null() - real, pointer, dimension(:,:,:) :: V => null() - real, pointer, dimension(:,:,:) :: QCTOT => null() - real, pointer, dimension(:,:,:) :: CNV_QC => null() - - real, pointer, dimension(:,:) :: FRACI => null() - real, pointer, dimension(:,:) :: LFR => null() - real, pointer, dimension(:,:) :: flashRate => null() - - real, pointer, dimension(:,:,:) :: RH2 => null() - real, pointer, dimension(:,:,:) :: PKAPPA => null() - real, pointer, dimension(:,:) :: CNV_TOPP => null() - real, pointer, dimension(:,:) :: CAPE => null() - real, pointer, dimension(:,:) :: LWI => null() - real, pointer, dimension(:,:) :: ITY => null() - real, pointer, dimension(:,:,:) :: DQDT => null() - real, pointer, dimension(:,:,:) :: DQRL => null() - real, pointer, dimension(:,:,:) :: BYNCY => null() - real, pointer, dimension(:,:,:) :: totflux => null() - real, pointer, dimension(:,:,:) :: expZLE => null() - - real, pointer, dimension(:,:,:) :: QI => null() - real, pointer, dimension(:,:,:) :: QL => null() - real, pointer, dimension(:,:,:) :: QICN => null() - real, pointer, dimension(:,:,:) :: QLCN => null() - real, pointer, dimension(:,:) :: PRECCON => null() - real, pointer, dimension(:,:) :: PRECANV => null() - real, pointer, dimension(:,:) :: PRECLSC => null() - real, pointer, dimension(:,:) :: TPREC => null() - real, pointer, dimension(:,:) :: tempFrac => null() - - integer :: km, k, is, ie, js, je, lm, ik, nc - integer :: ndt, isd, ied, jsd, jed, i, j, l - real(r8) :: DT - - ! local variables - type(ESMF_Clock) :: clock - type(ESMF_State) :: IMPORT, EXPORT - - call ESMF_LogWrite('CTMenv: modelAdvance', ESMF_LOGMSG_INFO, rc=rc) - - ! query the Component for its clock, importState and exportState - call ESMF_GridCompGet(GC, clock=clock, importState=IMPORT, & -! call NUOPC_ModelGet(GC, modelClock=clock, importState=IMPORT, & - exportState=EXPORT, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - configFile = ESMF_ConfigCreate(rc=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_ConfigLoadFile(configFile, TRIM(rcfilen), rc=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! Get the target components name and set-up traceback handle. - ! ----------------------------------------------------------- - call ESMF_GridCompGet ( GC, name=COMP_NAME, Grid=esmfGrid, RC=RC) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - Iam = trim(COMP_NAME) // TRIM(Iam) - - ! Get my internal MAPL_Generic state - !----------------------------------- - ! call MAPL_GetObjectFromGC ( GC, ggState, __RC__ ) - - !call MAPL_TimerOn(ggState,"TOTAL") - !call MAPL_TimerOn(ggState,"RUN") - - ! Get the time-step - ! ----------------------- - ! call MAPL_GetResource( ggState, ndt, 'RUN_DT:', default=0, __RC__ ) - - call ESMF_AttributeGet ( GC, 'RUN_DT:', ndt, RC=RC ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - DT = ndt - - !----------------------------- - ! Required Imports and Exports - !----------------------------- - call MAPL_GetPointer ( IMPORT, PLE0, 'PLE0', __RC__ ) - call MAPL_GetPointer ( IMPORT, PLE1, 'PLE1', __RC__ ) - call MAPL_GetPointer ( IMPORT, UC0, 'UC0', __RC__ ) - call MAPL_GetPointer ( IMPORT, UC1, 'UC1', __RC__ ) - call MAPL_GetPointer ( IMPORT, VC0, 'VC0', __RC__ ) - call MAPL_GetPointer ( IMPORT, VC1, 'VC1', __RC__ ) - call MAPL_GetPointer ( IMPORT, cellArea, 'AREA', __RC__ ) - - call MAPL_GetPointer ( EXPORT, PLE, 'PLE', __RC__ ) - PLE = PLE0 - call MAPL_GetPointer ( EXPORT, PLE0r8, 'PLE0r8', __RC__ ) - PLE0r8 = PLE0 - call MAPL_GetPointer ( EXPORT, PLE1r8, 'PLE1r8', __RC__ ) - PLE1r8 = PLE1 - call MAPL_GetPointer ( EXPORT, MFXr8, 'MFXr8', __RC__ ) - call MAPL_GetPointer ( EXPORT, MFYr8, 'MFYr8', __RC__ ) - call MAPL_GetPointer ( EXPORT, CXr8, 'CXr8', __RC__ ) - call MAPL_GetPointer ( EXPORT, CYr8, 'CYr8', __RC__ ) - - is = lbound(PLE,1); ie = ubound(PLE,1) - js = lbound(PLE,2); je = ubound(PLE,2) - - LM = size (PLE,3) - 1 - nc = (ie-is+1)*(je-js+1) - - !-------------------------------------------- - ! courant numbers and mass fluxes for AdvCore - !-------------------------------------------- - ALLOCATE( UCr8(is:ie,js:je,lm), STAT=STATUS); VERIFY_(STATUS) - ALLOCATE( VCr8(is:ie,js:je,lm), STAT=STATUS); VERIFY_(STATUS) - ALLOCATE(PLEr8(is:ie,js:je,lm+1), STAT=STATUS); VERIFY_(STATUS) - - UCr8 = 0.50d0*(UC1 + UC0) - VCr8 = 0.50d0*(VC1 + VC0) - PLEr8 = 0.50d0*(PLE1 + PLE0) - - call calcCourantNumberMassFlux(UCr8, VCr8, PLEr8, & - MFXr8, MFYr8, CXr8, CYr8, DT) - - DEALLOCATE(UCr8, VCr8, PLEr8) - - IF (.NOT. enable_pTracers) THEN - - !--------------------------- - ! Potential Temperature (TH) - !--------------------------- - call MAPL_GetPointer ( IMPORT, T, 'T', ALLOC=.TRUE., __RC__ ) - call MAPL_GetPointer ( EXPORT, TH, 'TH', ALLOC=.TRUE., __RC__ ) - - ALLOCATE( PKAPPA(is:ie,js:je,LM), STAT=STATUS); VERIFY_(STATUS) - - PKAPPA(:,:,:) = ((0.5*(PLE(:,:,0:LM-1) + PLE(:,:,1:LM ) ))/100000.)**(MAPL_RGAS/MAPL_CP) - TH(:,:,:) = T(:,:,:)/PKAPPA(:,:,:) - - DEALLOCATE(PKAPPA) - - call MAPL_GetPointer ( IMPORT, TS, 'TS', __RC__ ) - call MAPL_GetPointer ( IMPORT, FROCEAN, 'FROCEAN', __RC__ ) - call MAPL_GetPointer ( IMPORT, FRACI, 'FRACI', __RC__ ) - call MAPL_GetPointer ( IMPORT, FRLAKE, 'FRLAKE', __RC__ ) - call MAPL_GetPointer ( IMPORT, Q, 'Q', __RC__ ) - - !---- - ! LWI - !---- - call MAPL_GetPointer ( EXPORT, LWI, 'LWI', ALLOC=.TRUE., __RC__ ) - call computeLWI (LWI, TS, FRLAKE, FROCEAN, FRACI) - - IF ( (TRIM(metType) == 'MERRA2') .OR. (TRIM(metType) == 'FPIT') ) THEN - call MAPL_GetPointer ( IMPORT, ZLE, 'ZLE', __RC__ ) - call MAPL_GetPointer ( EXPORT, expZLE, 'ZLE', ALLOC=.TRUE., __RC__ ) - expZLE = ZLE - - ELSEIF ( TRIM(metType) == 'MERRA1') THEN - !--------------------------------- - ! RH2 and ZLE if using MERRA1 data - !--------------------------------- - call MAPL_GetPointer ( EXPORT, RH2, 'RH2', ALLOC=.TRUE., __RC__ ) - call MAPL_GetPointer ( EXPORT, ZLE, 'ZLE', ALLOC=.TRUE., __RC__ ) - - call compute_ZLE_RH2 (ZLE, RH2, TH, Q, PLE, ie-is+1, je-js+1, LM) - END IF - - !--------------------- - ! Derive QICN and QLCN - !--------------------- - call MAPL_GetPointer ( IMPORT, PRECCON, 'PRECCON', __RC__ ) - call MAPL_GetPointer ( IMPORT, PRECANV, 'PRECANV', __RC__ ) - call MAPL_GetPointer ( IMPORT, PRECLSC, 'PRECLSC', __RC__ ) - call MAPL_GetPointer ( IMPORT, QI, 'QI', __RC__ ) - call MAPL_GetPointer ( IMPORT, QL, 'QL', __RC__ ) - call MAPL_GetPointer ( EXPORT, QICN, 'QICN', ALLOC=.TRUE., __RC__ ) - call MAPL_GetPointer ( EXPORT, QLCN, 'QLCN', ALLOC=.TRUE., __RC__ ) - - isd = lbound(QLCN,1); ied = ubound(QLCN,1) - jsd = lbound(QLCN,2); jed = ubound(QLCN,2) - - ALLOCATE( tempFrac(isd:ied,jsd:jed), STAT=STATUS); VERIFY_(STATUS) - ALLOCATE( TPREC(isd:ied,jsd:jed), STAT=STATUS); VERIFY_(STATUS) - - call computeTotalPrecip(TPREC, PRECANV, PRECCON, PRECLSC) - - tempFrac(:,:) = 0.0 - WHERE (TPREC(:,:) .NE. 0.0) - tempFrac(:,:) = PRECANV(:,:) /TPREC(:,:) - END WHERE - - DO k=1,LM - QICN(:,:,k) = QI(:,:,k)*tempFrac(:,:) - QLCN(:,:,k) = QL(:,:,k)*tempFrac(:,:) - ENDDO - DEALLOCATE(tempFrac, TPREC) - - ! --------------------------------- - ! Air Desnsity and Atmospheric Mass - ! --------------------------------- - call MAPL_GetPointer ( EXPORT, AIRDENS, 'AIRDENS', ALLOC=.TRUE., __RC__ ) - call MAPL_GetPointer ( EXPORT, MASS, 'MASS', ALLOC=.TRUE., __RC__ ) - - ! Compute air density - call airdens_ ( AIRDENS, PLE, TH, Q, ie-is+1, je-js+1, LM) - - ! Compute the total mass - DO k = 1, LM - MASS(:,:,k) = AIRDENS(:,:,k)*cellArea(:,:)*(ZLE(:,:,k-1)-ZLE(:,:,k)) - END DO - - !------------------------------------------- - ! Mass Fraction of Total Cloud Water (QCTOT) - ! Grid Mean Convective Condensate (CNV_QC) - !------------------------------------------- - call MAPL_GetPointer ( IMPORT, QITOT, 'QITOT', __RC__ ) - call MAPL_GetPointer ( IMPORT, QLTOT, 'QLTOT', __RC__ ) - call MAPL_GetPointer ( EXPORT, QCTOT, 'QCTOT', ALLOC=.TRUE., __RC__ ) - QCTOT(:,:,:) = QLTOT(:,:,:) + QITOT(:,:,:) - - call MAPL_GetPointer ( IMPORT, QITOT1, 'QITOT1', __RC__ ) - call MAPL_GetPointer ( IMPORT, QLTOT1, 'QLTOT1', __RC__ ) - call MAPL_GetPointer ( EXPORT, CNV_QC, 'CNV_QC', ALLOC=.TRUE., __RC__ ) - CNV_QC(:,:,:) = QCTOT(:,:,:) - ( QLTOT1(:,:,:) + QITOT1(:,:,:) ) - - WHERE ( CNV_QC(:,:,:) < 0.0 ) CNV_QC(:,:,:) = 0.0 - CNV_QC(:,:,:) = CNV_QC(:,:,:) *(DT/(30.0*SecondsPerMinute)) - - !---------------- - ! Vegetation Type - !---------------- - call MAPL_GetPointer ( EXPORT, ITY, 'ITY', ALLOC=.TRUE., __RC__ ) - ITY = 1.0 - - !------------------------------------------------ - ! Flash Rate (LFR) for Lighting Parameterization - !------------------------------------------------ - call MAPL_GetPointer ( IMPORT, CNV_MFC, 'CNV_MFC', __RC__ ) - call MAPL_GetPointer ( IMPORT, CN_PRCP, 'CN_PRCP', __RC__ ) - call MAPL_GetPointer ( EXPORT, LFR, 'LFR', ALLOC=.TRUE., __RC__ ) - call MAPL_GetPointer ( EXPORT, BYNCY, 'BYNCY', ALLOC=.TRUE., __RC__ ) - - ! Determine the pressure at convective cloud top - ALLOCATE( CNV_TOPP(is:ie,js:je), STAT=STATUS); VERIFY_(STATUS) - CNV_TOPP(:,:) = MAPL_UNDEF - do j=js, je - do i=is, ie - do l=1,lm - if (CNV_MFC(i,j,l)/=0.0) then - CNV_TOPP(i,j) = PLE(i,j,l) - exit - endif - enddo - enddo - enddo - - ALLOCATE( CAPE(is:ie,js:je), STAT=STATUS); VERIFY_(STATUS) - call computeCAPE (TH, Q, PLE, CAPE, BYNCY, ie-is+1, je-js+1, LM) - - ALLOCATE( flashRate(is:ie,js:je), STAT=STATUS); VERIFY_(STATUS) - - call computeFlashRate (configfile, nc, LM, TS, CNV_TOPP, FROCEAN, & - CN_PRCP, CAPE, CNV_MFC, TH, PLE, ZLE, flashRate, RC=STATUS) - VERIFY_(STATUS) - - LFR(:,:) = flashRate(:,:) - - DEALLOCATE(CNV_TOPP, CAPE, flashRate) - - !---------------------- - ! DQDT and DQRL - !---------------------- - call MAPL_GetPointer ( IMPORT, PFLCU, 'PFL_CN', ALLOC=.TRUE., __RC__ ) - call MAPL_GetPointer ( IMPORT, PFICU, 'PFICU', ALLOC=.TRUE., __RC__ ) - call MAPL_GetPointer ( IMPORT, PFLLSAN, 'PFL_LSAN', ALLOC=.TRUE., __RC__ ) - call MAPL_GetPointer ( IMPORT, PFILSAN, 'PFILSAN', ALLOC=.TRUE., __RC__ ) - - call MAPL_GetPointer ( EXPORT, DQDT, 'DQDT', ALLOC=.TRUE., __RC__ ) - call MAPL_GetPointer ( EXPORT, DQRL, 'DQRL', ALLOC=.TRUE., __RC__ ) - - ALLOCATE(totflux(is:ie,js:je,0:lm), STAT=STATUS); VERIFY_(STATUS) - - totflux = PFLCU+PFLLSAN+PFICU+PFILSAN - - ! The minus sign is to have it be compatible with DQDT - ! (which is the negative of the precip generation) - DO k = 1, LM - DQDT(:,:,k) = -(totflux(:,:,k-1) - totflux(:,:,k)) / MASS(:,:,k) - END DO - - DQRL = 0.0 - - DEALLOCATE(totflux) - END IF ! .NOT. enable_pTracers - - !call MAPL_TimerOff(ggState,"RUN") - !call MAPL_TimerOff(ggState,"TOTAL") - -#endif - - call ESMF_ConfigDestroy(configfile, rc=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! All Done - ! -------- - RETURN_(ESMF_SUCCESS) - - end subroutine modelAdvance -!EOC -!------------------------------------------------------------------------------ -!BOP - subroutine computeEdgePressure(PLE, PS, AK, BK, km) -! -! !INPUT PARAMETERS: - INTEGER, intent(in) :: km ! number of vertical levels - REAL(r4), intent(in) :: PS(:,:) ! Surface pressure (Pa) - REAL(r8), intent(in) :: ak(km+1), bk(km+1) -! -! !OUTPUT PARAMETERS: - REAL(r4), intent(out) :: PLE(:,:,:) ! Edge pressure (Pa) -!EOP -!------------------------------------------------------------------------------ -!BOC - INTEGER :: L - - DO L = 1, km - PLE(:,:,L) = ak(L) + bk(L)*PS(:,:) - END DO - - RETURN - - end subroutine computeEdgePressure -!EOC -!------------------------------------------------------------------------------ -!BOP - subroutine computeTotalPrecip(TPREC, PRECANV, PRECCON, PRECLSC) -! -! !INPUT PARAMETERS: - REAL(r4), intent(in) :: PRECANV(:,:) ! Surface precipitation flux from anvils (kg/m2/s) - REAL(r4), intent(in) :: PRECCON(:,:) ! Surface precipitation flux from convection (kg/m2/s) - REAL(r4), intent(in) :: PRECLSC(:,:) ! Surface precipitation flux from large-scale (kg/m2/s) -! -! !OUTPUT PARAMETERS: - REAL(r4), intent(out) :: TPREC(:,:) ! Total precipitation (kg/m2/s) -!EOP -!------------------------------------------------------------------------------ -!BOC - TPREC = PRECANV + PRECCON + PRECLSC - - RETURN - - end subroutine computeTotalPrecip -!EOC -!------------------------------------------------------------------------------ -!BOP - subroutine computeLWI(LWI, TSKIN, FRLAKE, FROCEAN, FRACI) -! -! !INPUT PARAMETERS: - REAL(r4), intent(in) :: TSKIN(:,:) ! Surface skin temperature (K) - REAL(r4), intent(in) :: FRLAKE(:,:) ! Fraction of lake type in grid box (1) - REAL(r4), intent(in) :: FROCEAN(:,:) ! Fraction of ocean in grid box (1) - REAL(r4), intent(in) :: FRACI(:,:) ! Ice covered fraction of tile (1) -! -! !OUTPUT PARAMETERS: - REAL(r4), intent(out) :: LWI(:,:) ! Land water ice flag (1) -! -!EOP -!------------------------------------------------------------------------------ -!BOC - - LWI = 1.0 ! Land - where ( FROCEAN+FRLAKE >= 0.6 ) LWI = 0.0 ! Water - where ( LWI==0 .and. FRACI>0.5 ) LWI = 2.0 ! Ice - where ( LWI==0 .and. TSKIN<271.40 ) LWI = 2.0 ! Ice - - RETURN - - end subroutine computeLWI -!EOC -!------------------------------------------------------------------------------ -!BOP - subroutine computeRelativeHumidity(RH2, PRESS3D, T, QV) - -! -! !INPUT PARAMETERS: - REAL, intent(in) :: PRESS3D(:,:,:) ! Pressure (Pa) - REAL, intent(in) :: T (:,:,:) ! Air temperature (K) - REAL, intent(in) :: QV (:,:,:) ! Specific humidity (kg/kg) -! -! !OUTPUT PARAMETERS: - REAL, intent(out) :: RH2(:,:,:) ! Relative humidity (1) -! -!EOP -!------------------------------------------------------------------------------ -!BOC - - ! ----------------------------------------------------------------- - ! First calculate relative humidity from Seinfeld (1986) p. 181. - ! The first RH2 is the temperature dependent parameter a. - ! The second RH2 is the saturation vapor pressure of water. - ! The third RH2 is the actual relative humidity as a fraction. - ! Then make sure RH2 is between 0 and 0.95. - !----------------------------------------------------------------- - - RH2(:,:,:) = 1.0d0 - (373.15d0 / T(:,:,:)) - - RH2(:,:,:) = & - 1013.25d0 * Exp (13.3185d0 * RH2(:,:,:) - & - 1.9760d0 * RH2(:,:,:)**2 - & - 0.6445d0 * RH2(:,:,:)**3 - & - 0.1299d0 * RH2(:,:,:)**4) - - RH2(:,:,:) = QV(:,:,:) * MWTAIR / 18.0d0 / & - GPKG * PRESS3D(:,:,:) / RH2(:,:,:) - - RH2(:,:,:) = Max (Min (RH2(:,:,:), 0.95d0), 0.0d0) - - RETURN - - end subroutine computeRelativeHumidity -!EOC -!------------------------------------------------------------------------------ -!BOP -! -! !IROUTINES: airdens -! -! !INTERFACE: - - subroutine airdens_ ( AIRDENS, PLE, TH, Q, im, jm, lm ) -! -! !INPUT PARAMETERS: - integer, intent(in) :: im, jm , lm - real, intent(in) :: PLE(im,jm,lm+1) ! pressure edges - real, intent(in) :: TH(im,jm,lm) ! (dry) potential temperature - real, intent(in) :: Q(im,jm,lm) ! apecific humidity -! -! !OUTPUT PARAMETERS: - real, intent(out) :: AIRDENS(:,:,:) ! air density [kg/m3] -! -! !DESCRIPTION: -! Computes the air density that might be needed when GEOSchem is not -! exercised. -! -!EOP -!----------------------------------------------------------------------- -!BOC -! -! !LOCAL VARIABLES: - integer :: k - real :: eps - integer :: STATUS, RC - character(len=ESMF_MAXSTR) :: IAm = "airdens_" - real, allocatable :: npk(:,:,:) ! normalized pk = (PLE/p0)^kappa - - allocate(npk(im,jm,lm+1),stat=STATUS) ! work space - VERIFY_(STATUS) - - eps = MAPL_RVAP / MAPL_RGAS - 1.0 - - ! Compute normalized PLE**Kappa - ! ---------------------------- - npk = (PLE/MAPL_P00)**MAPL_KAPPA - - ! Compute AIRDENS from hydrostatic equation - ! ------------------------------------- - do k = 1, lm - AIRDENS(:,:,k) = ( PLE(:,:,k+1) - PLE(:,:,k) ) / & - ( MAPL_CP * ( TH(:,:,k)*(1. + eps*Q(:,:,k) ) ) & - * ( npk(:,:,k+1) - npk(:,:,k) ) ) - end do - - deallocate(npk) - - end subroutine airdens_ -!EOC -!----------------------------------------------------------------------- -!BOP - function compAreaWeightedAverage_2d (var2D, vm, cellArea) result(wAverage) -! -! !INPUT PARAMETER: - real :: var2D(:,:) - real :: cellArea(:,:) - type (ESMF_VM) :: VM -! -! RETURNED VALUE: - real :: wAverage -! -! DESCRIPTION: -! Computes the area weighted average of a 2d variable. -! -!EOP -!----------------------------------------------------------------------- -!BOC - logical, save :: first = .true. - real(r8) , save :: sumArea - real(r8) :: sumWeight - integer :: ik, im, jm, STATUS, RC - real(r8), pointer :: weightVals(:,:) - real(r8) :: sumWeight_loc, sumArea_loc - character(len=ESMF_MAXSTR) :: IAm = 'compAreaWeightedAverage_2d' - - ! Determine the earth surface area - if (first) then - sumArea_loc = SUM( cellArea (:,:) ) - call MAPL_CommsAllReduceSum(vm, sendbuf= sumArea_loc, & - recvbuf= sumArea, & - cnt=1, RC=status) - VERIFY_(STATUS) - - first = .false. - end if - - im = size(cellArea,1) - jm = size(cellArea,2) - - allocate(weightVals(im,jm)) - weightVals(:,:) = cellArea(:,:)*var2D(:,:) - - sumWeight_loc = SUM( weightVals(:,:) ) - - call MAPL_CommsAllReduceSum(vm, sendbuf= sumWeight_loc, recvbuf= sumWeight, & - cnt=1, RC=status) - VERIFY_(STATUS) - - wAverage = sumWeight/sumArea - - deallocate(weightVals) - - return - - end function compAreaWeightedAverage_2d -!EOC -!----------------------------------------------------------------------- -!BOP - function compAreaWeightedAverage_3d (var3D, vm, cellArea) result(wAverage) -! -! !INPUT PARAMETER: - real :: var3D(:,:,:) - real :: cellArea(:,:) - type (ESMF_VM) :: VM -! -! RETURNED VALUE: - real :: wAverage -! -! DESCRIPTION: -! Computes the area weighted average of a 3d variable. -! -!EOP -!----------------------------------------------------------------------- -!BOC - logical, save :: first = .true. - real(r8) , save :: sumArea - real(r8) :: sumWeight - integer :: ik, im, jm, STATUS, RC - real(r8), pointer :: weightVals(:,:) - real(r8) :: sumWeight_loc, sumArea_loc - character(len=ESMF_MAXSTR) :: IAm = 'compAreaWeightedAverage_3d' - - ! Determine the earth surface area - if (first) then - sumArea_loc = SUM( cellArea (:,:) ) - call MAPL_CommsAllReduceSum(vm, sendbuf= sumArea_loc, & - recvbuf= sumArea, & - cnt=1, RC=status) - VERIFY_(STATUS) - - first = .false. - end if - - im = size(cellArea,1) - jm = size(cellArea,2) - - allocate(weightVals(im,jm)) - weightVals(:,:) = 0.0d0 - DO ik = lbound(var3D,3), ubound(var3D,3) - weightVals(:,:) = weightVals(:,:) + cellArea(:,:)*var3D(:,:,ik) - END DO - - sumWeight_loc = SUM( weightVals(:,:) ) - - call MAPL_CommsAllReduceSum(vm, sendbuf= sumWeight_loc, recvbuf= sumWeight, & - cnt=1, RC=status) - VERIFY_(STATUS) - - wAverage = sumWeight/sumArea - - deallocate(weightVals) - - return - - end function compAreaWeightedAverage_3d -!EOC -!----------------------------------------------------------------------- -!BOP -! !IROUTINE: computeFlashRate -! -! !INTERFACE: -! - subroutine computeFlashRate (configFile, nc, lm, TS, CCTP, FROCEAN, CN_PRCP, & - CAPE, CNV_MFC, TH, PLE, ZLE, strokeRate, RC) -! -! !INPUT PARAMETERS: - type(ESMF_CONFIG) :: configFile - INTEGER, INTENT(IN) :: nc ! Number of cells - INTEGER, INTENT(IN) :: lm ! Number of layers - - REAL, INTENT(IN), DIMENSION(nc) :: TS ! Surface temperature [K] - REAL, INTENT(IN), DIMENSION(nc) :: CCTP ! Convective cloud top pressure [Pa] with MAPL_UNDEFs - REAL, INTENT(IN), DIMENSION(nc) :: FROCEAN ! Areal ocean fraction - REAL, INTENT(IN), DIMENSION(nc) :: CN_PRCP ! Convective precipitation [kg m^{-2} s^{-1}] - REAL, INTENT(IN), DIMENSION(nc) :: CAPE ! Convective available potential energy [J m^{-2}] - - REAL, INTENT(IN), DIMENSION(nc,lm) :: TH ! Potential temperature [K] - REAL, INTENT(IN), DIMENSION(nc,0:lm) :: CNV_MFC ! Convective mass flux [kg m^{-2} s^{-1}] - REAL, INTENT(IN), DIMENSION(nc,0:lm) :: PLE ! Layer interface pressures [Pa] - REAL, INTENT(IN), DIMENSION(nc,0:lm) :: ZLE ! Layer depths [m] - -! -! !OUTPUT PARAMETERS: - REAL, INTENT(OUT), DIMENSION(nc) :: strokeRate ! Flashes per second - INTEGER, OPTIONAL, INTENT(OUT) :: RC -! -! !INPUT/OUTPUT PARAMETERS: - TYPE(MAPL_MetaComp), POINTER :: STATE ! Internal MAPL_Generic state -! -! !DESCRIPTION: -! Generate lightning flash rates [km$^{-2}$ s$^{-1}$] using a six-variable polynomial fit.\\ -! -! -! ORIGIN AND CONTACT\\ -! Dr. Dale Allen, Associate Research Scientist\\ -! Dept. of Atmospheric and Oceanic Science\\ -! University of Maryland\\ -! College Park, MD 20742\\ -! 301-405-7629 (ph); 301-314-9482 (fax)\\ -! http://www.meto.umd.edu/~allen\\ -! -! -! FORMULATION NOTES\\ -! Predictor variables are set to zero where CN\_PRCP is zero or where the -! optical depth cloud top height is less than 5.5 km. -! The fit returns flash rates in units km$^{-2}$ day$^{-1}$. Convert to -! km$^{-2}$ s$^{-1}$ for the export state.\\ -! -! -! OTHER NOTES OF INTEREST\\ -! MOIST sets CNV\_TOPP to zero if there is an absence of convection. -! -! !REVISION HISTORY: -! 30 Nov 2011 Nielsen First crack -! 29 Feb 2012 Nielsen Accomodate CNV\_TOPP MAPL\_UNDEF for and after Fortuna-2\_5\_p4 -! 04 Nov 2014 Kouatchou Adapted the subroutine for GEOSctm -!EOP -!----------------------------------------------------------------------- -!BOC -! -! !LOCAL VARIABLES: - ! Error log variables - ! ------------------- - INTEGER :: STATUS - - REAL, DIMENSION(nc) :: A1X1 - REAL, DIMENSION(nc) :: A2X2 - REAL, DIMENSION(nc) :: A3X3 - REAL, DIMENSION(nc) :: A4X4 - REAL, DIMENSION(nc) :: A5X5 - - ! Local variables - ! --------------- - INTEGER :: i ! General-purpose integers - INTEGER :: k - INTEGER :: n - - REAL :: a0c,a0m ! Coefficients at continental and marine locations - REAL :: a1c,a1m - REAL :: a2c,a2m - REAL :: a3c,a3m - REAL :: a4c,a4m - REAL :: a5c,a5m - - REAL :: x1Divisor ! Divisors for x1-x5. - REAL :: x2Divisor - REAL :: x3Divisor - REAL :: x4Divisor - REAL :: x5Divisor - - REAL :: x5Power ! Exponent for the surface temperature deviation predictor - - REAL :: sfcTLimit ! Temperature thresholds - REAL :: airTLimit - - REAL :: hPaCldTop ! Cloud top limiter for weak/no convection - - REAL, ALLOCATABLE, DIMENSION(:) :: x1 ! Five independent variables - REAL, ALLOCATABLE, DIMENSION(:) :: x2 - REAL, ALLOCATABLE, DIMENSION(:) :: x3 - REAL, ALLOCATABLE, DIMENSION(:) :: x4 - REAL, ALLOCATABLE, DIMENSION(:) :: x5 - - REAL, ALLOCATABLE, DIMENSION(:) :: cloudTopAG ! Cloud top height above ground - REAL, ALLOCATABLE, DIMENSION(:) :: cnv_topp ! Convective cloud top pressure with MAPL_UNDEFs - ! changed to zero - - REAL, ALLOCATABLE, DIMENSION(:,:) :: dZ ! Layer depths [m] - REAL, ALLOCATABLE, DIMENSION(:,:) :: p ! Pressure at middle of layer [Pa] - REAL, ALLOCATABLE, DIMENSION(:,:) :: T ! Air temperature at middle of layer [K] - - INTEGER, ALLOCATABLE, DIMENSION(:) :: weakCnvMask ! Weak or no convection mask - INTEGER, ALLOCATABLE, DIMENSION(:,:) :: mask ! Working mask - INTEGER, ALLOCATABLE, DIMENSION(:,:) :: cloudTopMask ! Mask is 1 below cloud top - - character(len=ESMF_MAXSTR) :: IAm = 'computeFlashRate' - - - ! Preliminaries - ! ------------- - RC = 0 - strokeRate(:) = 0.0 - - ! Coefficients of the predictors, marine locations - ! ------------------------------------------------ - CALL ESMF_ConfigGetAttribute(configFile,a0m,label='MARINE_A0:',DEFAULT= 0.0139868,RC=STATUS) - VERIFY_(STATUS) - CALL ESMF_ConfigGetAttribute(configFile,a1m,label='MARINE_A1:',DEFAULT= 0.0358764,RC=STATUS) - VERIFY_(STATUS) - CALL ESMF_ConfigGetAttribute(configFile,a2m,label='MARINE_A2:',DEFAULT=-0.0610214,RC=STATUS) - VERIFY_(STATUS) - CALL ESMF_ConfigGetAttribute(configFile,a3m,label='MARINE_A3:',DEFAULT=-0.0102320,RC=STATUS) - VERIFY_(STATUS) - CALL ESMF_ConfigGetAttribute(configFile,a4m,label='MARINE_A4:',DEFAULT= 0.0031352,RC=STATUS) - VERIFY_(STATUS) - CALL ESMF_ConfigGetAttribute(configFile,a5m,label='MARINE_A5:',DEFAULT= 0.0346241,RC=STATUS) - VERIFY_(STATUS) - - ! Coefficients of the predictors, continental locations - ! ----------------------------------------------------- - CALL ESMF_ConfigGetAttribute(configFile,a0c,label='CONTINENT_A0:',DEFAULT=-0.0183172,RC=STATUS) - VERIFY_(STATUS) - CALL ESMF_ConfigGetAttribute(configFile,a1c,label='CONTINENT_A1:',DEFAULT=-0.0562338,RC=STATUS) - VERIFY_(STATUS) - CALL ESMF_ConfigGetAttribute(configFile,a2c,label='CONTINENT_A2:',DEFAULT= 0.1862740,RC=STATUS) - VERIFY_(STATUS) - CALL ESMF_ConfigGetAttribute(configFile,a3c,label='CONTINENT_A3:',DEFAULT=-0.0023363,RC=STATUS) - VERIFY_(STATUS) - CALL ESMF_ConfigGetAttribute(configFile,a4c,label='CONTINENT_A4:',DEFAULT=-0.0013838,RC=STATUS) - VERIFY_(STATUS) - CALL ESMF_ConfigGetAttribute(configFile,a5c,label='CONTINENT_A5:',DEFAULT= 0.0114759,RC=STATUS) - VERIFY_(STATUS) - - ! Divisors for nondimensionalization of the predictors - ! ---------------------------------------------------- - CALL ESMF_ConfigGetAttribute(configFile,x1Divisor,label='X1_DIVISOR:',DEFAULT=4.36,RC=STATUS) - VERIFY_(STATUS) - CALL ESMF_ConfigGetAttribute(configFile,x2Divisor,label='X2_DIVISOR:',DEFAULT=9.27,RC=STATUS) - VERIFY_(STATUS) - CALL ESMF_ConfigGetAttribute(configFile,x3Divisor,label='X3_DIVISOR:',DEFAULT=34.4,RC=STATUS) - VERIFY_(STATUS) - CALL ESMF_ConfigGetAttribute(configFile,x4Divisor,label='X4_DIVISOR:',DEFAULT=21.4,RC=STATUS) - VERIFY_(STATUS) - CALL ESMF_ConfigGetAttribute(configFile,x5Divisor,label='X5_DIVISOR:',DEFAULT=14600.,RC=STATUS) - VERIFY_(STATUS) - - ! Exponent for the surface temperature deviation predictor - ! -------------------------------------------------------- - CALL ESMF_ConfigGetAttribute(configFile,x5Power,label='X5_EXPONENT:',DEFAULT=3.00,RC=STATUS) - VERIFY_(STATUS) - - ! Threshold temperatures - ! ---------------------- - CALL ESMF_ConfigGetAttribute(configFile,sfcTLimit,label='SFC_T_LIMIT:',DEFAULT=273.0,RC=STATUS) - VERIFY_(STATUS) - CALL ESMF_ConfigGetAttribute(configFile,airTLimit,label='AIR_T_LIMIT:',DEFAULT=263.0,RC=STATUS) - VERIFY_(STATUS) - - ! Cloud-top pressure limiter - ! -------------------------- - CALL ESMF_ConfigGetAttribute(configFile,hPaCldTop,label='CLOUD_TOP_LIMIT:',DEFAULT=500.,RC=STATUS) - VERIFY_(STATUS) - - ! Layer depths [m] - ! ---------------- - ALLOCATE(dZ(nc,lm),STAT=STATUS) - VERIFY_(STATUS) - dZ = zle(:,0:lm-1)-zle(:,1:lm) - - ! Pressure at mid-layer [Pa] - ! -------------------------- - ALLOCATE(p(nc,lm),STAT=STATUS) - VERIFY_(STATUS) - p = (ple(:,1:lm)+ple(:,0:lm-1))*0.50 - - ! Temperature at mid-layer [K] - ! ---------------------------- - ALLOCATE(T(nc,lm),STAT=STATUS) - VERIFY_(STATUS) - T = TH*((p*1.00E-05)**(MAPL_RGAS/MAPL_CP)) - - ! Reset CNV_TOPP's MAPL_UNDEFs to zeroes - ! -------------------------------------- - ALLOCATE(cnv_topp(nc),STAT=STATUS) - WHERE(CCTP == MAPL_UNDEF) - cnv_topp = 0.00 - ELSEWHERE - cnv_topp = CCTP - END WHERE - - ! Set weak/no convection mask - ! --------------------------- - ALLOCATE(weakCnvMask(nc),STAT=STATUS) - VERIFY_(STATUS) - weakCnvMask = 0 - WHERE(cn_prcp == 0.00 .OR. cnv_topp >= hPaCldTop*100.00 .OR. CAPE >= MAPL_UNDEF) weakCnvMask = 1 - - ! Convective cloud top mask - ! ------------------------- - ALLOCATE(cloudTopMask(nc,lm),STAT=STATUS) - VERIFY_(STATUS) - cloudTopMask = 0 - DO k = 1,lm - WHERE(ple(1:nc,k) > cnv_topp(1:nc) .AND. cnv_topp(1:nc) > 0.00) cloudTopMask(1:nc,k) = 1 - END DO - - ! Cloud top distance above ground [m] - ! ----------------------------------- - ALLOCATE(cloudTopAG(nc),STAT=STATUS) - VERIFY_(STATUS) - cloudTopAG = 0.00 - DO i = 1,nc - n = SUM(cloudTopMask(i,1:lm)) - IF(n > 0) cloudTopAG(i) = SUM(dZ(i,lm-n+1:lm)) - END DO - - ! X1: Cold cloud depth: Vertical extent [km] where T < airTLimit and p > cnv_topp - ! ------------------------------------------------------------------------------- - ALLOCATE(x1(nc),STAT=STATUS) - VERIFY_(STATUS) - ALLOCATE(mask(nc,lm),STAT=STATUS) - VERIFY_(STATUS) - - mask = 0 - WHERE(T < airTLimit .AND. cloudTopMask == 1) mask = 1 - - x1 = 0.00 - DO i = 1,nc - DO k = 1,lm - IF(mask(i,k) == 1) x1(i) = x1(i)+dZ(i,k)*0.001 - END DO - END DO - WHERE(weakCnvMask == 1) x1 = 0.00 - x1 = x1/x1Divisor - - ! X4: Integrated convective mass flux - ! ----------------------------------- - ALLOCATE(x4(nc),STAT=STATUS) - VERIFY_(STATUS) - x4 = 0.00 - DO i = 1,nc - DO k = 1,lm - IF(mask(i,k) == 1) x4(i) = x4(i)+cnv_mfc(i,k)*dZ(i,k) - END DO - END DO - WHERE(weakCnvMask == 1) x4 = 0.00 - x4 = x4/x4Divisor - - ! X5: Surface temperature deviation from sfcTLimit, positive only. - ! Note: UNDEF TS test retains the ability to boot-strap moist_import_rst. - ! ----------------------------------------------------------------------- - ALLOCATE(x5(nc),STAT=STATUS) - VERIFY_(STATUS) - WHERE(TS == MAPL_UNDEF) - x5 = 0.00 - ELSEWHERE - x5 = TS-sfcTLimit - END WHERE - WHERE(weakCnvMask == 1) x5 = 0.00 - WHERE(x5 < 0.00) x5 = 0.00 - x5 = x5**x5Power/x5Divisor - - ! X2: Total cloud depth [km] - ! -------------------------- - ALLOCATE(x2(nc),STAT=STATUS) - VERIFY_(STATUS) - x2 = cloudTopAG*0.001 - WHERE(weakCnvMask == 1) x2 = 0.00 - x2 = x2/x2Divisor - - ! X3: CAPE - ! -------- - ALLOCATE(x3(nc),STAT=STATUS) - VERIFY_(STATUS) - x3 = CAPE - WHERE(weakCnvMask == 1) x3 = 0.00 - x3 = x3/x3Divisor - - ! Polynomial fit [units: km^{-2} s^{-1}] and individual - ! terms including marine and continental discrimination - ! ----------------------------------------------------- - WHERE(frOcean >= 0.01) - strokeRate = (a0m + a1m*x1 + a2m*x2 + a3m*x3 + a4m*x4 + a5m*x5)/86400.00 - A1X1 = a1m*x1/86400.00 - A2X2 = a2m*x2/86400.00 - A3X3 = a3m*x3/86400.00 - A4X4 = a4m*x4/86400.00 - A5X5 = a5m*x5/86400.00 - ELSEWHERE - strokeRate = (a0c + a1c*x1 + a2c*x2 + a3c*x3 + a4c*x4 + a5c*x5)/86400.00 - A1X1 = a1c*x1/86400.00 - A2X2 = a2c*x2/86400.00 - A3X3 = a3c*x3/86400.00 - A4X4 = a4c*x4/86400.00 - A5X5 = a5c*x5/86400.00 - END WHERE - - ! Eliminate negatives - ! ------------------- - WHERE(strokeRate < 0.00) strokeRate = 0.00 - - ! Set rate to zero where any of x1 through x5 are zero - ! ---------------------------------------------------- - WHERE(x1 == 0.00) strokeRate = 0.00 - WHERE(x2 == 0.00) strokeRate = 0.00 - WHERE(x3 == 0.00) strokeRate = 0.00 - WHERE(x4 == 0.00) strokeRate = 0.00 - WHERE(x5 == 0.00) strokeRate = 0.00 - - ! Clean up - ! -------- - DEALLOCATE(x1,STAT=STATUS) - VERIFY_(STATUS) - DEALLOCATE(x2,STAT=STATUS) - VERIFY_(STATUS) - DEALLOCATE(x3,STAT=STATUS) - VERIFY_(STATUS) - DEALLOCATE(x4,STAT=STATUS) - VERIFY_(STATUS) - DEALLOCATE(x5,STAT=STATUS) - VERIFY_(STATUS) - DEALLOCATE(cnv_topp,STAT=STATUS) - VERIFY_(STATUS) - DEALLOCATE(dZ,STAT=STATUS) - VERIFY_(STATUS) - DEALLOCATE(p,STAT=STATUS) - VERIFY_(STATUS) - DEALLOCATE(T,STAT=STATUS) - VERIFY_(STATUS) - DEALLOCATE(cloudTopAG,STAT=STATUS) - VERIFY_(STATUS) - DEALLOCATE(mask,STAT=STATUS) - VERIFY_(STATUS) - DEALLOCATE(cloudTopMask,STAT=STATUS) - VERIFY_(STATUS) - DEALLOCATE(weakCnvMask,STAT=STATUS) - VERIFY_(STATUS) - - return - - end subroutine computeFlashRate -!EOC -!----------------------------------------------------------------------- -!BOP -! - subroutine computeCAPE (TH, Q, PLE, CAPE, BUOY, IM, JM, LM) - - !use GEOS_UtilsMod - - integer, intent(in) :: IM,JM,LM - real, dimension(IM,JM,LM), intent(in) :: TH ! potential temperature - real, dimension(IM,JM,LM), intent(in) :: Q ! specific humidity - real, dimension(IM,JM,0:LM), intent(in) :: PLE ! pressure - real, dimension(IM,JM), intent(out) :: CAPE - real, dimension(IM,JM,LM), intent(out) :: BUOY -!EOP -!----------------------------------------------------------------------- -!BOC -#if 0 - integer :: L - real, dimension(IM,JM, LM) :: DQS, QSS, PLO, TEMP, PK, DM, DP - real, dimension(IM,JM, LM) :: ZLO - real, dimension(IM,JM,0:LM) :: ZLE - real, dimension(IM,JM,0:LM) :: CNV_PLE - real, dimension(IM,JM,0:LM) :: PKE - real, dimension(IM,JM ) :: HC - logical, dimension(IM,JM ) :: UNSTABLE - - CNV_PLE = PLE*.01 - PLO = 0.5*(CNV_PLE(:,:,0:LM-1) + CNV_PLE(:,:,1:LM ) ) - PKE = (CNV_PLE/1000.)**(MAPL_RGAS/MAPL_CP) - DP = ( PLE(:,:,1:LM)-PLE(:,:,0:LM-1) ) - PK = (PLO/1000.)**(MAPL_RGAS/MAPL_CP) - DM = DP*(1./MAPL_GRAV) - TEMP = TH*PK - DQS = GEOS_DQSAT(TEMP, PLO, qsat=QSS) - - ZLE(:,:,LM) = 0. - do L=LM,1,-1 - ZLE(:,:,L-1) = TH (:,:,L) * (1.+MAPL_VIREPS*Q(:,:,L)) - ZLO(:,:,L ) = ZLE(:,:,L) + (MAPL_CP/MAPL_GRAV)*( PKE(:,:,L)-PK (:,:,L ) ) * ZLE(:,:,L-1) - ZLE(:,:,L-1) = ZLO(:,:,L) + (MAPL_CP/MAPL_GRAV)*( PK (:,:,L)-PKE(:,:,L-1) ) * ZLE(:,:,L-1) - end do - - ! From BUYOANCY - - HC = TEMP(:,:,LM) + (MAPL_GRAV/MAPL_CP)*ZLO(:,:,LM) + (MAPL_ALHL/MAPL_CP)*Q(:,:,LM) - - do L=LM-1,1,-1 - BUOY(:,:,L) = HC - (TEMP(:,:,L) + (MAPL_GRAV/MAPL_CP)*ZLO(:,:,L) + (MAPL_ALHL/MAPL_CP)*QSS(:,:,L)) - BUOY(:,:,L) = BUOY(:,:,L) / ( (1.+ (MAPL_ALHL/MAPL_CP)*DQS(:,:,L))*TEMP(:,:,L) ) - enddo - - BUOY(:,:,LM) = 0.0 - - UNSTABLE = .false. - - CAPE = 0. - -! New formulation - do L=1,LM-1 - where(BUOY(:,:,L)>0.) - CAPE = CAPE + BUOY(:,:,L)*DM(:,:,L) - end where - end do - -! Old formulation -! do L=1,LM-1 -! where(BUOY(:,:,L)>0.) UNSTABLE=.true. -! where(UNSTABLE) -! CAPE = CAPE + BUOY(:,:,L)*DM(:,:,L) -! end where -! end do - - UNSTABLE = CAPE > 0.0 - - where(.not.UNSTABLE) - CAPE=MAPL_UNDEF - end where -#endif - - return - - end subroutine computeCAPE -!EOC -!----------------------------------------------------------------------- -!BOP -! - subroutine compute_ZLE_RH2 (ZLE, RH2, TH, Q, PLE, IM, JM, LM) - - !use GEOS_UtilsMod - - integer, intent(in) :: IM,JM,LM - real, dimension(IM,JM,LM), intent(in) :: TH ! potential temperature - real, dimension(IM,JM,LM), intent(in) :: Q ! specific humidity - real, dimension(IM,JM,0:LM), intent(in) :: PLE ! pressure - real, dimension(IM,JM,LM), intent(out) :: RH2 ! relative humidity - real, dimension(IM,JM,0:LM), intent(out) :: ZLE ! geopotential height -!EOP -!----------------------------------------------------------------------- -!BOC -#if 0 - integer :: L - real, dimension(IM,JM, LM) :: PLO, PK - real, dimension(IM,JM, LM) :: ZLO - real, dimension(IM,JM,0:LM) :: CNV_PLE - real, dimension(IM,JM,0:LM) :: PKE - - CNV_PLE = PLE*.01 - PLO = 0.5*(CNV_PLE(:,:,0:LM-1) + CNV_PLE(:,:,1:LM ) ) - PKE = (CNV_PLE/1000.)**(MAPL_RGAS/MAPL_CP) - PK = (PLO/1000.)**(MAPL_RGAS/MAPL_CP) - - ZLE(:,:,LM) = 0.0 - do L=LM,1,-1 - ZLE(:,:,L-1) = TH (:,:,L) * (1.+MAPL_VIREPS*Q(:,:,L)) - ZLO(:,:,L ) = ZLE(:,:,L) + (MAPL_CP/MAPL_GRAV)*( PKE(:,:,L)-PK (:,:,L ) ) * ZLE(:,:,L-1) - ZLE(:,:,L-1) = ZLO(:,:,L) + (MAPL_CP/MAPL_GRAV)*( PK (:,:,L)-PKE(:,:,L-1) ) * ZLE(:,:,L-1) - end do - - RH2 = max(MIN( Q/GEOS_QSAT (TH*PK, PLO) , 1.02 ),0.0) -#endif - return - - end subroutine compute_ZLE_RH2 -!EOC -!----------------------------------------------------------------------- - end module ENVCTM diff --git a/GeosCtmProto/extdata.F90 b/GeosCtmProto/extdata.F90 deleted file mode 100644 index b6482ebf..00000000 --- a/GeosCtmProto/extdata.F90 +++ /dev/null @@ -1,5129 +0,0 @@ -#include "MAPL_Generic.h" - -!============================================================================= -!BOP -! -! !MODULE: ExtData -! -! !INTERFACE: -! - module ExtData -! -! !USESs: - use ESMF -! use MAPL_Mod -#if 1 - USE ESMF - use MAPL_BaseMod - use MAPL_CommsMod - use ESMFL_Mod - use MAPL_GenericMod - use MAPL_VarSpecMod - use ESMF_CFIOFileMod - use ESMF_CFIOMod - use ESMF_CFIOUtilMod - use MAPL_CFIOMod -! use MAPL_HorzTransformMod - use MAPL_NewArthParserMod - use MAPL_ConstantsMod, only: MAPL_PI,MAPL_PI_R8 - use MAPL_IOMod, only: MAPL_NCIOParseTimeUnits - use MAPL_regridderSpecMod - use, intrinsic :: iso_fortran_env, only: REAL64 - use linearVerticalInterpolation_mod -#endif - use NUOPC - use NUOPC_Mediator, & - model_routine_SS => SetServices -! model_label_Advance => label_Advance, & -! model_label_DataInitialize => label_DataInitialize - use NUOPC_Generic - - implicit none -! - private -! -! !PUBLIC MEMBER FUNCTIONS: - - public SetServices -! public T_EXTDATA_STATE -! public EXTDATA_WRAP -! -! !DESCRIPTION: -! -!EOP -!============================================================================= - - integer :: Ext_Debug - character(len=ESMF_MAXSTR) :: Ext_TilePath - integer, parameter :: MAPL_ExtDataVectorItem = 32 - integer, parameter :: MAPL_ExtDataNullFrac = -9999 - integer, parameter :: MAPL_ExtDataLeft = 1 - integer, parameter :: MAPL_ExtDataRight = 2 - logical :: hasRun - -! --------------- -! Primary Exports -! --------------- - type PrimaryExport - PRIVATE - character(len=ESMF_MAXSTR) :: name - character(len=ESMF_MAXSTR) :: units - integer :: dim - integer :: vloc - character(len=ESMF_MAXSTR) :: cyclic - character(len=ESMF_MAXSTR) :: refresh_template - integer :: Trans - real :: scale, offset - logical :: do_offset, do_scale - character(len=ESMF_MAXSTR) :: var - character(len=ESMF_MAXPATHLEN) :: file - logical :: hasFileReffTime - character(len=ESMF_MAXSTR) :: FileReffTime - - type(ESMF_Time), pointer :: refresh_time => null() - logical :: doInterpolate = .true. - logical :: isConst - real :: Const - integer :: vartype ! MAPL_FieldItem or MAPL_BundleItem - -! variables for zero refresh time - type(ESMF_Field) :: finterp1, finterp2 - type(ESMF_FieldBundle) :: binterp1, binterp2 - type(ESMF_Time) :: time1, time2 - type(ESMF_Time) :: interp_time1, interp_time2 - integer :: climyear - type(ESMF_TimeInterval) :: frequency - type(ESMF_Time) :: reff_time - - ! if primary export represents a pair of vector fields - logical :: isVector, foundComp1, foundComp2 - ! fields to store endpoints for interpolation of a vector pair - type(ESMF_Field) :: v1_finterp1, v1_finterp2 - type(ESMF_Field) :: v2_finterp1, v2_finterp2 - - ! names of the two vector components in the gridded component where import is declared - character(len=ESMF_MAXSTR) :: vcomp1, vcomp2 - ! the corresponding names of the two vector components on file - character(len=ESMF_MAXSTR) :: fcomp1, fcomp2 - - ! Experimental: store CFIO and time vectors for each file - type(ESMF_CFIO) :: cfio1, cfio2 - type(ESMF_Time), Allocatable :: tSeries1(:), tSeries2(:) - logical :: isAssigned1 = .False. - logical :: isAssigned2 = .False. - - logical :: ExtDataAlloc - ! time shifting during continuous update - type(ESMF_TimeInterval) :: tshift - type(ESMF_Alarm) :: update_alarm - logical :: alarmIsEnabled = .false. - integer :: FracVal = MAPL_ExtDataNullFrac - ! do we have to do vertical interpolation - logical :: do_VertInterp = .false. - logical :: do_Fill = .false. - integer :: LM - real, allocatable :: levs(:) - character(len=ESMF_MAXSTR) :: levUnit - logical :: havePressure = .false. - end type PrimaryExport - - type PrimaryExports - PRIVATE - integer :: nItems = 0 - logical :: have_phis - type(PrimaryExport), pointer :: item(:) => null() - end type PrimaryExports - - type DerivedExport - PRIVATE - character(len=ESMF_MAXSTR) :: name - character(len=ESMF_MAXPATHLEN) :: expression - character(len=ESMF_MAXSTR) :: refresh_template - logical :: ExtDataAlloc - logical :: masking - type(ESMF_Time), pointer :: refresh_time => null() - ! time shifting during continuous update - type(ESMF_TimeInterval) :: tshift - type(ESMF_Alarm) :: update_alarm - logical :: alarmIsEnabled = .false. - end type DerivedExport - - type DerivedExports - PRIVATE - integer :: nItems = 0 - type(DerivedExport), pointer :: item(:) => null() - end type DerivedExports - -! Legacy state -! ------------ - type MAPL_ExtData_State - PRIVATE - type(PrimaryExports) :: Primary - type(DerivedExports) :: Derived - ! will add fields from export state to this state - ! will also add new fields that could be mask - ! or primary exports that were not in the export - ! state recieved by ExtData, i.e. fields that are - ! needed by a derived field where the primary fields - ! are not actually required - type(ESMF_State) :: ExtDataState - type(ESMF_Config) :: CF - logical :: active - logical :: ignoreCase - logical :: AllowExtrap - integer, allocatable :: PrimaryOrder(:) - end type MAPL_ExtData_State - -! Hook for the ESMF -! ----------------- - type MAPL_ExtData_Wrap - type (MAPL_ExtData_State), pointer :: PTR => null() - end type MAPL_ExtData_WRAP - -#if 0 - type T_EXTDATA_STATE - type(ESMF_State) :: expState - type(ESMF_GridComp) :: gc - end type T_EXTDATA_STATE - - ! Wrapper for extracting internal state - ! ------------------------------------- - type EXTDATA_WRAP - type (T_EXTDATA_STATE), pointer :: PTR - end type EXTDATA_WRAP -#endif - -! -!============================================================================= -contains -!============================================================================= -!BOP -! -! !IROUTINE: SetServices - -! !INTERFACE: - - subroutine SetServices ( GC, RC ) -! -! !OUTPUT PARAMETERS: - integer, intent(out) :: RC ! return code -! -! !INPUT/OUTPUT PARAMETERS: - type(ESMF_GridComp) :: GC ! gridded component - -! !DESCRIPTION: Sets Initialize and Run services. -! -! -!EOP -!============================================================================= -!BOC -! -! ErrLog Variables - character(len=ESMF_MAXSTR) :: IAm = 'SetServices' - integer :: STATUS - character(len=ESMF_MAXSTR) :: COMP_NAME - type (MAPL_ExtData_State), pointer :: self ! internal, that is - type (MAPL_ExtData_wrap) :: wrap - - ! Get my name and set-up traceback handle - !---------------------------------------- - - call ESMF_GridCompGet( GC, NAME=COMP_NAME, RC=STATUS ) - VERIFY_(STATUS) - - Iam = trim(COMP_NAME) //"::"// trim(Iam) - - call ESMF_LogWrite(Iam, ESMF_LOGMSG_INFO, rc=rc) - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(GC, model_routine_SS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! Register services for this component - ! ------------------------------------ - ! Provide InitializeP0 to switch to custom IPD version - call ESMF_GridCompSetEntryPoint(GC, ESMF_METHOD_INITIALIZE, & - userRoutine=InitializeP0, phase=0, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(GC, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv05p1"/), userRoutine=InitAdvertise, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSetEntryPoint(GC, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv05p4"/), userRoutine=InitForceGridTransfer, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSetEntryPoint(GC, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv05p6"/), userRoutine=InitRealize, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! Changing to DataInitialize specialization after change to - ! NUOPC_Model.F90 to use default IPDv05p8 implementation - - ! call NUOPC_CompSetEntryPoint(GC, ESMF_METHOD_INITIALIZE, & - ! phaseLabelList=(/"IPDv05p8"/), userRoutine=dataInitialize, rc=rc) - ! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - ! line=__LINE__, & - ! file=__FILE__)) & - ! return ! bail out - - call NUOPC_CompSpecialize(GC, specLabel=label_DataInitialize, & - specRoutine=dataInitialize, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! attach specializing method(s) - ! -> NUOPC specializes by default --->>> first need to remove the default - call ESMF_MethodRemove(GC, label_SetRunClock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSpecialize(GC, specLabel=label_SetRunClock, & - specRoutine=SetRunClock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_MethodRemove(GC, label=label_CheckImport,rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSpecialize(GC, specLabel=label_CheckImport, & - specRoutine=NUOPC_NoOp, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - - call NUOPC_CompSpecialize(GC, specLabel=label_Advance, & - specRoutine=ModelAdvance, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! Wrap internal state for storing in GC; rename legacyState - ! ------------------------------------- - allocate ( self, stat=STATUS ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - wrap%ptr => self - - ! Store internal state in GC - ! -------------------------- - call ESMF_UserCompSetInternalState ( GC, 'MAPL_ExtData_state', wrap, STATUS ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - - end subroutine SetServices - - !----------------------------------------------------------------------------- - - subroutine InitializeP0(gcomp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: gcomp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - call ESMF_LogWrite("ExtData InitializeP0", ESMF_LOGMSG_INFO, rc=rc) - - ! Switch to IPDv05 - ! by filtering all other phaseMap entries - call NUOPC_CompFilterPhaseMap(gcomp, ESMF_METHOD_INITIALIZE, & - acceptStringList=(/"IPDv05p"/), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine InitializeP0 - - !----------------------------------------------------------------------------- - - subroutine InitAdvertise(GC, IMPORT, EXPORT, CLOCK, rc) - type(ESMF_GridComp) :: GC - type(ESMF_State) :: IMPORT - type(ESMF_State) :: EXPORT - type(ESMF_Clock) :: CLOCK - integer, intent(out) :: rc - - ! locals - type (mystates_WRAP) :: mystates_ptr - type(MAPL_VarSpec), pointer :: exportSpec(:) - character(len=ESMF_MAXSTR) :: short_name - character(len=ESMF_MAXSTR) :: long_name - character(len=ESMF_MAXSTR) :: units - integer :: mytype - integer :: i - - rc = ESMF_SUCCESS - - call ESMF_LogWrite("ExtData:InitAdvertise", ESMF_LOGMSG_INFO, rc=rc) - - ! instead of explicitly advertising fields, set the - ! FieldTransferPolicy to "transferAll" so that all fields - ! in the CTM import state will be mirrored here - call NUOPC_SetAttribute(EXPORT, name="FieldTransferPolicy", & - value="transferAll", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine InitAdvertise -!EOC - - - !----------------------------------------------------------------------------- - - subroutine InitForceGridTransfer(gcomp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: gcomp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - ! local variables - integer :: i - type(ESMF_Field), pointer :: fieldList(:) - character(len=40) :: value - - rc = ESMF_SUCCESS - call ESMF_LogWrite("ExtData InitForceGridTransfer", ESMF_LOGMSG_INFO, rc=rc) - - ! By default all of the mirrored fields will have "TransferActionGeomObject" - ! set to "provide". This is because transfers are not transitive through the - ! hierarchy right now!! This means that a grid that is being transferred from - ! a child to its parent level, e.g. from unsatisfied fields in child import - ! states, cannot also be transferred on to a sibling of the parent. - - ! For the case of the extData component the above is really more a protocol - ! level limitation rather than a fundamental issue. Specifically, by the time - ! the driver component (which is the parent to the sub-components) would need - ! to transfer the grid to one of its sibling components, it actually does have - ! the grid available to do so (already transferred from the children). However, - ! the decision about whether this transfer is possible had to be made earlier, - ! following current NUOPC protocol. At that time the driver was still on the - ! receiving end of the transfer on the lower level of the hierarchy, and could - ! not act as a provider yet. - - ! The implementation in this routine works around this protocol limitation - ! and forces a transfer. It does so by directly setting the - ! "TransferActionGeomObject" attribute to "accept". This triggers the connector - ! to go through the actual GeomObject transfer. - ! - ! Note that "TransferActionGeomObject" is NOT an attribute that should typically - ! be modified by user level code. However, we know what we are doing here, - ! so let's do it! - - nullify(fieldList) - call NUOPC_GetStateMemberLists(exportState, fieldList=fieldList, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - if (associated(fieldList)) then - do i=1, size(fieldList) - ! first diagnose what the default setting ended up being on the - ! mirrored fields, expect "will provide" - call NUOPC_GetAttribute(fieldList(i), name="TransferActionGeomObject",& - value=value, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_LogWrite("TransferActionGeomObject in InitForceGridTransfer: "//& - trim(value), ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! now force the TransferActionGeomObject setting on the mirrored fields - ! to be "cannot provide" - call NUOPC_SetAttribute(fieldList(i), name="TransferActionGeomObject",& - value="accept", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - enddo - deallocate(fieldList) - endif - - end subroutine InitForceGridTransfer - - !----------------------------------------------------------------------------- - - subroutine SetRunClock(mediator, rc) - type(ESMF_GridComp) :: mediator - integer, intent(out) :: rc - - ! local variables - type(ESMF_Clock) :: mediatorClock, driverClock - type(ESMF_Time) :: currTime - - rc = ESMF_SUCCESS - - call ESMF_LogWrite("ExtData: SetRunClock", ESMF_LOGMSG_INFO, rc=rc) - - ! query the Mediator for clocks - call NUOPC_MediatorGet(mediator, mediatorClock=mediatorClock, & - driverClock=driverClock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! set the mediatorClock to have the current start time as the driverClock - call ESMF_ClockGet(driverClock, currTime=currTime, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_ClockSet(mediatorClock, currTime=currTime, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! check and set the component clock against the driver clock - call NUOPC_CompCheckSetClock(mediator, driverClock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, & - msg="NUOPC INCOMPATIBILITY DETECTED: between model and driver clocks", & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!BOP -! -! !IROUTINE: InitRealize -! -! !INTERFACE: -! - subroutine InitRealize ( GC, IMPORT, EXPORT, CLOCK, RC ) -! - type(ESMF_GridComp) :: GC ! Gridded component - type(ESMF_State) :: IMPORT ! Import state - type(ESMF_State) :: EXPORT ! Export state - type(ESMF_Clock) :: CLOCK ! The clock -! -! !OUTPUT PARAMETERS: - integer, intent( out) :: RC ! Error code! -! !DESCRIPTION: -! -!EOP -!============================================================================= -!BOC -! - character(len=ESMF_MAXSTR) :: IAm = 'initRealize' - integer :: STATUS, ic, nSpc, i, j, k - character(len=ESMF_MAXSTR) :: COMP_NAME - - ! locals - - RC = ESMF_SUCCESS - - call ESMF_GridCompGet ( GC, name=COMP_NAME, RC=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - Iam = trim(COMP_NAME)//'::InitRealize' - - call ESMF_LogWrite(Iam, ESMF_LOGMSG_INFO, rc=rc) - - call MirrorFieldsInState(EXPORT, rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - if ( MAPL_am_I_root() ) then - print *, trim(Iam)//": EXPORT State" - call ESMF_StatePrint ( EXPORT ) - endif - - end subroutine initRealize - - subroutine MirrorFieldsInState(state, rc) - type(ESMF_State), intent(in) :: state - integer, intent(out) :: rc - - integer :: i, itemCount, stat - type(ESMF_FieldStatus_Flag) :: fieldStatus - character(ESMF_MAXSTR), allocatable :: itemNameList(:) - type(ESMF_StateItem_Flag), allocatable :: itemTypeList(:) - type(ESMF_Field) :: field - - type(ESMF_Grid) :: grid - type(ESMF_DistGrid) :: distgrid - integer, allocatable :: minIndexPTile(:,:), maxIndexPTile(:,:) - integer :: dimCount - character(len=80) :: valueString, attrString - logical :: isPresent - type(ESMF_AttPack) :: attpack - integer, pointer :: ungriddedLBound(:), ungriddedUBound(:) - integer :: ungrid - integer :: knd - type(ESMF_TypeKind_Flag) :: typekind - - rc = ESMF_SUCCESS - - call ESMF_StateGet(state, itemCount=itemCount, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=__FILE__)) return ! bail out - - allocate(itemNameList(itemCount),stat=stat) - if (ESMF_LogFoundAllocError(statusToCheck=stat, & - msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=__FILE__, rcToReturn=rc)) & - return ! bail out - - allocate(itemTypeList(itemCount),stat=stat) - if (ESMF_LogFoundAllocError(statusToCheck=stat, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=__FILE__, rcToReturn=rc)) & - return ! bail out - - call ESMF_StateGet(state, itemNameList=itemNameList, & - itemTypeList=itemTypeList, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! WARNING: does not currently deal with nested states or field bundles - do i=lbound(itemNameList,1), ubound(itemNameList,1) - if (itemTypeList(i)==ESMF_STATEITEM_FIELD) then - - ! TODO: condition on NUOPC_IsConnected first - ! NUOPC_IsConnected(state, fieldName=fieldNameList(i)) - - call ESMF_StateGet(state, & - itemNameList(i), field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_FieldGet(field, status=fieldStatus, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - if (fieldStatus/=ESMF_FIELDSTATUS_COMPLETE) then - - call ESMF_LogWrite("Completing mirrored field: "//itemNameList(i), & - ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=__FILE__)) & - return ! bail out - - nullify(ungriddedLBound) - nullify(ungriddedUBound) - - call ESMF_AttributeGetAttPack(field, attpack=attpack, & - convention="NUOPC", purpose="Instance", isPresent=isPresent, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=__FILE__)) & - return ! bail out - if (.not. isPresent) then - ! attpack not present - call ESMF_LogWrite("Field level attpack NOT present!", & - ESMF_LOGMSG_WARNING, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=__FILE__)) & - return ! bail out - else - ! retrieve ungridded dimension bounds and mirror - ! match those as well - call ESMF_AttributeGet(field, name="UngriddedLBound", & - attpack=attpack, itemCount=itemCount, isPresent=isPresent, & - attnestflag=ESMF_ATTNEST_ON, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=__FILE__)) & - return ! bail out - - if (isPresent .and. itemCount > 0) then - allocate(ungriddedLBound(itemCount),stat=stat) - if (ESMF_LogFoundAllocError(statusToCheck=stat, & - msg="Allocation of internal ungriddedLBound failed.", & - line=__LINE__, file=__FILE__, rcToReturn=rc)) & - return ! bail out - - call ESMF_AttributeGet(field, & - name="UngriddedLBound", valueList=ungriddedLBound, & - convention="NUOPC", purpose="Instance", & - attnestflag=ESMF_ATTNEST_ON, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - endif - - call ESMF_AttributeGet(field, name="UngriddedUBound", & - attpack=attpack, itemCount=itemCount, isPresent=isPresent, & - attnestflag=ESMF_ATTNEST_ON, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=__FILE__)) & - return ! bail out - - if (isPresent .and. itemCount > 0) then - allocate(ungriddedUBound(itemCount),stat=stat) - if (ESMF_LogFoundAllocError(statusToCheck=stat, & - msg="Allocation of internal ungriddedUBound failed.", & - line=__LINE__, file=__FILE__, rcToReturn=rc)) & - return ! bail out - - call ESMF_AttributeGet(field, & - name="UngriddedUBound", valueList=ungriddedUBound, & - convention="NUOPC", purpose="Instance", & - attnestflag=ESMF_ATTNEST_ON, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - !print *, "UNGRIDDED UBOUND = ", ungriddedUBound - - endif - - call ESMF_AttributeGet(field, & - name="PRECISION", value=knd, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - if (knd == ESMF_KIND_R4) then - typekind = ESMF_TYPEKIND_R4 - else - typekind = ESMF_TYPEKIND_R8 - endif - endif - - if (associated(ungriddedLBound) .and. & - associated(ungriddedUBound)) then - call ESMF_FieldEmptyComplete(field, typekind=typekind, & - ungriddedLBound=ungriddedLBound, & - ungriddedUBound=ungriddedUBound, & - rc=rc) - deallocate(ungriddedLBound) - deallocate(ungriddedUBound) - else - call ESMF_FieldEmptyComplete(field, typekind=typekind, rc=rc) - endif - - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_FieldGet(field, grid=grid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_AttributeGet(grid, name='GRID_LM', & - value=UNGRID, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - !print *, 'grid GRID_LM:', UNGRID - -#define DEBUG_DISTGRID_off -#ifdef DEBUG_DISTGRID - call ESMF_FieldGet(field, grid=grid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_GridGet(grid, distgrid=distgrid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_DistGridGet(distgrid, dimCount=dimCount, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - allocate(minIndexPTile(dimCount,1), maxIndexPTile(dimCount,1)) - - call ESMF_DistGridGet(distgrid, minIndexPTile=minIndexPTile, & - maxIndexPTile=maxIndexPTile, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - write(valueString, *) "DistGrid minIndexPTile(:,1) = ", minIndexPTile(:,1) - call ESMF_LogWrite(valueString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - write(valueString, *) "DistGrid maxIndexPTile(:,1) = ", maxIndexPTile(:,1) - call ESMF_LogWrite(valueString, ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - deallocate(minIndexPTile) - deallocate(maxIndexPTile) - -#endif - else - call ESMF_LogWrite("CANNOT complete mirrored field: "//itemNameList(i), & - ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - end if - end if - end do - - deallocate(itemNameList) - deallocate(itemTypeList) - - end subroutine - -!------------------------------------------------------------------ - subroutine DataInitialize( GC, RC ) -! -! !INPUT/OUTPUT PARAMETERS: - type(ESMF_GridComp) :: GC ! Gridded component -! -! !OUTPUT PARAMETERS: - integer, intent( out) :: RC ! Error code - - ! locals - type(ESMF_Clock) :: clock - type(ESMF_State) :: importState, exportState - - RC = ESMF_SUCCESS - - call ESMF_LogWrite("EXTDATA:dataInitialize", ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! call NUOPC_ModelGet(GC, modelClock=clock, importState=importState, & - call ESMF_GridCompGet(GC, clock=clock, importState=importState, & - exportState=exportState, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! Initialize the data by reading the EXTDATA config file - call initialize_(GC, importState, exportState, clock, RC) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! must explicitly set time stamp on all export fields - call NUOPC_SetTimestamp(exportState, clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! indicate that data initialization is complete (breaking out of init-loop) - call NUOPC_CompAttributeSet(GC, & - name="InitializeDataComplete", value="true", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine DataInitialize - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: Initialize_ --- Initialize MAPL_ExtData -! -! !INTERFACE: -! - - SUBROUTINE Initialize_ ( GC, IMPORT, EXPORT, CLOCK, rc ) - -! !USES: - - implicit NONE - -! !INPUT PARAMETERS: - - type(ESMF_Clock), intent(inout) :: CLOCK ! The clock - -! !OUTPUT PARAMETERS: - - type(ESMF_GridComp), intent(inout) :: GC ! Grid Component - type(ESMF_State), intent(inout) :: IMPORT ! Import State - type(ESMF_State), intent(inout) :: EXPORT ! Export State - integer, intent(out) :: rc ! Error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: This is a simple ESMF wrapper. -! -! !REVISION HISTORY: -! -! 12Dec2009 da Silva Design and first implementation. -! -!EOP -!------------------------------------------------------------------------- - - type(MAPL_ExtData_state), pointer :: self ! Legacy state - type(ESMF_Grid) :: GRID ! Grid - type(ESMF_Config) :: CF_master ! Universal Config - - character(len=ESMF_MAXSTR) :: comp_name - character(len=ESMF_MAXSTR) :: Iam - integer :: Status - character(len=ESMF_MAXSTR) :: buffer - - type(PrimaryExports) :: Primary - type(PrimaryExport), pointer :: item - type(DerivedExports) :: Derived - type(DerivedExport), pointer :: derivedItem - integer :: nLines - integer :: i - integer :: ItemCount, itemCounter, j - integer :: PrimaryItemCount, DerivedItemCount - logical :: found - - type(ESMF_Time) :: time - character(len=ESMF_MAXSTR) :: VarName - - type (ESMF_Field) :: field,fieldnew - integer :: fieldRank, lm - type (ESMF_FieldBundle) :: bundle - integer :: fieldcount - type (ESMF_StateItem_Flag), pointer :: ITEMTYPES(:) - character(len=ESMF_MAXSTR), allocatable :: ITEMNAMES(:) - - character(len=ESMF_MAXSTR),allocatable :: PrimaryVarNames(:) - character(len=ESMF_MAXSTR),allocatable :: VarNames(:) - integer :: NumVarNames - -! logical to keep track of primary variables needed by derived fields, that ARE NOT in export state - logical, allocatable :: PrimaryVarNeeded(:) - logical, allocatable :: DerivedVarNeeded(:) - logical, allocatable :: LocalVarNeeded(:) - - type(ESMF_CFIO) :: cfio - integer :: counter - real, pointer :: ptr2d(:,:) => null() - real, pointer :: ptr3d(:,:,:) => null() - integer :: k, ios - character(len=ESMF_MAXSTR) :: c_offset, c_scale - character(len=ESMF_MAXSTR) :: EXTDATA_CF, ROOT_CF - type(ESMF_Config) :: CFtemp, CFtemp1 - integer :: totalPrimaryEntries - integer :: totalDerivedEntries - logical :: caseSensitiveVarNames - character(len=ESMF_MAXSTR) :: component1,component2 - character(len=ESMF_MAXPATHLEN) :: expression - integer :: idx,nhms,ihr,imn,isc - logical :: isNegative - character(len=ESMF_MAXSTR) :: thisLine - logical :: inBlock - type(ESMF_VM) :: vm - type(MAPL_MetaComp),pointer :: MAPLSTATE - -! Get my name and set-up traceback handle -! --------------------------------------- - Iam = 'Initialize_' - call ESMF_GridCompGet( GC, name=comp_name, config=CF_master, __RC__ ) - Iam = trim(comp_name) // '::' // trim(Iam) - -! Extract relevant runtime information -! ------------------------------------ - call extract_ ( GC, self, CF_master, __RC__) - call ESMF_ConfigGetAttribute(CF_master,ROOT_CF, Label='ROOT_CF:',default='GEOSCTM.rc',rc=status) - if (ESMF_LogFoundError(rcToCheck=status, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - CFtemp1 = ESMF_ConfigCreate (rc=STATUS ) - VERIFY_(STATUS) - call ESMF_ConfigLoadFile(CFtemp1,ROOT_CF,rc=status) - VERIFY_(STATUS) - self%CF = CFtemp1 - -! Start Some Timers -! ----------------- -! call MAPL_GetObjectFromGC ( gc, MAPLSTATE, RC=STATUS) -! VERIFY_(STATUS) -! call MAPL_TimerOn(MAPLSTATE,"TOTAL") -! call MAPL_TimerOn(MAPLSTATE,"Initialize") - -! Get information from export state -!---------------------------------- - call ESMF_StateGet(EXPORT, ITEMCOUNT=ItemCount, RC=STATUS) - VERIFY_(STATUS) - - ! set ExtData on by default, let user turn it off if they want - call ESMF_ConfigGetAttribute(CF_master,self%active, Label='USE_EXTDATA:',default=.true.,rc=status) - if (ESMF_LogFoundError(rcToCheck=status, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! set extdata to ignore case on variable names in files - call ESMF_ConfigGetAttribute(CF_master,caseSensitiveVarNames, Label='CASE_SENSITIVE_VARIABLE_NAMES:',default=.false.,rc=status) - if (ESMF_LogFoundError(rcToCheck=status, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - self%ignoreCase = .not. caseSensitiveVarNames - - ! no need to run ExtData if there are no imports to fill - if (ItemCount == 0) then - self%active = .false. - end if - - if (.not.self%active) then - RETURN_(ESMF_SUCCESS) - end if - -! Greetings -! --------- - if (MAPL_am_I_root()) then - print *, TRIM(Iam)//': ACTIVE' - print * - end if - - allocate(ITEMNAMES(ITEMCOUNT), STAT=STATUS) - VERIFY_(STATUS) - allocate(ITEMTYPES(ITEMCOUNT), STAT=STATUS) - VERIFY_(STATUS) - - call ESMF_StateGet(EXPORT, ITEMNAMELIST=ITEMNAMES, & - ITEMTYPELIST=ITEMTYPES, RC=STATUS) - VERIFY_(STATUS) - -! -------- -! Initialize MAPL Generic -! ----------------------- -! call MAPL_GenericInitialize ( GC, IMPORT, EXPORT, clock, __RC__ ) - - -! --------------------------- -! Parse ExtData Resource File -! --------------------------- - -! call ESMF_ConfigGetAttribute(CF_Master,value=EXTDATA_CF,Label="CF_EXTDATA:",rc=status) - call ESMF_ConfigGetAttribute(CF_Master,value=EXTDATA_CF,Label="EXTDATA_CF:",rc=status) - if (ESMF_LogFoundError(rcToCheck=status, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - VERIFY_(STATUS) - call ESMF_ConfigGetAttribute(CF_Master,value=self%allowExtrap,Label="Ext_AllowExtrap:", default=.true., rc=status) - if (ESMF_LogFoundError(rcToCheck=status, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - VERIFY_(STATUS) - - call ESMF_ConfigGetAttribute(CF_Master,value=Ext_Debug,Label="DEBUG_LEVEL:",default=0, rc=status) - if (ESMF_LogFoundError(rcToCheck=status, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - VERIFY_(STATUS) - !Ext_Debug = 20 - CFtemp = ESMF_ConfigCreate (rc=STATUS ) - VERIFY_(STATUS) - call ESMF_ConfigLoadFile(CFtemp,EXTDATA_CF,rc=status) - VERIFY_(STATUS) - - totalPrimaryEntries=0 - totalDerivedEntries=0 - call ESMF_ConfigNextLine(CFtemp,__RC__) - do while (status == ESMF_SUCCESS) - call ESMF_ConfigNextLine(CFtemp,rc=status) - if (status == ESMF_SUCCESS) then - call ESMF_ConfigGetAttribute(CFtemp,thisLine,rc=status) - VERIFY_(STATUS) - if (trim(thisLine) == "PrimaryExports%%" .or. trim(thisLine) == "DerivedExports%%" ) then - call advanceAndCount(CFtemp,nLines,rc=status) - VERIFY_(STATUS) - select case (trim(thisLine)) - case ("PrimaryExports%%") - totalPrimaryEntries = totalPrimaryEntries + nLines - case ("DerivedExports%%") - totalDerivedEntries = totalDerivedEntries + nLines - end select - end if - end if - enddo - ! destroy the config and reopen since there is no rewind function - call ESMF_ConfigDestroy(CFtemp,rc=status) - VERIFY_(STATUS) - - primary%nItems = totalPrimaryEntries - if (totalPrimaryEntries > 0) then - allocate (PrimaryVarNames(totalPrimaryEntries), stat=STATUS) - VERIFY_(STATUS) - allocate (PrimaryVarNeeded(totalPrimaryEntries), stat=STATUS) - VERIFY_(STATUS) - PrimaryVarNeeded = .false. - allocate(primary%item(totalPrimaryEntries), stat=STATUS) - VERIFY_(STATUS) - end if - - derived%nItems = totalDerivedEntries - if (totalDerivedEntries > 0) then - Allocate(DerivedVarNeeded(totalDerivedEntries),stat=status) - VERIFY_(STATUS) - DerivedVarNeeded = .false. - allocate(derived%item(totalDerivedEntries),stat=status) - VERIFY_(STATUS) - end if - -! Primary Exports -! --------------- - - totalPrimaryEntries = 0 - totalDerivedEntries = 0 - ! reload file and parse it - CFtemp = ESMF_ConfigCreate (rc=STATUS ) - VERIFY_(STATUS) - call ESMF_ConfigLoadFile(CFtemp,EXTDATA_CF,rc=status) - VERIFY_(STATUS) - call ESMF_ConfigNextLine(CFtemp,__RC__) - do while(status == ESMF_SUCCESS) - - call ESMF_ConfigNextLine(CFtemp,rc=status) - if (status == ESMF_SUCCESS) then - call ESMF_ConfigGetAttribute(CFtemp,thisLine,rc=status) - if (trim(thisLine) == "PrimaryExports%%" .or. trim(thisLine) == "DerivedExports%%" ) then - select case (trim(thisLine)) - case ("PrimaryExports%%") - inBlock = .true. - do while(inBLock) - call ESMF_ConfigNextLine(CFtemp, __RC__) - call ESMF_ConfigGetAttribute(CFtemp,thisLine,__RC__) - if (trim(thisLine) == "%%") then - inBlock = .false. - else - - totalPrimaryEntries = totalPrimaryEntries + 1 - ! name entry - primary%item(totalPrimaryEntries)%name = trim(thisLine) - !call ESMF_ConfigGetAttribute(CFtemp, primary%item(totalPrimaryEntries)%name, __RC__) - PrimaryVarNames(totalPrimaryEntries) = primary%item(totalPrimaryEntries)%name - ! check if this represents a vector by looking for semicolon - primary%item(totalPrimaryEntries)%isVector = ( index(primary%item(totalPrimaryEntries)%name,';').ne.0 ) - primary%item(totalPrimaryEntries)%vartype = MAPL_ExtDataVectorItem - primary%item(totalPrimaryEntries)%foundComp2 = .false. - primary%item(totalPrimaryEntries)%foundComp1 = .false. - - ! units entry - call ESMF_ConfigGetAttribute(CFtemp, primary%item(totalPrimaryEntries)%units, __RC__) - - ! climatology entry - call ESMF_ConfigGetAttribute(CFtemp, buffer, __RC__) - buffer = ESMF_UtilStringLowerCase(buffer, __RC__) - primary%item(totalPrimaryEntries)%cyclic=buffer - - ! regridding keyword, controls what type of regridding is performed - ! options are - ! N - conventional bilinear regridding - ! Y - conservative tile based regridding - ! V - voting, tile based - ! F;val - fractional, returns the fraction of the input cells with value, val - ! that overlap the target cell - call ESMF_ConfigGetAttribute(CFtemp, buffer, __RC__) - buffer = ESMF_UtilStringLowerCase(buffer, __RC__) - buffer = trim(buffer) - if (trim(buffer) == 'y') then -!!$ primary%item(totalPrimaryEntries)%Trans = MAPL_HorzTransOrderBinning - primary%item(totalPrimaryEntries)%trans = REGRID_METHOD_CONSERVE - else if (trim(buffer) == 'n') then -!!$ primary%item(totalPrimaryEntries)%Trans = MAPL_HorzTransOrderBilinear - primary%item(totalPrimaryEntries)%trans = REGRID_METHOD_BILINEAR - else if (trim(buffer) == 'v') then -!!$ primary%item(totalPrimaryEntries)%Trans = MAPL_HorzTransOrderSample - primary%item(totalPrimaryEntries)%trans = REGRID_METHOD_VOTE - else if (index(trim(buffer),'f') ==1 ) then -!!$ primary%item(totalPrimaryEntries)%Trans = MAPL_HorzTransOrderFraction - primary%item(totalPrimaryEntries)%trans = REGRID_METHOD_FRACTION - k = index(buffer,';') - ASSERT_(k > 0) - read(buffer(k+1:),*,iostat=ios) primary%item(totalPrimaryEntries)%FracVal - else - __raise__(MAPL_RC_ERROR, "the regridding keyword for extdata primary export must be N, Y, V, or F") - end if - - ! refresh template entry - call ESMF_ConfigGetAttribute(CFtemp, buffer, __RC__) - ! check if first entry is an F for no interpolation - buffer = trim(buffer) - if (buffer(1:1) == 'F') then - primary%item(totalPrimaryEntries)%refresh_template = buffer(2:) - primary%item(totalPrimaryEntries)%doInterpolate = .false. - else - primary%item(totalPrimaryEntries)%refresh_template = buffer - primary%item(totalPrimaryEntries)%doInterpolate = .true. - end if - ! offset entry - call ESMF_ConfigGetAttribute(CFtemp, c_offset, __RC__) - if (trim(c_offset) == "none") then - primary%item(totalPrimaryEntries)%do_offset = .false. - else - primary%item(totalPrimaryEntries)%do_offset = .true. - read(c_offset,*,iostat=ios) primary%item(totalPrimaryEntries)%offset - end if - ! scaling entry - call ESMF_ConfigGetAttribute(CFtemp, c_scale, __RC__) - if (trim(c_scale) == "none") then - primary%item(totalPrimaryEntries)%do_scale = .false. - else - primary%item(totalPrimaryEntries)%do_scale = .true. - read(c_scale,*,iostat=ios) primary%item(totalPrimaryEntries)%scale - end if - - ! variable name on file entry - call ESMF_ConfigGetAttribute(CFtemp, primary%item(totalPrimaryEntries)%var, __RC__) - ! file template entry - call ESMF_ConfigGetAttribute(CFtemp, primary%item(totalPrimaryEntries)%file, __RC__) - - ! the next three are optional entries to describe the time information about the file template - ! these are what is the first valid time you can apply to the file template to get a file that exists - ! then you can specify the frequnecy of the file and the units of the frequency - call ESMF_ConfigGetAttribute(CFtemp, primary%item(totalPrimaryEntries)%fileReffTime, rc=status) - if (status /= ESMF_SUCCESS) then - primary%item(totalPrimaryEntries)%FileReffTime = "" - primary%item(totalPrimaryEntries)%hasFileReffTime = .false. - else - primary%item(totalPrimaryEntries)%hasFileReffTime = .true. - end if - - ! assume we will allocate - primary%item(totalPrimaryEntries)%ExtDataAlloc = .true. - ! check if this is going to be a constant - primary%item(totalPrimaryEntries)%isConst = .false. - if (primary%item(totalPrimaryEntries)%file(1:9) == '/dev/null') then - primary%item(totalPrimaryEntries)%isConst = .true. - ios = -1 - k = index(primary%item(totalPrimaryEntries)%file,':') - if ( k > 9 ) then - read(primary%item(totalPrimaryEntries)%file(k+1:),*,iostat=ios) & - & primary%item(totalPrimaryEntries)%const - end if - if ( ios /= 0 ) primary%item(totalPrimaryEntries)%const = 0.0 - ! finally override whatever the cyclic arguement is - primary%item(totalPrimaryEntries)%cyclic='n' - end if - - - if ( primary%item(totalPrimaryEntries)%isConst .eqv. .false. ) then - call CreateTimeInterval(primary%item(totalPrimaryEntries),clock,__RC__) - end if - end if - enddo - ! Derived Exports - ! --------------- - case ("DerivedExports%%") - inBlock = .true. - do while(inBlock) - call ESMF_ConfigNextLine(CFtemp, __RC__) - call ESMF_ConfigGetAttribute(CFtemp,thisLine,__RC__) - if (trim(thisLine) == "%%") then - inBlock = .false. - else - totalDerivedEntries = totalDerivedEntries + 1 - derived%item(totalDerivedEntries)%name = trim(thisLine) - call ESMF_ConfigGetAttribute(CFtemp,derived%item(totalDerivedEntries)%expression,__RC__) - call ESMF_ConfigGetAttribute(CFtemp,derived%item(totalDerivedEntries)%refresh_template, __RC__) - derived%item(totalDerivedEntries)%ExtDataAlloc = .true. - end if - enddo - end select - end if - end if - end do - !Done parsing resource file - - PrimaryItemCount = 0 - DerivedItemCount = 0 - itemCounter = 0 - -! find items in primary and derived to fullfill Export state -! once we find primary or derived put in namespace - self%ExtDataState = ESMF_StateCreate(Name="ExtDataNameSpace",__RC__) - do I = 1, ItemCount - - found = .false. - do J = 1, primary%nItems - ! special handling if it is a vector - if (primary%item(J)%isVector) then - idx = index(primary%item(J)%name,";") - component1 = primary%item(J)%name(1:idx-1) - component2 = primary%item(J)%name(idx+1:) - if ( trim(ItemNames(I)) == trim(component1) ) then - primary%item(j)%vcomp1 = component1 - idx = index(primary%item(j)%var,";") - primary%item(j)%fcomp1 = primary%item(j)%var(1:idx-1) - itemCounter = itemCounter + 1 - found = .true. - primary%item(j)%foundComp1 = .true. - PrimaryVarNeeded(j) = .true. - primary%item(j)%ExtDataAlloc = .false. - if ( primary%item(j)%foundComp1 .and. primary%item(j)%foundComp2 ) PrimaryItemCount = PrimaryItemCount + 1 - call ESMF_StateGet(Export,component1,field,__RC__) - call MAPL_StateAdd(self%ExtDataState,field,__RC__) - ! put protection in, if you are filling vector pair, they must be fields, no bundles - ASSERT_( ITEMTYPES(I) == ESMF_StateItem_Field ) - exit - else if ( trim(ItemNames(I)) == trim(component2) ) then - primary%item(j)%vcomp2 = component2 - idx = index(primary%item(j)%var,";") - primary%item(j)%fcomp2 = primary%item(j)%var(idx+1:) - itemCounter = itemCounter + 1 - found = .true. - primary%item(j)%foundComp2 = .true. - PrimaryVarNeeded(j) = .true. - primary%item(j)%ExtDataAlloc = .false. - if ( primary%item(j)%foundComp1 .and. primary%item(j)%foundComp2 ) PrimaryItemCount = PrimaryItemCount + 1 - call ESMF_StateGet(Export,component2,field,__RC__) - call MAPL_StateAdd(self%ExtDataState,field,__RC__) - ! put protection in, if you are filling vector pair, they must be fields, no bundles - ASSERT_( ITEMTYPES(I) == ESMF_StateItem_Field ) - exit - end if - else - if (ItemNames(I) == primary%item(J)%name) then - itemCounter = itemCounter + 1 - found = .true. - if (primary%item(j)%isConst .and. ITEMTYPES(I) == ESMF_StateItem_FieldBundle) then - if (mapl_am_I_root()) write(*,*)'Can not have constant bundle in ExtData.rc file' - ASSERT_(.false.) - end if - PrimaryItemCount = PrimaryItemCount + 1 - PrimaryVarNeeded(j) = .true. - primary%item(j)%ExtDataAlloc = .false. - VarName=trim(primary%item(J)%name) - - if (ITEMTYPES(I) == ESMF_StateItem_Field) then - primary%item(J)%vartype = MAPL_FieldItem - call ESMF_StateGet(Export,VarName,field,__RC__) - call MAPL_StateAdd(self%ExtDataState,field,__RC__) - else if (ITEMTYPES(I) == ESMF_StateItem_FieldBundle) then - primary%item(J)%vartype = MAPL_BundleItem - call ESMF_StateGet(Export,VarName,bundle,__RC__) - call MAPL_StateAdd(self%ExtDataState,bundle,__RC__) - end if - exit - - end if - end if - end do - if ( (.not.found) .and. (derived%nItems > 0) ) then - do J = 1, derived%nItems - if (ItemNames(I) == derived%item(J)%name) then - - if (ITEMTYPES(I) == ESMF_StateItem_FieldBundle) then - ASSERT_(.false.) - end if - found = .true. - DerivedVarNeeded(j) = .true. - itemCounter = itemCounter + 1 - DerivedItemCount = DerivedItemCount + 1 - derived%item(j)%ExtDataAlloc = .false. - VarName=derived%item(j)%name - call ESMF_StateGet(Export,VarName,field,__RC__) - call MAPL_StateAdd(self%ExtDataState,field,__RC__) - exit - - end if - end do - end if - if (.not.found) then - if (mapl_am_I_root()) then - write(*,*)'ExtData could not satisfy import ',trim(ItemNames(I)) - end if - end if - end do - - call ESMF_VMGetCurrent(VM) - call ESMF_VMBarrier(VM) -! we have better found all the items in the export in either a primary or derived item - if ( itemCounter /= ItemCount ) then - if (mapl_am_I_root()) then - write(*,'(A6,I3,A31)')'Found ',ItemCount-itemCounter,' unfullfilled imports in extdata' - end if - ASSERT_(.false.) - end if - - NumVarNames=primary%nItems - allocate(VarNames(NumVarNames)) - allocate(LocalVarNeeded(NumVarNames)) - do i=1,primary%nItems - VarNames(i)=PrimaryVarNames(i) - end do - - IF (MAPL_am_I_root()) THEN - PRINT*, '************************************************' - PRINT*, '** Variables to be provided by the ExtData Component **' - PRINT*, '************************************************' - do I = 1, ItemCount - PRINT*, '---- ', I, ': ', TRIM(ItemNames(I)) - END DO - PRINT*, '************************************************' - PRINT* - END IF - -! search for other primary variables we may need to fill derived types that were not in the export state -! if we find them allocate them based on grid of variable we are trying to fill - do i=1, derived%nItems - if (DerivedVarNeeded(i)) then - LocalVarNeeded=.false. - - ! first check if it is a non-arithmetic function - expression = derived%item(i)%expression - expression = ESMF_UtilStringLowerCase(expression, __RC__) - if ( index(expression,"mask") /=0 ) then - derived%item(i)%masking = .true. - else - derived%item(i)%masking = .false. - end if - if (derived%item(i)%masking) then - call GetMaskName(derived%item(i)%expression,VarNames,LocalVarNeeded,__RC__) - else - call CheckSyntax(derived%item(i)%expression,VarNames,LocalVarNeeded,__RC__) - end if - - do j=1, primary%nItems - if (LocalVarNeeded(j)) then - VarName = trim(primary%item(j)%name) - call ESMF_StateGet(self%ExtDataState,VarName,field,rc=status) - if (status /= ESMF_SUCCESS) then - VarName = trim(derived%item(i)%name) - call ESMF_StateGet(self%ExtDataState,VarName,field,__RC__) - VarName=trim(primary%item(j)%name) - fieldnew = MAPL_FieldCreate(field,varname,doCopy=.true.,__RC__) - call MAPL_StateAdd(self%ExtDataState,fieldnew,__RC__) - PrimaryVarNeeded(j) = .true. - primary%item(j)%ExtDataAlloc = .true. - primary%item(j)%vartype = MAPL_FieldItem - PrimaryItemCount = PrimaryItemCount + 1 - end if - end if - end do - end if - end do - - self%primary%nItems = count(PrimaryVarNeeded) - if (DerivedItemCount > 0) self%derived%nItems = count(DerivedVarNeeded) - - allocate(self%primary%item(PrimaryItemCount),__STAT__) - if (DerivedItemCount > 0) allocate(self%derived%item(DerivedItemCount),__STAT__) - - counter = 0 - do i=1,primary%nItems - if (PrimaryVarNeeded(i)) then - counter = counter + 1 - self%primary%item(counter) = primary%item(i) - ! put in a special check if it is a vector item - ! both components must have bubbled up - if (self%primary%item(counter)%isVector) then - ASSERT_( self%primary%item(counter)%foundComp1 .and. self%primary%item(counter)%foundComp2 ) - end if - end if - end do - ASSERT_(counter==PrimaryItemCount) - - if (DerivedItemCount > 0) then - counter = 0 - do i=1,derived%nItems - if (derivedVarNeeded(i)) then - counter = counter + 1 - self%derived%item(counter) = derived%item(i) - end if - end do - ASSERT_(counter==DerivedItemCount) - end if - - call ESMF_ClockGet(CLOCK, currTIME=time, __RC__) - - PrimaryLoop: do i = 1, self%primary%nItems - - item => self%primary%item(i) - - ! parse refresh template to see if we have a time shift during constant updating - k = index(item%refresh_template,';') - call ESMF_TimeIntervalSet(item%tshift,__RC__) - if (k.ne.0) then - ASSERT_(trim(item%refresh_template(:k-1))=="0") - if (item%refresh_template(k+1:k+1) == '-' ) then - isNegative = .true. - read(item%refresh_template(k+2:),*,iostat=ios)nhms - else - isNegative = .false. - read(item%refresh_template(k+1:),*,iostat=ios)nhms - end if - call MAPL_UnpackTime(nhms,ihr,imn,isc) - if (isNegative) then - ihr = -ihr - imn = -imn - isc = -isc - end if - call ESMF_TimeIntervalSet(item%tshift,h=ihr,m=imn,s=isc,__RC__) - item%refresh_template = "0" - end if - call SetRefreshAlarms(clock,primaryItem=item,__RC__) - - if (item%vartype == MAPL_BundleItem) then - - call ESMF_StateGet(self%ExtDataState, trim(item%name), bundle,__RC__) - ! let us check that bundle is empty - call ESMF_FieldBundleGet(bundle, fieldcount = fieldcount , __RC__) - ASSERT_(fieldcount == 0) - call MAPL_CFIORead(item%file,time,bundle,noread=.true.,ignorecase=self%ignorecase, only_vars=item%var,__RC__) - - end if - -! Read the single step files (read interval equal to zero) -! -------------------------------------------------------- - - if (item%isConst) then - - if (item%vartype == MAPL_FieldItem) then - call ESMF_StateGet(self%ExtDataState,trim(item%name),field,__RC__) - call ESMF_FieldGet(field,dimCount=fieldRank,__RC__) - if (fieldRank == 2) then - call MAPL_GetPointer(self%ExtDataState, ptr2d, trim(item%name),__RC__) - ptr2d = item%const - else if (fieldRank == 3) then - call MAPL_GetPointer(self%ExtDataState, ptr3d, trim(item%name), __RC__) - ptr3d = item%const - endif - else if (item%vartype == MAPL_BundleItem) then - ASSERT_(.false.) - else if (item%vartype == MAPL_ExtDataVectorItem) then - call ESMF_StateGet(self%ExtDataState,trim(item%vcomp1),field,__RC__) - call ESMF_FieldGet(field,dimCount=fieldRank,__RC__) - if (fieldRank == 2) then - call MAPL_GetPointer(self%ExtDataState, ptr2d, trim(item%vcomp1),__RC__) - ptr2d = item%const - else if (fieldRank == 3) then - call MAPL_GetPointer(self%ExtDataState, ptr3d, trim(item%vcomp1), __RC__) - ptr3d = item%const - endif - call ESMF_StateGet(self%ExtDataState,trim(item%vcomp2),field,__RC__) - call ESMF_FieldGet(field,dimCount=fieldRank,__RC__) - if (fieldRank == 2) then - call MAPL_GetPointer(self%ExtDataState, ptr2d, trim(item%vcomp2),__RC__) - ptr2d = item%const - else if (fieldRank == 3) then - call MAPL_GetPointer(self%ExtDataState, ptr3d, trim(item%vcomp2), __RC__) - ptr3d = item%const - endif - end if - cycle - end if - - ! check if this is a single piece of data if user put - for refresh template - ! by that it is an untemplated file with one time that could not possibly be time interpolated - if (PrimaryExportIsConstant_(item)) then - if (index(item%file,'%') == 0) then - cfio = ESMF_CFIOCreate(cfioObjname='cfio_obj',__RC__) - call ESMF_CFIOSet(cfio,fName=trim(item%file),__RC__) - call ESMF_CFIOFileOpen(cfio,fmode=1,__RC__) - if (cfio%tsteps == 1) then - item%cyclic = 'single' - end if - end if - end if - - ! get clim year if this is cyclic - call GetClimYear(item,__RC__) - ! get levels, other information - call GetLevs(item,time,self%allowExtrap,__RC__) - - ! create interpolating fields, check if the vertical levels match the file - if (item%vartype == MAPL_FieldItem) then - - call ESMF_StateGet(self%ExtDataState, trim(item%name), field,__RC__) - call ESMF_FieldGet(field,grid=grid,rank=fieldRank,__RC__) - - lm=0 - if (fieldRank==3) then - call ESMF_FieldGet(field,0,farrayPtr=ptr3d, rc=status) - if (ESMF_LogFoundError(rcToCheck=status, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - lm = size(ptr3d,3) - end if - if (item%lm /= lm .and. lm /= 0 .and. item%havePressure) then - item%do_VertInterp = .true. - else if (item%lm /= lm .and. lm /= 0) then - item%do_Fill = .true. - end if - item%finterp1 = MAPL_FieldCreate(field,item%var,doCopy=.true.,__RC__) - item%finterp2 = MAPL_FieldCreate(field,item%var,doCopy=.true.,__RC__) - - else if (item%vartype == MAPL_BundleItem) then - - call ESMF_StateGet(self%ExtDataState, trim(item%name), bundle,__RC__) - call ESMF_FieldBundleGet(bundle,grid=grid,__RC__) - call ESMF_ClockGet(CLOCK, currTIME=time, __RC__) - item%binterp1 = ESMF_FieldBundleCreate( __RC__) - call ESMF_FieldBundleSet(item%binterp1, GRID=GRID, __RC__) - item%binterp2 = ESMF_FieldBundleCreate( __RC__) - call ESMF_FieldBundleSet(item%binterp2, GRID=GRID, __RC__) - call MAPL_CFIORead(item%file,time,item%binterp1,noread=.true.,ignorecase=self%ignorecase,only_vars=item%var,__RC__) - call MAPL_CFIORead(item%file,time,item%binterp2,noread=.true.,ignorecase=self%ignorecase,only_vars=item%var,__RC__) - - else if (item%vartype == MAPL_ExtDataVectorItem) then - - ! check that we are not asking for conservative regridding -!!$ if (item%Trans /= MAPL_HorzTransOrderBilinear) then - if (item%Trans /= REGRID_METHOD_BILINEAR) then - if (mapl_am_i_root()) write(*,*)"No conservative regridding with vectors" - ASSERT_(.false.) - end if - - call ESMF_StateGet(self%ExtDataState, trim(item%vcomp1), field,__RC__) - call ESMF_FieldGet(field,grid=grid,rank=fieldRank,__RC__) - - lm = 0 - if (fieldRank==3) then - call ESMF_FieldGet(field,0,farrayPtr=ptr3d,rc=status) - if (ESMF_LogFoundError(rcToCheck=status, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - lm = size(ptr3d,3) - end if - if (item%lm /= lm .and. item%havePressure) then - item%do_VertInterp = .true. - else if (item%lm /= lm .and. lm /= 0) then - item%do_Fill = .true. - end if - item%v1_finterp1 = MAPL_FieldCreate(field, item%vcomp1,doCopy=.true.,__RC__) - item%v1_finterp2 = MAPL_FieldCreate(field, item%vcomp1,doCopy=.true.,__RC__) - call ESMF_StateGet(self%ExtDataState, trim(item%vcomp2), field,__RC__) - item%v2_finterp1 = MAPL_FieldCreate(field, item%vcomp2,doCopy=.true.,__RC__) - item%v2_finterp2 = MAPL_FieldCreate(field, item%vcomp2,doCopy=.true.,__RC__) - end if - - allocate(item%refresh_time,__STAT__) - - call ESMF_TimeSet(item%refresh_time, yy=0, __RC__) - end do PrimaryLoop - - DerivedLoop: do i =1, self%derived%nItems - allocate(self%derived%item(i)%refresh_time,__STAT__) - - derivedItem => self%derived%item(i) - - ! parse refresh template to see if we have a time shift during constant updating - k = index(derivedItem%refresh_template,';') - call ESMF_TimeIntervalSet(derivedItem%tshift,__RC__) - if (k.ne.0) then - ASSERT_(trim(derivedItem%refresh_template(:k-1))=="0") - if (derivedItem%refresh_template(k+1:k+1) == '-' ) then - isNegative = .true. - read(derivedItem%refresh_template(k+2:),*,iostat=ios)nhms - else - isNegative = .false. - read(derivedItem%refresh_template(k+1:),*,iostat=ios)nhms - end if - call MAPL_UnpackTime(nhms,ihr,imn,isc) - if (isNegative) then - ihr = -ihr - imn = -imn - isc = -isc - end if - call ESMF_TimeIntervalSet(derivedItem%tshift,h=ihr,m=imn,s=isc,__RC__) - derivedItem%refresh_template = "0" - end if - - call SetRefreshAlarms(clock,derivedItem=derivedItem,__RC__) - - call ESMF_TimeSet(self%derived%item(i)%refresh_time, yy=0, __RC__) - end do DerivedLoop - -#ifdef DEBUG - if (MAPL_AM_I_ROOT()) then - print *, trim(Iam)//': IMPORT State during Initialize():' - call ESMF_StatePrint ( IMPORT ) - print * - print *, trim(Iam)//': EXPORT State during Initialize():' - call ESMF_StatePrint ( EXPORT ) - end if -#endif - -! Check if we have any files that would need to be vertically interpolated -! if so ensure that PS is done first - allocate(self%primaryOrder(size(self%primary%item)),__STAT__) - do i=1,size(self%primary%item) - self%primaryOrder(i)=i - enddo -! check for PS - idx = -1 - if (any(self%primary%item%do_VertInterp .eqv. .true.)) then - do i=1,size(self%primary%item) - if (self%primary%item(i)%name=='PS') then - idx =i - end if - if (self%primary%item(i)%vartype==MAPL_BundleItem) then - ASSERT_(.false.) - end if - enddo - ASSERT_(idx/=-1) - self%primaryOrder(1)=idx - self%primaryOrder(idx)=1 - self%primary%item(idx)%units = ESMF_UtilStringUppercase(self%primary%item(idx)%units,rc=status) - ASSERT_(trim(self%primary%item(idx)%units)=="PA") - end if -! check for PHIS - idx = -1 - if (any(self%primary%item%do_VertInterp .eqv. .true.)) then - do i=1,size(self%primary%item) - if (self%primary%item(i)%name=='PHIS') then - idx =i - end if - if (self%primary%item(i)%vartype==MAPL_BundleItem) then - ASSERT_(.false.) - end if - enddo - if (idx/=-1) then - self%primaryOrder(2)=idx - self%primaryOrder(idx)=2 - self%primary%have_phis=.true. - end if - end if - -! Clean up -! -------- - if (associated(primary%item)) deallocate(primary%item) - if (associated(derived%item)) deallocate(derived%item) - deallocate(ItemTypes) - deallocate(ItemNames) - if (allocated(PrimaryVarNames)) deallocate(PrimaryVarNames) - if (allocated(PrimaryVarNeeded)) deallocate(PrimaryVarNeeded) - if (allocated(VarNames)) deallocate(VarNames) - if (allocated(DerivedVarNeeded)) deallocate(DerivedVarNeeded) - if (allocated(LocalVarNeeded)) deallocate(LocalVarNeeded) - - !Done parsing resource file - -! Set has run to false to we know when we first go to run method it is first call - hasRun = .false. - -! call MAPL_TimerOff(MAPLSTATE,"Initialize") -! call MAPL_TimerOff(MAPLSTATE,"TOTAL") -! All done -! -------- - RETURN_(ESMF_SUCCESS) - - END SUBROUTINE Initialize_ - - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: Run_ --- Runs MAPL_ExtData -! -! !INTERFACE: -! - - subroutine ModelAdvance( GC, RC ) -! -! !INPUT/OUTPUT PARAMETERS: - type(ESMF_GridComp) :: GC ! Gridded component -! -! !OUTPUT PARAMETERS: - integer, intent( out) :: RC ! Error code - -! !DESCRIPTION: This is a simple ESMF wrapper. -! -! !REVISION HISTORY: -! -! 12Dec2009 da Silva Design and first implementation. -! -!EOP -!------------------------------------------------------------------------- - - ! local variables - type(ESMF_Clock) :: clock - type(ESMF_State) :: import, export - - type(MAPL_ExtData_state), pointer :: self ! Legacy state - type(ESMF_Field) :: field ! Field - type(ESMF_FieldBundle) :: bundle - type(ESMF_Config) :: CF ! Universal Config - - character(len=ESMF_MAXSTR) :: comp_name - character(len=ESMF_MAXSTR) :: Iam - integer :: status - - type(PrimaryExport), pointer :: item - type(DerivedExport), pointer :: derivedItem - integer :: i, j - - type(ESMF_Time) :: time, time0 - type(MAPL_MetaComp), pointer :: MAPLSTATE - - real, pointer, dimension(:,:) :: var2d_prev, var2d_next - real, pointer, dimension(:,:,:) :: var3d_prev, var3d_next - logical :: doUpdate_ - integer :: fieldCount, fieldRank - character(len=ESMF_MAXSTR), ALLOCATABLE :: NAMES (:) - type(ESMF_Field) :: field1, field2 - character(len=ESMF_MAXPATHLEN) :: file_processed, file_processed1, file_processed2 - integer :: NX, NY - logical :: NotSingle - logical :: updateL, updateR, swap - logical, allocatable :: doUpdate(:) - type(ESMF_Time), allocatable :: useTime(:) - real, pointer, dimension(:,:,:) :: fptr - integer :: is, js, ie, je - - -! Declare pointers to IMPORT/EXPORT/INTERNAL states -! ------------------------------------------------- -! #include "MAPL_ExtData_DeclarePointer___.h" - -! Get my name and set-up traceback handle -! --------------------------------------- - Iam = 'ModelAdvance' - call ESMF_GridCompGet( GC, name=comp_name, __RC__ ) - Iam = trim(comp_name) // '::' // trim(Iam) - call ESMF_GridCompGet(GC, clock=clock, importState=IMPORT, & - !call NUOPC_ModelGet(GC, modelClock=clock, importState=IMPORT, & - exportState=EXPORT, rc=rc) - if (ESMF_LogFoundError(rcToCheck=status, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_LogWrite('ExtData: modelAdvance', ESMF_LOGMSG_INFO, rc=rc) - -! Call Run for every Child -! ------------------------- -! call MAPL_GenericRun ( GC, IMPORT, EXPORT, CLOCK, __RC__) - - -! Extract relevant runtime information -! ------------------------------------ - call extract_ ( GC, self, CF, __RC__ ) - - if (.not. self%active) then - RETURN_(ESMF_SUCCESS) - end if - -! call MAPL_GetObjectFromGC ( gc, MAPLSTATE, RC=STATUS) -! VERIFY_(STATUS) -! call MAPL_TimerOn(MAPLSTATE,"TOTAL") -! call MAPL_TimerOn(MAPLSTATE,"Run") - - call ESMF_ClockGet(CLOCK, currTIME=time0, __RC__) - - -! Fill in the internal state with data from the files -! --------------------------------------------------- - - allocate(doUpdate(self%primary%nitems),stat=status) - VERIFY_(STATUS) - doUpdate = .false. - allocate(useTime(self%primary%nitems),stat=status) - VERIFY_(STATUS) - -! call MAPL_TimerOn(MAPLSTATE,"-Read_Loop") - - READ_LOOP: do i = 1, self%primary%nItems - - item => self%primary%item(self%primaryOrder(i)) - - if (item%isConst) cycle - ! Debug level 1 -! If (Ext_Debug > 0) Then - If (MAPL_AM_I_ROOT()) Then - Write(*,'(a,3(x,a))') '>> Reading ', trim(item%var), 'from', trim(item%file) - End If -! End If - - NotSingle = .true. - if (trim(item%cyclic) == 'single') NotSingle = .false. - - ! call MAPL_TimerOn(MAPLSTATE,"--CheckUpd") - - call CheckUpdate(doUpdate_,time,time0,hasRun,primaryItem=item,__RC__) - doUpdate(i) = doUpdate_ -! call MAPL_TimerOff(MAPLSTATE,"--CheckUpd") - - DO_UPDATE: if (doUpdate_) then - - HAS_RUN: if ( hasRun .eqv. .false.) then - -! call MAPL_TimerOn(MAPLSTATE,"--Bracket") - if (NotSingle) then - ! update left time - call UpdateBracketTime(item,time,"L",item%interp_time1, & - item%time1,file_processed1,item%isAssigned1,item%cfio1,item%tSeries1,self%allowExtrap,rc=status) - VERIFY_(status) - - ! update right time - call UpdateBracketTime(item,time,"R",item%interp_time2, & - item%time2,file_processed2,item%isAssigned2,item%cfio2,item%tSeries2,self%allowExtrap,rc=status) - VERIFY_(STATUS) - else - ! just get time on the file - item%time1 = MAPL_ExtDataGetFStartTime(trim(item%file),__RC__) - item%interp_time1 = item%time1 - file_processed1 = item%file - end if -! call MAPL_TimerOff(MAPLSTATE,"--Bracket") - - ! read bracketing data - -! call MAPL_TimerOn(MAPLSTATE,"--Read") - if (item%vartype /= MAPL_ExtDataVectorItem) then - - call MAPL_ExtDataGridCompRead(item,file_processed1, self,MAPL_ExtDataLeft,__RC__) - - if (NotSingle) then - call MAPL_ExtDataGridCompRead(item,file_processed2, self,MAPL_ExtDataRight,__RC__) - - end if - - else - - call ESMF_ConfigGetAttribute(self%cf, value = NX, Label="NX:", __RC__) - call ESMF_ConfigGetAttribute(self%cf, value = NY, Label="NY:", __RC__) - call MAPL_ExtDataReadVector(item,file_processed1,self,MAPL_ExtDataLeft,__RC__) - - if (NotSingle) then - call MAPL_ExtDataReadVector(item,file_processed2,self,MAPL_ExtDataRight,__RC__) - end if - - end if -! call MAPL_TimerOff(MAPLSTATE,"--Read") - - endif HAS_RUN - - ! now update bracketing times if neccessary - - NOT_SINGLE: if (NotSingle) then - - if (time >= item%interp_time2) then - ! normal flow assume clock is moving forward - updateR = .true. - updateL = .false. - swap = .true. - else if (time < item%interp_time1) then - ! the can only happen if clock was rewound like in replay update both - updateR = .true. - updateL = .true. - swap = .false. - else - updateR = .false. - updateL = .false. - swap = .false. - end if - -! call MAPL_TimerOn(MAPLSTATE,'--Swap') - DO_SWAP: if (swap) then - - item%interp_time1 = item%interp_time2 - - if (item%vartype == MAPL_FieldItem) then - - call ESMF_FieldGet(item%finterp1, dimCount=fieldRank,__RC__) - if (fieldRank == 2) then - call ESMF_FieldGet(item%finterp1, localDE=0, farrayPtr=var2d_prev, __RC__) - call ESMF_FieldGet(item%finterp2, localDE=0, farrayPtr=var2d_next, __RC__) - var2d_prev=var2d_next - else if (fieldRank == 3) then - call ESMF_FieldGet(item%finterp1, localDE=0, farrayPtr=var3d_prev, __RC__) - call ESMF_FieldGet(item%finterp2, localDE=0, farrayPtr=var3d_next, __RC__) - var3d_prev=var3d_next - endif - - else if (item%vartype == MAPL_BundleItem) then - - call ESMF_FieldBundleGet(item%binterp2, fieldCount = fieldCount, __RC__) - allocate(names(fieldCount),__STAT__) - call ESMF_FieldBundleGet(item%binterp2, fieldNameList = Names, __RC__) - do j = 1,fieldCount - call ESMF_FieldBundleGet(item%binterp1, names(j), field=field1, __RC__) - call ESMF_FieldBundleGet(item%binterp2, names(j), field=field2, __RC__) - call ESMF_FieldGet(field1, dimCount=fieldRank, __RC__) - if (fieldRank == 2) then - call ESMF_FieldGet(field1, localDE=0, farrayPtr=var2d_prev, __RC__) - call ESMF_FieldGet(field2, localDE=0, farrayPtr=var2d_next, __RC__) - var2d_prev=var2d_next - else if (fieldRank == 3) then - call ESMF_FieldGet(field1, localDE=0, farrayPtr=var3d_prev, __RC__) - call ESMF_FieldGet(field2, localDE=0, farrayPtr=var3d_next, __RC__) - var3d_prev=var3d_next - endif - enddo - - deallocate(names) - - else if (item%vartype == MAPL_ExtDataVectorItem) then - - call ESMF_FieldGet(item%v1_finterp1, dimCount=fieldRank, __RC__) - if (fieldRank == 2) then - call ESMF_FieldGet(item%v1_finterp1, localDE=0, farrayPtr=var2d_prev, __RC__) - call ESMF_FieldGet(item%v1_finterp2, localDE=0, farrayPtr=var2d_next, __RC__) - var2d_prev=var2d_next - call ESMF_FieldGet(item%v2_finterp1, localDE=0, farrayPtr=var2d_prev, __RC__) - call ESMF_FieldGet(item%v2_finterp2, localDE=0, farrayPtr=var2d_next, __RC__) - var2d_prev=var2d_next - else if (fieldRank == 3) then - call ESMF_FieldGet(item%v1_finterp1, localDE=0, farrayPtr=var3d_prev, __RC__) - call ESMF_FieldGet(item%v1_finterp2, localDE=0, farrayPtr=var3d_next, __RC__) - var3d_prev=var3d_next - call ESMF_FieldGet(item%v2_finterp1, localDE=0, farrayPtr=var3d_prev, __RC__) - call ESMF_FieldGet(item%v2_finterp2, localDE=0, farrayPtr=var3d_next, __RC__) - var3d_prev=var3d_next - endif - - end if - - end if DO_SWAP - -! call MAPL_TimerOff(MAPLSTATE,'--Swap') - - if (updateR) then - -! call MAPL_TimerOn(MAPLSTATE,'--Bracket') - - call UpdateBracketTime(item,time,"R",item%interp_time2, & - item%time2,file_processed,item%isAssigned2,item%cfio2,item%tSeries2,self%allowExtrap,rc=status) - VERIFY_(STATUS) - -! call MAPL_TimerOff(MAPLSTATE,'--Bracket') - -! call MAPL_TimerOn(MAPLSTATE,"--Read") - - if (item%vartype /= MAPL_ExtDataVectorItem) then - - call MAPL_ExtDataGridCompRead(item,file_processed,self,MAPL_ExtDataRight,__RC__) - - else if (item%vartype == MAPL_ExtDataVectorItem) then - - call ESMF_ConfigGetAttribute(self%cf, value = NX, Label="NX:", __RC__) - call ESMF_ConfigGetAttribute(self%cf, value = NY, Label="NY:", __RC__) - call MAPL_ExtDataReadVector(item,file_processed,self,MAPL_ExtDataRight,__RC__) - - end if -! call MAPL_TimerOff(MAPLSTATE,"--Read") - - end if - - if (updateL) then -! call MAPL_TimerOn(MAPLSTATE,'--Bracket') - - call UpdateBracketTime(item,time,"L",item%interp_time1, & - item%time1,file_processed,item%isAssigned1,item%cfio1,item%tSeries1,self%allowExtrap,rc=status) - VERIFY_(STATUS) - -! call MAPL_TimerOff(MAPLSTATE,'--Bracket') - -! call MAPL_TimerOn(MAPLSTATE,"--Read") - - if (item%vartype /= MAPL_ExtDataVectorItem) then - - call MAPL_ExtDataGridCompRead(item,file_processed,self,MAPL_ExtDataLeft,__RC__) - - else if (item%vartype == MAPL_ExtDataVectorItem) then - - call ESMF_ConfigGetAttribute(self%cf, value = NX, Label="NX:", __RC__) - call ESMF_ConfigGetAttribute(self%cf, value = NY, Label="NY:", __RC__) - call MAPL_ExtDataReadVector(item,file_processed,self,MAPL_ExtDataLeft,__RC__) - - end if - -! call MAPL_TimerOff(MAPLSTATE,"--Read") - - end if - - endif NOT_SINGLE - - useTime(i) = time - - end if DO_UPDATE - - if (PrimaryExportIsConstant_(item) .and. associated(item%refresh_time)) then - deallocate(item%refresh_time) - item%refresh_time => null() - end if - - end do READ_LOOP - -! call MAPL_TimerOff(MAPLSTATE,"-Read_Loop") - -! call MAPL_TimerOn(MAPLSTATE,"-Interpolate") - - INTERP_LOOP: do i = 1, self%primary%nItems - - item => self%primary%item(self%primaryOrder(i)) - - if (doUpdate(i)) then - - ! finally interpolate between bracketing times - - if (item%vartype == MAPL_FieldItem) then - - call ESMF_StateGet(self%ExtDataState, item%name, field, __RC__) - call MAPL_ExtDataInterpField(item,useTime(i),field,__RC__) - - else if (item%vartype == MAPL_BundleItem) then - - call ESMF_StateGet(self%ExtDataState, item%name, bundle, __RC__) - call ESMF_FieldBundleGet(bundle, fieldCount = fieldCount, __RC__) - allocate(names(fieldCount),__STAT__) - call ESMF_FieldBundleGet(bundle, fieldNameList = Names, __RC__) - do j = 1,fieldCount - call ESMF_FieldBundleGet(bundle,names(j), field=field, __RC__) - call MAPL_ExtDataInterpField(item,useTime(i),field,__RC__) - enddo - deallocate(names) - - else if (item%vartype == MAPL_ExtDataVectorItem) then - - call ESMF_StateGet(self%ExtDataState, item%vcomp1, field, __RC__) - call MAPL_ExtDataInterpField(item,useTime(i),field,vector_comp=1,__RC__) - call ESMF_StateGet(self%ExtDataState, item%vcomp2, field, __RC__) - call MAPL_ExtDataInterpField(item,useTime(i),field,vector_comp=2,__RC__) - - end if - - endif - - nullify(item) - - end do INTERP_LOOP - -! call MAPL_TimerOff(MAPLSTATE,"-Interpolate") - - ! now take care of derived fields - do i=1,self%derived%nItems - - derivedItem => self%derived%item(i) - - call CheckUpdate(doUpdate_,time,time0,hasRun,derivedItem=deriveditem,__RC__) - - if (doUpdate_) then - - call CalcDerivedField(self%ExtDataState,self%primary,derivedItem%name,derivedItem%expression, & - derivedItem%masking,__RC__) - - end if - - if (DerivedExportIsConstant_(derivedItem) .and. associated(derivedItem%refresh_time)) then - deallocate(self%derived%item(i)%refresh_time) - self%derived%item(i)%refresh_time => null() - end if - - end do - -! All done -! -------- - deallocate(doUpdate) - deallocate(useTime) - -#define PEGGY_DEBUG -#ifdef PEGGY_DEBUG -! Check the value of the PLE0 - call ESMF_StateGet(EXPORT,'pressure_at_layer_edges_before_advection',field, rc=rc) - call ESMF_FieldGet(field, farrayPtr=fptr, rc=rc) - if (MAPL_Am_I_Root()) then - print *, "EXTDATA: PLE0", lbound(fptr), ubound(fptr) - endif -#endif - - if (hasRun .eqv. .false.) hasRun = .true. -! call MAPL_TimerOff(MAPLSTATE,"Run") -! call MAPL_TimerOff(MAPLSTATE,"TOTAL") - - RETURN_(ESMF_SUCCESS) - - END SUBROUTINE ModelAdvance - -!------------------------------------------------------------------------- -! NASA/GSFC, Global Modeling and Assimilation Office, Code 610.1 ! -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: Finalize_ --- Finalize MAPL_ExtData -! -! !INTERFACE: -! - - SUBROUTINE Finalize_ ( GC, IMPORT, EXPORT, CLOCK, rc ) - -! !USES: - - implicit NONE - -! !INPUT PARAMETERS: - - type(ESMF_Clock), intent(inout) :: CLOCK ! The clock - -! !OUTPUT PARAMETERS: - - type(ESMF_GridComp), intent(inout) :: GC ! Grid Component - type(ESMF_State), intent(inout) :: IMPORT ! Import State - type(ESMF_State), intent(inout) :: EXPORT ! Export State - integer, intent(out) :: rc ! Error return code: - ! 0 - all is well - ! 1 - - -! !DESCRIPTION: This is a simple ESMF wrapper. -! -! !REVISION HISTORY: -! -! 12Dec2009 da Silva Design and first implementation. -! -!EOP -!------------------------------------------------------------------------- - - type(MAPL_ExtData_state), pointer :: self ! Legacy state - type(ESMF_Config) :: CF ! Universal Config - - character(len=ESMF_MAXSTR) :: comp_name - character(len=ESMF_MAXSTR) :: Iam - integer :: status - - integer :: i - - -! Get my name and set-up traceback handle -! --------------------------------------- - Iam = 'Finalize_' - call ESMF_GridCompGet( GC, name=comp_name, __RC__ ) - Iam = trim(comp_name) // trim(Iam) - -! Finalize MAPL Generic -! --------------------- - call MAPL_GenericFinalize ( GC, IMPORT, EXPORT, CLOCK, __RC__ ) - -! Extract relevant runtime information -! ------------------------------------ - call extract_ ( GC, self, CF, __RC__) - -! Free the memory used for the bracketing arrays -! ----------------------------------------------------------- - if (self%active) then - do i = 1, self%primary%nItems - - if (self%primary%item(i)%isConst) cycle - - if (trim(self%primary%item(i)%refresh_template) == "0") then - if (self%primary%item(i)%vartype == MAPL_FieldItem) then - call ESMF_FieldDestroy(self%primary%item(i)%finterp1,__RC__) - call ESMF_FieldDestroy(self%primary%item(i)%finterp2,__RC__) - end if - end if - - if (associated(self%primary%item(i)%refresh_time)) then - deallocate(self%primary%item(i)%refresh_time) - end if - -! Destroy CFIO associated with each item - !if (self%primary%item(i)%isAssigned1) then - !call ESMF_CFIODestroy(self%primary%item(i)%cfio1,__RC__) - !if (allocated(self%primary%item(i)%tSeries1)) then - !deallocate(self%primary%item(i)%tSeries1) - !end if - !self%primary%item(i)%isAssigned1 = .False. - !end if - !if (self%primary%item(i)%isAssigned2) then - !call ESMF_CFIODestroy(self%primary%item(i)%cfio2,__RC__) - !if (allocated(self%primary%item(i)%tSeries2)) then - !deallocate(self%primary%item(i)%tSeries2) - !end if - !self%primary%item(i)%isAssigned2 = .False. - !end if - end do - - -! Free the memory used to hold the primary export items -! ----------------------------------------------------- - if (associated(self%primary%item)) then - deallocate(self%primary%item) - end if - end if - - -! All done -! -------- - RETURN_(ESMF_SUCCESS) - - end SUBROUTINE Finalize_ - -!....................................................................... - - subroutine extract_ ( GC, self, CF, rc) - - type(ESMF_GridComp), intent(INout) :: GC ! Grid Comp object - - type(MAPL_ExtData_state), pointer :: self ! Legacy state - type(ESMF_Config), intent(out) :: CF ! Universal Config - - integer, intent(out), optional :: rc - -! --- - - character(len=ESMF_MAXSTR) :: comp_name - character(len=ESMF_MAXSTR) :: Iam - integer :: status - - type(MAPL_ExtData_Wrap) :: wrap - -! Get my name and set-up traceback handle -! --------------------------------------- - Iam = 'extract_' - call ESMF_GridCompGet( GC, NAME=comp_name, __RC__ ) - Iam = trim(COMP_NAME) // '::' // trim(Iam) - - rc = 0 - -! Get my internal state -! --------------------- - call ESMF_UserCompGetInternalState(gc, 'MAPL_ExtData_state', WRAP, STATUS) - VERIFY_(STATUS) - self => wrap%ptr - -! Get the configuration -! --------------------- - call ESMF_GridCompGet ( GC, config=CF, __RC__ ) - - - RETURN_(ESMF_SUCCESS) - - end subroutine extract_ - -! ............................................................................ - - logical function PrimaryExportIsConstant_(item) - - type(PrimaryExport), intent(in) :: item - - if ( trim(item%refresh_template) == '-' .or. & - trim(item%file) == '/dev/null' ) then - PrimaryExportIsConstant_ = .true. - else - PrimaryExportIsConstant_ = .false. - end if - - end function PrimaryExportIsConstant_ - -! ............................................................................ - - logical function DerivedExportIsConstant_(item) - - type(DerivedExport), intent(in) :: item - - if ( trim(item%refresh_template) == '-') then - DerivedExportIsConstant_ = .true. - else - DerivedExportIsConstant_ = .false. - end if - - end function DerivedExportIsConstant_ - -! ............................................................................ - - subroutine scale_field_(offset, scale_factor, field, rc) - real, intent(in) :: scale_factor - real, intent(in) :: offset - type (ESMF_Field), intent(inout) :: field - integer, optional, intent (inout) :: rc - - __Iam__('scale_field_') - - integer :: fieldRank - real, pointer :: xy(:,:) => null() - real, pointer :: xyz(:,:,:) => null() - - - call ESMF_FieldGet(field, dimCount=fieldRank, __RC__) - - ASSERT_(fieldRank == 2 .or. fieldRank == 3) - - if (fieldRank == 2) then - call ESMF_FieldGet(field, farrayPtr=xy, __RC__) - - if (associated(xy)) then - xy = offset + scale_factor*xy - end if - else if (fieldRank == 3) then - call ESMF_FieldGet(field, farrayPtr=xyz, __RC__) - - if (associated(xyz)) then - xyz = offset + scale_factor*xyz - end if - end if - - return - end subroutine scale_field_ - -! ............................................................................ - - type (ESMF_Time) function timestamp_(time, template, rc) - type(ESMF_Time), intent(inout) :: time - character(len=ESMF_MAXSTR), intent(in) :: template - integer, optional, intent(inout) :: rc - - __Iam__('timestamp_') - - ! locals - integer, parameter :: DATETIME_MAXSTR_ = 32 - integer :: yy, mm, dd, hs, ms, ss - character(len=DATETIME_MAXSTR_) :: buff, buff_date, buff_time - character(len=DATETIME_MAXSTR_) :: str_yy, str_mm, str_dd - character(len=DATETIME_MAXSTR_) :: str_hs, str_ms, str_ss - - integer :: i, il, ir - - ! test the length of the timestamp template - ASSERT_(len_trim(template) < DATETIME_MAXSTR_) - - buff = trim(template) - buff = ESMF_UtilStringLowerCase(buff, __RC__) - - ! test if the template is empty and return the current time as result - if (buff == '-' .or. buff == '--' .or. buff == '---' .or. & - buff == 'na' .or. buff == 'none' .or. buff == 'n/a') then - - timestamp_ = time - else - ! split the time stamp template into a date and time strings - i = scan(buff, 't') - If (.not.(i > 3)) Then - Write(*,'(a,a,a)') 'ERROR: Time stamp ', Trim(template), & - ' uses the fixed format, and must therefore contain a T' - ASSERT_(.False.) - End If - - buff_date = buff(1:i-1) - buff_time = buff(i+1:) - - ! parse the date string - il = scan(buff_date, '-', back=.false.) - ir = scan(buff_date, '-', back=.true. ) - str_yy = trim(buff_date(1:il-1)) - str_mm = trim(buff_date(il+1:ir-1)) - str_dd = trim(buff_date(ir+1:)) - - ! parse the time string - il = scan(buff_time, ':', back=.false.) - ir = scan(buff_time, ':', back=.true. ) - str_hs = trim(buff_time(1:il-1)) - str_ms = trim(buff_time(il+1:ir-1)) - str_ss = trim(buff_time(ir+1:)) - - ! remove the trailing 'Z' from the seconds string - i = scan(str_ss, 'z') - if (i > 0) then - str_ss = trim(str_ss(1:i-1)) - end if - - ! apply the timestamp template - call ESMF_TimeGet(time, yy=yy, mm=mm, dd=dd, h=hs, m=ms, s=ss, __RC__) - - i = scan(str_yy, '%'); if (i == 0) read (str_yy, '(I4)'), yy - i = scan(str_mm, '%'); if (i == 0) read (str_mm, '(I2)'), mm - i = scan(str_dd, '%'); if (i == 0) read (str_dd, '(I2)'), dd - i = scan(str_hs, '%'); if (i == 0) read (str_hs, '(I2)'), hs - i = scan(str_ms, '%'); if (i == 0) read (str_ms, '(I2)'), ms - i = scan(str_ss, '%'); if (i == 0) read (str_ss, '(I2)'), ss - - call ESMF_TimeSet(timestamp_, yy=yy, mm=mm, dd=dd, h=hs, m=ms, s=ss, __RC__) - end if - - RETURN_(ESMF_SUCCESS) - - end function timestamp_ - - subroutine CreateTimeInterval(item,clock,rc) - type(PrimaryExport) , intent(inout) :: item - type(ESMF_Clock) , intent(in ) :: clock - integer, optional , intent(out ) :: rc - - __Iam__('CreateTimeInterval') - - integer :: iyy,imm,idd,ihh,imn,isc - integer :: lasttoken - character(len=2) :: token - type(ESMF_Time) :: time - integer :: cindex,pindex - character(len=ESMF_MAXSTR) :: creffTime, ctInt - - creffTime = '' - ctInt = '' - call ESMF_ClockGet (CLOCK, currTIME=time, __RC__) - if (.not.item%hasFileReffTime) then - ! if int_frequency is less than zero than try to guess it from the file template - ! if that fails then it must be a single file or a climatology - - call ESMF_TimeGet(time, yy=iyy, mm=imm, dd=idd,h=ihh, m=imn, s=isc ,__RC__) - !======================================================================= - ! Using "now" as a reference time makes it difficult to find a file if - ! we need to extrapolate, and doesn't make an awful lot of sense anyway. - ! Instead, use the start of (current year - 20) or 1985, whichever is - ! earlier (SDE 2016-12-30) - iyy = Min(iyy-20,1985) - imm = 1 - idd = 1 - ihh = 0 - imn = 0 - isc = 0 - !======================================================================= - lasttoken = index(item%file,'%',back=.true.) - if (lasttoken.gt.0) then - token = item%file(lasttoken+1:lasttoken+2) - select case(token) - case("y4") - call ESMF_TimeSet(item%reff_time,yy=iyy,mm=1,dd=1,h=0,m=0,s=0,__RC__) - call ESMF_TimeIntervalSet(item%frequency,yy=1,__RC__) - case("m2") - call ESMF_TimeSet(item%reff_time,yy=iyy,mm=imm,dd=1,h=0,m=0,s=0,__RC__) - call ESMF_TimeIntervalSet(item%frequency,mm=1,__RC__) - case("d2") - call ESMF_TimeSet(item%reff_time,yy=iyy,mm=imm,dd=idd,h=0,m=0,s=0,__RC__) - call ESMF_TimeIntervalSet(item%frequency,d=1,__RC__) - case("h2") - call ESMF_TimeSet(item%reff_time,yy=iyy,mm=imm,dd=idd,h=ihh,m=0,s=0,__RC__) - call ESMF_TimeIntervalSet(item%frequency,h=1,__RC__) - case("n2") - call ESMF_TimeSet(item%reff_time,yy=iyy,mm=imm,dd=idd,h=ihh,m=imn,s=0,__RC__) - call ESMF_TimeIntervalSet(item%frequency,m=1,__RC__) - end select - else - ! couldn't find any tokens so all the data must be on one file - call ESMF_TimeIntervalSet(item%frequency,__RC__) - end if - else - ! Reference time should look like: - ! YYYY-MM-DDThh:mm:ssPYYYY-MM-DDThh:mm:ss - ! The date before the P is the reference time, from which future times - ! will be taken. The date after the P is the frequency with which the - ! file changes. For example, if the data is referenced to 1985 and - ! there is 1 file per year, the reference time should be - ! 1985-01-01T00:00:00P0001-00-00T00:00:00 - ! Get refference time, if not provided use current model date - pindex=index(item%FileReffTime,'P') - if (pindex==0) then - Write(*,'(a,a,a)') 'ERROR: File template ', item%file, ' has invalid reference date format' - ASSERT_(.false.) - end if - cReffTime = item%FileReffTime(1:pindex-1) - if (trim(cReffTime) == '') then - item%reff_time = Time - else - call MAPL_NCIOParseTimeUnits(cReffTime,iyy,imm,idd,ihh,imn,isc,status) - VERIFY_(STATUS) - call ESMF_TimeSet(item%reff_time,yy=iyy,mm=imm,dd=idd,h=ihh,m=imn,s=isc,rc=status) - VERIFY_(STATUS) - end if - ! now get time interval. Put 0000-00-00 in front if not there so parsetimeunits doesn't complain - ctInt = item%FileReffTime(pindex+1:) - cindex = index(ctInt,'T') - if (cindex == 0) ctInt = '0000-00-00T'//trim(ctInt) - call MAPL_NCIOParseTimeUnits(ctInt,iyy,imm,idd,ihh,imn,isc,status) - VERIFY_(STATUS) - call ESMF_TimeIntervalSet(item%frequency,yy=iyy,mm=imm,d=idd,h=ihh,m=imn,s=isc,rc=status) - VERIFY_(STATUS) - end if - - If (Mapl_Am_I_Root().and.(Ext_Debug > 19)) Then - Write(*,'(5(a))') ' >> REFFTIME for ',trim(item%file),': ',trim(item%FileReffTime) - call ESMF_TimeGet(item%reff_time,yy=iyy,mm=imm,dd=idd,h=ihh,m=imn,s=isc,rc=status) - Write(*,'(a,I0.4,5(a,I0.2))') ' >> Reference time: ',iYy,'-',iMm,'-',iDd,' ',iHh,':',iMn,':',iSc - call ESMF_TimeIntervalGet(item%frequency,yy=iyy,mm=imm,d=idd,h=ihh,m=imn,s=isc,rc=status) - Write(*,'(a,I0.4,5(a,I0.2))') ' >> Frequency : ',iYy,'-',iMm,'-',iDd,' ',iHh,':',iMn,':',iSc - End If - RETURN_(ESMF_SUCCESS) - - end subroutine CreateTimeInterval - - subroutine GetClimYear(item, rc) - - type(PrimaryExport) , intent(inout) :: item - integer, optional , intent(out ) :: rc - - __Iam__('GetClimYear') - - type(ESMF_CFIO) :: cfio - integer(ESMF_KIND_I4) :: iyr,imm,idd - integer :: begDate - type(ESMF_TimeInterval) :: zero - integer :: lasttoken - character(len=ESMF_MAXPATHLEN) :: file - character(len=2) :: token - integer :: nymd, nhms, climYear - character(len=ESMF_MAXSTR) :: buffer - logical :: inRange - - buffer = trim(item%cyclic) - - if (trim(buffer) == 'n') then - - item%cyclic = "n" - RETURN_(ESMF_SUCCESS) - - else if (trim(buffer) == 'single') then - - RETURN_(ESMF_SUCCESS) - else if (trim(buffer) == 'y') then - - item%cyclic = "y" - - call ESMF_TimeIntervalSet(zero,__RC__) - cfio = ESMF_CFIOCreate (cfioObjName='cfio_obj',__RC__) - - if (item%frequency == zero) then - file = item%file - else - lasttoken = index(item%file,'%',back=.true.) - token = item%file(lasttoken+1:lasttoken+2) - ASSERT_(token == "m2") - ! just put a time in so we can evaluate the template to open a file - nymd = 20000101 - nhms = 0 - call ESMF_CFIOStrTemplate(file,item%file,'GRADS',nymd=nymd,nhms=nhms,__STAT__) - end if - call ESMF_CFIOSet(CFIO, fName=trim(file),__RC__) - call ESMF_CFIOFileOpen (CFIO, FMODE=1,__RC__) - begDate = cfio%date - call MAPL_UnpackTime(begDate,iyr,imm,idd) - item%climyear = iyr - call ESMF_CFIODestroy(CFIO,__RC__) - RETURN_(ESMF_SUCCESS) - else - read(buffer,'(I4)') climYear - inRange = 0 <= climYear .and. climYear <= 3000 - if (inRange) then - item%cyclic = "y" - item%climYear = climYear - RETURN_(ESMF_SUCCESS) - else - WRITE(*,*)'cyclic keyword was not y, n, or a year' - ASSERT_(.false.) - end if - end if - - end subroutine GetClimYear - - subroutine GetLevs(item, time, allowExtrap, rc) - - type(PrimaryExport) , intent(inout) :: item - type(ESMF_Time) , intent(inout) :: time - logical , intent(in ) :: allowExtrap - integer, optional , intent(out ) :: rc - - __Iam__('GetLevs') - - type(ESMF_CFIO) :: cfio - type(ESMF_CFIOGRID),pointer :: cfiogrid - integer(ESMF_KIND_I4) :: iyr,imm,idd,ihr,imn,iss,i,n,refYear - character(len=ESMF_MAXPATHLEN) :: file - integer :: nymd, nhms - type(ESMF_Time) :: fTime - real, pointer :: levFile(:) => null() - integer :: nVars - type(ESMF_CFIOVarInfo), pointer :: vars(:) - character(len=ESMF_MAXSTR) :: cfiovarname,units,buff,varname - logical :: found,intOK,lFound - integer :: maxOffset - - type(ESMF_TimeInterval) :: zero - - call ESMF_TimeIntervalSet(zero,__RC__) - - if (item%frequency == zero) then - - file = item%file - Inquire(file=trim(file),EXIST=found) - - else - buff = trim(item%refresh_template) - buff = ESMF_UtilStringLowerCase(buff, __RC__) - if ( index(buff,'t')/=0) then - if (index(buff,'p') == 0) then - ftime = timestamp_(time,buff,__RC__) - else - ftime = time - end if - else - ftime = time - end if - - call ESMF_TimeGet(fTime,yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=iss,__RC__) - if (item%cyclic == 'y') then - iyr = item%climyear - end if - call MAPL_PackTime(nymd,iyr,imm,idd) - call MAPL_PackTime(nhms,ihr,imn,iss) - call ESMF_CFIOStrTemplate(file,item%file,'GRADS',nymd=nymd,nhms=nhms,__STAT__) - Inquire(file=trim(file),EXIST=found) - - end if - - if (found) then - call MakeCFIO(file, cfio, found, __RC__) - else - if (allowExtrap .and. (item%cyclic == 'n') ) then - - ftime = item%reff_time - n = 0 - maxOffSet = 100 - call ESMF_TimeGet(item%reff_time,yy=refYear) - lfound = .false. - intOK = .true. - do while (intOK .and. (.not.lfound)) - call ESMF_TimeGet(fTime,yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=iss,__RC__) - call MAPL_PackTime(nymd,iyr,imm,idd) - call MAPL_PackTime(nhms,ihr,imn,iss) - call gx_(file,item%file,nymd=nymd,nhms=nhms,__STAT__) - call MakeCFIO(file,cfio,lfound) - Inquire(FILE=trim(file),EXIST=found) - intOK = (abs(iYr-refYear)levFile(size(levFile))) then - do i=1,size(levFile) - item%levs(i)=levFile(size(levFile)-i+1) - enddo - else - item%levs=levFile - end if - if (trim(item%levUnit)=='hPa') item%levs=item%levs*100.0 - ! check if the level unit matches something that is pressure - if (trim(item%levUnit) == 'hPa') then - item%havePressure = .true. - end if - - end if - - call ESMF_CFIOGet (CFIO,varObjs=VARS, nVars=nVars, RC=STATUS) - VERIFY_(STATUS) - varname = trim(item%var) - varname = ESMF_UtilStringUpperCase(varname,rc=status) - do i=1,nVars - call ESMF_CFIOVarInfoGet(Vars(i),vname=CFIOVARNAME, vunits=UNITS,rc=status) - VERIFY_(STATUS) - cfiovarname = ESMF_UtilStringUpperCase(cfiovarname,rc=status) - if (trim(cfiovarname)==trim(varname)) then - item%units=units - endif - enddo - call ESMF_CFIODestroy(cfio,__RC__) - RETURN_(ESMF_SUCCESS) - - end subroutine GetLevs - - subroutine UpdateBracketTime(item,cTime,bSide,interpTime,fileTime,file_processed,isAssigned,xCFIO,xTSeries,allowExtrap,rc) - type(PrimaryExport), intent(inout) :: item - type(ESMF_Time), intent(inout) :: cTime - character(len=1), intent(in ) :: bSide - type(ESMF_TIME), intent(inout) :: interpTime - type(ESMF_TIME), intent(inout) :: fileTime - character(len=*), intent(inout) :: file_processed - type(ESMF_CFIO), intent(inout) :: xCFIO - type(ESMF_Time), Allocatable, intent(inout) :: xTSeries(:) - logical, intent(inout) :: isAssigned - logical, intent(in ) :: allowExtrap - integer, optional, intent(out ) :: rc - - __Iam__('UpdateBracketTime') - - type(ESMF_Time) :: newTime - integer :: curDate,curTime,n - integer(ESMF_KIND_I4) :: iyr, imm, idd, ihr, imn, isc, oldYear - integer(ESMF_KIND_I4) :: fyr, fmm, fdd, fhr, fmn, fsc - type(ESMF_TimeInterval) :: zero - type(ESMF_Time) :: fTime - logical :: UniFileClim - type(ESMF_Time) :: readTime - - ! Allow for extrapolation.. up to a limit - integer :: yrOffset,yrOffsetStamp - integer(ESMF_KIND_I4) :: cYearOff, refYear - character(len=ESMF_MAXSTR) :: buff - integer, parameter :: maxOffset=10000 - logical :: found, newFile - logical :: LExtrap, RExtrap, LExact, RExact - logical :: LSide, RSide, intOK, bracketScan - - call ESMF_TimeIntervalSet(zero,__RC__) - - ! Default - fTime = cTime - bracketScan = .False. - - - ! Is there only one file for this dataset? - if (item%frequency == zero) then - if (mapl_am_I_root().and.(Ext_Debug > 19)) Then - write(*,'(a,a,a,a)') ' DEBUG: Scanning fixed file ',trim(item%file),' for side ',bSide - end if - UniFileClim = .false. - ! if the file is constant, i.e. no tokens in in the template - ! but it was marked as cyclic we must have a year long climatology - ! on one file, set UniFileClim to true - if (trim(item%cyclic)=='y') UniFileClim = .true. - file_processed = item%file - ! Generate CFIO if needed - If (.not.isAssigned) Then - call MakeCFIO(file_processed,xCFIO,found,rc=status) - ! Retrieve the time series - allocate(xTSeries(xCFIO%tSteps)) - call GetTimesOnFile(xCFIO,xTSeries,rc=status) - isAssigned = .True. - End If - If (status /= ESMF_SUCCESS) then - if (mapl_am_I_root()) Then - write(*,'(a,a)') ' ERROR: Time vector retrieval failed on fixed file ',trim(item%file) - end if - RETURN_(ESMF_FAILURE) - end if - call GetBracketTimeOnSingleFile(xCFIO,xTSeries,cTime,bSide,UniFileClim,interpTime,fileTime,allowExtrap,item%climYear,rc=status) - if (status /= ESMF_SUCCESS) then - if (mapl_am_I_root()) Then - write(*,'(a,a,a,a)') ' ERROR: Bracket timing request failed on fixed file ',trim(item%file),' for side ',bSide - end if - RETURN_(ESMF_FAILURE) - end if - else - if (mapl_am_I_root().and.(Ext_Debug > 19)) Then - write(*,'(a,a,a,a)') ' DEBUG: Scanning template ',trim(item%file),' for side ',bSide - call ESMF_TimeGet(cTime,yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - Write(*,'(a,I0.4,5(a,I0.2))') ' >> >> >> Target time : ',iYr,'-',iMM,'-',iDD,' ',iHr,':',iMn,':',iSc - call ESMF_TimeGet(item%reff_time,yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - Write(*,'(a,I0.4,5(a,I0.2))') ' >> >> >> Reference time: ',iYr,'-',iMM,'-',iDD,' ',iHr,':',iMn,':',iSc - end if - UniFileClim = .false. - found = .false. - ! Start by assuming the file we want exists - if (trim(item%cyclic)=='y') then - ! if climatology compute year offset - call ESMF_TimeGet(cTime,yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - yrOffset = item%climYear - iyr - call ESMF_TimeSet(fTime,yy=item%climYear,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - else - yrOffset = 0 - if (item%reff_time > cTime) then - Write(*,'(a,a,a)') 'ERROR: Reference time for file ', Trim(item%file),' is too late' - ASSERT_(.False.) - end if - ! This approach causes a problem if cTime and item%reff_time are too far - ! apart - do it the hard way instead... - ftime = item%reff_time - n = 0 - ! SDE DEBUG: This caused problems in the past but the - ! alternative is far too slow... need to keep an eye - ! on this but the Max(0,...) should help. - n = max(0,floor((cTime-item%reff_time)/item%frequency)) - if (n>0) fTime = fTime + (n*item%frequency) - do while (.not.found) - ! SDE: This needs to be ">" - found = ((ftime + item%frequency) > ctime) - if (.not.found) then - n = n + 1 - ftime = fTime+item%frequency - end if - end do - if (mapl_am_I_root().and.(Ext_Debug > 19)) Then - write(*,'(a,a,a,a)') ' DEBUG: Untemplating ',trim(item%file) - call ESMF_TimeGet(cTime,yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - Write(*,'(a,I0.4,5(a,I0.2))') ' >> >> >> Target time : ',iYr,'-',iMM,'-',iDD,' ',iHr,':',iMn,':',iSc - call ESMF_TimeGet(fTime,yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - Write(*,'(a,I0.4,5(a,I0.2))') ' >> >> >> File time : ',iYr,'-',iMM,'-',iDD,' ',iHr,':',iMn,':',iSc - call ESMF_TimeIntervalGet(item%frequency,yy=iyr,mm=imm,d=idd,h=ihr,m=imn,s=isc,__RC__) - Write(*,'(a,I0.4,5(a,I0.2))') ' >> >> >> item%frequency : ',iYr,'-',iMM,'-',iDD,' ',iHr,':',iMn,':',iSc - Write(*,'(a,I5)') ' >> >> >> N : ',n - end if - end if - readTime = cTime - call ESMF_TimeGet(fTime,yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - call MAPL_PackTime(curDate,iyr,imm,idd) - call MAPL_PackTime(curTime,ihr,imn,isc) - call gx_(file_processed,item%file,nymd=curDate,nhms=curTime,__STAT__) - Inquire(FILE=trim(file_processed),EXIST=found) - If (found) Then - if (mapl_am_I_root().and.(Ext_Debug > 19)) Then - write(*,'(a,a,a,a)') ' DEBUG: Target file for ',trim(item%file),' found and is ',trim(file_processed) - end if - !yrOffset = 0 - Else if (allowExtrap) then - if (mapl_am_I_root().and.(Ext_Debug > 19)) Then - write(*,'(a,a,a)') ' DEBUG: Propagating forwards on ',trim(item%file),' from reference time' - call ESMF_TimeGet(item%reff_time,yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - Write(*,'(a,I0.4,5(a,I0.2))') ' >> >> >> Reference time: ',iYr,'-',iMM,'-',iDD,' ',iHr,':',iMn,':',iSc - end if - ! Go back to the reference time, and propagate forwards until we find - ! the first valid file - ftime = item%reff_time - call ESMF_TimeGet(item%reff_time,yy=refYear,__RC__) - If (refYear.lt.1850) Then - if (mapl_am_I_root()) Then - write(*,'(a,I0.4,a,a)') 'Reference year too early (', refYear, '). Aborting search for data from ',trim(item%file) - end if - RETURN_(ESMF_FAILURE) - End If - intOK = .True. - found = .false. - ! yrOffset currently tracking how far we are from the reference year - n = 0 - yrOffset = 0 - ftime = item%reff_time - Do While (intOK.and.(.not.found)) - call ESMF_TimeGet(fTime,yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - call MAPL_PackTime(curDate,iyr,imm,idd) - call MAPL_PackTime(curTime,ihr,imn,isc) - call gx_(file_processed,item%file,nymd=curDate,nhms=curTime,__STAT__) - Inquire(FILE=trim(file_processed),EXIST=found) - yrOffset = iYr-refYear - intOK = (abs(yrOffset)> >> >> Reference time: ',iYr,'-',iMM,'-',iDD,' ',iHr,':',iMn,':',iSc - call ESMF_TimeGet(fTime,yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - Write(*,'(a,I0.4,5(a,I0.2))') ' >> >> >> Last check : ',iYr,'-',iMM,'-',iDD,' ',iHr,':',iMn,':',iSc - end if - RETURN_(ESMF_FAILURE) - End If - If (isAssigned) Then - ! Do we still have the right file? - If (Trim(xCFIO%fNAME) .ne. Trim(file_processed)) Then - isAssigned = .False. - If (allocated(xTSeries)) Deallocate(xTSeries) - Call ESMF_CFIODestroy(xCFIO,__RC__) - End If - End If - If (.not.isAssigned) Then - ! Generate CFIO - call MakeCFIO(file_processed,xCFIO,found,rc=status) - ! Retrieve the time series - allocate(xTSeries(xCFIO%tSteps)) - call GetTimesOnFile(xCFIO,xTSeries,rc=rc) - isAssigned = .True. - End If - ! Is this before or after our target time? - LSide = (bSide == "L") - RSide = (.not.LSide) - LExact = (cTime == xTSeries(1)) - LExtrap = (cTime < xTSeries(1)) - RExact = (cTime == xTSeries(xCFIO%tSteps)) - RExtrap = (cTime > xTSeries(xCFIO%tSteps)) - found = .false. - If (LExtrap.or.(LExact.and.RSide)) Then - if (mapl_am_I_root().and.(Ext_Debug>2)) Then - write(*,'(a,a,a,a)') ' Extrapolating BACKWARD for bracket ', bSide, ' for file ',trim(item%file) - end if - ! We have data from future years - ! Advance the target time until we can have what we want - call ESMF_TimeGet(cTime,yy=cYearOff,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - iYr = refYear + yrOffset - ! Convert year offset to the future value - yrOffset = iYr - cYearOff - ! Determine the template time - call ESMF_TimeSet(newTime,yy=iYr,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - ftime = item%reff_time - n = 0 - do while (.not.found) - found = ((ftime + item%frequency) > newtime) - if (.not.found) then - n = n + 1 - ftime = fTime+item%frequency - end if - end do - ! untemplate file - call ESMF_TimeGet(fTime,yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - ! Build file name - call MAPL_PackTime(curDate,iyr,imm,idd) - call MAPL_PackTime(curTime,ihr,imn,isc) - call gx_(file_processed,item%file,nymd=curDate,nhms=curTime,__STAT__) - Inquire(FILE=trim(file_processed),EXIST=found) - If (.not.found) Then - if (mapl_am_I_root()) Then - write(*,'(a,a,a,a)') ' ERROR: Failed to project data from ',trim(item%file),' for side ',bSide - end if - RETURN_(ESMF_FAILURE) - End If - ElseIf (RExtrap.or.(RExact.and.RSide)) Then - if (mapl_am_I_root().and.(Ext_Debug>2)) Then - write(*,'(a,a,a,a)') ' Extrapolating FORWARD for bracket ', bSide, ' for file ',trim(item%file) - end if - ! We have data from past years - ! Rewind the target time until we can have what we want - call ESMF_TimeGet(cTime,yy=refYear,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - yrOffset = 0 - fTime = cTime - ! yrOffset: Number of years added from current time to get file time - Do While ((.not.found).and.(abs(yrOffset).lt.maxOffset)) - yrOffset = yrOffset - 1 - iYr = refYear + yrOffset - call ESMF_TimeSet(newTime,yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - ! Error check - if the new time is before the first file time, - ! all is lost - If (newTime.lt.xTSeries(1)) exit - do while (ftime > newTime) - fTime = fTime - item%frequency - n = n - 1 - end do - ! untemplate file - call ESMF_TimeGet(fTime,yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - call MAPL_PackTime(curDate,iyr,imm,idd) - call MAPL_PackTime(curTime,ihr,imn,isc) - call gx_(file_processed,item%file,nymd=curDate,nhms=curTime,__STAT__) - Inquire(FILE=trim(file_processed),EXIST=found) - End Do - If (.not.found) Then - if (mapl_am_I_root()) Then - write(*,'(a,a,a,a)') ' ERROR: Could not determine upper bounds on ',trim(item%file),' for side ',bSide - end if - RETURN_(ESMF_FAILURE) - End If - Else - if (mapl_am_I_root()) Then - write(*,'(a,a,a,a)') ' ERROR: Unkown error while scanning ',trim(item%file),' for side ',bSide - end if - RETURN_(ESMF_FAILURE) - End If - End If - - ! Should now have the "correct" time - ! Generate CFIO for the "current" file - If (MAPL_Am_I_Root().and.(Ext_Debug > 19)) Write(*,'(a,a)') ' DEBUG: Generating CFIO for ', trim(file_processed) - If (isAssigned) Then - ! Do we still have the right file? - If (Trim(xCFIO%fNAME) .ne. Trim(file_processed)) Then - isAssigned = .False. - If (allocated(xTSeries)) Deallocate(xTSeries) - Call ESMF_CFIODestroy(xCFIO,__RC__) - End If - End If - If (.not.isAssigned) Then - ! Generate CFIO - call MakeCFIO(file_processed,xCFIO,found,rc=status) - ! Retrieve the time series - allocate(xTSeries(xCFIO%tSteps)) - call GetTimesOnFile(xCFIO,xTSeries,rc=rc) - isAssigned = .True. - End If - - ! We now have a time which, when passed to the FILE TEMPLATE, returns a valid file - ! However, if the file template does not include a year token, then the file in - ! question could actually be for a different year. We therefore feed the file time - ! into the refresh template and see if the result has the same year. If it doesn't, - ! then we can assume that the year is actually fixed, and the times in the file will - ! correspond to the year in the refresh template. In this case, an additional year - ! offset must be applied. - yrOffsetStamp = 0 - buff = trim(item%refresh_template) - buff = ESMF_UtilStringLowerCase(buff, __RC__) - If (buff /= "0" .and. index(buff,"p")==0) Then - newTime = timestamp_(fTime,item%refresh_template,__RC__) - if (newTime .ne. fTime) Then - call ESMF_TimeGet(fTime,yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - call ESMF_TimeGet(newTime,yy=fyr,mm=fmm,dd=fdd,h=fhr,m=fmn,s=fsc,__RC__) - yrOffsetStamp = fYr - iYr - End If - End If - - ! try to get bracketing time on file using current time - call GetBracketTimeOnFile(xCFIO,xTSeries,readTime,bSide,UniFileClim,interpTime,fileTime,yrOffsetInt=yrOffset+yrOffsetStamp,rc=status) - found = (status==ESMF_SUCCESS) - - If (MAPL_Am_I_Root().and.(Ext_Debug > 19)) Write(*,'(a,a,a,L1)') ' DEBUG: Status of ', trim(file_processed),': ', found - - ! if we didn't find the bracketing time look forwards or backwards depending on - ! whether it is the right or left time - if (.not.found) then - If (MAPL_Am_I_Root().and.(Ext_Debug > 19)) Write(*,'(a,a,a,a,a,L1)') ' DEBUG: Scanning for bracket ', bSide, ' of ', trim(file_processed), '. RSide: ', (bSide=="R") - bracketScan = .True. - newTime = fTime - if (bSide == "R") then - found=.false. - newFile=allowExtrap - status = ESMF_SUCCESS - If (MAPL_Am_I_Root().and.(Ext_Debug > 19)) Write(*,'(a,a,a,I5,x,2L1)') ' DEBUG: Sanity check on file ', trim(file_processed), ' with flags: ', status, status==ESMF_SUCCESS,found - do while ((status==ESMF_SUCCESS).and.(.not.found)) - ! check next time - newTime = fTime + item%frequency - if (trim(item%cyclic)=='y') then - call ESMF_TimeGet(fTime,yy=OldYear) - call ESMF_TimeGet(newTime,yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - if (oldyear/=iyr) then - call ESMF_TimeSet(newTime,yy=oldyear,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - yrOffset = yrOffset - 1 - If (MAPL_Am_I_Root()) Write(*,'(a,I0.4,5(a,I0.2))') ' DEBUG: IN clim after ',Oldyear,'-',iMm,'-',iDd,' ',iHr,':',iMn,':',iSc - end if - end if - ! untemplate file - call ESMF_TimeGet(newTime,yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - - call MAPL_PackTime(curDate,iyr,imm,idd) - call MAPL_PackTime(curTime,ihr,imn,isc) - call gx_(file_processed,item%file,nymd=curDate,nhms=curTime,__STAT__) - If (MAPL_Am_I_Root().and.(Ext_Debug > 19)) Write(*,'(a,a,a,I0.4,5(a,I0.2))') ' DEBUG: Testing for file ', trim(file_processed), ' for target time ',iYr,'-',iMm,'-',iDd,' ',iHr,':',iMn,':',iSc - Inquire(FILE=trim(file_processed),EXIST=found) - If (found) Then - fTime = newTime - Else If (newFile) Then - ! We went RIGHT - cycle round by SUBTRACTING a year - yrOffset = yrOffset - 1 - newFile = .False. ! Only one attempt - call OffsetTimeYear(fTime,-1,newTime,rc) - fTime = newTime - Else - status = ESMF_FAILURE - End If - End Do - if (status /= ESMF_SUCCESS) then - if (mapl_am_I_root()) write(*,*)'ExtData could not find appropriate file from file template ',trim(item%file),' for side ',bSide - RETURN_(ESMF_FAILURE) - end if - else if (bSide == "L") then - found=.false. - newFile=allowExtrap - status = ESMF_SUCCESS - do while ((status==ESMF_SUCCESS).and.(.not.found)) - ! check next time - newTime = fTime - item%frequency - if (trim(item%cyclic)=='y') then - call ESMF_TimeGet(fTime,yy=OldYear) - call ESMF_TimeGet(newTime,yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - if (oldyear/=iyr) then - call ESMF_TimeSet(newTime,yy=oldyear,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - yrOffset = yrOffset + 1 - If (MAPL_Am_I_Root()) Write(*,'(a,I0.4,5(a,I0.2))') ' DEBUG: IN clim after ',Oldyear,'-',iMm,'-',iDd,' ',iHr,':',iMn,':',iSc - end if - end if - ! untemplate file - call ESMF_TimeGet(newTime,yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - - call MAPL_PackTime(curDate,iyr,imm,idd) - call MAPL_PackTime(curTime,ihr,imn,isc) - call gx_(file_processed,item%file,nymd=curDate,nhms=curTime,__STAT__) - Inquire(FILE=trim(file_processed),EXIST=found) - If (found) Then - fTime = newTime - Else If (newFile) Then - ! We went LEFT - cycle round by ADDING a year - yrOffset = yrOffset + 1 - newFile = .False. ! Only one attempt - call OffsetTimeYear(fTime,+1,newTime,rc) - fTime = newTime - Else - status = ESMF_FAILURE - End If - End Do - if (status /= ESMF_SUCCESS) then - if (mapl_am_I_root()) write(*,*)'ExtData could not find appropriate file from file template ',trim(item%file),' for side ',bSide - RETURN_(ESMF_FAILURE) - end if - end if - - ! fTime is now ALWAYS the time which was applied to the file template to get the current file - If (isAssigned) Then - ! Do we still have the right file? - If (Trim(xCFIO%fNAME) .ne. Trim(file_processed)) Then - isAssigned = .False. - If (allocated(xTSeries)) Deallocate(xTSeries) - Call ESMF_CFIODestroy(xCFIO,__RC__) - End If - End If - If (.not.isAssigned) Then - ! Generate CFIO - call MakeCFIO(file_processed,xCFIO,found,rc=status) - ! Retrieve the time series - allocate(xTSeries(xCFIO%tSteps)) - call GetTimesOnFile(xCFIO,xTSeries,rc=rc) - isAssigned = .True. - End If - - !If (Mapl_Am_I_Root()) Write (*,'(a,a,x,a)') ' SUPERDEBUG: File/template: ',Trim(file_processed),Trim(item%refresh_template) - ! The file template may be "hiding" a year offset from us - yrOffsetStamp = 0 - buff = trim(item%refresh_template) - buff = ESMF_UtilStringLowerCase(buff, __RC__) - If (buff /= "0" .and. index(buff,"p")==0 ) Then - newTime = timestamp_(fTime,item%refresh_template,__RC__) - If (Mapl_Am_I_Root().and.Ext_Debug > 24) Then - call ESMF_TimeGet(fTime,yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - call ESMF_TimeGet(newTime,yy=fyr,mm=fmm,dd=fdd,h=fhr,m=fmn,s=fsc,__RC__) - Write(*,'(3a,I0.4,5(a,I0.2),a,I0.4,5(a,I0.2),2a)') ' DEBUG: Template ',Trim(item%refresh_template),' applied: ',& - iyr,'-',imm,'-',idd,' ',ihr,':',imn,':',isc,' -> ',& - fyr,'-',fmm,'-',fdd,' ',fhr,':',fmn,':',fsc,& - ' on file ',Trim(file_processed) - End If - if (newTime .ne. fTime) Then - call ESMF_TimeGet(fTime,yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - call ESMF_TimeGet(newTime,yy=fyr,mm=fmm,dd=fdd,h=fhr,m=fmn,s=fsc,__RC__) - yrOffsetStamp = fYr - iYr - If (Mapl_Am_I_Root().and.Ext_Debug > 19) Then - Write(*,'(2(a,I4),2a)') ' DEBUG: Year offset modified from ',yrOffset,' to ',yrOffset+yrOffsetStamp,' to satisfy refresh template for ', Trim(file_processed) - End If - End If - End If - - ! try to get bracketing time on file using new time - call GetBracketTimeOnFile(xCFIO,xTSeries,readTime,bSide,UniFileClim,interpTime,fileTime,yrOffsetInt=yrOffset+yrOffsetStamp,rc=status) - found = (status == ESMF_SUCCESS) - if (.not.found) then - if (mapl_am_I_root()) write(*,*)'ExtData could not find bracketing data from file template ',trim(item%file),' for side ',bSide - RETURN_(ESMF_FAILURE) - - end if - - end if - - end if - - ! Debug - If (Mapl_Am_I_Root().and.Ext_Debug > 10) Then - Write(*,'(a,a,a,a)') ' >> >> Updated bracket ', bSide, ' for ', Trim(file_processed) - call ESMF_TimeGet(cTime,yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - Write(*,'(a,I0.4,5(a,I0.2))') ' >> >> >> Time requested: ',iYr,'-',iMM,'-',iDD,' ',iHr,':',iMn,':',iSc - call ESMF_TimeGet(fileTime,yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - Write(*,'(a,I0.4,5(a,I0.2))') ' >> >> >> Record time : ',iYr,'-',iMM,'-',iDD,' ',iHr,':',iMn,':',iSc - call ESMF_TimeGet(interpTime,yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - Write(*,'(a,I0.4,5(a,I0.2))') ' >> >> >> Effective time: ',iYr,'-',iMM,'-',iDD,' ',iHr,':',iMn,':',iSc - End If - ! If we made it this far, then I guess we are OK? - RETURN_(ESMF_SUCCESS) - - end subroutine UpdateBracketTime - - subroutine MakeCFIO(file,cfio,found,rc) - character(len=ESMF_MAXSTR), intent(in ) :: file - type(ESMF_CFIO) :: cfio - logical :: found - integer, optional, intent(out ) :: rc - - __Iam__('MakeCFIO') - - Inquire(FILE=trim(file),EXIST=found) - If (.not.found) Then - Write(6,'(a,a)') 'WARNING: File not found while getting times: ', Trim(file) - RC = ESMF_FAILURE - return - Else If (Mapl_Am_I_Root().and.(Ext_Debug > 9)) Then - Write(6,'(a,a)') ' DEBUG: Opening file: ', Trim(file) - End If - cfio = ESMF_CFIOCreate (cfioObjName='cfio_obj',__RC__) - call ESMF_CFIOSet(CFIO, fName=trim(file),__RC__) - call ESMF_CFIOFileOpen (CFIO, FMODE=1, __RC__) - rc = ESMF_SUCCESS - return - end subroutine - - subroutine GetTimesOnFile(cfio,tSeries,rc) - type(ESMF_CFIO) :: cfio - type(ESMF_Time) :: tSeries(:) - integer, optional, intent(out ) :: rc - - __Iam__('GetTimesOnFile') - - integer(ESMF_KIND_I4) :: iyr,imm,idd,ihr,imn,isc - integer :: i - integer(ESMF_KIND_I8) :: iCurrInterval - integer :: nhmsB, nymdB - integer :: begDate, begTime - integer(ESMF_KIND_I8),allocatable :: tSeriesInt(:) - - allocate(tSeriesInt(cfio%tSteps)) - call getDateTimeVec(cfio%fid,begDate,begTime,tSeriesInt,__RC__) - - ! Assume success - rc=ESMF_SUCCESS - - ! Debug level 3 - If (Mapl_Am_I_Root().and.(Ext_Debug > 2)) Then - Write(*,'(a,a)') ' >> >> Reading times from ', Trim(cfio%fName) - Write(*,'(a,2(x,I0.10),x,I0.4)') ' >> >> File timing info:', begDate, begTime, cfio%tSteps - End If - - do i=1,cfio%tSteps - iCurrInterval = tSeriesInt(i) - call GetDate ( begDate, begTime, iCurrInterval, nymdB, nhmsB, status ) - call MAPL_UnpackTime(nymdB,iyr,imm,idd) - call MAPL_UnpackTime(nhmsB,ihr,imn,isc) - ! Debug level 4 - If (Mapl_Am_I_Root()) Then - If ((Ext_Debug > 4).or.((Ext_Debug > 3).and.((i.eq.1).or.(i.eq.cfio%tSteps)))) Then - Write(*,'(a,I0.6,a,I0.4,5(a,I0.2))') ' >> >> STD Sample ',i,': ',iYr,'-',iMM,'-',iDD,' ',iHr,':',iMn,':',iSc - End If - End If - call ESMF_TimeSet(tSeries(i), yy=iyr, mm=imm, dd=idd, h=ihr, m=imn, s=isc,__RC__) - enddo - - deallocate(tSeriesInt) - return - - end subroutine GetTimesOnFile - - subroutine OffsetTimeYear(inTime,yrOffset,outTime,rc) - type(ESMF_Time), intent(in ) :: inTime - integer :: yrOffset - type(ESMF_Time), intent(out ) :: outTime - integer, optional, intent(out ) :: rc - - __Iam__('OffsetTimeYear') - - integer(ESMF_KIND_I4) :: iyr,imm,idd,ihr,imn,isc - logical :: srcLeap, targLeap - - call ESMF_TimeGet(inTime,yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - ! If the source year is a leap year but the new one isn't, modify to day 28 - iYr = iYr + yrOffset - targLeap = ((imm.eq.2).and.(idd.eq.29)) - if (targLeap) then - if (iyr.lt.1582) then - srcLeap = .False. - else if (modulo(iYr,4).ne.0) then - srcLeap = .False. - else if (modulo(iYr,100).ne.0) then - srcLeap = .True. - else if (modulo(iYr,400).ne.0) then - srcLeap = .False. - else - srcLeap = .True. - end if - else - srcLeap = .True. - end if - if (targLeap.and.(.not.srcLeap)) idd=28 - call ESMF_TimeSet(outTime,yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - - rc=ESMF_SUCCESS - return - - end subroutine OffsetTimeYear - - subroutine GetBracketTimeOnSingleFile(cfio,tSeries,cTime,bSide,UniFileClim,interpTime,fileTime,allowExtrap,climyear,rc) - type(ESMF_CFIO), intent(in ) :: cfio - type(ESMF_Time), intent(in ) :: tSeries(:) - type(ESMF_Time), intent(inout) :: cTime - character(len=1), intent(in ) :: bSide - logical, intent(in ) :: UniFileClim - type(ESMF_TIME), intent(inout) :: interpTime - type(ESMF_TIME), intent(inout) :: fileTime - logical, intent(in ) :: allowExtrap - integer, intent(in ) :: climYear - integer, optional, intent(out ) :: rc - - __Iam__('GetBracketTimeOnSingleFile') - - integer(ESMF_KIND_I4) :: iyr,imm,idd,ihr,imn,isc - integer :: i - type(ESMF_Time) :: climTime - logical :: found - logical :: LExtrap,RExtrap,LExact,RExact - logical :: LSide, RSide - integer :: yrOffset, yrOffsetNeg, targYear - integer :: iEntry - type(ESMF_Time), pointer :: tSeriesC(:) - logical :: foundYear - integer :: tSteps, curYear - - ! Store the target time which was actually requested - call ESMF_TimeGet(cTime,yy=targYear,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - - ! Debug output - If (Mapl_Am_I_Root().and.(Ext_Debug > 15)) Then - Write(6,'(a,a)') ' DEBUG: GetBracketTimeOnSingleFile called for ', trim(cfio%fName) - End If - - ! Debug level 3 - If (Mapl_Am_I_Root().and.(Ext_Debug > 2) ) Then - Write(*,'(a,L1,a,a)') ' >> >> Reading times from fixed (',UniFileClim,') file ', Trim(cfio%fName) - call ESMF_TimeGet(tSeries(1),yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - Write(*,'(a,I0.4,5(a,I0.2))') ' >> >> >> File start : ',iYr,'-',iMM,'-',iDD,' ',iHr,':',iMn,':',iSc - call ESMF_TimeGet(tSeries(cfio%tSteps),yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - Write(*,'(a,I0.4,5(a,I0.2))') ' >> >> >> File end : ',iYr,'-',iMM,'-',iDD,' ',iHr,':',iMn,':',iSc - call ESMF_TimeGet(cTime,yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - Write(*,'(a,I0.4,5(a,I0.2))') ' >> >> >> Time requested: ',iYr,'-',iMM,'-',iDD,' ',iHr,':',iMn,':',iSc - End If - - if (uniFileClim) then - - call ESMF_TimeGet(cTime,yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - iyr = climYear - if (idd == 29 .and. imm == 2) idd = 28 - call ESMF_TimeSet(climTime,yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - - tsteps=0 - foundYear = .false. - do i=1,cfio%tSteps - - call ESMF_TimeGet(tseries(i),yy=iyr,__RC__) - if (iyr==climYear) then - if (foundYear .eqv. .false.) then - iEntry = i - foundYear = .true. - end if - tsteps=tsteps+1 - end if - - end do - - allocate(tSeriesC(tsteps),__STAT__) - do i=1,tsteps - tSeriesC(i)=tSeries(iEntry+i-1) - enddo - - found = .false. - if (bSide == "L") then - if ( (climTime < tSeriesC(1)) ) then - fileTime = tSeriesC(tSteps) - call ESMF_TimeGet(tSeriesC(tSteps),yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - call ESMF_TimeGet(cTime,yy=curYear,__RC__) - iyr = curYear - 1 - call ESMF_TimeSet(interpTime,yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - found = .true. - else - do i=tSteps,1,-1 - if (climTime >= tSeriesC(i)) then - fileTime = tSeriesC(i) - if (UniFileClim) then - call ESMF_TimeGet(cTime,yy=curYear,__RC__) - call ESMF_TimeGet(fileTime,yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - call ESMF_TimeSet(interpTime,yy=curYear,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - else - interpTime = tSeriesC(i) - end if - found = .true. - exit - end if - end do - end if - else if (bSide == "R") then - if ( (climTime >= tSeriesC(tSteps)) ) then - fileTime = tSeriesC(1) - call ESMF_TimeGet(tSeriesC(1),yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - call ESMF_TimeGet(cTime,yy=curYear,__RC__) - iyr = curYear + 1 - call ESMF_TimeSet(interpTime,yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - found = .true. - else - do i=1,tSteps - if (climTime < tSeriesC(i)) then - fileTime = tSeriesC(i) - if (UniFileClim) then - call ESMF_TimeGet(cTime,yy=curYear,__RC__) - call ESMF_TimeGet(fileTime,yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - call ESMF_TimeSet(interpTime,yy=curYear,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - else - interpTime = tSeriesC(i) - end if - found = .true. - exit - end if - end do - end if - end if - - else - - yrOffset = 0 - climTime = cTime - - ! Is the requested time within the range of values offered? - LSide = (bSide == "L") - RSide = (.not.LSide) - LExact = (cLimTime == tSeries(1)) - RExact = (cLimTime == tSeries(cfio%tSteps)) - LExtrap = (cLimTime < tSeries(1)) - RExtrap = (cLimTime > tSeries(cfio%tSteps)) - found = .false. - If (Mapl_Am_I_Root().and.(Ext_Debug > 19)) Then - Write(*,'(a,4(L1,x),a,a)') ' DEBUG: Extrapolation flags (0) are ',LExact,RExact,LExtrap,RExtrap,'for file ', trim(cfio%fName) - End If - - if (allowExtrap) then - If (LExtrap) Then - If (Mapl_Am_I_Root().and.(Ext_Debug > 19)) Then - Write(6,'(a,a)') ' DEBUG: Requested time is before first available sample in file ', trim(cfio%fName) - End If - ! Increase the target time until it is within range - Do While (LExtrap) - yrOffset = yrOffset + 1 - iYr = targYear + yrOffset - call OffsetTimeYear(cTime,yrOffset,cLimTime,rc) - If (LSide) Then - LExtrap = (cLimTime < tSeries(1)) - Else - LExtrap = (cLimTime <= tSeries(1)) - ! When scanning for the right side, if we find that we - ! have an exact match to the first entry, then as long - ! as there is a second entry, we have the correct offset - If (LExtrap.and.(cfio%tSteps > 1)) Then - LExact = (cLimTime == tSeries(1)) - LExtrap = (LExtrap.and.(.not.LExact)) - End If - End If - End Do - Else If (RExtrap.or.(RExact.and.RSide)) Then - If (Mapl_Am_I_Root().and.(Ext_Debug > 19)) Then - Write(6,'(a,a)') ' DEBUG: Requested time is after or on last available sample in file ', trim(cfio%fName) - End If - Do While (RExtrap.or.(RExact.and.RSide)) - yrOffset = yrOffset - 1 - iYr = targYear + yrOffset - call OffsetTimeYear(cTime,yrOffset,cLimTime,rc) - If (LSide) Then - RExtrap = (cLimTime > tSeries(cfio%tSteps)) - Else - RExtrap = (cLimTime >= tSeries(cfio%tSteps)) - RExact = (cLimTime == tSeries(cfio%tSteps)) - End If - End Do - End If - - ! Retest for an exact match - note this is only useful if we want bracket L - LExact = (cLimTime == tSeries(1)) - RExact = (cLimTime == tSeries(cfio%tSteps)) - If (Mapl_Am_I_Root().and.(Ext_Debug > 19)) Then - Write(*,'(a,4(L1,x),a,a)') ' DEBUG: Extrapolation flags (2) are ',LExact,RExact,LExtrap,RExtrap,'for file ', trim(cfio%fName) - End If - - End IF - - If (LSide.and.LExact) Then - found = .true. - iEntry = 1 - Else If (LSide.and.RExact) Then - found = .true. - iEntry = cfio%tSteps - Else - if (bSide == "L") then - do i=cfio%tSteps,1,-1 - if (climTime >= tSeries(i)) then - iEntry = i - found = .true. - exit - end if - end do - else if (bSide == "R") then - do i=1,cfio%tSteps - if (climTime < tSeries(i)) then - iEntry = i - found = .true. - exit - end if - end do - end if - end if - - if (found) then - fileTime = tSeries(iEntry) - if (yrOffset == 0) Then - interpTime = fileTime - Else - yrOffsetNeg = -1*yrOffset - call OffsetTimeYear(fileTime,yrOffsetNeg,interpTime,rc) - End If - end if - - end if - - if (found) then - If (Mapl_Am_I_Root().and.(Ext_Debug > 15)) Then - call ESMF_TimeGet(fileTime,yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - Write(*,'(a,I0.4,a,I0.2,a,I0.2,a,I0.2,a,I0.2,a,a,a,a)') & - ' DEBUG: Data from time ', iYr, '-', iMm, '-', iDd, & - ' ', iHr, ':', iMn, ' set for bracket ', bSide,& - ' of file ', Trim(cfio%fName) - Write(*,'(a,I5)') ' DEBUG: ==>> Year offset: ', yrOffset - If (yrOffset .ne. 0) Then - call ESMF_TimeGet(interpTime,yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - Write(*,'(a,I0.4,a,I0.2,a,I0.2,a,I0.2,a,I0.2)') & - ' DEBUG: ==> Mapped to: ', iYr, '-', iMm, '-', iDd, & - ' ', iHr, ':', iMn - call ESMF_TimeGet(interpTime,yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - Write(*,'(a,I0.4,a,I0.2,a,I0.2,a,I0.2,a,I0.2)') & - ' DEBUG: ==> Target to: ', iYr, '-', iMm, '-', iDd, & - ' ', iHr, ':', iMn - End If - End If - rc=ESMF_SUCCESS - return - else - Write(6,'(a,a)') 'WARNING: Requested sample not found in file ', trim(cfio%fName) - rc=ESMF_FAILURE - return - endif - - end subroutine GetBracketTimeOnSingleFile - - subroutine GetBracketTimeOnFile(cfio,tSeries,cTime,bSide,UniFileClim,interpTime,fileTime,yrOffsetInt,rc) - type(ESMF_CFIO), intent(in ) :: cfio - type(ESMF_Time), intent(in ) :: tSeries(:) - type(ESMF_Time), intent(inout) :: cTime - character(len=1), intent(in ) :: bSide - logical, intent(in ) :: UniFileClim - type(ESMF_TIME), intent(inout) :: interpTime - type(ESMF_TIME), intent(inout) :: fileTime - integer, optional, intent(in ) :: yrOffsetInt - integer, optional, intent(out ) :: rc - - __Iam__('GetBracketTimeOnFile') - - integer(ESMF_KIND_I4) :: iyr,imm,idd,ihr,imn,isc - integer :: i - type(ESMF_Time) :: climTime - logical :: found, outOfBounds - integer :: yrOffset, yrOffsetNeg - integer :: climSize - - ! Assume that the requested time is within range - If (Present(yrOffsetInt)) Then - yrOffset = yrOffsetInt - Else - yrOffset = 0 - End If - - if (UniFileClim) then - If (MAPL_Am_I_Root()) Write(*,'(a)') 'GetBracketTimeOnFile called with UniFileClim' - RC = ESMF_FAILURE - Return - end if - - ! Debug output - If (Mapl_Am_I_Root().and.(Ext_Debug > 15)) Then - Write(6,'(4a)') ' DEBUG: GetBracketTimeOnFile (',Trim(bSide),') called for ', trim(cfio%fName) - End If - - if (yrOffset.ne.0) then - ! If the source year is a leap year but this isn't, modify to day 28 - call OffsetTimeYear(cTime,yrOffset,cLimTime,rc) - else - climTime = cTime - end if - climSize = 1 - - ! Debug output - If (Mapl_Am_I_Root().and.(Ext_Debug > 19)) Then - call ESMF_TimeGet(cLimTime,yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - Write(6,'(a,I2,3a,I0.4,5(a,I0.2))') ' DEBUG: Year offset of ',yrOffset,& - ' applied while scanning ', trim(cfio%fName),& - ' to give target time ',iYr,'-',iMm,'-',iDd,' ',iHr,':',iMn,':',iSc - End If - - found = .false. - ! we will have to specially handle a climatology in one file - ! might be better way but can not think of one - if (bSide == "L") then - OutOfBounds = (cLimTime < tSeries(1)) - If (OutOfBounds) Then - ! This can be an acceptable outcome - no printout - RC = ESMF_FAILURE - Return - End If - do i=cfio%tSteps,1,-1 - if (climTime >= tSeries(i)) then - fileTime = tSeries(i) - if (yrOffset .ne. 0) Then - yrOffsetNeg = -1*yrOffset - Call OffsetTimeYear(fileTime,yrOffsetNeg,interpTime,rc) - else - interpTime = fileTime - end if - found = .true. - exit - end if - end do - else if (bSide == "R") then - ! Is the requested time within the range of values offered? - OutOfBounds = (cLimTime >= tSeries(cfio%tSteps)) - If (OutOfBounds) Then - ! This can be an acceptable outcome - no printout - RC = ESMF_FAILURE - Return - End If - do i=1,cfio%tSteps - if (climTime < tSeries(i)) then - fileTime = tSeries(i) - if (yrOffset .ne. 0) Then - yrOffsetNeg = -1*yrOffset - Call OffsetTimeYear(fileTime,yrOffsetNeg,interpTime,rc) - else - interpTime = fileTime - end if - found = .true. - exit - end if - end do - end if - - if (found) then - If (Mapl_Am_I_Root().and.(Ext_Debug > 15)) Then - call ESMF_TimeGet(fileTime,yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - Write(*,'(a,I0.4,a,I0.2,a,I0.2,a,I0.2,a,I0.2,a,a,a,a)') & - ' DEBUG: Data from time ', iYr, '-', iMm, '-', iDd, & - ' ', iHr, ':', iMn, ' set for bracket ', bSide,& - ' of file ', Trim(cfio%fName) - If (yrOffset .ne. 0) Then - call ESMF_TimeGet(interpTime,yy=iyr,mm=imm,dd=idd,h=ihr,m=imn,s=isc,__RC__) - !Write(*,'(a,I0.4,a,I0.2,a,I0.2,a,I0.2,a,I0.2)') & - !' DEBUG: ==> Mapped to: ', iYr, '-', iMm, '-', iDd, & - !' ', iHr, ':', iMn - Write(*,'(a,I0.4,a,I0.2,a,I0.2,a,I0.2,a,I0.2,a,I0.2)') & - ' DEBUG: ==> Mapped to: ', iYr, '-', iMm, '-', iDd, & - ' ', iHr, ':', iMn, ' Offset:', yrOffset - End If - End If - rc=ESMF_SUCCESS - return - else - Write(6,'(a,a)') 'WARNING: Requested sample not found in file ', trim(cfio%fName) - rc=ESMF_FAILURE - return - endif - !end if - - end subroutine GetBracketTimeOnFile - - subroutine CalcDerivedField(state,primaries,exportName,exportExpr,masking,rc) - type(ESMF_State), intent(inout) :: state - type(PrimaryExports), intent(inout) :: primaries - character(len=*), intent(in ) :: exportName - character(len=*), intent(in ) :: exportExpr - logical, intent(in ) :: masking - integer, optional, intent(out ) :: rc - - __Iam__('CalcDerivedField') - - type(ESMF_Field) :: field - - if (masking) then - call MAPL_ExtDataEvaluateMask(state,exportName,exportExpr,__RC__) - else - call ESMF_StateGet(state,exportName,field,__RC__) - call MAPL_StateEval(state,exportExpr,field,__RC__) - end if - RETURN_(ESMF_SUCCESS) - end subroutine CalcDerivedField - - subroutine MAPL_ExtDataInterpField(item,time,field,vector_comp,rc) - type(PrimaryExport), intent(inout) :: item - type(ESMF_Time), intent(in ) :: time - type(ESMF_Field), intent(inout) :: field - integer, optional, intent(in ) :: vector_comp - integer, optional, intent(out ) :: rc - - character(len=ESMF_MAXSTR) :: Iam - integer :: status - - type(ESMF_TimeInterval) :: tinv1, tinv2 - real :: alpha - real, pointer :: var2d(:,:) => null() - real, pointer :: var3d(:,:,:) => null() - real, pointer :: var2d_prev(:,:) => null() - real, pointer :: var2d_next(:,:) => null() - real, pointer :: var3d_prev(:,:,:) => null() - real, pointer :: var3d_next(:,:,:) => null() - integer :: fieldRank,i,j,k - character(len=ESMF_MAXSTR) :: name - - integer :: yr,mm,dd,hr,mn,sc,nhms1,nymd1,nhms2,nymd2 - - Iam = "MAPL_ExtDataInterpField" - tinv1 = time - item%interp_time1 - tinv2 = item%interp_time2 - item%interp_time1 - alpha = tinv1/tinv2 - call ESMF_FieldGet(FIELD, dimCount=fieldRank,name=name,__RC__) - If (Mapl_Am_I_Root()) Then - If (Ext_Debug > 9) Then - call ESMF_TimeGet(item%interp_time1,yy=yr,mm=mm,dd=dd,h=hr,m=mn,s=sc,__RC__) - call MAPL_PackTime(nhms1,hr,mn,sc) - call MAPL_PackTime(nymd1,yr,mm,dd) - If (item%doInterpolate) Then - If (alpha .gt. 0.0) Then - call ESMF_TimeGet(item%interp_time2,yy=yr,mm=mm,dd=dd,h=hr,m=mn,s=sc,__RC__) - call MAPL_PackTime(nhms2,hr,mn,sc) - call MAPL_PackTime(nymd2,yr,mm,dd) - Else - nhms2=0 - nymd2=0 - End If - Else - nhms2=0 - nymd2=0 - End If - - If (.not.(item%doInterpolate)) Then - Write(*,'(a,a,a,a,I0.8,x,I0.6)') ' >> >> >> ', & - 'Uninterpolated field ', Trim(item%name), & - ' set to sample L: ', nymd1, nhms1 - Else If (time == item%interp_time1) Then - Write(*,'(a,a,a,a,I0.8,x,I0.6)') ' >> >> >> ', & - ' Interpolated field ', Trim(item%name), & - ' set to sample L: ', nymd1, nhms1 - Else If (time == item%interp_time2) Then - Write(*,'(a,a,a,a,I0.8,x,I0.6)') ' >> >> >> ', & - ' Interpolated field ', Trim(item%name), & - ' set to sample R: ', nymd2, nhms2 - Else - Write(*,'(a,a,a,a,2(I0.8,x,I0.6,a),F10.6,a)') ' >> >> >> ', & - ' Interpolated field ', Trim(item%name), & - ' between ', nymd1,nhms1,' and ',nymd2,nhms2,' (', & - alpha,' fraction)' - End If - End If - End If - call ESMF_FieldGet(FIELD, dimCount=fieldRank,name=name, __RC__) - if (fieldRank == 2) then - - if (item%vartype == MAPL_FieldItem) then - call ESMF_FieldGet(item%finterp1, localDE=0, farrayPtr=var2d_prev, __RC__) - call ESMF_FieldGet(item%finterp2, localDE=0, farrayPtr=var2d_next, __RC__) - else if (item%vartype == MAPL_BundleItem) then - call ESMFL_BundleGetPointerToData(item%binterp1,name,var2d_prev,__RC__) - call ESMFL_BundleGetPointerToData(item%binterp2,name,var2d_next,__RC__) - else if (item%vartype == MAPL_ExtDataVectorItem) then - ASSERT_(present(vector_comp)) - if (vector_comp == 1) then - call ESMF_FieldGet(item%v1_finterp1, localDE=0, farrayPtr=var2d_prev, __RC__) - call ESMF_FieldGet(item%v1_finterp2, localDE=0, farrayPtr=var2d_next, __RC__) - else if (vector_comp == 2) then - call ESMF_FieldGet(item%v2_finterp1, localDE=0, farrayPtr=var2d_prev, __RC__) - call ESMF_FieldGet(item%v2_finterp2, localDE=0, farrayPtr=var2d_next, __RC__) - end if - end if - call ESMF_FieldGet(field, localDE=0, farrayPtr=var2d, __RC__) - ! only interpolate if we have to - if (time == item%interp_time1 .or. item%doInterpolate .eqv. .false.) then - var2d = var2d_prev - else if (time == item%interp_time2) then - var2d = var2d_next - else - do j=1,size(var2d,2) - do i=1,size(var2d,1) - if (var2d_next(i,j) /= MAPL_UNDEF .and. var2d_prev(i,j) /= MAPL_UNDEF) then - var2d(i,j) = var2d_prev(i,j) + alpha*(var2d_next(i,j)-var2d_prev(i,j)) - else - var2d(i,j) = MAPL_UNDEF - end if - enddo - enddo - end if - do j=1,size(var2d,2) - do i=1,size(var2d,1) - if (var2d(i,j) /= MAPL_UNDEF) then - if (item%do_scale .and. (.not.item%do_offset)) var2d(i,j) = item%scale*var2d(i,j) - if ((.not.item%do_scale) .and. item%do_offset) var2d(i,j) = var2d(i,j)+item%offset - if (item%do_scale .and. item%do_offset) var2d(i,j) = item%offset + (item%scale * var2d(i,j)) - else - var2d(i,j) = MAPL_UNDEF - end if - enddo - enddo - - else if (fieldRank == 3) then - - if (item%vartype == MAPL_FieldItem) then - call ESMF_FieldGet(item%finterp1, localDE=0, farrayPtr=var3d_prev, __RC__) - call ESMF_FieldGet(item%finterp2, localDE=0, farrayPtr=var3d_next, __RC__) - else if (item%vartype == MAPL_BundleItem) then - call ESMFL_BundleGetPointerToData(item%binterp1,name,var3d_prev,__RC__) - call ESMFL_BundleGetPointerToData(item%binterp2,name,var3d_next,__RC__) - else if (item%vartype == MAPL_ExtDataVectorItem) then - ASSERT_(present(vector_comp)) - if (vector_comp == 1) then - call ESMF_FieldGet(item%v1_finterp1, localDE=0, farrayPtr=var3d_prev, __RC__) - call ESMF_FieldGet(item%v1_finterp2, localDE=0, farrayPtr=var3d_next, __RC__) - else if (vector_comp == 2) then - call ESMF_FieldGet(item%v2_finterp1, localDE=0, farrayPtr=var3d_prev, __RC__) - call ESMF_FieldGet(item%v2_finterp2, localDE=0, farrayPtr=var3d_next, __RC__) - end if - end if - call ESMF_FieldGet(field, localDE=0, farrayPtr=var3d, __RC__) - ! only interpolate if we have to - if (time == item%interp_time1 .or. item%doInterpolate .eqv. .false.) then - var3d = var3d_prev - else if (time == item%interp_time2) then - var3d = var3d_next - else - do k=lbound(var3d,3),ubound(var3d,3) - do j=1,size(var3d,2) - do i=1,size(var3d,1) - if (var3d_next(i,j,k) /= MAPL_UNDEF .and. var3d_prev(i,j,k) /= MAPL_UNDEF) then - var3d(i,j,k) = var3d_prev(i,j,k) + alpha*(var3d_next(i,j,k)-var3d_prev(i,j,k)) - - - else - var3d(i,j,k) = MAPL_UNDEF - end if - enddo - enddo - enddo - end if - do k=lbound(var3d,3),ubound(var3d,3) - do j=1,size(var3d,2) - do i=1,size(var3d,1) - if (var3d(i,j,k) /= MAPL_UNDEF) then - if (item%do_scale .and. (.not.item%do_offset)) var3d(i,j,k) = item%scale*var3d(i,j,k) - if ((.not.item%do_scale) .and. item%do_offset) var3d(i,j,k) = var3d(i,j,k)+item%offset - if (item%do_scale .and. item%do_offset) var3d(i,j,k) = item%offset + (item%scale * var3d(i,j,k)) - else - var3d(i,j,k) = MAPL_UNDEF - end if - enddo - enddo - enddo - endif - - RETURN_(ESMF_SUCCESS) - end subroutine MAPL_ExtDataInterpField - - ! routine to read two components of a vector on a Lat-Lon A grid - ! and do proper vector transform to cube-sphere A grid - ! as we will be making a lat-lon grid to call the HorzTransform - ! we will need to pass the layout, follows what is done in the - ! mkiau grid comp - subroutine MAPL_ExtDataReadVector(item,file,ExtState,side,rc ) - use MAPL_AbstractRegridderMod - use MAPL_RegridderManagerMod - use MAPL_LatLonGridFactoryMod - use MAPL_GridManagerMod - type(PrimaryExport), intent(INOUT) :: item - character(len=*), intent(IN ) :: file - type(MAPL_ExtData_State), intent(INOUT) :: ExtState - integer, intent(IN ) :: side - - integer, optional, intent(out ) :: rc - - integer :: status - character(len=ESMF_MAXSTR) :: Iam - - integer :: NX, NY - type(ESMF_Time) :: time - type(ESMF_Field) :: v1out, v2out - character(len=ESMF_MAXSTR) :: fname1, fname2 - logical :: ignoreCase - integer :: fid - integer :: im_world, jm_world, lmIn, nt, nvars, natts, vdir - integer :: imIn, jmIn, imOut, jmOut, lmOut - type(ESMF_Grid) :: gridIn, gridOut, newGrid - class (AbstractRegridder), pointer :: regridder - - real, pointer :: v1out_3d(:,:,:) => null() - real, pointer :: v2out_3d(:,:,:) => null() - real, pointer :: v1out_2d(:,:) => null() - real, pointer :: v2out_2d(:,:) => null() - - real, pointer :: v1in_3d(:,:,:) => null() - real, pointer :: v2in_3d(:,:,:) => null() - real, pointer :: v1in_2d(:,:) => null() - real, pointer :: v2in_2d(:,:) => null() - real, pointer :: ptr1_3d(:,:,:) => null() - real, pointer :: ptr2_3d(:,:,:) => null() - - type(ESMF_Field) :: field,newField1,newField2, psF - - integer :: gridStagger1,gridStagger2 - integer :: gridRotation1,gridRotation2 - logical :: doRotation - - integer :: fieldRank - integer :: DIMS(ESMF_MAXGRIDDIM) - type (LatLonGridFactory) :: factory - - Iam = "MAPL_ExtDataReadVector" - - fname1 = item%fcomp1 - fname2 = item%fcomp2 - call ESMF_ConfigGetAttribute(ExtState%cf,value=NX,Label="NX:",__RC__) - call ESMF_ConfigGetAttribute(ExtState%cf,value=NY,Label="NY:",__RC__) - ignorecase=ExtState%ignoreCase - - ! query the file to get the size of the lat-lon grid on the file - call CFIO_Open(file,1,fid,status) - VERIFY_(STATUS) - call CFIO_DimInquire(fid,im_world,jm_world,lmIn,nt,nvars,natts,vdir,status) - VERIFY_(STATUS) - call CFIO_Close(fid,status) - VERIFY_(STATUS) - - if (item%do_vertInterp .or. item%do_Fill) then - call MAPL_ExtDataGetBracket(item,side,field=NewField1,vcomp=1,__RC__) - call MAPL_ExtDataGetBracket(item,side,field=NewField2,vcomp=2,__RC__) - call ESMF_FieldGet(NewField1,grid=gridOut,__RC__) - newGrid = MAPL_ExtDataGridChangeLev(gridOut,ExtState%cf,item%lm,__RC__) - call MAPL_GridGet(gridOut, localCellCountPerDim=dims,__RC__) - imOut = dims(1) - jmOut = dims(2) - allocate(ptr1_3d(imOut,jmOut,lmIn),__STAT__) - allocate(ptr2_3d(imOut,jmOut,lmIn),__STAT__) - v1out = ESMF_FieldCreate(grid=newGrid, & - dataCopyFlag = ESMF_DATACOPY_REFERENCE, & - farrayPtr = ptr1_3d, __RC__) - v2out = ESMF_FieldCreate(grid=newGrid, & - dataCopyFlag = ESMF_DATACOPY_REFERENCE, & - farrayPtr = ptr2_3d, __RC__) - call MAPL_FieldCopyAttributes(NewField1,v1out,__RC__) - call MAPL_FieldCopyAttributes(NewField2,v2out,__RC__) - else - call MAPL_ExtDataGetBracket(item,side,field=v1out,vcomp=1,__RC__) - call MAPL_ExtDataGetBracket(item,side,field=v2out,vcomp=2,__RC__) - end if - - if (side == MAPL_ExtDataLeft) then - time = item%time1 - else if (side == MAPL_ExtDataRight) then - time = item%time2 - end if - - call MAPL_ExtDataGetBracket(item,side,field=Field,vcomp=1,__RC__) - call ESMF_AttributeGet(field, NAME='STAGGERING', value=gridStagger1, __RC__) - call ESMF_AttributeGet(field, NAME='ROTATION',value=gridRotation1, __RC__) - call MAPL_ExtDataGetBracket(item,side,field=Field,vcomp=2,__RC__) - call ESMF_AttributeGet(field, NAME='STAGGERING', value=gridStagger2, __RC__) - call ESMF_AttributeGet(field, NAME='ROTATION',value=gridRotation2, __RC__) - - ASSERT_(gridStagger1 == gridStagger2) - ASSERT_(gridRotation1 == gridRotation2) - - if (gridStagger1 == MAPL_AGrid) then - if (gridRotation1 == MAPL_RotateLL) then - doRotation = .false. - else if (gridRotation1 == MAPL_RotateCube) then - doRotation = .true. - end if - else if (gridStagger1 == MAPL_DGrid) then - if (gridRotation1 /= MAPL_RotateCube) then - ASSERT_(.false.) - else - doRotation = .false. - end if - else if (gridStagger1 == MAPL_CGrid) then - if (gridRotation1 /= MAPL_RotateCube) then - ASSERT_(.false.) - else - doRotation = .false. - end if - end if - - factory = LatLonGridFactory(im_world=IM_WORLD, jm_world=jm_world, & - & nx=nx, ny=ny, lm=lmIn, pole='PC',dateline='DC',__RC__) - gridIn = grid_manager%make_grid(factory,__RC__) - - call MAPL_GridGet(gridIn, localCellCountPerDim=dims,__RC__) - imIn = dims(1) - jmIn = dims(2) - - call ESMF_FieldGet(v1out,grid=gridOut,dimCount=fieldRank,__RC__) - call MAPL_GridGet(gridOut, localCellCountPerDim=dims,__RC__) - imOut = dims(1) - jmOut = dims(2) - - -!!$ call MAPL_HorzTransformCreate(trans,gridIn,gridOut,__RC__) - if (doRotation) then - regridder => regridder_manager%make_regridder(gridIn, gridOut, REGRID_METHOD_BILINEAR_ROTATE,__RC__) - else - regridder => regridder_manager%make_regridder(gridIn, gridOut, REGRID_METHOD_BILINEAR,__RC__) - end if - - if (fieldRank == 2) then - - call ESMF_FieldGet(v1out,localDe=0,farrayPtr=v1out_2d,__RC__) - call ESMF_FieldGet(v2out,localDe=0,farrayPtr=v2out_2d,__RC__) - - allocate(v1in_3d(imIn,jmIn,1),__STAT__) - allocate(v2in_3d(imIn,jmIn,1),__STAT__) - allocate(v1in_2d(imIn,jmIn),__STAT__) - allocate(v2in_2d(imIn,jmIn),__STAT__) - allocate(v1out_3d(imOut,jmOut,1),__STAT__) - allocate(v2out_3d(imOut,jmOut,1),__STAT__) - - - call MAPL_CFIORead(fname1, file, time, gridIn, v1in_2d,ignoreCase=ignoreCase,__RC__) - call MAPL_CFIORead(fname2, file, time, gridIn, v2in_2d,ignoreCase=ignoreCase,__RC__) - - v1in_3d(:,:,1) = v1in_2d - v2in_3d(:,:,1) = v2in_2d - v1out_3d(:,:,1) = v1out_2d - v2out_3d(:,:,1) = v2out_2d - -!!$ call MAPL_HorzTransformRun (trans, v1in_3d, v2in_3d, v2out_3d, v2out_3d, rotate=doRotation, __RC__) - call regridder%regrid(v1in_3d, v2in_3d, v1out_3d, v2out_3d) - - if (gridStagger1 == MAPL_CGrid) then - call A2D2C(gridOut,v1out_3d,v2out_3d,1,getC=.true.) - else if (gridStagger1 == MAPL_DGrid) then - call A2D2C(gridOut,v1out_3d,v2out_3d,1,getC=.false.) - end if - - v1out_2d = v1out_3d(:,:,1) - v2out_2d = v2out_3d(:,:,1) - - deallocate(v1in_3d,v2in_3d,v1in_2d,v2in_2d,v1out_3d,v2out_3d,__STAT__) - else if (fieldRank == 3) then - - call ESMF_FieldGet(v1out,localDe=0,farrayPtr=v1out_3d,__RC__) - call ESMF_FieldGet(v2out,localDe=0,farrayPtr=v2out_3d,__RC__) - - allocate(v1in_3d(imIn,jmIn,lmIn),__STAT__) - allocate(v2in_3d(imIn,jmIn,lmIn),__STAT__) - - call MAPL_CFIORead(fname1, file, time, gridIn, v1in_3d,ignoreCase=ignoreCase,__RC__) - call MAPL_CFIORead(fname2, file, time, gridIn, v2in_3d,ignoreCase=ignoreCase,__RC__) - -!!$ call MAPL_HorzTransformRun (trans, v1in_3d, v2in_3d, v2out_3d, v2out_3d, rotate=doRotation, __RC__) - call regridder%regrid(v1in_3d, v2in_3d, v1out_3d, v2out_3d) - - if (item%do_vertInterp) then - call MAPL_ExtDataGetBracket(item,side,field=newField1,vcomp=1,__RC__) - call MAPL_ExtDataGetBracket(item,side,field=newField2,vcomp=2,__RC__) - nt = ExtState%PrimaryOrder(1) - call MAPL_ExtDataGetBracket(ExtState%primary%item(nt),side,field=psF,__RC__) - - call vertInterpolation_pressKappa(newfield1,v1out,psF,item%levs,MAPL_UNDEF,__RC__) - call vertInterpolation_pressKappa(newfield2,v2out,psF,item%levs,MAPL_UNDEF,__RC__) - call ESMF_FieldGet(newField1,localDe=0,farrayPtr=v1out_3d,__RC__) - call ESMF_FieldGet(newField2,localDe=0,farrayPtr=v2out_3d,__RC__) - deallocate(ptr1_3d,ptr2_3d) - else if (item%do_Fill) then - call MAPL_ExtDataGetBracket(item,side,field=newField1,vcomp=1,__RC__) - call MAPL_ExtDataGetBracket(item,side,field=newField2,vcomp=2,__RC__) - call MAPL_ExtDataFillField(newfield1,v1out,__RC__) - call MAPL_ExtDataFillField(newfield2,v2out,__RC__) - call ESMF_FieldGet(newField1,localDe=0,farrayPtr=v1out_3d,__RC__) - call ESMF_FieldGet(newField2,localDe=0,farrayPtr=v2out_3d,__RC__) - deallocate(ptr1_3d,ptr2_3d) - end if - - lmout = size(v1out_3d,3) - if (gridStagger1 == MAPL_CGrid) then - call A2D2C(gridOut,v1out_3d,v2out_3d,lmOut,getC=.true.) - else if (gridStagger1 == MAPL_DGrid) then - call A2D2C(gridOut,v1out_3d,v2out_3d,lmOut,getC=.false.) - end if - - deallocate(v1in_3d,v2in_3d,__STAT__) - - end if - - RETURN_(ESMF_SUCCESS) - - end subroutine MAPL_ExtDataReadVector - - - subroutine GetMaskName(FuncStr,Var,Needed,rc) - character(len=*), intent(in) :: FuncStr - character(len=*), intent(in) :: Var(:) - logical, intent(inout) :: needed(:) - integer, optional, intent(out) :: rc - - character(len=ESMF_MAXSTR) :: Iam = "GetMaskName" - integer :: status - integer :: i1,i2,i,ivar - logical :: found,twovar - character(len=ESMF_MAXSTR) :: tmpstring,tmpstring1,tmpstring2,functionname - - i1 = index(Funcstr,"(") - ASSERT_(i1 > 0) - functionname = adjustl(Funcstr(:i1-1)) - functionname = ESMF_UtilStringLowerCase(functionname, __RC__) - if (trim(functionname) == "regionmask") twovar = .true. - if (trim(functionname) == "zonemask") twovar = .false. - if (trim(functionname) == "boxmask") twovar = .false. - tmpstring = adjustl(Funcstr(i1+1:)) - i1 = index(tmpstring,",") - ASSERT_(i1 > 0) - i2 = index(tmpstring,";") - if (twovar) then - tmpstring1 = adjustl(tmpstring(1:i1-1)) - tmpstring2 = adjustl(tmpstring(i1+1:i2-1)) - else - tmpstring1 = adjustl(tmpstring(1:i1-1)) - end if - - found = .false. - do i=1,size(var) - if ( trim(tmpstring1) == trim(var(i)) ) then - ivar = i - found = .true. - exit - end if - end do - ASSERT_(found) - needed(ivar) = .true. - - if (twovar) then - found = .false. - do i=1,size(var) - if ( trim(tmpstring2) == trim(var(i)) ) then - ivar = i - found = .true. - exit - end if - end do - ASSERT_(found) - needed(ivar) = .true. - end if - RETURN_(ESMF_SUCCESS) - end subroutine GetMaskName - - subroutine MAPL_ExtDataEvaluateMask(state,exportName,exportExpr,rc) - - type(ESMF_STATE), intent(inout) :: state - character(len=*), intent(in) :: exportName - character(len=*), intent(in) :: exportExpr - integer, optional, intent(out) :: rc - - character(len=ESMF_MAXSTR) :: Iam = "EvaluateMask" - integer :: status - - integer :: k,i - character(len=ESMF_MAXSTR) :: maskString,maskname,vartomask,functionname,clatS,clatN - character(len=ESMF_MAXSTR) :: strtmp - integer, allocatable :: regionNumbers(:), flag(:) - integer, allocatable :: mask(:,:) - real, pointer :: rmask(:,:) => null() - real, pointer :: rvar2d(:,:) => null() - real, pointer :: rvar3d(:,:,:) => null() - real, pointer :: var2d(:,:) => null() - real, pointer :: var3d(:,:,:) => null() - real(REAL64), pointer :: lats(:,:) => null() - real(REAL64), pointer :: lons(:,:) => null() - real(REAL64) :: limitS, limitN, limitE, limitW - real(REAL64) :: limitE1, limitW1 - real(REAL64) :: limitE2, limitW2 - type(ESMF_Field) :: field - type(ESMF_Grid) :: grid - integer :: rank,ib,ie,is,i1,nargs - integer :: counts(3) - logical :: isCube, twoBox - real, allocatable :: temp2d(:,:) - character(len=ESMF_MAXSTR) :: args(5) - - call ESMF_StateGet(state,exportName,field,__RC__) - call ESMF_FieldGet(field,rank=rank,grid=grid,__RC__) - i1 = index(exportExpr,"(") - ASSERT_(i1 > 0) - functionname = adjustl(exportExpr(:i1-1)) - functionname = ESMF_UtilStringLowerCase(functionname, __RC__) - - if (trim(functionname) == "regionmask") then - ! get mask string - ib = index(exportExpr,";") - ie = index(exportExpr,")") - maskString = trim(exportExpr(ib+1:ie-1)) - ! get mask name - ie = index(exportExpr,";") - is = index(exportExpr,"(") - ib = index(exportExpr,",") - vartomask = trim(exportExpr(is+1:ib-1)) - maskname = trim(exportExpr(ib+1:ie-1)) - call MAPL_GetPointer(state,rmask,maskName,__RC__) - if (rank == 2) then - call MAPL_GetPointer(state,rvar2d,vartomask,__RC__) - call MAPL_GetPointer(state,var2d,exportName,__RC__) - else if (rank == 3) then - call MAPL_GetPointer(state,rvar3d,vartomask,__RC__) - call MAPL_GetPointer(state,var3d,exportName,__RC__) - else - ASSERT_(.false.) - end if - - k=32 - allocate(regionNumbers(k), flag(k), stat=status) - VERIFY_(STATUS) - regionNumbers = 0 - call MAPL_ExtDataExtractIntegers(maskString,k,regionNumbers,rc=status) - VERIFY_(STATUS) - flag(:) = 1 - WHERE(regionNumbers(:) == 0) flag(:) = 0 - k = SUM(flag) - deallocate(flag,stat=status) - VERIFY_(STATUS) - - ! Set local mask to 1 where gridMask matches each integer (within precision!) - ! --------------------------------------------------------------------------- - allocate(mask(size(rmask,1),size(rmask,2)),stat=status) - VERIFY_(STATUS) - mask = 0 - DO i=1,k - WHERE(regionNumbers(i)-0.01 <= rmask .AND. & - rmask <= regionNumbers(i)+0.01) mask = 1 - END DO - - if (rank == 2) then - var2d = rvar2d - where(mask == 0) var2d = 0.0 - else if (rank == 3) then - var3d = rvar3d - do i=1,size(var3d,3) - where(mask == 0) var3d(:,:,i) = 0.0 - enddo - end if - deallocate( mask) - elseif(trim(functionname) == "zonemask") then - - ib = index(exportExpr,"(") - ie = index(exportExpr,",") - vartomask = trim(exportExpr(ib+1:ie-1)) - ib = index(exportExpr,",") - is = index(exportExpr,",",back=.true.) - ie = index(exportExpr,")") - clatS = trim(exportExpr(ib+1:is-1)) - clatN = trim(exportExpr(is+1:ie-1)) - READ(clatS,*,IOSTAT=status) limitS - VERIFY_(status) - READ(clatN,*,IOSTAT=status) limitN - VERIFY_(status) - - call ESMF_GridGetCoord(grid, coordDim=2, localDE=0, & - staggerloc=ESMF_STAGGERLOC_CENTER, farrayPtr=lats, rc=status) - VERIFY_(status) - limitN=limitN*MAPL_PI_R8/180.0d0 - limitS=limitS*MAPL_PI_R8/180.0d0 - - if (rank == 2) then - call MAPL_GetPointer(state,rvar2d,vartomask,__RC__) - call MAPL_GetPointer(state,var2d,exportName,__RC__) - else if (rank == 3) then - call MAPL_GetPointer(state,rvar3d,vartomask,__RC__) - call MAPL_GetPointer(state,var3d,exportName,__RC__) - else - ASSERT_(.false.) - end if - - if (rank == 2) then - var2d = 0.0 - where(limitS <= lats .and. lats <=limitN) var2d = rvar2d - else if (rank == 3) then - var3d = 0.0 - do i=1,size(var3d,3) - where(limitS <= lats .and. lats <=limitN) var3d(:,:,i) = rvar3d(:,:,i) - enddo - end if - - elseif(trim(functionname) == "boxmask") then - is=index(exportExpr,'(') - ie=index(exportExpr,')') - strtmp = exportExpr(is+1:ie-1) - do nargs=1,5 - is = index(strtmp,',') - if (is >0) then - args(nargs) = strtmp(:is-1) - else - args(nargs) = strtmp - end if - strtmp = strtmp(is+1:) - end do - - varToMask=args(1) - - READ(args(2),*,IOSTAT=status) limitS - VERIFY_(status) - READ(args(3),*,IOSTAT=status) limitN - VERIFY_(status) - READ(args(4),*,IOSTAT=status) limitW - VERIFY_(status) - READ(args(5),*,IOSTAT=status) limitE - VERIFY_(status) - ASSERT_(limitE > limitW) - ASSERT_(limitE /= limitW) - ASSERT_(limitN /= limitS) - ASSERT_((limitE-limitW)<=360.0d0) - - call ESMF_GridGetCoord(grid, coordDim=1, localDE=0, & - staggerloc=ESMF_STAGGERLOC_CENTER, farrayPtr=lons, rc=status) - VERIFY_(status) - call ESMF_GridGetCoord(grid, coordDim=2, localDE=0, & - staggerloc=ESMF_STAGGERLOC_CENTER, farrayPtr=lats, rc=status) - VERIFY_(status) - - ! do some tests if cube goes from 0 to 360, lat-lon -180 to 180 - call MAPL_GridGet(grid, globalCellCountPerDim=COUNTS,rc=status) - VERIFY_(STATUS) - if (counts(2)==6*counts(1)) then - isCube=.true. - else - isCube=.false. - end if - - twoBox = .false. - if (isCube) then - if (limitW < 0.0d0 .and. limitE >=0.0d0) then - ! need two boxes - twoBox=.true. - limitW1=0.0d0 - limitE1=limitE - limitW2=limitW+360.0d0 - limitE2=360.0d0 - - else if (limitW <0.0d0 .and. limitE <0.0d0) then - ! just shift - limitW1=limitW+360.d0 - limitE1=limitE+360.d0 - - else - ! normal case - limitW1=limitW - limitE1=limitE - end if - - else - - if (limitW <= 180.0d0 .and. limitE > 180.0d0) then - ! need two boxes - twoBox=.true. - limitW1=limitW - limitE1=180.0d0 - limitW2=-180.d0 - limitE2=limitE-360.0d0 - else if (limitW > 180.0d0 .and. limitE > 180.0d0) then - ! just shift - limitW1=limitW-360.d0 - limitE1=limitE-360.d0 - else - ! normal case - limitW1=limitW - limitE1=limitE - end if - - end if - - limitE1=limitE1*MAPL_PI_R8/180.0d0 - limitW1=limitW1*MAPL_PI_R8/180.0d0 - limitE2=limitE2*MAPL_PI_R8/180.0d0 - limitW2=limitW2*MAPL_PI_R8/180.0d0 - - limitN=limitN*MAPL_PI_R8/180.0d0 - limitS=limitS*MAPL_PI_R8/180.0d0 - if (rank == 2) then - call MAPL_GetPointer(state,rvar2d,vartomask,__RC__) - call MAPL_GetPointer(state,var2d,exportName,__RC__) - else if (rank == 3) then - call MAPL_GetPointer(state,rvar3d,vartomask,__RC__) - call MAPL_GetPointer(state,var3d,exportName,__RC__) - else - ASSERT_(.false.) - end if - - if (rank == 2) then - var2d = 0.0 - where(limitS <= lats .and. lats <=limitN .and. limitW1 <= lons .and. lons <= limitE1 ) var2d = rvar2d - else if (rank == 3) then - var3d = 0.0 - do i=1,size(var3d,3) - where(limitS <= lats .and. lats <=limitN .and. limitW1 <= lons .and. lons <= limitE1 ) var3d(:,:,i) = rvar3d(:,:,i) - enddo - end if - - if (twoBox) then - allocate(temp2d(size(var2d,1),size(var2d,2)),stat=status) - VERIFY_(STATUS) - if (rank == 2) then - temp2d = 0.0 - where(limitS <= lats .and. lats <=limitN .and. limitW2 <= lons .and. lons <= limitE2 ) temp2d = rvar2d - var2d=var2d+temp2d - else if (rank == 3) then - do i=1,size(var3d,3) - temp2d = 0.0 - where(limitS <= lats .and. lats <=limitN .and. limitW2 <= lons .and. lons <= limitE2 ) temp2d = rvar3d(:,:,i) - var3d(:,:,i)=var3d(:,:,i)+temp2d - enddo - end if - deallocate(temp2d) - end if - - end if - - RETURN_(ESMF_SUCCESS) - - end subroutine MAPL_ExtDataEvaluateMask - - SUBROUTINE MAPL_ExtDataExtractIntegers(string,iSize,iValues,delimiter,verbose,rc) - -! !USES: - - IMPLICIT NONE - -! !INPUT/OUTPUT PARAMETERS: - - CHARACTER(LEN=*), INTENT(IN) :: string ! Character-delimited string of integers - INTEGER, INTENT(IN) :: iSize - INTEGER, INTENT(INOUT) :: iValues(iSize)! Space allocated for extracted integers - CHARACTER(LEN=*), OPTIONAL :: delimiter ! 1-character delimiter - LOGICAL, OPTIONAL, INTENT(IN) :: verbose ! Let me know iValues as they are found. - ! DEBUG directive turns on the message even - ! if verbose is not present or if - ! verbose = .FALSE. - INTEGER, OPTIONAL, INTENT(OUT) :: rc ! Return code -! !DESCRIPTION: -! -! Extract integers from a character-delimited string, for example, "-1,45,256,7,10". In the context -! of Chem_Util, this is provided for determining the numerically indexed regions over which an -! emission might be applied. -! -! In multiple passes, the string is parsed for the delimiter, and the characters up to, but not -! including the delimiter are taken as consecutive digits of an integer. A negative sign ("-") is -! allowed. After the first pass, each integer and its trailing delimiter are lopped of the head of -! the (local copy of the) string, and the process is started over. -! -! The default delimiter is a comma (","). -! -! "Unfilled" iValues are zero. -! -! Return codes: -! 1 Zero-length string. -! 2 iSize needs to be increased. -! -! Assumptions/bugs: -! -! A non-zero return code does not stop execution. -! Allowed numerals are: 0,1,2,3,4,5,6,7,8,9. -! A delimiter must be separated from another delimiter by at least one numeral. -! The delimiter cannot be a numeral or a negative sign. -! The character following a negative sign must be an allowed numeral. -! The first character must be an allowed numeral or a negative sign. -! The last character must be an allowed numeral. -! The blank character (" ") cannot serve as a delimiter. -! -! Examples of strings that will work: -! "1" -! "-1" -! "-1,2004,-3" -! "1+-2+3" -! "-1A100A5" -! Examples of strings that will not work: -! "1,--2,3" -! "1,,2,3" -! "1,A,3" -! "1,-,2" -! "1,2,3,4," -! "+1" -! "1 3 6" -! -! !REVISION HISTORY: -! -! Taken from chem utilities. -! -!EOP - CHARACTER(LEN=*), PARAMETER :: Iam = 'Chem_UtilExtractIntegers' - - INTEGER :: base,count,i,iDash,last,lenStr - INTEGER :: multiplier,pos,posDelim,sign - CHARACTER(LEN=255) :: str - CHARACTER(LEN=1) :: char,delimChar - LOGICAL :: Done - LOGICAL :: tellMe - -! Initializations -! --------------- - rc = 0 - count = 1 - Done = .FALSE. - iValues(:) = 0 - base = ICHAR("0") - iDash = ICHAR("-") - -! Determine verbosity, letting the DEBUG -! directive override local specification -! -------------------------------------- - tellMe = .FALSE. - IF(PRESENT(verbose)) THEN - IF(verbose) tellMe = .TRUE. - END IF -#ifdef DEBUG - tellMe = .TRUE. -#endif -! Check for zero-length string -! ---------------------------- - lenStr = LEN_TRIM(string) - IF(lenStr == 0) THEN - rc = 1 - PRINT *,trim(IAm),": ERROR - Found zero-length string." - RETURN - END IF - -! Default delimiter is a comma -! ---------------------------- - delimChar = "," - IF(PRESENT(delimiter)) delimChar(1:1) = delimiter(1:1) - -! Work on a local copy -! -------------------- - str = TRIM(string) - -! One pass for each delimited integer -! ----------------------------------- - Parse: DO - - lenStr = LEN_TRIM(str) - -! Parse the string for the delimiter -! ---------------------------------- - posDelim = INDEX(TRIM(str),TRIM(delimChar)) - IF(tellMe) PRINT *,trim(Iam),": Input string is >",TRIM(string),"<" - -! If the delimiter does not exist, -! one integer remains to be extracted. -! ------------------------------------ - IF(posDelim == 0) THEN - Done = .TRUE. - last = lenStr - ELSE - last = posDelim-1 - END IF - multiplier = 10**last - -! Examine the characters of this integer -! -------------------------------------- - Extract: DO pos=1,last - - char = str(pos:pos) - i = ICHAR(char) - -! Account for a leading "-" -! ------------------------- - IF(pos == 1) THEN - IF(i == iDash) THEN - sign = -1 - ELSE - sign = 1 - END IF - END IF - -! "Power" of 10 for this character -! -------------------------------- - multiplier = multiplier/10 - - IF(pos == 1 .AND. sign == -1) CYCLE Extract - -! Integer comes from remaining characters -! --------------------------------------- - i = (i-base)*multiplier - iValues(count) = iValues(count)+i - IF(pos == last) THEN - iValues(count) = iValues(count)*sign - IF(tellMe) PRINT *,trim(Iam),":Integer number ",count," is ",iValues(count) - END IF - - END DO Extract - - IF(Done) EXIT - -! Lop off the leading integer and try again -! ----------------------------------------- - str(1:lenStr-posDelim) = str(posDelim+1:lenStr) - str(lenStr-posDelim+1:255) = " " - count = count+1 - -! Check size -! ---------- - IF(count > iSize) THEN - rc = 2 - PRINT *,trim(Iam),": ERROR - iValues does not have enough elements." - END IF - - END DO Parse - - RETURN_(ESMF_SUCCESS) - - END SUBROUTINE MAPL_ExtDataExtractIntegers - - function MAPL_ExtDataGetFStartTime(fname, rc) result(stime) - - character(len=*), intent(in ) :: fname - integer, optional, intent(out ) :: rc - - type(ESMF_Time) :: stime - - character(len=ESMF_MAXSTR), parameter :: IAM="MAPL_ExtDataGetFStartTime" - integer :: status - - integer :: iyr,imm,idd,ihr,imn,isc,begDate,begTime - type(ESMF_CFIO) :: cfio - - cfio = ESMF_CFIOCreate (cfioObjName='cfio_obj',__RC__) - call ESMF_CFIOSet(CFIO, fName=fname,__RC__) - call ESMF_CFIOFileOpen (CFIO, FMODE=1, cyclic=.false.,__RC__) - begDate = cfio%date - begTime = cfio%begTime - call MAPL_UnpackTime(begDate,iyr,imm,idd) - call MAPL_UnpackTime(begTime,ihr,imn,isc) - call ESMF_TimeSet(sTime, yy=iyr, mm=imm, dd=idd, h=ihr, m=imn, s=isc, __RC__) - call ESMF_CFIODestroy(CFIO,__RC__) - - RETURN_(ESMF_SUCCESS) - - end function MAPL_ExtDataGetFStartTime - - subroutine AdvanceAndCount(CF,nLines,rc) - - type(ESMF_Config), intent(inout) :: cf - integer, intent(out) :: nLines - integer, optional, intent(out) :: rc - - integer :: iCnt - logical :: inBlock - character(len=ESMF_MAXPATHLEN) :: thisLine - integer :: status - character(len=ESMF_MAXSTR) :: Iam - Iam = "AdvanceAndCount" - - inBlock = .true. - iCnt = 0 - do while(inBlock) - call ESMF_ConfigNextLine(CF,rc=status) - VERIFY_(STATUS) - call ESMF_ConfigGetAttribute(CF,thisLine,rc=status) - VERIFY_(STATUS) - if (trim(thisLine) == "%%") then - inBlock = .false. - else - iCnt = iCnt + 1 - end if - end do - nLines = iCnt - - RETURN_(ESMF_SUCCESS) - - end subroutine advanceAndCount - - subroutine CheckUpdate(doUpdate,updateTime,currTime,hasRun,primaryItem,derivedItem,rc) - logical, intent(out ) :: doUpdate - type(ESMF_Time), intent(inout) :: updateTime - type(ESMF_Time), intent(inout) :: currTime - logical , intent(in ) :: hasRun - type(PrimaryExport), optional, intent(inout) :: primaryItem - type(DerivedExport), optional, intent(inout) :: derivedItem - integer, optional, intent(out ) :: rc - - character(len=ESMF_MAXSTR) :: Iam - integer :: status - type(ESMF_Time) :: time,time0,refresh_time - Iam = "CheckUpdate" - - time0 = currTime - time = currTime - if (present(primaryItem)) then - - if (primaryItem%AlarmIsEnabled) then - doUpdate = ESMF_AlarmIsRinging(primaryItem%update_alarm,__RC__) - if (hasRun .eqv. .false.) doUpdate = .true. - updateTime = currTime - else if (trim(primaryItem%cyclic) == 'single') then - doUpdate = .true. - else - if (primaryItem%refresh_template == "0") then - doUpdate = .true. - updateTime = time0 + PrimaryItem%tshift - else - updateTime = time0 - if (.not. associated(PrimaryItem%refresh_time)) then - doUpdate = .false. - else - refresh_time = timestamp_(time, PrimaryItem%refresh_template, __RC__) - if (refresh_time /= primaryItem%refresh_time) then - doUpdate = .true. - primaryItem%refresh_time = refresh_time - updateTime = refresh_time - else - doUpdate = .false. - end if - end if - end if - end if - else if (present(derivedItem)) then - if (DerivedItem%AlarmIsEnabled) then - doUpdate = ESMF_AlarmIsRinging(derivedItem%update_alarm,__RC__) - updateTime = currTime - else - if (derivedItem%refresh_template == "0") then - doUpdate = .true. - updateTime = time0 + derivedItem%tshift - else - updateTime = time0 - if (.not. associated(derivedItem%refresh_time)) then - doUpdate = .false. - else - refresh_time = timestamp_(time, derivedItem%refresh_template, __RC__) - if (refresh_time /= derivedItem%refresh_time) then - doUpdate = .true. - derivedItem%refresh_time = refresh_time - time = refresh_time - else - doUpdate = .false. - end if - end if - end if - end if - end if - - RETURN_(ESMF_SUCCESS) - end subroutine CheckUpdate - - subroutine SetRefreshAlarms(clock,primaryItem,derivedItem,rc) - type(ESMF_Clock), intent(inout) :: Clock - type(PrimaryExport), optional, intent(inout) :: primaryItem - type(DerivedExport), optional, intent(inout) :: derivedItem - integer, optional, intent(out ) :: rc - - integer :: pindex,cindex,iyy,imm,idd,ihh,imn,isc - character(len=ESMF_MAXSTR) :: refresh_template,ctInt - character(len=ESMF_MAXSTR) :: Iam - type(ESMF_TimeInterval) :: tInterval - integer :: status - Iam = "SetRefreshAlarms" - - if (present(primaryItem)) then - refresh_template = primaryItem%refresh_template - else if (present(derivedItem)) then - refresh_template = derivedItem%refresh_template - end if - pindex = index(refresh_template,'P') - if (pindex > 0) then - ! now get time interval. Put 0000-00-00 in front if not there so parsetimeunits doesn't complain - ctInt = refresh_template(pindex+1:) - cindex = index(ctInt,'T') - if (cindex == 0) ctInt = '0000-00-00T'//trim(ctInt) - call MAPL_NCIOParseTimeUnits(ctInt,iyy,imm,idd,ihh,imn,isc,status) - VERIFY_(STATUS) - call ESMF_TimeIntervalSet(tInterval,yy=iyy,mm=imm,d=idd,h=ihh,m=imn,s=isc,rc=status) - VERIFY_(STATUS) - if (present(primaryItem)) then - primaryItem%update_alarm = ESMF_AlarmCreate(clock=clock,ringInterval=tInterval,sticky=.false.,rc=status) - VERIFY_(STATUS) - primaryItem%alarmIsEnabled = .true. - else if (present(derivedItem)) then - DerivedItem%update_alarm = ESMF_AlarmCreate(clock=clock,ringInterval=tInterval,sticky=.false.,rc=status) - VERIFY_(STATUS) - derivedItem%alarmIsEnabled = .true. - end if - end if - - RETURN_(ESMF_SUCCESS) - end subroutine SetRefreshAlarms - - ! This is a routine to make the appropriate call to MAPL_CFIO so we do not need to - ! duplicate the calls with lots of if/else for voting, fractional etc ... - subroutine MAPL_ExtDataGridCompRead(item,file,ExtState,side,rc) - type(PrimaryExport), intent(INOUT) :: item - character(len=*), intent(IN ) :: file - type(MAPL_ExtData_State), intent(INOUT) :: ExtState - integer, intent(IN ) :: side - integer, optional, intent( OUT) :: rc - - character(len = ESMF_MAXSTR) :: Iam - integer :: Status - - type(ESMF_Field) :: field - type(ESMF_FieldBundle) :: bundle - type(ESMF_Time) :: time - character(len=ESMF_MAXSTR) :: name - integer :: trans - integer :: val - integer :: id_ps - logical :: ignoreCase - type(ESMF_Grid) :: newGrid, Grid - type(ESMF_Field) :: newField,psF - - Iam = "MAPL_ExtDataGridCompRead" - - if (side == MAPL_ExtDataLeft) then - time = item%time1 - else if (side == MAPL_ExtDataRight) then - time = item%time2 - end if - name = trim(item%var) - trans = item%trans - val = item%FracVal - ignoreCase = ExtState%ignoreCase - - if ((item%do_Fill .or. item%do_VertInterp) .and. item%VarType == MAPL_FieldItem) then - - ASSERT_(item%VarType == MAPL_FieldItem) - call MAPL_ExtDataGetBracket(item,side,field=Field,__RC__) - call ESMF_FieldGet(field,grid=grid,__RC__) - newGrid = MAPL_ExtDataGridChangeLev(grid,ExtState%cf,item%lm,__RC__) - newField = MAPL_FieldCreate(field,newGrid,lm=item%lm,newName=name,__RC__) - - else if (.not. item%do_VertInterp .and. .not. item%do_Fill .and. item%VarType == MAPL_FieldItem) then - - call MAPL_ExtDataGetBracket(item,side,field=NewField,__RC__) - - end if - - if (item%VarType == MAPL_FieldItem) then -!!$ if (trans == MAPL_HorzTransOrderBilinear) then - if (trans == REGRID_METHOD_BILINEAR) then - call MAPL_CFIORead(name, file, time, newfield, & - time_is_cyclic=.false., time_interp=.false., ignoreCase = ignoreCase, & - __RC__) -!!$ else if (trans == MAPL_HorzTransOrderBinning) then - else if (trans == REGRID_METHOD_CONSERVE) then - call MAPL_CFIORead(name, file, time, newfield, & - time_is_cyclic=.false., time_interp=.false., ignoreCase = ignoreCase, & - Conservative = .true., __RC__) -!!$ else if (trans == MAPL_HorzTransOrderSample) then - else if (trans == REGRID_METHOD_VOTE) then - call MAPL_CFIORead(name, file, time, newfield, & - time_is_cyclic=.false., time_interp=.false., ignoreCase = ignoreCase, & - Conservative = .true., Voting = .true., __RC__) -!!$ else if (trans == MAPL_HorzTransOrderFraction) then - else if (trans == REGRID_METHOD_FRACTION) then - call MAPL_CFIORead(name, file, time, newfield, & - time_is_cyclic=.false., time_interp=.false., ignoreCase = ignoreCase, & - Conservative = .true., getFrac = val, __RC__) - end if - - else if (item%VarType == MAPL_BundleItem) then - - call MAPL_ExtDataGetBracket(item,side,bundle=bundle,__RC__) - -!!$ if (trans == MAPL_HorzTransOrderBilinear) then - if (trans == REGRID_METHOD_BILINEAR) then - call MAPL_CFIORead(file, time, bundle, & - time_is_cyclic=.false., time_interp=.false., ignoreCase = ignoreCase, & - __RC__) -!!$ else if (trans == MAPL_HorzTransOrderBinning) then - else if (trans == REGRID_METHOD_CONSERVE) then - call MAPL_CFIORead(file, time, bundle, & - time_is_cyclic=.false., time_interp=.false., ignoreCase = ignoreCase, & - Conservative = .true., __RC__) -!!$ else if (trans == MAPL_HorzTransOrderSample) then - else if (trans == REGRID_METHOD_VOTE) then - call MAPL_CFIORead(file, time, bundle, & - time_is_cyclic=.false., time_interp=.false., ignoreCase = ignoreCase, & - Conservative = .true., Voting = .true., __RC__) -!!$ else if (trans == MAPL_HorzTransOrderFraction) then - else if (trans == REGRID_METHOD_FRACTION) then - call MAPL_CFIORead(file, time, bundle, & - time_is_cyclic=.false., time_interp=.false., ignoreCase = ignoreCase, & - Conservative = .true., getFrac = val, __RC__) - end if - - end if - - if (item%do_VertInterp .and. item%VarType == MAPL_FieldItem) then - call MAPL_ExtDataGetBracket(item,side,field=Field,__RC__) - id_ps = ExtState%primaryOrder(1) - call MAPL_ExtDataGetBracket(ExtState%primary%item(id_ps),side,field=psF,__RC__) - call vertInterpolation_pressKappa(field,newfield,psF,item%levs,MAPL_UNDEF,__RC__) - - else if (item%do_Fill .and. item%VarType == MAPL_FieldItem) then - call MAPL_ExtDataFillField(field,newfield,rc=status) - VERIFY_(STATUS) - end if - - RETURN_(ESMF_SUCCESS) - - end subroutine MAPL_ExtDataGridCompRead - - function MAPL_ExtDataGridChangeLev(Grid,CF,lm,rc) result(NewGrid) - - type(ESMF_Grid), intent(inout) :: Grid - type(ESMF_Config), intent(inout) :: CF - integer, intent(in) :: lm - integer, optional, intent(out) :: rc - - integer :: status - character(len=ESMF_MAXSTR) :: Iam - - character(len=ESMF_MAXSTR) :: gname - integer :: counts(3) - integer :: NX,NY - type(ESMF_Grid) :: newGrid - !type(ESMF_Grid), external :: AppGridCreateF - - IAM = "MAPL_ExtDataGridChangeLev" - - call MAPL_GridGet(grid,globalCellCountPerDim=counts,__RC__) - call ESMF_GridGet(grid,name=gName,__RC__) - call ESMF_ConfigGetAttribute(CF, value = NX, Label="NX:", __RC__) - call ESMF_ConfigGetAttribute(CF, value = NY, Label="NY:", __RC__) - print *, IAM, ' count ', counts - if (counts(2) == 6*counts(1)) then - newgrid = AppGridCreateF(counts(1),counts(2),lm,NX,NY,status) - VERIFY_(STATUS) - else - newgrid = MAPL_LatLonGridCreate(name="gName", & - NX = NX, & - NY = NY, & - IM_World = counts(1), & - JM_World = counts(2), & - LM_World = lm, & - RC=STATUS ) - VERIFY_(STATUS) - end if - RETURN_(ESMF_SUCCESS) - - end function MAPL_ExtDataGridChangeLev - - subroutine MAPL_ExtDataGetBracket(item,Bside,field,bundle,vcomp,rc) - - type(PrimaryExport), intent(inout) :: item - integer, intent(in ) :: bside - type(ESMF_Field), optional, intent(inout) ::field - type(ESMF_FieldBundle), optional, intent(inout) ::bundle - integer, optional, intent(in ) :: vcomp - integer, optional, intent(out ) :: rc - - character(len=ESMF_MAXSTR) :: Iam - - Iam = "MAPL_ExtDataGetBracket" - - if (present(vcomp)) then - - if (present(field)) then - if (Bside == MAPL_ExtDataLeft .and. vcomp == 1) then - field = item%v1_finterp1 - RETURN_(ESMF_SUCCESS) - else if (Bside == MAPL_ExtDataLeft .and. vcomp == 2) then - field = item%v2_finterp1 - RETURN_(ESMF_SUCCESS) - else if (Bside == MAPL_ExtDataRight .and. vcomp == 1) then - field = item%v1_finterp2 - RETURN_(ESMF_SUCCESS) - else if (Bside == MAPL_ExtDataRight .and. vcomp == 2) then - field = item%v2_finterp2 - RETURN_(ESMF_SUCCESS) - end if - else if (present(bundle)) then - RETURN_(ESMF_FAILURE) - end if - - else - - if (present(field)) then - if (Bside == MAPL_ExtDataLeft) then - field = item%finterp1 - RETURN_(ESMF_SUCCESS) - else if (Bside == MAPL_ExtDataRight) then - field = item%finterp2 - RETURN_(ESMF_SUCCESS) - end if - else if (present(bundle)) then - if (Bside == MAPL_ExtDataLeft) then - bundle = item%binterp1 - RETURN_(ESMF_SUCCESS) - else if (Bside == MAPL_ExtDataRight) then - bundle = item%binterp2 - RETURN_(ESMF_SUCCESS) - end if - - end if - - end if - RETURN_(ESMF_FAILURE) - - end subroutine MAPL_ExtDataGetBracket - - subroutine MAPL_ExtDataFillField(FieldF,FieldR,rc) - - type(ESMF_Field), intent(inout) :: FieldF - type(ESMF_Field), intent(inout) :: FieldR - integer, optional, intent(out) :: rc - - character(len=ESMF_MAXSTR) :: Iam - integer :: status - - real, pointer :: ptrF(:,:,:),ptrR(:,:,:) - integer :: lm_in,lm_out,i - - Iam = "MAPL_ExtDataFillField" - - call ESMF_FieldGet(FieldF,0,farrayPtr=ptrF,rc=status) - VERIFY_(STATUS) - call ESMF_FieldGet(FieldR,0,farrayPtr=ptrR,rc=status) - VERIFY_(STATUS) - ptrF = 0.0 - lm_in= size(ptrR,3) - lm_out = size(ptrF,3) - do i=1,lm_in - ptrF(:,:,lm_out-i+1)=ptrR(:,:,i) - enddo - - RETURN_(ESMF_SUCCESS) - - end subroutine MAPL_ExtDataFillField - - end module EXTDATA diff --git a/GeosCtmProto/fvcore_layout.rc b/GeosCtmProto/fvcore_layout.rc deleted file mode 100644 index f22054e9..00000000 --- a/GeosCtmProto/fvcore_layout.rc +++ /dev/null @@ -1,29 +0,0 @@ - npx: 48 - npy: 48 - npz: 72 - dt: 900 - n_sponge: -1 - ADIABATIC: .true. - hydrostatic: .true. - nord: 0 - d2_bg: 0.0075 - d4_bg: 0.0 - dddmp: 0.2 - ksplit: 1 - nsplit: 0 - msplit: 0 - hord_mt: 10 - hord_vt: 10 - hord_tm: 10 - hord_dp: 13 - hord_tr: 13 - kord_tm: -9 - kord_mt: 9 - kord_wz: 9 - kord_tr: 9 - test_case: 5 - FV_OFF: .false. - fv_debug: .false. - inline_q: .false. - z_tracer: .false. - chk_mass: .false. diff --git a/GeosCtmProto/input.nml b/GeosCtmProto/input.nml deleted file mode 100755 index 49ad23c3..00000000 --- a/GeosCtmProto/input.nml +++ /dev/null @@ -1,3 +0,0 @@ -&fms_nml - print_memory_usage = .false., - domains_stack_size = 3000000/ diff --git a/GeosCtmProto/pTracers_GridComp.rc b/GeosCtmProto/pTracers_GridComp.rc deleted file mode 100644 index b9a46fbe..00000000 --- a/GeosCtmProto/pTracers_GridComp.rc +++ /dev/null @@ -1,48 +0,0 @@ - -#--------------------------------------------------------------- -# The cold start allows you to use synthetic tracers (5 of them) -#--------------------------------------------------------------- -do_AdvColdStart: T - -#------------------------------------------------------------------------- -# Do you want to compute the total mass of each tracer at every time step? -#------------------------------------------------------------------------- -do_ComputeTracerMass: T - -#----------------------- -# Setting for cold start (not really necessary for it is part of the code -#----------------------- -vNames:: -Q00 -Q01 -Q02 -Q03 -Q04 -:: - -vunits:: -mol/mol -mol/mol -mol/mol -mol/mol -mol/mol -:: - -# If you are not using a cold start run (you have your own restart file), -# you will need to provide the tracer names and the tracer units -# (as appearing in your restart file). For instance: -# -# vNames:: -# CH2O -# CH4 -# CO -# H2 -# :: -# -# vunits:: -# mol/mol -# mol/mol -# mol/mol -# mol/mol -# :: -# diff --git a/GeosCtmProto/ptracer.F90 b/GeosCtmProto/ptracer.F90 deleted file mode 100644 index cefad09a..00000000 --- a/GeosCtmProto/ptracer.F90 +++ /dev/null @@ -1,1472 +0,0 @@ -#include "MAPL_Generic.h" -!============================================================================= -! NASA/GSFC, Software System Support Office, Code 610.3 ! -!============================================================================= -!BOP -! -! !MODULE: PTRACER -! -! !INTERFACE: -! - module PTRACER -! -! !USESs: - use ESMF - use NUOPC - use NUOPC_Model, & - model_routine_SS => SetServices, & - model_label_Advance => label_Advance, & - model_label_DataInitialize => label_DataInitialize, & - model_label_CheckImport => label_CheckImport - use NUOPC_Generic - use m_set_eta, only: set_eta - use MAPL_Mod -! USE Chem_UtilMod - - USE jw, only : tracer_q, tracer_q1_q2, tracer_q3 - - implicit none -! - private -! -! !PUBLIC MEMBER FUNCTIONS: - public SetServices -! -! !DESCRIPTION: -! {\tt CTM\_pTracers} is a passive tracer component that is friendly -! to DYNAMICS. A set of tracers is initialized through either through -! internal computations (idealized tracers) or through a restart file -! and advected for the desired period of time. The only operation -! involved is Advection. -! -!EOP -!============================================================================= - -!# include "GmiParameters.h" - -#define PRINT_STATES - - type t_ArrayBundle - real, pointer :: pArray3D(:,:,:) => null() - end type t_ArrayBundle - - type T_pTracers_STATE - private - type(t_ArrayBundle), pointer :: tr(:) => null() - CHARACTER(LEN=ESMF_MAXSTR), pointer :: vname(:) => null() - CHARACTER(LEN=ESMF_MAXSTR), pointer :: vtitle(:) => null() - CHARACTER(LEN=ESMF_MAXSTR), pointer :: vunits(:) => null() - end type T_pTracers_STATE - - type pTracers_WRAP - type (T_pTracers_STATE), pointer :: PTR - end type pTracers_WRAP - - logical :: do_AdvColdStart - logical :: do_ComputeTracerMass - integer, parameter :: REAL4 = 4 !kind(1.00) - integer, parameter :: REAL8 = 8 !kind(1.d0) -! -!============================================================================= -contains -!============================================================================= -!BOP -! -! !IROUTINE: SetServices - -! !INTERFACE: - - subroutine SetServices ( GC, RC ) -! -! !OUTPUT PARAMETERS: - integer, intent(out) :: RC ! return code -! -! !INPUT/OUTPUT PARAMETERS: - type(ESMF_GridComp) :: GC ! gridded component - -! !DESCRIPTION: Sets Initialize and Run services. -! \newline -! -!EOP -!============================================================================= -!BOC -! -! ErrLog Variables - character(len=ESMF_MAXSTR) :: IAm = 'SetServices' - character(len=ESMF_MAXSTR) :: COMP_NAME -! Local derived type aliases - type (ESMF_Config ) :: configFile - type (mystates_WRAP) :: mystates_ptr - type (my_States), pointer :: mystates - INTEGER :: numTracers, dims(3) - - ! Get my name and set-up traceback handle - !---------------------------------------- - - call ESMF_GridCompGet( GC, NAME=COMP_NAME, RC=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - Iam = trim(COMP_NAME) //"::"// trim(Iam) - - call ESMF_LogWrite(Iam, ESMF_LOGMSG_INFO, rc=rc) - - allocate(mystates) - mystates_ptr%ptr => mystates - call ESMF_UserCompSetInternalState(GC, 'MAPL_VarSpec', mystates_ptr, rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! the NUOPC model component will register the generic methods - call NUOPC_CompDerive(GC, model_routine_SS, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! Register services for this component - ! ------------------------------------ - ! Provide InitializeP0 to switch to custom IPD version - call ESMF_GridCompSetEntryPoint(GC, ESMF_METHOD_INITIALIZE, & - userRoutine=InitializeP0, phase=0, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! set entry point for methods that require specific implementation - call NUOPC_CompSetEntryPoint(GC, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv02p1"/), userRoutine=InitAdvertise, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSetEntryPoint(GC, ESMF_METHOD_INITIALIZE, & - phaseLabelList=(/"IPDv02p3"/), userRoutine=InitRealize, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call NUOPC_CompSpecialize(GC, specLabel=model_label_DataInitialize, & - specRoutine=initTracer, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - -#if 0 - call ESMF_MethodRemove(GC, label=model_label_CheckImport,rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_CompSpecialize(GC, specLabel=model_label_CheckImport, & - specRoutine=NUOPC_NoOp, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#endif - - call NUOPC_CompSpecialize(GC, specLabel=model_label_Advance, & - specRoutine=ModelAdvance, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine SetServices - - !----------------------------------------------------------------------------- - - subroutine InitializeP0(gcomp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: gcomp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - rc = ESMF_SUCCESS - call ESMF_LogWrite("dyn InitializeP0", ESMF_LOGMSG_INFO, rc=rc) - - ! Switch to IPDv02 (for datainitialize dependency loop) - ! by filtering all other phaseMap entries - call NUOPC_CompFilterPhaseMap(gcomp, ESMF_METHOD_INITIALIZE, & - acceptStringList=(/"IPDv02p"/), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - end subroutine - - !----------------------------------------------------------------------------- - - subroutine InitAdvertise(GC, IMPORT, EXPORT, CLOCK, rc) - type(ESMF_GridComp) :: GC - type(ESMF_State) :: IMPORT - type(ESMF_State) :: EXPORT - type(ESMF_Clock) :: CLOCK - integer, intent(out) :: rc - - - CHARACTER(LEN=ESMF_MAXSTR) :: rcfilen = 'pTracers_GridComp.rc' - character(len=ESMF_MAXSTR) :: IAm = 'InitAdvertise' - type(ESMF_Config) :: configFile - type(MAPL_VarSpec), pointer :: importSpec(:), exportSpec(:) - character(len=ESMF_MAXSTR) :: FRIENDLIES - type (mystates_WRAP) :: mystates_ptr - type (T_pTracers_STATE), pointer :: state - type (pTracers_wrap) :: wrap - INTEGER :: numTracers, dims(3) - INTEGER :: n, i, ic - CHARACTER(LEN=ESMF_MAXSTR) :: tempNames(150) - CHARACTER(LEN=38400) :: longList - character(len=2) :: id - character(len=ESMF_MAXSTR) :: short_name, long_name - character(len=ESMF_MAXSTR) :: units - integer :: STATUS - - rc = ESMF_SUCCESS - - call ESMF_LogWrite("PTRACER:InitAdvertise", ESMF_LOGMSG_INFO, rc=rc) - - configFile = ESMF_ConfigCreate(rc=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_ConfigLoadFile(configFile, TRIM(rcfilen), rc=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_GridCompSet(GC, config=ConfigFile, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_ConfigGetAttribute(configFile, do_ComputeTracerMass, & - Default = .FALSE., & - Label = "do_ComputeTracerMass:", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_ConfigGetAttribute(configFile, do_AdvColdStart, & - Default = .FALSE., & - Label = "do_AdvColdStart:", rc=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! Wrap internal state for storing in GC; rename legacyState - ! ------------------------------------- - allocate ( state, stat=rc ) - wrap%ptr => state - -! !IMPORT STATE: - - call NUOPC_AddImportSpec ( GC, & - SHORT_NAME = 'AREA', & - LONG_NAME = 'agrid_cell_area', & - UNITS = 'm+2' , & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, RC=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call NUOPC_AddImportSpec(GC, & - SHORT_NAME = 'PLE', & -! name inconsistent with the name used in ECTM -! LONG_NAME = 'air_pressure', & - LONG_NAME = 'pressure_at_layer_edges', & - UNITS = 'Pa', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationEdge, & - RC=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_UserCompGetInternalState(gc, 'MAPL_VarSpec', mystates_ptr, rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - !Advertize the import fields - importSpec => mystates_ptr%ptr%importSpec - - do i=1,size(importSpec) - call MAPL_VarSpecGet(importSpec(i), SHORT_NAME=short_name, & - LONG_NAME=long_name, UNITS=units, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_Advertise(IMPORT, & - StandardName=long_name, name=short_name, units=units, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - !print *, 'PTRACER: advertise import field ', long_name - end do - - - if (do_AdvColdStart) then - numTracers = 5 - - allocate(state%vname(numTracers), stat=STATUS) - VERIFY_(STATUS) - allocate(state%vunits(numTracers), stat=STATUS) - VERIFY_(STATUS) - allocate(state%vtitle(numTracers), stat=STATUS) - VERIFY_(STATUS) - - do ic = 1, numTracers - write (id ,'(i2.2)') ic-1 - state%vname (ic) = 'Q'//id - state%vtitle(ic) = 'advected_quantity_'//id - state%vunits(ic) = 'mol/mol' - end do - - else - call rcEsmfReadTable2String(configFile, longList, "vNames::", rc=STATUS) - VERIFY_(STATUS) - - !------------------------------------- - ! Obtain the name of all the tracers - !------------------------------------- - tempNames(:) = '' - - call constructListNames(tempNames, longList) - - numTracers = Count (tempNames(:) /= '') - - allocate(state%vname(numTracers), stat=STATUS) - VERIFY_(STATUS) - - state%vname(:) = tempNames(1:numTracers) - - allocate(state%vunits(numTracers), stat=STATUS) - VERIFY_(STATUS) - - allocate(state%vtitle(numTracers), stat=STATUS) - VERIFY_(STATUS) - state%vtitle(:) = '' - - ! Obtain the units of tracers - !---------------------------- - call rcEsmfReadTable2String(configFile, longList, "vunits::", rc=STATUS) - VERIFY_(STATUS) - - tempNames(:) = '' - call constructListNames(tempNames, longList) - - state%vunits(:) = tempNames(1:numTracers) - - end if - - IF ( MAPL_AM_I_ROOT() ) THEN - WRITE(*,101) numTracers - DO n = 1, numTracers - WRITE(*,201) n, TRIM(state%vname(n)), TRIM(state%vunits(n)), TRIM(state%vtitle(n)) - END DO - PRINT *," " - ENDIF - - 101 FORMAT(/,' ---------------------------------------',/, & - ' There are ',I3,' tracers ',/, & - ' ---',2X,'----------------',2X,'----------------',/, & - ' ID ',2X,' Name ',2X,' Unit ',/, & - ' ---',2X,'----------------',2X,'----------------') - 201 FORMAT(' ',I3,2X,A16,2X,A16,4X,A22) - - !call ESMF_GridCompGet( GC, GRID=grid, RC=STATUS ) - !VERIFY_(STATUS) - - !--------------------------- - ! Allocate the state tracers - !--------------------------- - allocate(state%tr(numTracers)) - - -! ------------------------ -! ESMF Functional Services -! ------------------------ - - call ESMF_UserCompSetInternalState ( GC, 'PTRACERS', WRAP, rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - -! !INTERNAL STATE: -! !When FRIENDLYTO is given, these fields will be added into the exportSpec automatically - - FRIENDLIES="DYNAMICS:TURBULENCE:MOIST" - - do n = 1, numTracers - CALL NUOPC_AddInternalSpec(GC, & - SHORT_NAME = TRIM(state%vname(n)), & - LONG_NAME = TRIM(state%vtitle(n)), & - UNITS = TRIM(state%vunits(n)), & - FRIENDLYTO = TRIM(FRIENDLIES), & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, RC=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - enddo - - !Advertize the export fields - exportSpec => mystates_ptr%ptr%exportSpec - - do i=1,size(exportSpec) - call MAPL_VarSpecGet(exportSpec(i), SHORT_NAME=short_name, & - LONG_NAME=long_name,UNITS=units, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_Advertise(EXPORT, & - StandardName=long_name, name=short_name, units=units, & - SharePolicyField="share", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - !print *, 'PTRACER: advertise export field ', long_name - end do - -#if 0 - ! Set the Profiling timers - ! ------------------------ - call MAPL_TimerAdd ( GC, name = "RUN", RC=STATUS ) - VERIFY_(STATUS) - call MAPL_TimerAdd ( GC, name = "INITIALIZE", RC=STATUS ) - VERIFY_(STATUS) - call MAPL_TimerAdd ( GC, name = "FINALIZE", RC=STATUS ) - VERIFY_(STATUS) -#endif - - ! Generic Set Services - ! -------------------- - - !call MAPL_GenericSetServices ( GC,RC=STATUS ) - !VERIFY_(STATUS) - - RETURN - - end subroutine InitAdvertise -!EOC -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!BOP -! -! !IROUTINE: initRealize -! -! !INTERFACE: -! - subroutine InitRealize ( GC, IMPORT, EXPORT, CLOCK, RC ) -! - type(ESMF_GridComp) :: GC ! Gridded component - type(ESMF_State) :: IMPORT ! Import state - type(ESMF_State) :: EXPORT ! Export state - type(ESMF_Clock) :: CLOCK ! The clock -! -! !OUTPUT PARAMETERS: - integer, intent( out) :: RC ! Error code -! -! !DESCRIPTION: The Initialize method of pTracers gridded component. -! \newline -! -!EOP -!============================================================================= -!BOC -! -! ErrLog Variables - character(len=ESMF_MAXSTR) :: IAm = 'initRealize' - integer :: nymd, nhms ! time of day - real :: cdt ! timestep (secs) - integer :: STATUS, ic, nSpc, i, j, k - character(len=ESMF_MAXSTR) :: COMP_NAME -! Local derived type aliases - character(len=ESMF_MAXSTR) :: short_name - type (T_pTracers_STATE), pointer :: pTracers_STATE - type (pTracers_wrap) :: WRAP - type(ESMF_Grid) :: esmfGrid - type(mystates_wrap) :: mystates_ptr - type(MAPL_VarSpec), pointer :: importSpec(:) - type(MAPL_VarSpec), pointer :: exportSpec(:) - - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! Need to get the grid from its parent - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - - ! Get the target components name and set-up traceback handle. - ! ----------------------------------------------------------- - - call ESMF_GridCompGet ( GC, name=COMP_NAME, RC=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - Iam = trim(COMP_NAME)//'::InitRealize' - - call ESMF_LogWrite(Iam, ESMF_LOGMSG_INFO, rc=rc) - - ! Get the grid related information - !--------------------------------- - call ESMF_GridCompGet ( GC, GRID=esmfGrid, rc=RC) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! Get the importSpec and exportSpec from internal state - call ESMF_UserCompGetInternalState(GC, "MAPL_VarSpec", mystates_ptr, rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - importSpec => mystates_ptr%ptr%importSpec - exportSpec => mystates_ptr%ptr%exportSpec - - ! Start timer - !------------ - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! Need to get the grid from its parent - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - - !call MAPL_TimerOn (ggState,"TOTAL" ) - !call MAPL_TimerOn (ggState,"INITIALIZE" ) - - ! Need to create fields and realize them - - ! realize connected Fields in the importState - call realizeConnectedFields(IMPORT, importspec, esmfGrid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! realize connected Fields in the importState - call realizeConnectedFields(EXPORT, exportspec,esmfGrid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - -#if 0 - call initTracer(GC, rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#endif - return - - contains !-------------------------------------------------------- - - subroutine realizeConnectedFields(state, spec, grid, rc) - ! TODO: this method may move into the NUOPC_ utility layer - type(ESMF_State) :: state - type(MAPL_VarSpec),pointer :: spec(:) - type(ESMF_Grid) :: grid - integer, intent(out), optional :: rc - ! local variables - character(len=ESMF_MAXSTR) :: fieldName - character(len=ESMF_MAXSTR) :: name - integer :: i, itemCount, k - type(ESMF_Field) :: field - real(ESMF_KIND_R8), pointer :: fptr(:) - type(ESMF_Index_Flag) :: indexflag - - if (present(rc)) rc = ESMF_SUCCESS - - itemCount=size(spec) - - k=1 ! initialize - do i=1, itemCount - ! find the VarSpec with matching long_name - call MAPL_VarSpecGet(spec(i),LONG_NAME=fieldName, SHORT_NAME=name, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call MAPL_VarSpecSet(spec(i), GRID=grid,rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - if (NUOPC_IsConnected(state, fieldName=name)) then - ! create a Field - field = NUOPC_FieldCreateFromSpec(spec(i),rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - ! realize the connected Field using the just created Field - call NUOPC_Realize(state, field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - else - ! We might need to keep them for now to allow the connection between - ! the friendly fields and - ! remove a not connected Field from State in a later phase - call ESMF_StateRemove(state, (/name/), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - print *, 'PTRACER remove field ', name - - endif - enddo - - end subroutine realizeConnectedFields - - end subroutine initRealize - - -!---------------------------------------------------------------------- - subroutine initTracer ( GC, RC ) -! - type(ESMF_GridComp) :: GC ! Gridded component - integer, intent( out) :: RC ! Error code -! -! !DESCRIPTION: The Initialize method of pTracers gridded component. -! \newline -! -!EOP -!============================================================================= - - REAL(REAL8), POINTER, DIMENSION(:) :: AK - REAL(REAL8), POINTER, DIMENSION(:) :: BK - integer :: IS, IE, JS, JE, KS,KE, KM, IM, JM, LS - integer :: p_ks - real(REAL8) :: dummy_1, dummy_2, dummy_3, dummy_4, dummy_5, dummy_6 - real(REAL8) :: dz, ztop, height, pressure - real(REAL8) :: LONc,LATc - real(REAL8) :: eta, eta_top, rot_ang, ptop, pint - real(ESMF_KIND_R8), pointer :: LONSR8 (:,:) - real(ESMF_KIND_R8), pointer :: LATSR8 (:,:) - real(ESMF_KIND_R4), pointer :: LONS (:,:) - real(ESMF_KIND_R4), pointer :: LATS (:,:) - type (mystates_WRAP) :: mystates_ptr - type (MAPL_VarSpec), pointer :: internalSpec(:) - type (T_pTracers_STATE), pointer :: pTracers_STATE - type (pTracers_wrap) :: WRAP - real(REAL8), parameter :: r0_6=0.6 - real(REAL8), parameter :: r1_0=1.0 - type(ESMF_Grid) :: esmfGrid - type(ESMF_Field) :: field - integer :: minIndex(2,6) - integer :: maxIndex(2,6) - integer :: tileno, nSpc - integer :: i, j, k, ic - character(len=ESMF_MAXSTR) :: short_name - character(len=ESMF_MAXSTR) :: Iam = 'PTRACER:initTracer' - type(ESMF_State) :: IMPORT, EXPORT - type(ESMF_State) :: INTERNAL - type(ESMF_Clock) :: clock - integer :: STATUS - - ! Get my private state from the component - !---------------------------------------- - call ESMF_LogWrite("PTRACER:dataInitialize", ESMF_LOGMSG_INFO, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_UserCompGetInternalState(gc, 'MAPL_VarSpec', mystates_ptr, rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - internalSpec => mystates_ptr%ptr%InternalSpec - - call ESMF_UserCompGetInternalState(gc, 'PTRACERS', WRAP, rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - pTracers_STATE => WRAP%PTR - - call ESMF_GridCompGet ( GC, GRID=esmfGrid, importState=IMPORT, & - exportState=EXPORT, clock=clock, rc=RC) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - call ESMF_AttributeGet(esmfGrid, value=KM, name="GRID_LM", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! Get the coordinates of the local grid - call ESMF_GridGetCoord(esmfGrid, 1, farrayPtr=LONSR8, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_GridGetCoord(esmfGrid, 2, farrayPtr=LATSR8, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - allocate(LONS(size(LONSR8,1),size(LONSR8,2))) - allocate(LATS(size(LATSR8,1),size(LATSR8,2))) - LONS = LONSR8 - LATS = LATSR8 - - ! Associate the Internal State fields with our legacy state - ! --------------------------------------------------------- - ! call MAPL_Get ( ggSTATE, INTERNALSPEC=InternalSpec, & - ! INTERNAL_ESMF_STATE=internal, & - ! LM = KM, lats = LATS, lons = LONS, RC=RC ) - ! VERIFY_(RC) - - ! How do I find out KM that is defined in GEOSCTM.rc, the config for ctm component? - ! defined it as an attribute to the grid - KS = 1 - KE = KM - - IS = lbound(LONS,1) - IE = ubound(LONS,1) - JS = lbound(LONS,2) - JE = ubound(LONS,2) - - !print *, 'Local grid dimension:', IS, IE, JS, JE, KS, KE - - if (do_AdvColdStart) then - ! Get AKs and BKs for vertical grid - !---------------------------------- - AllOCATE( AK(0:KM) ,stat=STATUS ) - VERIFY_(STATUS) - AllOCATE( BK(0:KM) ,stat=STATUS ) - VERIFY_(STATUS) - - call set_eta(KM,LS,PTOP,PINT,AK,BK) - rot_ang = 0 - end if - - nSpc = size(pTracers_STATE%tr(:)) - - ! Consistency Checks - !------------------- - ASSERT_ ( size(InternalSpec) == nSpc ) - - do ic = 1, size(InternalSpec) - call MAPL_VarSpecGet ( InternalSpec(ic), & - SHORT_NAME = short_name, & - RC=RC ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! Should I get it from the export state???? - call ESMF_StateGet(EXPORT, short_name, field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! Get the pointer from the field - call ESMF_FieldGet(field, farrayptr = pTracers_STATE%tr(ic)%pArray3D, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - !CALL MAPL_GetPointer ( internal, & - ! NAME = short_name, & - ! ptr = pTracers_STATE%tr(ic)%pArray3D, & - ! rc = RC ) - !VERIFY_(RC) - - ! Determine the concentrations of idealized tracers - !-------------------------------------------------- - if (do_AdvColdStart) then - if (TRIM(short_name) == 'Q00') then - do k=KS,KE - do j=JS,JE - do i=IS,IE - pTracers_STATE%tr(ic)%pArray3D(i,j,k) = 0.0 - enddo - enddo - enddo - elseif (TRIM(short_name) == 'Q01') then - do k=KS,KE - eta = 0.5*( (AK(k-1)+AK(k))/1.e5 + BK(k-1)+BK(k) ) - do j=JS,JE - do i=IS,IE - LONc = LONS(i,j) - LATc = LATS(i,j) - dummy_1 = tracer_q1_q2(LONc,LATc,eta,rot_ang,r0_6) - pTracers_STATE%tr(ic)%pArray3D(i,j,k) = dummy_1 - enddo - enddo - enddo - elseif (TRIM(short_name) == 'Q02') then - do k=KS,KE - eta = 0.5*( (AK(k-1)+AK(k))/1.e5 + BK(k-1)+BK(k) ) - do j=JS,JE - do i=IS,IE - LONc = LONS(i,j) - LATc = LATS(i,j) - dummy_1 = tracer_q1_q2(LONc,LATc,eta,rot_ang,r1_0) - pTracers_STATE%tr(ic)%pArray3D(i,j,k) = dummy_1 - enddo - enddo - enddo - elseif (TRIM(short_name) == 'Q03') then - do k=KS,KE - eta = 0.5*( (AK(k-1)+AK(k))/1.e5 + BK(k-1)+BK(k) ) - do j=JS,JE - do i=IS,IE - LONc = LONS(i,j) - LATc = LATS(i,j) - dummy_1 = tracer_q3(LONc,LATc,eta,rot_ang) - pTracers_STATE%tr(ic)%pArray3D(i,j,k) = dummy_1 - enddo - enddo - enddo - elseif (TRIM(short_name) == 'Q04') then - pTracers_STATE%tr(ic)%pArray3D(:,:,:) = 1.0_REAL4 - end if - end if - - end do - - if (do_AdvColdStart) DEALLOCATE(AK, BK) - deallocate(LONS, LATS) - - km = size(pTracers_STATE%tr(1)%pArray3D, 3) - - !call extract_ ( GC, clock, nymd, nhms, cdt, rc ) - - -#ifdef PRINT_STATES - ! Print what my states are - !------------------------- - if ( MAPL_am_I_root() ) then - print *, trim(Iam)//": IMPORT State" - call ESMF_StatePrint ( IMPORT) -! print *, trim(Iam)//": INTERNAL State" -! call ESMF_StatePrint ( WRAP ) - print *, trim(Iam)//": EXPORT State" - call ESMF_StatePrint ( EXPORT ) - end if -#endif - - - ! indicate that data initialization is complete (breaking out of init-loop) - call NUOPC_CompAttributeSet(GC, & - name="InitializeDataComplete", value="true", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! must explicitly set time stamp on all export fields - call NUOPC_SetTimestamp(EXPORT, clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - !call MAPL_TimerOff (ggState,"INITIALIZE" ) - !call MAPL_TimerOff (ggState,"TOTAL" ) - - ! All Done - !--------- - - RETURN_(ESMF_SUCCESS) - - end subroutine initTracer - - -!EOC -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!BOP -! -! !IROUTINE: RUN -! -! !INTERFACE: -! - subroutine ModelAdvance( GC, RC ) -! -! !INPUT/OUTPUT PARAMETERS: - type(ESMF_GridComp) :: GC ! Gridded component -! -! !OUTPUT PARAMETERS: - integer, intent( out) :: RC ! Error code -! -! !DESCRIPTION: Does nothing for now. -! \newline -! -!EOP -!============================================================================= -!BOC -! -! ErrLog Variables - character(len=ESMF_MAXSTR) :: IAm = "ModelAdvance" - integer :: STATUS - character(len=ESMF_MAXSTR) :: COMP_NAME -! Local derived types - type (MAPL_MetaComp), pointer :: ggState - type(MAPL_VarSpec), pointer :: InternalSpec(:) - type (ESMF_State) :: internal - character(len=ESMF_MAXSTR) :: short_name - type (T_pTracers_STATE), pointer :: pTracers_STATE - type (pTracers_wrap) :: WRAP - type(ESMF_Grid) :: esmfGrid - integer :: AGCM_YY, AGCM_MM, AGCM_DD, AGCM_H, AGCM_M, AGCM_S - type(ESMF_Time) :: CurrTime - -! Imports - real, pointer, dimension(:,:,:) :: pe => null() - real, pointer, dimension(:,:) :: gridCellArea => null() - - real, pointer, dimension(:,:,:) :: dp => null() - real , allocatable :: qsum(:,:) - real*8 :: totMass - - REAL, POINTER :: PLE(:,:,:) => null() - REAL, POINTER :: cellArea(:,:) => null() - integer :: DIMS(3), im, jm, km, k, nSpc, ic - integer :: is,js,ie,je - - ! local variables - type(ESMF_Clock) :: clock - type(ESMF_State) :: IMPORT, EXPORT - - ! query the Component for its clock, importState and exportState - call NUOPC_ModelGet(GC, modelClock=clock, importState=IMPORT, & - exportState=EXPORT, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! Get the target components name and set-up traceback handle. - ! ----------------------------------------------------------- - - call ESMF_GridCompGet( GC, name=COMP_NAME, GRID=esmfGrid, RC=STATUS ) - VERIFY_(STATUS) - Iam = trim(COMP_NAME)//"::Run_" - - ! Retrieve the pointer to the generic state - !------------------------------------------ - -#if 1 - !call MAPL_GetObjectFromGC ( GC, ggState, RC=STATUS) - !VERIFY_(STATUS) - - ! Start timer - !------------ - - !call MAPL_TimerOn (ggState,"TOTAL") - !call MAPL_TimerOn (ggState,"RUN" ) - - ! Retrieve the pointer to the private internal state - !--------------------------------------------------- - - call ESMF_UserCompGetInternalState(GC, 'PTRACERS', WRAP, STATUS) - VERIFY_(STATUS) - - pTracers_STATE => WRAP%PTR - - ! Associate the Internal State fields with our legacy state - ! --------------------------------------------------------- - !call MAPL_Get ( ggSTATE, INTERNALSPEC=InternalSpec, & - ! INTERNAL_ESMF_STATE=internal, RC=STATUS ) - !VERIFY_(STATUS) - - - nSpc = size(pTracers_STATE%tr(:)) - - ! Consistency Checks - !------------------- - ! ASSERT_ ( size(InternalSpec) == nSpc ) - - IF (do_ComputeTracerMass) THEN - CALL MAPL_GetPointer(IMPORT, PLE, 'PLE', ALLOC = .TRUE., RC=STATUS) - VERIFY_(STATUS) - - call MAPL_GetPointer(IMPORT, cellArea, 'AREA', ALLOC=.true., rc=status) - VERIFY_(STATUS) - - call ESMF_ClockGet ( clock, CurrTime=currTime, rc=status ) - VERIFY_(STATUS) - call ESMF_TimeGet ( CurrTime, YY = AGCM_YY, & - MM = AGCM_MM, & - DD = AGCM_DD, & - H = AGCM_H , & - M = AGCM_M , & - S = AGCM_S, rc=status ) - VERIFY_(STATUS) - - - if ( MAPL_am_I_root() ) then - write(6,1000) AGCM_YY,AGCM_MM,AGCM_DD,AGCM_H,AGCM_M,AGCM_S - 1000 format(1x,'AGCM Date: ',i4.4,'/',i2.2,'/',i2.2,2x,'Time: ',i2.2,':',i2.2,':',i2.2) - - PRINT*, "------------------------------------------------" - PRINT*, "------ Compute the mass of each tracer ------" - PRINT*, "------------------------------------------------" - end if - do ic = 1, nSpc - call computeTracerMass(pTracers_STATE%tr(ic)%pArray3D, & - TRIM(pTracers_STATE%vname(ic)), & - esmfGrid, cellArea, PLE) - end do - if ( MAPL_am_I_root() ) then - PRINT*, "------------------------------------------------" - end if - END IF - - !call MAPL_TimerOff (ggState,"RUN" ) - !call MAPL_TimerOff (ggState,"TOTAL" ) - -#endif - RETURN_(ESMF_SUCCESS) - - end subroutine modelAdvance -!EOC -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: Finalize_ -! -! !INTERFACE: -! - subroutine Finalize_ ( GC, IMPORT, EXPORT, CLOCK, RC ) -! -! !INPUT/OUTPUT PARAMETERS: - type(ESMF_GridComp), intent(inout) :: GC ! Gridded component - type(ESMF_State), intent(inout) :: IMPORT ! Import state - type(ESMF_State), intent(inout) :: EXPORT ! Export state - type(ESMF_Clock), intent(inout) :: CLOCK ! The clock -! -! !OUTPUT PARAMETERS: - integer, optional, intent( out) :: RC ! Error code -! -! !DESCRIPTION: This is a simple ESMF wrapper. -! -! !REVISION HISTORY: -! -!EOP -!------------------------------------------------------------------------- -!BOC -! - -! ErrLog Variables -! ---------------- - character(len=ESMF_MAXSTR) :: IAm = 'Finalize_' - integer :: STATUS - character(len=ESMF_MAXSTR) :: COMP_NAME - - integer :: nymd, nhms ! time - real :: cdt ! chemistry timestep (secs) - type(MAPL_MetaComp), pointer :: ggState ! GEOS Generic State - type (T_pTracers_STATE), pointer :: pTracers_STATE - type (pTracers_wrap) :: WRAP - ! Get my name and set-up traceback handle - ! --------------------------------------- - call ESMF_GridCompGet( GC, NAME=COMP_NAME, RC=STATUS ) - VERIFY_(STATUS) - Iam = trim(COMP_NAME) // '::' // 'Finalize_' - - ! Get my internal MAPL_Generic state - ! ----------------------------------- - call MAPL_GetObjectFromGC ( GC, ggState, __RC__) - - call MAPL_TimerON(ggState, 'TOTAL') - call MAPL_TimerON(ggState, 'FINALIZE') - - ! Retrieve the pointer to the private internal state - !--------------------------------------------------- - - call ESMF_UserCompGetInternalState(GC, 'PTRACERS', WRAP, STATUS) - VERIFY_(STATUS) - - pTracers_STATE => WRAP%PTR - - ! Destroy Legacy state - ! -------------------- - deallocate ( pTracers_STATE%vname, pTracers_STATE%vunits, & - pTracers_STATE%vtitle, pTracers_STATE%tr, stat = STATUS ) - VERIFY_(STATUS) - - call MAPL_TimerOff(ggState, 'FINALIZE') - call MAPL_TimerOff(ggState, 'TOTAL') - - ! Finalize GEOS Generic - ! --------------------- - call MAPL_GenericFinalize ( gc, IMPORT, EXPORT, clock, RC=STATUS ) - VERIFY_(STATUS) - - RETURN_(ESMF_SUCCESS) - - end subroutine Finalize_ -!EOC -!--------------------------------------------------------------------------- -!!BOP - subroutine extract_ ( gc, clock, nymd, nhms, cdt, & - rc, state ) -!! -!! !INPUT PARAMETERS: - type(ESMF_Clock), intent(in) :: clock -!! -!! !OUTPUT PARAMETERS: - integer, intent(out) :: nymd, nhms - real, intent(out) :: cdt - integer, intent(out) :: rc -!! -!! !INPUT/OUTPUT PARAMETERS: - type(ESMF_GridComp), intent(INout) :: gc - type(T_pTracers_STATE), pointer, optional :: state -!! -!! !LOCAL VARIABLES: - type(MAPL_MetaComp), pointer :: ggState - type(T_pTracers_STATE), pointer :: myState - character(len=ESMF_MAXSTR) :: IAm - integer :: STATUS - character(len=ESMF_MAXSTR) :: COMP_NAME - type(ESMF_Time) :: TIME - type(ESMF_Config) :: CF - type(pTracers_Wrap) :: wrap - integer :: IYR, IMM, IDD, IHR, IMN, ISC - integer :: ic -!! -!!EOP -!!--------------------------------------------------------------------------- -!!BOC - ! Get my name and set-up traceback handle - ! --------------------------------------- - call ESMF_GridCompGet( GC, NAME=COMP_NAME, RC=STATUS ) - VERIFY_(STATUS) - Iam = trim(COMP_NAME) // '::' // 'extract_' - - rc = 0 - - ! Get my internal MAPL_Generic state - ! ----------------------------------- - call MAPL_GetObjectFromGC ( GC, ggState, __RC__ ) - - ! Get my internal state - ! --------------------- - call ESMF_UserCompGetInternalState(gc, 'PTRACERS', WRAP, STATUS) - VERIFY_(STATUS) - - myState => wrap%ptr - - if ( present(state) ) then - state => wrap%ptr - end if - -! nSpc = size(myState%tr(:)) -! if (nSpc > 0) then -! do ic = 1, nSpc -! PRINT*, ic, TRIM(myState%vname(ic)), sum(myState%tr(ic)%pArray3D) -! end do -! end if - - ! This is likely to be allocated during initialize only - ! ----------------------------------------------------- - - ! Get the configuration - ! --------------------- - call ESMF_GridCompGet ( GC, CONFIG = CF, RC=STATUS ) - VERIFY_(STATUS) - - ! Get time step - ! ------------- - call ESMF_AttributeGet ( GC, "RUN_DT:", cdt, RC=STATUS ) - VERIFY_(STATUS) - - ! Need code to extract nymd(20050205), nhms(120000) from clock - ! ------------------------------------------ - - call ESMF_ClockGet(CLOCK,currTIME=TIME,rc=STATUS) - VERIFY_(STATUS) - - call ESMF_TimeGet(TIME ,YY=IYR, MM=IMM, DD=IDD, H=IHR, M=IMN, S=ISC, rc=STATUS) - VERIFY_(STATUS) - - call MAPL_PackTime(NYMD,IYR,IMM,IDD) - call MAPL_PackTime(NHMS,IHR,IMN,ISC) - - RETURN_(ESMF_SUCCESS) - - end subroutine extract_ -!!EOC -!--------------------------------------------------------------------------- -!BOP - subroutine computeTracerMass (tracerArray, tracerName, esmfGrid, & - gridCellArea, PLE) - -! -! !INPUT PARAMETERS: - REAL , intent(in) :: tracerArray(:,:,:) - REAL , intent(in) :: PLE(:,:,:) - REAL , intent(in) :: gridCellArea(:,:) - character(len=*) :: tracerName - type (ESMF_GRID) :: esmfGrid -! -! !LOCAL VARIABLES: - INTEGER :: im, jm, lm, k, STATUS, RC - real, pointer, dimension(:,:,:) :: dp => null() - real , allocatable :: qsum(:,:) - real*8 :: totMass - character(len=ESMF_MAXSTR) :: Iam = "computeTracerMass" -!EOP -!------------------------------------------------------------------------------ -!BOC - im = size(tracerArray, 1) - jm = size(tracerArray, 2) - lm = size(tracerArray, 3) - - allocate( dp(im,jm,lm) ) ! pressure thickness - dp(:,:,1:lm) = PLE(:,:,2:lm+1)-PLE(:,:,1:lm) - - allocate( qsum(im,jm) ) - qsum = 0.0 - do k = 1, lm - qsum(:,:) = qsum(:,:) + tracerArray(:,:,k)*dp(:,:,k) - end do - - call MAPL_AreaMean( totMass, qsum, gridCellArea, esmfGrid, rc=STATUS ) - VERIFY_(STATUS) - - IF (MAPL_AM_I_ROOT()) then - PRINT *, TRIM(tracerName), totMass - ENDIF - - deallocate(qsum, dp) - - return - - end subroutine computeTracerMass -!EOC -!------------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: constructListNames -! -! !INTERFACE: - - subroutine constructListNames(tracerNames, names) -! - implicit none -! -! OUTPUT PARAMETERS: - character (len=*), intent( out) :: tracerNames(*) -! -! !INPUT/OUTPUT PARAMETERS: - character (len=*), intent(inout) :: names -! -! !DESCRIPTION: -! This routine takes the long string "names" (containing a list -! of tracers, separated by commas) and construct a new list -! where each tracer name is a string. -! -! !LOCAL VARIABLES: - integer :: loc, namesLen, i -! -! !AUTHOR: -! Jules Kouatchou -! -! !REVISION HISTORY: -! Initial code. -! -!EOP -!------------------------------------------------------------------------- -!BOC - - i = 1 - loc = index(names, ',') - if (loc == 0) then - tracerNames(i) = names - tracerNames(i) = adjustl(tracerNames(i)) - tracerNames(i) = trim (tracerNames(i)) - else - do while(loc > 0) - tracerNames(i) = names(1:loc-1) - tracerNames(i) = adjustl(tracerNames(i)) - tracerNames(i) = trim (tracerNames(i)) - namesLen = len(names) - names = names(loc+1:namesLen) - i = i + 1 - loc = index(names, ',') - end do - tracerNames(i) = names - tracerNames(i) = adjustl(tracerNames(i)) - tracerNames(i) = trim (tracerNames(i)) - end if - - return - - end subroutine constructListNames -!EOC -!------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: rcEsmfReadTable2String -! -! !INTERFACE: -! - subroutine rcEsmfReadTable2String(config, value, label, rc) -! - implicit none - - INTEGER, PARAMETER :: MAX_STRING_LENGTH = 128*50 -! -! !INPUT PARAMETERS: - character(len=*), intent(in) :: label -! -! !OUTPUT PARAMETERS: - character(len=MAX_STRING_LENGTH), intent(out) :: value - integer, optional, intent(out) :: rc -! -! !INPUT/OUTPUT PARAMETERS: - type(ESMF_Config), intent(inOut) :: config -! -! !DESCRIPTION: -! Reads in a table of words from a resource file. -! -! !LOCAL VARIABLES: - integer :: STATUS - logical :: firstIter, endTable - character(len=1) :: cValue - character(len=ESMF_MAXSTR) :: tempWord - character(len=ESMF_MAXSTR), parameter :: IAm = "rcEsmfReadTable2String" -!EOP -!------------------------------------------------------------------------------ -!BOC - firstIter = .true. - - call ESMF_ConfigFindLabel(config, label=label, rc=STATUS ) - - value = '' - - if (STATUS == ESMF_SUCCESS) then - call ESMF_ConfigNextLine (config, tableEnd=endTable, rc=STATUS ) - VERIFY_(STATUS) - - do while (.not. endTable) - call ESMF_ConfigGetAttribute(config, tempWord, rc=STATUS ) - VERIFY_(STATUS) - - call reconstructPhrase(tempWord) - - if (firstIter) then - firstIter = .false. - value = trim(tempWord) - else - value = trim(value)//', '//trim(tempWord) - end if - - call ESMF_ConfigNextLine (config, tableEnd=endTable, rc=STATUS ) - VERIFY_(STATUS) - end do - end if - - if (present(rc)) rc = STATUS - - return - - end subroutine rcEsmfReadTable2String -!EOC -!------------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: reconstructPhrase -! -! !INTERFACE: - - subroutine reconstructPhrase(phrase) -! - implicit none -! -! !INPUT/OUTPUT PARAMETERS: - character (len=*), intent(inOut) :: phrase -! -! !DESCRIPTION: -! Takes a long string and reconstruct the phrase/name it represents. -! -! !LOCAL VARIABLES: - integer :: loc, namesLen - logical :: first - character (len=ESMF_MAXSTR) :: names -! -! !AUTHOR: -! Jules Kouatchou -! -! !REVISION HISTORY: -! Initial code. -! -!EOP -!------------------------------------------------------------------------- -!BOC - first = .true. - names = phrase - - loc = index(names, '*') - if (loc == 0) then - phrase = names - phrase = adjustl(phrase) - phrase = trim (phrase) - else - do while(loc > 0) - if (first) then - first = .false. - phrase = names(1:loc-1) - else - phrase = trim(phrase)//' '//names(1:loc-1) - end if - - phrase = adjustl(phrase) - phrase = trim (phrase) - namesLen = len(names) - names = names(loc+2:namesLen) - loc = index(names, '*') - end do - phrase = trim(phrase)//' '//names - phrase = adjustl(phrase) - phrase = trim (phrase) - end if - - return - - end subroutine reconstructPhrase - -!EOC -!------------------------------------------------------------------------- - - end module PTRACER From a8e4029673e5eedb4ecf841a51a1cb15cedfb118 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Mon, 5 Apr 2021 16:11:36 -0700 Subject: [PATCH 42/68] Protos to work without ESMF_NETCDF present. --- AtmOcnCplListProto/esm.F90 | 5 +++++ AtmOcnTransferGridProto/atm.F90 | 16 ++++++++++++++++ AtmOcnTransferGridProto/ocn.F90 | 22 ++++++++++++++++++++++ AtmOcnTransferMeshProto/ocn.F90 | 4 ++-- 4 files changed, 45 insertions(+), 2 deletions(-) diff --git a/AtmOcnCplListProto/esm.F90 b/AtmOcnCplListProto/esm.F90 index 0cfce629..964df9b7 100644 --- a/AtmOcnCplListProto/esm.F90 +++ b/AtmOcnCplListProto/esm.F90 @@ -267,8 +267,13 @@ subroutine ModifyCplLists(driver, rc) .or. trim(cplList(j))=="air_pressure_at_sea_level") then tempString = trim(cplList(j))//":REMAPMETHOD=redist" else +#ifdef ESMF_NETCDF tempString = trim(cplList(j))//":REMAPMETHOD=bilinear"//& ":SrcTermProcessing=1:DUMPWEIGHTS=true:TermOrder=SrcSeq" +#else + tempString = trim(cplList(j))//":REMAPMETHOD=bilinear"//& + ":SrcTermProcessing=1:TermOrder=SrcSeq" +#endif endif cplList(j) = trim(tempString) write (msg,*) "Modified: "//trim(cplList(j)) diff --git a/AtmOcnTransferGridProto/atm.F90 b/AtmOcnTransferGridProto/atm.F90 index 1aeba592..1b91d4c4 100644 --- a/AtmOcnTransferGridProto/atm.F90 +++ b/AtmOcnTransferGridProto/atm.F90 @@ -1046,21 +1046,25 @@ subroutine RealizeAccepted(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out +#ifdef ESMF_NETCDF call ESMF_ArrayWrite(array, "array_ATM-grid_center_coord1.nc", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out +#endif call ESMF_GridGetCoord(grid, coordDim=2, array=array, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out +#ifdef ESMF_NETCDF call ESMF_ArrayWrite(array, "array_ATM-grid_center_coord2.nc", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out +#endif #ifdef TEST_GRID_EDGE_WIDTHS ! corner: call ESMF_GridGetCoord(grid, staggerloc=ESMF_STAGGERLOC_CORNER, & @@ -1069,22 +1073,26 @@ subroutine RealizeAccepted(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out +#ifdef ESMF_NETCDF call ESMF_ArrayWrite(array, "array_ATM-grid_corner_coord1.nc", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out +#endif call ESMF_GridGetCoord(grid, staggerloc=ESMF_STAGGERLOC_CORNER, & coordDim=2, array=array, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out +#ifdef ESMF_NETCDF call ESMF_ArrayWrite(array, "array_ATM-grid_corner_coord2.nc", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out +#endif ! edge1: call ESMF_GridGetCoord(grid, staggerloc=ESMF_STAGGERLOC_EDGE1, & coordDim=1, array=array, rc=rc) @@ -1092,22 +1100,26 @@ subroutine RealizeAccepted(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out +#ifdef ESMF_NETCDF call ESMF_ArrayWrite(array, "array_ATM-grid_edge1_coord1.nc", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out +#endif call ESMF_GridGetCoord(grid, staggerloc=ESMF_STAGGERLOC_EDGE1, & coordDim=2, array=array, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out +#ifdef ESMF_NETCDF call ESMF_ArrayWrite(array, "array_ATM-grid_edge1_coord2.nc", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out +#endif ! edge2: call ESMF_GridGetCoord(grid, staggerloc=ESMF_STAGGERLOC_EDGE2, & coordDim=1, array=array, rc=rc) @@ -1115,17 +1127,20 @@ subroutine RealizeAccepted(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out +#ifdef ESMF_NETCDF call ESMF_ArrayWrite(array, "array_ATM-grid_edge2_coord1.nc", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out +#endif call ESMF_GridGetCoord(grid, staggerloc=ESMF_STAGGERLOC_EDGE2, & coordDim=2, array=array, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out +#ifdef ESMF_NETCDF call ESMF_ArrayWrite(array, "array_ATM-grid_edge2_coord2.nc", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -1133,6 +1148,7 @@ subroutine RealizeAccepted(model, rc) return ! bail out #endif #endif +#endif #if 1 ! write out the Grid into VTK file for inspection diff --git a/AtmOcnTransferGridProto/ocn.F90 b/AtmOcnTransferGridProto/ocn.F90 index cffcd676..945b9d23 100644 --- a/AtmOcnTransferGridProto/ocn.F90 +++ b/AtmOcnTransferGridProto/ocn.F90 @@ -347,21 +347,25 @@ subroutine Realize(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out +#ifdef ESMF_NETCDF call ESMF_ArrayWrite(array, "array_OCN-gridIn_center_coord1.nc", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out +#endif call ESMF_GridGetCoord(gridIn, coordDim=2, array=array, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out +#ifdef ESMF_NETCDF call ESMF_ArrayWrite(array, "array_OCN-gridIn_center_coord2.nc", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out +#endif #ifdef TEST_GRID_EDGE_WIDTHS ! corner: call ESMF_GridGetCoord(gridIn, staggerloc=ESMF_STAGGERLOC_CORNER, & @@ -370,22 +374,26 @@ subroutine Realize(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out +#ifdef ESMF_NETCDF call ESMF_ArrayWrite(array, "array_OCN-gridIn_corner_coord1.nc", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out +#endif call ESMF_GridGetCoord(gridIn, staggerloc=ESMF_STAGGERLOC_CORNER, & coordDim=2, array=array, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out +#ifdef ESMF_NETCDF call ESMF_ArrayWrite(array, "array_OCN-gridIn_corner_coord2.nc", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out +#endif ! edge1: call ESMF_GridGetCoord(gridIn, staggerloc=ESMF_STAGGERLOC_EDGE1, & coordDim=1, array=array, rc=rc) @@ -393,22 +401,26 @@ subroutine Realize(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out +#ifdef ESMF_NETCDF call ESMF_ArrayWrite(array, "array_OCN-gridIn_edge1_coord1.nc", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out +#endif call ESMF_GridGetCoord(gridIn, staggerloc=ESMF_STAGGERLOC_EDGE1, & coordDim=2, array=array, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out +#ifdef ESMF_NETCDF call ESMF_ArrayWrite(array, "array_OCN-gridIn_edge1_coord2.nc", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out +#endif ! edge2: call ESMF_GridGetCoord(gridIn, staggerloc=ESMF_STAGGERLOC_EDGE2, & coordDim=1, array=array, rc=rc) @@ -416,17 +428,20 @@ subroutine Realize(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out +#ifdef ESMF_NETCDF call ESMF_ArrayWrite(array, "array_OCN-gridIn_edge2_coord1.nc", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out +#endif call ESMF_GridGetCoord(gridIn, staggerloc=ESMF_STAGGERLOC_EDGE2, & coordDim=2, array=array, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out +#ifdef ESMF_NETCDF call ESMF_ArrayWrite(array, "array_OCN-gridIn_edge2_coord2.nc", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -434,6 +449,7 @@ subroutine Realize(model, rc) return ! bail out #endif #endif +#endif #if 1 ! write out the Grid into VTK file for inspection @@ -726,11 +742,13 @@ subroutine Realize(model, rc) return ! bail out ! write the field out to file, which will be 1d and with the arbitrary order +#ifdef ESMF_NETCDF call ESMF_FieldWrite(fieldArb, fileName="field_gridArb.nc", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out +#endif ! create an auxiliary regDecomp grid with the same index space as gridArb ! periodic along i (must set here explicitly to match the gridArb @@ -780,11 +798,13 @@ subroutine Realize(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out +#ifdef ESMF_NETCDF call ESMF_FieldWrite(fieldAux, fileName="field_gridAux.nc", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out +#endif #endif ! pull out the sst field from exportState for testing regridding to it @@ -839,12 +859,14 @@ subroutine Realize(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out +#ifdef ESMF_NETCDF call ESMFIO_Write(ioComp, "fields_ocn_init_export.nc", & (/field/), rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out +#endif #if 0 ! Currently do not destroy the ioComp here, because it will trigger ! an issue in StateReconcile(), which looks like a bug to me. diff --git a/AtmOcnTransferMeshProto/ocn.F90 b/AtmOcnTransferMeshProto/ocn.F90 index ca643640..7cb4caeb 100644 --- a/AtmOcnTransferMeshProto/ocn.F90 +++ b/AtmOcnTransferMeshProto/ocn.F90 @@ -148,7 +148,7 @@ subroutine Realize(model, rc) ! --- IMPORT ------------------------------------------------------------- #define READ_MESHIN_FROM_FILE -#ifdef READ_MESHIN_FROM_FILE +#if (defined READ_MESHIN_FROM_FILE && defined ESMF_NETCDF) ! create from file meshIn = ESMF_MeshCreate("./gx3v7_unstructured.nc", & fileformat=ESMF_FILEFORMAT_ESMFMESH, name="OCN-MeshIn", rc=rc) @@ -263,7 +263,7 @@ subroutine Realize(model, rc) ! --- EXPORT ------------------------------------------------------------- #define READ_MESHOUT_FROM_FILE -#ifdef READ_MESHOUT_FROM_FILE +#if (defined READ_MESHOUT_FROM_FILE && defined ESMF_NETCDF) ! create from file meshOut = ESMF_MeshCreate("./fv1.9x2.5_unstructured.nc", & fileformat=ESMF_FILEFORMAT_ESMFMESH, name="OCN-GridOut", rc=rc) From d251ec4b96bd60e9a009be34fc78899d8fc7624d Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Tue, 13 Apr 2021 15:01:38 -0700 Subject: [PATCH 43/68] Adjust to changed/new hints. --- SingleModelOpenMPProto/driver.F90 | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/SingleModelOpenMPProto/driver.F90 b/SingleModelOpenMPProto/driver.F90 index 0b58f118..fbd518e3 100644 --- a/SingleModelOpenMPProto/driver.F90 +++ b/SingleModelOpenMPProto/driver.F90 @@ -104,12 +104,6 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out - call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/MinStackSize", & - value=16*1024*1024, rc=rc) ! stack size no less than 16MiB - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out #if 1 call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/OpenMpHandling", & value="SET", rc=rc) @@ -126,6 +120,20 @@ subroutine SetModelServices(driver, rc) file=__FILE__)) & return ! bail out #endif +#if 0 + call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/ForceChildPthreads", & + value=.true., rc=rc) ! force child PETs to execute as Pthreads + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/PthreadMinStackSize", & + value=16*1024*1024, rc=rc) ! stack size no less than 16MiB + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out +#endif ! SetServices for MODEL component call NUOPC_DriverAddComp(driver, "MODEL", modelSS, modelSVM, info=info, & From b78d0a7a162d75f3be2626aa77ef17aa4e958122 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Tue, 13 Apr 2021 16:43:42 -0700 Subject: [PATCH 44/68] Add NUOPC resouce management testing, and explicit OpenMP testing. --- AtmOcnTransferGridProto/atm.F90 | 46 +++++++++++++++++++++++++++++- AtmOcnTransferGridProto/esm.F90 | 33 +++++++++++++--------- AtmOcnTransferGridProto/ocn.F90 | 44 +++++++++++++++++++++++++++++ AtmOcnTransferMeshProto/atm.F90 | 49 +++++++++++++++++++++++++++++++- AtmOcnTransferMeshProto/esm.F90 | 50 +++++++++++++++++++++++++++++---- AtmOcnTransferMeshProto/ocn.F90 | 49 +++++++++++++++++++++++++++++++- 6 files changed, 250 insertions(+), 21 deletions(-) diff --git a/AtmOcnTransferGridProto/atm.F90 b/AtmOcnTransferGridProto/atm.F90 index 1b91d4c4..394eeca7 100644 --- a/AtmOcnTransferGridProto/atm.F90 +++ b/AtmOcnTransferGridProto/atm.F90 @@ -28,7 +28,7 @@ module ATM private public SetVM, SetServices - + !----------------------------------------------------------------------------- contains !----------------------------------------------------------------------------- @@ -1381,6 +1381,7 @@ subroutine DataInitialize(model, rc) !----------------------------------------------------------------------------- subroutine Advance(model, rc) +!$ use omp_lib type(ESMF_GridComp) :: model integer, intent(out) :: rc @@ -1388,6 +1389,8 @@ subroutine Advance(model, rc) type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState integer, save :: slice=1 + type(ESMF_VM) :: vm + integer :: currentSsiPe, i, tid, unit, localPet character(len=160) :: msgString rc = ESMF_SUCCESS @@ -1399,6 +1402,47 @@ subroutine Advance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out + call ESMF_GridCompGet(model, vm=vm, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_VMGet(vm, localPet=localPet, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! Now can use OpenMP for fine grained parallelism... + ! Here just write info about the PET-local OpenMP threads to Log. +!$omp parallel private(msgString, currentSsiPe) +!$omp critical +!$ call ESMF_VMGet(vm, currentSsiPe=currentSsiPe) +!$ write(msgString,'(A,I4,A,I4,A,I4,A,I4,A,I4)') & +!$ "thread_num=", omp_get_thread_num(), & +!$ " currentSsiPe=", currentSsiPe, & +!$ " num_threads=", omp_get_num_threads(), & +!$ " max_threads=", omp_get_max_threads(), & +!$ " num_procs=", omp_get_num_procs() +!$ call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) +!$omp end critical +!$omp end parallel + +#define STDOUT_off +#ifdef STDOUT + unit = 6 +#else + unit = localPet + 100 +#endif +!$omp parallel private(tid) + tid = -1 ! initialize to obvious value if building without OpenMP +!$ tid = omp_get_thread_num() +!$omp do + do i=1, 100 + write(unit,*) "ATM test write, localPet=", localPet, " tid=", tid, & + " slice=", slice, " i=", i + enddo +!$omp end parallel ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep diff --git a/AtmOcnTransferGridProto/esm.F90 b/AtmOcnTransferGridProto/esm.F90 index f2ca4706..f548c7cb 100644 --- a/AtmOcnTransferGridProto/esm.F90 +++ b/AtmOcnTransferGridProto/esm.F90 @@ -96,10 +96,24 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out + + ! get the petCount + call ESMF_GridCompGet(driver, petCount=petCount, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! split up the PETs between ATM and OCN + petCountOCN = min(2,petCount/2) ! don't give OCN more than 2 PETs + petCountATM = petCount - petCountOCN + #define MORE_THAN_ONE_PE_PER_PET_WORKING_ATM #ifdef MORE_THAN_ONE_PE_PER_PET_WORKING_ATM call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/MaxCount", value=2, & rc=rc) +! call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/ForceChildPthreads", & +! value=.true., rc=rc) #else call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/MaxCount", value=1, & rc=rc) @@ -109,24 +123,14 @@ subroutine SetModelServices(driver, rc) file=__FILE__)) & return ! bail out - ! get the petCount - call ESMF_GridCompGet(driver, petCount=petCount, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! split up the PETs between ATM and OCN - petCountOCN = min(2,petCount/2) ! don't give OCN more than 2 PETs - petCountATM = petCount - petCountOCN - ! SetServices for ATM with petList on first half of PETs allocate(petList(petCountATM)) do i=1, petCountATM petList(i) = i-1 ! PET labeling goes from 0 to petCount-1 enddo call NUOPC_DriverAddComp(driver, "ATM", atmSS, atmSVM, info=info, & - petList=petList, comp=child, rc=rc) + petList=petList, & + comp=child, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -142,6 +146,8 @@ subroutine SetModelServices(driver, rc) #ifdef MORE_THAN_ONE_PE_PER_PET_WORKING_OCN call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/MaxCount", value=2, & rc=rc) +! call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/ForceChildPthreads", & +! value=.false., rc=rc) #else call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/MaxCount", value=1, & rc=rc) @@ -157,7 +163,8 @@ subroutine SetModelServices(driver, rc) petList(i) = petCountATM + i-1 ! PET labeling goes from 0 to petCount-1 enddo call NUOPC_DriverAddComp(driver, "OCN", ocnSS, ocnSVM, info=info, & - petList=petList, comp=child, rc=rc) + petList=petList, & + comp=child, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & diff --git a/AtmOcnTransferGridProto/ocn.F90 b/AtmOcnTransferGridProto/ocn.F90 index 945b9d23..b2d5605b 100644 --- a/AtmOcnTransferGridProto/ocn.F90 +++ b/AtmOcnTransferGridProto/ocn.F90 @@ -949,6 +949,7 @@ subroutine SetClock(model, rc) !----------------------------------------------------------------------------- subroutine Advance(model, rc) +!$ use omp_lib type(ESMF_GridComp) :: model integer, intent(out) :: rc @@ -960,6 +961,8 @@ subroutine Advance(model, rc) type(ESMF_Time) :: currTime type(ESMF_TimeInterval) :: timeStep integer, save :: slice=1 + type(ESMF_VM) :: vm + integer :: currentSsiPe, i, tid, unit, localPet character(len=160) :: msgString character(80) :: fieldName, gridName @@ -972,6 +975,47 @@ subroutine Advance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out + call ESMF_GridCompGet(model, vm=vm, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_VMGet(vm, localPet=localPet, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! Now can use OpenMP for fine grained parallelism... + ! Here just write info about the PET-local OpenMP threads to Log. +!$omp parallel private(msgString, currentSsiPe) +!$omp critical +!$ call ESMF_VMGet(vm, currentSsiPe=currentSsiPe) +!$ write(msgString,'(A,I4,A,I4,A,I4,A,I4,A,I4)') & +!$ "thread_num=", omp_get_thread_num(), & +!$ " currentSsiPe=", currentSsiPe, & +!$ " num_threads=", omp_get_num_threads(), & +!$ " max_threads=", omp_get_max_threads(), & +!$ " num_procs=", omp_get_num_procs() +!$ call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) +!$omp end critical +!$omp end parallel + +#define STDOUT_off +#ifdef STDOUT + unit = 6 +#else + unit = localPet + 200 +#endif +!$omp parallel private(tid) + tid = -1 ! initialize to obvious value if building without OpenMP +!$ tid = omp_get_thread_num() +!$omp do + do i=1, 100 + write(unit,*) "OCN test write, localPet=", localPet, " tid=", tid, & + " slice=", slice, " i=", i + enddo +!$omp end parallel ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep diff --git a/AtmOcnTransferMeshProto/atm.F90 b/AtmOcnTransferMeshProto/atm.F90 index aceb506b..99f44b24 100644 --- a/AtmOcnTransferMeshProto/atm.F90 +++ b/AtmOcnTransferMeshProto/atm.F90 @@ -23,7 +23,7 @@ module ATM private - public SetServices + public SetVM, SetServices !----------------------------------------------------------------------------- contains @@ -805,12 +805,16 @@ subroutine DataInitialize(model, rc) !----------------------------------------------------------------------------- subroutine Advance(model, rc) +!$ use omp_lib type(ESMF_GridComp) :: model integer, intent(out) :: rc ! local variables type(ESMF_Clock) :: clock type(ESMF_State) :: importState, exportState + integer, save :: slice=1 + type(ESMF_VM) :: vm + integer :: currentSsiPe, i, tid, unit, localPet character(len=160) :: msgString rc = ESMF_SUCCESS @@ -822,6 +826,47 @@ subroutine Advance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out + call ESMF_GridCompGet(model, vm=vm, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_VMGet(vm, localPet=localPet, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! Now can use OpenMP for fine grained parallelism... + ! Here just write info about the PET-local OpenMP threads to Log. +!$omp parallel private(msgString, currentSsiPe) +!$omp critical +!$ call ESMF_VMGet(vm, currentSsiPe=currentSsiPe) +!$ write(msgString,'(A,I4,A,I4,A,I4,A,I4,A,I4)') & +!$ "thread_num=", omp_get_thread_num(), & +!$ " currentSsiPe=", currentSsiPe, & +!$ " num_threads=", omp_get_num_threads(), & +!$ " max_threads=", omp_get_max_threads(), & +!$ " num_procs=", omp_get_num_procs() +!$ call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) +!$omp end critical +!$omp end parallel + +#define STDOUT_off +#ifdef STDOUT + unit = 6 +#else + unit = localPet + 100 +#endif +!$omp parallel private(tid) + tid = -1 ! initialize to obvious value if building without OpenMP +!$ tid = omp_get_thread_num() +!$omp do + do i=1, 100 + write(unit,*) "ATM test write, localPet=", localPet, " tid=", tid, & + " slice=", slice, " i=", i + enddo +!$omp end parallel ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep @@ -854,6 +899,8 @@ subroutine Advance(model, rc) file=__FILE__)) & return ! bail out + slice = slice+1 + end subroutine !----------------------------------------------------------------------------- diff --git a/AtmOcnTransferMeshProto/esm.F90 b/AtmOcnTransferMeshProto/esm.F90 index 2332fceb..4dfbc8df 100644 --- a/AtmOcnTransferMeshProto/esm.F90 +++ b/AtmOcnTransferMeshProto/esm.F90 @@ -19,8 +19,8 @@ module ESM use NUOPC_Driver, & driverSS => SetServices - use ATM, only: atmSS => SetServices - use OCN, only: ocnSS => SetServices + use ATM, only: atmSVM => SetVM, atmSS => SetServices + use OCN, only: ocnSVM => SetVM, ocnSS => SetServices use NUOPC_Connector, only: cplSS => SetServices @@ -86,11 +86,19 @@ subroutine SetModelServices(driver, rc) integer, allocatable :: petList(:) type(ESMF_GridComp) :: child type(ESMF_CplComp) :: conn + type(ESMF_Info) :: info integer :: verbosity character(len=10) :: attrStr rc = ESMF_SUCCESS + ! Create and set the info object that is used to pass hints into methods + info = ESMF_InfoCreate(rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! get the petCount call ESMF_GridCompGet(driver, petCount=petCount, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -102,12 +110,28 @@ subroutine SetModelServices(driver, rc) petCountOCN = min(2,petCount/2) ! don't give OCN more than 2 PETs petCountATM = petCount - petCountOCN - ! SetServices for ATM with petList on first half of PETs +#define MORE_THAN_ONE_PE_PER_PET_WORKING_ATM +#ifdef MORE_THAN_ONE_PE_PER_PET_WORKING_ATM + call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/MaxCount", value=4, & + rc=rc) +! call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/ForceChildPthreads", & +! value=.true., rc=rc) +#else + call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/MaxCount", value=1, & + rc=rc) +#endif + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! SetServices for ATM with petList on first half of PETs allocate(petList(petCountATM)) do i=1, petCountATM petList(i) = i-1 ! PET labeling goes from 0 to petCount-1 enddo - call NUOPC_DriverAddComp(driver, "ATM", atmSS, petList=petList, & + call NUOPC_DriverAddComp(driver, "ATM", atmSS, atmSVM, info=info, & + petList=petList, & comp=child, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -123,12 +147,28 @@ subroutine SetModelServices(driver, rc) file=__FILE__)) & return ! bail out +#define MORE_THAN_ONE_PE_PER_PET_WORKING_OCN +#ifdef MORE_THAN_ONE_PE_PER_PET_WORKING_OCN + call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/MaxCount", value=2, & + rc=rc) +! call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/ForceChildPthreads", & +! value=.false., rc=rc) +#else + call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/MaxCount", value=1, & + rc=rc) +#endif + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! SetServices for OCN with petList on second half of PETs allocate(petList(petCountOCN)) do i=1, petCountOCN petList(i) = petCountATM + i-1 ! PET labeling goes from 0 to petCount-1 enddo - call NUOPC_DriverAddComp(driver, "OCN", ocnSS, petList=petList, & + call NUOPC_DriverAddComp(driver, "OCN", ocnSS, ocnSVM, info=info, & + petList=petList, & comp=child, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & diff --git a/AtmOcnTransferMeshProto/ocn.F90 b/AtmOcnTransferMeshProto/ocn.F90 index 7cb4caeb..f90d436b 100644 --- a/AtmOcnTransferMeshProto/ocn.F90 +++ b/AtmOcnTransferMeshProto/ocn.F90 @@ -23,7 +23,7 @@ module OCN private - public SetServices + public SetVM, SetServices !----------------------------------------------------------------------------- contains @@ -426,6 +426,7 @@ subroutine SetClock(model, rc) !----------------------------------------------------------------------------- subroutine Advance(model, rc) +!$ use omp_lib type(ESMF_GridComp) :: model integer, intent(out) :: rc @@ -434,6 +435,9 @@ subroutine Advance(model, rc) type(ESMF_State) :: importState, exportState type(ESMF_Time) :: currTime type(ESMF_TimeInterval) :: timeStep + integer, save :: slice=1 + type(ESMF_VM) :: vm + integer :: currentSsiPe, i, tid, unit, localPet character(len=160) :: msgString rc = ESMF_SUCCESS @@ -445,6 +449,47 @@ subroutine Advance(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out + call ESMF_GridCompGet(model, vm=vm, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_VMGet(vm, localPet=localPet, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! Now can use OpenMP for fine grained parallelism... + ! Here just write info about the PET-local OpenMP threads to Log. +!$omp parallel private(msgString, currentSsiPe) +!$omp critical +!$ call ESMF_VMGet(vm, currentSsiPe=currentSsiPe) +!$ write(msgString,'(A,I4,A,I4,A,I4,A,I4,A,I4)') & +!$ "thread_num=", omp_get_thread_num(), & +!$ " currentSsiPe=", currentSsiPe, & +!$ " num_threads=", omp_get_num_threads(), & +!$ " max_threads=", omp_get_max_threads(), & +!$ " num_procs=", omp_get_num_procs() +!$ call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) +!$omp end critical +!$omp end parallel + +#define STDOUT_off +#ifdef STDOUT + unit = 6 +#else + unit = localPet + 200 +#endif +!$omp parallel private(tid) + tid = -1 ! initialize to obvious value if building without OpenMP +!$ tid = omp_get_thread_num() +!$omp do + do i=1, 100 + write(unit,*) "OCN test write, localPet=", localPet, " tid=", tid, & + " slice=", slice, " i=", i + enddo +!$omp end parallel ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep @@ -485,6 +530,8 @@ subroutine Advance(model, rc) file=__FILE__)) & return ! bail out + slice = slice+1 + end subroutine !----------------------------------------------------------------------------- From 024fa497249701eb09dccf1345a5f6bf717a356b Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Tue, 13 Apr 2021 18:06:41 -0700 Subject: [PATCH 45/68] Set only sensible hints by default. --- SingleModelOpenMPProto/driver.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SingleModelOpenMPProto/driver.F90 b/SingleModelOpenMPProto/driver.F90 index fbd518e3..4dd12a2b 100644 --- a/SingleModelOpenMPProto/driver.F90 +++ b/SingleModelOpenMPProto/driver.F90 @@ -104,7 +104,7 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out -#if 1 +#if 0 call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/OpenMpHandling", & value="SET", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -112,7 +112,7 @@ subroutine SetModelServices(driver, rc) file=__FILE__)) & return ! bail out #endif -#if 1 +#if 0 call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/OpenMpNumThreads", & value=4, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & From 3c71ab2876e0eada4318cf08f537fbf1f70dad61 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Fri, 16 Apr 2021 10:21:34 -0700 Subject: [PATCH 46/68] Add SingleModelOpenMPUnawareProto. --- SingleModelOpenMPProto/driver.F90 | 13 +- SingleModelOpenMPUnawareProto/Makefile | 73 ++++++ SingleModelOpenMPUnawareProto/README | 45 ++++ SingleModelOpenMPUnawareProto/driver.F90 | 190 ++++++++++++++ SingleModelOpenMPUnawareProto/mainApp.F90 | 120 +++++++++ SingleModelOpenMPUnawareProto/model.F90 | 306 ++++++++++++++++++++++ testProtos.sh | 2 + 7 files changed, 741 insertions(+), 8 deletions(-) create mode 100644 SingleModelOpenMPUnawareProto/Makefile create mode 100644 SingleModelOpenMPUnawareProto/README create mode 100644 SingleModelOpenMPUnawareProto/driver.F90 create mode 100644 SingleModelOpenMPUnawareProto/mainApp.F90 create mode 100644 SingleModelOpenMPUnawareProto/model.F90 diff --git a/SingleModelOpenMPProto/driver.F90 b/SingleModelOpenMPProto/driver.F90 index 0b58f118..eb51fdcd 100644 --- a/SingleModelOpenMPProto/driver.F90 +++ b/SingleModelOpenMPProto/driver.F90 @@ -98,19 +98,16 @@ subroutine SetModelServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out +#if 1 call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/MaxCount", value=2, & rc=rc) ! expect 2 PEs per PET in the child VM if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/MinStackSize", & - value=16*1024*1024, rc=rc) ! stack size no less than 16MiB - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out -#if 1 +#endif + +#if 0 call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/OpenMpHandling", & value="SET", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -118,7 +115,7 @@ subroutine SetModelServices(driver, rc) file=__FILE__)) & return ! bail out #endif -#if 1 +#if 0 call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/OpenMpNumThreads", & value=4, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & diff --git a/SingleModelOpenMPUnawareProto/Makefile b/SingleModelOpenMPUnawareProto/Makefile new file mode 100644 index 00000000..c735ee00 --- /dev/null +++ b/SingleModelOpenMPUnawareProto/Makefile @@ -0,0 +1,73 @@ +# GNU Makefile template for user ESMF application + +################################################################################ +################################################################################ +## This Makefile must be able to find the "esmf.mk" Makefile fragment in the ## +## 'include' line below. Following the ESMF User's Guide, a complete ESMF ## +## installation should ensure that a single environment variable "ESMFMKFILE" ## +## is made available on the system. This variable should point to the ## +## "esmf.mk" file. ## +## ## +## This example Makefile uses the "ESMFMKFILE" environment variable. ## +## ## +## If you notice that this Makefile cannot find variable ESMFMKFILE then ## +## please contact the person responsible for the ESMF installation on your ## +## system. ## +## As a work-around you can simply hardcode the path to "esmf.mk" in the ## +## include line below. However, doing so will render this Makefile a lot less ## +## flexible and non-portable. ## +################################################################################ + +ifneq ($(origin ESMFMKFILE), environment) +$(error Environment variable ESMFMKFILE was not set.) +endif + +include $(ESMFMKFILE) + +################################################################################ +################################################################################ + +.SUFFIXES: .f90 .F90 .c .C + +%.o : %.f90 + $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREENOCPP) $< + +%.o : %.F90 + $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) -DESMF_VERSION_MAJOR=$(ESMF_VERSION_MAJOR) $< + +%.o : %.c + $(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< + +%.o : %.C + $(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< + + +# ----------------------------------------------------------------------------- +mainApp: mainApp.o driver.o model.o + $(ESMF_F90LINKER) $(ESMF_F90LINKOPTS) $(ESMF_F90LINKPATHS) $(ESMF_F90LINKRPATHS) -o $@ $^ $(ESMF_F90ESMFLINKLIBS) + +# module dependencies: +mainApp.o: driver.o +driver.o: model.o + +# ----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- +.PHONY: dust clean distclean info edit +dust: + rm -f PET*.ESMF_LogFile *.nc *.stdout +clean: + rm -f mainApp *.o *.mod +distclean: dust clean + +info: + @echo ================================================================== + @echo ESMFMKFILE=$(ESMFMKFILE) + @echo ================================================================== + @cat $(ESMFMKFILE) + @echo ================================================================== + +edit: + nedit mainApp.F90 driver.F90 model.F90 & + +run: + env OMP_NUM_THREADS=3 mpirun -np 4 ./mainApp diff --git a/SingleModelOpenMPUnawareProto/README b/SingleModelOpenMPUnawareProto/README new file mode 100644 index 00000000..e9fc385a --- /dev/null +++ b/SingleModelOpenMPUnawareProto/README @@ -0,0 +1,45 @@ +README for single Model OpenMP Unaware NUOPC prototype +------------------------------------------------------- + +Very simple NUOPC app with a Driver controlling a single Model component. The +model component uses OpenMP if compiled with support, but does so outside of +NUOPC control. This is called NUOPC-unaware threading or resource control. + +Description: + + A single model component driven by a single driver component. + + The driver assumes that each PET launched is a master thread for its own + OpenMP thead team. NUOPC/ESMF is unaware of the OpenMP threading inside of + the model component. The number of OpenMP threads is set via the standard + OMP_NUM_THREADS environment variable, which is set equal to 3 inside the + Makefile run target. + + The ESM driver component uses the default run sequence to drive the MODEL + component. + + No connector components are present. + + The MODEL component uses a simple two-phase initialization, + consisting of advertise and realize. + + +Build: + - Set environment variable ESMFMKFILE to point to the esmf.mk of your ESMF + installation. + - gmake + +Execution: + - Optionally set environment variable ESMF_RUNTIME_COMPLIANCECHECK to ON. + - Set OMP_NUM_THREADS if directly calling into mpirun as per below. + - mpirun -np X ./esmApp (where X is the total number of PETs, typically 4) + +Output: + - PET*.Log files containing compliance checker output if turned on. + - The prototype outputs time stepping information to stdout. + +Code structure: + - Makefile - Makefile that is based on the standard esmf.mk mechanism. + - model.F90 - The MODEL component, specializing generic NUOPC_Model. + - driver.F90 - Driver specializing NUOPC_Driver, driving the single MODEL. + - mainApp.F90 - Main application. diff --git a/SingleModelOpenMPUnawareProto/driver.F90 b/SingleModelOpenMPUnawareProto/driver.F90 new file mode 100644 index 00000000..9f58bf12 --- /dev/null +++ b/SingleModelOpenMPUnawareProto/driver.F90 @@ -0,0 +1,190 @@ +!============================================================================== +! Earth System Modeling Framework +! Copyright 2002-2021, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! NASA Goddard Space Flight Center. +! Licensed under the University of Illinois-NCSA License. +!============================================================================== + +module driver + + !----------------------------------------------------------------------------- + ! Code that specializes generic NUOPC_Driver + !----------------------------------------------------------------------------- + + use MPI + use ESMF + use NUOPC + use NUOPC_Driver, & + driverSS => SetServices + + use MODEL, only: & + modelSS => SetServices + + implicit none + + private + + ! private module data --> ONLY PARAMETERS + integer, parameter :: stepCount = 5 + real(ESMF_KIND_R8), parameter :: stepTime = 30.D0 ! step time [s] + ! should be parent step + + public SetServices + + !----------------------------------------------------------------------------- + contains + !----------------------------------------------------------------------------- + + subroutine SetServices(driver, rc) + type(ESMF_GridComp) :: driver + integer, intent(out) :: rc + + rc = ESMF_SUCCESS + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! specialize driver + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & + specRoutine=SetModelServices, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! set driver verbosity + call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + end subroutine + + !----------------------------------------------------------------------------- + + subroutine SetModelServices(driver, rc) + type(ESMF_GridComp) :: driver + integer, intent(out) :: rc + + ! local variables + type(ESMF_GridComp) :: child + type(ESMF_CplComp) :: connector + type(ESMF_Time) :: startTime + type(ESMF_Time) :: stopTime + type(ESMF_TimeInterval) :: timeStep + type(ESMF_Clock) :: internalClock + + ! - diagnostics - + type(ESMF_VM) :: vm + logical :: isFlag + character(80) :: msgString + integer :: mpiComm, size, ierr + + rc = ESMF_SUCCESS + + ! SetServices for MODEL component + call NUOPC_DriverAddComp(driver, "MODEL", modelSS, comp=child, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_CompAttributeSet(child, name="Verbosity", value="high", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! - diagnostics - + isFlag = ESMF_GridCompIsPetLocal(child, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + write(msgString,*) "GridCompIsPetLocal: ", isFlag + call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + call ESMF_GridCompGet(child, vm=vm, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + isFlag = ESMF_VMIsCreated(vm, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + write(msgString,*) "VmIsCreated: ", isFlag + call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + call ESMF_VMGet(vm, mpiCommunicator=mpiComm, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + if (mpiComm==MPI_COMM_NULL) then + write(msgString,*) "MPI_COMM_NULL" + else + call MPI_Comm_size(mpiComm, size, ierr) + write(msgString,*) "valid MPI_COMM with size=",size + endif + call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! set the driver clock + call ESMF_TimeSet(startTime, s = 0, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + + call ESMF_TimeSet(stopTime, s_r8 = stepTime * stepCount, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + + call ESMF_TimeIntervalSet(timeStep, s_r8 = stepTime, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + + internalClock = ESMF_ClockCreate(name="Driver Clock", & + timeStep=timeStep, startTime=startTime, stopTime=stopTime, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + + call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + end subroutine + + !----------------------------------------------------------------------------- + +end module diff --git a/SingleModelOpenMPUnawareProto/mainApp.F90 b/SingleModelOpenMPUnawareProto/mainApp.F90 new file mode 100644 index 00000000..eb5ee6ff --- /dev/null +++ b/SingleModelOpenMPUnawareProto/mainApp.F90 @@ -0,0 +1,120 @@ +!============================================================================== +! Earth System Modeling Framework +! Copyright 2002-2021, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! NASA Goddard Space Flight Center. +! Licensed under the University of Illinois-NCSA License. +!============================================================================== + +#define EXPLICIT_MPI_INIT + +program mainApp + + !----------------------------------------------------------------------------- + ! Generic ESMF Main + !----------------------------------------------------------------------------- + + use ESMF +#ifdef EXPLICIT_MPI_INIT + use MPI +#endif + + use driver, only: & + driver_SS => SetServices + + implicit none + + integer :: rc, userRc + type(ESMF_GridComp) :: drvComp + + ! Initialize MPI/ESMF +#ifdef EXPLICIT_MPI_INIT + ! This prototype implements ESMF-aware resource management for threading. + ! Therefore must call ESMF_InitializePreMPI() before MPI_Init*() if later is + ! called explicitly from user level! + call ESMF_InitializePreMPI(rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + call MPI_Init_thread(MPI_THREAD_MULTIPLE, userRc, rc) +#endif + call ESMF_Initialize(defaultCalkind=ESMF_CALKIND_GREGORIAN, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + + call ESMF_LogWrite("mainApp STARTING", ESMF_LOGMSG_INFO, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + + !----------------------------------------------------------------------------- + + ! -> CREATE THE DRIVER + drvComp = ESMF_GridCompCreate(name="driver", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + + ! -> SET DRIVER SERVICES + call ESMF_GridCompSetServices(drvComp, driver_SS, userRc=userRc, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + if (ESMF_LogFoundError(rcToCheck=userRc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + + ! INITIALIZE THE DRIVER + call ESMF_GridCompInitialize(drvComp, userRc=userRc, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + if (ESMF_LogFoundError(rcToCheck=userRc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + + ! RUN THE DRIVER + call ESMF_GridCompRun(drvComp, userRc=userRc, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + if (ESMF_LogFoundError(rcToCheck=userRc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + + ! FINALIZE THE DRIVER + call ESMF_GridCompFinalize(drvComp, userRc=userRc, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + if (ESMF_LogFoundError(rcToCheck=userRc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + + !----------------------------------------------------------------------------- + + call ESMF_LogWrite("mainApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + + ! Finalize ESMF + call ESMF_Finalize() + +end program diff --git a/SingleModelOpenMPUnawareProto/model.F90 b/SingleModelOpenMPUnawareProto/model.F90 new file mode 100644 index 00000000..cc49f64b --- /dev/null +++ b/SingleModelOpenMPUnawareProto/model.F90 @@ -0,0 +1,306 @@ +!============================================================================== +! Earth System Modeling Framework +! Copyright 2002-2021, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! NASA Goddard Space Flight Center. +! Licensed under the University of Illinois-NCSA License. +!============================================================================== + +module MODEL + + !----------------------------------------------------------------------------- + ! MODEL Component. + !----------------------------------------------------------------------------- + + use ESMF + use NUOPC + use NUOPC_Model, & + modelSS => SetServices + + implicit none + + private + + public SetVM, SetServices + + !----------------------------------------------------------------------------- + contains + !----------------------------------------------------------------------------- + + subroutine SetServices(model, rc) + type(ESMF_GridComp) :: model + integer, intent(out) :: rc + + rc = ESMF_SUCCESS + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_CompSpecialize(model, specLabel=label_DataInitialize, & + specRoutine=DataInitialize, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + end subroutine + + !----------------------------------------------------------------------------- + + subroutine Advertise(model, rc) + type(ESMF_GridComp) :: model + integer, intent(out) :: rc + + ! local variables + type(ESMF_State) :: importState, exportState + + rc = ESMF_SUCCESS + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! Enabeling the following macro, i.e. renaming it to WITHIMPORTFIELDS, + ! will result in a model component that advertise import Field dependencies. + ! In the single model case, where there isn't another model to satisfy these + ! dependencies, it is expected to be caught by the compatability checking. +#define WITHIMPORTFIELDS___disable +#ifdef WITHIMPORTFIELDS + ! importable field: sea_surface_temperature + call NUOPC_Advertise(importState, & + StandardName="sea_surface_temperature", name="sst", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out +#endif + + ! exportable field: air_pressure_at_sea_level + call NUOPC_Advertise(exportState, & + StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! exportable field: surface_net_downward_shortwave_flux + call NUOPC_Advertise(exportState, & + StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + end subroutine + + !----------------------------------------------------------------------------- + + subroutine Realize(model, rc) + type(ESMF_GridComp) :: model + integer, intent(out) :: rc + + ! local variables + type(ESMF_State) :: importState, exportState + type(ESMF_Field) :: field + type(ESMF_Grid) :: gridIn + type(ESMF_Grid) :: gridOut + + rc = ESMF_SUCCESS + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! create a Grid object for Fields + gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/10, 100/), & + minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & + maxCornerCoord=(/100._ESMF_KIND_R8, 200._ESMF_KIND_R8/), & + coordSys=ESMF_COORDSYS_CART, staggerLocList=(/ESMF_STAGGERLOC_CENTER/), & + rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + gridOut = gridIn ! for now out same as in + +#ifdef WITHIMPORTFIELDS + ! importable field: sea_surface_temperature + field = ESMF_FieldCreate(name="sst", grid=gridIn, & + typekind=ESMF_TYPEKIND_R8, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_Realize(importState, field=field, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out +#endif + + ! exportable field: air_pressure_at_sea_level + field = ESMF_FieldCreate(name="pmsl", grid=gridOut, & + typekind=ESMF_TYPEKIND_R8, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_Realize(exportState, field=field, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! exportable field: surface_net_downward_shortwave_flux + field = ESMF_FieldCreate(name="rsns", grid=gridOut, & + typekind=ESMF_TYPEKIND_R8, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_Realize(exportState, field=field, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + call ESMF_VMLogMemInfo(prefix="After Realize:", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + end subroutine + + !----------------------------------------------------------------------------- + + subroutine DataInitialize(model, rc) + type(ESMF_GridComp) :: model + integer, intent(out) :: rc + + integer, save :: inHere=1 + + rc = ESMF_SUCCESS + + if (inHere > 1) then + ! indicate that data initialization is complete (breaking out of init-loop) + call NUOPC_CompAttributeSet(model, & + name="InitializeDataComplete", value="true", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + endif + + inHere = inHere + 1 + + end subroutine + + !----------------------------------------------------------------------------- + + subroutine Advance(model, rc) +!$ use omp_lib + type(ESMF_GridComp) :: model + integer, intent(out) :: rc + + ! local variables + type(ESMF_Clock) :: clock + type(ESMF_State) :: importState, exportState + type(ESMF_VM) :: vm + integer :: currentSsiPe + character(len=160) :: msgString + + rc = ESMF_SUCCESS + + ! query for clock, importState and exportState + call ESMF_GridCompGet(model, clock=clock, importState=importState, & + exportState=exportState, vm=vm, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! Now can use OpenMP for fine grained parallelism... + ! Here just write info about the PET-local OpenMP threads to Log. +!$omp parallel private(msgString, currentSsiPe) +!$omp critical +!$ call ESMF_VMGet(vm, currentSsiPe=currentSsiPe) +!$ write(msgString,'(A,I4,A,I4,A,I4,A,I4,A,I4)') & +!$ "thread_num=", omp_get_thread_num(), & +!$ " currentSsiPe=", currentSsiPe, & +!$ " num_threads=", omp_get_num_threads(), & +!$ " max_threads=", omp_get_max_threads(), & +!$ " num_procs=", omp_get_num_procs() +!$ call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) +!$omp end critical +!$omp end parallel + + ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep + + ! Because of the way that the internal Clock was set by default, + ! its timeStep is equal to the parent timeStep. As a consequence the + ! currTime + timeStep is equal to the stopTime of the internal Clock + ! for this call of the Advance() routine. + + call ESMF_ClockPrint(clock, options="currTime", & + preString="---->Advancing Model from: ", unit=msgString, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + call ESMF_ClockPrint(clock, options="stopTime", & + preString="---------------------> to: ", unit=msgString, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + end subroutine + + !----------------------------------------------------------------------------- + +end module diff --git a/testProtos.sh b/testProtos.sh index dab835f8..e9b80f4b 100755 --- a/testProtos.sh +++ b/testProtos.sh @@ -298,6 +298,8 @@ TestProto NestingSingleProto mainApp TestProto NestingTelescopeMultipleProto mainApp TestProto SingleModelProto mainApp TestProto SingleModelOpenMPProto mainApp +export OMP_NUM_THREADS=3 +TestProto SingleModelOpenMPUnawareProto mainApp echo "== TEST SUMMARY START ==" i=1 From 00d72ff860d62da8362e6da9a8e2f70ded1fe8f4 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Fri, 16 Apr 2021 12:02:47 -0700 Subject: [PATCH 47/68] Clean up new output files during 'dust' target. --- AtmOcnTransferGridProto/Makefile | 2 +- AtmOcnTransferMeshProto/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/AtmOcnTransferGridProto/Makefile b/AtmOcnTransferGridProto/Makefile index 565d4938..fe8b26b1 100644 --- a/AtmOcnTransferGridProto/Makefile +++ b/AtmOcnTransferGridProto/Makefile @@ -54,7 +54,7 @@ esm.o: atm.o ocn.o # ----------------------------------------------------------------------------- .PHONY: dust clean distclean info edit dust: - rm -f PET*.ESMF_LogFile *.nc *.vtk *.stdout + rm -f PET*.ESMF_LogFile *.nc *.vtk *.stdout fort.* clean: rm -f esmApp *.o *.mod distclean: dust clean diff --git a/AtmOcnTransferMeshProto/Makefile b/AtmOcnTransferMeshProto/Makefile index 14b92566..0007678b 100644 --- a/AtmOcnTransferMeshProto/Makefile +++ b/AtmOcnTransferMeshProto/Makefile @@ -54,7 +54,7 @@ esm.o: atm.o ocn.o # ----------------------------------------------------------------------------- .PHONY: dust clean distclean info edit dust: - rm -f PET*.ESMF_LogFile field*.nc *.vtk *.stdout + rm -f PET*.ESMF_LogFile field*.nc *.vtk *.stdout fort.* clean: rm -f esmApp *.o *.mod distclean: dust clean From 2edab2f66250fdfe73c2d185780bf9df714051c3 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Fri, 16 Apr 2021 12:27:20 -0700 Subject: [PATCH 48/68] Change from 'gmake' to 'make'. Not all systems have 'gmake' defined, and GNU make behavior can now be assumed as standard. --- testProtos.sh | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/testProtos.sh b/testProtos.sh index e9b80f4b..43be5f8e 100755 --- a/testProtos.sh +++ b/testProtos.sh @@ -23,8 +23,8 @@ testList[count]=$1 echo --------------------------------------------------------------------------- echo STARTING: $1 cd $1 -gmake distclean -gmake +make distclean +make set -x $MPIRUN 4 $TOOLRUN ./$2 > $2.stdout 2>&1 local result=$? @@ -53,8 +53,8 @@ read -ra ARGS <<< "$3" echo --------------------------------------------------------------------------- echo STARTING: $1 cd $1 -gmake distclean -gmake +make distclean +make for arg in "${ARGS[@]}"; do set -x $MPIRUN 4 $TOOLRUN ./$2 $arg > $2.$arg.stdout 2>&1 @@ -81,8 +81,8 @@ function TestSelectProto { echo --------------------------------------------------------------------------- echo STARTING: $1 cd $1 -gmake distclean -gmake ATM=A OCN=A,B +make distclean +make ATM=A OCN=A,B echo "OCN_SELECT: A" > esm.config ((count++)) testList[count]=$1 @@ -97,8 +97,8 @@ else testResult[count]="FAIL" fi echo -gmake clean -gmake ATM=B OCN=A,B +make clean +make ATM=B OCN=A,B echo "OCN_SELECT: A" > esm.config ((count++)) testList[count]=$1 @@ -113,8 +113,8 @@ else testResult[count]="FAIL" fi echo -gmake clean -gmake ATM=A OCN=B +make clean +make ATM=A OCN=B echo "OCN_SELECT: B" > esm.config ((count++)) testList[count]=$1 @@ -138,10 +138,10 @@ function TestSelectExternalProto { echo --------------------------------------------------------------------------- echo STARTING: $1 cd $1 -gmake distclean +make distclean ./cleanSubs.csh ./buildSubs.csh -gmake ATM=A OCN=A,B,C +make ATM=A OCN=A,B,C echo "OCN_SELECT: A" > esm.config ((count++)) testList[count]=$1 @@ -156,8 +156,8 @@ else testResult[count]="FAIL" fi echo -gmake clean -gmake ATM=B OCN=A,B,C +make clean +make ATM=B OCN=A,B,C echo "OCN_SELECT: B" > esm.config ((count++)) testList[count]=$1 @@ -172,8 +172,8 @@ else testResult[count]="FAIL" fi echo -gmake clean -gmake ATM=C OCN=A,B,C +make clean +make ATM=C OCN=A,B,C echo "OCN_SELECT: C" > esm.config ((count++)) testList[count]=$1 @@ -188,8 +188,8 @@ else testResult[count]="FAIL" fi echo -gmake clean -gmake ATM=D OCN=A,B,C +make clean +make ATM=D OCN=A,B,C echo "OCN_SELECT: A" > esm.config ((count++)) testList[count]=$1 @@ -205,8 +205,8 @@ testResult[count]="FAIL" fi echo FINISHED: $1 echo -gmake clean -gmake ATM=E OCN=A,B,C +make clean +make ATM=E OCN=A,B,C echo "OCN_SELECT: B" > esm.config ((count++)) testList[count]=$1 @@ -221,8 +221,8 @@ else testResult[count]="FAIL" fi echo -gmake clean -gmake ATM=F OCN=A,B,C +make clean +make ATM=F OCN=A,B,C echo "OCN_SELECT: C" > esm.config #$MPIRUN 4 ./$2 --- cannot run this because atmF is not fully implemented echo FINISHED: $1 @@ -237,7 +237,7 @@ testList[count]=$1 echo --------------------------------------------------------------------------- echo STARTING: $1 cd $1 -gmake distclean +make distclean set -x ./nuopcExplorerScript ../AtmOcnSelectExternalProto/ATM-A/atmA.mk $MPIRUN 4 $TOOLRUN ./$2 > $2.stdout 2>&1 From 513e1ddfe533810ebd3a928a6065fd292c1888d7 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Tue, 20 Apr 2021 16:14:15 -0700 Subject: [PATCH 49/68] Add files under SingleModelOpenMPUnawareProto. --- .gitignore | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.gitignore b/.gitignore index 254b87cf..7767e5a8 100644 --- a/.gitignore +++ b/.gitignore @@ -802,6 +802,17 @@ SingleModelOpenMPProto/mainApp.o SingleModelOpenMPProto/mainApp.stdout SingleModelOpenMPProto/model.mod SingleModelOpenMPProto/model.o +SingleModelOpenMPUnawareProto/PET0.ESMF_LogFile +SingleModelOpenMPUnawareProto/PET1.ESMF_LogFile +SingleModelOpenMPUnawareProto/PET2.ESMF_LogFile +SingleModelOpenMPUnawareProto/PET3.ESMF_LogFile +SingleModelOpenMPUnawareProto/driver.mod +SingleModelOpenMPUnawareProto/driver.o +SingleModelOpenMPUnawareProto/mainApp +SingleModelOpenMPUnawareProto/mainApp.o +SingleModelOpenMPUnawareProto/mainApp.stdout +SingleModelOpenMPUnawareProto/model.mod +SingleModelOpenMPUnawareProto/model.o SingleModelProto/PET0.ESMF_LogFile SingleModelProto/PET1.ESMF_LogFile SingleModelProto/PET2.ESMF_LogFile From f7ed37065a945220e1fc53a07c28b400c1f51e6a Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Wed, 21 Apr 2021 08:53:22 -0700 Subject: [PATCH 50/68] Additional files now being produced. --- .gitignore | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.gitignore b/.gitignore index 7767e5a8..e5bd16dd 100644 --- a/.gitignore +++ b/.gitignore @@ -488,6 +488,8 @@ AtmOcnTransferGridProto/fields_ocn_init_export.tile3.nc AtmOcnTransferGridProto/fields_ocn_init_export.tile4.nc AtmOcnTransferGridProto/fields_ocn_init_export.tile5.nc AtmOcnTransferGridProto/fields_ocn_init_export.tile6.nc +AtmOcnTransferGridProto/fort.100 +AtmOcnTransferGridProto/fort.200 AtmOcnTransferGridProto/ocn.mod AtmOcnTransferGridProto/ocn.o AtmOcnTransferLocStreamProto/PET0.ESMF_LogFile @@ -504,6 +506,12 @@ AtmOcnTransferLocStreamProto/esmApp.stdout AtmOcnTransferLocStreamProto/field_pmsl_init.nc AtmOcnTransferLocStreamProto/ocn.mod AtmOcnTransferLocStreamProto/ocn.o +AtmOcnTransferMeshProto/Atm-MeshIn_corners.vtk +AtmOcnTransferMeshProto/Atm-MeshOut_corners.vtk +AtmOcnTransferMeshProto/OCN-MeshIn.vtk +AtmOcnTransferMeshProto/OCN-MeshOut.vtk +AtmOcnTransferMeshProto/fort.100 +AtmOcnTransferMeshProto/fort.200 AtmOcnTransferMeshProto/Atm-MeshIn_corners.2.0.vtk AtmOcnTransferMeshProto/Atm-MeshIn_corners.2.1.vtk AtmOcnTransferMeshProto/Atm-MeshOut_corners.2.0.vtk From 25d4045b18fed43c6b43173b9a7a8e79a4f75db3 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Tue, 4 May 2021 11:55:25 -0700 Subject: [PATCH 51/68] Implement more complex test scenarios. --- ExternalDriverAPIProto/atm.F90 | 16 +++++-- ExternalDriverAPIProto/externalApp.F90 | 61 +++++++++++++++++++++++++- ExternalDriverAPIProto/ocn.F90 | 36 ++------------- 3 files changed, 77 insertions(+), 36 deletions(-) diff --git a/ExternalDriverAPIProto/atm.F90 b/ExternalDriverAPIProto/atm.F90 index 45661559..22914385 100644 --- a/ExternalDriverAPIProto/atm.F90 +++ b/ExternalDriverAPIProto/atm.F90 @@ -61,6 +61,12 @@ subroutine SetServices(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out + call NUOPC_CompSpecialize(model, specLabel=label_CheckImport, & + specRoutine=NUOPC_NoOp, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out end subroutine @@ -83,6 +89,7 @@ subroutine Advertise(model, rc) file=__FILE__)) & return ! bail out +#if 1 ! importable field: sea_surface_temperature call NUOPC_Advertise(importState, & StandardName="sea_surface_temperature", name="sst", rc=rc) @@ -90,7 +97,9 @@ subroutine Advertise(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out +#endif +#if 1 ! importable field: precipitation_flux call NUOPC_Advertise(importState, & StandardName="precipitation_flux", name="precip", rc=rc) @@ -98,6 +107,7 @@ subroutine Advertise(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out +#endif ! exportable field: air_pressure_at_sea_level call NUOPC_Advertise(exportState, & @@ -158,7 +168,8 @@ subroutine Realize(model, rc) return ! bail out ! create a Grid object for Fields -#if 0 +#define LAT_LON_GRID +#ifdef LAT_LON_GRID gridIn = ESMF_GridCreate1PeriDimUfrm(maxIndex=(/100, 50/), & minCornerCoord=(/0._ESMF_KIND_R8, -60._ESMF_KIND_R8/), & maxCornerCoord=(/360._ESMF_KIND_R8, 80._ESMF_KIND_R8/), & @@ -354,8 +365,7 @@ subroutine Advance(model, rc) enddo endif -#if 0 -! cannot use NUOPC_Write() for fields on cubed sphere grid right now +#ifdef LAT_LON_GRID ! write out the Fields in the importState call NUOPC_Write(importState, fileNamePrefix="field_atm_import_", & timeslice=slice, overwrite=.true., relaxedFlag=.true., rc=rc) diff --git a/ExternalDriverAPIProto/externalApp.F90 b/ExternalDriverAPIProto/externalApp.F90 index 60a7a30c..f660b1ea 100644 --- a/ExternalDriverAPIProto/externalApp.F90 +++ b/ExternalDriverAPIProto/externalApp.F90 @@ -26,6 +26,8 @@ program externalApp type(ESMF_TimeInterval) :: timeStep type(ESMF_Clock) :: clock type(ESMF_State) :: externalExportState, externalImportState + type(ESMF_StateItem_Flag):: itemType + type(ESMF_Field) :: field integer :: phase character(40) :: sharePolicy integer, save :: slice=1 @@ -111,6 +113,7 @@ program externalApp file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) +#if 1 ! Advertise field(s) in external import state in order to receive from ESM #define SHARED #ifdef SHARED @@ -123,15 +126,41 @@ program externalApp sharePolicy = "not share" #endif call NUOPC_Advertise(externalImportState, & - StandardNames=(/"sea_surface_temperature"/), & + StandardNames=(/"sea_surface_temperature ", & + "surface_net_downward_shortwave_flux"/), & TransferOfferGeomObject="cannot provide", SharePolicyField=sharePolicy, & rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) +#endif + +#if 1 + ! Advertise field(s) in external export state in order to send to ESM +#define SHARED +#ifdef SHARED + ! request reference sharing for field and geomobject + ! -> still the child component may not allow sharing and we end up with copy + sharePolicy = "share" +#else + ! prevent reference sharing for field and geomobject + ! -> definitely create local copy of the field here + sharePolicy = "not share" +#endif + call NUOPC_Advertise(externalExportState, & + StandardNames=(/"precipitation_flux"/), & + TransferOfferGeomObject="cannot provide", SharePolicyField=sharePolicy, & + rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) +#endif ! Call "ExternalAdvertise" Initialize for the earth system Component + ! -> This method removes any fields previously advertised in the states, + ! but ended up not connected. call NUOPC_CompSearchPhaseMap(esmComp, methodflag=ESMF_METHOD_INITIALIZE, & phaseLabel=label_ExternalAdvertise, phaseIndex=phase, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -151,6 +180,9 @@ program externalApp call ESMF_Finalize(endflag=ESMF_END_ABORT) ! Call "ExternalRealize" Initialize for the earth system Component + ! -> This method realizes any fields previously advertised in the states, + ! for which enough information is available to realize (e.g. due to sharing, + ! or transfers). call NUOPC_CompSearchPhaseMap(esmComp, methodflag=ESMF_METHOD_INITIALIZE, & phaseLabel=label_ExternalRealize, phaseIndex=phase, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -169,6 +201,27 @@ program externalApp file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) + ! Fill fields provided from this level with data + call ESMF_StateGet(externalExportState, itemName="precipitation_flux", & + itemType=itemType, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + if (itemType /= ESMF_STATEITEM_NOTFOUND) then + call ESMF_StateGet(externalExportState, itemName="precipitation_flux", & + field=field, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_FieldFill(field, dataFillScheme="sincos", member=1, rc=rc) + if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + endif + ! Call "ExternalDataInit" Initialize for the earth system Component call NUOPC_CompSearchPhaseMap(esmComp, methodflag=ESMF_METHOD_INITIALIZE, & phaseLabel=label_ExternalDataInit, phaseIndex=phase, rc=rc) @@ -207,6 +260,12 @@ program externalApp ! Explicit time stepping loop on the external level, here based on ESMF_Clock do while (.not.ESMF_ClockIsStopTime(clock, rc=rc)) + ! Timestamp the fields in the externalExportState + call NUOPC_SetTimestamp(externalExportState, clock, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) ! Run the earth system Component: i.e. step ESM forward by timestep=15min call ESMF_GridCompRun(esmComp, clock=clock, & importState=externalExportState, exportState=externalImportState, & diff --git a/ExternalDriverAPIProto/ocn.F90 b/ExternalDriverAPIProto/ocn.F90 index eafeb595..8cdd521d 100644 --- a/ExternalDriverAPIProto/ocn.F90 +++ b/ExternalDriverAPIProto/ocn.F90 @@ -143,8 +143,6 @@ subroutine Realize(model, rc) type(ESMF_Field) :: field type(ESMF_Grid) :: gridIn type(ESMF_Grid) :: gridOut - real(ESMF_KIND_R8), pointer :: dataPtr(:,:), lonPtr(:), latPtr(:) - integer :: i,j rc = ESMF_SUCCESS @@ -219,40 +217,14 @@ subroutine Realize(model, rc) file=__FILE__)) & return ! bail out - ! exportable field: sea_surface_temperature - field = ESMF_FieldCreate(name="sst", grid=gridOut, & - typekind=ESMF_TYPEKIND_R8, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call NUOPC_Realize(exportState, field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - - ! fill export with some data - call ESMF_GridGetCoord(gridOut, coordDim=1, farrayPtr=lonPtr, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_GridGetCoord(gridOut, coordDim=2, farrayPtr=latPtr, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - return ! bail out - call ESMF_FieldGet(field, farrayPtr=dataPtr, rc=rc) + ! exportable field: sea_surface_temperature, realize conditionally and fill + call NUOPC_Realize(exportState, grid=gridOut, fieldName="sst", & + typekind=ESMF_TYPEKIND_R8, selection="realize_connected_remove_others", & + dataFillScheme="sincos", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - do j=lbound(dataPtr,2),ubound(dataPtr,2) - do i=lbound(dataPtr,1),ubound(dataPtr,1) - dataPtr(i,j) = sin(3.1416*lonPtr(i)/180.) * cos(3.1416*latPtr(j)/180.) - enddo - enddo end subroutine From d99da93e55a76e24080979c49eb1f8f19b196faf Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Tue, 4 May 2021 15:16:54 -0700 Subject: [PATCH 52/68] First working version. Still need to implement separate time loops inside the DA components, calling into the nuopc-da layer independently on different MPI ranks. --- ExternalDriverAPIWeakCplDAProto/Makefile | 75 ++++ ExternalDriverAPIWeakCplDAProto/README | 47 +++ ExternalDriverAPIWeakCplDAProto/atm.F90 | 391 ++++++++++++++++++ ExternalDriverAPIWeakCplDAProto/atmDA.F90 | 70 ++++ ExternalDriverAPIWeakCplDAProto/esm.F90 | 220 ++++++++++ .../externalApp.F90 | 64 +++ ExternalDriverAPIWeakCplDAProto/nuopc_da.F90 | 324 +++++++++++++++ ExternalDriverAPIWeakCplDAProto/ocn.F90 | 380 +++++++++++++++++ ExternalDriverAPIWeakCplDAProto/ocnDA.F90 | 70 ++++ 9 files changed, 1641 insertions(+) create mode 100644 ExternalDriverAPIWeakCplDAProto/Makefile create mode 100644 ExternalDriverAPIWeakCplDAProto/README create mode 100644 ExternalDriverAPIWeakCplDAProto/atm.F90 create mode 100644 ExternalDriverAPIWeakCplDAProto/atmDA.F90 create mode 100644 ExternalDriverAPIWeakCplDAProto/esm.F90 create mode 100644 ExternalDriverAPIWeakCplDAProto/externalApp.F90 create mode 100644 ExternalDriverAPIWeakCplDAProto/nuopc_da.F90 create mode 100644 ExternalDriverAPIWeakCplDAProto/ocn.F90 create mode 100644 ExternalDriverAPIWeakCplDAProto/ocnDA.F90 diff --git a/ExternalDriverAPIWeakCplDAProto/Makefile b/ExternalDriverAPIWeakCplDAProto/Makefile new file mode 100644 index 00000000..a7eb2c5a --- /dev/null +++ b/ExternalDriverAPIWeakCplDAProto/Makefile @@ -0,0 +1,75 @@ +# GNU Makefile template for user ESMF application + +################################################################################ +################################################################################ +## This Makefile must be able to find the "esmf.mk" Makefile fragment in the ## +## 'include' line below. Following the ESMF User's Guide, a complete ESMF ## +## installation should ensure that a single environment variable "ESMFMKFILE" ## +## is made available on the system. This variable should point to the ## +## "esmf.mk" file. ## +## ## +## This example Makefile uses the "ESMFMKFILE" environment variable. ## +## ## +## If you notice that this Makefile cannot find variable ESMFMKFILE then ## +## please contact the person responsible for the ESMF installation on your ## +## system. ## +## As a work-around you can simply hardcode the path to "esmf.mk" in the ## +## include line below. However, doing so will render this Makefile a lot less ## +## flexible and non-portable. ## +################################################################################ + +ifneq ($(origin ESMFMKFILE), environment) +$(error Environment variable ESMFMKFILE was not set.) +endif + +include $(ESMFMKFILE) + +################################################################################ +################################################################################ + +.SUFFIXES: .f90 .F90 .c .C + +%.o : %.f90 + $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREENOCPP) $< + +%.o : %.F90 + $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $< + +%.o : %.c + $(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< + +%.o : %.C + $(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< + + +# ----------------------------------------------------------------------------- +externalApp: externalApp.o atmDA.o ocnDA.o nuopc_da.o esm.o atm.o ocn.o + $(ESMF_F90LINKER) $(ESMF_F90LINKOPTS) $(ESMF_F90LINKPATHS) $(ESMF_F90LINKRPATHS) -o $@ $^ $(ESMF_F90ESMFLINKLIBS) + +# module dependencies: +externalApp.o: esm.o atmDA.o ocnDA.o nuopc_da.o +atmDA.o: nuopc_da.o +ocnDA.o: nuopc_da.o +esm.o: atm.o ocn.o + +# ----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- +.PHONY: dust clean distclean info edit +dust: + rm -f PET*.ESMF_LogFile *.nc *.stdout +clean: + rm -f externalApp *.o *.mod +distclean: dust clean + +info: + @echo ================================================================== + @echo ESMFMKFILE=$(ESMFMKFILE) + @echo ================================================================== + @cat $(ESMFMKFILE) + @echo ================================================================== + +edit: + nedit externalApp.F90 atmDA.F90 ocnDA.F90 nuopc_da.F90 esm.F90 atm.F90 ocn.F90 & + +run: + mpirun -np 4 ./externalApp diff --git a/ExternalDriverAPIWeakCplDAProto/README b/ExternalDriverAPIWeakCplDAProto/README new file mode 100644 index 00000000..e4194abd --- /dev/null +++ b/ExternalDriverAPIWeakCplDAProto/README @@ -0,0 +1,47 @@ +README for External Driver API NUOPC for weakly coupled DA prototype +-------------------------------------------------------------------- + +A simple two model coupled system with a driver. Layered with the nuopc-da +interface layer, accessed independently by two DA systems: for ATM and OCN. +The nuopc-da interface is using the "External" Driver API to drive the coupled +system. Fields are connected between the coupled system and the DA components. + +Description: + + A two-way coupled system with a single driver (ESM) and two model components + (ATM, OCN). + + The ESM driver uses explicitly constructed petLists when adding the two + model components. + + The ESM driver component uses the default run sequence to implement coupling + between ATM and OCN components. + + The application layer splits the MPI_COMM_WORLD communicator for ATM DA (lower + half of ranks) and OCN DA (upper half of ranks). Both DA components access the + coupled system through the nuopc-da interface layer. + +Build: + - Set environment variable ESMFMKFILE to point to the esmf.mk of your ESMF + installation. + - gmake + +Execution: + - Optionally set environment variable ESMF_RUNTIME_COMPLIANCECHECK to ON. + - mpirun -np X ./esmApp (where X is the total number of PETs, typically 4) + +Output: + - PET*.Log files containing compliance checker output if turned on. + - The prototype outputs time stepping information to stdout. + +Code structure: + - Makefile - Makefile that is based on the standard esmf.mk mechanism. + - atm.F90 - The ATM component, specializing generic NUOPC_Model. + - ocn.F90 - The OCN component, specializing generic NUOPC_Model. + - esm.F90 - The Earth System Model (ESM) component, specializing generic + NUOPC_Driver. Define partial petLists for ATM and OCN. + - nuopc_da.F90- NUOPC-DA interface layer. + - atmDA.F90 - ATM DA component on a subset of ranks. + - ocnDA.F90 - OCN DA component on a subset of ranks. + - externalApp.F90 - Application layer setting up the NUOPC-DA interface, and + both DA components. diff --git a/ExternalDriverAPIWeakCplDAProto/atm.F90 b/ExternalDriverAPIWeakCplDAProto/atm.F90 new file mode 100644 index 00000000..22914385 --- /dev/null +++ b/ExternalDriverAPIWeakCplDAProto/atm.F90 @@ -0,0 +1,391 @@ +!============================================================================== +! Earth System Modeling Framework +! Copyright 2002-2021, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! NASA Goddard Space Flight Center. +! Licensed under the University of Illinois-NCSA License. +!============================================================================== + +module ATM + + !----------------------------------------------------------------------------- + ! ATM Component. + !----------------------------------------------------------------------------- + + use ESMF + use NUOPC + use NUOPC_Model, & + modelSS => SetServices + + implicit none + + private + + public SetServices + + !----------------------------------------------------------------------------- + contains + !----------------------------------------------------------------------------- + + subroutine SetServices(model, rc) + type(ESMF_GridComp) :: model + integer, intent(out) :: rc + + rc = ESMF_SUCCESS + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_CompSpecialize(model, specLabel=label_CheckImport, & + specRoutine=NUOPC_NoOp, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + end subroutine + + !----------------------------------------------------------------------------- + + subroutine Advertise(model, rc) + type(ESMF_GridComp) :: model + integer, intent(out) :: rc + + ! local variables + type(ESMF_State) :: importState, exportState + + rc = ESMF_SUCCESS + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + +#if 1 + ! importable field: sea_surface_temperature + call NUOPC_Advertise(importState, & + StandardName="sea_surface_temperature", name="sst", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out +#endif + +#if 1 + ! importable field: precipitation_flux + call NUOPC_Advertise(importState, & + StandardName="precipitation_flux", name="precip", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out +#endif + + ! exportable field: air_pressure_at_sea_level + call NUOPC_Advertise(exportState, & + StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! exportable field: surface_net_downward_shortwave_flux + call NUOPC_Advertise(exportState, & + StandardName="surface_net_downward_longwave_flux", name="rsnl", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! exportable field: surface_net_downward_shortwave_flux + call NUOPC_Advertise(exportState, & + StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! exportable field: surface_downward_heat_flux_in_air + call NUOPC_Advertise(exportState, & + StandardName="surface_downward_heat_flux_in_air", name="sdhf", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + end subroutine + + !----------------------------------------------------------------------------- + + subroutine Realize(model, rc) + type(ESMF_GridComp) :: model + integer, intent(out) :: rc + + ! local variables + type(ESMF_State) :: importState, exportState + type(ESMF_Field) :: field + type(ESMF_Grid) :: gridIn + type(ESMF_Grid) :: gridOut + real(ESMF_KIND_R8), pointer :: dataPtr(:,:), lonPtr(:), latPtr(:) + integer :: i,j + + rc = ESMF_SUCCESS + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! create a Grid object for Fields +#define LAT_LON_GRID +#ifdef LAT_LON_GRID + gridIn = ESMF_GridCreate1PeriDimUfrm(maxIndex=(/100, 50/), & + minCornerCoord=(/0._ESMF_KIND_R8, -60._ESMF_KIND_R8/), & + maxCornerCoord=(/360._ESMF_KIND_R8, 80._ESMF_KIND_R8/), & + staggerLocList=(/ESMF_STAGGERLOC_CENTER/), rc=rc) +#else + gridIn = ESMF_GridCreateCubedSphere(tileSize=16, name="CubedSphere", & + staggerLocList=(/ESMF_STAGGERLOC_CENTER/), rc=rc) +#endif + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + gridOut = gridIn ! for now out same as in + + ! conditionally realize the fields in the importState + call NUOPC_Realize(importState, grid=gridIn, typekind=ESMF_TYPEKIND_R8, & + selection="realize_connected_remove_others", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! exportable field: air_pressure_at_sea_level + field = ESMF_FieldCreate(name="pmsl", grid=gridOut, & + typekind=ESMF_TYPEKIND_R8, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_Realize(exportState, field=field, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! fill export with some data + call ESMF_FieldFill(field, dataFillScheme="sincos", member=1, rc=rc) + + ! exportable field: surface_net_downward_longwave_flux + field = ESMF_FieldCreate(name="rsnl", grid=gridOut, & + typekind=ESMF_TYPEKIND_R8, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_Realize(exportState, field=field, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! fill export with some data + call ESMF_FieldFill(field, dataFillScheme="sincos", member=2, rc=rc) + + ! exportable field: surface_net_downward_shortwave_flux + field = ESMF_FieldCreate(name="rsns", grid=gridOut, & + typekind=ESMF_TYPEKIND_R8, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_Realize(exportState, field=field, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! fill export with some data + call ESMF_FieldFill(field, dataFillScheme="sincos", member=3, rc=rc) + + ! exportable field: surface_downward_heat_flux_in_air + field = ESMF_FieldCreate(name="sdhf", grid=gridOut, & + typekind=ESMF_TYPEKIND_R8, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_Realize(exportState, field=field, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! fill export with some data + call ESMF_FieldFill(field, dataFillScheme="sincos", member=4, rc=rc) + + end subroutine + + !----------------------------------------------------------------------------- + + subroutine Advance(model, rc) + type(ESMF_GridComp) :: model + integer, intent(out) :: rc + + ! local variables + type(ESMF_Clock) :: clock + type(ESMF_State) :: importState, exportState + type(ESMF_Field) :: field + type(ESMF_StateItem_Flag) :: itemType + real(ESMF_KIND_R8), pointer :: dataPtr(:,:) + integer :: i,j + character(len=160) :: msgString + integer, save :: slice=1 + + rc = ESMF_SUCCESS + + ! query for clock, importState and exportState + call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep + + ! Because of the way that the internal Clock was set by default, + ! its timeStep is equal to the parent timeStep. As a consequence the + ! currTime + timeStep is equal to the stopTime of the internal Clock + ! for this call of the Advance() routine. + + call ESMF_ClockPrint(clock, options="currTime", & + preString="------>Advancing ATM from: ", unit=msgString, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + call ESMF_ClockPrint(clock, options="stopTime", & + preString="---------------------> to: ", unit=msgString, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! update the "pmsl" field + call ESMF_StateGet(exportState, itemName="pmsl", itemType=itemType, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + if (itemType /= ESMF_STATEITEM_NOTFOUND) then + call ESMF_StateGet(exportState, itemName="pmsl", field=field, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_FieldGet(field, farrayPtr=dataPtr, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! dummy calculation to make the export field more interesting + do j=lbound(dataPtr,2),ubound(dataPtr,2) + do i=lbound(dataPtr,1),ubound(dataPtr,1) + dataPtr(i,j) = dataPtr(i,j) * 1.1 + enddo + enddo + endif + + ! update the "rsns" field + call ESMF_StateGet(exportState, itemName="rsns", itemType=itemType, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + if (itemType /= ESMF_STATEITEM_NOTFOUND) then + call ESMF_StateGet(exportState, itemName="rsns", field=field, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_FieldGet(field, farrayPtr=dataPtr, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! dummy calculation to make the export field more interesting + do j=lbound(dataPtr,2),ubound(dataPtr,2) + do i=lbound(dataPtr,1),ubound(dataPtr,1) + dataPtr(i,j) = dataPtr(i,j) * 1.1 + enddo + enddo + endif + +#ifdef LAT_LON_GRID + ! write out the Fields in the importState + call NUOPC_Write(importState, fileNamePrefix="field_atm_import_", & + timeslice=slice, overwrite=.true., relaxedFlag=.true., rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! write out the Fields in the exportState + call NUOPC_Write(exportState, fileNamePrefix="field_atm_export_", & + timeslice=slice, overwrite=.true., relaxedFlag=.true., rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out +#endif + ! advance the time slice counter + slice = slice + 1 + + end subroutine + + !----------------------------------------------------------------------------- + +end module diff --git a/ExternalDriverAPIWeakCplDAProto/atmDA.F90 b/ExternalDriverAPIWeakCplDAProto/atmDA.F90 new file mode 100644 index 00000000..853584fd --- /dev/null +++ b/ExternalDriverAPIWeakCplDAProto/atmDA.F90 @@ -0,0 +1,70 @@ +!============================================================================== +! Earth System Modeling Framework +! Copyright 2002-2021, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! NASA Goddard Space Flight Center. +! Licensed under the University of Illinois-NCSA License. +!============================================================================== + +module atmDA + + !----------------------------------------------------------------------------- + ! ATM DA Code + !----------------------------------------------------------------------------- + + use MPI + use ESMF + use NUOPC + + use nuopc_da, only: & + nuopc_da_connect => connect, & + nuopc_da_drive => drive + + implicit none + + private + + public exec + + !----------------------------------------------------------------------------- + contains + !----------------------------------------------------------------------------- + + subroutine exec(comm) + integer :: comm + + integer :: rc + + call ESMF_LogWrite("Starting into ATM DA code", ESMF_LOGMSG_INFO, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + + ! Connect DA code with NUOPC system top component + call nuopc_da_connect(toNuopcTopStandardNames=(/"precipitation_flux"/), & + fmNuopcTopStandardNames=(/"surface_net_downward_shortwave_flux"/), rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + + !TODO: implement an explicit time loop here... + !TODO: call into component specific step + call nuopc_da_drive(rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + + call ESMF_LogWrite("Finished with ATM DA code", ESMF_LOGMSG_INFO, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + + end subroutine + +end module diff --git a/ExternalDriverAPIWeakCplDAProto/esm.F90 b/ExternalDriverAPIWeakCplDAProto/esm.F90 new file mode 100644 index 00000000..91fd57c9 --- /dev/null +++ b/ExternalDriverAPIWeakCplDAProto/esm.F90 @@ -0,0 +1,220 @@ +!============================================================================== +! Earth System Modeling Framework +! Copyright 2002-2021, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! NASA Goddard Space Flight Center. +! Licensed under the University of Illinois-NCSA License. +!============================================================================== + +module ESM + + !----------------------------------------------------------------------------- + ! Code that specializes generic ESM Component code. + !----------------------------------------------------------------------------- + + use ESMF + use NUOPC + use NUOPC_Driver, & + driverSS => SetServices + + use ATM, only: atmSS => SetServices + use OCN, only: ocnSS => SetServices + + use NUOPC_Connector, only: cplSS => SetServices + + implicit none + + private + + public SetServices + + !----------------------------------------------------------------------------- + contains + !----------------------------------------------------------------------------- + + subroutine SetServices(driver, rc) + type(ESMF_GridComp) :: driver + integer, intent(out) :: rc + + rc = ESMF_SUCCESS + + ! derive from NUOPC_Driver + call NUOPC_CompDerive(driver, driverSS, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! specialize driver + call NUOPC_CompSpecialize(driver, specLabel=label_SetModelServices, & + specRoutine=SetModelServices, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! set driver verbosity + call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + end subroutine + + !----------------------------------------------------------------------------- + + subroutine SetModelServices(driver, rc) + type(ESMF_GridComp) :: driver + integer, intent(out) :: rc + + ! local variables + type(ESMF_Grid) :: grid + type(ESMF_Field) :: field + type(ESMF_Time) :: startTime + type(ESMF_Time) :: stopTime + type(ESMF_TimeInterval) :: timeStep + logical :: clockIsPresent + type(ESMF_Clock) :: internalClock + type(ESMF_GridComp) :: child + type(ESMF_CplComp) :: connector + integer :: petCount, i + integer, allocatable :: petList(:) + + rc = ESMF_SUCCESS + + ! get the petCount + call ESMF_GridCompGet(driver, petCount=petCount, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! SetServices for ATM with petList on first half of PETs + allocate(petList(petCount/2)) + do i=1, petCount/2 + petList(i) = i-1 ! PET labeling goes from 0 to petCount-1 + enddo + call NUOPC_DriverAddComp(driver, "ATM", atmSS, & + petList=petList, comp=child, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_CompAttributeSet(child, name="Verbosity", value="low", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + deallocate(petList) + + ! SetServices for OCN with petList on second half of PETs + allocate(petList(petCount/2)) + do i=1, petCount/2 + petList(i) = petCount/2 + i-1 ! PET labeling goes from 0 to petCount-1 + enddo + call NUOPC_DriverAddComp(driver, "OCN", ocnSS, & + petList=petList, comp=child, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_CompAttributeSet(child, name="Verbosity", value="low", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + deallocate(petList) + + ! SetServices for atm2ocn + call NUOPC_DriverAddComp(driver, srcCompLabel="ATM", dstCompLabel="OCN", & + compSetServicesRoutine=cplSS, comp=connector, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_CompAttributeSet(connector, name="Verbosity", value="low", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! SetServices for ocn2atm + call NUOPC_DriverAddComp(driver, srcCompLabel="OCN", dstCompLabel="ATM", & + compSetServicesRoutine=cplSS, comp=connector, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_CompAttributeSet(connector, name="Verbosity", value="low", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! conditionally set the driver clock + call ESMF_GridCompGet(driver, clockIsPresent=clockIsPresent, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + if (.not.clockIsPresent) then + ! set the driver clock here + call ESMF_TimeIntervalSet(timeStep, m=15, rc=rc) ! 15 minute steps + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + call ESMF_TimeSet(startTime, yy=2010, mm=6, dd=1, h=0, m=0, & + calkindflag=ESMF_CALKIND_GREGORIAN, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + call ESMF_TimeSet(stopTime, yy=2010, mm=6, dd=1, h=1, m=0, & + calkindflag=ESMF_CALKIND_GREGORIAN, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + internalClock = ESMF_ClockCreate(name="Application Clock", & + timeStep=timeStep, startTime=startTime, stopTime=stopTime, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + call ESMF_GridCompSet(driver, clock=internalClock, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + else + call ESMF_TimeIntervalSet(timeStep, m=5, rc=rc) ! 5 minute steps + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_GridCompGet(driver, clock=internalClock, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_ClockSet(internalClock, timeStep=timeStep, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + endif + + end subroutine + + !----------------------------------------------------------------------------- + +end module diff --git a/ExternalDriverAPIWeakCplDAProto/externalApp.F90 b/ExternalDriverAPIWeakCplDAProto/externalApp.F90 new file mode 100644 index 00000000..e62df1d3 --- /dev/null +++ b/ExternalDriverAPIWeakCplDAProto/externalApp.F90 @@ -0,0 +1,64 @@ +!============================================================================== +! Earth System Modeling Framework +! Copyright 2002-2021, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! NASA Goddard Space Flight Center. +! Licensed under the University of Illinois-NCSA License. +!============================================================================== + +program externalApp + + !----------------------------------------------------------------------------- + ! Generic external application driver + !----------------------------------------------------------------------------- + + use MPI + + use ESMF + use NUOPC + use ESM, only: esmSS => SetServices + + use nuopc_da, only: & + nuopc_da_init => init, & + nuopc_da_final => final + + use atmDA, only: atmDAexec => exec + use ocnDA, only: ocnDAexec => exec + + implicit none + + integer :: rc, urc + integer :: size, rank + integer :: splitComm + + ! Initialize the NUOPC-DA interface + call nuopc_da_init(nuopcTopSetServices=esmSS, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + + ! Split up the MPI_COMM_WORLD into atmDA (first half) and ocnDA (second half) + ! of MPI ranks. Call into the respective DA routine + call MPI_Comm_size(MPI_COMM_WORLD, size, ierror=rc) + call MPI_Comm_rank(MPI_COMM_WORLD, rank, ierror=rc) + if (rank < size/2) then + ! atm DA processes + call MPI_Comm_split(MPI_COMM_WORLD, 1, rank, splitComm, ierror=rc) + call atmDAexec(comm=splitComm) + else + ! ocn DA processes + call MPI_Comm_split(MPI_COMM_WORLD, 2, rank, splitComm, ierror=rc) + call ocnDAexec(comm=splitComm) + endif + + ! Finalize the NUOPC-DA interface + call nuopc_da_final(rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + +end program diff --git a/ExternalDriverAPIWeakCplDAProto/nuopc_da.F90 b/ExternalDriverAPIWeakCplDAProto/nuopc_da.F90 new file mode 100644 index 00000000..a251fb29 --- /dev/null +++ b/ExternalDriverAPIWeakCplDAProto/nuopc_da.F90 @@ -0,0 +1,324 @@ +!============================================================================== +! Earth System Modeling Framework +! Copyright 2002-2021, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! NASA Goddard Space Flight Center. +! Licensed under the University of Illinois-NCSA License. +!============================================================================== + +module nuopc_da + + !----------------------------------------------------------------------------- + ! NUOPC - DA interface code + !----------------------------------------------------------------------------- + + use MPI + use ESMF + use NUOPC + + implicit none + + private + + type(ESMF_GridComp) :: nuopcTop + type(ESMF_State) :: toNuopcTop, fmNuopcTop + type(ESMF_Clock) :: clock + + public init, connect, drive, final + + !----------------------------------------------------------------------------- + contains + !----------------------------------------------------------------------------- + + subroutine init(nuopcTopSetServices, rc) + interface + recursive subroutine nuopcTopSetServices(gridcomp, rc) + use ESMF + implicit none + type(ESMF_GridComp) :: gridcomp ! must not be optional + integer, intent(out) :: rc ! must not be optional + end subroutine + end interface + integer, intent(out) :: rc + + integer :: urc + type(ESMF_Time) :: startTime, stopTime + type(ESMF_TimeInterval) :: timeStep + + ! Initialize ESMF + call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, & + defaultCalkind=ESMF_CALKIND_GREGORIAN, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) return + + call ESMF_LogSet(flush=.true., rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) return + + call ESMF_LogWrite("INIT...", ESMF_LOGMSG_INFO, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) return + + ! Create the application Clock + call ESMF_TimeIntervalSet(timeStep, m=15, rc=rc) ! 15 minute steps + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) return + call ESMF_TimeSet(startTime, yy=2010, mm=6, dd=1, h=0, m=0, & + calkindflag=ESMF_CALKIND_GREGORIAN, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) return + call ESMF_TimeSet(stopTime, yy=2010, mm=6, dd=1, h=1, m=0, & + calkindflag=ESMF_CALKIND_GREGORIAN, rc=rc) + clock = ESMF_ClockCreate(name="Application Clock", & + timeStep=timeStep, startTime=startTime, stopTime=stopTime, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) return + + ! Create the external level import/export States + ! NOTE: The "stateintent" must be specified, and it must be set from the + ! perspective of the external level: + ! -> state holding fields exported by the external level to the ESM component + toNuopcTop = ESMF_StateCreate(stateintent=ESMF_STATEINTENT_EXPORT, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) return + ! -> state holding fields imported by the external level from the ESM component + fmNuopcTop = ESMF_StateCreate(stateintent=ESMF_STATEINTENT_IMPORT, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) return + + ! Create the earth system Component + nuopcTop = ESMF_GridCompCreate(name="nuopcTop", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) return + + ! SetServices for the earth system Component + call ESMF_GridCompSetServices(nuopcTop, nuopcTopSetServices, userRc=urc, & + rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) return + if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__, rcToReturn=rc)) return + + end subroutine + + !----------------------------------------------------------------------------- + + subroutine connect(toNuopcTopStandardNames, fmNuopcTopStandardNames, rc) + character(*), intent(in), optional :: toNuopcTopStandardNames(:) + character(*), intent(in), optional :: fmNuopcTopStandardNames(:) + integer, intent(out) :: rc + + integer :: urc, phase, i + type(ESMF_Field) :: field + type(ESMF_StateItem_Flag) :: itemType + + if (present(toNuopcTopStandardNames)) then + call NUOPC_Advertise(toNuopcTop, StandardNames=toNuopcTopStandardNames, & + TransferOfferGeomObject="cannot provide", SharePolicyField="share", & + rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__, rcToReturn=rc)) return + endif + + if (present(fmNuopcTopStandardNames)) then + call NUOPC_Advertise(fmNuopcTop, StandardNames=fmNuopcTopStandardNames, & + TransferOfferGeomObject="cannot provide", SharePolicyField="share", & + rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__, rcToReturn=rc)) return + endif + + ! Call "ExternalAdvertise" Initialize for the earth system Component + ! -> This method removes any fields previously advertised in the states, + ! but ended up not connected. + call NUOPC_CompSearchPhaseMap(nuopcTop, methodflag=ESMF_METHOD_INITIALIZE, & + phaseLabel=label_ExternalAdvertise, phaseIndex=phase, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__, rcToReturn=rc)) return + call ESMF_GridCompInitialize(nuopcTop, phase=phase, & + importState=toNuopcTop, exportState=fmNuopcTop, & + userRc=urc, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) return + if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__, rcToReturn=rc)) return + + ! Call "ExternalRealize" Initialize for the earth system Component + ! -> This method realizes any fields previously advertised in the states, + ! for which enough information is available to realize (e.g. due to sharing, + ! or transfers). + call NUOPC_CompSearchPhaseMap(nuopcTop, methodflag=ESMF_METHOD_INITIALIZE, & + phaseLabel=label_ExternalRealize, phaseIndex=phase, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__, rcToReturn=rc)) return + call ESMF_GridCompInitialize(nuopcTop, phase=phase, & + importState=toNuopcTop, exportState=fmNuopcTop, & + userRc=urc, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) return + if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__, rcToReturn=rc)) return + + ! Fill fields provided from this level to nuopcTop with data + if (present(toNuopcTopStandardNames)) then + do i=1, size(toNuopcTopStandardNames) + call ESMF_StateGet(toNuopcTop, itemName=toNuopcTopStandardNames(i), & + itemType=itemType, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) return + if (itemType /= ESMF_STATEITEM_NOTFOUND) then + call ESMF_StateGet(toNuopcTop, itemName=toNuopcTopStandardNames(i), & + field=field, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) return + call ESMF_FieldFill(field, dataFillScheme="sincos", member=1, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) return + endif + enddo + endif + + ! Call "ExternalDataInit" Initialize for the earth system Component + call NUOPC_CompSearchPhaseMap(nuopcTop, methodflag=ESMF_METHOD_INITIALIZE, & + phaseLabel=label_ExternalDataInit, phaseIndex=phase, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__, rcToReturn=rc)) return + call ESMF_GridCompInitialize(nuopcTop, phase=phase, & + importState=toNuopcTop, exportState=fmNuopcTop, & + userRc=urc, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) return + if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__, rcToReturn=rc)) return + + ! Write out the Fields in the toNuopcTop after initialize + call NUOPC_Write(toNuopcTop, & + fileNamePrefix="field_toNuopcTop_init_", & + overwrite=.true., relaxedFlag=.true., rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__, rcToReturn=rc)) return + ! Write out the Fields in the fmNuopcTop after initialize + call NUOPC_Write(fmNuopcTop, & + fileNamePrefix="field_fmNuopcTop_init_", & + overwrite=.true., relaxedFlag=.true., rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__, rcToReturn=rc)) return + + end subroutine + + !----------------------------------------------------------------------------- + + subroutine drive(rc) + integer, intent(out) :: rc + + integer :: urc, phase, i + integer, save :: slice=1 + + ! Explicit time stepping loop on the external level, here based on ESMF_Clock + do while (.not.ESMF_ClockIsStopTime(clock, rc=rc)) + ! Timestamp the fields in the toNuopcTop state + call NUOPC_SetTimestamp(toNuopcTop, clock, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__, rcToReturn=rc)) return + ! Run the earth system Component: i.e. step nuopcTop forward by timestep + call ESMF_GridCompRun(nuopcTop, clock=clock, & + importState=toNuopcTop, exportState=fmNuopcTop, & + userRc=urc, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) return + if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__, rcToReturn=rc)) return + ! Write out the Fields in the toNuopcTop + call NUOPC_Write(toNuopcTop, & + fileNamePrefix="field_toNuopcTop_", & + timeslice=slice, overwrite=.true., relaxedFlag=.true., rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__, rcToReturn=rc)) return + ! Write out the Fields in the fmNuopcTop after initialize + call NUOPC_Write(fmNuopcTop, & + fileNamePrefix="field_fmNuopcTop_", & + timeslice=slice, overwrite=.true., relaxedFlag=.true., rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__, rcToReturn=rc)) return + ! Increment the time slice counter + slice = slice + 1 + ! Advance the clock + call ESMF_ClockAdvance(clock, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__, rcToReturn=rc)) return + end do + + end subroutine + + !----------------------------------------------------------------------------- + + subroutine final(rc) + integer, intent(out) :: rc + + integer :: urc, phase, i + + ! Finalize the nuopcTop Component + call ESMF_GridCompFinalize(nuopcTop, & + importState=toNuopcTop, exportState=fmNuopcTop, & + userRc=urc, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) return + if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__, rcToReturn=rc)) return + + ! Destroy the nuopcTop Component + call ESMF_GridCompDestroy(nuopcTop, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) return + + call ESMF_LogWrite("...FINAL", ESMF_LOGMSG_INFO, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) return + + ! Finalize ESMF + call ESMF_Finalize(rc=rc) + + end subroutine + + !----------------------------------------------------------------------------- + +end module diff --git a/ExternalDriverAPIWeakCplDAProto/ocn.F90 b/ExternalDriverAPIWeakCplDAProto/ocn.F90 new file mode 100644 index 00000000..8cdd521d --- /dev/null +++ b/ExternalDriverAPIWeakCplDAProto/ocn.F90 @@ -0,0 +1,380 @@ +!============================================================================== +! Earth System Modeling Framework +! Copyright 2002-2021, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! NASA Goddard Space Flight Center. +! Licensed under the University of Illinois-NCSA License. +!============================================================================== + +module OCN + + !----------------------------------------------------------------------------- + ! OCN Component. + !----------------------------------------------------------------------------- + + use ESMF + use NUOPC + use NUOPC_Model, & + modelSS => SetServices + + implicit none + + private + + public SetServices + + !----------------------------------------------------------------------------- + contains + !----------------------------------------------------------------------------- + + subroutine SetServices(model, rc) + type(ESMF_GridComp) :: model + integer, intent(out) :: rc + + rc = ESMF_SUCCESS + + ! derive from NUOPC_Model + call NUOPC_CompDerive(model, modelSS, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! specialize model + call NUOPC_CompSpecialize(model, specLabel=label_Advertise, & + specRoutine=Advertise, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_CompSpecialize(model, specLabel=label_RealizeProvided, & + specRoutine=Realize, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_CompSpecialize(model, specLabel=label_SetClock, & + specRoutine=SetClock, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_CompSpecialize(model, specLabel=label_Advance, & + specRoutine=Advance, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + end subroutine + + !----------------------------------------------------------------------------- + + subroutine Advertise(model, rc) + type(ESMF_GridComp) :: model + integer, intent(out) :: rc + + ! local variables + type(ESMF_State) :: importState, exportState + + rc = ESMF_SUCCESS + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! importable field: air_pressure_at_sea_level + call NUOPC_Advertise(importState, & + StandardName="air_pressure_at_sea_level", name="pmsl", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! importable field: surface_net_downward_shortwave_flux + call NUOPC_Advertise(importState, & + StandardName="surface_net_downward_longwave_flux", name="rsnl", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! importable field: surface_net_downward_shortwave_flux + call NUOPC_Advertise(importState, & + StandardName="surface_net_downward_shortwave_flux", name="rsns", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! importable field: surface_downward_heat_flux_in_air + call NUOPC_Advertise(importState, & + StandardName="surface_downward_heat_flux_in_air", name="sdhf", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! exportable field: sea_surface_temperature + call NUOPC_Advertise(exportState, & + StandardName="sea_surface_temperature", name="sst", & + SharePolicyField="share", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + end subroutine + + !----------------------------------------------------------------------------- + + subroutine Realize(model, rc) + type(ESMF_GridComp) :: model + integer, intent(out) :: rc + + ! local variables + type(ESMF_State) :: importState, exportState + type(ESMF_Field) :: field + type(ESMF_Grid) :: gridIn + type(ESMF_Grid) :: gridOut + + rc = ESMF_SUCCESS + + ! query for importState and exportState + call NUOPC_ModelGet(model, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! create a Grid object for Fields + gridIn = ESMF_GridCreate1PeriDimUfrm(maxIndex=(/100, 50/), & + minCornerCoord=(/0._ESMF_KIND_R8, -60._ESMF_KIND_R8/), & + maxCornerCoord=(/360._ESMF_KIND_R8, 80._ESMF_KIND_R8/), & + staggerLocList=(/ESMF_STAGGERLOC_CENTER/), rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + gridOut = gridIn ! for now out same as in + + ! importable field: air_pressure_at_sea_level + field = ESMF_FieldCreate(name="pmsl", grid=gridIn, & + typekind=ESMF_TYPEKIND_R8, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_Realize(importState, field=field, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! importable field: surface_net_downward_longwave_flux + field = ESMF_FieldCreate(name="rsnl", grid=gridIn, & + typekind=ESMF_TYPEKIND_R8, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_Realize(importState, field=field, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! importable field: surface_net_downward_shortwave_flux + field = ESMF_FieldCreate(name="rsns", grid=gridIn, & + typekind=ESMF_TYPEKIND_R8, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_Realize(importState, field=field, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! importable field: surface_downward_heat_flux_in_air + field = ESMF_FieldCreate(name="sdhf", grid=gridIn, & + typekind=ESMF_TYPEKIND_R8, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_Realize(importState, field=field, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! exportable field: sea_surface_temperature, realize conditionally and fill + call NUOPC_Realize(exportState, grid=gridOut, fieldName="sst", & + typekind=ESMF_TYPEKIND_R8, selection="realize_connected_remove_others", & + dataFillScheme="sincos", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + end subroutine + + !----------------------------------------------------------------------------- + + subroutine SetClock(model, rc) + type(ESMF_GridComp) :: model + integer, intent(out) :: rc + + ! local variables + type(ESMF_Clock) :: clock + type(ESMF_TimeInterval) :: stabilityTimeStep + + rc = ESMF_SUCCESS + + ! query for clock + call NUOPC_ModelGet(model, modelClock=clock, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! initialize internal clock + ! here: parent Clock and stability timeStep determine actual model timeStep + !TODO: stabilityTimeStep should be read in from configuation + !TODO: or computed from internal Grid information + call ESMF_TimeIntervalSet(stabilityTimeStep, m=5, rc=rc) ! 5 minute steps + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_CompSetClock(model, clock, stabilityTimeStep, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + end subroutine + + !----------------------------------------------------------------------------- + + subroutine Advance(model, rc) + type(ESMF_GridComp) :: model + integer, intent(out) :: rc + + ! local variables + type(ESMF_Clock) :: clock + type(ESMF_State) :: importState, exportState + type(ESMF_Time) :: currTime + type(ESMF_TimeInterval) :: timeStep + type(ESMF_Field) :: field + type(ESMF_StateItem_Flag) :: itemType + real(ESMF_KIND_R8), pointer :: dataPtr(:,:) + integer :: i,j + character(len=160) :: msgString + integer, save :: slice=1 + + rc = ESMF_SUCCESS + + ! query for clock, importState and exportState + call NUOPC_ModelGet(model, modelClock=clock, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep + + ! Because of the way that the internal Clock was set in SetClock(), + ! its timeStep is likely smaller than the parent timeStep. As a consequence + ! the time interval covered by a single parent timeStep will result in + ! multiple calls to the Advance() routine. Every time the currTime + ! will come in by one internal timeStep advanced. This goes until the + ! stopTime of the internal Clock has been reached. + + call ESMF_ClockPrint(clock, options="currTime", & + preString="------>Advancing OCN from: ", unit=msgString, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + call ESMF_TimePrint(currTime + timeStep, & + preString="---------------------> to: ", unit=msgString, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! update the "sst" field + call ESMF_StateGet(exportState, itemName="sst", itemType=itemType, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + if (itemType /= ESMF_STATEITEM_NOTFOUND) then + call ESMF_StateGet(exportState, itemName="sst", field=field, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_FieldGet(field, farrayPtr=dataPtr, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! dummy calculation to make the export field more interesting + do j=lbound(dataPtr,2),ubound(dataPtr,2) + do i=lbound(dataPtr,1),ubound(dataPtr,1) + dataPtr(i,j) = dataPtr(i,j) * 1.1 + enddo + enddo + endif + + ! write out the Fields in the importState + call NUOPC_Write(importState, fileNamePrefix="field_ocn_import_", & + timeslice=slice, overwrite=.true., relaxedFlag=.true., rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! write out the Fields in the exportState + call NUOPC_Write(exportState, fileNamePrefix="field_ocn_export_", & + timeslice=slice, overwrite=.true., relaxedFlag=.true., rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! advance the time slice counter + slice = slice + 1 + + end subroutine + + !----------------------------------------------------------------------------- + +end module diff --git a/ExternalDriverAPIWeakCplDAProto/ocnDA.F90 b/ExternalDriverAPIWeakCplDAProto/ocnDA.F90 new file mode 100644 index 00000000..bea0121d --- /dev/null +++ b/ExternalDriverAPIWeakCplDAProto/ocnDA.F90 @@ -0,0 +1,70 @@ +!============================================================================== +! Earth System Modeling Framework +! Copyright 2002-2021, University Corporation for Atmospheric Research, +! Massachusetts Institute of Technology, Geophysical Fluid Dynamics +! Laboratory, University of Michigan, National Centers for Environmental +! Prediction, Los Alamos National Laboratory, Argonne National Laboratory, +! NASA Goddard Space Flight Center. +! Licensed under the University of Illinois-NCSA License. +!============================================================================== + +module ocnDA + + !----------------------------------------------------------------------------- + ! OCN DA Code + !----------------------------------------------------------------------------- + + use MPI + use ESMF + use NUOPC + + use nuopc_da, only: & + nuopc_da_connect => connect, & + nuopc_da_drive => drive + + implicit none + + private + + public exec + + !----------------------------------------------------------------------------- + contains + !----------------------------------------------------------------------------- + + subroutine exec(comm) + integer :: comm + + integer :: rc + + call ESMF_LogWrite("Starting into OCN DA code", ESMF_LOGMSG_INFO, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + + ! Connect DA code with NUOPC system top component + call nuopc_da_connect(fmNuopcTopStandardNames=(/"sea_surface_temperature"/), & + rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + + !TODO: implement an explicit time loop here... + !TODO: call into component specific step + call nuopc_da_drive(rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + + call ESMF_LogWrite("Finished with OCN DA code", ESMF_LOGMSG_INFO, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + + end subroutine + +end module From 5e37db6c49f41dd154cb531c28d48e8f05b69c5e Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Tue, 4 May 2021 16:33:39 -0700 Subject: [PATCH 53/68] Implement explicit time stepping from within DA components. --- ExternalDriverAPIWeakCplDAProto/atmDA.F90 | 32 ++++- .../externalApp.F90 | 2 +- ExternalDriverAPIWeakCplDAProto/nuopc_da.F90 | 111 +++++++++++------- ExternalDriverAPIWeakCplDAProto/ocnDA.F90 | 32 ++++- 4 files changed, 124 insertions(+), 53 deletions(-) diff --git a/ExternalDriverAPIWeakCplDAProto/atmDA.F90 b/ExternalDriverAPIWeakCplDAProto/atmDA.F90 index 853584fd..d8d8e1f8 100644 --- a/ExternalDriverAPIWeakCplDAProto/atmDA.F90 +++ b/ExternalDriverAPIWeakCplDAProto/atmDA.F90 @@ -20,7 +20,7 @@ module atmDA use nuopc_da, only: & nuopc_da_connect => connect, & - nuopc_da_drive => drive + nuopc_da_step => step implicit none @@ -51,14 +51,38 @@ subroutine exec(comm) file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - !TODO: implement an explicit time loop here... - !TODO: call into component specific step - call nuopc_da_drive(rc=rc) + !--> explicitly unrolled time loop to demonstrate stepping more clearly + + call nuopc_da_step(tStart="2010-06-01T00:00:00", & + tFinal="2010-06-01T00:15:00", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) + call nuopc_da_step(tStart="2010-06-01T00:15:00", & + tFinal="2010-06-01T00:30:00", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + + call nuopc_da_step(tStart="2010-06-01T00:30:00", & + tFinal="2010-06-01T00:45:00", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + + call nuopc_da_step(tStart="2010-06-01T00:45:00", & + tFinal="2010-06-01T01:00:00", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + + !<-- end of explicitly unrolled time loop + call ESMF_LogWrite("Finished with ATM DA code", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & diff --git a/ExternalDriverAPIWeakCplDAProto/externalApp.F90 b/ExternalDriverAPIWeakCplDAProto/externalApp.F90 index e62df1d3..9d7f9127 100644 --- a/ExternalDriverAPIWeakCplDAProto/externalApp.F90 +++ b/ExternalDriverAPIWeakCplDAProto/externalApp.F90 @@ -29,7 +29,7 @@ program externalApp implicit none - integer :: rc, urc + integer :: rc integer :: size, rank integer :: splitComm diff --git a/ExternalDriverAPIWeakCplDAProto/nuopc_da.F90 b/ExternalDriverAPIWeakCplDAProto/nuopc_da.F90 index a251fb29..9ed3e3f3 100644 --- a/ExternalDriverAPIWeakCplDAProto/nuopc_da.F90 +++ b/ExternalDriverAPIWeakCplDAProto/nuopc_da.F90 @@ -26,7 +26,7 @@ module nuopc_da type(ESMF_State) :: toNuopcTop, fmNuopcTop type(ESMF_Clock) :: clock - public init, connect, drive, final + public init, connect, step, final !----------------------------------------------------------------------------- contains @@ -237,51 +237,74 @@ subroutine connect(toNuopcTopStandardNames, fmNuopcTopStandardNames, rc) !----------------------------------------------------------------------------- - subroutine drive(rc) - integer, intent(out) :: rc + subroutine step(tStart, tFinal, rc) + ! Take a step forward from start time to final time. + ! Different MPI ranks are allowed to call with different values for times. + ! On each MPI rank the method will block until tFinal has been reached by + ! the underlying coupled NUOPC system. + character(*), intent(in) :: tStart ! start time + character(*), intent(in) :: tFinal ! final time + integer, intent(out) :: rc - integer :: urc, phase, i + type(ESMF_Time) :: startTime, stopTime + type(ESMF_TimeInterval) :: timeStep + integer :: urc, i integer, save :: slice=1 - ! Explicit time stepping loop on the external level, here based on ESMF_Clock - do while (.not.ESMF_ClockIsStopTime(clock, rc=rc)) - ! Timestamp the fields in the toNuopcTop state - call NUOPC_SetTimestamp(toNuopcTop, clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__, rcToReturn=rc)) return - ! Run the earth system Component: i.e. step nuopcTop forward by timestep - call ESMF_GridCompRun(nuopcTop, clock=clock, & - importState=toNuopcTop, exportState=fmNuopcTop, & - userRc=urc, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) return - if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__, rcToReturn=rc)) return - ! Write out the Fields in the toNuopcTop - call NUOPC_Write(toNuopcTop, & - fileNamePrefix="field_toNuopcTop_", & - timeslice=slice, overwrite=.true., relaxedFlag=.true., rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__, rcToReturn=rc)) return - ! Write out the Fields in the fmNuopcTop after initialize - call NUOPC_Write(fmNuopcTop, & - fileNamePrefix="field_fmNuopcTop_", & - timeslice=slice, overwrite=.true., relaxedFlag=.true., rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__, rcToReturn=rc)) return - ! Increment the time slice counter - slice = slice + 1 - ! Advance the clock - call ESMF_ClockAdvance(clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__, rcToReturn=rc)) return - end do + call ESMF_TimeSet(startTime, timeString=tStart, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__, rcToReturn=rc)) return + + call ESMF_TimeSet(stopTime, timeString=tFinal, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__, rcToReturn=rc)) return + + timeStep = stopTime - startTime + + call ESMF_ClockSet(clock, currTime=startTime, stopTime=stopTime, & + timeStep=timeStep, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__, rcToReturn=rc)) return + + ! Timestamp the fields in the toNuopcTop state + call NUOPC_SetTimestamp(toNuopcTop, clock, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__, rcToReturn=rc)) return + ! Run the earth system Component: i.e. step nuopcTop forward by timestep + call ESMF_GridCompRun(nuopcTop, clock=clock, & + importState=toNuopcTop, exportState=fmNuopcTop, & + userRc=urc, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) return + if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__, rcToReturn=rc)) return + ! Write out the Fields in the toNuopcTop + call NUOPC_Write(toNuopcTop, & + fileNamePrefix="field_toNuopcTop_", & + timeslice=slice, overwrite=.true., relaxedFlag=.true., rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__, rcToReturn=rc)) return + ! Write out the Fields in the fmNuopcTop after initialize + call NUOPC_Write(fmNuopcTop, & + fileNamePrefix="field_fmNuopcTop_", & + timeslice=slice, overwrite=.true., relaxedFlag=.true., rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__, rcToReturn=rc)) return + ! Increment the time slice counter + slice = slice + 1 + ! Advance the clock + call ESMF_ClockAdvance(clock, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__, rcToReturn=rc)) return end subroutine @@ -290,7 +313,7 @@ subroutine drive(rc) subroutine final(rc) integer, intent(out) :: rc - integer :: urc, phase, i + integer :: urc, i ! Finalize the nuopcTop Component call ESMF_GridCompFinalize(nuopcTop, & diff --git a/ExternalDriverAPIWeakCplDAProto/ocnDA.F90 b/ExternalDriverAPIWeakCplDAProto/ocnDA.F90 index bea0121d..53fce6e4 100644 --- a/ExternalDriverAPIWeakCplDAProto/ocnDA.F90 +++ b/ExternalDriverAPIWeakCplDAProto/ocnDA.F90 @@ -20,7 +20,7 @@ module ocnDA use nuopc_da, only: & nuopc_da_connect => connect, & - nuopc_da_drive => drive + nuopc_da_step => step implicit none @@ -51,14 +51,38 @@ subroutine exec(comm) file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) - !TODO: implement an explicit time loop here... - !TODO: call into component specific step - call nuopc_da_drive(rc=rc) + !--> explicitly unrolled time loop to demonstrate stepping more clearly + + call nuopc_da_step(tStart="2010-06-01T00:00:00", & + tFinal="2010-06-01T00:15:00", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) + call nuopc_da_step(tStart="2010-06-01T00:15:00", & + tFinal="2010-06-01T00:30:00", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + + call nuopc_da_step(tStart="2010-06-01T00:30:00", & + tFinal="2010-06-01T00:45:00", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + + call nuopc_da_step(tStart="2010-06-01T00:45:00", & + tFinal="2010-06-01T01:00:00", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + + !<-- end of explicitly unrolled time loop + call ESMF_LogWrite("Finished with OCN DA code", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & From aa06385403609f92b04bd6a94cbbb0e5eb300ef6 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Tue, 4 May 2021 17:02:27 -0700 Subject: [PATCH 54/68] Finish the prototype, now fully supporting different time steps on different MPI ranks, yet driving the coupled system through the unified driver. --- ExternalDriverAPIWeakCplDAProto/README | 6 +- ExternalDriverAPIWeakCplDAProto/atmDA.F90 | 10 +- ExternalDriverAPIWeakCplDAProto/nuopc_da.F90 | 124 +++++++++++++------ ExternalDriverAPIWeakCplDAProto/ocnDA.F90 | 16 +-- 4 files changed, 92 insertions(+), 64 deletions(-) diff --git a/ExternalDriverAPIWeakCplDAProto/README b/ExternalDriverAPIWeakCplDAProto/README index e4194abd..b81e3342 100644 --- a/ExternalDriverAPIWeakCplDAProto/README +++ b/ExternalDriverAPIWeakCplDAProto/README @@ -1,8 +1,10 @@ README for External Driver API NUOPC for weakly coupled DA prototype -------------------------------------------------------------------- -A simple two model coupled system with a driver. Layered with the nuopc-da -interface layer, accessed independently by two DA systems: for ATM and OCN. +A simple two model coupled system with a driver, layered with the nuopc-da +interface, allowing access by two DA components (for ATM and OCN). +The time step method implemented by the nuopc-da layer supports independent +time steps on different MPI ranks. The nuopc-da interface is using the "External" Driver API to drive the coupled system. Fields are connected between the coupled system and the DA components. diff --git a/ExternalDriverAPIWeakCplDAProto/atmDA.F90 b/ExternalDriverAPIWeakCplDAProto/atmDA.F90 index d8d8e1f8..d57f5a54 100644 --- a/ExternalDriverAPIWeakCplDAProto/atmDA.F90 +++ b/ExternalDriverAPIWeakCplDAProto/atmDA.F90 @@ -53,6 +53,7 @@ subroutine exec(comm) !--> explicitly unrolled time loop to demonstrate stepping more clearly + ! take 15min timestep call nuopc_da_step(tStart="2010-06-01T00:00:00", & tFinal="2010-06-01T00:15:00", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -60,20 +61,15 @@ subroutine exec(comm) file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) + ! take 30min timestep call nuopc_da_step(tStart="2010-06-01T00:15:00", & - tFinal="2010-06-01T00:30:00", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - call nuopc_da_step(tStart="2010-06-01T00:30:00", & tFinal="2010-06-01T00:45:00", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) + ! take 15min timestep call nuopc_da_step(tStart="2010-06-01T00:45:00", & tFinal="2010-06-01T01:00:00", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & diff --git a/ExternalDriverAPIWeakCplDAProto/nuopc_da.F90 b/ExternalDriverAPIWeakCplDAProto/nuopc_da.F90 index 9ed3e3f3..1ec8b408 100644 --- a/ExternalDriverAPIWeakCplDAProto/nuopc_da.F90 +++ b/ExternalDriverAPIWeakCplDAProto/nuopc_da.F90 @@ -246,66 +246,108 @@ subroutine step(tStart, tFinal, rc) character(*), intent(in) :: tFinal ! final time integer, intent(out) :: rc - type(ESMF_Time) :: startTime, stopTime + type(ESMF_Time) :: startTime, stopTime, currTime type(ESMF_TimeInterval) :: timeStep - integer :: urc, i + integer :: urc, i, timeStepSec(1), timeStepSecMin(1) + type(ESMF_VM) :: vm integer, save :: slice=1 - call ESMF_TimeSet(startTime, timeString=tStart, rc=rc) + call ESMF_VMGetCurrent(vm, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__, rcToReturn=rc)) return - call ESMF_TimeSet(stopTime, timeString=tFinal, rc=rc) + call ESMF_TimeSet(startTime, timeString=tStart, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__, rcToReturn=rc)) return - timeStep = stopTime - startTime - - call ESMF_ClockSet(clock, currTime=startTime, stopTime=stopTime, & - timeStep=timeStep, rc=rc) + call ESMF_TimeSet(stopTime, timeString=tFinal, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__, rcToReturn=rc)) return - ! Timestamp the fields in the toNuopcTop state - call NUOPC_SetTimestamp(toNuopcTop, clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__, rcToReturn=rc)) return - ! Run the earth system Component: i.e. step nuopcTop forward by timestep - call ESMF_GridCompRun(nuopcTop, clock=clock, & - importState=toNuopcTop, exportState=fmNuopcTop, & - userRc=urc, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) return - if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__, rcToReturn=rc)) return - ! Write out the Fields in the toNuopcTop - call NUOPC_Write(toNuopcTop, & - fileNamePrefix="field_toNuopcTop_", & - timeslice=slice, overwrite=.true., relaxedFlag=.true., rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__, rcToReturn=rc)) return - ! Write out the Fields in the fmNuopcTop after initialize - call NUOPC_Write(fmNuopcTop, & - fileNamePrefix="field_fmNuopcTop_", & - timeslice=slice, overwrite=.true., relaxedFlag=.true., rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__, rcToReturn=rc)) return - ! Increment the time slice counter - slice = slice + 1 - ! Advance the clock - call ESMF_ClockAdvance(clock, rc=rc) + call ESMF_ClockSet(clock, currTime=startTime, stopTime=stopTime, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__, rcToReturn=rc)) return + do while (.not.ESMF_ClockIsStopTime(clock, rc=rc)) + + call ESMF_ClockGet(clock, currTime=currTime, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__, rcToReturn=rc)) return + + !TODO: would be good to check consistentcy of currTime across all ranks + + timeStep = stopTime - currTime + + call ESMF_TimeIntervalGet(timeStep, s=timeStepSec(1), rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__, rcToReturn=rc)) return + + call ESMF_VMAllReduce(vm, sendData=timeStepSec, recvData=timeStepSecMin, & + count=1, reduceflag=ESMF_REDUCE_MIN, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__, rcToReturn=rc)) return + + call ESMF_TimeIntervalSet(timeStep, s=timeStepSecMin(1), rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__, rcToReturn=rc)) return + + call ESMF_ClockSet(clock, timeStep=timeStep, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__, rcToReturn=rc)) return + + ! Timestamp the fields in the toNuopcTop state + call NUOPC_SetTimestamp(toNuopcTop, clock, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__, rcToReturn=rc)) return + + ! Run the earth system Component: i.e. step nuopcTop forward by timestep + call ESMF_GridCompRun(nuopcTop, clock=clock, & + importState=toNuopcTop, exportState=fmNuopcTop, & + userRc=urc, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) return + if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__, rcToReturn=rc)) return + + ! Write out the Fields in the toNuopcTop + call NUOPC_Write(toNuopcTop, & + fileNamePrefix="field_toNuopcTop_", & + timeslice=slice, overwrite=.true., relaxedFlag=.true., rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__, rcToReturn=rc)) return + + ! Write out the Fields in the fmNuopcTop after initialize + call NUOPC_Write(fmNuopcTop, & + fileNamePrefix="field_fmNuopcTop_", & + timeslice=slice, overwrite=.true., relaxedFlag=.true., rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__, rcToReturn=rc)) return + + ! Increment the time slice counter + slice = slice + 1 + + ! Advance the clock + call ESMF_ClockAdvance(clock, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__, rcToReturn=rc)) return + + enddo + end subroutine !----------------------------------------------------------------------------- diff --git a/ExternalDriverAPIWeakCplDAProto/ocnDA.F90 b/ExternalDriverAPIWeakCplDAProto/ocnDA.F90 index 53fce6e4..f858372c 100644 --- a/ExternalDriverAPIWeakCplDAProto/ocnDA.F90 +++ b/ExternalDriverAPIWeakCplDAProto/ocnDA.F90 @@ -53,28 +53,16 @@ subroutine exec(comm) !--> explicitly unrolled time loop to demonstrate stepping more clearly + ! take 30min timestep call nuopc_da_step(tStart="2010-06-01T00:00:00", & - tFinal="2010-06-01T00:15:00", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - call nuopc_da_step(tStart="2010-06-01T00:15:00", & tFinal="2010-06-01T00:30:00", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) + ! take 30min timestep call nuopc_da_step(tStart="2010-06-01T00:30:00", & - tFinal="2010-06-01T00:45:00", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, & - file=__FILE__)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) - - call nuopc_da_step(tStart="2010-06-01T00:45:00", & tFinal="2010-06-01T01:00:00", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & From 1414318c1249a5c12a3f7f8c95b366b2391259af Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Tue, 4 May 2021 17:18:41 -0700 Subject: [PATCH 55/68] Implement check for consistent currTime across MPI ranks to catch potential user errors. Improve comments. --- ExternalDriverAPIWeakCplDAProto/nuopc_da.F90 | 38 ++++++++++++++++---- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/ExternalDriverAPIWeakCplDAProto/nuopc_da.F90 b/ExternalDriverAPIWeakCplDAProto/nuopc_da.F90 index 1ec8b408..5f0edbe2 100644 --- a/ExternalDriverAPIWeakCplDAProto/nuopc_da.F90 +++ b/ExternalDriverAPIWeakCplDAProto/nuopc_da.F90 @@ -248,7 +248,8 @@ subroutine step(tStart, tFinal, rc) type(ESMF_Time) :: startTime, stopTime, currTime type(ESMF_TimeInterval) :: timeStep - integer :: urc, i, timeStepSec(1), timeStepSecMin(1) + integer :: urc, i + integer(ESMF_KIND_I8) :: sec(1), secMin(1) type(ESMF_VM) :: vm integer, save :: slice=1 @@ -257,48 +258,71 @@ subroutine step(tStart, tFinal, rc) line=__LINE__, & file=__FILE__, rcToReturn=rc)) return + ! Convert string to ESMF_Time call ESMF_TimeSet(startTime, timeString=tStart, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__, rcToReturn=rc)) return + ! Convert string to ESMF_Time call ESMF_TimeSet(stopTime, timeString=tFinal, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__, rcToReturn=rc)) return + ! Set the currTime and stopTime on Clock call ESMF_ClockSet(clock, currTime=startTime, stopTime=stopTime, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__, rcToReturn=rc)) return + ! Loop until the current MPI rank has reached the local stopTime, taking + ! time steps that are coordinated across all MPI ranks. do while (.not.ESMF_ClockIsStopTime(clock, rc=rc)) + ! Get the currTime as the basis for the next step call ESMF_ClockGet(clock, currTime=currTime, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__, rcToReturn=rc)) return - !TODO: would be good to check consistentcy of currTime across all ranks + ! Check for consistency of currTime across all MPI ranks + call ESMF_TimeGet(currTime, s_i8=sec(1), rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__, rcToReturn=rc)) return + call ESMF_VMAllReduce(vm, sendData=sec, recvData=secMin, & + count=1, reduceflag=ESMF_REDUCE_MIN, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__, rcToReturn=rc)) return + if (sec(1) > secMin(1)) then + call ESMF_LogSetError(ESMF_RC_INTNRL_INCONS, & + msg="Inconsistent currTime detected arcoss MPI ranks!", & + line=__LINE__, & + file=__FILE__, rcToReturn=rc) + return ! bail out + endif + ! Determine local timeStep timeStep = stopTime - currTime - call ESMF_TimeIntervalGet(timeStep, s=timeStepSec(1), rc=rc) + ! Determine consistent timeStep across all MPI ranks + call ESMF_TimeIntervalGet(timeStep, s_i8=sec(1), rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__, rcToReturn=rc)) return - - call ESMF_VMAllReduce(vm, sendData=timeStepSec, recvData=timeStepSecMin, & + call ESMF_VMAllReduce(vm, sendData=sec, recvData=secMin, & count=1, reduceflag=ESMF_REDUCE_MIN, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__, rcToReturn=rc)) return - - call ESMF_TimeIntervalSet(timeStep, s=timeStepSecMin(1), rc=rc) + call ESMF_TimeIntervalSet(timeStep, s_i8=secMin(1), rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__, rcToReturn=rc)) return + ! Set the consistent timeStep in Clock for the next step call ESMF_ClockSet(clock, timeStep=timeStep, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & From 39fed560234122d202497cbd5aa64673cda5def4 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Tue, 4 May 2021 17:29:18 -0700 Subject: [PATCH 56/68] Integrate new ExternalDriverAPIWeakCplDAProto into test script. --- testProtos.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/testProtos.sh b/testProtos.sh index 43be5f8e..5585d9d9 100755 --- a/testProtos.sh +++ b/testProtos.sh @@ -290,6 +290,7 @@ TestProto DriverInDriverDataDepProto mainApp TestProto DriverInDriverProto mainApp TestProto DynPhyProto esmApp TestProto ExternalDriverAPIProto externalApp +TestProto ExternalDriverAPIWeakCplDAProto externalApp TestProto GenericMediatorProto app TestProto HierarchyProto esmApp TestProto NamespaceProto mainApp From 3d70733aa8e204ebb3c6c08fa800903b117c9267 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Wed, 5 May 2021 15:34:14 -0700 Subject: [PATCH 57/68] Add new artifacts that should be ignored. --- .gitignore | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/.gitignore b/.gitignore index e5bd16dd..5fcfc6ce 100644 --- a/.gitignore +++ b/.gitignore @@ -694,6 +694,52 @@ ExternalDriverAPIProto/field_ocn_import_rsns.nc ExternalDriverAPIProto/field_ocn_import_sdhf.nc ExternalDriverAPIProto/ocn.mod ExternalDriverAPIProto/ocn.o +ExternalDriverAPIProto/field_atm_export_pmsl.nc +ExternalDriverAPIProto/field_atm_export_rsnl.nc +ExternalDriverAPIProto/field_atm_export_rsns.nc +ExternalDriverAPIProto/field_atm_export_sdhf.nc +ExternalDriverAPIProto/field_atm_import_precip.nc +ExternalDriverAPIProto/field_atm_import_sst.nc +ExternalDriverAPIProto/field_externalExportState_init_precipitation_flux.nc +ExternalDriverAPIProto/field_externalExportState_precipitation_flux.nc +ExternalDriverAPIProto/field_externalImportState_init_surface_net_downward_shortwave_flux.nc +ExternalDriverAPIProto/field_externalImportState_surface_net_downward_shortwave_flux.nc +ExternalDriverAPIWeakCplDAProto/PET0.ESMF_LogFile +ExternalDriverAPIWeakCplDAProto/PET1.ESMF_LogFile +ExternalDriverAPIWeakCplDAProto/PET2.ESMF_LogFile +ExternalDriverAPIWeakCplDAProto/PET3.ESMF_LogFile +ExternalDriverAPIWeakCplDAProto/atm.mod +ExternalDriverAPIWeakCplDAProto/atm.o +ExternalDriverAPIWeakCplDAProto/atmDA.o +ExternalDriverAPIWeakCplDAProto/atmda.mod +ExternalDriverAPIWeakCplDAProto/esm.mod +ExternalDriverAPIWeakCplDAProto/esm.o +ExternalDriverAPIWeakCplDAProto/externalApp +ExternalDriverAPIWeakCplDAProto/externalApp.o +ExternalDriverAPIWeakCplDAProto/externalApp.stdout +ExternalDriverAPIWeakCplDAProto/field_atm_export_pmsl.nc +ExternalDriverAPIWeakCplDAProto/field_atm_export_rsnl.nc +ExternalDriverAPIWeakCplDAProto/field_atm_export_rsns.nc +ExternalDriverAPIWeakCplDAProto/field_atm_export_sdhf.nc +ExternalDriverAPIWeakCplDAProto/field_atm_import_precip.nc +ExternalDriverAPIWeakCplDAProto/field_atm_import_sst.nc +ExternalDriverAPIWeakCplDAProto/field_fmNuopcTop_init_sea_surface_temperature.nc +ExternalDriverAPIWeakCplDAProto/field_fmNuopcTop_init_surface_net_downward_shortwave_flux.nc +ExternalDriverAPIWeakCplDAProto/field_fmNuopcTop_sea_surface_temperature.nc +ExternalDriverAPIWeakCplDAProto/field_fmNuopcTop_surface_net_downward_shortwave_flux.nc +ExternalDriverAPIWeakCplDAProto/field_ocn_export_sst.nc +ExternalDriverAPIWeakCplDAProto/field_ocn_import_pmsl.nc +ExternalDriverAPIWeakCplDAProto/field_ocn_import_rsnl.nc +ExternalDriverAPIWeakCplDAProto/field_ocn_import_rsns.nc +ExternalDriverAPIWeakCplDAProto/field_ocn_import_sdhf.nc +ExternalDriverAPIWeakCplDAProto/field_toNuopcTop_init_precipitation_flux.nc +ExternalDriverAPIWeakCplDAProto/field_toNuopcTop_precipitation_flux.nc +ExternalDriverAPIWeakCplDAProto/nuopc_da.mod +ExternalDriverAPIWeakCplDAProto/nuopc_da.o +ExternalDriverAPIWeakCplDAProto/ocn.mod +ExternalDriverAPIWeakCplDAProto/ocn.o +ExternalDriverAPIWeakCplDAProto/ocnDA.o +ExternalDriverAPIWeakCplDAProto/ocnda.mod GenericMediatorProto/PET0.ESMF_LogFile GenericMediatorProto/PET1.ESMF_LogFile GenericMediatorProto/PET2.ESMF_LogFile From 45a369b0ed6b68baee16e97c9607defd672cb969 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Fri, 21 May 2021 11:00:26 -0700 Subject: [PATCH 58/68] Small improvements. --- AtmOcnTransferGridProto/atm.F90 | 6 ++--- AtmOcnTransferGridProto/esmApp.F90 | 2 +- AtmOcnTransferGridProto/ocn.F90 | 17 +++++++++++++ AtmOcnTransferMeshProto/atm.F90 | 31 +++++++++++++++++------ AtmOcnTransferMeshProto/esmApp.F90 | 40 +++++++++++++++++++++++++++--- AtmOcnTransferMeshProto/ocn.F90 | 2 +- 6 files changed, 82 insertions(+), 16 deletions(-) diff --git a/AtmOcnTransferGridProto/atm.F90 b/AtmOcnTransferGridProto/atm.F90 index 394eeca7..a686a3ba 100644 --- a/AtmOcnTransferGridProto/atm.F90 +++ b/AtmOcnTransferGridProto/atm.F90 @@ -407,7 +407,7 @@ subroutine AcceptTransfer(model, rc) ! create the new DistGrid with the same minIndexPTile and maxIndexPTile, ! but use default multi-tile regDecomp - ! If the default regDecomp is not suitable, a custome one could be set + ! If the default regDecomp is not suitable, a custom one could be set ! up here and used. distgrid = ESMF_DistGridCreate(minIndexPTile=minIndexPTile, & maxIndexPTile=maxIndexPTile, connectionList=connectionList, rc=rc) @@ -419,7 +419,7 @@ subroutine AcceptTransfer(model, rc) deallocate(minIndexPTile, maxIndexPTile, connectionList) ! Create a new Grid on the new DistGrid - grid = ESMF_GridCreate(distgrid, rc=rc) + grid = ESMF_GridCreate(distgrid, name="ATM-custom-"//trim(name), rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -539,7 +539,7 @@ subroutine AcceptTransfer(model, rc) file=__FILE__)) & return ! bail out ! Create default regDecomp Grid - grid = ESMF_GridCreate(distgrid, rc=rc) + grid = ESMF_GridCreate(distgrid, name="ATM-custom-"//trim(name), rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & diff --git a/AtmOcnTransferGridProto/esmApp.F90 b/AtmOcnTransferGridProto/esmApp.F90 index 2aaba819..b717175f 100644 --- a/AtmOcnTransferGridProto/esmApp.F90 +++ b/AtmOcnTransferGridProto/esmApp.F90 @@ -101,6 +101,6 @@ program esmApp call ESMF_Finalize(endflag=ESMF_END_ABORT) ! Finalize ESMF - call ESMF_Finalize() + call ESMF_Finalize(rc=rc) end program diff --git a/AtmOcnTransferGridProto/ocn.F90 b/AtmOcnTransferGridProto/ocn.F90 index b2d5605b..f24449ac 100644 --- a/AtmOcnTransferGridProto/ocn.F90 +++ b/AtmOcnTransferGridProto/ocn.F90 @@ -848,6 +848,23 @@ subroutine Realize(model, rc) file=__FILE__)) & return ! bail out + ! clean-up + call ESMF_FieldDestroy(fieldArb, noGarbage=.true., rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_FieldDestroy(fieldAux, noGarbage=.true., rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_RouteHandleDestroy(rh, noGarbage=.true., rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + #ifdef TEST_MULTI_TILE_GRID ioComp = ESMFIO_Create(gridOut, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & diff --git a/AtmOcnTransferMeshProto/atm.F90 b/AtmOcnTransferMeshProto/atm.F90 index 99f44b24..4bdeaf98 100644 --- a/AtmOcnTransferMeshProto/atm.F90 +++ b/AtmOcnTransferMeshProto/atm.F90 @@ -230,6 +230,12 @@ subroutine RealizeProvided(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out + ! destroy the grid actually not needed + call ESMF_GridDestroy(gridIn, noGarbage=.true., rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out endif !NOTE: The air_pressure_at_sea_level (pmsl) Field is not realized here @@ -387,21 +393,23 @@ subroutine AcceptTransfer(model, rc) #if (defined USE_NODAL_DG && defined USE_ELEMENT_DG) ! Create a new Mesh on both new DistGrid mesh = ESMF_MeshEmptyCreate(nodalDistGrid=newNodalDG, & - elementDistGrid=newElementDG, name=name, rc=rc) + elementDistGrid=newElementDG, name="ATM-custom-"//trim(name), rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out #elif (defined USE_NODAL_DG) ! Create a new Mesh on new nodal DistGrid - mesh = ESMF_MeshEmptyCreate(nodalDistGrid=newNodalDG, name=name, rc=rc) + mesh = ESMF_MeshEmptyCreate(nodalDistGrid=newNodalDG, & + name="ATM-custom-"//trim(name), rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out #elif (defined USE_ELEMENT_DG) ! Create a new Mesh on new element DistGrid - mesh = ESMF_MeshEmptyCreate(elementDistGrid=newElementDG, name=name, rc=rc) + mesh = ESMF_MeshEmptyCreate(elementDistGrid=newElementDG, & + name="ATM-custom-"//trim(name), rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -452,7 +460,7 @@ subroutine AcceptTransfer(model, rc) #undef USE_NODAL_DG #undef USE_ELEMENT_DG -#define USE_NODAL_DG_off +#define USE_NODAL_DG #define USE_ELEMENT_DG #ifdef USE_NODAL_DG @@ -532,21 +540,23 @@ subroutine AcceptTransfer(model, rc) #if (defined USE_NODAL_DG && defined USE_ELEMENT_DG) ! Create a new Mesh on both new DistGrid mesh = ESMF_MeshEmptyCreate(nodalDistGrid=newNodalDG, & - elementDistGrid=newElementDG, name=name, rc=rc) + elementDistGrid=newElementDG, name="ATM-custom-"//trim(name), rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out #elif (defined USE_NODAL_DG) ! Create a new Mesh on new nodal DistGrid - mesh = ESMF_MeshEmptyCreate(nodalDistGrid=newNodalDG, name=name, rc=rc) + mesh = ESMF_MeshEmptyCreate(nodalDistGrid=newNodalDG, & + name="ATM-custom-"//trim(name), rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out #elif (defined USE_ELEMENT_DG) ! Create a new Mesh on new element DistGrid - mesh = ESMF_MeshEmptyCreate(elementDistGrid=newElementDG, name=name, rc=rc) + mesh = ESMF_MeshEmptyCreate(elementDistGrid=newElementDG, & + name="ATM-custom-"//trim(name), rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -727,6 +737,13 @@ subroutine RealizeAccepted(model, rc) file=__FILE__)) & return ! bail out + ! release the RouteHandle + call ESMF_FieldRegridRelease(rh, noGarbage=.true., rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! realize "sss" field in the importState, with transferred Mesh ! test the option here to specify an explicit typekind call NUOPC_Realize(importState, fieldName="sss", & diff --git a/AtmOcnTransferMeshProto/esmApp.F90 b/AtmOcnTransferMeshProto/esmApp.F90 index 2aaba819..55d5c558 100644 --- a/AtmOcnTransferMeshProto/esmApp.F90 +++ b/AtmOcnTransferMeshProto/esmApp.F90 @@ -22,6 +22,11 @@ program esmApp integer :: rc, urc type(ESMF_GridComp) :: esmComp +#define WITH_EXTERNAL_STATES__off +#ifdef WITH_EXTERNAL_STATES + type(ESMF_State) :: toESM, fmESM +#endif + ! Initialize ESMF call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, & defaultCalkind=ESMF_CALKIND_GREGORIAN, rc=rc) @@ -54,8 +59,27 @@ program esmApp file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) +#ifdef WITH_EXTERNAL_STATES + ! Created external states + toESM = ESMF_StateCreate(name="toESM", stateintent=ESMF_STATEINTENT_EXPORT, rc=rc) + if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + + fmESM = ESMF_StateCreate(name="fmESM", stateintent=ESMF_STATEINTENT_IMPORT, rc=rc) + if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) +#endif + ! Call Initialize for the earth system Component - call ESMF_GridCompInitialize(esmComp, userRc=urc, rc=rc) + call ESMF_GridCompInitialize(esmComp, & +#ifdef WITH_EXTERNAL_STATES + importState=toESM, exportState=fmESM, & +#endif + userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -66,7 +90,11 @@ program esmApp call ESMF_Finalize(endflag=ESMF_END_ABORT) ! Call Run for earth the system Component - call ESMF_GridCompRun(esmComp, userRc=urc, rc=rc) + call ESMF_GridCompRun(esmComp, & +#ifdef WITH_EXTERNAL_STATES + importState=toESM, exportState=fmESM, & +#endif + userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -77,7 +105,11 @@ program esmApp call ESMF_Finalize(endflag=ESMF_END_ABORT) ! Call Finalize for the earth system Component - call ESMF_GridCompFinalize(esmComp, userRc=urc, rc=rc) + call ESMF_GridCompFinalize(esmComp, & +#ifdef WITH_EXTERNAL_STATES + importState=toESM, exportState=fmESM, & +#endif + userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -101,6 +133,6 @@ program esmApp call ESMF_Finalize(endflag=ESMF_END_ABORT) ! Finalize ESMF - call ESMF_Finalize() + call ESMF_Finalize(rc=rc) end program diff --git a/AtmOcnTransferMeshProto/ocn.F90 b/AtmOcnTransferMeshProto/ocn.F90 index f90d436b..07c3aa7e 100644 --- a/AtmOcnTransferMeshProto/ocn.F90 +++ b/AtmOcnTransferMeshProto/ocn.F90 @@ -266,7 +266,7 @@ subroutine Realize(model, rc) #if (defined READ_MESHOUT_FROM_FILE && defined ESMF_NETCDF) ! create from file meshOut = ESMF_MeshCreate("./fv1.9x2.5_unstructured.nc", & - fileformat=ESMF_FILEFORMAT_ESMFMESH, name="OCN-GridOut", rc=rc) + fileformat=ESMF_FILEFORMAT_ESMFMESH, name="OCN-MeshOut", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & From 384ddc2524ecf1ef34fdfe01dfc54848d513a4f2 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Mon, 13 Sep 2021 10:22:13 -0700 Subject: [PATCH 59/68] Exercise and test the @@ RunSequence syntax. --- AtmOcnMedIngestFromInternalProto/esm.F90 | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/AtmOcnMedIngestFromInternalProto/esm.F90 b/AtmOcnMedIngestFromInternalProto/esm.F90 index d0ac5807..6bb9cd69 100644 --- a/AtmOcnMedIngestFromInternalProto/esm.F90 +++ b/AtmOcnMedIngestFromInternalProto/esm.F90 @@ -94,8 +94,8 @@ subroutine SetModelServices(driver, rc) ! set up free format driver attributes attrFF = NUOPC_FreeFormatCreate(stringList=(/ & - "Verbosity = 1", & - "Profiling = 0" /), & + "Verbosity = high", & + "Profiling = 0 " /), & rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -273,10 +273,16 @@ subroutine SetRunSequence(driver, rc) " MED ", & " MED -> ATM ", & " MED -> OCN ", & - " ATM ", & - " OCN ", & - " ATM -> MED ", & + " @@3600 ", & + " ATM ", & + " OCN ", & + " @1800 ", & + " ATM -> MED ", & + " @ ", & + " @@ ", & + " @@3600 ", & " OCN -> MED ", & + " @@ ", & " MED ", & " @ " /), & rc=rc) @@ -298,7 +304,7 @@ subroutine SetRunSequence(driver, rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, file=trim(name)//":"//__FILE__)) return ! bail out -#if 0 +#if 1 ! Diagnostic output call NUOPC_DriverPrint(driver, orderflag=.true., rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & From db4057cb2e81bc644be96e7b5fa4fda5801e6fc4 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Mon, 13 Sep 2021 10:49:13 -0700 Subject: [PATCH 60/68] Testing reading from Config during ESMF_Initialize(), and 'globalResourceControl'. --- AtmOcnPetListProto/atm.F90 | 6 ++++++ AtmOcnPetListProto/esm.F90 | 28 ++++++++++++++++++++++++---- AtmOcnPetListProto/esmApp.F90 | 25 +++++++++++++++++++++++-- AtmOcnPetListProto/nuopc.configure | 3 +++ AtmOcnPetListProto/ocn.F90 | 6 ++++++ 5 files changed, 62 insertions(+), 6 deletions(-) create mode 100644 AtmOcnPetListProto/nuopc.configure diff --git a/AtmOcnPetListProto/atm.F90 b/AtmOcnPetListProto/atm.F90 index be719494..1ba8c1b9 100644 --- a/AtmOcnPetListProto/atm.F90 +++ b/AtmOcnPetListProto/atm.F90 @@ -223,6 +223,12 @@ subroutine Advance(model, rc) file=__FILE__)) & return ! bail out + call ESMF_VMLog(vm, "ATM Advance(): ", ESMF_LOGMSG_INFO, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! Now can use OpenMP for fine grained parallelism... ! Here just write info about the PET-local OpenMP threads to Log. !$omp parallel private(msgString, currentSsiPe) diff --git a/AtmOcnPetListProto/esm.F90 b/AtmOcnPetListProto/esm.F90 index 94f7d084..e19ef0ff 100644 --- a/AtmOcnPetListProto/esm.F90 +++ b/AtmOcnPetListProto/esm.F90 @@ -100,7 +100,13 @@ subroutine SetModelServices(driver, rc) return ! bail out ! get the petCount - call ESMF_GridCompGet(driver, petCount=petCount, rc=rc) + call ESMF_GridCompGet(driver, petCount=petCount, vm=vm, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + call ESMF_VMLog(vm, "ESM SetModelServices() enter: ", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -200,14 +206,17 @@ subroutine SetModelServices(driver, rc) do i=1, petCount/2 petList(i) = petCount/2 + i-1 ! PET labeling goes from 0 to petCount-1 enddo - call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/MaxCount", value=2, & + call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/MaxCount", value=3, & rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_DriverAddComp(driver, "OCN", ocnSS, ocnSVM, info=info, & - petList=petList, comp=child, rc=rc) + call NUOPC_DriverAddComp(driver, "OCN", ocnSS, & + ocnSVM, & + info=info, & +! petList=petList, & + comp=child, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -323,6 +332,17 @@ subroutine SetModelServices(driver, rc) file=__FILE__)) & return ! bail out + call ESMF_GridCompGet(driver, vm=vm, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_VMLog(vm, "ESM SetModelServices() exit: ", ESMF_LOGMSG_INFO, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + end subroutine !----------------------------------------------------------------------------- diff --git a/AtmOcnPetListProto/esmApp.F90 b/AtmOcnPetListProto/esmApp.F90 index 2aaba819..294edccb 100644 --- a/AtmOcnPetListProto/esmApp.F90 +++ b/AtmOcnPetListProto/esmApp.F90 @@ -21,10 +21,13 @@ program esmApp integer :: rc, urc type(ESMF_GridComp) :: esmComp + type(ESMF_VM) :: vm ! Initialize ESMF - call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, & - defaultCalkind=ESMF_CALKIND_GREGORIAN, rc=rc) + call ESMF_Initialize(& + defaultConfigFileName="nuopc.configure", & + defaultCalkind=ESMF_CALKIND_GREGORIAN, & + vm=vm, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -36,6 +39,12 @@ program esmApp file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) + call ESMF_VMLog(vm, "esmApp VM init: ", ESMF_LOGMSG_INFO, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + ! Create the earth system Component esmComp = ESMF_GridCompCreate(name="esm", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -65,6 +74,12 @@ program esmApp file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) + call ESMF_VMLog(vm, "esmApp VM: ", ESMF_LOGMSG_INFO, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + ! Call Run for earth the system Component call ESMF_GridCompRun(esmComp, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -94,6 +109,12 @@ program esmApp file=__FILE__)) & call ESMF_Finalize(endflag=ESMF_END_ABORT) + call ESMF_VMLog(vm, "esmApp VM final: ", ESMF_LOGMSG_INFO, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + call ESMF_Finalize(endflag=ESMF_END_ABORT) + call ESMF_LogWrite("esmApp FINISHED", ESMF_LOGMSG_INFO, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & diff --git a/AtmOcnPetListProto/nuopc.configure b/AtmOcnPetListProto/nuopc.configure new file mode 100644 index 00000000..432284a3 --- /dev/null +++ b/AtmOcnPetListProto/nuopc.configure @@ -0,0 +1,3 @@ +globalResourceControl: .true. +logKindFlag: ESMF_LOGKIND_MULTI +logAppendFlag: .true. diff --git a/AtmOcnPetListProto/ocn.F90 b/AtmOcnPetListProto/ocn.F90 index dffddccf..fa8cd568 100644 --- a/AtmOcnPetListProto/ocn.F90 +++ b/AtmOcnPetListProto/ocn.F90 @@ -268,6 +268,12 @@ subroutine Advance(model, rc) file=__FILE__)) & return ! bail out + call ESMF_VMLog(vm, "OCN Advance(): ", ESMF_LOGMSG_INFO, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! Now can use OpenMP for fine grained parallelism... ! Here just write info about the PET-local OpenMP threads to Log. !$omp parallel private(msgString, currentSsiPe) From d288f57dc2423cc9f273ead79b787fcb4967829b Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Mon, 13 Sep 2021 12:42:55 -0700 Subject: [PATCH 61/68] Add testing for fields on Mesh and LocStream. --- AtmOcnPetListProto/atm.F90 | 180 +++++++++++++++++++++++++++++++++++-- AtmOcnPetListProto/esm.F90 | 83 ++++++++++++++++- AtmOcnPetListProto/ocn.F90 | 180 +++++++++++++++++++++++++++++++++++-- 3 files changed, 428 insertions(+), 15 deletions(-) diff --git a/AtmOcnPetListProto/atm.F90 b/AtmOcnPetListProto/atm.F90 index 1ba8c1b9..d47a9076 100644 --- a/AtmOcnPetListProto/atm.F90 +++ b/AtmOcnPetListProto/atm.F90 @@ -95,6 +95,22 @@ subroutine Advertise(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out + + ! importable field: sea_surface_salinity + call NUOPC_Advertise(importState, & + StandardName="sea_surface_salinity", name="sss", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! importable field: sea_surface_height_above_sea_level + call NUOPC_Advertise(importState, & + StandardName="sea_surface_height_above_sea_level", name="ssh", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out #endif ! exportable field: air_pressure_at_sea_level @@ -113,6 +129,14 @@ subroutine Advertise(model, rc) file=__FILE__)) & return ! bail out + ! exportable field: precipitation_flux + call NUOPC_Advertise(exportState, & + StandardName="precipitation_flux", name="precip", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + end subroutine !----------------------------------------------------------------------------- @@ -124,8 +148,15 @@ subroutine Realize(model, rc) ! local variables type(ESMF_State) :: importState, exportState type(ESMF_Field) :: field - type(ESMF_Grid) :: gridIn - type(ESMF_Grid) :: gridOut + type(ESMF_Grid) :: gridIn, gridOut + type(ESMF_Mesh) :: meshIn, meshOut + type(ESMF_LocStream) :: locsIn, locsOut + + integer, parameter :: totalNumPoints=100 + integer(ESMF_KIND_I4), pointer :: mask(:) + real(ESMF_KIND_R8), pointer :: lon(:), lat(:) + real(ESMF_KIND_R8), pointer :: fptr(:) + integer :: clb(1), cub(1), i rc = ESMF_SUCCESS @@ -137,11 +168,12 @@ subroutine Realize(model, rc) file=__FILE__)) & return ! bail out - ! create a Grid object for Fields + ! create Grid objects for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/10, 100/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & maxCornerCoord=(/100._ESMF_KIND_R8, 200._ESMF_KIND_R8/), & - coordSys=ESMF_COORDSYS_CART, staggerLocList=(/ESMF_STAGGERLOC_CENTER/), & + coordSys=ESMF_COORDSYS_CART, & + staggerLocList=(/ESMF_STAGGERLOC_CENTER, ESMF_STAGGERLOC_CORNER/), & rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -149,8 +181,87 @@ subroutine Realize(model, rc) return ! bail out gridOut = gridIn ! for now out same as in + ! create Mesh objects for Fields + meshIn = ESMF_MeshCreate(grid=gridIn, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + meshOut = ESMF_MeshCreate(grid=gridOut, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! create LocStream objects for Fields + locsIn=ESMF_LocStreamCreate(name="Equatorial Measurements", & + maxIndex=totalNumPoints, coordSys=ESMF_COORDSYS_SPH_DEG, & + indexFlag=ESMF_INDEX_GLOBAL, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! Add key data (internally allocating memory). + call ESMF_LocStreamAddKey(locsIn, & + keyName="ESMF:Lat", & + KeyTypeKind=ESMF_TYPEKIND_R8, & + keyUnits="Degrees", & + keyLongName="Latitude", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_LocStreamAddKey(locsIn, & + keyName="ESMF:Lon", & + KeyTypeKind=ESMF_TYPEKIND_R8, & + keyUnits="Degrees", & + keyLongName="Longitude", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_LocStreamAddKey(locsIn, & + keyName="ESMF:Mask", & + KeyTypeKind=ESMF_TYPEKIND_I4, & + keyUnits="none", & + keyLongName="mask values", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! Get coordinate memory + call ESMF_LocStreamGetKey(locsIn, & + localDE=0, & + keyName="ESMF:Lat", & + farray=lat, & + rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_LocStreamGetKey(locsIn, & + localDE=0, & + keyName="ESMF:Lon", & + farray=lon, & + rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! Get mask memory + call ESMF_LocStreamGetKey(locsIn, & + localDE=0, & + keyName="ESMF:Mask", & + farray=mask, & + rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + locsOut = locsIn ! for now out same as in + #ifdef WITHIMPORTFIELDS - ! importable field: sea_surface_temperature + ! importable field on Grid: sea_surface_temperature field = ESMF_FieldCreate(name="sst", grid=gridIn, & typekind=ESMF_TYPEKIND_R8, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -162,9 +273,51 @@ subroutine Realize(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out + + ! importable field on Grid: sea_surface_salinity + field = ESMF_FieldCreate(name="sss", mesh=meshIn, & + typekind=ESMF_TYPEKIND_R8, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_Realize(importState, field=field, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! importable field on LocStream: sea_surface_height_above_sea_level + field = ESMF_FieldCreate(name="ssh", locstream=locsIn, & + typekind=ESMF_TYPEKIND_R8, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_Realize(importState, field=field, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! Get Field memory + call ESMF_FieldGet(field, localDe=0, farrayPtr=fptr, & + computationalLBound=clb, computationalUBound=cub, rc=rc) + ! Set coordinate data and field data + do i=clb(1),cub(1) + lon(i)=(i-1)*360.0/REAL(totalNumPoints) + lat(i)=0.0 + fptr(i)=0.0 ! Init to 0.0 + mask(i)=0 + ! Mask out range + ! (Same range as in ocn.F90) + if ((lon(i) > 10.0) .and. (lon(i) < 20.0)) then + mask(i)=2 + endif + enddo + #endif - ! exportable field: air_pressure_at_sea_level + ! exportable field on Grid: air_pressure_at_sea_level field = ESMF_FieldCreate(name="pmsl", grid=gridOut, & typekind=ESMF_TYPEKIND_R8, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -177,7 +330,7 @@ subroutine Realize(model, rc) file=__FILE__)) & return ! bail out - ! exportable field: surface_net_downward_shortwave_flux + ! exportable field on Grid: surface_net_downward_shortwave_flux field = ESMF_FieldCreate(name="rsns", grid=gridOut, & typekind=ESMF_TYPEKIND_R8, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -190,6 +343,19 @@ subroutine Realize(model, rc) file=__FILE__)) & return ! bail out + ! exportable field on Grid: precipitation_flux + field = ESMF_FieldCreate(name="precip", mesh=meshOut, & + typekind=ESMF_TYPEKIND_R8, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_Realize(exportState, field=field, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + end subroutine !----------------------------------------------------------------------------- diff --git a/AtmOcnPetListProto/esm.F90 b/AtmOcnPetListProto/esm.F90 index e19ef0ff..c9303b43 100644 --- a/AtmOcnPetListProto/esm.F90 +++ b/AtmOcnPetListProto/esm.F90 @@ -55,6 +55,12 @@ subroutine SetServices(driver, rc) line=__LINE__, & file=__FILE__)) & return ! bail out + call NUOPC_CompSpecialize(driver, specLabel=label_ModifyCplLists, & + specRoutine=ModifyCplLists, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out ! set driver verbosity call NUOPC_CompAttributeSet(driver, name="Verbosity", value="high", rc=rc) @@ -215,7 +221,7 @@ subroutine SetModelServices(driver, rc) call NUOPC_DriverAddComp(driver, "OCN", ocnSS, & ocnSVM, & info=info, & -! petList=petList, & + petList=petList, & comp=child, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -347,4 +353,79 @@ subroutine SetModelServices(driver, rc) !----------------------------------------------------------------------------- + subroutine ModifyCplLists(driver, rc) + type(ESMF_GridComp) :: driver + integer, intent(out) :: rc + + ! local variables + character(len=160) :: msg + type(ESMF_CplComp), pointer :: connectorList(:) + integer :: i, j, cplListSize + character(len=160), allocatable :: cplList(:) + character(len=160) :: tempString + + rc = ESMF_SUCCESS + + call ESMF_LogWrite("Driver is in ModifyCplLists()", ESMF_LOGMSG_INFO, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + nullify(connectorList) + call NUOPC_DriverGetComp(driver, compList=connectorList, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + write (msg,*) "Found ", size(connectorList), " Connectors."// & + " Modifying CplList Attribute...." + call ESMF_LogWrite(trim(msg), ESMF_LOGMSG_INFO, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + do i=1, size(connectorList) + ! query the cplList for connector i + call NUOPC_CompAttributeGet(connectorList(i), name="CplList", & + itemCount=cplListSize, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + if (cplListSize>0) then + allocate(cplList(cplListSize)) + call NUOPC_CompAttributeGet(connectorList(i), name="CplList", & + valueList=cplList, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! go through all of the entries in the cplList + do j=1, cplListSize + if (trim(cplList(j))=="sea_surface_height_above_sea_level") then + ! switch to ESMF_REGRIDMETHOD_NEAREST_STOD + cplList(j) = trim(cplList(j))//":REMAPMETHOD=nearest_stod"// & + ":srcMaskValues=1:dstMaskValues=2" + endif + enddo + ! store the modified cplList in CplList attribute of connector i + call NUOPC_CompAttributeSet(connectorList(i), & + name="CplList", valueList=cplList, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + deallocate(cplList) + endif + enddo + + deallocate(connectorList) + + end subroutine + + !----------------------------------------------------------------------------- + end module diff --git a/AtmOcnPetListProto/ocn.F90 b/AtmOcnPetListProto/ocn.F90 index fa8cd568..566be166 100644 --- a/AtmOcnPetListProto/ocn.F90 +++ b/AtmOcnPetListProto/ocn.F90 @@ -109,6 +109,14 @@ subroutine Advertise(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out + + ! importable field: precipitation_flux + call NUOPC_Advertise(importState, & + StandardName="precipitation_flux", name="precip", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out #endif ! exportable field: sea_surface_temperature @@ -119,6 +127,22 @@ subroutine Advertise(model, rc) file=__FILE__)) & return ! bail out + ! exportable field: sea_surface_salinity + call NUOPC_Advertise(exportState, & + StandardName="sea_surface_salinity", name="sss", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! exportable field: sea_surface_height_above_sea_level + call NUOPC_Advertise(exportState, & + StandardName="sea_surface_height_above_sea_level", name="ssh", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + end subroutine !----------------------------------------------------------------------------- @@ -131,8 +155,15 @@ subroutine Realize(model, rc) type(ESMF_State) :: importState, exportState type(ESMF_TimeInterval) :: stabilityTimeStep type(ESMF_Field) :: field - type(ESMF_Grid) :: gridIn - type(ESMF_Grid) :: gridOut + type(ESMF_Grid) :: gridIn, gridOut + type(ESMF_Mesh) :: meshIn, meshOut + type(ESMF_LocStream) :: locsIn, locsOut + + integer, parameter :: totalNumPoints=100 + integer(ESMF_KIND_I4), pointer :: mask(:) + real(ESMF_KIND_R8), pointer :: lon(:), lat(:) + real(ESMF_KIND_R8), pointer :: fptr(:) + integer :: clb(1), cub(1), i rc = ESMF_SUCCESS @@ -144,11 +175,12 @@ subroutine Realize(model, rc) file=__FILE__)) & return ! bail out - ! create a Grid object for Fields + ! create Grid objects for Fields gridIn = ESMF_GridCreateNoPeriDimUfrm(maxIndex=(/100, 20/), & minCornerCoord=(/10._ESMF_KIND_R8, 20._ESMF_KIND_R8/), & maxCornerCoord=(/100._ESMF_KIND_R8, 200._ESMF_KIND_R8/), & - coordSys=ESMF_COORDSYS_CART, staggerLocList=(/ESMF_STAGGERLOC_CENTER/), & + coordSys=ESMF_COORDSYS_CART, & + staggerLocList=(/ESMF_STAGGERLOC_CENTER, ESMF_STAGGERLOC_CORNER/), & rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -156,8 +188,87 @@ subroutine Realize(model, rc) return ! bail out gridOut = gridIn ! for now out same as in + ! create Mesh objects for Fields + meshIn = ESMF_MeshCreate(grid=gridIn, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + meshOut = ESMF_MeshCreate(grid=gridOut, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! create LocStream objects for Fields + locsIn=ESMF_LocStreamCreate(name="Equatorial Measurements", & + maxIndex=totalNumPoints, coordSys=ESMF_COORDSYS_SPH_DEG, & + indexFlag=ESMF_INDEX_GLOBAL, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! Add key data (internally allocating memory). + call ESMF_LocStreamAddKey(locsIn, & + keyName="ESMF:Lat", & + KeyTypeKind=ESMF_TYPEKIND_R8, & + keyUnits="Degrees", & + keyLongName="Latitude", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_LocStreamAddKey(locsIn, & + keyName="ESMF:Lon", & + KeyTypeKind=ESMF_TYPEKIND_R8, & + keyUnits="Degrees", & + keyLongName="Longitude", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_LocStreamAddKey(locsIn, & + keyName="ESMF:Mask", & + KeyTypeKind=ESMF_TYPEKIND_I4, & + keyUnits="none", & + keyLongName="mask values", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! Get coordinate memory + call ESMF_LocStreamGetKey(locsIn, & + localDE=0, & + keyName="ESMF:Lat", & + farray=lat, & + rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_LocStreamGetKey(locsIn, & + localDE=0, & + keyName="ESMF:Lon", & + farray=lon, & + rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! Get mask memory + call ESMF_LocStreamGetKey(locsIn, & + localDE=0, & + keyName="ESMF:Mask", & + farray=mask, & + rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + locsOut = locsIn ! for now out same as in + #ifdef WITHIMPORTFIELDS - ! importable field: air_pressure_at_sea_level + ! importable field on Grid: air_pressure_at_sea_level field = ESMF_FieldCreate(name="pmsl", grid=gridIn, & typekind=ESMF_TYPEKIND_R8, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -170,7 +281,7 @@ subroutine Realize(model, rc) file=__FILE__)) & return ! bail out - ! importable field: surface_net_downward_shortwave_flux + ! importable field on Grid: surface_net_downward_shortwave_flux field = ESMF_FieldCreate(name="rsns", grid=gridIn, & typekind=ESMF_TYPEKIND_R8, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -182,9 +293,22 @@ subroutine Realize(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out + + ! importable field on Grid: precipitation_flux + field = ESMF_FieldCreate(name="precip", mesh=meshIn, & + typekind=ESMF_TYPEKIND_R8, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_Realize(importState, field=field, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out #endif - ! exportable field: sea_surface_temperature + ! exportable field on Grid: sea_surface_temperature field = ESMF_FieldCreate(name="sst", grid=gridOut, & typekind=ESMF_TYPEKIND_R8, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -197,6 +321,48 @@ subroutine Realize(model, rc) file=__FILE__)) & return ! bail out + ! exportable field on Mesh: sea_surface_salinity + field = ESMF_FieldCreate(name="sss", mesh=meshOut, & + typekind=ESMF_TYPEKIND_R8, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_Realize(exportState, field=field, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! exportable field on LocStream: sea_surface_height_above_sea_level + field = ESMF_FieldCreate(name="ssh", locstream=locsOut, & + typekind=ESMF_TYPEKIND_R8, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_Realize(exportState, field=field, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! Get Field memory + call ESMF_FieldGet(field, localDe=0, farrayPtr=fptr, & + computationalLBound=clb, computationalUBound=cub, rc=rc) + ! Set coordinate data and field data + do i=clb(1),cub(1) + lon(i)=(i-1)*360.0/REAL(totalNumPoints) + lat(i)=0.0 + fptr(i)=lon(i)/360.0 ! Just set it to this for testing + mask(i)=0 + ! Mask out range and make data bad + ! (Same range as in atm.F90) + if ((lon(i) > 10.0) .and. (lon(i) < 20.0)) then + mask(i)=1 + fptr(i)=-10000.0 ! Bad value to check that mask works + endif + enddo + end subroutine !----------------------------------------------------------------------------- From 65811bdc650dc2e273954b3417cf0d964b7aa57a Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Tue, 21 Sep 2021 14:39:41 -0700 Subject: [PATCH 62/68] Use the ESMF_INTERNAL_MPIRUN variable from esmf.mk for launching MPI. --- testProtos.sh | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/testProtos.sh b/testProtos.sh index 5585d9d9..350f97c5 100755 --- a/testProtos.sh +++ b/testProtos.sh @@ -10,8 +10,9 @@ # Licensed under the University of Illinois-NCSA License. #============================================================================== -MPIRUN="mpirun -np" -#MPIRUN="srun -n" +# Obtain ESMF_INTERNAL_MPIRUN from esmf.mk +command=`grep ESMF_INTERNAL_MPIRUN $ESMFMKFILE` +eval $command #TOOLRUN="valgrind --leak-check=full" @@ -26,7 +27,7 @@ cd $1 make distclean make set -x -$MPIRUN 4 $TOOLRUN ./$2 > $2.stdout 2>&1 +$ESMF_INTERNAL_MPIRUN -np 4 $TOOLRUN ./$2 > $2.stdout 2>&1 local result=$? set +x if [ $result -eq 0 ] @@ -57,7 +58,7 @@ make distclean make for arg in "${ARGS[@]}"; do set -x -$MPIRUN 4 $TOOLRUN ./$2 $arg > $2.$arg.stdout 2>&1 +$ESMF_INTERNAL_MPIRUN -np 4 $TOOLRUN ./$2 $arg > $2.$arg.stdout 2>&1 local result=$? set +x if [ $result -ne 0 ] @@ -87,7 +88,7 @@ echo "OCN_SELECT: A" > esm.config ((count++)) testList[count]=$1 set -x -$MPIRUN 4 $TOOLRUN ./$2 > $2.stdout 2>&1 +$ESMF_INTERNAL_MPIRUN -np 4 $TOOLRUN ./$2 > $2.stdout 2>&1 local result=$? set +x if [ $result -eq 0 ] @@ -103,7 +104,7 @@ echo "OCN_SELECT: A" > esm.config ((count++)) testList[count]=$1 set -x -$MPIRUN 4 $TOOLRUN ./$2 > $2.stdout 2>&1 +$ESMF_INTERNAL_MPIRUN -np 4 $TOOLRUN ./$2 > $2.stdout 2>&1 local result=$? set +x if [ $result -eq 0 ] @@ -119,7 +120,7 @@ echo "OCN_SELECT: B" > esm.config ((count++)) testList[count]=$1 set -x -$MPIRUN 4 $TOOLRUN ./$2 > $2.stdout 2>&1 +$ESMF_INTERNAL_MPIRUN -np 4 $TOOLRUN ./$2 > $2.stdout 2>&1 local result=$? set +x if [ $result -eq 0 ] @@ -146,7 +147,7 @@ echo "OCN_SELECT: A" > esm.config ((count++)) testList[count]=$1 set -x -$MPIRUN 4 $TOOLRUN ./$2 > $2.stdout 2>&1 +$ESMF_INTERNAL_MPIRUN -np 4 $TOOLRUN ./$2 > $2.stdout 2>&1 local result=$? set +x if [ $result -eq 0 ] @@ -162,7 +163,7 @@ echo "OCN_SELECT: B" > esm.config ((count++)) testList[count]=$1 set -x -$MPIRUN 4 $TOOLRUN ./$2 > $2.stdout 2>&1 +$ESMF_INTERNAL_MPIRUN -np 4 $TOOLRUN ./$2 > $2.stdout 2>&1 local result=$? set +x if [ $result -eq 0 ] @@ -178,7 +179,7 @@ echo "OCN_SELECT: C" > esm.config ((count++)) testList[count]=$1 set -x -$MPIRUN 4 $TOOLRUN ./$2 > $2.stdout 2>&1 +$ESMF_INTERNAL_MPIRUN -np 4 $TOOLRUN ./$2 > $2.stdout 2>&1 local result=$? set +x if [ $result -eq 0 ] @@ -194,7 +195,7 @@ echo "OCN_SELECT: A" > esm.config ((count++)) testList[count]=$1 set -x -$MPIRUN 4 $TOOLRUN ./$2 > $2.stdout 2>&1 +$ESMF_INTERNAL_MPIRUN -np 4 $TOOLRUN ./$2 > $2.stdout 2>&1 local result=$? set +x if [ $result -eq 0 ] @@ -211,7 +212,7 @@ echo "OCN_SELECT: B" > esm.config ((count++)) testList[count]=$1 set -x -$MPIRUN 4 $TOOLRUN ./$2 > $2.stdout 2>&1 +$ESMF_INTERNAL_MPIRUN -np 4 $TOOLRUN ./$2 > $2.stdout 2>&1 local result=$? set +x if [ $result -eq 0 ] @@ -224,7 +225,7 @@ echo make clean make ATM=F OCN=A,B,C echo "OCN_SELECT: C" > esm.config -#$MPIRUN 4 ./$2 --- cannot run this because atmF is not fully implemented +#$ESMF_INTERNAL_MPIRUN -np 4 ./$2 --- cannot run this because atmF is not fully implemented echo FINISHED: $1 cd .. echo --------------------------------------------------------------------------- @@ -240,7 +241,7 @@ cd $1 make distclean set -x ./nuopcExplorerScript ../AtmOcnSelectExternalProto/ATM-A/atmA.mk -$MPIRUN 4 $TOOLRUN ./$2 > $2.stdout 2>&1 +$ESMF_INTERNAL_MPIRUN -np 4 $TOOLRUN ./$2 > $2.stdout 2>&1 local result=$? set +x if [ $result -eq 0 ] @@ -313,4 +314,4 @@ echo "== TEST SUMMARY STOP ==" echo echo --------------------------------------------------------------------------- -grep ERROR */PET*.ESMF_LogFile +grep " ERROR " */PET*.ESMF_LogFile From 85d7eccbf8404331919edd6f556583f539d52257 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Tue, 21 Sep 2021 16:30:30 -0700 Subject: [PATCH 63/68] Fix Fortran issue with "return" from within main program. --- ExternalDriverAPIProto/externalApp.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ExternalDriverAPIProto/externalApp.F90 b/ExternalDriverAPIProto/externalApp.F90 index f660b1ea..e75107c1 100644 --- a/ExternalDriverAPIProto/externalApp.F90 +++ b/ExternalDriverAPIProto/externalApp.F90 @@ -207,14 +207,14 @@ program externalApp if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & - return ! bail out + call ESMF_Finalize(endflag=ESMF_END_ABORT) if (itemType /= ESMF_STATEITEM_NOTFOUND) then call ESMF_StateGet(externalExportState, itemName="precipitation_flux", & field=field, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & - return ! bail out + call ESMF_Finalize(endflag=ESMF_END_ABORT) call ESMF_FieldFill(field, dataFillScheme="sincos", member=1, rc=rc) if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & From 3de8536b18ed5c2def9e0d8c2cec7edbc253cc84 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Wed, 22 Sep 2021 11:48:45 -0700 Subject: [PATCH 64/68] Add 'date' calls for timestamping. --- testProtos.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/testProtos.sh b/testProtos.sh index 350f97c5..87bd7d77 100755 --- a/testProtos.sh +++ b/testProtos.sh @@ -22,6 +22,7 @@ function TestProto { ((count++)) testList[count]=$1 echo --------------------------------------------------------------------------- +date echo STARTING: $1 cd $1 make distclean @@ -38,6 +39,7 @@ testResult[count]="FAIL" fi echo FINISHED: $1 cd .. +date echo --------------------------------------------------------------------------- echo } @@ -52,6 +54,7 @@ fi testList[count]=$1 read -ra ARGS <<< "$3" echo --------------------------------------------------------------------------- +date echo STARTING: $1 cd $1 make distclean @@ -74,12 +77,14 @@ testResult[count]="FAIL" fi echo FINISHED: $1 cd .. +date echo --------------------------------------------------------------------------- echo } function TestSelectProto { echo --------------------------------------------------------------------------- +date echo STARTING: $1 cd $1 make distclean @@ -131,12 +136,14 @@ testResult[count]="FAIL" fi echo FINISHED: $1 cd .. +date echo --------------------------------------------------------------------------- echo } function TestSelectExternalProto { echo --------------------------------------------------------------------------- +date echo STARTING: $1 cd $1 make distclean @@ -228,6 +235,7 @@ echo "OCN_SELECT: C" > esm.config #$ESMF_INTERNAL_MPIRUN -np 4 ./$2 --- cannot run this because atmF is not fully implemented echo FINISHED: $1 cd .. +date echo --------------------------------------------------------------------------- echo } @@ -236,6 +244,7 @@ function TestExplorer { ((count++)) testList[count]=$1 echo --------------------------------------------------------------------------- +date echo STARTING: $1 cd $1 make distclean @@ -252,6 +261,7 @@ testResult[count]="FAIL" fi echo FINISHED: $1 cd .. +date echo --------------------------------------------------------------------------- echo } @@ -303,6 +313,7 @@ TestProto SingleModelOpenMPProto mainApp export OMP_NUM_THREADS=3 TestProto SingleModelOpenMPUnawareProto mainApp +date echo "== TEST SUMMARY START ==" i=1 while [[ $i -le $count ]] @@ -311,6 +322,7 @@ echo ${testResult[i]}: ${testList[i]} ((i++)) done echo "== TEST SUMMARY STOP ==" +date echo echo --------------------------------------------------------------------------- From 5bd84b7cdb6c3b53e6ace469ed686096ef303938 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Fri, 24 Sep 2021 16:24:16 -0700 Subject: [PATCH 65/68] Test ESMF_Initialize() changes, passing config through NUOPC, ingesting petLists. --- AtmOcnPetListProto/atm.F90 | 22 ++++++++---- AtmOcnPetListProto/esm.F90 | 57 ++++++++++++++++++++---------- AtmOcnPetListProto/esmApp.F90 | 9 +++-- AtmOcnPetListProto/nuopc.configure | 7 ++-- AtmOcnPetListProto/ocn.F90 | 3 +- 5 files changed, 67 insertions(+), 31 deletions(-) diff --git a/AtmOcnPetListProto/atm.F90 b/AtmOcnPetListProto/atm.F90 index d47a9076..24c88264 100644 --- a/AtmOcnPetListProto/atm.F90 +++ b/AtmOcnPetListProto/atm.F90 @@ -86,8 +86,8 @@ subroutine Advertise(model, rc) ! Disabling the following macro, e.g. renaming to WITHIMPORTFIELDS_disable, ! will result in a model component that does not advertise any importable ! Fields. Use this if you want to drive the model independently. -#define WITHIMPORTFIELDS -#ifdef WITHIMPORTFIELDS +#define WITHIMPORTFIELDS_GRID +#ifdef WITHIMPORTFIELDS_GRID ! importable field: sea_surface_temperature call NUOPC_Advertise(importState, & StandardName="sea_surface_temperature", name="sst", rc=rc) @@ -95,7 +95,10 @@ subroutine Advertise(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out +#endif +#define WITHIMPORTFIELDS_MESH +#ifdef WITHIMPORTFIELDS_MESH ! importable field: sea_surface_salinity call NUOPC_Advertise(importState, & StandardName="sea_surface_salinity", name="sss", rc=rc) @@ -103,7 +106,10 @@ subroutine Advertise(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out +#endif +#define WITHIMPORTFIELDS_LOCSTREAM +#ifdef WITHIMPORTFIELDS_LOCSTREAM ! importable field: sea_surface_height_above_sea_level call NUOPC_Advertise(importState, & StandardName="sea_surface_height_above_sea_level", name="ssh", rc=rc) @@ -157,6 +163,7 @@ subroutine Realize(model, rc) real(ESMF_KIND_R8), pointer :: lon(:), lat(:) real(ESMF_KIND_R8), pointer :: fptr(:) integer :: clb(1), cub(1), i + type(ESMF_VM) :: vm rc = ESMF_SUCCESS @@ -260,7 +267,7 @@ subroutine Realize(model, rc) return ! bail out locsOut = locsIn ! for now out same as in -#ifdef WITHIMPORTFIELDS +#ifdef WITHIMPORTFIELDS_GRID ! importable field on Grid: sea_surface_temperature field = ESMF_FieldCreate(name="sst", grid=gridIn, & typekind=ESMF_TYPEKIND_R8, rc=rc) @@ -273,8 +280,10 @@ subroutine Realize(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out +#endif - ! importable field on Grid: sea_surface_salinity +#ifdef WITHIMPORTFIELDS_MESH + ! importable field on Mesh: sea_surface_salinity field = ESMF_FieldCreate(name="sss", mesh=meshIn, & typekind=ESMF_TYPEKIND_R8, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & @@ -286,7 +295,9 @@ subroutine Realize(model, rc) line=__LINE__, & file=__FILE__)) & return ! bail out +#endif +#ifdef WITHIMPORTFIELDS_LOCSTREAM ! importable field on LocStream: sea_surface_height_above_sea_level field = ESMF_FieldCreate(name="ssh", locstream=locsIn, & typekind=ESMF_TYPEKIND_R8, rc=rc) @@ -314,7 +325,6 @@ subroutine Realize(model, rc) mask(i)=2 endif enddo - #endif ! exportable field on Grid: air_pressure_at_sea_level @@ -343,7 +353,7 @@ subroutine Realize(model, rc) file=__FILE__)) & return ! bail out - ! exportable field on Grid: precipitation_flux + ! exportable field on Mesh: precipitation_flux field = ESMF_FieldCreate(name="precip", mesh=meshOut, & typekind=ESMF_TYPEKIND_R8, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & diff --git a/AtmOcnPetListProto/esm.F90 b/AtmOcnPetListProto/esm.F90 index c9303b43..8ad92e74 100644 --- a/AtmOcnPetListProto/esm.F90 +++ b/AtmOcnPetListProto/esm.F90 @@ -87,8 +87,11 @@ subroutine SetModelServices(driver, rc) type(ESMF_GridComp) :: child type(ESMF_CplComp) :: connector integer :: petCount, i + character(len=160) :: petListString integer, allocatable :: petList(:) type(ESMF_Info) :: info + type(ESMF_Config) :: config + type(NUOPC_FreeFormat) :: ff ! - diagnostics - type(ESMF_VM) :: vm @@ -106,7 +109,8 @@ subroutine SetModelServices(driver, rc) return ! bail out ! get the petCount - call ESMF_GridCompGet(driver, petCount=petCount, vm=vm, rc=rc) + call ESMF_GridCompGet(driver, config=config, petCount=petCount, vm=vm, & + rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -118,19 +122,28 @@ subroutine SetModelServices(driver, rc) file=__FILE__)) & return ! bail out - ! SetServices for ATM with petList on first half of PETs - allocate(petList(petCount/2)) - do i=1, petCount/2 - petList(i) = i-1 ! PET labeling goes from 0 to petCount-1 - enddo - call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/MaxCount", value=2, & + ! ATM + ! - set up petList + ff = NUOPC_FreeFormatCreate(config, label="ATM_petlist:", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_IngestPetList(petList, ff, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! - set /NUOPC/Hint/PePerPet/MaxCount + call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/MaxCount", value=1, & rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out + ! - add the ATM component to Driver call NUOPC_DriverAddComp(driver, "ATM", atmSS, atmSVM, info=info, & - petList=petList, comp=child, rc=rc) + petList=petList, config=config, comp=child, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & @@ -207,22 +220,28 @@ subroutine SetModelServices(driver, rc) #endif #endif - ! SetServices for OCN with petList on second half of PETs - allocate(petList(petCount/2)) - do i=1, petCount/2 - petList(i) = petCount/2 + i-1 ! PET labeling goes from 0 to petCount-1 - enddo - call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/MaxCount", value=3, & + ! OCN + ! - set up petList + ff = NUOPC_FreeFormatCreate(config, label="OCN_petlist:", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_IngestPetList(petList, ff, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! - set /NUOPC/Hint/PePerPet/MaxCount + call ESMF_InfoSet(info, key="/NUOPC/Hint/PePerPet/MaxCount", value=1, & rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & return ! bail out - call NUOPC_DriverAddComp(driver, "OCN", ocnSS, & - ocnSVM, & - info=info, & - petList=petList, & - comp=child, rc=rc) + ! - add the OCN component to Driver + call NUOPC_DriverAddComp(driver, "OCN", ocnSS, ocnSVM, info=info, & + petList=petList, comp=child, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & diff --git a/AtmOcnPetListProto/esmApp.F90 b/AtmOcnPetListProto/esmApp.F90 index 294edccb..16bae9a2 100644 --- a/AtmOcnPetListProto/esmApp.F90 +++ b/AtmOcnPetListProto/esmApp.F90 @@ -21,12 +21,15 @@ program esmApp integer :: rc, urc type(ESMF_GridComp) :: esmComp + type(ESMF_Config) :: config type(ESMF_VM) :: vm ! Initialize ESMF call ESMF_Initialize(& - defaultConfigFileName="nuopc.configure", & - defaultCalkind=ESMF_CALKIND_GREGORIAN, & + configFileName="nuopc.configure", & + defaultGlobalResourceControl=.true., & + defaultCalKind=ESMF_CALKIND_GREGORIAN, & + config=config, & vm=vm, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & @@ -46,7 +49,7 @@ program esmApp call ESMF_Finalize(endflag=ESMF_END_ABORT) ! Create the earth system Component - esmComp = ESMF_GridCompCreate(name="esm", rc=rc) + esmComp = ESMF_GridCompCreate(name="esm", config=config, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & line=__LINE__, & file=__FILE__)) & diff --git a/AtmOcnPetListProto/nuopc.configure b/AtmOcnPetListProto/nuopc.configure index 432284a3..fd64c8e6 100644 --- a/AtmOcnPetListProto/nuopc.configure +++ b/AtmOcnPetListProto/nuopc.configure @@ -1,3 +1,6 @@ -globalResourceControl: .true. +globalResourceControl: .false. logKindFlag: ESMF_LOGKIND_MULTI -logAppendFlag: .true. +logAppendFlag: .false. + +ATM_petlist: 0-1 +OCN_petlist: 2-3 diff --git a/AtmOcnPetListProto/ocn.F90 b/AtmOcnPetListProto/ocn.F90 index 566be166..cb56083f 100644 --- a/AtmOcnPetListProto/ocn.F90 +++ b/AtmOcnPetListProto/ocn.F90 @@ -164,6 +164,7 @@ subroutine Realize(model, rc) real(ESMF_KIND_R8), pointer :: lon(:), lat(:) real(ESMF_KIND_R8), pointer :: fptr(:) integer :: clb(1), cub(1), i + type(ESMF_VM) :: vm rc = ESMF_SUCCESS @@ -294,7 +295,7 @@ subroutine Realize(model, rc) file=__FILE__)) & return ! bail out - ! importable field on Grid: precipitation_flux + ! importable field on Mesh: precipitation_flux field = ESMF_FieldCreate(name="precip", mesh=meshIn, & typekind=ESMF_TYPEKIND_R8, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & From 4a8e5d93174b15842c2602ea7a9514eb3604a346 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Mon, 27 Sep 2021 17:56:13 +0000 Subject: [PATCH 66/68] Use $(ESMF_INTERNAL_MPIRUN) for generic run targets. --- AsyncIOBlockingProto/Makefile | 2 +- AsyncIONonblockingProto/Makefile | 2 +- AtmOcnConOptsProto/Makefile | 2 +- AtmOcnConProto/Makefile | 2 +- AtmOcnCplListProto/Makefile | 2 +- AtmOcnCplSetProto/Makefile | 2 +- AtmOcnFDSynoProto/Makefile | 2 +- AtmOcnIceSimpleImplicitProto/Makefile | 2 +- AtmOcnImplicitProto/Makefile | 2 +- AtmOcnLndProto/Makefile | 2 +- AtmOcnLogNoneProto/Makefile | 2 +- AtmOcnMedIngestFromConfigProto/Makefile | 2 +- AtmOcnMedIngestFromInternalProto/Makefile | 2 +- AtmOcnMedPetListProto/Makefile | 2 +- AtmOcnMedPetListTimescalesProto/Makefile | 2 +- AtmOcnMedPetListTimescalesSplitFastProto/Makefile | 2 +- AtmOcnMedProto/Makefile | 2 +- AtmOcnMirrorFieldsProto/Makefile | 2 +- AtmOcnPetListProto/Makefile | 2 +- AtmOcnProto/Makefile | 2 +- AtmOcnRtmTwoTimescalesProto/Makefile | 2 +- AtmOcnScalarProto/Makefile | 2 +- AtmOcnSelectExternalProto/Makefile | 2 +- AtmOcnSelectProto/Makefile | 2 +- AtmOcnSimpleImplicitProto/Makefile | 2 +- AtmOcnTransferGridProto/Makefile | 2 +- AtmOcnTransferLocStreamProto/Makefile | 2 +- AtmOcnTransferMeshProto/Makefile | 2 +- ComponentExplorer/Makefile | 2 +- CustomFieldDictionaryProto/Makefile | 2 +- DriverInDriverDataDepProto/Makefile | 2 +- DriverInDriverProto/Makefile | 2 +- DynPhyProto/Makefile | 2 +- ExternalDriverAPIProto/Makefile | 2 +- ExternalDriverAPIWeakCplDAProto/Makefile | 2 +- GenericMediatorProto/Makefile | 2 +- HierarchyProto/Makefile | 2 +- NamespaceProto/Makefile | 2 +- NestingMultipleProto/Makefile | 2 +- NestingSingleProto/Makefile | 2 +- NestingTelescopeMultipleProto/Makefile | 2 +- SingleModelOpenMPProto/Makefile | 2 +- SingleModelOpenMPUnawareProto/Makefile | 2 +- SingleModelProto/Makefile | 2 +- 44 files changed, 44 insertions(+), 44 deletions(-) diff --git a/AsyncIOBlockingProto/Makefile b/AsyncIOBlockingProto/Makefile index 0ded8323..a3cda116 100644 --- a/AsyncIOBlockingProto/Makefile +++ b/AsyncIOBlockingProto/Makefile @@ -70,4 +70,4 @@ edit: nedit asyncIOApp.F90 asyncIODriver.F90 model.F90 io.F90 & run: - mpirun -np 4 ./asyncIOApp + $(ESMF_INTERNAL_MPIRUN) -np 4 ./asyncIOApp diff --git a/AsyncIONonblockingProto/Makefile b/AsyncIONonblockingProto/Makefile index e242c0bf..b82e6d13 100644 --- a/AsyncIONonblockingProto/Makefile +++ b/AsyncIONonblockingProto/Makefile @@ -70,4 +70,4 @@ edit: nedit asyncIOApp.F90 asyncIODriver.F90 model.F90 io.F90 conn.F90 & run: - mpirun -np 4 ./asyncIOApp + $(ESMF_INTERNAL_MPIRUN) -np 4 ./asyncIOApp diff --git a/AtmOcnConOptsProto/Makefile b/AtmOcnConOptsProto/Makefile index 9ab63796..26d5a182 100644 --- a/AtmOcnConOptsProto/Makefile +++ b/AtmOcnConOptsProto/Makefile @@ -70,4 +70,4 @@ edit: nedit esmApp.F90 esm.F90 atm.F90 ocn.F90 & run: - mpirun -np 4 ./esmApp + $(ESMF_INTERNAL_MPIRUN) -np 4 ./esmApp diff --git a/AtmOcnConProto/Makefile b/AtmOcnConProto/Makefile index 1deea26a..798befaf 100644 --- a/AtmOcnConProto/Makefile +++ b/AtmOcnConProto/Makefile @@ -70,4 +70,4 @@ edit: nedit esmApp.F90 esm.F90 atm.F90 ocn.F90 conn.F90 & run: - mpirun -np 4 ./esmApp + $(ESMF_INTERNAL_MPIRUN) -np 4 ./esmApp diff --git a/AtmOcnCplListProto/Makefile b/AtmOcnCplListProto/Makefile index cd34e9e8..2630ec0a 100644 --- a/AtmOcnCplListProto/Makefile +++ b/AtmOcnCplListProto/Makefile @@ -70,4 +70,4 @@ edit: nedit esmApp.F90 esm.F90 atm.F90 ocn.F90 & run: - mpirun -np 4 ./esmApp + $(ESMF_INTERNAL_MPIRUN) -np 4 ./esmApp diff --git a/AtmOcnCplSetProto/Makefile b/AtmOcnCplSetProto/Makefile index 71375b5b..beb0f3dd 100644 --- a/AtmOcnCplSetProto/Makefile +++ b/AtmOcnCplSetProto/Makefile @@ -70,4 +70,4 @@ edit: nedit esmApp.F90 esm.F90 atm.F90 ocn.F90 & run: - mpirun -np 4 ./esmApp + $(ESMF_INTERNAL_MPIRUN) -np 4 ./esmApp diff --git a/AtmOcnFDSynoProto/Makefile b/AtmOcnFDSynoProto/Makefile index cd34e9e8..2630ec0a 100644 --- a/AtmOcnFDSynoProto/Makefile +++ b/AtmOcnFDSynoProto/Makefile @@ -70,4 +70,4 @@ edit: nedit esmApp.F90 esm.F90 atm.F90 ocn.F90 & run: - mpirun -np 4 ./esmApp + $(ESMF_INTERNAL_MPIRUN) -np 4 ./esmApp diff --git a/AtmOcnIceSimpleImplicitProto/Makefile b/AtmOcnIceSimpleImplicitProto/Makefile index 295dd793..2e5bbb63 100644 --- a/AtmOcnIceSimpleImplicitProto/Makefile +++ b/AtmOcnIceSimpleImplicitProto/Makefile @@ -70,4 +70,4 @@ edit: nedit esmApp.F90 esm.F90 atm.F90 ocn.F90 ice.F90 & run: - mpirun -np 4 ./esmApp + $(ESMF_INTERNAL_MPIRUN) -np 4 ./esmApp diff --git a/AtmOcnImplicitProto/Makefile b/AtmOcnImplicitProto/Makefile index cd34e9e8..2630ec0a 100644 --- a/AtmOcnImplicitProto/Makefile +++ b/AtmOcnImplicitProto/Makefile @@ -70,4 +70,4 @@ edit: nedit esmApp.F90 esm.F90 atm.F90 ocn.F90 & run: - mpirun -np 4 ./esmApp + $(ESMF_INTERNAL_MPIRUN) -np 4 ./esmApp diff --git a/AtmOcnLndProto/Makefile b/AtmOcnLndProto/Makefile index 468c4824..963e1e3d 100644 --- a/AtmOcnLndProto/Makefile +++ b/AtmOcnLndProto/Makefile @@ -70,4 +70,4 @@ edit: nedit esmApp.F90 esm.F90 atm.F90 ocn.F90 lnd.F90 & run: - mpirun -np 4 ./esmApp + $(ESMF_INTERNAL_MPIRUN) -np 4 ./esmApp diff --git a/AtmOcnLogNoneProto/Makefile b/AtmOcnLogNoneProto/Makefile index 9ab63796..26d5a182 100644 --- a/AtmOcnLogNoneProto/Makefile +++ b/AtmOcnLogNoneProto/Makefile @@ -70,4 +70,4 @@ edit: nedit esmApp.F90 esm.F90 atm.F90 ocn.F90 & run: - mpirun -np 4 ./esmApp + $(ESMF_INTERNAL_MPIRUN) -np 4 ./esmApp diff --git a/AtmOcnMedIngestFromConfigProto/Makefile b/AtmOcnMedIngestFromConfigProto/Makefile index 47e0fc2e..e32259e6 100644 --- a/AtmOcnMedIngestFromConfigProto/Makefile +++ b/AtmOcnMedIngestFromConfigProto/Makefile @@ -70,4 +70,4 @@ edit: nedit esmApp.F90 esm.F90 atm.F90 ocn.F90 med.F90 & run: - mpirun -np 4 ./esmApp + $(ESMF_INTERNAL_MPIRUN) -np 4 ./esmApp diff --git a/AtmOcnMedIngestFromInternalProto/Makefile b/AtmOcnMedIngestFromInternalProto/Makefile index 47e0fc2e..e32259e6 100644 --- a/AtmOcnMedIngestFromInternalProto/Makefile +++ b/AtmOcnMedIngestFromInternalProto/Makefile @@ -70,4 +70,4 @@ edit: nedit esmApp.F90 esm.F90 atm.F90 ocn.F90 med.F90 & run: - mpirun -np 4 ./esmApp + $(ESMF_INTERNAL_MPIRUN) -np 4 ./esmApp diff --git a/AtmOcnMedPetListProto/Makefile b/AtmOcnMedPetListProto/Makefile index 47e0fc2e..e32259e6 100644 --- a/AtmOcnMedPetListProto/Makefile +++ b/AtmOcnMedPetListProto/Makefile @@ -70,4 +70,4 @@ edit: nedit esmApp.F90 esm.F90 atm.F90 ocn.F90 med.F90 & run: - mpirun -np 4 ./esmApp + $(ESMF_INTERNAL_MPIRUN) -np 4 ./esmApp diff --git a/AtmOcnMedPetListTimescalesProto/Makefile b/AtmOcnMedPetListTimescalesProto/Makefile index 47e0fc2e..e32259e6 100644 --- a/AtmOcnMedPetListTimescalesProto/Makefile +++ b/AtmOcnMedPetListTimescalesProto/Makefile @@ -70,4 +70,4 @@ edit: nedit esmApp.F90 esm.F90 atm.F90 ocn.F90 med.F90 & run: - mpirun -np 4 ./esmApp + $(ESMF_INTERNAL_MPIRUN) -np 4 ./esmApp diff --git a/AtmOcnMedPetListTimescalesSplitFastProto/Makefile b/AtmOcnMedPetListTimescalesSplitFastProto/Makefile index 47e0fc2e..e32259e6 100644 --- a/AtmOcnMedPetListTimescalesSplitFastProto/Makefile +++ b/AtmOcnMedPetListTimescalesSplitFastProto/Makefile @@ -70,4 +70,4 @@ edit: nedit esmApp.F90 esm.F90 atm.F90 ocn.F90 med.F90 & run: - mpirun -np 4 ./esmApp + $(ESMF_INTERNAL_MPIRUN) -np 4 ./esmApp diff --git a/AtmOcnMedProto/Makefile b/AtmOcnMedProto/Makefile index 47e0fc2e..e32259e6 100644 --- a/AtmOcnMedProto/Makefile +++ b/AtmOcnMedProto/Makefile @@ -70,4 +70,4 @@ edit: nedit esmApp.F90 esm.F90 atm.F90 ocn.F90 med.F90 & run: - mpirun -np 4 ./esmApp + $(ESMF_INTERNAL_MPIRUN) -np 4 ./esmApp diff --git a/AtmOcnMirrorFieldsProto/Makefile b/AtmOcnMirrorFieldsProto/Makefile index cd34e9e8..2630ec0a 100644 --- a/AtmOcnMirrorFieldsProto/Makefile +++ b/AtmOcnMirrorFieldsProto/Makefile @@ -70,4 +70,4 @@ edit: nedit esmApp.F90 esm.F90 atm.F90 ocn.F90 & run: - mpirun -np 4 ./esmApp + $(ESMF_INTERNAL_MPIRUN) -np 4 ./esmApp diff --git a/AtmOcnPetListProto/Makefile b/AtmOcnPetListProto/Makefile index cd34e9e8..2630ec0a 100644 --- a/AtmOcnPetListProto/Makefile +++ b/AtmOcnPetListProto/Makefile @@ -70,4 +70,4 @@ edit: nedit esmApp.F90 esm.F90 atm.F90 ocn.F90 & run: - mpirun -np 4 ./esmApp + $(ESMF_INTERNAL_MPIRUN) -np 4 ./esmApp diff --git a/AtmOcnProto/Makefile b/AtmOcnProto/Makefile index 9ab63796..26d5a182 100644 --- a/AtmOcnProto/Makefile +++ b/AtmOcnProto/Makefile @@ -70,4 +70,4 @@ edit: nedit esmApp.F90 esm.F90 atm.F90 ocn.F90 & run: - mpirun -np 4 ./esmApp + $(ESMF_INTERNAL_MPIRUN) -np 4 ./esmApp diff --git a/AtmOcnRtmTwoTimescalesProto/Makefile b/AtmOcnRtmTwoTimescalesProto/Makefile index fbed929f..216de5b8 100644 --- a/AtmOcnRtmTwoTimescalesProto/Makefile +++ b/AtmOcnRtmTwoTimescalesProto/Makefile @@ -70,4 +70,4 @@ edit: nedit esmApp.F90 esm.F90 atm.F90 ocn.F90 rtm.F90 & run: - mpirun -np 4 ./esmApp + $(ESMF_INTERNAL_MPIRUN) -np 4 ./esmApp diff --git a/AtmOcnScalarProto/Makefile b/AtmOcnScalarProto/Makefile index cd34e9e8..2630ec0a 100644 --- a/AtmOcnScalarProto/Makefile +++ b/AtmOcnScalarProto/Makefile @@ -70,4 +70,4 @@ edit: nedit esmApp.F90 esm.F90 atm.F90 ocn.F90 & run: - mpirun -np 4 ./esmApp + $(ESMF_INTERNAL_MPIRUN) -np 4 ./esmApp diff --git a/AtmOcnSelectExternalProto/Makefile b/AtmOcnSelectExternalProto/Makefile index 464ba877..208c639a 100644 --- a/AtmOcnSelectExternalProto/Makefile +++ b/AtmOcnSelectExternalProto/Makefile @@ -170,4 +170,4 @@ edit: nedit esmApp.F90 esm.F90 & run: - mpirun -np 4 ./esmApp + $(ESMF_INTERNAL_MPIRUN) -np 4 ./esmApp diff --git a/AtmOcnSelectProto/Makefile b/AtmOcnSelectProto/Makefile index 41adebcb..60d8e384 100644 --- a/AtmOcnSelectProto/Makefile +++ b/AtmOcnSelectProto/Makefile @@ -85,4 +85,4 @@ edit: nedit esmApp.F90 esm.F90 atmA.F90 atmB.F90 ocnA.F90 ocnB.F90 & run: - mpirun -np 4 ./esmApp + $(ESMF_INTERNAL_MPIRUN) -np 4 ./esmApp diff --git a/AtmOcnSimpleImplicitProto/Makefile b/AtmOcnSimpleImplicitProto/Makefile index cd34e9e8..2630ec0a 100644 --- a/AtmOcnSimpleImplicitProto/Makefile +++ b/AtmOcnSimpleImplicitProto/Makefile @@ -70,4 +70,4 @@ edit: nedit esmApp.F90 esm.F90 atm.F90 ocn.F90 & run: - mpirun -np 4 ./esmApp + $(ESMF_INTERNAL_MPIRUN) -np 4 ./esmApp diff --git a/AtmOcnTransferGridProto/Makefile b/AtmOcnTransferGridProto/Makefile index fe8b26b1..a3ea92a6 100644 --- a/AtmOcnTransferGridProto/Makefile +++ b/AtmOcnTransferGridProto/Makefile @@ -70,4 +70,4 @@ edit: nedit esmApp.F90 esm.F90 atm.F90 ocn.F90 & run: - mpirun -np 4 ./esmApp + $(ESMF_INTERNAL_MPIRUN) -np 4 ./esmApp diff --git a/AtmOcnTransferLocStreamProto/Makefile b/AtmOcnTransferLocStreamProto/Makefile index cd34e9e8..2630ec0a 100644 --- a/AtmOcnTransferLocStreamProto/Makefile +++ b/AtmOcnTransferLocStreamProto/Makefile @@ -70,4 +70,4 @@ edit: nedit esmApp.F90 esm.F90 atm.F90 ocn.F90 & run: - mpirun -np 4 ./esmApp + $(ESMF_INTERNAL_MPIRUN) -np 4 ./esmApp diff --git a/AtmOcnTransferMeshProto/Makefile b/AtmOcnTransferMeshProto/Makefile index 0007678b..d3d696d7 100644 --- a/AtmOcnTransferMeshProto/Makefile +++ b/AtmOcnTransferMeshProto/Makefile @@ -70,4 +70,4 @@ edit: nedit esmApp.F90 esm.F90 atm.F90 ocn.F90 & run: - mpirun -np 4 ./esmApp + $(ESMF_INTERNAL_MPIRUN) -np 4 ./esmApp diff --git a/ComponentExplorer/Makefile b/ComponentExplorer/Makefile index a4b1957e..b80ffa32 100644 --- a/ComponentExplorer/Makefile +++ b/ComponentExplorer/Makefile @@ -97,4 +97,4 @@ edit: nedit nuopcExplorerScript nuopcExplorerApp.F90 nuopcExplorerDriver.F90 explorer.config & run: - mpirun -np 4 ./nuopcExplorerApp + $(ESMF_INTERNAL_MPIRUN) -np 4 ./nuopcExplorerApp diff --git a/CustomFieldDictionaryProto/Makefile b/CustomFieldDictionaryProto/Makefile index 2f2a89ed..cd8d2029 100644 --- a/CustomFieldDictionaryProto/Makefile +++ b/CustomFieldDictionaryProto/Makefile @@ -70,4 +70,4 @@ edit: nedit mainApp.F90 driver.F90 model.F90 util.F90 & run: - mpirun -np 4 ./mainApp + $(ESMF_INTERNAL_MPIRUN) -np 4 ./mainApp diff --git a/DriverInDriverDataDepProto/Makefile b/DriverInDriverDataDepProto/Makefile index 61763a8f..a84c31ed 100644 --- a/DriverInDriverDataDepProto/Makefile +++ b/DriverInDriverDataDepProto/Makefile @@ -71,4 +71,4 @@ edit: nedit mainApp.F90 driverParentComp.F90 driverChildComp.F90 atm.F90 ocn.F90 & run: - mpirun -np 4 ./mainApp + $(ESMF_INTERNAL_MPIRUN) -np 4 ./mainApp diff --git a/DriverInDriverProto/Makefile b/DriverInDriverProto/Makefile index 61763a8f..a84c31ed 100644 --- a/DriverInDriverProto/Makefile +++ b/DriverInDriverProto/Makefile @@ -71,4 +71,4 @@ edit: nedit mainApp.F90 driverParentComp.F90 driverChildComp.F90 atm.F90 ocn.F90 & run: - mpirun -np 4 ./mainApp + $(ESMF_INTERNAL_MPIRUN) -np 4 ./mainApp diff --git a/DynPhyProto/Makefile b/DynPhyProto/Makefile index d283df2e..fd393ae9 100644 --- a/DynPhyProto/Makefile +++ b/DynPhyProto/Makefile @@ -70,4 +70,4 @@ edit: nedit esmApp.F90 atm.F90 dyn.F90 phy.F90 & run: - mpirun -np 4 ./esmApp + $(ESMF_INTERNAL_MPIRUN) -np 4 ./esmApp diff --git a/ExternalDriverAPIProto/Makefile b/ExternalDriverAPIProto/Makefile index b21c5b36..46f593ad 100644 --- a/ExternalDriverAPIProto/Makefile +++ b/ExternalDriverAPIProto/Makefile @@ -70,4 +70,4 @@ edit: nedit externalApp.F90 esm.F90 atm.F90 ocn.F90 & run: - mpirun -np 4 ./externalApp + $(ESMF_INTERNAL_MPIRUN) -np 4 ./externalApp diff --git a/ExternalDriverAPIWeakCplDAProto/Makefile b/ExternalDriverAPIWeakCplDAProto/Makefile index a7eb2c5a..d8bb2e88 100644 --- a/ExternalDriverAPIWeakCplDAProto/Makefile +++ b/ExternalDriverAPIWeakCplDAProto/Makefile @@ -72,4 +72,4 @@ edit: nedit externalApp.F90 atmDA.F90 ocnDA.F90 nuopc_da.F90 esm.F90 atm.F90 ocn.F90 & run: - mpirun -np 4 ./externalApp + $(ESMF_INTERNAL_MPIRUN) -np 4 ./externalApp diff --git a/GenericMediatorProto/Makefile b/GenericMediatorProto/Makefile index 931b4f9a..d3ae0fd4 100644 --- a/GenericMediatorProto/Makefile +++ b/GenericMediatorProto/Makefile @@ -70,4 +70,4 @@ edit: nedit app.F90 driver.F90 mediator.F90 modelA.F90 modelB.F90 & run: - mpirun -np 4 ./app + $(ESMF_INTERNAL_MPIRUN) -np 4 ./app diff --git a/HierarchyProto/Makefile b/HierarchyProto/Makefile index 496c7a4f..7a1eff0e 100644 --- a/HierarchyProto/Makefile +++ b/HierarchyProto/Makefile @@ -71,4 +71,4 @@ edit: nedit esmApp.F90 esm.F90 atm.F90 dyn.F90 phy.F90 ocn.F90 & run: - mpirun -np 4 ./esmApp + $(ESMF_INTERNAL_MPIRUN) -np 4 ./esmApp diff --git a/NamespaceProto/Makefile b/NamespaceProto/Makefile index 9bbb9217..27bf4c1a 100644 --- a/NamespaceProto/Makefile +++ b/NamespaceProto/Makefile @@ -70,4 +70,4 @@ edit: nedit mainApp.F90 driver.F90 atm.F90 med.F90 & run: - mpirun -np 4 ./mainApp + $(ESMF_INTERNAL_MPIRUN) -np 4 ./mainApp diff --git a/NestingMultipleProto/Makefile b/NestingMultipleProto/Makefile index 18dcf1e2..ad7b7bcf 100644 --- a/NestingMultipleProto/Makefile +++ b/NestingMultipleProto/Makefile @@ -70,4 +70,4 @@ edit: nedit mainApp.F90 driverComp.F90 advectDiffComp.F90 & run: - mpirun -np 4 ./mainApp + $(ESMF_INTERNAL_MPIRUN) -np 4 ./mainApp diff --git a/NestingSingleProto/Makefile b/NestingSingleProto/Makefile index 18dcf1e2..ad7b7bcf 100644 --- a/NestingSingleProto/Makefile +++ b/NestingSingleProto/Makefile @@ -70,4 +70,4 @@ edit: nedit mainApp.F90 driverComp.F90 advectDiffComp.F90 & run: - mpirun -np 4 ./mainApp + $(ESMF_INTERNAL_MPIRUN) -np 4 ./mainApp diff --git a/NestingTelescopeMultipleProto/Makefile b/NestingTelescopeMultipleProto/Makefile index 18dcf1e2..ad7b7bcf 100644 --- a/NestingTelescopeMultipleProto/Makefile +++ b/NestingTelescopeMultipleProto/Makefile @@ -70,4 +70,4 @@ edit: nedit mainApp.F90 driverComp.F90 advectDiffComp.F90 & run: - mpirun -np 4 ./mainApp + $(ESMF_INTERNAL_MPIRUN) -np 4 ./mainApp diff --git a/SingleModelOpenMPProto/Makefile b/SingleModelOpenMPProto/Makefile index e73aa632..28f14f2e 100644 --- a/SingleModelOpenMPProto/Makefile +++ b/SingleModelOpenMPProto/Makefile @@ -70,4 +70,4 @@ edit: nedit mainApp.F90 driver.F90 model.F90 & run: - mpirun -np 4 ./mainApp + $(ESMF_INTERNAL_MPIRUN) -np 4 ./mainApp diff --git a/SingleModelOpenMPUnawareProto/Makefile b/SingleModelOpenMPUnawareProto/Makefile index c735ee00..b08cfc55 100644 --- a/SingleModelOpenMPUnawareProto/Makefile +++ b/SingleModelOpenMPUnawareProto/Makefile @@ -70,4 +70,4 @@ edit: nedit mainApp.F90 driver.F90 model.F90 & run: - env OMP_NUM_THREADS=3 mpirun -np 4 ./mainApp + env OMP_NUM_THREADS=3 $(ESMF_INTERNAL_MPIRUN) -np 4 ./mainApp diff --git a/SingleModelProto/Makefile b/SingleModelProto/Makefile index e73aa632..28f14f2e 100644 --- a/SingleModelProto/Makefile +++ b/SingleModelProto/Makefile @@ -70,4 +70,4 @@ edit: nedit mainApp.F90 driver.F90 model.F90 & run: - mpirun -np 4 ./mainApp + $(ESMF_INTERNAL_MPIRUN) -np 4 ./mainApp From 8c749ca1342d23422c3a2eba6ad98d60674f5112 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Mon, 27 Sep 2021 18:36:15 +0000 Subject: [PATCH 67/68] Rework section that demonstrates hanging under Intel < 19.1.1 in multi-threaded mode, and de-activate it for now. Many of our test platforms still use older Intel versions. --- AtmOcnTransferGridProto/atm.F90 | 10 ++++++---- AtmOcnTransferGridProto/ocn.F90 | 10 ++++++---- AtmOcnTransferMeshProto/atm.F90 | 10 ++++++---- AtmOcnTransferMeshProto/ocn.F90 | 10 ++++++---- 4 files changed, 24 insertions(+), 16 deletions(-) diff --git a/AtmOcnTransferGridProto/atm.F90 b/AtmOcnTransferGridProto/atm.F90 index a686a3ba..edba1d78 100644 --- a/AtmOcnTransferGridProto/atm.F90 +++ b/AtmOcnTransferGridProto/atm.F90 @@ -1428,11 +1428,13 @@ subroutine Advance(model, rc) !$omp end critical !$omp end parallel -#define STDOUT_off -#ifdef STDOUT - unit = 6 -#else +#define FILEOUT_off +! Activating FILEOUT triggers a hang for Intel < 19.1.1 when multi-threaded +! due to an Intel bug +#ifdef FILEOUT unit = localPet + 100 +#else + unit = 6 #endif !$omp parallel private(tid) tid = -1 ! initialize to obvious value if building without OpenMP diff --git a/AtmOcnTransferGridProto/ocn.F90 b/AtmOcnTransferGridProto/ocn.F90 index f24449ac..4032d7ed 100644 --- a/AtmOcnTransferGridProto/ocn.F90 +++ b/AtmOcnTransferGridProto/ocn.F90 @@ -1018,11 +1018,13 @@ subroutine Advance(model, rc) !$omp end critical !$omp end parallel -#define STDOUT_off -#ifdef STDOUT - unit = 6 -#else +#define FILEOUT_off +! Activating FILEOUT triggers a hang for Intel < 19.1.1 when multi-threaded +! due to an Intel bug +#ifdef FILEOUT unit = localPet + 200 +#else + unit = 6 #endif !$omp parallel private(tid) tid = -1 ! initialize to obvious value if building without OpenMP diff --git a/AtmOcnTransferMeshProto/atm.F90 b/AtmOcnTransferMeshProto/atm.F90 index 4bdeaf98..dccc7547 100644 --- a/AtmOcnTransferMeshProto/atm.F90 +++ b/AtmOcnTransferMeshProto/atm.F90 @@ -869,11 +869,13 @@ subroutine Advance(model, rc) !$omp end critical !$omp end parallel -#define STDOUT_off -#ifdef STDOUT - unit = 6 -#else +#define FILEOUT_off +! Activating FILEOUT triggers a hang for Intel < 19.1.1 when multi-threaded +! due to an Intel bug +#ifdef FILEOUT unit = localPet + 100 +#else + unit = 6 #endif !$omp parallel private(tid) tid = -1 ! initialize to obvious value if building without OpenMP diff --git a/AtmOcnTransferMeshProto/ocn.F90 b/AtmOcnTransferMeshProto/ocn.F90 index 07c3aa7e..6c6b687e 100644 --- a/AtmOcnTransferMeshProto/ocn.F90 +++ b/AtmOcnTransferMeshProto/ocn.F90 @@ -475,11 +475,13 @@ subroutine Advance(model, rc) !$omp end critical !$omp end parallel -#define STDOUT_off -#ifdef STDOUT - unit = 6 -#else +#define FILEOUT_off +! Activating FILEOUT triggers a hang for Intel < 19.1.1 when multi-threaded +! due to an Intel bug +#ifdef FILEOUT unit = localPet + 200 +#else + unit = 6 #endif !$omp parallel private(tid) tid = -1 ! initialize to obvious value if building without OpenMP From 4b0a60b2248844115c81ac6dd94ad73672e387c9 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Mon, 27 Sep 2021 22:38:47 +0000 Subject: [PATCH 68/68] Change to 'sh' to see if that helps on some platforms under automated testing. --- AtmOcnSelectExternalProto/buildSubs.csh | 2 +- AtmOcnSelectExternalProto/cleanSubs.csh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/AtmOcnSelectExternalProto/buildSubs.csh b/AtmOcnSelectExternalProto/buildSubs.csh index 6518109e..6804b9ce 100755 --- a/AtmOcnSelectExternalProto/buildSubs.csh +++ b/AtmOcnSelectExternalProto/buildSubs.csh @@ -1,4 +1,4 @@ -#!/bin/csh +#!/bin/sh cd ATM-A gmake distclean; gmake diff --git a/AtmOcnSelectExternalProto/cleanSubs.csh b/AtmOcnSelectExternalProto/cleanSubs.csh index 097e3780..2c94dc32 100755 --- a/AtmOcnSelectExternalProto/cleanSubs.csh +++ b/AtmOcnSelectExternalProto/cleanSubs.csh @@ -1,4 +1,4 @@ -#!/bin/csh +#!/bin/sh cd ATM-A gmake distclean