File indexing completed on 2018-03-02 18:45:19 UTC
view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
717a660aff Jean*0001 #include "PACKAGES_CONFIG.h"
42c525bfb4 Alis*0002 #include "CPP_OPTIONS.h"
0003
26b1c6e660 Jean*0004
0005
0006
42c525bfb4 Alis*0007 SUBROUTINE INI_DEPTHS( myThid )
486e38797b Jean*0008
26b1c6e660 Jean*0009
0010
8d70182ac2 Jean*0011
0012
26b1c6e660 Jean*0013
8d70182ac2 Jean*0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
26b1c6e660 Jean*0027
0028
0029
0030
42c525bfb4 Alis*0031 IMPLICIT NONE
0032
0033 #include "SIZE.h"
0034 #include "EEPARAMS.h"
0035 #include "PARAMS.h"
0036 #include "GRID.h"
62a035ab16 Jean*0037 #include "SURFACE.h"
12ffad7671 Jean*0038 #ifdef ALLOW_MNC
0039 # include "MNC_PARAMS.h"
0040 #endif
42c525bfb4 Alis*0041
26b1c6e660 Jean*0042
42c525bfb4 Alis*0043
486e38797b Jean*0044
42c525bfb4 Alis*0045 INTEGER myThid
0046
26b1c6e660 Jean*0047
42c525bfb4 Alis*0048
486e38797b Jean*0049
0050
0051
0052
0053
42c525bfb4 Alis*0054 INTEGER iG, jG
0055 INTEGER bi, bj
486e38797b Jean*0056 INTEGER i, j
61c0ef52f3 Jean*0057 CHARACTER*(MAX_LEN_MBUF) msgBuf
26b1c6e660 Jean*0058
61c0ef52f3 Jean*0059
8d70182ac2 Jean*0060 IF (usingPCoords .AND. bathyFile .NE. ' '
0061 & .AND. topoFile .NE. ' ' ) THEN
61c0ef52f3 Jean*0062 WRITE(msgBuf,'(A,A)')
0063 & 'S/R INI_DEPTHS: both bathyFile & topoFile are specified:',
0064 & ' select the right one !'
0065 CALL PRINT_ERROR( msgBuf , myThid)
0066 STOP 'ABNORMAL END: S/R INI_DEPTHS'
0067 ENDIF
0068
0069
0070
0071
0072 DO bj = myByLo(myThid), myByHi(myThid)
0073 DO bi = myBxLo(myThid), myBxHi(myThid)
0074 DO j=1-Oly,sNy+Oly
0075 DO i=1-Olx,sNx+Olx
717a660aff Jean*0076 R_low(i,j,bi,bj) = 0. _d 0
0077 Ro_surf(i,j,bi,bj) = 0. _d 0
0078 topoZ(i,j,bi,bj) = 0. _d 0
61c0ef52f3 Jean*0079 ENDDO
0080 ENDDO
0081 ENDDO
0082 ENDDO
0083
717a660aff Jean*0084
486e38797b Jean*0085
0086
717a660aff Jean*0087
61c0ef52f3 Jean*0088
0089
0090
8d70182ac2 Jean*0091 IF (usingPCoords .OR. bathyFile .EQ. ' ') THEN
61c0ef52f3 Jean*0092
0093
42c525bfb4 Alis*0094 DO bj = myByLo(myThid), myByHi(myThid)
0095 DO bi = myBxLo(myThid), myBxHi(myThid)
0096 DO j=1,sNy
0097 DO i=1,sNx
61c0ef52f3 Jean*0098 R_low(i,j,bi,bj) = rF(Nr+1)
42c525bfb4 Alis*0099 ENDDO
0100 ENDDO
0101 ENDDO
0102 ENDDO
0103 ELSE
12ffad7671 Jean*0104
0105 #ifdef ALLOW_MNC
0106 IF (useMNC .AND. mnc_read_bathy) THEN
0107 CALL MNC_CW_ADD_VNAME('bathy', 'Cen_xy_Hn__-__-', 3,4, myThid)
0108 CALL MNC_FILE_CLOSE_ALL_MATCHING(bathyFile, myThid)
0109 CALL MNC_CW_SET_UDIM(bathyFile, 1, myThid)
0110 CALL MNC_CW_SET_CITER(bathyFile, 2, -1, -1, -1, myThid)
0111 CALL MNC_CW_SET_UDIM(bathyFile, 1, myThid)
486e38797b Jean*0112 CALL MNC_CW_RS_R('D',bathyFile,0,0,'bathy',R_low, myThid)
12ffad7671 Jean*0113 CALL MNC_FILE_CLOSE_ALL_MATCHING(bathyFile, myThid)
0114 CALL MNC_CW_DEL_VNAME('bathy', myThid)
0115 ELSE
0116 #endif /* ALLOW_MNC */
717a660aff Jean*0117
42c525bfb4 Alis*0118
12ffad7671 Jean*0119 CALL READ_REC_XY_RS( bathyFile, R_low, 1, 0, myThid )
717a660aff Jean*0120
42c525bfb4 Alis*0121
61c0ef52f3 Jean*0122
42c525bfb4 Alis*0123
61c0ef52f3 Jean*0124
0125
12ffad7671 Jean*0126
0127 #ifdef ALLOW_MNC
0128 ENDIF
0129 #endif /* ALLOW_MNC */
0130
0131
42c525bfb4 Alis*0132 ENDIF
61c0ef52f3 Jean*0133
0134
717a660aff Jean*0135
12ffad7671 Jean*0136 _EXCH_XY_RS(R_low, myThid )
61c0ef52f3 Jean*0137
b090e8cd4a Jean*0138 IF ( debugLevel.GE.debLevC ) THEN
717a660aff Jean*0139
0140 CALL PLOT_FIELD_XYRS( R_low, 'Bottom depths (ini_depths)',
0141 & -1, myThid )
0142 ENDIF
8d70182ac2 Jean*0143
61c0ef52f3 Jean*0144
0145
0146
0147
0148
0149
0150
8d70182ac2 Jean*0151 IF ( usingPCoords .AND. bathyFile.NE.' ' ) THEN
0152
42c525bfb4 Alis*0153
61c0ef52f3 Jean*0154 CALL READ_REC_XY_RS( bathyFile, Ro_surf, 1, 0, myThid )
0155
0156 ELSEIF ( topoFile.EQ.' ' ) THEN
0157
0158
0159 DO bj = myByLo(myThid), myByHi(myThid)
0160 DO bi = myBxLo(myThid), myBxHi(myThid)
0161 DO j=1,sNy
0162 DO i=1,sNx
12ffad7671 Jean*0163 Ro_surf(i,j,bi,bj) = rF(1)
61c0ef52f3 Jean*0164 ENDDO
0165 ENDDO
0166 ENDDO
0167 ENDDO
42c525bfb4 Alis*0168
61c0ef52f3 Jean*0169 ELSE
0170
0171
0172
717a660aff Jean*0173
62a035ab16 Jean*0174 CALL READ_REC_XY_RS( topoFile, topoZ, 1, 0, myThid )
61c0ef52f3 Jean*0175
0176 IF (buoyancyRelation .EQ. 'ATMOSPHERIC') THEN
0177
8d70182ac2 Jean*0178
61c0ef52f3 Jean*0179
0180
8d70182ac2 Jean*0181
61c0ef52f3 Jean*0182
6177f7885b Jean*0183 CALL INI_P_GROUND( 2, topoZ,
c7734eb7a9 Jean*0184 O Ro_surf,
0185 I myThid )
61c0ef52f3 Jean*0186
8d70182ac2 Jean*0187
0188
61c0ef52f3 Jean*0189
12ffad7671 Jean*0190 ELSEIF ( buoyancyRelation.EQ.'OCEANICP' ) THEN
0191
0192 WRITE(msgBuf,'(A,A)') 'S/R INI_DEPTHS: ',
0193 & 'from topoFile (in m) to ref.bottom pressure: Not yet coded'
0194 CALL PRINT_ERROR( msgBuf , myThid)
0195 STOP 'ABNORMAL END: S/R INI_DEPTHS'
0196
61c0ef52f3 Jean*0197 ELSE
0198
8d70182ac2 Jean*0199
6177f7885b Jean*0200
61c0ef52f3 Jean*0201 DO bj = myByLo(myThid), myByHi(myThid)
0202 DO bi = myBxLo(myThid), myBxHi(myThid)
0203 DO j=1,sNy
0204 DO i=1,sNx
62a035ab16 Jean*0205 Ro_surf(i,j,bi,bj) = topoZ(i,j,bi,bj)
61c0ef52f3 Jean*0206 ENDDO
0207 ENDDO
0208 ENDDO
0209 ENDDO
0210
0211 ENDIF
0212
0213
0214 ENDIF
0215
717a660aff Jean*0216
12ffad7671 Jean*0217 _EXCH_XY_RS(Ro_surf, myThid )
61c0ef52f3 Jean*0218
0219
0220
0221
0222
0223
8d70182ac2 Jean*0224 IF (usingPCoords) THEN
42c525bfb4 Alis*0225 DO bj = myByLo(myThid), myByHi(myThid)
0226 DO bi = myBxLo(myThid), myBxHi(myThid)
0227 DO j=1-Oly,sNy+Oly
0228 DO i=1-Olx,sNx+Olx
486e38797b Jean*0229 iG = myXGlobalLo-1+(bi-1)*sNx+i
0230 jG = myYGlobalLo-1+(bj-1)*sNy+j
61c0ef52f3 Jean*0231
0232
0233
0234
486e38797b Jean*0235
0236 IF ( usingSphericalPolarGrid .AND.
0237 & ABS(yC(i,j,bi,bj)).GE.ABS(ygOrigin) )
0238 & Ro_surf(i,j,bi,bj) = rF(Nr+1)
0239 IF ( usingSphericalPolarGrid .AND.
0240 & ABS(yC(i,j,bi,bj)).GE.90. )
0241 & Ro_surf(i,j,bi,bj) = rF(Nr+1)
aea29c8517 Alis*0242 ENDDO
0243 ENDDO
0244 ENDDO
0245 ENDDO
0246 ELSE
0247 DO bj = myByLo(myThid), myByHi(myThid)
0248 DO bi = myBxLo(myThid), myBxHi(myThid)
0249 DO j=1-Oly,sNy+Oly
0250 DO i=1-Olx,sNx+Olx
486e38797b Jean*0251 iG = myXGlobalLo-1+(bi-1)*sNx+i
0252 jG = myYGlobalLo-1+(bj-1)*sNy+j
61c0ef52f3 Jean*0253
0254
0255
0256
486e38797b Jean*0257
0258 IF ( usingSphericalPolarGrid .AND.
0259 & ABS(yC(i,j,bi,bj)).GE.ABS(ygOrigin) )
0260 & R_low(i,j,bi,bj) = rF(1)
0261 IF ( usingSphericalPolarGrid .AND.
0262 & ABS(yC(i,j,bi,bj)).GE.90. )
0263 & R_low(i,j,bi,bj) = rF(1)
42c525bfb4 Alis*0264 ENDDO
0265 ENDDO
0266 ENDDO
0267 ENDDO
0268 ENDIF
aea29c8517 Alis*0269
b090e8cd4a Jean*0270 IF ( debugLevel.GE.debLevC ) THEN
486e38797b Jean*0271 _BARRIER
717a660aff Jean*0272 CALL PLOT_FIELD_XYRS( Ro_surf,
0273 & 'Surface reference r-position (ini_depths)',
0274 & -1, myThid )
0275 ENDIF
8d70182ac2 Jean*0276
717a660aff Jean*0277
0278
486e38797b Jean*0279
0280
0281
61c0ef52f3 Jean*0282
12ffad7671 Jean*0283 #ifdef ALLOW_OBCS
0284 IF ( useOBCS ) THEN
0285
0286 CALL OBCS_CHECK_DEPTHS( myThid )
0287
486e38797b Jean*0288 _EXCH_XY_RS( R_low, myThid )
12ffad7671 Jean*0289 ENDIF
0290 #endif /* ALLOW_OBCS */
0291
0292 #ifdef ALLOW_EXCH2
0293
0294 CALL EXCH2_CHECK_DEPTHS( R_low, Ro_surf, myThid )
0295 #endif
0296
42c525bfb4 Alis*0297 RETURN
0298 END