151 |
CADJ GENERAL |
CADJ GENERAL |
152 |
#endif /* ALLOW_AUTODIFF_TAMC */ |
#endif /* ALLOW_AUTODIFF_TAMC */ |
153 |
|
|
154 |
C---------- This discretization is the "finite volume" form |
CmlC---------- This discretization is the "finite volume" form |
155 |
C which has not been used to date since it does not |
CmlC which has not been used to date since it does not |
156 |
C conserve KE+PE exactly even though it is more natural |
CmlC conserve KE+PE exactly even though it is more natural |
157 |
C |
CmlC |
158 |
c IF (k.LT.Nr) phiHyd(i,j,k+1)=phiHyd(i,j,k)+ |
Cml IF ( K .EQ. kLowC(i,j,bi,bj) ) THEN |
159 |
c & drF(K)*gravity*alphaRho(i,j)*recip_rhoConst |
Cml phiHydLow(i,j,bi,bj) = phiHyd(i,j,k) |
160 |
c phiHyd(i,j,k)=phiHyd(i,j,k)+ |
Cml & + hFacC(i,j,k,bi,bj) |
161 |
c & 0.5*drF(K)*gravity*alphaRho(i,j)*recip_rhoConst |
Cml & *drF(K)*gravity*alphaRho(i,j)*recip_rhoConst |
162 |
C----------------------------------------------------------------------- |
Cml & + gravity*etaN(i,j,bi,bj) |
163 |
|
Cml ENDIF |
164 |
|
Cml IF (k.LT.Nr) phiHyd(i,j,k+1)=phiHyd(i,j,k)+ |
165 |
|
Cml & drF(K)*gravity*alphaRho(i,j)*recip_rhoConst |
166 |
|
Cml phiHyd(i,j,k)=phiHyd(i,j,k)+ |
167 |
|
Cml & 0.5*drF(K)*gravity*alphaRho(i,j)*recip_rhoConst |
168 |
|
CmlC----------------------------------------------------------------------- |
169 |
|
|
170 |
C---------- This discretization is the "energy conserving" form |
C---------- This discretization is the "energy conserving" form |
171 |
C which has been used since at least Adcroft et al., MWR 1997 |
C which has been used since at least Adcroft et al., MWR 1997 |
183 |
C substracted from hFacC |
C substracted from hFacC |
184 |
IF ( K .EQ. kLowC(i,j,bi,bj) ) THEN |
IF ( K .EQ. kLowC(i,j,bi,bj) ) THEN |
185 |
phiHydLow(i,j,bi,bj) = phiHyd(i,j,k) |
phiHydLow(i,j,bi,bj) = phiHyd(i,j,k) |
186 |
& + (hFacC(i,j,k,bi,bj)-0.5)*drF(K) |
& + (hFacC(i,j,k,bi,bj)-.5)*drF(K) |
187 |
& *gravity*alphaRho(i,j)*recip_rhoConst |
& *gravity*alphaRho(i,j)*recip_rhoConst |
188 |
& + gravity*etaN(i,j,bi,bj) |
& + gravity*etaN(i,j,bi,bj) |
189 |
ENDIF |
ENDIF |
196 |
C This is the hydrostatic pressure calculation for the Ocean |
C This is the hydrostatic pressure calculation for the Ocean |
197 |
C which uses the FIND_RHO() routine to calculate density |
C which uses the FIND_RHO() routine to calculate density |
198 |
C before integrating g*rho over the current layer/interface |
C before integrating g*rho over the current layer/interface |
199 |
|
#ifdef ALLOW_AUTODIFF_TAMC |
200 |
|
CADJ GENERAL |
201 |
|
#endif /* ALLOW_AUTODIFF_TAMC */ |
202 |
|
|
203 |
dRloc=drC(k) |
dRloc=drC(k) |
204 |
IF (k.EQ.1) dRloc=drF(1) |
IF (k.EQ.1) dRloc=drF(1) |
213 |
DO i=iMin,iMax |
DO i=iMin,iMax |
214 |
phiHyd(i,j,k)=0. |
phiHyd(i,j,k)=0. |
215 |
phiHyd(i,j,k)=pload(i,j,bi,bj) |
phiHyd(i,j,k)=pload(i,j,bi,bj) |
|
c & -Ro_surf(i,j,bi,bj)*recip_rhoNil |
|
|
c & -(Ro_surf(i,j,bi,bj)-.5*drF( kSurfC(i,j,bi,bj) ))/1000. |
|
|
c & -(Ro_surf(i,j,bi,bj)-.5*drF( kSurfC(i,j,bi,bj) ))*recip_rhoNil |
|
216 |
ENDDO |
ENDDO |
217 |
ENDDO |
ENDDO |
218 |
ENDIF |
ENDIF |
230 |
C Hydrostatic pressure at cell centers |
C Hydrostatic pressure at cell centers |
231 |
DO j=jMin,jMax |
DO j=jMin,jMax |
232 |
DO i=iMin,iMax |
DO i=iMin,iMax |
233 |
locAlpha=alphaRho(i,j)+rhoNil |
locAlpha=alphaRho(i,j)+rhoConst |
234 |
IF (locAlpha.NE.0.) locAlpha=maskC(i,j,k,bi,bj)/locAlpha |
IF (locAlpha.NE.0.) locAlpha=maskC(i,j,k,bi,bj)/locAlpha |
235 |
|
|
236 |
C---------- This discretization is the "finite volume" form |
CmlC---------- This discretization is the "finite volume" form |
237 |
C which has not been used to date since it does not |
CmlC which has not been used to date since it does not |
238 |
C conserve KE+PE exactly even though it is more natural |
CmlC conserve KE+PE exactly even though it is more natural |
239 |
C |
CmlC |
240 |
c IF (k.LT.Nr) phiHyd(i,j,k+1)=phiHyd(i,j,k)+ |
Cml IF ( K .EQ. kLowC(i,j,bi,bj) ) THEN |
241 |
c & drF(K)*locAlpha |
Cml phiHydLow(i,j,bi,bj) = phiHyd(i,j,k) |
242 |
c phiHyd(i,j,k)=phiHyd(i,j,k)+ |
Cml & + hFacC(i,j,k,bi,bj)*drF(K)*locAlpha |
243 |
c & 0.5*drF(K)*locAlpha |
Cml & + Bo_surf(i,j,bi,bj)*etaN(i,j,bi,bj) |
244 |
C----------------------------------------------------------------------- |
Cml ENDIF |
245 |
|
Cml IF (k.LT.Nr) phiHyd(i,j,k+1)=phiHyd(i,j,k)+ |
246 |
|
Cml & drF(K)*locAlpha |
247 |
|
Cml phiHyd(i,j,k)=phiHyd(i,j,k)+ |
248 |
|
Cml & 0.5*drF(K)*locAlpha |
249 |
|
CmlC----------------------------------------------------------------------- |
250 |
|
|
251 |
C---------- This discretization is the "energy conserving" form |
C---------- This discretization is the "energy conserving" form |
252 |
C which has been used since at least Adcroft et al., MWR 1997 |
C which has been used since at least Adcroft et al., MWR 1997 |
253 |
C |
C |
254 |
|
|
255 |
phiHyd(i,j,k)=phiHyd(i,j,k)+ |
phiHyd(i,j,k)=phiHyd(i,j,k)+ |
256 |
& 0.5*dRloc*locAlpha |
& 0.5*dRloc*locAlpha |
257 |
IF (k.LT.Nr) phiHyd(i,j,k+1)=phiHyd(i,j,k)+ |
IF (k.LT.Nr) phiHyd(i,j,k+1)=phiHyd(i,j,k)+ |
258 |
& 0.5*dRlocKp1*locAlpha |
& 0.5*dRlocKp1*locAlpha |
259 |
|
|
260 |
C----------------------------------------------------------------------- |
C----------------------------------------------------------------------- |
261 |
|
|
262 |
C---------- Compute gravity*(sea surface elevation) |
C---------- Compute gravity*(sea surface elevation) first |
263 |
C This has to be done starting from phiHyd at the current |
C This has to be done starting from phiHyd at the current |
264 |
C tracer point and .5 of the cell's thickness has to be |
C tracer point and .5 of the cell's thickness has to be |
265 |
C substracted from hFacC |
C substracted from hFacC |