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

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

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


Revision 1.5 - (show annotations) (download)
Fri Sep 27 20:05:11 2002 UTC (21 years, 7 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint46n_post, checkpoint48f_post, checkpoint51k_post, checkpoint53f_post, checkpoint47j_post, checkpoint54a_pre, checkpoint55c_post, checkpoint53b_pre, checkpoint48d_pre, checkpoint51l_post, checkpoint51j_post, branch-exfmods-tag, checkpoint47e_post, checkpoint57m_post, checkpoint52l_pre, checkpoint48i_post, checkpoint52e_pre, hrcube4, hrcube5, checkpoint57g_pre, checkpoint52j_post, checkpoint47f_post, checkpoint48d_post, checkpoint51o_pre, checkpoint57f_post, checkpoint46j_post, checkpoint47c_post, checkpoint50e_post, checkpoint52e_post, checkpoint50c_post, checkpoint46i_post, checkpoint51n_pre, checkpoint47d_post, checkpoint57j_post, checkpoint47a_post, checkpoint57b_post, checkpoint52d_pre, checkpoint53c_post, checkpoint53d_post, checkpoint57f_pre, checkpoint48a_post, checkpoint55d_pre, checkpoint51f_pre, checkpoint57g_post, checkpoint48e_post, checkpoint57c_pre, checkpoint48h_post, checkpoint55j_post, checkpoint56b_post, checkpoint50c_pre, checkpoint57h_pre, branchpoint-genmake2, checkpoint46k_post, checkpoint52j_pre, checkpoint54a_post, branch-netcdf, checkpoint50d_pre, checkpoint55h_post, checkpoint51r_post, checkpoint47i_post, checkpoint52b_pre, checkpoint52n_post, checkpoint54b_post, checkpoint46l_pre, checkpoint46j_pre, checkpoint51i_post, checkpoint57e_post, checkpoint54d_post, checkpoint47h_post, checkpoint48c_post, checkpoint46l_post, checkpoint56c_post, checkpoint54e_post, checkpoint55b_post, checkpoint51e_post, checkpoint51b_post, checkpoint51l_pre, checkpoint52m_post, checkpoint51c_post, checkpoint55, checkpoint53a_post, checkpoint55a_post, checkpoint57a_post, checkpoint48, checkpoint49, checkpoint47b_post, checkpoint56, checkpoint57o_post, checkpoint55g_post, checkpoint57h_done, checkpoint51o_post, checkpoint48g_post, checkpoint57k_post, checkpoint57d_post, checkpoint55f_post, checkpoint57i_post, checkpoint51q_post, checkpoint52l_post, checkpoint52k_post, checkpoint57h_post, checkpoint57a_pre, checkpoint54, checkpoint57, checkpoint53b_post, checkpoint51, checkpoint50, checkpoint53, checkpoint52, checkpoint50d_post, checkpoint52d_post, checkpoint51b_pre, checkpoint52a_post, checkpoint47g_post, checkpoint52b_post, checkpoint53g_post, checkpoint52f_post, checkpoint57n_post, checkpoint52c_post, checkpoint46m_post, checkpoint57p_post, checkpoint51h_pre, checkpoint50g_post, checkpoint50b_pre, checkpoint51g_post, ecco_c52_e35, checkpoint54f_post, checkpoint51f_post, checkpoint48b_post, checkpoint50b_post, eckpoint57e_pre, checkpoint57c_post, checkpoint50f_post, checkpoint50a_post, checkpoint50f_pre, checkpoint52a_pre, checkpoint47d_pre, checkpoint51d_post, checkpoint48c_pre, checkpoint51m_post, checkpoint51t_post, checkpoint53d_pre, checkpoint47, checkpoint55e_post, checkpoint54c_post, checkpoint50h_post, checkpoint52i_post, checkpoint51a_post, checkpoint50e_pre, checkpoint50i_post, checkpoint51p_post, checkpoint51n_post, checkpoint55i_post, checkpoint51i_pre, checkpoint57l_post, checkpoint52i_pre, checkpoint51u_post, checkpoint52h_pre, checkpoint52f_pre, hrcube_1, hrcube_2, hrcube_3, checkpoint56a_post, checkpoint51s_post, checkpoint55d_post
Branch point for: netcdf-sm0, branch-genmake2, branch-nonh, tg2-branch, checkpoint51n_branch, branch-exfmods-curt
Changes since 1.4: +36 -17 lines
Clean up AIM package (and keep the results unchanged):
a) include CPP_OPTION and use IMPLICT NONE in all routines ;
  declare all the variables _RL ;
b) use _d 0 for all numerical constants in Physics package,
  so that the code works with g77 (and give the right answer)
c) use ifdef ALLOW_AIM everywhere so that the package can be
 compiled without increasing the memory size.
d) clean-up the AIM interface (remove commented lines, unused
  variables ...)

1 C $Header: /u/gcmpack/MITgcm/pkg/aim/phy_shtorh.F,v 1.4 2001/09/06 13:28:01 adcroft Exp $
2 C $Name: $
3
4 #include "AIM_OPTIONS.h"
5
6 SUBROUTINE SHTORH (IMODE,NGP,TA,PS,SIG,QA,RH,QSAT,myThid)
7 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 IMPLICIT NONE
26
27 C-- Routine arguments:
28 INTEGER IMODE, NGP
29 INTEGER myThid
30 _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
40 C- jmc: declare all local variables:
41 _RL E0, C1, C2, T0, T1, T2
42 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
43
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
95 #endif /* ALLOW_AIM */
96 RETURN
97 END
98
99 SUBROUTINE ZMEDDY (NLON,NLAT,FF,ZM,EDDY)
100
101 IMPLICIT NONE
102
103 C *** Decompose a field into zonal-mean and eddy component
104
105 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
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 #endif /* ALLOW_AIM */
136
137 RETURN
138 END

  ViewVC Help
Powered by ViewVC 1.1.22