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_Array) :: dstArray1, dstArray2
    integer          :: dstF90(100,150)

    ! Initialize return code
    rc = ESMF_SUCCESS

    print *, "User Coupler Run starting"

    ! Get the Arrays from the states
    call ESMF_StateGet(exportState, "dstArray1", dstArray1, rc=rc)
    if (rc/=ESMF_SUCCESS) return ! bail out
    call ESMF_StateGet(exportState, "dstArray2", dstArray2, rc=rc)
    if (rc/=ESMF_SUCCESS) return ! bail out
    
    ! ArrayGather() dstArray2 into dstF90 on rootPet=2
    call ESMF_ArrayGather(dstArray2, dstF90, rootPet=2, rc=rc)
    if (rc/=ESMF_SUCCESS) return ! bail out
    
    ! ArrayScatter() dstF90 on rootPet=2 across dstArray1
    call ESMF_ArrayScatter(dstArray1, dstF90, rootPet=2, rc=rc)
    if (rc/=ESMF_SUCCESS) return ! bail out
  
    print *, "User Coupler Run returning"

  end subroutine user_run