SUBROUTINE MHUAESV 1
#if defined (DOC)
***   S/R MHUAES  -  CALCULATE ES=T-TD FROM T AND Q
*
*Author
*          N. Brunet  (Jan91)
*
*Revision
* 001      B. Bilodeau  (August 1991)- Adaptation to UNIX
*
* 002      C.CHOUINARD  (August 1998)- ADAPTATION TO 3DVAR
*
* 003      C.CHARETTE  (March 1999)- Added llprint and print diagnostics
* 004      S.Pellerin  (SEPT. 2000)- Exclude reference to commvo1
* 005      JM Belanger CMDA/SMC  Nov 2000
*                   . 32 bits conversion
* 006      Y.J. Rochon and Cecilien Charette - SMC - Sept 2004
*            - Use of new function FOTW8 FOEFQ8(in fintern8.cdk)
*              Follow WMO convention on T-Td vs HU relationship)

*Object
*          to calculate the dew point depression from specific
*          humidity, temperature and pressure.  No ice phase
*          is permitted and the pressure vector is given.
*
#endif
      IMPLICIT NONE
*IMPLICITS
*         --------------------------------------------------------------------------
#include "comlun.cdk"
#include "pardim.cdk"
#include "comdim.cdk"
#include "comdimo.cdk"
#include "comgem.cdk"
#include "commvo.cdk"
#include "commvog.cdk"
#include "comcst.cdk"
*
      INTEGER JOBS,JLEV
      REAL*8 ZE, ZTD, ZHU
      LOGICAL LLPRINT
*
#include "comphy.cdk"
#include "dintern8.cdk"
#include "fintern8.cdk"
*
c
*
      LLPRINT = .FALSE.
*
      DO JLEV=1,NFLEV
*
        DO JOBS=1,NOBTOT
*
*        Get the saturated vapor pressure from q (specific humidity)
*
         ZHU = exp(gomqg(jlev,jobs))
         ZE = FOEFQ8(ZHU, RPPOBS(JLEV,JOBS))
*
*        Now the dewpoint temperature
*
         ZTD=FOTW8(ZE)
*
*        Finally the dewpoint depression
*
         GOMESG(JLEV,JOBS) = min(GOMTG(JLEV,JOBS) - ZTD,rmaxes)

********************************************************************
c         IF(LLPRINT) THEN
c            write(nulout,*)'MHUAESV:JOBS,JLEV,RPOBS,GMESG,GMTG,ZTD,ZHU '
c     &           ,JOBS,JLEV,RPPOBS(JLEV,JOBS),GOMESG(JLEV,JOBS)
c     &           ,GOMTG(JLEV,JOBS),ZTD,ZHU
c         ENDIF
*******************************************************************
*
        ENDDO
*
      ENDDO
*
      RETURN
      END