user_run Subroutine

public subroutine user_run(comp, importState, exportState, clock, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_CplComp) :: comp
type(ESMF_State) :: importState
type(ESMF_State) :: exportState
type(ESMF_Clock) :: clock
integer, intent(out) :: rc

Source Code

  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
    type(ESMF_Field) :: srcField, dstField
    type(ESMF_Array) :: srcArray, dstArray

    ! Initialize return code
    rc = ESMF_SUCCESS

    print *, "User Coupler Run starting"

    ! Get source Field out of import State
    call ESMF_StateGet(importState, "field data", srcField, rc=rc)
    if (rc/=ESMF_SUCCESS) return ! bail out

    ! Get destination Field out of export State
    call ESMF_StateGet(exportState, "field data", dstField, rc=rc)
    if (rc/=ESMF_SUCCESS) return ! bail out

    ! Get Array out of srcField
    call ESMF_FieldGet(srcField, array=srcArray, rc=rc)
    if (rc/=ESMF_SUCCESS) return ! bail out

    ! Get Array out of dstField
    call ESMF_FieldGet(dstField, array=dstArray, rc=rc)
    if (rc/=ESMF_SUCCESS) return ! bail out

    ! Use ArraySMM() to take data from srcArray to dstArray
    call ESMF_ArraySMM(srcArray=srcArray, dstArray=dstArray, &
      routehandle=routehandle, rc=rc)
    if (rc/=ESMF_SUCCESS) return ! bail out
  
    print *, "User Coupler Run returning"

  end subroutine user_run