!--------------------------------------------------------------------------------------------------
!  DOXYGEN
!> @brief Inserir Brief de DUMPVAR
!> @details Inserir Details de DUMPVAR
!> @author ORIGINATOR - ????? 
!> @date ??-??-?? \n
!> @author LUCCI 
!> @date 18-03-20 \n
!> @version V1.1.0
!> @details MODERNIZATION OF THE CODE, INCLUDING:
!!                      * F77 TO F90/F95
!!                      * INDENTATION & UNIFORMIZATION CODE
!!                      * REPLACEMENT OF COMMONS BLOCK FOR MODULES
!!                      * DOCUMENTATION WITH DOXYGEN
!!                      * OPENMP FUNCTIONALITY 
!<
!> @details <b>Use Module:</b>
!! @arg @c DYNAM
!! @arg @c F77KINDS
!! @arg @c MPPSTAFF
!! @arg @c PARMETA
!! @arg @c VRBLS
!> @details <b>Driver:</b> 
!<
!> @details <b>Calls:</b>
!! @arg @c MPI_ISEND
!! @arg @c MPI_WAIT
!--------------------------------------------------------------------------------------------------
    SUBROUTINE DUMPVAR
!--------------------------------------------------------------------------------------------------
! SUBROUTINE DUMPVAR
!
! SUBPROGRAM: DUMPVAR - ?????
! PROGRAMMER: ?????
! ORG: W/NP2 
! DATE: ??-??-??
!
! ABSTRACT:
! ?????
!
! PROGRAM HISTORY LOG:
! ??-??-??  ?????     - ORIGINATOR
! 18-03-20  LUCCI     - MODERNIZATION OF THE CODE, INCLUDING:
!                       * F77 TO F90/F95
!                       * INDENTATION & UNIFORMIZATION CODE
!                       * REPLACEMENT OF COMMONS BLOCK FOR MODULES
!                       * DOCUMENTATION WITH DOXYGEN
!                       * OPENMP FUNCTIONALITY 
!
! INPUT ARGUMENT LIST:
! NONE
!
! OUTPUT ARGUMENT LIST:
! NONE
!
! INPUT/OUTPUT ARGUMENT LIST:
! NONE 
!
! USE MODULES: DYNAM
!              F77KINDS
!              MPPSTAFF
!              PARMETA
!              VRBLS
!  
! DRIVER     : -----
!
! CALLS      : MPI_ISEND
!              MPI_WAIT             
!--------------------------------------------------------------------------------------------------
    USE DYNAM
    USE F77KINDS
    USE MPPSTAFF
    USE PARMETA
    USE VRBLS
!
    IMPLICIT NONE
!
    INCLUDE "mpif.h"
!
    INTEGER(KIND=I4)                                                                            ::&
    & NDATA   , ISEND   , IERR    ,                                                               &
    & I       , J       , L       ,                                                               &
    & SH1     , SH2     , SH3     , SH4
!
    INTEGER(KIND=I4)    , DIMENSION(MPI_STATUS_SIZE)                                            ::&
    & ISTAT
!
    REAL   (KIND=R4)    , DIMENSION(0:IM+1, 0:JM+1, LM)                                         ::&
    & THETA
!
    REAL   (KIND=R4)                                                                            ::&
    & PRES    , PBB
!
    NDATA = (IM + 2) * (JM + 2) * LM
!
    DO L=1,LM
        DO I=0,IM+1
            DO J=0,JM+1
                PRES = PT + RES(I,J) * PD(I,J) * AETA(L)
                PBB  = (PRES / P0) ** KAPPA
!
                THETA(I,J,L) = T(I,J,L) / PBB
            END DO
        END DO
    END DO
!
    CALL MPI_ISEND(T    , NDATA, ITYPE, DGNSNUM, DGNSTAG, MPI_COMM_WORLD, SH1, ISEND)
    CALL MPI_ISEND(U    , NDATA, ITYPE, DGNSNUM, DGNSTAG, MPI_COMM_WORLD, SH2, ISEND)
    CALL MPI_ISEND(V    , NDATA, ITYPE, DGNSNUM, DGNSTAG, MPI_COMM_WORLD, SH3, ISEND)
    CALL MPI_ISEND(THETA, NDATA, ITYPE, DGNSNUM, DGNSTAG, MPI_COMM_WORLD, SH4, ISEND)
!
    CALL MPI_WAIT(SH1, ISTAT, IERR)
    CALL MPI_WAIT(SH2, ISTAT, IERR)
    CALL MPI_WAIT(SH3, ISTAT, IERR)
    CALL MPI_WAIT(SH4, ISTAT, IERR)
!
    END SUBROUTINE DUMPVAR
