/[MITgcm]/MITgcm/model/src/solve_for_pressure.F
ViewVC logotype

Contents of /MITgcm/model/src/solve_for_pressure.F

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


Revision 1.11 - (show annotations) (download)
Mon May 24 15:42:23 1999 UTC (25 years ago) by adcroft
Branch: MAIN
CVS Tags: checkpoint23, checkpoint24
Changes since 1.10: +3 -1 lines
Added CPP macro ALLOW_OBCS to include/exclude open boundary code.

1 C $Header: /u/gcmpack/models/MITgcmUV/model/src/solve_for_pressure.F,v 1.10 1999/05/24 14:15:15 adcroft Exp $
2
3 #include "CPP_OPTIONS.h"
4
5 CStartOfInterface
6 SUBROUTINE SOLVE_FOR_PRESSURE( myThid )
7 C /==========================================================\
8 C | SUBROUTINE SOLVE_FOR_PRESSURE |
9 C | o Controls inversion of two and/or three-dimensional |
10 C | elliptic problems for the pressure field. |
11 C \==========================================================/
12 IMPLICIT NONE
13
14 C == Global variables
15 #include "SIZE.h"
16 #include "EEPARAMS.h"
17 #include "PARAMS.h"
18 #include "DYNVARS.h"
19 #include "CG2D.h"
20 #ifdef ALLOW_NONHYDROSTATIC
21 #include "CG3D.h"
22 #include "GW.h"
23 #ifdef ALLOW_OBCS
24 #include "OBCS.h"
25 #endif
26 #include "GRID.h"
27 #endif
28
29 C == Routine arguments ==
30 C myThid - Number of this instance of SOLVE_FOR_PRESSURE
31 INTEGER myThid
32 CEndOfInterface
33
34 C Local variables
35 INTEGER i,j,k,bi,bj
36 #ifdef ALLOW_NONHYDROSTATIC
37 _RS uf(1-Olx:sNx+Olx,1-Oly:sNy+Oly)
38 _RS vf(1-Olx:sNx+Olx,1-Oly:sNy+Oly)
39 #endif
40
41 #ifdef INCLUDE_CD_CODE
42 C-- Save previous solution.
43 DO bj=myByLo(myThid),myByHi(myThid)
44 DO bi=myBxLo(myThid),myBxHi(myThid)
45 DO j=1-OLy,sNy+OLy
46 DO i=1-OLx,sNx+OLx
47 cg2d_xNM1(i,j,bi,bj) = cg2d_x(i,j,bi,bj)
48 ENDDO
49 ENDDO
50 ENDDO
51 ENDDO
52 #endif
53
54 C-- Find the surface pressure using a two-dimensional conjugate
55 C-- gradient solver.
56 C see CG2D.h for the interface to this routine.
57 CALL CG2D(
58 I cg2d_b,
59 U cg2d_x,
60 I myThid )
61
62 _EXCH_XY_R8(cg2d_x, myThid )
63
64 #ifdef ALLOW_NONHYDROSTATIC
65 IF ( nonHydrostatic ) THEN
66
67 C-- Solve for a three-dimensional pressure term (NH or IGW or both ).
68 C see CG3D.h for the interface to this routine.
69 DO bj=myByLo(myThid),myByHi(myThid)
70 DO bi=myBxLo(myThid),myBxHi(myThid)
71 DO j=1,sNy+1
72 DO i=1,sNx+1
73 uf(i,j)=-gBaro*_recip_dxC(i,j,bi,bj)*
74 & (cg2d_x(i,j,bi,bj)-cg2d_x(i-1,j,bi,bj))
75 vf(i,j)=-gBaro*_recip_dyC(i,j,bi,bj)*
76 & (cg2d_x(i,j,bi,bj)-cg2d_x(i,j-1,bi,bj))
77 ENDDO
78 ENDDO
79
80 IF (openBoundaries) THEN
81 DO i=1,sNx+1
82 C Northern boundary
83 IF (OB_Jn(I,bi,bj).NE.0) THEN
84 uf(I,OB_Jn(I,bi,bj))=0.
85 vf(I,OB_Jn(I,bi,bj))=0.
86 ENDIF
87 C Southern boundary
88 IF (OB_Js(I,bi,bj).NE.0) THEN
89 uf(I,OB_Js(I,bi,bj))=0.
90 vf(I,OB_Js(I,bi,bj)+1)=0.
91 ENDIF
92 ENDDO
93 DO j=1,sNy+1
94 C Eastern boundary
95 IF (OB_Ie(J,bi,bj).NE.0) THEN
96 uf(OB_Ie(J,bi,bj),J)=0.
97 vf(OB_Ie(J,bi,bj),J)=0.
98 ENDIF
99 C Western boundary
100 IF (OB_Iw(J,bi,bj).NE.0) THEN
101 uf(OB_Iw(J,bi,bj)+1,J)=0.
102 vf(OB_Iw(J,bi,bj),J)=0.
103 ENDIF
104 ENDDO
105 ENDIF
106
107 DO K=1,Nr
108 DO j=1,sNy
109 DO i=1,sNx
110 c cg3d_x(i,j,k,bi,bj) = 0.
111 cg3d_b(i,j,k,bi,bj) = cg3d_b(i,j,k,bi,bj)
112 & +dRF(K)*dYG(i+1,j,bi,bj)*hFacW(i+1,j,k,bi,bj)*uf(i+1,j)
113 & -dRF(K)*dYG( i ,j,bi,bj)*hFacW( i ,j,k,bi,bj)*uf( i ,j)
114 & +dRF(K)*dXG(i,j+1,bi,bj)*hFacS(i,j+1,k,bi,bj)*vf(i,j+1)
115 & -dRF(K)*dXG(i, j ,bi,bj)*hFacS(i, j ,k,bi,bj)*vf(i, j )
116 ENDDO
117 ENDDO
118 ENDDO
119
120 ENDDO ! bi
121 ENDDO ! bj
122
123 CALL CG3D( myThid )
124
125 _EXCH_XYZ_R8(cg3d_x, myThid )
126
127 ENDIF
128 #endif
129
130 RETURN
131 END

  ViewVC Help
Powered by ViewVC 1.1.22