subroutine user_final(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_DistGrid) :: distgrid
type(ESMF_Array) :: array
! Initialize return code
rc = ESMF_SUCCESS
print *, "User Comp2 Final starting"
call ESMF_StateGet(exportState, "dstArray2", array, rc=rc)
if (rc/=ESMF_SUCCESS) return ! bail out
call ESMF_ArrayGet(array, distgrid=distgrid, rc=rc)
if (rc/=ESMF_SUCCESS) return ! bail out
call ESMF_ArrayDestroy(array, rc=rc)
if (rc/=ESMF_SUCCESS) return ! bail out
call ESMF_DistGridDestroy(distgrid, rc=rc)
if (rc/=ESMF_SUCCESS) return ! bail out
call ESMF_StateGet(importState, "srcArray2", array, rc=rc)
if (rc/=ESMF_SUCCESS) return ! bail out
call ESMF_ArrayGet(array, distgrid=distgrid, rc=rc)
if (rc/=ESMF_SUCCESS) return ! bail out
call ESMF_ArrayDestroy(array, rc=rc)
if (rc/=ESMF_SUCCESS) return ! bail out
call ESMF_DistGridDestroy(distgrid, rc=rc)
if (rc/=ESMF_SUCCESS) return ! bail out
print *, "User Comp2 Final returning"
end subroutine user_final