/[MITgcm]/MITgcm/pkg/exf/exf_wind.F
ViewVC logotype

Contents of /MITgcm/pkg/exf/exf_wind.F

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


Revision 1.11 - (show annotations) (download)
Mon Oct 25 16:21:58 2010 UTC (13 years, 6 months ago) by gforget
Branch: MAIN
CVS Tags: checkpoint63p, checkpoint63q, checkpoint63r, checkpoint63l, checkpoint63m, checkpoint63n, checkpoint63o, checkpoint63h, checkpoint63i, checkpoint63j, checkpoint63k, checkpoint63d, checkpoint63e, checkpoint63f, checkpoint63g, checkpoint63a, checkpoint63b, checkpoint63c, checkpoint63, checkpoint62o, checkpoint62n, checkpoint62s, checkpoint62r, checkpoint62q, checkpoint62p, checkpoint62w, checkpoint62v, checkpoint62u, checkpoint62t, checkpoint62z, checkpoint62y, checkpoint62x
Changes since 1.10: +19 -1 lines
avoiding recomputations.

1 C $Header: /u/gcmpack/MITgcm/pkg/exf/exf_wind.F,v 1.10 2010/04/12 09:00:34 mlosch Exp $
2 C $Name: $
3
4 #include "EXF_OPTIONS.h"
5
6 SUBROUTINE EXF_WIND( myTime, myIter, myThid )
7
8 C ==================================================================
9 C SUBROUTINE exf_wind
10 C ==================================================================
11 C
12 C o Prepare wind speed and stress fields
13 C
14 C ==================================================================
15 C SUBROUTINE exf_wind
16 C ==================================================================
17
18 IMPLICIT NONE
19
20 C == global variables ==
21
22 #include "SIZE.h"
23 #include "EEPARAMS.h"
24 #include "PARAMS.h"
25
26 #include "EXF_PARAM.h"
27 #include "EXF_FIELDS.h"
28 #include "EXF_CONSTANTS.h"
29
30 #ifdef ALLOW_AUTODIFF_TAMC
31 #include "tamc.h"
32 #include "tamc_keys.h"
33 #endif
34
35 C == routine arguments ==
36
37 _RL myTime
38 INTEGER myIter
39 INTEGER myThid
40
41 C == external functions ==
42
43 C == local variables ==
44
45 INTEGER bi,bj
46 INTEGER i,j
47 _RL wsLoc(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
48 #ifdef ALLOW_ATM_WIND
49 _RL wsSq
50 #else
51 _RL usSq, recip_sqrtRhoA, ustar
52 _RL tmp1, tmp2, tmp3, tmp4
53 _RL oneThirdRL
54 PARAMETER ( oneThirdRL = 1.d0 / 3.d0 )
55 #endif
56
57 C == end of interface ==
58
59 C-- Use atmospheric state to compute surface fluxes.
60
61 C Loop over tiles.
62 DO bj = myByLo(myThid),myByHi(myThid)
63 DO bi = myBxLo(myThid),myBxHi(myThid)
64
65 #ifdef ALLOW_AUTODIFF_TAMC
66 act1 = bi - myBxLo(myThid)
67 max1 = myBxHi(myThid) - myBxLo(myThid) + 1
68 act2 = bj - myByLo(myThid)
69 max2 = myByHi(myThid) - myByLo(myThid) + 1
70 act3 = myThid - 1
71 max3 = nTx*nTy
72 act4 = ikey_dynamics - 1
73 ikey = (act1 + 1) + act2*max1
74 & + act3*max1*max2
75 & + act4*max1*max2*max3
76 #endif /* ALLOW_AUTODIFF_TAMC */
77
78 C-- Initialise
79 DO j = 1,sNy
80 DO i = 1,sNx
81 wsLoc(i,j) = 0. _d 0
82 cw(i,j,bi,bj) = 0. _d 0
83 sw(i,j,bi,bj) = 0. _d 0
84 sh(i,j,bi,bj) = 0. _d 0
85 wStress(i,j,bi,bj) = 0. _d 0
86 ENDDO
87 ENDDO
88
89 #ifdef ALLOW_ATM_WIND
90
91 C-- Wind speed and direction.
92 DO j = 1,sNy
93 DO i = 1,sNx
94 wsSq = uwind(i,j,bi,bj)*uwind(i,j,bi,bj)
95 & + vwind(i,j,bi,bj)*vwind(i,j,bi,bj)
96 IF ( wsSq .NE. 0. _d 0 ) THEN
97 wsLoc(i,j) = SQRT(wsSq)
98 cw(i,j,bi,bj) = uwind(i,j,bi,bj)/wsLoc(i,j)
99 sw(i,j,bi,bj) = vwind(i,j,bi,bj)/wsLoc(i,j)
100 ELSE
101 wsLoc(i,j) = 0. _d 0
102 cw(i,j,bi,bj) = 0. _d 0
103 sw(i,j,bi,bj) = 0. _d 0
104 ENDIF
105 ENDDO
106 ENDDO
107 IF ( wspeedfile .EQ. ' ' ) THEN
108 C- wind-speed is not loaded from file: save local array into common block
109 DO j = 1,sNy
110 DO i = 1,sNx
111 wspeed(i,j,bi,bj) = wsLoc(i,j)
112 ENDDO
113 ENDDO
114 ENDIF
115
116 #else /* ifndef ALLOW_ATM_WIND */
117
118 C-- Wind stress and direction.
119 DO j = 1,sNy
120 DO i = 1,sNx
121 IF ( stressIsOnCgrid ) THEN
122 usSq = ( ustress(i, j,bi,bj)*ustress(i ,j,bi,bj)
123 & +ustress(i+1,j,bi,bj)*ustress(i+1,j,bi,bj)
124 & +vstress(i,j, bi,bj)*vstress(i,j ,bi,bj)
125 & +vstress(i,j+1,bi,bj)*vstress(i,j+1,bi,bj)
126 & )*0.5 _d 0
127 ELSE
128 usSq = ustress(i,j,bi,bj)*ustress(i,j,bi,bj)
129 & +vstress(i,j,bi,bj)*vstress(i,j,bi,bj)
130 ENDIF
131 IF ( usSq .NE. 0. _d 0 ) THEN
132 wStress(i,j,bi,bj) = SQRT(usSq)
133 c ustar = SQRT(usSq/atmrho)
134 cw(i,j,bi,bj) = ustress(i,j,bi,bj)/wStress(i,j,bi,bj)
135 sw(i,j,bi,bj) = vstress(i,j,bi,bj)/wStress(i,j,bi,bj)
136 ELSE
137 wStress(i,j,bi,bj) = 0. _d 0
138 cw(i,j,bi,bj) = 0. _d 0
139 sw(i,j,bi,bj) = 0. _d 0
140 ENDIF
141 ENDDO
142 ENDDO
143
144 IF ( wspeedfile .EQ. ' ' ) THEN
145 C-- wspeed is not loaded ; derive wind-speed by inversion of
146 C wind-stress=fct(wind-speed) relation:
147 C The variables us, sh and rdn have to be computed from
148 C given wind stresses inverting relationship for neutral
149 C drag coeff. cdn.
150 C The inversion is based on linear and quadratic form of
151 C cdn(umps); ustar can be directly computed from stress;
152 recip_sqrtRhoA = 1. _d 0 / SQRT(atmrho)
153 DO j = 1,sNy
154 DO i = 1,sNx
155 ustar = wStress(i,j,bi,bj)*recip_sqrtRhoA
156 IF ( ustar .EQ. 0. _d 0 ) THEN
157 wsLoc(i,j) = 0. _d 0
158 ELSE IF ( ustar .LT. ustofu11 ) THEN
159 tmp1 = -cquadrag_2/cquadrag_1*exf_half
160 tmp2 = SQRT(tmp1*tmp1 + ustar*ustar/cquadrag_1)
161 wsLoc(i,j) = SQRT(tmp1 + tmp2)
162 ELSE
163 tmp1 = clindrag_2/clindrag_1*oneThirdRL
164 tmp2 = ustar*ustar/clindrag_1*exf_half
165 & - tmp1*tmp1*tmp1
166 tmp3 = SQRT( ustar*ustar/clindrag_1*
167 & (ustar*ustar/clindrag_1*0.25 _d 0 - tmp1*tmp1*tmp1 )
168 & )
169 tmp4 = (tmp2 + tmp3)**oneThirdRL
170 wsLoc(i,j) = tmp4 + tmp1*tmp1 / tmp4 - tmp1
171 c wsLoc(i,j) = (tmp2 + tmp3)**oneThirdRL +
172 c & tmp1*tmp1 * (tmp2 + tmp3)**(-oneThirdRL) - tmp1
173 ENDIF
174 ENDDO
175 ENDDO
176 C- save local array wind-speed to common block
177 DO j = 1,sNy
178 DO i = 1,sNx
179 wspeed(i,j,bi,bj) = wsLoc(i,j)
180 ENDDO
181 ENDDO
182 ENDIF
183
184 C-- infer wind field from wind-speed & wind-stress direction
185 DO j = 1,sNy
186 DO i = 1,sNx
187 uwind(i,j,bi,bj) = wspeed(i,j,bi,bj)*cw(i,j,bi,bj)
188 vwind(i,j,bi,bj) = wspeed(i,j,bi,bj)*sw(i,j,bi,bj)
189 ENDDO
190 ENDDO
191 #endif /* ifndef ALLOW_ATM_WIND */
192
193 #ifdef ALLOW_AUTODIFF_TAMC
194 CADJ STORE wspeed(:,:,bi,bj) = comlev1_bibj, key=ikey, byte=isbyte
195 #endif
196
197 C-- set wind-speed lower limit
198 DO j = 1,sNy
199 DO i = 1,sNx
200 sh(i,j,bi,bj) = MAX(wspeed(i,j,bi,bj),uMin)
201 ENDDO
202 ENDDO
203
204 C-- end bi,bj loops
205 ENDDO
206 ENDDO
207
208 RETURN
209 END

  ViewVC Help
Powered by ViewVC 1.1.22