/[MITgcm]/MITgcm/pkg/fizhi/fizhi_wrapper.F
ViewVC logotype

Contents of /MITgcm/pkg/fizhi/fizhi_wrapper.F

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


Revision 1.36 - (show annotations) (download)
Tue Mar 27 15:48:27 2012 UTC (12 years, 1 month ago) by jmc
Branch: MAIN
CVS Tags: checkpoint64y, checkpoint64x, checkpoint64z, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint64i, checkpoint64h, checkpoint64k, checkpoint64j, checkpoint64m, checkpoint64l, checkpoint64o, checkpoint64n, checkpoint64a, checkpoint64c, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64g, checkpoint64f, checkpoint63p, checkpoint63q, checkpoint63r, checkpoint63s, checkpoint63l, checkpoint63m, checkpoint63n, checkpoint63o, checkpoint64, checkpoint65, checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65o, checkpoint65l, checkpoint65m, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e, HEAD
Changes since 1.35: +55 -54 lines
clean-up turbulence cold-start switch: decided in fizhi_init_vars.F, stored
in common bloc (fizhi_coms.h) and then passed as argument up to S/R TURBIO.

1 C $Header: /u/gcmpack/MITgcm/pkg/fizhi/fizhi_wrapper.F,v 1.35 2009/04/28 18:15:33 jmc Exp $
2 C $Name: $
3
4 #include "FIZHI_OPTIONS.h"
5 SUBROUTINE FIZHI_WRAPPER (myTime, myIter, myThid)
6 c-----------------------------------------------------------------------
7 c Subroutine fizhi_wrapper - 'Wrapper' routine to interface
8 c with physics driver.
9 c 1) Set up "bi, bj loop" and some timers and clocks.
10 c 2) Call do_fizhi - driver for physics which computes tendencies
11 c 3) Interpolate tendencies to dynamics grid in vertical
12 c 4) Convert u,v tendencies to C-Grid
13 c
14 c Calls: do_fizhi (get u,v,t,s tend, step tke, etc and tc, etc. forward)
15 c phys2dyn (4 calls - all physics tendencies)
16 c AtoC (u and v tendencies)
17 c-----------------------------------------------------------------------
18 IMPLICIT NONE
19 #include "SIZE.h"
20 #include "GRID.h"
21 #include "EEPARAMS.h"
22 #include "PARAMS.h"
23 #include "SURFACE.h"
24 #include "DYNVARS.h"
25 #include "fizhi_land_SIZE.h"
26 #include "fizhi_SIZE.h"
27 #include "fizhi_coms.h"
28 #include "gridalt_mapping.h"
29 #include "fizhi_land_coms.h"
30 #include "fizhi_earth_coms.h"
31 #include "fizhi_ocean_coms.h"
32 #include "fizhi_chemistry_coms.h"
33 #ifdef ALLOW_DIAGNOSTICS
34 #include "fizhi_SHP.h"
35 #endif
36
37 INTEGER myIter, myThid
38 _RL myTime
39 LOGICAL diagnostics_is_on
40 EXTERNAL diagnostics_is_on
41
42 c pe on dynamics and physics grid refers to bottom edge
43 _RL pephy4fiz(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nrphys+1,nSx,nSy)
44 _RL pephy(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nrphys+1,nSx,nSy)
45 _RL pedyn(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr+1,nSx,nSy)
46 _RL tempphy(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nrphys,nSx,nSy)
47 _RL fracland(sNx,sNy,nSx,nSy)
48 _RL tempLdiag(sNx,sNy,Nrphys+1)
49 _RL tempLdiag2(sNx,sNy,Nrphys)
50 _RL tempdiag(sNx,sNy)
51 _RL slp(sNx,sNy)
52
53 INTEGER i, j, L, Lbotij, bi, bj
54 INTEGER im1, im2, jm1, jm2, idim1, idim2, jdim1, jdim2
55 _RL grav, getcon
56
57 grav = getcon('GRAVITY')
58 idim1 = 1-OLx
59 idim2 = sNx+OLx
60 jdim1 = 1-OLy
61 jdim2 = sNy+OLy
62 im1 = 1
63 im2 = sNx
64 jm1 = 1
65 jm2 = sNy
66
67 #ifdef ALLOW_DIAGNOSTICS
68 if ( useDiagnostics ) then
69 if(diagnostics_is_on('TENDUFIZ',myThid) .or.
70 & diagnostics_is_on('CORRDU ',myThid) ) then
71 do bj = myByLo(myThid), myByHi(myThid)
72 do bi = myBxLo(myThid), myBxHi(myThid)
73 do L = 1,Nrphys
74 do j = 1,sNy
75 do i = 1,sNx
76 ubef(i,j,L,bi,bj) = uphy(i,j,L,bi,bj)
77 enddo
78 enddo
79 enddo
80 do L = 1,Nr
81 do j = 1,sNy
82 do i = 1,sNx+1
83 udynbef(i,j,L,bi,bj) = uvel(i,j,L,bi,bj)
84 enddo
85 enddo
86 enddo
87 enddo
88 enddo
89 endif
90 if(diagnostics_is_on('TENDVFIZ',myThid) .or.
91 & diagnostics_is_on('CORRDV ',myThid) ) then
92 do bj = myByLo(myThid), myByHi(myThid)
93 do bi = myBxLo(myThid), myBxHi(myThid)
94 do L = 1,Nrphys
95 do j = 1,sNy
96 do i = 1,sNx
97 vbef(i,j,L,bi,bj) = vphy(i,j,L,bi,bj)
98 enddo
99 enddo
100 enddo
101 do L = 1,Nr
102 do j = 1,sNy+1
103 do i = 1,sNx
104 vdynbef(i,j,L,bi,bj) = vvel(i,j,L,bi,bj)
105 enddo
106 enddo
107 enddo
108 enddo
109 enddo
110 endif
111 if(diagnostics_is_on('TENDTFIZ',myThid) .or.
112 & diagnostics_is_on('CORRDT ',myThid) ) then
113 do bj = myByLo(myThid), myByHi(myThid)
114 do bi = myBxLo(myThid), myBxHi(myThid)
115 do L = 1,Nrphys
116 do j = 1,sNy
117 do i = 1,sNx
118 thbef(i,j,L,bi,bj) = thphy(i,j,L,bi,bj)
119 enddo
120 enddo
121 enddo
122 do L = 1,Nr
123 do j = 1,sNy
124 do i = 1,sNx
125 thdynbef(i,j,L,bi,bj) = theta(i,j,L,bi,bj)
126 enddo
127 enddo
128 enddo
129 enddo
130 enddo
131 endif
132 if(diagnostics_is_on('TENDQFIZ',myThid) .or.
133 & diagnostics_is_on('CORRDQ ',myThid) ) then
134 do bj = myByLo(myThid), myByHi(myThid)
135 do bi = myBxLo(myThid), myBxHi(myThid)
136 do L = 1,Nrphys
137 do j = 1,sNy
138 do i = 1,sNx
139 sbef(i,j,L,bi,bj) = sphy(i,j,L,bi,bj)
140 enddo
141 enddo
142 enddo
143 do L = 1,Nr
144 do j = 1,sNy
145 do i = 1,sNx
146 sdynbef(i,j,L,bi,bj) = salt(i,j,L,bi,bj)
147 enddo
148 enddo
149 enddo
150 enddo
151 enddo
152 endif
153 endif
154 #endif
155
156 do bj = myByLo(myThid), myByHi(myThid)
157 do bi = myBxLo(myThid), myBxHi(myThid)
158
159 c Construct the physics grid pressures
160 C Note: Need one array to send to fizhi (top-down) and another
161 C For the interpolations between physics and dynamics (bottom-up)
162 do j = 1,sNy
163 do i = 1,sNx
164 pephy(i,j,1,bi,bj)=(Ro_surf(i,j,bi,bj) + etaH(i,j,bi,bj))
165 do L = 2,Nrphys+1
166 pephy(i,j,L,bi,bj)=pephy(i,j,L-1,bi,bj)-dpphys(i,j,L-1,bi,bj)
167 enddo
168 c Do not use a zero field as the top edge pressure for interpolation
169 do L = 1,Nrphys+1
170 pephy4fiz(i,j,Nrphys+2-L,bi,bj)=pephy(i,j,L,bi,bj)
171 enddo
172 if(pephy(i,j,Nrphys+1,bi,bj).lt.1.e-5)
173 & pephy(i,j,Nrphys+1,bi,bj) = 1.e-5
174 enddo
175 enddo
176 C Build pressures on dynamics grid
177 do j = 1,sNy
178 do i = 1,sNx
179 do L = 1,Nr
180 pedyn(i,j,L,bi,bj) = 0.
181 enddo
182 enddo
183 enddo
184 do j = 1,sNy
185 do i = 1,sNx
186 Lbotij = kSurfC(i,j,bi,bj)
187 if(Lbotij.ne.0.)
188 & pedyn(i,j,Lbotij,bi,bj) = (Ro_surf(i,j,bi,bj) + etaH(i,j,bi,bj))
189 enddo
190 enddo
191 do j = 1,sNy
192 do i = 1,sNx
193 Lbotij = kSurfC(i,j,bi,bj)
194 do L = Lbotij+1,Nr+1
195 pedyn(i,j,L,bi,bj) = pedyn(i,j,L-1,bi,bj) -
196 & drF(L-1)* rStarExpC(i,j,bi,bj)*hfacC(i,j,L-1,bi,bj)
197 enddo
198 c Do not use a zero field as the top edge pressure for interpolation
199 if(pedyn(i,j,Nr+1,bi,bj).lt.1.e-5)
200 & pedyn(i,j,Nr+1,bi,bj) = 1.e-5
201 enddo
202 enddo
203 enddo
204 enddo
205
206 #ifdef ALLOW_DIAGNOSTICS
207 if ( useDiagnostics ) then
208 if(diagnostics_is_on('FIZPRES ',myThid) ) then
209 do bj = myByLo(myThid), myByHi(myThid)
210 do bi = myBxLo(myThid), myBxHi(myThid)
211 do j = 1,sNy
212 do i = 1,sNx
213 do L = 1,Nrphys
214 tempphy(i,j,L,bi,bj) = pephy4fiz(i,j,L,bi,bj)
215 enddo
216 enddo
217 enddo
218 enddo
219 enddo
220 call diagnostics_fill(tempphy,'FIZPRES ',0,
221 & Nrphys,0,1,1,myThid)
222 endif
223 endif
224 #endif
225
226 CALL TIMER_START ('DO_FIZHI [FIZHI_WRAPPER]',myThid)
227 do bj = myByLo(myThid), myByHi(myThid)
228 do bi = myBxLo(myThid), myBxHi(myThid)
229 call get_landfrac(im2,jm2,nSx,nSy,bi,bj,maxtyp,
230 & surftype,tilefrac,fracland(1,1,bi,bj))
231
232 #ifdef ALLOW_DIAGNOSTICS
233 if ( useDiagnostics ) then
234 if(diagnostics_is_on('SLP ',myThid) ) then
235 L = Nrphys+1
236 do j = 1,sNy
237 do i = 1,sNx
238 tempdiag(i,j) = topoZ(i,j,bi,bj)*grav
239 tempLdiag(i,j,L) = pephy4fiz(i,j,L,bi,bj)/100.
240 enddo
241 enddo
242 do L = 1,Nrphys
243 do j = 1,sNy
244 do i = 1,sNx
245 tempLdiag(i,j,L) = pephy4fiz(i,j,L,bi,bj)/100.
246 tempLdiag2(i,j,L) = thphy(i,j,L,bi,bj) *
247 & (1.+0.609*sphy(i,j,L,bi,bj))
248
249 enddo
250 enddo
251 enddo
252 call slprs( tempdiag, tempLdiag, tempLdiag2,
253 & fracland(1,1,bi,bj),sNx,sNy,Nrphys,slp)
254 call diagnostics_fill( slp,'SLP ',1,1,3,bi,bj,myThid )
255 endif
256 endif
257 #endif
258 c
259 c Compute physics increments
260 turbStart(bi,bj) = turbStart(bi,bj) .AND. ( myIter.EQ.nIter0 )
261
262 call do_fizhi(myIter,myThid,
263 & idim1,idim2,jdim1,jdim2,Nrphys,nSx,nSy,im1,im2,jm1,jm2,bi,bj,
264 & turbStart(bi,bj), nchp,nchptot,nchpland,
265 & uphy,vphy,thphy,sphy,pephy4fiz,xC,yC,topoZ,
266 & ctmt,xxmt,yymt,zetamt,xlmt,khmt,tke,
267 & tgz,sst,sice,phis_var,landtype,fracland,emiss,albnirdr,albnirdf,
268 & albvisdr,albvisdf,ityp,chfr,alai,agrn,igrd,chlt,chlon,
269 & tcanopy,tdeep,ecanopy,swetshal,swetroot,swetdeep,snodep,capac,
270 & o3,qstr,co2,cfc11,cfc12,cfc22,n2o,methane,
271 & iras,nlwcld,cldtot_lw,cldras_lw,cldlsp_lw,nlwlz,lwlz,
272 & nswcld,cldtot_sw,cldras_sw,cldlsp_sw,nswlz,swlz,
273 & imstturbsw,imstturblw,qliqavesw,qliqavelw,fccavesw,fccavelw,
274 & raincon,rainlsp,snowfall,
275 & duphy,dvphy,dthphy,dsphy)
276 enddo
277 enddo
278
279 CALL TIMER_STOP ('DO_FIZHI [FIZHI_WRAPPER]',myThid)
280
281 CALL TIMER_START ('PHYS2DYN [FIZHI_WRAPPER]',myThid)
282 do bj = myByLo(myThid), myByHi(myThid)
283 do bi = myBxLo(myThid), myBxHi(myThid)
284 c Interpolate (A-Grid) physics increments to dynamics grid
285 C First flip the physics arrays (which are top-down)
286 C into bottom-up arrays for interpolation to dynamics grid
287 do j = 1,sNy
288 do i = 1,sNx
289 do L = 1,Nrphys
290 tempphy(i,j,Nrphys+1-L,bi,bj)=duphy(i,j,L,bi,bj)
291 enddo
292 enddo
293 enddo
294 call phys2dyn(tempphy,pephy,idim1,idim2,jdim1,jdim2,Nrphys,
295 & nSx,nSy,im1,im2,jm1,jm2,bi,bj,pedyn,kSurfC,Nr,nlperdyn,guphy)
296 do j = 1,sNy
297 do i = 1,sNx
298 do L = 1,Nrphys
299 tempphy(i,j,Nrphys+1-L,bi,bj)=dvphy(i,j,L,bi,bj)
300 enddo
301 enddo
302 enddo
303 call phys2dyn(tempphy,pephy,idim1,idim2,jdim1,jdim2,Nrphys,
304 & nSx,nSy,im1,im2,jm1,jm2,bi,bj,pedyn,kSurfC,Nr,nlperdyn,gvphy)
305 do j = 1,sNy
306 do i = 1,sNx
307 do L = 1,Nrphys
308 tempphy(i,j,Nrphys+1-L,bi,bj)=dthphy(i,j,L,bi,bj)
309 enddo
310 enddo
311 enddo
312 call phys2dyn(tempphy,pephy,idim1,idim2,jdim1,jdim2,Nrphys,
313 & nSx,nSy,im1,im2,jm1,jm2,bi,bj,pedyn,kSurfC,Nr,nlperdyn,gthphy)
314 do j = 1,sNy
315 do i = 1,sNx
316 do L = 1,Nrphys
317 tempphy(i,j,Nrphys+1-L,bi,bj)=dsphy(i,j,L,bi,bj)
318 enddo
319 enddo
320 enddo
321 call phys2dyn(tempphy,pephy,idim1,idim2,jdim1,jdim2,Nrphys,
322 & nSx,nSy,im1,im2,jm1,jm2,bi,bj,pedyn,kSurfC,Nr,nlperdyn,gsphy)
323
324 enddo
325 enddo
326
327 CALL TIMER_STOP ('PHYS2DYN [FIZHI_WRAPPER]',myThid)
328
329 c Convert guphy and gvphy from A-grid to C-grid for use by dynamics
330 CALL TIMER_START ('ATOC [FIZHI_WRAPPER]',myThid)
331 call AtoC(myThid,guphy,gvphy,maskC,idim1,idim2,jdim1,jdim2,Nr,
332 & nSx,nSy,im1,im2,jm1,jm2,guphy,gvphy)
333 CALL TIMER_STOP ('ATOC [FIZHI_WRAPPER]',myThid)
334
335 CALL TIMER_START ('EXCHANGES [FIZHI_WRAPPER]',myThid)
336 c Call the c-grid exchange routine to fill in the halo regions (du,dv)
337 call exch_uv_xyz_RL(guphy,gvphy,.TRUE.,myThid)
338 c Call the a-grid exchange routine to fill in the halo regions (dth,ds)
339 _EXCH_XYZ_RL(gthphy,myThid)
340 _EXCH_XYZ_RL(gsphy,myThid)
341 CALL TIMER_STOP ('EXCHANGES [FIZHI_WRAPPER]',myThid)
342
343 return
344 end

  ViewVC Help
Powered by ViewVC 1.1.22