subroutine comp1_run(gcomp, istate, ostate, clock, rc)
type(ESMF_GridComp) :: gcomp
type(ESMF_State) :: istate, ostate
type(ESMF_Clock) :: clock
integer, intent(out) :: rc
type(ESMF_Field) :: field
type(ESMF_FieldBundle):: fb
type(ESMF_Grid) :: grid, gridCheck
integer :: i
character(40) :: fieldName
print *, "i am comp1_run"
rc = ESMF_SUCCESS
call ESMF_GridCompGet(gcomp, grid=grid, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=FILENAME)) &
return ! bail out
call ESMF_StateGet(istate, "Comp1 FieldBundle", fb, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=FILENAME)) &
return ! bail out
do i=1,FB_MEMBER_COUNT
write(fieldName,'("Comp1 Field ", I2, " in FB")') i
call ESMF_FieldBundleGet(fb, fieldName=trim(fieldName), field=field, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=FILENAME)) &
return ! bail out
call ESMF_FieldGet(field, grid=gridCheck, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=FILENAME)) &
return ! bail out
if (gridCheck /= grid) then
call ESMF_LogSetError(rcToCheck=ESMF_RC_OBJ_WRONG, &
msg="The actual grid object has been changed!", &
line=__LINE__, file=FILENAME, &
rcToReturn=rc)
return
endif
enddo
end subroutine comp1_run