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

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

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


Revision 1.8 - (hide annotations) (download)
Mon Jul 26 18:45:17 2004 UTC (19 years, 11 months ago) by molod
Branch: MAIN
CVS Tags: checkpoint54d_post
Changes since 1.7: +2 -2 lines
Went to use of FIZHI_OPTIONS and _RL in all routines

1 molod 1.8 C $Header: /u/gcmpack/MITgcm/pkg/fizhi/step_fizhi_corr.F,v 1.7 2004/06/14 20:34:50 molod Exp $
2 edhill 1.5 C $Name: $
3    
4 molod 1.8 #include "FIZHI_OPTIONS.h"
5 molod 1.1 subroutine step_fizhi_corr (myTime, myIter, myThid)
6     c----------------------------------------------------------------------
7     c Subroutine step_fizhi_corr - 'Wrapper' routine to advance
8     c the physics state and make the new value.
9     c At this point, increment with the "correction term"
10     c which includes the dynamics tendency and the integral
11     c constraint to enforce agreement with the dynamics state
12     c Also: Set up "bi, bj loop" and some timers and clocks here.
13     c
14     c Call:phys2dyn (4) (interpolate physics state to dynamics grid
15     c for use in the correction terms)
16     c AtoC (convert physics state on dynamics grid to C-Grid)
17     c CtoA (convert correction term on dynamics grid to A-Grid)
18     c dyn2phys (4) (interpolate A-Grid correction term to physics grid)
19     c step_physics (advance physics state by correction term)
20     c-----------------------------------------------------------------------
21     implicit none
22     #include "SIZE.h"
23     #include "GRID.h"
24     #include "fizhi_SIZE.h"
25 molod 1.6 #include "fizhi_land_SIZE.h"
26 molod 1.1 #include "DYNVARS.h"
27     #include "fizhi_coms.h"
28     #include "gridalt_mapping.h"
29     #include "EEPARAMS.h"
30     #include "SURFACE.h"
31    
32     integer myTime, myIter, myThid
33    
34     c pe on dynamics and physics grid refers to bottom edge
35     _RL pephy(1-OLx:sNx+Olx,1-Oly:sNy+Oly,Nrphys+1,nSx,nSy)
36     _RL pedyn(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr+1,nSx,nSy)
37     _RL windphy(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nrphys,nSx,nSy)
38     _RL udyntemp(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy)
39     _RL vdyntemp(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy)
40     _RL thdyntemp(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy)
41     _RL sdyntemp(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nrphys,nSx,nSy)
42     _RL uphytemp(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nrphys,nSx,nSy)
43     _RL vphytemp(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nrphys,nSx,nSy)
44     _RL thphytemp(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nrphys,nSx,nSy)
45     _RL sphytemp(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nrphys,nSx,nSy)
46 molod 1.7 _RL tempphy(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nrphys,nSx,nSy)
47 molod 1.1
48     integer i, j, L, Lbotij, bi, bj
49     integer im1, im2, jm1, jm2, idim1, idim2, jdim1, jdim2
50 molod 1.2 _RL dt
51 molod 1.1
52     im1 = 1-OLx
53     im2 = sNx+OLx
54     jm1 = 1-OLy
55     jm2 = sNy+OLy
56     idim1 = 1
57     idim2 = sNx
58     jdim1 = 1
59     jdim2 = sNy
60 molod 1.2 dt = 1.
61 molod 1.1
62     do bj = myByLo(myThid), myByHi(myThid)
63     do bi = myBxLo(myThid), myBxHi(myThid)
64    
65     C Construct Pressures on physics and dynamics grids
66     do j = 1,sNy
67     do i = 1,sNx
68     do L = 1,Nr
69     pedyn(i,j,L,bi,bj) = 0.
70     enddo
71     enddo
72     enddo
73     do j = 1,sNy
74     do i = 1,sNx
75     Lbotij = ksurfC(i,j,bi,bj)
76     if(Lbotij.ne.0.)
77     . pedyn(i,j,Lbotij,bi,bj) = Ro_surf(i,j,bi,bj) + etaH(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    
93     do j = 1,sNy
94     do i = 1,sNx
95     pephy(i,j,1,bi,bj)=Ro_surf(i,j,bi,bj) + etaH(i,j,bi,bj)
96     do L = 2,Nrphys+1
97     pephy(i,j,L,bi,bj)=pephy(i,j,L-1,bi,bj)-dpphys(i,j,L-1,bi,bj)
98     enddo
99     c Do not use a zero field as the top edge pressure for interpolation
100     if(pephy(i,j,Nrphys+1,bi,bj).lt.1.e-5)
101     . pephy(i,j,Nrphys+1,bi,bj) = 1.e-5
102     enddo
103     enddo
104     c
105     c Create a wind magnitude field on the physics grid -
106     do L = 1,Nrphys
107     do j = 1,sNy
108     do i = 1,sNx
109     windphy(i,j,L,bi,bj) = sqrt(uphy(i,j,L,bi,bj)*uphy(i,j,L,bi,bj)
110     . + vphy(i,j,L,bi,bj)*vphy(i,j,L,bi,bj))
111     enddo
112     enddo
113     enddo
114 molod 1.3 enddo
115     enddo
116    
117     CALL TIMER_START('PHYS2DYN [STEP_FIZHI_CORR]',mythid)
118     do bj = myByLo(myThid), myByHi(myThid)
119     do bi = myBxLo(myThid), myBxHi(myThid)
120 molod 1.1
121     c Compute correction term (new dyn state-phys state to dyn) on physics grid:
122     c First: interp physics state to dynamics grid
123 molod 1.7 C Note: physics field levels are numbered top down - need bottom up
124     do L = 1,Nrphys
125     do j = 1,sNy
126     do i = 1,sNx
127     tempphy(i,j,Nrphys+1-L,bi,bj) = uphy(i,j,L,bi,bj)
128     enddo
129     enddo
130     enddo
131     call phys2dyn(tempphy,pephy,im1,im2,jm1,jm2,Nrphys,Nsx,Nsy,
132 molod 1.1 . 1,sNx,1,sNy,bi,bj,pedyn,ksurfC,Nr,nlperdyn,udyntemp)
133 molod 1.7 do L = 1,Nrphys
134     do j = 1,sNy
135     do i = 1,sNx
136     tempphy(i,j,Nrphys+1-L,bi,bj) = vphy(i,j,L,bi,bj)
137     enddo
138     enddo
139     enddo
140     call phys2dyn(tempphy,pephy,im1,im2,jm1,jm2,Nrphys,Nsx,Nsy,
141 molod 1.1 . 1,sNx,1,sNy,bi,bj,pedyn,ksurfC,Nr,nlperdyn,vdyntemp)
142 molod 1.7 do L = 1,Nrphys
143     do j = 1,sNy
144     do i = 1,sNx
145     tempphy(i,j,Nrphys+1-L,bi,bj) = thphy(i,j,L,bi,bj)
146     enddo
147     enddo
148     enddo
149     call phys2dyn(tempphy,pephy,im1,im2,jm1,jm2,Nrphys,Nsx,Nsy,
150 molod 1.1 . 1,sNx,1,sNy,bi,bj,pedyn,ksurfC,Nr,nlperdyn,thdyntemp)
151 molod 1.7 do L = 1,Nrphys
152     do j = 1,sNy
153     do i = 1,sNx
154     tempphy(i,j,Nrphys+1-L,bi,bj) = sphy(i,j,L,bi,bj)
155     enddo
156     enddo
157     enddo
158     call phys2dyn(tempphy,pephy,im1,im2,jm1,jm2,Nrphys,Nsx,Nsy,
159 molod 1.1 . 1,sNx,1,sNy,bi,bj,pedyn,ksurfC,Nr,nlperdyn,sdyntemp)
160    
161     enddo
162     enddo
163 molod 1.3 CALL TIMER_STOP('PHYS2DYN [STEP_FIZHI_CORR]',mythid)
164 molod 1.1
165     c Second: Convert physics state on dynamics grid to C-Grid
166    
167 molod 1.3 CALL TIMER_START('ATOC [STEP_FIZHI_CORR]',mythid)
168 molod 1.1 call AtoC(myThid,udyntemp,vdyntemp,maskC,im1,im2,jm1,jm2,Nr,
169     . Nsx,Nsy,1,sNx,1,sNy,udyntemp,vdyntemp)
170 molod 1.3 CALL TIMER_STOP('ATOC [STEP_FIZHI_CORR]',mythid)
171 molod 1.1
172     c Third: Subtract Phys state on dyn. grid from new dynamics state
173     do bj = myByLo(myThid), myByHi(myThid)
174     do bi = myBxLo(myThid), myBxHi(myThid)
175    
176     do L = 1,Nr
177     do j = jdim1,jdim2
178     do i = idim1,idim2
179     udyntemp(i,j,L,bi,bj)=uvel(i,j,L,bi,bj)-udyntemp(i,j,L,bi,bj)
180     vdyntemp(i,j,L,bi,bj)=vvel(i,j,L,bi,bj)-vdyntemp(i,j,L,bi,bj)
181     thdyntemp(i,j,L,bi,bj)=theta(i,j,L,bi,bj)-thdyntemp(i,j,L,bi,bj)
182     sdyntemp(i,j,L,bi,bj)=salt(i,j,L,bi,bj)-sdyntemp(i,j,L,bi,bj)
183     enddo
184     enddo
185     enddo
186    
187     enddo
188     enddo
189    
190     c Fourth: Convert correction terms to A-Grid
191 molod 1.3 CALL TIMER_START('CTOA [STEP_FIZHI_CORR]',mythid)
192 molod 1.1 call CtoA(myThid,udyntemp,vdyntemp,maskW,maskS,im1,im2,jm1,jm2,
193     . Nr,Nsx,Nsy,1,sNx,1,sNy,udyntemp,vdyntemp)
194 molod 1.3 CALL TIMER_STOP('CTOA [STEP_FIZHI_CORR]',mythid)
195 molod 1.1
196     c Fifth: Interpolate correction terms to physics grid
197 molod 1.3 CALL TIMER_START('DYN2PHYS [STEP_FIZHI_CORR]',mythid)
198 molod 1.1 do bj = myByLo(myThid), myByHi(myThid)
199     do bi = myBxLo(myThid), myBxHi(myThid)
200    
201     call dyn2phys(udyntemp,pedyn,im1,im2,jm1,jm2,Nr,Nsx,Nsy,1,sNx,
202 molod 1.7 . 1,sNy,bi,bj,windphy,pephy,ksurfC,Nrphys,nlperdyn,1,tempphy)
203     C Note: correction term is now bottom up - needed in top down arrays
204     do L = 1,Nrphys
205     do j = 1,sNy
206     do i = 1,sNx
207     uphytemp(i,j,Nrphys+1-L,bi,bj) = tempphy(i,j,L,bi,bj)
208     enddo
209     enddo
210     enddo
211 molod 1.1 call dyn2phys(vdyntemp,pedyn,im1,im2,jm1,jm2,Nr,Nsx,Nsy,1,sNx,
212 molod 1.7 . 1,sNy,bi,bj,windphy,pephy,ksurfC,Nrphys,nlperdyn,1,tempphy)
213     do L = 1,Nrphys
214     do j = 1,sNy
215     do i = 1,sNx
216     vphytemp(i,j,Nrphys+1-L,bi,bj) = tempphy(i,j,L,bi,bj)
217     enddo
218     enddo
219     enddo
220 molod 1.1 call dyn2phys(thdyntemp,pedyn,im1,im2,jm1,jm2,Nr,Nsx,Nsy,1,sNx,
221 molod 1.7 . 1,sNy,bi,bj,windphy,pephy,ksurfC,Nrphys,nlperdyn,0,tempphy)
222     do L = 1,Nrphys
223     do j = 1,sNy
224     do i = 1,sNx
225     thphytemp(i,j,Nrphys+1-L,bi,bj) = tempphy(i,j,L,bi,bj)
226     enddo
227     enddo
228     enddo
229 molod 1.1 call dyn2phys(sdyntemp,pedyn,im1,im2,jm1,jm2,Nr,Nsx,Nsy,1,sNx,
230 molod 1.7 . 1,sNy,bi,bj,windphy,pephy,ksurfC,Nrphys,nlperdyn,0,tempphy)
231     do L = 1,Nrphys
232     do j = 1,sNy
233     do i = 1,sNx
234     sphytemp(i,j,Nrphys+1-L,bi,bj) = tempphy(i,j,L,bi,bj)
235     enddo
236     enddo
237     enddo
238 molod 1.3 enddo
239     enddo
240     CALL TIMER_STOP('DYN2PHYS [STEP_FIZHI_CORR]',mythid)
241 molod 1.2
242 molod 1.1 c Last: Increment physics state by the correction term
243 molod 1.3 do bj = myByLo(myThid), myByHi(myThid)
244     do bi = myBxLo(myThid), myBxHi(myThid)
245 molod 1.2 call step_physics(uphy,vphy,thphy,sphy,dt,im1,im2,jm1,jm2,
246     . Nrphys,Nsx,Nsy,1,sNx,1,sNy,bi,bj,
247     . uphytemp,vphytemp,thphytemp,sphytemp)
248 molod 1.1
249     enddo
250     enddo
251    
252     return
253     end

  ViewVC Help
Powered by ViewVC 1.1.22