/[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.19 - (show annotations) (download)
Thu Aug 5 17:06:40 2004 UTC (19 years, 9 months ago) by molod
Branch: MAIN
CVS Tags: checkpoint55c_post, checkpoint54e_post, checkpoint55b_post, checkpoint55, checkpoint54f_post, checkpoint55a_post
Changes since 1.18: +2 -2 lines
Debugging

1 C $Header: /u/gcmpack/MITgcm/pkg/fizhi/fizhi_wrapper.F,v 1.18 2004/08/04 18:23:44 molod 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 "SURFACE.h"
23 #include "DYNVARS.h"
24 #include "fizhi_land_SIZE.h"
25 #include "fizhi_SIZE.h"
26 #include "fizhi_coms.h"
27 #include "gridalt_mapping.h"
28 #include "fizhi_land_coms.h"
29 #include "fizhi_earth_coms.h"
30 #include "fizhi_ocean_coms.h"
31 #include "fizhi_chemistry_coms.h"
32
33 integer myTime, myIter, myThid
34
35 c pe on dynamics and physics grid refers to bottom edge
36 _RL pephy4fiz(1-OLx:sNx+Olx,1-Oly:sNy+Oly,Nrphys+1,nSx,nSy)
37 _RL pephy(1-OLx:sNx+Olx,1-Oly:sNy+Oly,Nrphys+1,nSx,nSy)
38 _RL pedyn(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr+1,nSx,nSy)
39 _RL tempphy(1-OLx:sNx+Olx,1-Oly:sNy+Oly,Nrphys,nSx,nSy)
40 _RL fracland(sNx,sNy,Nsx,Nsy)
41
42 integer i, j, L, Lbotij, bi, bj
43 integer im1, im2, jm1, jm2, idim1, idim2, jdim1, jdim2
44 _RL tempij(sNx,sNy)
45
46 idim1 = 1-OLx
47 idim2 = sNx+OLx
48 jdim1 = 1-OLy
49 jdim2 = sNy+OLy
50 im1 = 1
51 im2 = sNx
52 jm1 = 1
53 jm2 = sNy
54
55 do bj = myByLo(myThid), myByHi(myThid)
56 do bi = myBxLo(myThid), myBxHi(myThid)
57
58 c Construct the physics grid pressures
59 C Note: Need one array to send to fizhi (top-down) and another
60 C For the interpolations between physics and dynamics (bottom-up)
61 do j = 1,sNy
62 do i = 1,sNx
63 pephy(i,j,1,bi,bj)=(Ro_surf(i,j,bi,bj) + etaH(i,j,bi,bj))
64 do L = 2,Nrphys+1
65 pephy(i,j,L,bi,bj)=pephy(i,j,L-1,bi,bj)-dpphys(i,j,L-1,bi,bj)
66 enddo
67 c Do not use a zero field as the top edge pressure for interpolation
68 do L = 1,Nrphys+1
69 pephy4fiz(i,j,Nrphys+2-L,bi,bj)=pephy(i,j,L,bi,bj)
70 enddo
71 if(pephy(i,j,Nrphys+1,bi,bj).lt.1.e-5)
72 . pephy(i,j,Nrphys+1,bi,bj) = 1.e-5
73 enddo
74 enddo
75 C Build pressures on dynamics grid
76 do j = 1,sNy
77 do i = 1,sNx
78 do L = 1,Nr
79 pedyn(i,j,L,bi,bj) = 0.
80 enddo
81 enddo
82 enddo
83 do j = 1,sNy
84 do i = 1,sNx
85 Lbotij = ksurfC(i,j,bi,bj)
86 if(Lbotij.ne.0.)
87 . pedyn(i,j,Lbotij,bi,bj) = (Ro_surf(i,j,bi,bj) + etaH(i,j,bi,bj))
88 enddo
89 enddo
90 do j = 1,sNy
91 do i = 1,sNx
92 Lbotij = ksurfC(i,j,bi,bj)
93 do L = Lbotij+1,Nr+1
94 pedyn(i,j,L,bi,bj) = pedyn(i,j,L-1,bi,bj) -
95 . drF(L-1)*hfacC(i,j,L-1,bi,bj)
96 enddo
97 c Do not use a zero field as the top edge pressure for interpolation
98 if(pedyn(i,j,Nr+1,bi,bj).lt.1.e-5)
99 . pedyn(i,j,Nr+1,bi,bj) = 1.e-5
100 enddo
101 enddo
102 enddo
103 enddo
104
105 CALL TIMER_START ('DO_FIZHI [FIZHI_WRAPPER]',mythid)
106 do bj = myByLo(myThid), myByHi(myThid)
107 do bi = myBxLo(myThid), myBxHi(myThid)
108 call get_landfrac(im2,jm2,Nsx,Nsy,bi,bj,maxtyp,
109 . surftype,tilefrac,fracland)
110 c
111 c Compute physics increments
112
113 call do_fizhi(myThid,
114 . idim1,idim2,jdim1,jdim2,Nrphys,Nsx,Nsy,im1,im2,jm1,jm2,bi,bj,
115 . nchp,nchptot,nchpland,
116 . uphy,vphy,thphy,sphy,pephy4fiz,xC,yC,
117 . ctmt,xxmt,yymt,zetamt,xlmt,khmt,tke,
118 . tgz,sst,sice,phis_var,landtype,fracland,emiss,albnirdr,albnirdf,
119 . albvisdr,albvisdf,ityp,chfr,alai,agrn,igrd,chlt,chlon,
120 . tcanopy,tdeep,ecanopy,swetshal,swetroot,swetdeep,snodep,capac,
121 . o3,qstr,co2,cfc11,cfc12,cfc22,n2o,methane,
122 . duphy,dvphy,dthphy,dsphy)
123 enddo
124 enddo
125
126 CALL TIMER_STOP ('DO_FIZHI [FIZHI_WRAPPER]',mythid)
127
128 CALL TIMER_START ('PHYS2DYN [FIZHI_WRAPPER]',mythid)
129 do bj = myByLo(myThid), myByHi(myThid)
130 do bi = myBxLo(myThid), myBxHi(myThid)
131 c Interpolate (A-Grid) physics increments to dynamics grid
132 C First flip the physics arrays (which are top-down)
133 C into bottom-up arrays for interpolation to dynamics grid
134 do j = 1,sNy
135 do i = 1,sNx
136 do L = 1,Nrphys
137 tempphy(i,j,Nrphys+1-L,bi,bj)=duphy(i,j,L,bi,bj)
138 enddo
139 enddo
140 enddo
141 call phys2dyn(tempphy,pephy,idim1,idim2,jdim1,jdim2,Nrphys,
142 . Nsx,Nsy,im1,im2,jm1,jm2,bi,bj,pedyn,ksurfC,Nr,nlperdyn,guphy)
143 do j = 1,sNy
144 do i = 1,sNx
145 do L = 1,Nrphys
146 tempphy(i,j,Nrphys+1-L,bi,bj)=dvphy(i,j,L,bi,bj)
147 enddo
148 enddo
149 enddo
150 call phys2dyn(tempphy,pephy,idim1,idim2,jdim1,jdim2,Nrphys,
151 . Nsx,Nsy,im1,im2,jm1,jm2,bi,bj,pedyn,ksurfC,Nr,nlperdyn,gvphy)
152 do j = 1,sNy
153 do i = 1,sNx
154 do L = 1,Nrphys
155 tempphy(i,j,Nrphys+1-L,bi,bj)=dthphy(i,j,L,bi,bj)
156 enddo
157 enddo
158 enddo
159 call phys2dyn(tempphy,pephy,idim1,idim2,jdim1,jdim2,Nrphys,
160 . Nsx,Nsy,im1,im2,jm1,jm2,bi,bj,pedyn,ksurfC,Nr,nlperdyn,gthphy)
161 do j = 1,sNy
162 do i = 1,sNx
163 do L = 1,Nrphys
164 tempphy(i,j,Nrphys+1-L,bi,bj)=dsphy(i,j,L,bi,bj)
165 enddo
166 enddo
167 enddo
168 call phys2dyn(tempphy,pephy,idim1,idim2,jdim1,jdim2,Nrphys,
169 . Nsx,Nsy,im1,im2,jm1,jm2,bi,bj,pedyn,ksurfC,Nr,nlperdyn,gsphy)
170
171
172 if( (2.eq.1) ) then
173 print *,' In fizhi wrapper after phys2dyn before exchange ',bi
174 do L = 1,Nr
175 do j = 1,sNy
176 do i = 1,sNx
177 tempij(i,j) = guphy(i,j,L,bi,bj)
178 enddo
179 enddo
180 c print *,' guphy at level ',l,' ',tempij
181 enddo
182 do L = 1,Nr
183 do j = 1,sNy
184 do i = 1,sNx
185 tempij(i,j) = gvphy(i,j,L,bi,bj)
186 enddo
187 enddo
188 c print *,' gvphy at level ',l,' ',tempij
189 enddo
190 do L = 1,Nr
191 do j = 1,sNy
192 do i = 1,sNx
193 tempij(i,j) = gthphy(i,j,L,bi,bj)
194 enddo
195 enddo
196 print *,' gthphy at level ',l,' ',tempij
197 enddo
198 do L = 1,Nr
199 do j = 1,sNy
200 do i = 1,sNx
201 tempij(i,j) = gsphy(i,j,L,bi,bj)
202 enddo
203 enddo
204 c print *,' gsphy at level ',l,' ',tempij
205 enddo
206 endif
207 enddo
208 enddo
209
210 CALL TIMER_STOP ('PHYS2DYN [FIZHI_WRAPPER]',mythid)
211
212 c Convert guphy and gvphy from A-grid to C-grid for use by dynamics
213 CALL TIMER_START ('ATOC [FIZHI_WRAPPER]',mythid)
214 call AtoC(myThid,guphy,gvphy,maskC,idim1,idim2,jdim1,jdim2,Nr,
215 . Nsx,Nsy,im1,im2,jm1,jm2,guphy,gvphy)
216 CALL TIMER_STOP ('ATOC [FIZHI_WRAPPER]',mythid)
217
218 CALL TIMER_START ('EXCHANGES [FIZHI_WRAPPER]',mythid)
219 c Call the c-grid exchange routine to fill in the halo regions (du,dv)
220 call exch_uv_xyz_RL(guphy,gvphy,.TRUE.,myThid)
221 c Call the a-grid exchange routine to fill in the halo regions (dth,ds)
222 call exch_RL_cube(gthphy,OLx, OLx, OLy, OLy, Nr,OLx, OLy,
223 . FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid )
224 call exch_RL_cube(gsphy,OLx, OLx, OLy, OLy, Nr,OLx, OLy,
225 . FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid )
226 CALL TIMER_STOP ('EXCHANGES [FIZHI_WRAPPER]',mythid)
227
228 do bj = myByLo(myThid), myByHi(myThid)
229 do bi = myBxLo(myThid), myBxHi(myThid)
230 if( (2.eq.1) ) then
231 print *,' In fizhi wrapper after exchange ',bi
232 do L = 1,Nr
233 do j = 1,sNy
234 do i = 1,sNx
235 tempij(i,j) = guphy(i,j,L,bi,bj)
236 enddo
237 enddo
238 print *,' guphy at level ',l,' ',tempij
239 enddo
240 do L = 1,Nr
241 do j = 1,sNy
242 do i = 1,sNx
243 tempij(i,j) = gvphy(i,j,L,bi,bj)
244 enddo
245 enddo
246 print *,' gvphy at level ',l,' ',tempij
247 enddo
248 do L = 1,Nr
249 do j = 1,sNy
250 do i = 1,sNx
251 tempij(i,j) = gthphy(i,j,L,bi,bj)
252 enddo
253 enddo
254 print *,' gthphy at level ',l,' ',tempij
255 enddo
256 do L = 1,Nr
257 do j = 1,sNy
258 do i = 1,sNx
259 tempij(i,j) = gsphy(i,j,L,bi,bj)
260 enddo
261 enddo
262 print *,' gsphy at level ',l,' ',tempij
263 enddo
264 endif
265 enddo
266 enddo
267
268 return
269 end

  ViewVC Help
Powered by ViewVC 1.1.22