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

Diff of /MITgcm/model/src/ini_pressure.F

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

revision 1.9 by jmc, Fri Aug 4 00:45:47 2006 UTC revision 1.10 by jmc, Wed Jan 31 22:26:56 2007 UTC
# Line 10  C     !INTERFACE: Line 10  C     !INTERFACE:
10  C     !DESCRIPTION: \bv  C     !DESCRIPTION: \bv
11  C     *==========================================================*  C     *==========================================================*
12  C     | SUBROUTINE INI_PRESSURE  C     | SUBROUTINE INI_PRESSURE
13  C     | o initialise the pressure field consistently with  C     | o initialise the pressure field consistently with
14  C     |   temperature and salinity  C     |   temperature and salinity
15  C     |   - needs to be called after ini_theta, ini_salt, and  C     |   - needs to be called after ini_theta, ini_salt, and
16  C     |     ini_psurf  C     |     ini_psurf
17  C     |   - does not include surface pressure loading, because  C     |   - does not include surface pressure loading, because
18  C     |     that is only available until after  C     |     that is only available until after
19  C     |     CALL packages_init_variables  C     |     CALL packages_init_variables
20  C     *==========================================================*  C     *==========================================================*
21  C     \ev  C     \ev
# Line 38  C     myThid -  Number of this instance Line 38  C     myThid -  Number of this instance
38  C     !LOCAL VARIABLES:  C     !LOCAL VARIABLES:
39  C     == Local variables ==  C     == Local variables ==
40  C     dPhiHydX,Y :: Gradient (X & Y directions) of Hyd. Potential  C     dPhiHydX,Y :: Gradient (X & Y directions) of Hyd. Potential
41  C     bi,bj  - Loop counters  C     bi,bj      :: tile indices
42  C     I,J,K  C     i,j,k      :: Loop counters
43        INTEGER bi, bj        INTEGER bi, bj
44        INTEGER  I,  J, K        INTEGER  i,  j, k
45        INTEGER  iMin, iMax, jMin, jMax, npiter        INTEGER  iMin, iMax, jMin, jMax, npiter
46        _RL PhiHydF (1-Olx:sNx+Olx,1-Oly:sNy+Oly)        _RL PhiHydF (1-Olx:sNx+Olx,1-Oly:sNy+Oly)
47        _RL PhiHydC (1-Olx:sNx+Olx,1-Oly:sNy+Oly)        _RL PhiHydC (1-Olx:sNx+Olx,1-Oly:sNy+Oly)
# Line 49  C     I,J,K Line 49  C     I,J,K
49        _RL dPhiHydY(1-Olx:sNx+Olx,1-Oly:sNy+Oly)        _RL dPhiHydY(1-Olx:sNx+Olx,1-Oly:sNy+Oly)
50        _RL oldPhi  (1-Olx:sNx+Olx,1-Oly:sNy+Oly)        _RL oldPhi  (1-Olx:sNx+Olx,1-Oly:sNy+Oly)
51        _RL count, rmspp, rmsppold        _RL count, rmspp, rmsppold
52          _RL sumTile, rmsTile
53    
54        CHARACTER*(MAX_LEN_MBUF) msgBuf        CHARACTER*(MAX_LEN_MBUF) msgBuf
55  CEOP  CEOP
# Line 91  C     iterate pressure p = integral of ( Line 92  C     iterate pressure p = integral of (
92         DO npiter= 1, 15         DO npiter= 1, 15
93          rmsppold = rmspp          rmsppold = rmspp
94          rmspp    = 0. _d 0          rmspp    = 0. _d 0
95          count    = 0.          count    = 0. _d 0
96          DO bj = myByLo(myThid), myByHi(myThid)          DO bj = myByLo(myThid), myByHi(myThid)
97           DO bi = myBxLo(myThid), myBxHi(myThid)           DO bi = myBxLo(myThid), myBxHi(myThid)
98             DO j=1-OLy,sNy+OLy            rmsTile = 0. _d 0
99              DO i=1-OLx,sNx+OLx            sumTile = 0. _d 0
100              DO j=1-OLy,sNy+OLy
101               DO i=1-OLx,sNx+OLx
102               phiHydF(i,j) = 0. _d 0               phiHydF(i,j) = 0. _d 0
             ENDDO  
103             ENDDO             ENDDO
104              ENDDO
105            DO k = 1, Nr            DO k = 1, Nr
106  C     for each level save old pressure and compute new pressure  C     for each level save old pressure and compute new pressure
107             DO j=jMin,jMax             DO j=jMin,jMax
108              DO i=iMin,iMax              DO i=iMin,iMax
109               oldPhi(i,j) = totPhiHyd(i,j,k,bi,bj)               oldPhi(i,j) = totPhiHyd(i,j,k,bi,bj)
# Line 113  C     for each level save old pressure a Line 116  C     for each level save old pressure a
116       O          phiHydC, dPhiHydX, dPhiHydY,       O          phiHydC, dPhiHydX, dPhiHydY,
117       I          startTime, nIter0, myThid)       I          startTime, nIter0, myThid)
118  C     compute convergence criterion  C     compute convergence criterion
119             DO j=jMin,jMax             DO j=1,sNy
120              DO i=iMin,iMax              DO i=1,sNx
121               rmspp = rmspp               rmsTile = rmsTile
122       &            + (totPhiHyd(i,j,k,bi,bj)-oldPhi(i,j))**2       &            + (totPhiHyd(i,j,k,bi,bj)-oldPhi(i,j))**2
123               count = count + maskC(i,j,k,bi,bj)       &             * maskC(i,j,k,bi,bj)
124                 sumTile = sumTile + maskC(i,j,k,bi,bj)
125              ENDDO              ENDDO
126             ENDDO             ENDDO
127  C --      end k loop  C --      end k loop
128            ENDDO            ENDDO
129              rmspp = rmspp + rmsTile
130              count = count + sumTile
131           ENDDO           ENDDO
132          ENDDO          ENDDO
133  Cml        WRITE(msgBuf,'(I10.10)') npiter  Cml        WRITE(msgBuf,'(I10.10)') npiter
# Line 132  Cml        CALL WRITE_FLD_XYZ_RL( 'PINI. Line 138  Cml        CALL WRITE_FLD_XYZ_RL( 'PINI.
138          IF ( count .EQ. 0. ) THEN          IF ( count .EQ. 0. ) THEN
139             rmspp = 0. _d 0             rmspp = 0. _d 0
140          ELSE          ELSE
141             rmspp = sqrt(rmspp/count)             rmspp = SQRT(rmspp/count)
142          ENDIF          ENDIF
143          _BEGIN_MASTER( myThid )          _BEGIN_MASTER( myThid )
144          WRITE(msgBuf,'(a,i2,a,e20.13)')          WRITE(msgBuf,'(A,I4,A,1PE20.12)')
145       &       'Iteration ', npiter, ', RMS-difference = ', rmspp       &       'Iteration', npiter, ', RMS-difference =', rmspp
146          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
147       &       SQUEEZE_RIGHT , myThid)       &       SQUEEZE_RIGHT , myThid)
148          _END_MASTER( myThid )          _END_MASTER( myThid )
# Line 145  C --   end npiter loop Line 151  C --   end npiter loop
151         ENDDO         ENDDO
152  C     print some diagnostics      C     print some diagnostics    
153         _BEGIN_MASTER( myThid )         _BEGIN_MASTER( myThid )
154         IF ( rmspp .ne. 0. ) THEN         IF ( rmspp .NE. 0. ) THEN
155          IF ( rmspp .EQ. rmsppold ) THEN          IF ( rmspp .EQ. rmsppold ) THEN
156           WRITE(msgBuf,'(A)')           WRITE(msgBuf,'(A)')
157       &      'Initial hydrostatic pressure did not converge perfectly,'       &      'Initial hydrostatic pressure did not converge perfectly,'

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

  ViewVC Help
Powered by ViewVC 1.1.22