      REAL FUNCTION MR2TDEW(WVMR,PRESSURE)
      IMPLICIT NONE
C
C**********************************************************************
C
C   NAME- MR2TDEW
C
C   LANGUAGE- FORTRAN        TYPE- FUNCTION        COMPUTER- IBM SP
C
C   VERSION- 1.0    DATE- 07/28/05   PROGRAMMER- FRANK TILLEY (RAYTHEON)
C   VERSION- 2.0    DATE- 01/09/06   PROGRAMMER- FRANK TILLEY (ERT)
C                   REMOVED DEPENDENCE UPON THE DEWPOINT TEMPERATURE
C                   BEING ABOVE OR BELOW FREEZING. REPLACED FUNCTION
C                   TDEW2MR WITH FUNCTION W TO GO FROM DEWPOINT TEMPERATURE
C                   TO MIXING RATIO.
C 
C   FUNCTION- THIS FUNCTION RETURNS THE DEWPOINT TEMPERATURE FOR A
C             GIVEN MIXING RATIO AND PRESSURE. THE FUNCTION WAS ORIGINALLY
C             WRITTEN BY MIKE PETTEY (RAYTHEON) IN JAVA FOR THE PDISP
C             PROGRAM.
C
C  CALLING SEQUENCE PARAMETERS-
C     ARGUMENT         TYPE  I/O  FUNCTION
C     --------         ----  ---  --------
C     WVMR             REAL   I   WATER VAPOR MIXING RATIO
C     PRESSURE         REAL   I   ATMOSPHERIC PRESSURE IN MILLIBARS
C
C
C  LOCAL VARIABLES-
C     NAME             TYPE    DESCRIPTION
C     ----             ----    -----------
C     KELVIN           REAL    KELVIN FREEZING POINT CONSTANT
C     VPRESS           REAL    VAPOR PRESSURE
C     W                REAL    INTERMEDIATE VALUE
C
C  SUBPROGRAMS CALLED- NONE
C
C******************************************************************
C
      REAL WVMR, PRESSURE
C
      REAL DWPT, KELVIN, W, VPRESS
C
      PARAMETER(KELVIN = 273.16)

      VPRESS = (PRESSURE*(WVMR / 622.0)) / (1.0 + (WVMR / 622.0))
c     W = ALOG(VPRESS/6.1078)
      W = LOG(VPRESS/6.1078)
C
      MR2TDEW = W*238.3 / (17.2694-W) 
C
      RETURN
      END
