Mixing Ratio -> Dewpoint

Ben Quinn benquinn at OPTUSHOME.COM.AU
Fri Feb 24 19:47:17 EST 2006


Brilliant!

Thanks Warren, Charles!


----- Original Message -----
From: "Charles Seman" <Charles.Seman at NOAA.GOV>
To: <GRADSUSR at LIST.CINECA.IT>
Sent: Saturday, February 25, 2006 5:28 AM
Subject: Re: Mixing Ratio -> Dewpoint


> Dear Ben,
>
> Please find attached a GrADS script function "qvtd.gsf" which calculates
> the dewpoint temperature, given values for the air pressure (Pa) and
> water vapor mixing ratio (kg/kg).  "qvtd.gsf" solves Teten's formula
> (see, for example:  "The Computation of Equivalent Potential
> Temperature" (Bolton, 1980, MWR) and compare formula in "qvtd.gsf" to
> Equation 13.1.4a, page 551 in "An Introduction to Boundary Layer
> Meteorology" by Roland B. Stull (1988)).  Also attached is a GrADS
> script "test_qvtd.gs" which calls "qvtd.gsf".  Here is a sample output:
>
> ga-> test_qvtd 100000 0.02
> P, QV = 100000, 0.02
> Function "qvtd":
> P(hPa) = 1000
> QV(kg/kg) = 0.02
> QV(g/kg)  = 20
> Td(C) = 25.247201488183
> Td(K) = 298.397201488183
>
> I hope this helps, and please let me know if you have any questions, OK?
>
> Thanks,
> Chuck
>
> Ben Quinn wrote:
>
> >Hi all,
> >
> >Does anyone have or know where i can find a formula to convert the mixing
> >ratio to a dew point figure when i have pressure and temperature to work
> >with? I've gone through the archives and spent several hours going
through
> >Google search results but haven't had any luck so far.  Any help would be
> >appreciated!
> >
> >
>
> --
>
> ********************************************************************
>  Charles Seman                                charles.seman at noaa.gov
>  U.S. Department of Commerce / NOAA / OAR
>  Geophysical Fluid Dynamics Laboratory         voice: (609) 452-6547
>  201 Forrestal Road                              fax: (609) 987-5063
>  Princeton, NJ  08540-6649            http://www.gfdl.noaa.gov/~cjs/
> ********************************************************************
>
> "The contents of this message are mine personally and do not reflect
> any position of the Government or NOAA."
>
>


----------------------------------------------------------------------------
----


> *************************************************************************
>
> function qvtd(P,QV)
>
> *-----------------------------------------------------------------------
> *
> *  Calculates the dewpoint temperature (Td, in K) given the air
> *  pressure (Pa) and water vapor mixing ratio (kg[H2O]/kg[dry air])
> *
> *  Solve Teten's formula
> *
> *         QVsat = (380./P)*exp(17.2693882*(Td-Tfr)/(Td-35.86))
> *
> *  for the dewpoint temperature, Td:
> *
> *         Td = (Tfr - (c/b)*ln(qvsat/a))/(1 - ln(qvsat/a)/b)
> *
> *     where
> *
> *         Tfr = freezing temperature (K)
> *         P = air pressure (Pa)
> *         QVsat = actual water vapor mixing ratio (kg[H2O]/kg[dry air])
> *                 (= saturation mixing ratio at Td)
> *
> *         a = 380./P
> *         b = 17.2693882
> *         c = 35.86
> *
> *  Compare to Equation 13.1.4a, page 551 in
> *  "An Introduction to Boundary Layer Meteorology" by Roland B. Stull
(1988).
> *
> *  Note, uses function "math_log(x)" to calculate the natural logarithm
> *  from:  http://grads.iges.org/grads/gadoc/mathfunctions.html
> *
> *-----------------------------------------------------------------------
> *
> say 'Function "qvtd":'
> *
> * constants required for function
> *
> Tfr = 273.15
> b = 17.2693882
> c = 35.86
> a = 380./P
>
> say 'P(hPa) = 'P*0.01
> say 'QV(kg/kg) = 'QV
> say 'QV(g/kg)  = 'QV*1000.
>
> qvsat = QV
> qvsat_ratio = qvsat/a
> if( qvsat_ratio > 0. )
>   Td = (Tfr-(c/b)*math_log(qvsat/a))/(1-math_log(qvsat/a)/b)
> else
>   say
>   say '"qvsat/a" is not greater than zero;  qvsat/a = 'qvsat/a
>   say 'exit script...'
>   say
>   exit
> endif
>
> say 'Td(C) = 'Td-Tfr
>
> return(Td)
>
> *************************************************************************
>


----------------------------------------------------------------------------
----


> ************************************************************************
> *
> *  Tests the function "qvtd.gsf"
> *
> *  Note, uses function "math_log(x)" to calculate the natural logarithm
> *  from:  http://grads.iges.org/grads/gadoc/mathfunctions.html
> *
> *  To use, open a GrADS window, and type:
> *
> *       ga-> test_qvtd P QV
> *
> *  where "P" is a value for air pressure (Pa) and
> *        "QV" is a value for water vapor mixing ratio (kg[H2O]/kg[dry
air])
> *
> ************************************************************************
>
> function test_qvtd (args)
> *
> *  Allow external GrADS functions
> *
> rc = gsfallow("on")
>
> P  = subwrd(args,1)
> QV = subwrd(args,2)
> *P  = 100000
> *QV = 0.01
>
> say 'P, QV = 'P', 'QV
>
> dewpt = qvtd(P,QV)
> say 'Td(K) = 'dewpt
>
> return
>



More information about the gradsusr mailing list