1 |
C $Header: $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "CPP_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 "land_SIZE.h" |
22 |
#include "fizhi_SIZE.h" |
23 |
#include "DYNVARS.h" |
24 |
#include "fizhi_coms.h" |
25 |
#include "gridalt_mapping.h" |
26 |
#include "land_coms.h" |
27 |
#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 |
_RL pephy(1-OLx:sNx+Olx,1-Oly:sNy+Oly,Nrphys+1,nSx,nSy) |
34 |
_RL pedyn(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr+1,nSx,nSy) |
35 |
|
36 |
integer i, j, L, Lbotij, bi, bj |
37 |
integer im1, im2, jm1, jm2, idim1, idim2, jdim1, jdim2 |
38 |
|
39 |
im1 = 1-OLx |
40 |
im2 = sNx+OLx |
41 |
jm1 = 1-OLy |
42 |
jm2 = sNy+OLy |
43 |
idim1 = 1 |
44 |
idim2 = sNx |
45 |
jdim1 = 1 |
46 |
jdim2 = sNy |
47 |
|
48 |
do bj = myByLo(myThid), myByHi(myThid) |
49 |
do bi = myBxLo(myThid), myBxHi(myThid) |
50 |
|
51 |
c Construct the physics grid pressures |
52 |
do j = 1,sNy |
53 |
do i = 1,sNx |
54 |
pephy(i,j,1,bi,bj)=(Ro_surf(i,j,bi,bj) + etaH(i,j,bi,bj))/ |
55 |
. rstarExpC(i,j,bi,bj) |
56 |
do L = 2,Nrphys+1 |
57 |
pephy(i,j,L,bi,bj)=pephy(i,j,L-1,bi,bj)-dpphys(i,j,L-1,bi,bj) |
58 |
enddo |
59 |
c Do not use a zero field as the top edge pressure for interpolation |
60 |
if(pephy(i,j,Nrphys+1,bi,bj).lt.1.e-5) |
61 |
. pephy(i,j,Nrphys+1,bi,bj) = 1.e-5 |
62 |
enddo |
63 |
enddo |
64 |
C Build pressures on dynamics grid |
65 |
do j = 1,sNy |
66 |
do i = 1,sNx |
67 |
do L = 1,Nr |
68 |
pedyn(i,j,L,bi,bj) = 0. |
69 |
enddo |
70 |
enddo |
71 |
enddo |
72 |
do j = 1,sNy |
73 |
do i = 1,sNx |
74 |
Lbotij = ksurfC(i,j,bi,bj) |
75 |
if(Lbotij.ne.0.) |
76 |
. pedyn(i,j,Lbotij,bi,bj) = (Ro_surf(i,j,bi,bj) + etaH(i,j,bi,bj))/ |
77 |
. rstarExpC(i,j,bi,bj) |
78 |
enddo |
79 |
enddo |
80 |
do j = 1,sNy |
81 |
do i = 1,sNx |
82 |
Lbotij = ksurfC(i,j,bi,bj) |
83 |
do L = Lbotij+1,Nr+1 |
84 |
pedyn(i,j,L,bi,bj) = pedyn(i,j,L-1,bi,bj) - |
85 |
. drF(L-1)*hfacC(i,j,L-1,bi,bj) |
86 |
enddo |
87 |
c Do not use a zero field as the top edge pressure for interpolation |
88 |
if(pedyn(i,j,Nr+1,bi,bj).lt.1.e-5) |
89 |
. pedyn(i,j,Nr+1,bi,bj) = 1.e-5 |
90 |
enddo |
91 |
enddo |
92 |
enddo |
93 |
enddo |
94 |
|
95 |
CALL TIMER_START ('DO_FIZHI [FIZHI_WRAPPER]',mythid) |
96 |
do bj = myByLo(myThid), myByHi(myThid) |
97 |
do bi = myBxLo(myThid), myBxHi(myThid) |
98 |
c |
99 |
c Compute physics increments |
100 |
call do_fizhi(uphy,vphy,thphy,sphy,pephy, |
101 |
. ctmt,xxmt,yymt,zetamt,xlmt,khmt,tke, |
102 |
. xC,yC, |
103 |
. im1,im2,jm1,jm2,Nrphys,Nsx,Nsy,1,sNx,1,sNy,bi,bj,nchp, |
104 |
. duphy,dvphy,dthphy,dsphy) |
105 |
enddo |
106 |
enddo |
107 |
CALL TIMER_STOP ('DO_FIZHI [FIZHI_WRAPPER]',mythid) |
108 |
|
109 |
CALL TIMER_START ('PHYS2DYN [FIZHI_WRAPPER]',mythid) |
110 |
do bj = myByLo(myThid), myByHi(myThid) |
111 |
do bi = myBxLo(myThid), myBxHi(myThid) |
112 |
c Interpolate (A-Grid) physics increments to dynamics grid |
113 |
call phys2dyn(duphy,pephy,im1,im2,jm1,jm2,Nrphys,Nsx,Nsy, |
114 |
. 1,sNx,1,sNy,bi,bj,pedyn,ksurfC,Nr,nlperdyn,guphy) |
115 |
call phys2dyn(dvphy,pephy,im1,im2,jm1,jm2,Nrphys,Nsx,Nsy, |
116 |
. 1,sNx,1,sNy,bi,bj,pedyn,ksurfC,Nr,nlperdyn,gvphy) |
117 |
call phys2dyn(dthphy,pephy,im1,im2,jm1,jm2,Nrphys,Nsx,Nsy, |
118 |
. 1,sNx,1,sNy,bi,bj,pedyn,ksurfC,Nr,nlperdyn,gthphy) |
119 |
call phys2dyn(dsphy,pephy,im1,im2,jm1,jm2,Nrphys,Nsx,Nsy, |
120 |
. 1,sNx,1,sNy,bi,bj,pedyn,ksurfC,Nr,nlperdyn,gsphy) |
121 |
|
122 |
enddo |
123 |
enddo |
124 |
CALL TIMER_STOP ('PHYS2DYN [FIZHI_WRAPPER]',mythid) |
125 |
|
126 |
c Convert guphy and gvphy from A-grid to C-grid for use by dynamics |
127 |
CALL TIMER_START ('ATOC [FIZHI_WRAPPER]',mythid) |
128 |
call AtoC(myThid,guphy,gvphy,maskC,im1,im2,jm1,jm2,Nr, |
129 |
. Nsx,Nsy,1,sNx,1,sNy,guphy,gvphy) |
130 |
CALL TIMER_STOP ('ATOC [FIZHI_WRAPPER]',mythid) |
131 |
|
132 |
CALL TIMER_START ('EXCHANGES [FIZHI_WRAPPER]',mythid) |
133 |
c Call the c-grid exchange routine to fill in the halo regions (du,dv) |
134 |
call exch_uv_xyz_RL(guphy,gvphy,.TRUE.,myThid) |
135 |
c Call the a-grid exchange routine to fill in the halo regions (dth,ds) |
136 |
call exch_RL_cube(gthphy,OLx, OLx, OLy, OLy, Nr,OLx, OLy, |
137 |
. FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
138 |
call exch_RL_cube(gsphy,OLx, OLx, OLy, OLy, Nr,OLx, OLy, |
139 |
. FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
140 |
CALL TIMER_STOP ('EXCHANGES [FIZHI_WRAPPER]',mythid) |
141 |
|
142 |
return |
143 |
end |