!copyright (C) 2001 MSC-RPN COMM %%%RPNPHY%%%
***S/R MHUAHR - PASSAGE DE HU A HR
*
#include "phy_macros_f.h"
SUBROUTINE MHUAHR(HR,HU,TX,PX,LNPS,MODP,SWTT,SWPH, 1,4
$ NI,NK,N)
#include "impnone.cdk"
*
INTEGER NI, NK, N, MODP
REAL HR(NI,NK), HU(NI,NK), TX(NI,NK)
REAL PX(NK), LNPS(NI,*)
REAL TEMP1, TEMP2
*
*
LOGICAL SWTT, SWPH
*
*Author
* N. Brunet (Jan91)
*
*Revision
* 001 B. Bilodeau (August 1991)- Adaptation to UNIX
* 002 B. Bilodeau (January 2001) - Automatic arrays
*
*Object
* to calculate relative humidity from specific humidity,
* temperature and pressure
*
*Arguments
*
* - Output -
* HR relative humidity in fraction
*
* - Input -
* HU specific humidity in kg/kg
* TX temperature or virtual temperature in Kelvins
* PX see MODP
* LNPS see MODP
* MODP pressure mode (SI units only):
* =0; pressure level in PX
* =1; sigma level in PX and PS(surface pressure) in LNPS
* =2; sigma level in PX and logarithm of sigma level in
* LNPS
* =3; all points of pressure in LNPS(NI,*) in Pascals
* =4; sigma level in PX and logarithm of sigma level in
* LNPS(in millibars unless using SI units)
* =5; logarithm of pressure level in PX(in millibars unless
* using SI units)
* SWTT .TRUE. to pass TT for argument
* .FALSE. to pass TV for argument
* SWPH .TRUE. to consider water and ice phase
* .FALSE. to consider water phase only
* NI horizontal dimension
* NK vertical dimension
* N number of treated points
*
*
*IMPLICITES
#include "consphy.cdk"
*MODULES
EXTERNAL INCTPHY
*
**
*--------------------------------------------------------------------
*
************************************************************************
* AUTOMATIC ARRAYS
************************************************************************
*
AUTOMATIC ( PN , REAL , (N) )
AUTOMATIC ( TP , REAL , (N) )
*
************************************************************************
*
INTEGER I, K
*
#include "dintern.cdk"
#include "fintern.cdk"
*--------------------------------------------------------------------
#include "initcph.cdk"
*
*
DO 10 K=1,NK
*
#include "modpr2.cdk"
*
IF(SWTT)THEN
DO 100 I=1,N
100 TP
(I) = TX(I,K)
ELSE
DO 105 I=1,N
105 TP
(I) = FOTTV(TX(I,K),HU(I,K))
END IF
*
DO 200 I=1,N
IF(SWPH)THEN
TEMP1 = TP
(I)
TEMP2 = PN(I)
HR(I,K) = FOHR(HU(I,K),TEMP1,TEMP2)
ELSE
TEMP1 = TP
(I)
TEMP2 = PN(I)
HR(I,K) = FOHRA(HU(I,K),TEMP1,TEMP2)
END IF
200 CONTINUE
*
10 CONTINUE
*
*
RETURN
END