/[MITgcm]/MITgcm/pkg/aim_v23/aim_dyn2aim.F
ViewVC logotype

Contents of /MITgcm/pkg/aim_v23/aim_dyn2aim.F

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


Revision 1.5 - (show annotations) (download)
Fri Aug 4 22:27:46 2006 UTC (17 years, 9 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint62c, checkpoint59, checkpoint62a, checkpoint62g, checkpoint62f, checkpoint62e, checkpoint62d, checkpoint62k, checkpoint62j, checkpoint62i, checkpoint62h, checkpoint62o, checkpoint62n, checkpoint62m, checkpoint62l, checkpoint62s, checkpoint62r, checkpoint62q, checkpoint62p, checkpoint62w, checkpoint62v, checkpoint62u, checkpoint62t, checkpoint62z, checkpoint62y, checkpoint62x, checkpoint58y_post, checkpoint58t_post, checkpoint64, checkpoint60, checkpoint61, checkpoint62, checkpoint63, checkpoint58w_post, checkpoint58o_post, checkpoint58p_post, checkpoint58q_post, checkpoint63p, checkpoint63q, checkpoint63r, checkpoint63s, checkpoint63l, checkpoint63m, checkpoint63n, checkpoint63o, checkpoint63h, checkpoint63i, checkpoint63j, checkpoint63k, checkpoint63d, checkpoint63e, checkpoint63f, checkpoint63g, checkpoint63a, checkpoint63b, checkpoint63c, checkpoint58r_post, checkpoint58n_post, checkpoint59q, checkpoint59p, checkpoint59r, checkpoint59e, checkpoint59d, checkpoint59g, checkpoint59f, checkpoint59a, checkpoint59c, checkpoint59b, checkpoint59m, checkpoint59l, checkpoint59o, checkpoint59n, checkpoint59i, checkpoint59h, checkpoint59k, checkpoint59j, checkpoint62b, checkpoint58v_post, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint64i, checkpoint64h, checkpoint64k, checkpoint64j, checkpoint64m, checkpoint64l, checkpoint64o, checkpoint64n, checkpoint64a, checkpoint64c, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64g, checkpoint64f, checkpoint61f, checkpoint58x_post, checkpoint61n, checkpoint61q, checkpoint61z, checkpoint61e, checkpoint58u_post, checkpoint58s_post, checkpoint61g, checkpoint61d, checkpoint61b, checkpoint61c, checkpoint61a, checkpoint61o, checkpoint61l, checkpoint61m, checkpoint61j, checkpoint61k, checkpoint61h, checkpoint61i, checkpoint61v, checkpoint61w, checkpoint61t, checkpoint61u, checkpoint61r, checkpoint61s, checkpoint61p, checkpoint61x, checkpoint61y
Changes since 1.4: +3 -3 lines
new S/R AIM_WRITE_PHYS (replaces AIM_WRITE_LOCAL) to write AIM physics
 common-block variables ; Allows multi-threading with master-thread IO.

1 C $Header: /u/gcmpack/MITgcm/pkg/aim_v23/aim_dyn2aim.F,v 1.4 2004/07/08 15:51:19 jmc Exp $
2 C $Name: $
3
4 #include "AIM_OPTIONS.h"
5
6 CStartOfInterface
7 SUBROUTINE AIM_DYN2AIM(
8 O TA, QA, ThA, Vsurf2, PSA, dpFac,
9 O kGrd,
10 I bi,bj, myTime, myIter, myThid)
11 C *==========================================================*
12 C | S/R AIM_DYN2AIM
13 C | o Map dynamics conforming arrays to AIM internal arrays.
14 C *==========================================================*
15 C | this routine transfers grid information
16 C | and all dynamical variables (T,Q, ...) to AIM physics
17 C *==========================================================*
18 IMPLICIT NONE
19
20 C == Global data ==
21 C-- size for MITgcm & Physics package :
22 #include "AIM_SIZE.h"
23
24 #include "EEPARAMS.h"
25 #include "PARAMS.h"
26 #include "GRID.h"
27 #include "SURFACE.h"
28 #include "DYNVARS.h"
29
30 #include "AIM_GRID.h"
31 #include "com_physcon.h"
32
33 C == Routine arguments ==
34 C-- Input:
35 C bi,bj - Tile index
36 C myTime - Current time of simulation ( s )
37 C myIter - Current iteration number in simulation
38 C myThid - Number of this instance of the routine
39 C-- Output: TA = temperature [K} (3-dim)
40 C QA = specific humidity [g/kg] (3-dim)
41 C ThA = Pot.Temp. [K] (replace dry stat. energy)(3-dim)
42 C Vsurf2 = square of surface wind speed (2-dim)
43 C PSA = norm. surface pressure [p/p0] (2-dim)
44 C dpFac = cell delta_P fraction (3-dim)
45 C kGrd = Ground level index (2-dim)
46 C-- Updated common blocks: AIM_GRID_R
47 C WVSurf : weights for near surf interpolation (2-dim)
48 C fOrogr : orographic factor (for surface drag) (2-dim)
49 C snLat,csLat : sin(Lat) & cos(Lat) (2-dim)
50
51 INTEGER bi, bj, myIter, myThid
52 _RL myTime
53
54 _RL TA(NGP,NLEV), QA(NGP,NLEV), ThA(NGP,NLEV)
55 _RL Vsurf2(NGP), PSA(NGP), dpFac(NGP,NLEV)
56 INTEGER kGrd(NGP)
57
58 CEndOfInterface
59
60 #ifdef ALLOW_AIM
61 C == Local variables ==
62 C Loop counters
63 C msgBuf :: Informational/error message buffer
64 CHARACTER*(MAX_LEN_MBUF) msgBuf
65 INTEGER I, J, I2, K, Katm
66 _RL conv_theta2T, temp1, temp2
67
68 c _RL hInitC(5), hInitF(5)
69 c DATA hInitC / 17338.0,10090.02,5296.88,2038.54,418.038/
70 c DATA hInitF / 15090.4, 8050.96, 4087.75, 1657.54, 0. /
71
72 C- Compute Sin & Cos (Latitude) :
73 DO J = 1,sNy
74 DO I = 1,sNx
75 I2 = I+(J-1)*sNx
76 snLat(I2,myThid) = SIN(yC(I,J,bi,bj)*deg2rad)
77 csLat(I2,myThid) = COS(yC(I,J,bi,bj)*deg2rad)
78 ENDDO
79 ENDDO
80
81 C- Set surface level index :
82 DO J = 1,sNy
83 DO I = 1,sNx
84 I2 = I+(J-1)*sNx
85 kGrd(I2) = (Nr+1) - ksurfC(I,J,bi,bj)
86 ENDDO
87 ENDDO
88
89 C- Set (normalized) surface pressure :
90 DO J=1,sNy
91 DO I=1,sNx
92 I2 = I+(J-1)*sNx
93 K = ksurfC(i,j,bi,bj)
94 IF ( K.LE.Nr ) THEN
95 c PSA(I2) = rF(K)/atm_po
96 PSA(I2) = Ro_surf(i,j,bi,bj)/atm_po
97 ELSE
98 PSA(I2) = 1.
99 ENDIF
100 ENDDO
101 ENDDO
102
103 C- Set cell delta_P fraction (of the full delta.P = drF_k):
104 #ifdef NONLIN_FRSURF
105 IF ( staggerTimeStep .AND. nonlinFreeSurf.GT.0 ) THEN
106 IF ( select_rStar.GT.0 ) THEN
107 DO k = 1,Nr
108 Katm = _KD2KA( k )
109 DO j = 1,sNy
110 DO i = 1,sNx
111 I2 = i+(j-1)*sNx
112 dpFac(I2,Katm) = h0FacC(i,j,k,bi,bj)*rStarFacC(i,j,bi,bj)
113 c dpFac(I2,Katm) = 1. _d 0
114 ENDDO
115 ENDDO
116 ENDDO
117 ELSE
118 DO k = 1,Nr
119 Katm = _KD2KA( k )
120 DO j = 1,sNy
121 DO i = 1,sNx
122 I2 = i+(j-1)*sNx
123 IF ( k.EQ.ksurfC(i,j,bi,bj) ) THEN
124 dpFac(I2,Katm) = hFac_surfC(i,j,bi,bj)
125 ELSE
126 dpFac(I2,Katm) = hFacC(i,j,k,bi,bj)
127 ENDIF
128 c dpFac(I2,Katm) = 1. _d 0
129 ENDDO
130 ENDDO
131 ENDDO
132 ENDIF
133 ELSE
134 #else /* ndef NONLIN_FRSURF */
135 IF (.TRUE.) THEN
136 #endif /* NONLIN_FRSURF */
137 DO k = 1,Nr
138 Katm = _KD2KA( k )
139 DO j = 1,sNy
140 DO i = 1,sNx
141 I2 = i+(j-1)*sNx
142 dpFac(I2,Katm) = hFacC(i,j,k,bi,bj)
143 c dpFac(I2,Katm) = 1. _d 0
144 ENDDO
145 ENDDO
146 ENDDO
147 ENDIF
148
149 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
150
151 C Physics package works with sub-domains 1:sNx,1:sNy,1:Nr.
152 C Internal index mapping is linear in X and Y with a second
153 C dimension for the vertical.
154
155 C- Dynamical var --> AIM var :
156 C note: UA & VA are not used => removed
157 temp1 = lwTemp1
158 temp2 = lwTemp2
159 DO K = 1,Nr
160 conv_theta2T = (rC(K)/atm_po)**atm_kappa
161 Katm = _KD2KA( K )
162 DO J = 1,sNy
163 DO I = 1,sNx
164 I2 = I+(J-1)*sNx
165 IF (maskC(i,j,k,bi,bj).EQ.1. _d 0) THEN
166 c UA(I2,Katm) = uVel(I,J,K,bi,bj)
167 c VA(I2,Katm) = vVel(I,J,K,bi,bj)
168 C Physics works with temperature - not potential temp.
169 TA(I2,Katm) = theta(I,J,K,bi,bj)*conv_theta2T
170 c TA(I2,Katm) = max(temp1,min(temp2,
171 c & theta(I,J,K,bi,bj)*conv_theta2T ))
172 C In atm.Phys, water vapor must be > 0 :
173 QA(I2,Katm) = MAX(salt(I,J,K,bi,bj), 0. _d 0)
174 C Dry static energy replaced by Pot.Temp:
175 ThA(I2,Katm) = theta(I,J,K,bi,bj)
176 ELSE
177 TA(I2,Katm) = 300. _d 0
178 QA(I2,Katm) = 0. _d 0
179 ThA(I2,Katm) = 300. _d 0
180 ENDIF
181 ENDDO
182 ENDDO
183 ENDDO
184
185 C_jmc: add square of surface wind speed (center of C grid) = 2 * KE_surf
186 DO J = 1,sNy
187 DO I = 1,sNx
188 I2 = I+(J-1)*sNx
189 K = ksurfC(i,j,bi,bj)
190 IF (K.LE.Nr) THEN
191 Vsurf2(I2) = 0.5 * (
192 & uVel(I,J,K,bi,bj)*uVel(I,J,K,bi,bj)
193 & + uVel(I+1,J,K,bi,bj)*uVel(I+1,J,K,bi,bj)
194 & + vVel(I,J,K,bi,bj)*vVel(I,J,K,bi,bj)
195 & + vVel(I,J+1,K,bi,bj)*vVel(I,J+1,K,bi,bj)
196 & )
197 ELSE
198 Vsurf2(I2) = 0.
199 ENDIF
200 ENDDO
201 ENDDO
202
203 C- Check that Temp is OK for LW Radiation scheme :
204 DO K = 1,Nr
205 Katm = _KD2KA( K )
206 DO I2=1,NGP
207 IF ( TA(I2,Katm).LT.lwTemp1 .OR.
208 & TA(I2,Katm).GT.lwTemp2 ) THEN
209 i = 1 + mod((I2-1),sNx)
210 j = 1 + int((I2-1)/sNx)
211 WRITE(msgBuf,'(A,1PE20.13,A,2I4)')
212 & 'AIM_DYN2AIM: Temp=', TA(I2,Katm),
213 & ' out of range ',lwTemp1,lwTemp2
214 CALL PRINT_ERROR( msgBuf , myThid)
215 WRITE(msgBuf,'(A,3I4,3I3,I6,2F9.3)')
216 & 'AIM_DYN2AIM: Pb in i,j,k,bi,bj,myThid,I2,X,Y=',
217 & i,j,k,bi,bj,myThid,I2,xC(i,j,bi,bj),yC(i,j,bi,bj)
218 CALL PRINT_ERROR( msgBuf , myThid)
219 STOP 'ABNORMAL END: S/R AIM_DYN2AIM'
220 ENDIF
221 ENDDO
222 ENDDO
223
224 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
225
226 C- Set geopotential surfaces
227 c DO Katm=1,NLEV
228 c DO I2=1,NGP
229 c PHIG1(I2,Katm) = gravity*HinitC(Katm)
230 c ENDDO
231 c ENDDO
232
233 C- Weights for vertical interpolation down to the surface
234 C Fsurf = Ffull(nlev)+WVS*(Ffull(nlev)-Ffull(nlev-1))
235 DO J = 1,sNy
236 DO I = 1,sNx
237 I2 = I+(J-1)*sNx
238 WVSurf(I2,myThid) = 0.
239 K = kGrd(I2)
240 IF (K.GT.1) THEN
241 C- full cell version of Franco Molteni formula:
242 c WVSurf(I2,myThid) = (LOG(SIGH(K))-SIGL(K))*WVI(K-1,2)
243 C- partial cell version using true log-P extrapolation:
244 WVSurf(I2,myThid) = (LOG(PSA(I2))-SIGL(K))*WVI(K-1,1)
245 C- like in the old code:
246 c WVSurf(I2,myThid) = WVI(K,2)
247 ENDIF
248 ENDDO
249 ENDDO
250 IF (myIter.EQ.nIter0)
251 & CALL AIM_WRITE_PHYS( 'aim_WeightSurf', '', 1, WVSurf,
252 & 1, bi, bj, 1, myIter, myThid )
253
254 #endif /* ALLOW_AIM */
255
256 RETURN
257 END

  ViewVC Help
Powered by ViewVC 1.1.22