MODULE CPLNG_FINALIZE_MOD

    IMPLICIT NONE

    PRIVATE

    PUBLIC CPLNG_FINALIZE

CONTAINS

SUBROUTINE CPLNG_FINALIZE

    USE MOD_OASIS
    USE CPLNG_DATA_MOD

    INTEGER          :: IERROR
    CHARACTER(LEN=3) :: CERRSTR

    ! Finalize by calling OASIS terminate routine
    CALL OASIS_TERMINATE(IERROR)

    ! Check error code
    IF (IERROR/=OASIS_OK) THEN
        WRITE (CERRSTR,'(I3)') IERROR
        CALL OASIS_ABORT(CPLNG_COMP_ID,CPLNG_COMP_NAME,"CPLNG_FINALIZE: OASIS_TERMINATE returns error code: "//CERRSTR)
    ENDIF

END SUBROUTINE CPLNG_FINALIZE

END MODULE CPLNG_FINALIZE_MOD
