subroutine comp1_final(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_State) :: neststate
type(ESMF_FieldBundle):: fb
type(ESMF_Grid) :: grid
print *, "i am comp1_final"
call ESMF_StateGet(istate, "Comp1 Field", field, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=FILENAME)) &
return ! bail out
call ESMF_FieldDestroy(field, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=FILENAME)) &
return ! bail out
call ESMF_StateGet(istate, "Comp1 Nested State", neststate, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=FILENAME)) &
return ! bail out
call ESMF_StateGet(neststate, "Comp1 Field in Nested State", field, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=FILENAME)) &
return ! bail out
call ESMF_FieldDestroy(field, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=FILENAME)) &
return ! bail out
call ESMF_StateDestroy(neststate, 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
! For now do not worry about cleaning up fields inside FB
call ESMF_FieldBundleDestroy(fb, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=FILENAME)) &
return ! bail out
end subroutine comp1_final