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