[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

20050117: Ice bulb temperature



Pat,

your PR_ routine would be used for SF and SN programs.
You need to add your function to $GEMTBL/parms/pcconv.tbl,

and

Add your PR_TMIB routine to the call list in $GEMPAK/sounrce/gemlib/pc/pcfunc.f.

To create a grid program function, you would need to create a
DF library function to call your PR routine for every grid point
and add this routine to the call list of $GEMPAK/source/gemlib/dg/dgdriv.f.

Steve Chiswell

On Mon, 17 Jan 2005, Patrick S. Market wrote:

> Steve:
>
> I am trying to include a subroutine into GEMPAK that I have modified.
>
> I have rewritten TMWB to calculate to include the latent heat of fusion
> as well (see below).  The code compiles alright, but trying to use it
> turns up:
>
>       [DG -19]  Operator TMIB is not recognized.
>
> How do I get this new function into GEMPAK?
>
> Pat
>
>
>
> *******************************begin include****************************
>         FUNCTION PR_TMIB  ( tmpk, rmix, pres )
> C************************************************************************
> C* PR_TMIB                                                              *
> C*                                                                      *
> C* This function computes ice bulb temperature from the temperature,    *
> C* mixing ratio, and pressure.  The result is obtained by solving       *
> C* for the temperature at which saturation occurs when the latent       *
> C* heat required to vaporize/melt ice is provided by a cooling of       *
> C* the air.  The equation representing the process is                   *
> C*                                                                      *
> C*      ( TMPK - TMWB ) * CP - ( Rsat (TMWB) - RMIX ) * LVAP = 0        *
> C*                                                                      *
> C* This implicit equation is solved by Newton's method, since the       *
> C* saturation mixing ratio Rsat is a transcendental function of         *
> C* TMWB.                                                                *
> C*                                                                      *
> C* The expressions for the heat of vaporization (LVAP) and saturation   *
> C* vapor pressure are equations (2) and (10) from Bolton (MWR, 1980).   *
> C*                                                                      *
> C* REAL PR_TMIB  ( TMPK, RMIX, PRES )                                   *
> C*                                                                      *
> C* Input parameters:                                                    *
> C*      TMPK            REAL            Temperature (K)                 *
> C*      RMIX            REAL            Mixing ratio (g/kg)             *
> C*      PRES            REAL            Pressure (mb)                   *
> C*                                                                      *
> C* Output parameters:                                                   *
> C*      PR_TMIB         REAL            Wet bulb temperature (K)        *
> C**                                                                     *
> C* Log:                                                                 *
> C* K. Brill/NMC          4/94                                           *
> C* S. Jacobs/NMC         4/94   Changed input RMIX from kg/kg to g/kg   *
> C* G. Krueger/EAI        4/96   Replaced C->K constant with PR_TMKC     *
> C* T. Lee/GSC           11/96   Changed constant                        *
> C* S. Jacobs/NCEP        8/97   Changed latent heat calc to use PR_LHVP *
> C* T. Lee/GSC            8/97   Set TMWB <= temp; Simplify computation  *
> C************************************************************************
>         INCLUDE         'GEMPRM.PRM'
> C*
>         PARAMETER       ( A = 6.112, B = 17.67, C = 243.5, EPSI = .622 )
>         PARAMETER       ( G = B * C )
>         PARAMETER       ( ERRMAX = .001 )
> C*
>         LOGICAL         convrg
> C*
>         INCLUDE         'ERMISS.FNC'
> C------------------------------------------------------------------------
> C*      Check for missing values.
> C
>         IF  ( ERMISS ( tmpk ) .or. ERMISS ( rmix ) .or. ERMISS ( pres )
>      +       .or.  ( pres .le. 0. ) )  THEN
>             PR_TMWB = RMISSD
>           ELSE
> C
> C*          Change temperature to degrees Celsius.
> C
>             tmp = PR_TMKC (tmpk)
> C
> C*          Compute the latent heat of sublimation.
> C
>             lvap = PR_LHVP ( tmp ) + (0.333 * 1.0E6)
> C
> C*          Compute the specific heat of moist air.
> C
>             rmix = rmix / 1000.
>             cp = 1005.7 * ( 1. + .887 * rmix )
> C
> C*          Compute L / cp.
> C
>             rlocp = lvap / cp
> C
> C*          Do Newton iteration.
> C
>             iter = 0
>             tib = tmp
>             convrg = .false.
>             DO WHILE ( iter .le. 50 .and. .not. convrg )
>                 iter = iter + 1
>                 bt = B * tib
>                 tpc = tib + C
>                 d = ( pres / A ) * EXP ( -bt / tpc )
>                 dm1 = d - 1.
>                 f = ( tmp - tib ) - rlocp * ( EPSI / dm1 - rmix )
>                 df = - G  / ( tpc * tpc )
>                 df = d * df * rlocp * EPSI / ( dm1 * dm1 ) - 1.
>                 cor = f / df
>                 tib = tib - cor
>                 IF ( ABS ( cor ) .le. ERRMAX ) convrg = .true.
>             END DO
> C*
>             IF ( .not. convrg ) THEN
>                 PR_TMWB = RMISSD
>               ELSE
>                 twk     = PR_TMCK (tib)
>                 IF  ( twk .gt. tmpk )  twk = tmpk
>                 PR_TMIB = twk
>             END IF
>         END IF
> C*
>         RETURN
>         END
>
> *******************************begin include****************************
>
> --
> ========================================================================
> Dr. Patrick S. Market
> Dept. of Soil, Env. & Atmospheric Sci.
> University of Missouri-Columbia                 Phone:  (573) 882 - 1496
> 331 ABNR Hall                                   Lab:    (573) 882 - 4401
> Columbia, MO 65211 USA          E-mail: address@hidden
> ========================================================================
>