1 |
molod |
1.1 |
subroutine fizhi_wrapper (myTime, myIter, myThid) |
2 |
|
|
c----------------------------------------------------------------------- |
3 |
|
|
c Subroutine fizhi_wrapper - 'Wrapper' routine to interface |
4 |
|
|
c with physics driver. |
5 |
|
|
c 1) Set up "bi, bj loop" and some timers and clocks. |
6 |
|
|
c 2) Call do_fizhi - driver for physics which computes tendencies |
7 |
|
|
c 3) Interpolate tendencies to dynamics grid in vertical |
8 |
|
|
c 4) Convert u,v tendencies to C-Grid |
9 |
|
|
c |
10 |
|
|
c Calls: do_fizhi (get u,v,t,s tend, step tke, etc and tc, etc. forward) |
11 |
|
|
c phys2dyn (4 calls - all physics tendencies) |
12 |
|
|
c AtoC (u and v tendencies) |
13 |
|
|
c----------------------------------------------------------------------- |
14 |
|
|
implicit none |
15 |
|
|
#include "CPP_OPTIONS.h" |
16 |
|
|
#include "SIZE.h" |
17 |
|
|
#include "GRID.h" |
18 |
|
|
#include "land_SIZE.h" |
19 |
|
|
#include "fizhi_SIZE.h" |
20 |
|
|
#include "DYNVARS.h" |
21 |
|
|
#include "fizhi_coms.h" |
22 |
|
|
#include "gridalt_mapping.h" |
23 |
|
|
#include "land_coms.h" |
24 |
|
|
#include "EEPARAMS.h" |
25 |
|
|
#include "SURFACE.h" |
26 |
|
|
|
27 |
|
|
integer myTime, myIter, myThid |
28 |
|
|
|
29 |
|
|
c pe on dynamics and physics grid refers to bottom edge |
30 |
|
|
_RL pephy(1-OLx:sNx+Olx,1-Oly:sNy+Oly,Nrphys+1,nSx,nSy) |
31 |
|
|
_RL pedyn(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr+1,nSx,nSy) |
32 |
|
|
|
33 |
|
|
integer i, j, L, Lbotij, bi, bj |
34 |
|
|
integer im1, im2, jm1, jm2, idim1, idim2, jdim1, jdim2 |
35 |
|
|
|
36 |
|
|
im1 = 1-OLx |
37 |
|
|
im2 = sNx+OLx |
38 |
|
|
jm1 = 1-OLy |
39 |
|
|
jm2 = sNy+OLy |
40 |
|
|
idim1 = 1 |
41 |
|
|
idim2 = sNx |
42 |
|
|
jdim1 = 1 |
43 |
|
|
jdim2 = sNy |
44 |
|
|
|
45 |
|
|
do bj = myByLo(myThid), myByHi(myThid) |
46 |
|
|
do bi = myBxLo(myThid), myBxHi(myThid) |
47 |
|
|
|
48 |
|
|
c Construct the physics grid pressures |
49 |
|
|
do j = 1,sNy |
50 |
|
|
do i = 1,sNx |
51 |
molod |
1.2 |
pephy(i,j,1,bi,bj)=(Ro_surf(i,j,bi,bj) + etaH(i,j,bi,bj))/ |
52 |
|
|
. rstarExpC(i,j,bi,bj) |
53 |
molod |
1.1 |
do L = 2,Nrphys+1 |
54 |
|
|
pephy(i,j,L,bi,bj)=pephy(i,j,L-1,bi,bj)-dpphys(i,j,L-1,bi,bj) |
55 |
|
|
enddo |
56 |
|
|
c Do not use a zero field as the top edge pressure for interpolation |
57 |
|
|
if(pephy(i,j,Nrphys+1,bi,bj).lt.1.e-5) |
58 |
|
|
. pephy(i,j,Nrphys+1,bi,bj) = 1.e-5 |
59 |
|
|
enddo |
60 |
|
|
enddo |
61 |
|
|
C Build pressures on dynamics grid |
62 |
|
|
do j = 1,sNy |
63 |
|
|
do i = 1,sNx |
64 |
|
|
do L = 1,Nr |
65 |
|
|
pedyn(i,j,L,bi,bj) = 0. |
66 |
|
|
enddo |
67 |
|
|
enddo |
68 |
|
|
enddo |
69 |
|
|
do j = 1,sNy |
70 |
molod |
1.2 |
do i = 1,sNx |
71 |
molod |
1.1 |
Lbotij = ksurfC(i,j,bi,bj) |
72 |
|
|
if(Lbotij.ne.0.) |
73 |
molod |
1.2 |
. pedyn(i,j,Lbotij,bi,bj) = (Ro_surf(i,j,bi,bj) + etaH(i,j,bi,bj))/ |
74 |
|
|
. rstarExpC(i,j,bi,bj) |
75 |
molod |
1.1 |
enddo |
76 |
|
|
enddo |
77 |
|
|
do j = 1,sNy |
78 |
|
|
do i = 1,sNx |
79 |
|
|
Lbotij = ksurfC(i,j,bi,bj) |
80 |
|
|
do L = Lbotij+1,Nr+1 |
81 |
|
|
pedyn(i,j,L,bi,bj) = pedyn(i,j,L-1,bi,bj) - |
82 |
|
|
. drF(L-1)*hfacC(i,j,L-1,bi,bj) |
83 |
|
|
enddo |
84 |
|
|
c Do not use a zero field as the top edge pressure for interpolation |
85 |
|
|
if(pedyn(i,j,Nr+1,bi,bj).lt.1.e-5) |
86 |
|
|
. pedyn(i,j,Nr+1,bi,bj) = 1.e-5 |
87 |
|
|
enddo |
88 |
|
|
enddo |
89 |
molod |
1.3 |
enddo |
90 |
|
|
enddo |
91 |
|
|
|
92 |
|
|
CALL TIMER_START ('DO_FIZHI [FIZHI_WRAPPER]',mythid) |
93 |
|
|
do bj = myByLo(myThid), myByHi(myThid) |
94 |
|
|
do bi = myBxLo(myThid), myBxHi(myThid) |
95 |
molod |
1.1 |
c |
96 |
|
|
c Compute physics increments |
97 |
|
|
call do_fizhi(uphy,vphy,thphy,sphy,pephy, |
98 |
|
|
. ctmt,xxmt,yymt,zetamt,xlmt,khmt,tke, |
99 |
|
|
. xC,yC, |
100 |
|
|
. im1,im2,jm1,jm2,Nrphys,Nsx,Nsy,1,sNx,1,sNy,bi,bj,nchp, |
101 |
|
|
. duphy,dvphy,dthphy,dsphy) |
102 |
molod |
1.3 |
enddo |
103 |
|
|
enddo |
104 |
|
|
CALL TIMER_STOP ('DO_FIZHI [FIZHI_WRAPPER]',mythid) |
105 |
|
|
|
106 |
|
|
CALL TIMER_START ('PHYS2DYN [FIZHI_WRAPPER]',mythid) |
107 |
|
|
do bj = myByLo(myThid), myByHi(myThid) |
108 |
|
|
do bi = myBxLo(myThid), myBxHi(myThid) |
109 |
molod |
1.1 |
c Interpolate (A-Grid) physics increments to dynamics grid |
110 |
|
|
call phys2dyn(duphy,pephy,im1,im2,jm1,jm2,Nrphys,Nsx,Nsy, |
111 |
|
|
. 1,sNx,1,sNy,bi,bj,pedyn,ksurfC,Nr,nlperdyn,guphy) |
112 |
|
|
call phys2dyn(dvphy,pephy,im1,im2,jm1,jm2,Nrphys,Nsx,Nsy, |
113 |
|
|
. 1,sNx,1,sNy,bi,bj,pedyn,ksurfC,Nr,nlperdyn,gvphy) |
114 |
|
|
call phys2dyn(dthphy,pephy,im1,im2,jm1,jm2,Nrphys,Nsx,Nsy, |
115 |
|
|
. 1,sNx,1,sNy,bi,bj,pedyn,ksurfC,Nr,nlperdyn,gthphy) |
116 |
|
|
call phys2dyn(dsphy,pephy,im1,im2,jm1,jm2,Nrphys,Nsx,Nsy, |
117 |
|
|
. 1,sNx,1,sNy,bi,bj,pedyn,ksurfC,Nr,nlperdyn,gsphy) |
118 |
|
|
|
119 |
|
|
enddo |
120 |
|
|
enddo |
121 |
molod |
1.3 |
CALL TIMER_STOP ('PHYS2DYN [FIZHI_WRAPPER]',mythid) |
122 |
molod |
1.1 |
|
123 |
|
|
c Convert guphy and gvphy from A-grid to C-grid for use by dynamics |
124 |
molod |
1.3 |
CALL TIMER_START ('ATOC [FIZHI_WRAPPER]',mythid) |
125 |
molod |
1.1 |
call AtoC(myThid,guphy,gvphy,maskC,im1,im2,jm1,jm2,Nr, |
126 |
|
|
. Nsx,Nsy,1,sNx,1,sNy,guphy,gvphy) |
127 |
molod |
1.3 |
CALL TIMER_STOP ('ATOC [FIZHI_WRAPPER]',mythid) |
128 |
molod |
1.2 |
|
129 |
molod |
1.3 |
CALL TIMER_START ('EXCHANGES [FIZHI_WRAPPER]',mythid) |
130 |
molod |
1.2 |
c Call the c-grid exchange routine to fill in the halo regions (du,dv) |
131 |
|
|
call exch_uv_xyz_RL(guphy,gvphy,.TRUE.,myThid) |
132 |
|
|
c Call the a-grid exchange routine to fill in the halo regions (dth,ds) |
133 |
|
|
call exch_RL_cube(gthphy,OLx, OLx, OLy, OLy, Nr,OLx, OLy, |
134 |
|
|
. FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
135 |
|
|
call exch_RL_cube(gsphy,OLx, OLx, OLy, OLy, Nr,OLx, OLy, |
136 |
|
|
. FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
137 |
molod |
1.3 |
CALL TIMER_STOP ('EXCHANGES [FIZHI_WRAPPER]',mythid) |
138 |
molod |
1.1 |
|
139 |
|
|
return |
140 |
|
|
end |