/[MITgcm]/MITgcm/pkg/aim/phy_shtorh.F
ViewVC logotype

Annotation of /MITgcm/pkg/aim/phy_shtorh.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.6 - (hide annotations) (download)
Mon Aug 1 19:34:58 2005 UTC (18 years, 10 months ago) by cnh
Branch: MAIN
CVS Tags: HEAD
Changes since 1.5: +1 -1 lines
FILE REMOVED
Emptying aim/ since aim_v23 is now "the one" for all experiements.

1 cnh 1.6 C $Header: /u/gcmpack/MITgcm/pkg/aim/phy_shtorh.F,v 1.5 2002/09/27 20:05:11 jmc Exp $
2 cnh 1.3 C $Name: $
3 adcroft 1.2
4 jmc 1.5 #include "AIM_OPTIONS.h"
5    
6 cnh 1.3 SUBROUTINE SHTORH (IMODE,NGP,TA,PS,SIG,QA,RH,QSAT,myThid)
7 adcroft 1.2 C--
8     C-- SUBROUTINE SHTORH (IMODE,NGP,TA,PS,SIG,QA,RH,QSAT)
9     C--
10     C-- Purpose: compute saturation specific humidity and
11     C-- relative hum. from specific hum. (or viceversa)
12     C-- Input: IMODE : mode of operation
13     C-- NGP : no. of grid-points
14     C-- TA : abs. temperature
15     C-- PS : normalized pressure (= p/1000_hPa) [if SIG < 0]
16     C-- : normalized sfc. pres. (= ps/1000_hPa) [if SIG > 0]
17     C-- SIG : sigma level
18     C-- QA : specific humidity in g/kg [if IMODE > 0]
19     C-- RH : relative humidity [if IMODE < 0]
20     C-- QSAT : saturation spec. hum. in g/kg
21     C-- Output: RH : relative humidity [if IMODE > 0]
22     C-- QA : specific humidity in g/kg [if IMODE < 0]
23     C--
24    
25 jmc 1.5 IMPLICIT NONE
26 adcroft 1.2
27 jmc 1.5 C-- Routine arguments:
28     INTEGER IMODE, NGP
29 cnh 1.3 INTEGER myThid
30 jmc 1.5 _RL TA(NGP), PS(NGP), QA(NGP), RH(NGP), QSAT(NGP)
31    
32     C- jmc: declare all routine arguments:
33     _RL SIG
34    
35     #ifdef ALLOW_AIM
36    
37     C-- Local variables:
38     INTEGER J
39 adcroft 1.2
40 jmc 1.5 C- jmc: declare all local variables:
41     _RL E0, C1, C2, T0, T1, T2
42     C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
43 adcroft 1.2
44     C--- 1. Compute Qsat (g/kg) from T (degK) and normalized pres. P (= p/1000_hPa)
45     C If SIG > 0, P = Ps * sigma, otherwise P = Ps(1) = const.
46     C
47     E0= 6.108 _d -3
48     C1= 17.269 _d 0
49     C2= 21.875 _d 0
50     T0=273.16 _d 0
51     T1= 35.86 _d 0
52     T2= 7.66 _d 0
53     C
54     DO 110 J=1,NGP
55     QSAT(J)=0.
56     IF (TA(J).GE.T0) THEN
57     QSAT(J)=E0*EXP(C1*(TA(J)-T0)/(TA(J)-T1))
58     ELSE IF ( TA(J).GT.0.) then
59     QSAT(J)=E0*EXP(C2*(TA(J)-T0)/(TA(J)-T2))
60     ENDIF
61     110 CONTINUE
62     C
63     IF (SIG.LE.0.0) THEN
64     DO 120 J=1,NGP
65     QSAT(J)=622. _d 0*QSAT(J)/(PS(1)-0.378 _d 0*QSAT(J))
66     120 CONTINUE
67     ELSE
68     DO 130 J=1,NGP
69     QSAT(J)=622. _d 0*QSAT(J)/(SIG*PS(J)-0.378 _d 0*QSAT(J))
70     130 CONTINUE
71     ENDIF
72     chh write(0,*) 'MAXVAL(QSAT)=',MAXVAL(QSAT)
73     chh write(0,*) 'MINVAL(QSAT)=',MINVAL(QSAT)
74     C
75     C--- 2. Compute rel.hum. RH=Q/Qsat (IMODE>0), or Q=RH*Qsat (IMODE<0)
76     C
77     IF (IMODE.GT.0) THEN
78     DO 210 J=1,NGP
79     IF(QSAT(J).ne.0.) then
80     RH(J)=QA(J)/QSAT(J)
81     ELSE
82     RH(J)=0.
83     ENDIF
84     210 CONTINUE
85     ELSE IF (IMODE.LT.0) THEN
86     DO 220 J=1,NGP
87     QA(J)=RH(J)*QSAT(J)
88     220 CONTINUE
89     ENDIF
90     chh write(0,*) 'MAXVAL(QA)=',MAXVAL(QA)
91     chh write(0,*) 'MINVAL(QA)=',MINVAL(QA)
92     chh write(0,*) 'MAXVAL(RH)=',MAXVAL(RH)
93     chh write(0,*) 'MINVAL(RH)=',MINVAL(RH)
94 jmc 1.5
95     #endif /* ALLOW_AIM */
96 adcroft 1.2 RETURN
97     END
98    
99     SUBROUTINE ZMEDDY (NLON,NLAT,FF,ZM,EDDY)
100    
101 jmc 1.5 IMPLICIT NONE
102 adcroft 1.2
103 jmc 1.5 C *** Decompose a field into zonal-mean and eddy component
104 adcroft 1.2
105 jmc 1.5 C-- Routine arguments:
106     INTEGER NLON, NLAT
107     _RL FF(NLON,NLAT), ZM(NLAT), EDDY(NLON,NLAT)
108    
109     #ifdef ALLOW_AIM
110    
111     C-- Local variables:
112     INTEGER I,J
113    
114     C- jmc: declare all local variables:
115     _RL RNLON
116     C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
117 adcroft 1.2
118     RNLON=1./NLON
119     C
120     DO 130 J=1,NLAT
121     C
122     ZM(J)=0.
123     DO 110 I=1,NLON
124     ZM(J)=ZM(J)+FF(I,J)
125     110 CONTINUE
126     ZM(J)=ZM(J)*RNLON
127     C
128     DO 120 I=1,NLON
129     EDDY(I,J)=FF(I,J)-ZM(J)
130     120 CONTINUE
131     C
132     130 CONTINUE
133     C
134     C--
135 jmc 1.5 #endif /* ALLOW_AIM */
136    
137 adcroft 1.2 RETURN
138     END

  ViewVC Help
Powered by ViewVC 1.1.22