user_final Subroutine

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

Arguments

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

Source Code

    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_Field) :: dstField
      type(ESMF_Mesh) :: dstMesh

      rc = ESMF_SUCCESS
      print *, "User Comp Final starting"

      ! check validity of results
      ! Get Fields from import state
      call ESMF_StateGet(importState, "dst", dstField, rc=rc)
      if(rc/=ESMF_SUCCESS) return

      ! garbage collection
      call ESMF_FieldGet(dstField, mesh=dstMesh, rc=rc)
      if (rc .ne. ESMF_SUCCESS) return

      call ESMF_FieldDestroy(dstField, rc=rc)
      if (rc .ne. ESMF_SUCCESS) return

      call ESMF_MeshDestroy(dstMesh, rc=rc)
      if (rc .ne. ESMF_SUCCESS) return

      print *, "User Comp Final returning"

      ! Return success
      rc = ESMF_SUCCESS
    end subroutine user_final