/[MITgcm]/MITgcm/pkg/fizhi/fizhi_wrapper.F
ViewVC logotype

Annotation of /MITgcm/pkg/fizhi/fizhi_wrapper.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.24 - (hide annotations) (download)
Thu Oct 21 16:25:21 2004 UTC (19 years, 7 months ago) by molod
Branch: MAIN
Changes since 1.23: +2 -2 lines
Change argument from phi0 to z of topography itself

1 molod 1.24 C $Header: /u/gcmpack/MITgcm/pkg/fizhi/fizhi_wrapper.F,v 1.23 2004/10/21 15:18:11 molod Exp $
2 molod 1.4 C $Name: $
3    
4 molod 1.14 #include "FIZHI_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 molod 1.22 _RL tempij(1-olx:sNx+olx,1-oly:sNy+oly)
45 molod 1.1
46 molod 1.8 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 molod 1.1
55     do bj = myByLo(myThid), myByHi(myThid)
56     do bi = myBxLo(myThid), myBxHi(myThid)
57    
58 molod 1.7 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 molod 1.1 do j = 1,sNy
62     do i = 1,sNx
63 molod 1.11 pephy(i,j,1,bi,bj)=(Ro_surf(i,j,bi,bj) + etaH(i,j,bi,bj))
64 molod 1.1 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 molod 1.7 do L = 1,Nrphys+1
69     pephy4fiz(i,j,Nrphys+2-L,bi,bj)=pephy(i,j,L,bi,bj)
70     enddo
71 molod 1.1 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 molod 1.2 do i = 1,sNx
85 molod 1.1 Lbotij = ksurfC(i,j,bi,bj)
86     if(Lbotij.ne.0.)
87 molod 1.11 . pedyn(i,j,Lbotij,bi,bj) = (Ro_surf(i,j,bi,bj) + etaH(i,j,bi,bj))
88 molod 1.1 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 molod 1.3 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 molod 1.10 call get_landfrac(im2,jm2,Nsx,Nsy,bi,bj,maxtyp,
109     . surftype,tilefrac,fracland)
110 molod 1.1 c
111     c Compute physics increments
112 molod 1.16
113     call do_fizhi(myThid,
114     . idim1,idim2,jdim1,jdim2,Nrphys,Nsx,Nsy,im1,im2,jm1,jm2,bi,bj,
115     . nchp,nchptot,nchpland,
116 molod 1.24 . uphy,vphy,thphy,sphy,pephy4fiz,xC,yC,topoZ,
117 molod 1.12 . 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 molod 1.20 . iras,nlwcld,cldtot_lw,cldras_lw,cldlsp_lw,nlwlz,lwlz,
123     . nswcld,cldtot_sw,cldras_sw,cldlsp_sw,nswlz,swlz,
124     . imstturbsw,imstturblw,qliqavesw,qliqavelw,fccavesw,fccavelw,
125 molod 1.21 . raincon,rainlsp,snowfall,
126 molod 1.12 . duphy,dvphy,dthphy,dsphy)
127 molod 1.3 enddo
128     enddo
129 molod 1.15
130 molod 1.3 CALL TIMER_STOP ('DO_FIZHI [FIZHI_WRAPPER]',mythid)
131    
132     CALL TIMER_START ('PHYS2DYN [FIZHI_WRAPPER]',mythid)
133     do bj = myByLo(myThid), myByHi(myThid)
134     do bi = myBxLo(myThid), myBxHi(myThid)
135 molod 1.1 c Interpolate (A-Grid) physics increments to dynamics grid
136 molod 1.7 C First flip the physics arrays (which are top-down)
137     C into bottom-up arrays for interpolation to dynamics grid
138     do j = 1,sNy
139     do i = 1,sNx
140     do L = 1,Nrphys
141 molod 1.12 tempphy(i,j,Nrphys+1-L,bi,bj)=duphy(i,j,L,bi,bj)
142 molod 1.7 enddo
143     enddo
144     enddo
145 molod 1.12 call phys2dyn(tempphy,pephy,idim1,idim2,jdim1,jdim2,Nrphys,
146 molod 1.8 . Nsx,Nsy,im1,im2,jm1,jm2,bi,bj,pedyn,ksurfC,Nr,nlperdyn,guphy)
147 molod 1.7 do j = 1,sNy
148     do i = 1,sNx
149     do L = 1,Nrphys
150 molod 1.12 tempphy(i,j,Nrphys+1-L,bi,bj)=dvphy(i,j,L,bi,bj)
151 molod 1.7 enddo
152     enddo
153     enddo
154 molod 1.12 call phys2dyn(tempphy,pephy,idim1,idim2,jdim1,jdim2,Nrphys,
155 molod 1.8 . Nsx,Nsy,im1,im2,jm1,jm2,bi,bj,pedyn,ksurfC,Nr,nlperdyn,gvphy)
156 molod 1.7 do j = 1,sNy
157     do i = 1,sNx
158     do L = 1,Nrphys
159 molod 1.12 tempphy(i,j,Nrphys+1-L,bi,bj)=dthphy(i,j,L,bi,bj)
160 molod 1.7 enddo
161     enddo
162     enddo
163 molod 1.12 call phys2dyn(tempphy,pephy,idim1,idim2,jdim1,jdim2,Nrphys,
164 molod 1.8 . Nsx,Nsy,im1,im2,jm1,jm2,bi,bj,pedyn,ksurfC,Nr,nlperdyn,gthphy)
165 molod 1.7 do j = 1,sNy
166     do i = 1,sNx
167     do L = 1,Nrphys
168 molod 1.12 tempphy(i,j,Nrphys+1-L,bi,bj)=dsphy(i,j,L,bi,bj)
169 molod 1.7 enddo
170     enddo
171     enddo
172 molod 1.12 call phys2dyn(tempphy,pephy,idim1,idim2,jdim1,jdim2,Nrphys,
173 molod 1.8 . Nsx,Nsy,im1,im2,jm1,jm2,bi,bj,pedyn,ksurfC,Nr,nlperdyn,gsphy)
174 molod 1.1
175     enddo
176     enddo
177 molod 1.17
178 molod 1.3 CALL TIMER_STOP ('PHYS2DYN [FIZHI_WRAPPER]',mythid)
179 molod 1.1
180     c Convert guphy and gvphy from A-grid to C-grid for use by dynamics
181 molod 1.3 CALL TIMER_START ('ATOC [FIZHI_WRAPPER]',mythid)
182 molod 1.8 call AtoC(myThid,guphy,gvphy,maskC,idim1,idim2,jdim1,jdim2,Nr,
183     . Nsx,Nsy,im1,im2,jm1,jm2,guphy,gvphy)
184 molod 1.3 CALL TIMER_STOP ('ATOC [FIZHI_WRAPPER]',mythid)
185 molod 1.2
186 molod 1.3 CALL TIMER_START ('EXCHANGES [FIZHI_WRAPPER]',mythid)
187 molod 1.2 c Call the c-grid exchange routine to fill in the halo regions (du,dv)
188     call exch_uv_xyz_RL(guphy,gvphy,.TRUE.,myThid)
189     c Call the a-grid exchange routine to fill in the halo regions (dth,ds)
190 molod 1.22 _EXCH_XYZ_R8(gthphy,myThid)
191     _EXCH_XYZ_R8(gsphy,myThid)
192 molod 1.3 CALL TIMER_STOP ('EXCHANGES [FIZHI_WRAPPER]',mythid)
193 molod 1.1
194     return
195     end

  ViewVC Help
Powered by ViewVC 1.1.22