Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(ESMF_GridComp) | :: | comp | ||||
type(ESMF_State) | :: | importState | ||||
type(ESMF_State) | :: | exportState | ||||
type(ESMF_Clock) | :: | clock | ||||
integer, | intent(out) | :: | rc |
subroutine user_initP2(comp, importState, exportState, clock, rc) type(ESMF_GridComp) :: comp type(ESMF_State) :: importState, exportState type(ESMF_Clock) :: clock integer, intent(out) :: rc ! Local variables type(ESMF_Field) :: field type(ESMF_Mesh) :: mesh type(ESMF_DistGrid) :: distgrid ! Initialize return code rc = ESMF_SUCCESS print *, "User Comp2 Init phase=2 starting" ! Access Field with shared Mesh that is available in the importState call ESMF_StateGet(importState, "dstField", field, rc=rc) if (rc/=ESMF_SUCCESS) return ! bail out ! Get the shared Mesh call ESMF_FieldGet(field, mesh=mesh, rc=rc) if (rc/=ESMF_SUCCESS) return ! bail out ! Get the DistGrid call ESMF_MeshGet(mesh, elementDistgrid=distgrid, rc=rc) if (rc/=ESMF_SUCCESS) return ! bail out ! Print the DistGrid of the shared Mesh call ESMF_DistGridPrint(distgrid, rc=rc) if (rc/=ESMF_SUCCESS) return ! bail out ! TODO: If there were changes made to the DistGrid, then the Mesh will need ! TODO: to be re-created on the changed DistGrid, and re-set in the Field. !distgrid = ESMF_DistGridCreate(minIndex=(/1/), maxIndex=(/4/), rc=rc) !if (rc/=ESMF_SUCCESS) return ! bail out !mesh = ESMF_MeshCreate(distgrid, distgrid, rc=rc) !if (rc/=ESMF_SUCCESS) return ! bail out !call ESMF_FieldEmptySet(field, mesh=mesh, rc=rc) !if (rc/=ESMF_SUCCESS) return ! bail out print *, "User Comp2 Init phase=2 returning" end subroutine user_initP2