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

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

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


Revision 1.32 - (hide annotations) (download)
Mon Jun 19 23:37:34 2006 UTC (17 years, 11 months ago) by molod
Branch: MAIN
CVS Tags: checkpoint58l_post, checkpoint58k_post, checkpoint58m_post
Changes since 1.31: +11 -7 lines
Bug fixes in SLP computation routine and call

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

  ViewVC Help
Powered by ViewVC 1.1.22