/[MITgcm]/MITgcm/pkg/obcs/obcs_check_depths.F
ViewVC logotype

Contents of /MITgcm/pkg/obcs/obcs_check_depths.F

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


Revision 1.5 - (show annotations) (download)
Tue Sep 18 19:45:21 2012 UTC (11 years, 7 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint64y, checkpoint64x, checkpoint64z, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint64i, checkpoint64h, checkpoint64k, checkpoint64j, checkpoint64m, checkpoint64l, checkpoint64o, checkpoint64n, checkpoint64a, checkpoint64c, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64g, checkpoint64f, checkpoint64, checkpoint65, checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65o, checkpoint65l, checkpoint65m, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e, HEAD
Changes since 1.4: +34 -32 lines
- remove k loop (checking 1 time is enough)
- use new parameter OB_indexNone for null index value (instead of hard-coded 0)

1 C $Header: /u/gcmpack/MITgcm/pkg/obcs/obcs_check_depths.F,v 1.4 2012/04/03 00:13:02 jmc Exp $
2 C $Name: $
3
4 #include "OBCS_OPTIONS.h"
5
6 SUBROUTINE OBCS_CHECK_DEPTHS( myThid )
7 C *==========================================================*
8 C | SUBROUTINE OBCS_CHECK_DEPTHS
9 C | o Check for non-zero normal gradient across open
10 C | boundaries
11 C | o fix them if required and print a message
12 C *==========================================================*
13 C *==========================================================*
14 IMPLICIT NONE
15
16 C === Global variables ===
17 #include "SIZE.h"
18 #include "EEPARAMS.h"
19 #include "PARAMS.h"
20 #include "GRID.h"
21 #include "OBCS_PARAMS.h"
22 #include "OBCS_GRID.h"
23
24 C === Routine arguments ===
25 C myThid :: my Thread Id number
26 INTEGER myThid
27
28 #ifdef ALLOW_OBCS
29 C === Local variables ===
30 C msgBuf :: Informational/error message buffer
31 CHARACTER*(MAX_LEN_MBUF) msgBuf
32 INTEGER bi, bj, i, j, ichanged
33
34 IF ( OBCSfixTopo ) THEN
35 C-- Modify topography to ensure that outward d(topography)/dn >= 0,
36 C topography at open boundary points must be equal or shallower than
37 C topography one grid-point inward from open boundary
38 ichanged = 0
39 DO bj = myByLo(myThid), myByHi(myThid)
40 DO bi = myBxLo(myThid), myBxHi(myThid)
41
42 #ifdef ALLOW_OBCS_NORTH
43 DO i=1,sNx
44 j = OB_Jn(i,bi,bj)
45 IF ( j.NE.OB_indexNone ) THEN
46 IF ( R_low(i,j,bi,bj) .LT. R_low(i,j-1,bi,bj) ) THEN
47 ichanged = ichanged + 1
48 R_low(i,j,bi,bj) = R_low(i,j-1,bi,bj)
49 WRITE(msgBuf,'(2A,2I6,2I4)')
50 & 'OBCS_CHECK_DEPTHS: fixed topography at ',
51 & '(i,j,bi,bj)=', i, j, bi, bj
52 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
53 & SQUEEZE_RIGHT, myThid)
54 ENDIF
55 ENDIF
56 ENDDO
57 #endif
58 #ifdef ALLOW_OBCS_SOUTH
59 DO i=1,sNx
60 j = OB_Js(i,bi,bj)
61 IF ( j.NE.OB_indexNone ) THEN
62 IF ( R_low(i,j,bi,bj) .LT. R_low(i,j+1,bi,bj) ) THEN
63 ichanged = ichanged + 1
64 R_low(i,j,bi,bj) = R_low(i,j+1,bi,bj)
65 WRITE(msgBuf,'(2A,2I6,2I4)')
66 & 'OBCS_CHECK_DEPTHS: fixed topography at ',
67 & '(i,j,bi,bj)=', i, j, bi, bj
68 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
69 & SQUEEZE_RIGHT, myThid)
70 ENDIF
71 ENDIF
72 ENDDO
73 #endif
74 #ifdef ALLOW_OBCS_EAST
75 DO j=1,sNy
76 i = OB_Ie(j,bi,bj)
77 IF ( i.NE.OB_indexNone ) THEN
78 IF ( R_low(i,j,bi,bj) .LT. R_low(i-1,j,bi,bj) ) THEN
79 ichanged = ichanged + 1
80 R_low(i,j,bi,bj) = R_low(i-1,j,bi,bj)
81 WRITE(msgBuf,'(2A,2I6,2I4)')
82 & 'OBCS_CHECK_DEPTHS: fixed topography at ',
83 & '(i,j,bi,bj)=', i, j, bi, bj
84 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
85 & SQUEEZE_RIGHT, myThid)
86 ENDIF
87 ENDIF
88 ENDDO
89 #endif
90 C Western boundary
91 #ifdef ALLOW_OBCS_WEST
92 DO j=1,sNy
93 i = OB_Iw(j,bi,bj)
94 IF ( i.NE.OB_indexNone ) THEN
95 IF ( R_low(i,j,bi,bj) .LT. R_low(i+1,j,bi,bj) ) THEN
96 ichanged = ichanged + 1
97 R_low(i,j,bi,bj) = R_low(i+1,j,bi,bj)
98 WRITE(msgBuf,'(2A,2I6,2I4)')
99 & 'OBCS_CHECK_DEPTHS: fixed topography at ',
100 & '(i,j,bi,bj)=', i, j, bi, bj
101 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
102 & SQUEEZE_RIGHT, myThid)
103 ENDIF
104 ENDIF
105 ENDDO
106 #endif
107
108 ENDDO
109 ENDDO
110 C-- some diagnostics to stdout
111 CALL GLOBAL_SUM_INT( ichanged, myThid )
112 IF ( ichanged .GT. 0 ) THEN
113 _BEGIN_MASTER(myThid)
114 WRITE(msgBuf,'(2A,I7,A)') 'OBCS_CHECK_DEPTHS: ',
115 & 'Topography gradients normal to open boundaries:'
116 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
117 & SQUEEZE_RIGHT, myThid )
118 WRITE(msgBuf,'(2A,I7,A)') 'OBCS_CHECK_DEPTHS: ',
119 & '==> corrected ', ichanged,' problematic grid-points'
120 c WRITE(msgBuf,'(A,I7,A,A)')
121 c & 'OBCS message: corrected ', ichanged,
122 c & ' instances of problematic topography gradients',
123 c & ' normal to open boundaries'
124 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
125 & SQUEEZE_RIGHT, myThid )
126 _END_MASTER(myThid)
127 ENDIF
128
129 C endif (OBCSfixTopo)
130 ENDIF
131 #endif /* ALLOW_OBCS */
132
133 RETURN
134 END

  ViewVC Help
Powered by ViewVC 1.1.22