subroutine user_run(comp, importState, exportState, clock, rc)
type(ESMF_CplComp) :: comp
type(ESMF_State) :: importState, exportState
type(ESMF_Clock) :: clock
integer,intent(out) :: rc
! Local variables
integer :: status = ESMF_SUCCESS
type(ESMF_Field) :: sorted_data1, sorted_data2
print *, "User Coupler Run starting"
! query data from States
call ESMF_StateGet(importState, "sorted_data1", sorted_data1, rc=status)
if (ESMF_LogFoundError(status, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
call ESMF_StateGet(exportState, "sorted_data2", sorted_data2, rc=status)
if (ESMF_LogFoundError(status, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
! preform data redistribution
! deliver sorted result from component 1 to component 2
! component 2 will verify component 1 result
call ESMF_FieldRedist(srcField=sorted_data1, dstField=sorted_data2, &
routehandle= redistRH12, checkflag=.true., rc=status)
if (ESMF_LogFoundError(status, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
rc = status
end subroutine user_run