1 |
molod |
1.11 |
C $Header: /u/gcmpack/MITgcm/pkg/fizhi/fizhi_wrapper.F,v 1.10 2004/06/16 19:19:49 molod Exp $ |
2 |
molod |
1.4 |
C $Name: $ |
3 |
|
|
|
4 |
|
|
#include "CPP_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 |
|
|
#include "SURFACE.h" |
23 |
|
|
#include "DYNVARS.h" |
24 |
molod |
1.6 |
#include "fizhi_land_SIZE.h" |
25 |
molod |
1.1 |
#include "fizhi_SIZE.h" |
26 |
|
|
#include "fizhi_coms.h" |
27 |
|
|
#include "gridalt_mapping.h" |
28 |
molod |
1.9 |
#include "fizhi_land_coms.h" |
29 |
|
|
#include "fizhi_earth_coms.h" |
30 |
|
|
#include "fizhi_ocean_coms.h" |
31 |
|
|
#include "fizhi_chemistry_coms.h" |
32 |
molod |
1.1 |
|
33 |
|
|
integer myTime, myIter, myThid |
34 |
|
|
|
35 |
|
|
c pe on dynamics and physics grid refers to bottom edge |
36 |
molod |
1.7 |
_RL pephy4fiz(1-OLx:sNx+Olx,1-Oly:sNy+Oly,Nrphys+1,nSx,nSy) |
37 |
molod |
1.1 |
_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 |
molod |
1.7 |
_RL tempphy(1-OLx:sNx+Olx,1-Oly:sNy+Oly,Nrphys,nSx,nSy) |
40 |
molod |
1.10 |
_RL fracland(sNx,sNy,Nsx,Nsy) |
41 |
molod |
1.1 |
|
42 |
|
|
integer i, j, L, Lbotij, bi, bj |
43 |
|
|
integer im1, im2, jm1, jm2, idim1, idim2, jdim1, jdim2 |
44 |
|
|
|
45 |
molod |
1.8 |
idim1 = 1-OLx |
46 |
|
|
idim2 = sNx+OLx |
47 |
|
|
jdim1 = 1-OLy |
48 |
|
|
jdim2 = sNy+OLy |
49 |
|
|
im1 = 1 |
50 |
|
|
im2 = sNx |
51 |
|
|
jm1 = 1 |
52 |
|
|
jm2 = sNy |
53 |
molod |
1.1 |
|
54 |
|
|
do bj = myByLo(myThid), myByHi(myThid) |
55 |
|
|
do bi = myBxLo(myThid), myBxHi(myThid) |
56 |
|
|
|
57 |
molod |
1.7 |
c Construct the physics grid pressures |
58 |
|
|
C Note: Need one array to send to fizhi (top-down) and another |
59 |
|
|
C For the interpolations between physics and dynamics (bottom-up) |
60 |
molod |
1.1 |
do j = 1,sNy |
61 |
|
|
do i = 1,sNx |
62 |
molod |
1.11 |
pephy(i,j,1,bi,bj)=(Ro_surf(i,j,bi,bj) + etaH(i,j,bi,bj)) |
63 |
molod |
1.1 |
do L = 2,Nrphys+1 |
64 |
|
|
pephy(i,j,L,bi,bj)=pephy(i,j,L-1,bi,bj)-dpphys(i,j,L-1,bi,bj) |
65 |
|
|
enddo |
66 |
|
|
c Do not use a zero field as the top edge pressure for interpolation |
67 |
molod |
1.7 |
do L = 1,Nrphys+1 |
68 |
|
|
pephy4fiz(i,j,Nrphys+2-L,bi,bj)=pephy(i,j,L,bi,bj) |
69 |
|
|
enddo |
70 |
molod |
1.1 |
if(pephy(i,j,Nrphys+1,bi,bj).lt.1.e-5) |
71 |
|
|
. pephy(i,j,Nrphys+1,bi,bj) = 1.e-5 |
72 |
|
|
enddo |
73 |
|
|
enddo |
74 |
|
|
C Build pressures on dynamics grid |
75 |
|
|
do j = 1,sNy |
76 |
|
|
do i = 1,sNx |
77 |
|
|
do L = 1,Nr |
78 |
|
|
pedyn(i,j,L,bi,bj) = 0. |
79 |
|
|
enddo |
80 |
|
|
enddo |
81 |
|
|
enddo |
82 |
|
|
do j = 1,sNy |
83 |
molod |
1.2 |
do i = 1,sNx |
84 |
molod |
1.1 |
Lbotij = ksurfC(i,j,bi,bj) |
85 |
|
|
if(Lbotij.ne.0.) |
86 |
molod |
1.11 |
. pedyn(i,j,Lbotij,bi,bj) = (Ro_surf(i,j,bi,bj) + etaH(i,j,bi,bj)) |
87 |
molod |
1.1 |
enddo |
88 |
|
|
enddo |
89 |
|
|
do j = 1,sNy |
90 |
|
|
do i = 1,sNx |
91 |
|
|
Lbotij = ksurfC(i,j,bi,bj) |
92 |
|
|
do L = Lbotij+1,Nr+1 |
93 |
|
|
pedyn(i,j,L,bi,bj) = pedyn(i,j,L-1,bi,bj) - |
94 |
|
|
. drF(L-1)*hfacC(i,j,L-1,bi,bj) |
95 |
|
|
enddo |
96 |
|
|
c Do not use a zero field as the top edge pressure for interpolation |
97 |
|
|
if(pedyn(i,j,Nr+1,bi,bj).lt.1.e-5) |
98 |
|
|
. pedyn(i,j,Nr+1,bi,bj) = 1.e-5 |
99 |
|
|
enddo |
100 |
|
|
enddo |
101 |
molod |
1.3 |
enddo |
102 |
|
|
enddo |
103 |
|
|
|
104 |
|
|
CALL TIMER_START ('DO_FIZHI [FIZHI_WRAPPER]',mythid) |
105 |
|
|
do bj = myByLo(myThid), myByHi(myThid) |
106 |
|
|
do bi = myBxLo(myThid), myBxHi(myThid) |
107 |
molod |
1.10 |
call get_landfrac(im2,jm2,Nsx,Nsy,bi,bj,maxtyp, |
108 |
|
|
. surftype,tilefrac,fracland) |
109 |
molod |
1.1 |
c |
110 |
|
|
c Compute physics increments |
111 |
molod |
1.10 |
call do_fizhi(myThid,uphy,vphy,thphy,sphy,pephy4fiz,xC,yC, |
112 |
molod |
1.9 |
. ctmt,xxmt,yymt,zetamt,xlmt,khmt,tke, |
113 |
molod |
1.10 |
. tgz,sst,sice,phis_var,landtype,fracland,emiss,albnidr,albnirdf, |
114 |
molod |
1.9 |
. albvisdr,albvisdf,ityp,chfr,alai,agrn,igrd,chlat,chlon, |
115 |
|
|
. tcanopy,tdeep,ecanopy,swetshal,swetroot,swetdeep,snodep,capac, |
116 |
|
|
. o3,qstr,co2,cfc11,cfc12,cfc22,n2o,methane, |
117 |
|
|
. idim1,idim2,jdim1,jdim2,Nrphys,Nsx,Nsy,im1,im2,jm1,jm2,bi,bj, |
118 |
molod |
1.10 |
. nchp,nchpland, |
119 |
molod |
1.9 |
. duphy,dvphy,dthphy,dsphy) |
120 |
molod |
1.3 |
enddo |
121 |
|
|
enddo |
122 |
|
|
CALL TIMER_STOP ('DO_FIZHI [FIZHI_WRAPPER]',mythid) |
123 |
|
|
|
124 |
|
|
CALL TIMER_START ('PHYS2DYN [FIZHI_WRAPPER]',mythid) |
125 |
|
|
do bj = myByLo(myThid), myByHi(myThid) |
126 |
|
|
do bi = myBxLo(myThid), myBxHi(myThid) |
127 |
molod |
1.1 |
c Interpolate (A-Grid) physics increments to dynamics grid |
128 |
molod |
1.7 |
C First flip the physics arrays (which are top-down) |
129 |
|
|
C into bottom-up arrays for interpolation to dynamics grid |
130 |
|
|
do j = 1,sNy |
131 |
|
|
do i = 1,sNx |
132 |
|
|
do L = 1,Nrphys |
133 |
|
|
tempphys(i,j,Nrphys+1-L,bi,bj)=duphy(i,j,L,bi,bj) |
134 |
|
|
enddo |
135 |
|
|
enddo |
136 |
|
|
enddo |
137 |
molod |
1.8 |
call phys2dyn(tmpphys,pephy,idim1,idim2,jdim1,jdim2,Nrphys, |
138 |
|
|
. Nsx,Nsy,im1,im2,jm1,jm2,bi,bj,pedyn,ksurfC,Nr,nlperdyn,guphy) |
139 |
molod |
1.7 |
do j = 1,sNy |
140 |
|
|
do i = 1,sNx |
141 |
|
|
do L = 1,Nrphys |
142 |
|
|
tempphys(i,j,Nrphys+1-L,bi,bj)=dvphy(i,j,L,bi,bj) |
143 |
|
|
enddo |
144 |
|
|
enddo |
145 |
|
|
enddo |
146 |
molod |
1.8 |
call phys2dyn(tmpphys,pephy,idim1,idim2,jdim1,jdim2,Nrphys, |
147 |
|
|
. Nsx,Nsy,im1,im2,jm1,jm2,bi,bj,pedyn,ksurfC,Nr,nlperdyn,gvphy) |
148 |
molod |
1.7 |
do j = 1,sNy |
149 |
|
|
do i = 1,sNx |
150 |
|
|
do L = 1,Nrphys |
151 |
|
|
tempphys(i,j,Nrphys+1-L,bi,bj)=dthphy(i,j,L,bi,bj) |
152 |
|
|
enddo |
153 |
|
|
enddo |
154 |
|
|
enddo |
155 |
molod |
1.8 |
call phys2dyn(tmpphys,pephy,idim1,idim2,jdim1,jdim2,Nrphys, |
156 |
|
|
. Nsx,Nsy,im1,im2,jm1,jm2,bi,bj,pedyn,ksurfC,Nr,nlperdyn,gthphy) |
157 |
molod |
1.7 |
do j = 1,sNy |
158 |
|
|
do i = 1,sNx |
159 |
|
|
do L = 1,Nrphys |
160 |
|
|
tempphys(i,j,Nrphys+1-L,bi,bj)=dsphy(i,j,L,bi,bj) |
161 |
|
|
enddo |
162 |
|
|
enddo |
163 |
|
|
enddo |
164 |
molod |
1.8 |
call phys2dyn(tmpphys,pephy,idim1,idim2,jdim1,jdim2,Nrphys, |
165 |
|
|
. Nsx,Nsy,im1,im2,jm1,jm2,bi,bj,pedyn,ksurfC,Nr,nlperdyn,gsphy) |
166 |
molod |
1.1 |
|
167 |
|
|
enddo |
168 |
|
|
enddo |
169 |
molod |
1.3 |
CALL TIMER_STOP ('PHYS2DYN [FIZHI_WRAPPER]',mythid) |
170 |
molod |
1.1 |
|
171 |
|
|
c Convert guphy and gvphy from A-grid to C-grid for use by dynamics |
172 |
molod |
1.3 |
CALL TIMER_START ('ATOC [FIZHI_WRAPPER]',mythid) |
173 |
molod |
1.8 |
call AtoC(myThid,guphy,gvphy,maskC,idim1,idim2,jdim1,jdim2,Nr, |
174 |
|
|
. Nsx,Nsy,im1,im2,jm1,jm2,guphy,gvphy) |
175 |
molod |
1.3 |
CALL TIMER_STOP ('ATOC [FIZHI_WRAPPER]',mythid) |
176 |
molod |
1.2 |
|
177 |
molod |
1.3 |
CALL TIMER_START ('EXCHANGES [FIZHI_WRAPPER]',mythid) |
178 |
molod |
1.2 |
c Call the c-grid exchange routine to fill in the halo regions (du,dv) |
179 |
|
|
call exch_uv_xyz_RL(guphy,gvphy,.TRUE.,myThid) |
180 |
|
|
c Call the a-grid exchange routine to fill in the halo regions (dth,ds) |
181 |
|
|
call exch_RL_cube(gthphy,OLx, OLx, OLy, OLy, Nr,OLx, OLy, |
182 |
|
|
. FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
183 |
|
|
call exch_RL_cube(gsphy,OLx, OLx, OLy, OLy, Nr,OLx, OLy, |
184 |
|
|
. FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
185 |
molod |
1.3 |
CALL TIMER_STOP ('EXCHANGES [FIZHI_WRAPPER]',mythid) |
186 |
molod |
1.1 |
|
187 |
|
|
return |
188 |
|
|
end |