my_final Subroutine

private subroutine my_final(gcomp, importState, exportState, parentclock, rc)

Arguments

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

Source Code

    subroutine my_final(gcomp, importState, exportState, parentclock, rc)
      type(ESMF_GridComp) :: gcomp
      type(ESMF_State) :: importState
      type(ESMF_State) :: exportState
      type(ESMF_Clock) :: parentclock
      integer, intent(out) :: rc
     
      call ESMF_LogWrite("Parent Gridded Component Finalize routine called", ESMF_LOGMSG_INFO)

      ! Give each of the subcomponents a chance to finalize themselves.
      call ESMF_GridCompFinalize(comp1Grid, importState=G1imp, &
        exportState=G1exp, clock=parentclock, rc=rc)
      call ESMF_GridCompFinalize(comp2Grid, importState=G2imp, &
        exportState=G2exp, clock=parentclock, rc=rc)

      call ESMF_CplCompFinalize(compCoupler, importState=G1exp, &
        exportState=G2imp, clock=parentclock, rc=rc)

      ! Now remove the Components to free up their resources
      call ESMF_GridCompDestroy(comp1Grid, rc=rc)
      call ESMF_GridCompDestroy(comp2Grid, rc=rc)
      call ESMF_CplCompDestroy(compCoupler, rc=rc)

      call ESMF_LogWrite( "Parent Gridded Component Finalize routine finished", ESMF_LOGMSG_INFO)
      rc=ESMF_SUCCESS

    end subroutine my_final