/[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.31 - (hide annotations) (download)
Thu May 18 23:04:46 2006 UTC (18 years, 1 month ago) by molod
Branch: MAIN
CVS Tags: checkpoint58h_post, checkpoint58j_post, checkpoint58f_post, checkpoint58i_post, checkpoint58g_post
Changes since 1.30: +4 -7 lines
Fix syntax

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

  ViewVC Help
Powered by ViewVC 1.1.22