File indexing completed on 2023-09-21 05:10:51 UTC
view on githubraw file Latest commit 96b00645 on 2023-09-20 15:15:14 UTC
5ca83cd8f7 Dani*0001 #include "STREAMICE_OPTIONS.h"
0002
0003
0004
0005
0006
0007
0008 SUBROUTINE STREAMICE_INIT_FIXED( myThid )
0009
0010
0011
0012
0013
0014 IMPLICIT NONE
0015 #include "EEPARAMS.h"
0016 #include "SIZE.h"
0017 #include "PARAMS.h"
0018 #include "STREAMICE.h"
0019 #include "STREAMICE_CG.h"
0020 #include "STREAMICE_BDRY.h"
0021 #include "GRID.h"
0022 #ifdef ALLOW_STREAMICE_FLUX_CONTROL
0023 #include "STREAMICE_CTRL_FLUX.h"
0024 #endif
0025
0026
0027 INTEGER myThid
0028
0029
6a6b1adb9c Jean*0030 #ifdef ALLOW_STREAMICE
5ca83cd8f7 Dani*0031
0032
0fbff46b46 dngo*0033 INTEGER bi, bj, i, j, Gi, Gj, m
5ca83cd8f7 Dani*0034 _RL x, y
0035 CHARACTER*(MAX_LEN_MBUF) msgBuf
0036
0037 #ifdef STREAMICE_GEOM_FILE_SETUP
0fbff46b46 dngo*0038 INTEGER maskFlag, hmaskFlag
5ca83cd8f7 Dani*0039 _RS temp_ufacemask (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
0040 _RS temp_vfacemask (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
0041 _RS temp_hmask (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
0042 #endif
0043
0fbff46b46 dngo*0044 #ifdef ALLOW_CTRL
0045 _RS dummyRS
0046 INTEGER k
0047 #endif
0048
6a6b1adb9c Jean*0049 #ifdef ALLOW_PETSC
18a089944d Dani*0050 if (streamice_use_petsc) then
6a6b1adb9c Jean*0051 CALL STREAMICE_INITIALIZE_PETSC
18a089944d Dani*0052 endif
6a6b1adb9c Jean*0053 #endif
5ca83cd8f7 Dani*0054
6a6b1adb9c Jean*0055 #ifdef ALLOW_MNC
5ca83cd8f7 Dani*0056 IF ( useMNC .AND. (streamice_tave_mnc.OR.streamice_dump_mnc)
0057 & ) THEN
0058
0059 ENDIF
0060 #endif /* ALLOW_MNC */
0061
0062 #ifdef ALLOW_DIAGNOSTICS
0063 IF ( useDiagnostics ) THEN
0064 CALL STREAMICE_INIT_DIAGNOSTICS( myThid )
0065 ENDIF
0066 #endif
0067
96b006450c dngo*0068
5ca83cd8f7 Dani*0069
0070 IF ( STREAMICE_calve_to_mask ) THEN
0071 IF ( STREAMICEcalveMaskFile .NE. ' ') THEN
0072 _BARRIER
0073
217ff6d33b Jean*0074 CALL READ_FLD_XY_RS( STREAMICEcalveMaskFile, ' ',
5ca83cd8f7 Dani*0075 & STREAMICE_calve_mask, 0, myThid )
0076 ELSE
bdd8102d3e Dani*0077 WRITE(msgBuf,'(A)') 'INIT CALVE MASK - NOT IMPLENTED'
0078 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
0079 & SQUEEZE_RIGHT , 1)
ea0fe49ceb Dani*0080
0081 DO bj = myByLo(myThid), myByHi(myThid)
0082 DO bi = myBxLo(myThid), myBxHi(myThid)
0083 DO j=1,sNy
0084 DO i=1,sNx
0085 streamice_calve_mask(i,j,bi,bj) = 0. _d 0
0086 ENDDO
0087 ENDDO
0088 ENDDO
0089 ENDDO
0090
5ca83cd8f7 Dani*0091 ENDIF
0092 ENDIF
0093
96b006450c dngo*0094
5ca83cd8f7 Dani*0095 IF (STREAMICEsigcoordInit.eq.'FILE') THEN
0096 WRITE(msgBuf,'(A)') 'SIG FROM FILE - NOT IMPLENTED'
0097 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
0098 & SQUEEZE_RIGHT , 1)
0099 ELSEIF (STREAMICEsigcoordInit.eq.'UNIFORM') THEN
0100 do m=1,Nr
0101 streamice_sigma_coord (m) = 1./Nr * (m-0.5)
0102 streamice_delsigma (m) = 1./Nr
0103 enddo
0104 ELSE
0105 WRITE(msgBuf,'(A)') 'SIG COORD INIT - NOT IMPLENTED'
0106 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
0107 & SQUEEZE_RIGHT , 1)
0108 ENDIF
0109
0110 #ifdef ALLOW_COST
bdd8102d3e Dani*0111 IF ( STREAMICEcostMaskFile .NE. ' ') THEN
5ca83cd8f7 Dani*0112 _BARRIER
0113
578fad1ab3 Jean*0114 CALL READ_FLD_XY_RS( STREAMICEcostMaskFile, ' ',
5ca83cd8f7 Dani*0115 & STREAMICE_cost_mask, 0, myThid )
0116 ELSE
0117 WRITE(msgBuf,'(A)') 'COST MASK - NOT IMPLENTED'
0118 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
0119 & SQUEEZE_RIGHT , 1)
0120
bdd8102d3e Dani*0121 DO bj = myByLo(myThid), myByHi(myThid)
0122 DO bi = myBxLo(myThid), myBxHi(myThid)
0123 DO j=1,sNy
0124 DO i=1,sNx
0125 STREAMICE_cost_mask (i,j,bi,bj) = 1.0
0126 ENDDO
5ca83cd8f7 Dani*0127 ENDDO
0128 ENDDO
0129 ENDDO
96b006450c dngo*0130 ENDIF
0131 #endif
0132 #ifdef ALLOW_STREAMICE_TC_COST
0133 IF ( STREAMICEBglenCostMaskFile .NE. ' ') THEN
0134 _BARRIER
0135
0136 CALL READ_FLD_XY_RS( STREAMICEBglenCostMaskFile, ' ',
0137 & B_glen0, 0, myThid )
0138 ELSE
0139 WRITE(msgBuf,'(A)') 'BGLEN COST MASK - NOT IMPLENTED'
0140 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
0141 & SQUEEZE_RIGHT , 1)
5ca83cd8f7 Dani*0142
96b006450c dngo*0143 DO bj = myByLo(myThid), myByHi(myThid)
0144 DO bi = myBxLo(myThid), myBxHi(myThid)
0145 DO j=1,sNy
0146 DO i=1,sNx
0147 b_glen0 (i,j,bi,bj) = 0.0
0148 ENDDO
0149 ENDDO
0150 ENDDO
0151 ENDDO
bdd8102d3e Dani*0152 ENDIF
5ca83cd8f7 Dani*0153 #endif
217ff6d33b Jean*0154
96b006450c dngo*0155
5ca83cd8f7 Dani*0156 #ifdef STREAMICE_GEOM_FILE_SETUP
0157
0158 IF ( STREAMICEuFaceBdryFile .NE. ' ') THEN
0159 _BARRIER
217ff6d33b Jean*0160 CALL READ_FLD_XY_RS ( STREAMICEuFaceBdryFile, ' ',
5ca83cd8f7 Dani*0161 & temp_ufacemask, 0, myThid )
0162 ELSE
0163 WRITE(msgBuf,'(A)') 'U FACE MASK - NOT SET'
0164 CALL PRINT_ERROR( msgBuf, myThid)
0165 ENDIF
0166
0167 IF ( STREAMICEvFaceBdryFile .NE. ' ') THEN
0168 _BARRIER
217ff6d33b Jean*0169 CALL READ_FLD_XY_RS ( STREAMICEvFaceBdryFile, ' ',
5ca83cd8f7 Dani*0170 & temp_vfacemask, 0, myThid )
0171 ELSE
0172 WRITE(msgBuf,'(A)') 'V FACE MASK - NOT SET'
0173 CALL PRINT_ERROR( msgBuf, myThid)
0174 ENDIF
0175
0176 _EXCH_XY_RS(temp_ufacemask,myThid)
bdd8102d3e Dani*0177 _EXCH_XY_RS(temp_vfacemask,myThid)
5ca83cd8f7 Dani*0178
0179 IF ( STREAMICEuDirichValsFile .NE. ' ') THEN
0180 _BARRIER
217ff6d33b Jean*0181 CALL READ_FLD_XY_RL ( STREAMICEuDirichValsFile, ' ',
5ca83cd8f7 Dani*0182 #ifdef ALLOW_STREAMICE_FLUX_CONTROL
0183 & u_bdry_values_SI_base, 0, myThid )
0184 #else
0185 & u_bdry_values_SI, 0, myThid )
0186 #endif
0187 ELSE
0188 WRITE(msgBuf,'(A)') 'U DIRICH VALS - NOT SET'
0189 CALL PRINT_ERROR( msgBuf, myThid)
0190 ENDIF
0191
0192 IF ( STREAMICEvDirichValsFile .NE. ' ') THEN
0193 _BARRIER
217ff6d33b Jean*0194 CALL READ_FLD_XY_RL ( STREAMICEvDirichValsFile, ' ',
5ca83cd8f7 Dani*0195 #ifdef ALLOW_STREAMICE_FLUX_CONTROL
0196 & v_bdry_values_SI_base, 0, myThid )
0197 #else
0198 & v_bdry_values_SI, 0, myThid )
0199 #endif
0200 ELSE
0201 WRITE(msgBuf,'(A)') 'V DIRICH VALS - NOT SET'
0202 CALL PRINT_ERROR( msgBuf, myThid)
0203 ENDIF
0204
0205 IF ( STREAMICEHBCxFile .NE. ' ') THEN
0206 _BARRIER
0207 CALL READ_FLD_XY_RL ( STREAMICEHBCxFile, ' ',
0208 & h_ubdry_values_SI, 0, myThid )
0209 ELSE
0210 WRITE(msgBuf,'(A)') 'THICK BC AT U FACE - NOT SET'
0211 CALL PRINT_ERROR( msgBuf, myThid)
0212 ENDIF
0213
0214 IF ( STREAMICEHBCyFile .NE. ' ') THEN
0215 _BARRIER
0216 CALL READ_FLD_XY_RL ( STREAMICEHBCyFile, ' ',
0217 & h_vbdry_values_SI, 0, myThid )
0218 ELSE
0219 WRITE(msgBuf,'(A)') 'THICK BC AT V FACE - NOT SET'
0220 CALL PRINT_ERROR( msgBuf, myThid)
0221 ENDIF
0222
bdd8102d3e Dani*0223 IF ( streamiceumassfluxfile .NE. ' ') THEN
0224 _BARRIER
0225 CALL READ_FLD_XY_RL ( streamiceumassfluxfile , ' ',
0226 & u_flux_bdry_SI, 0, myThid )
0227 ELSE
0228 WRITE(msgBuf,'(A)') 'MASS FLUX AT U FACE - NOT SET'
0229 CALL PRINT_ERROR( msgBuf, myThid)
0230 ENDIF
0231
0232 IF ( streamicevmassfluxfile .NE. ' ') THEN
0233 _BARRIER
0234 CALL READ_FLD_XY_RL ( streamicevmassfluxfile , ' ',
0235 & v_flux_bdry_SI, 0, myThid )
0236 ELSE
0237 WRITE(msgBuf,'(A)') 'MASS FLUX AT V FACE - NOT SET'
0238 CALL PRINT_ERROR( msgBuf, myThid)
0239 ENDIF
0240
5ca83cd8f7 Dani*0241 #ifdef ALLOW_STREAMICE_2DTRACER
0242
0243 IF ( STREAMICETrac2dBCxFile .NE. ' ') THEN
0244 _BARRIER
0245 CALL READ_FLD_XY_RL ( STREAMICETrac2dBCxFile, ' ',
0246 & trac2d_ubdry_values_SI, 0, myThid )
0247 ELSE
0248 WRITE(msgBuf,'(A)') 'TRAC BC AT U FACE - NOT SET'
0249 CALL PRINT_ERROR( msgBuf, myThid)
0250 ENDIF
0251
0252 IF ( STREAMICETRAC2DBCyFile .NE. ' ') THEN
0253 _BARRIER
0254 CALL READ_FLD_XY_RL ( STREAMICETrac2dBCyFile, ' ',
0255 & trac2d_vbdry_values_SI, 0, myThid )
0256 ELSE
0257 WRITE(msgBuf,'(A)') 'TRAC BC AT V FACE - NOT SET'
0258 CALL PRINT_ERROR( msgBuf, myThid)
0259 ENDIF
0260
0261 #endif
0262
96b006450c dngo*0263
0264
0265
0266
5ca83cd8f7 Dani*0267
0268 IF ( STREAMICEhMaskFile .NE. ' ') THEN
0269 _BARRIER
217ff6d33b Jean*0270 CALL READ_FLD_XY_RS ( STREAMICEhMaskFile, ' ',
5ca83cd8f7 Dani*0271 & temp_hmask, 0, myThid )
0272 ELSE
0273 WRITE(msgBuf,'(A)') 'H MASK FILE - NOT SET'
0274 CALL PRINT_ERROR( msgBuf, myThid)
0275 ENDIF
217ff6d33b Jean*0276
5ca83cd8f7 Dani*0277 _EXCH_XY_RS(temp_hmask,myThid)
0278
0279 #ifdef ALLOW_CTRL
0280 DO bj = myByLo(myThid), myByHi(myThid)
0281 DO bi = myBxLo(myThid), myBxHi(myThid)
0282 DO j=1,sNy
0283 DO i=1,sNx
0284 IF (temp_hmask(i,j,bi,bj) .eq. 1.0) THEN
0285 DO k=1,Nr
0286 STREAMICE_ctrl_mask(i,j,k,bi,bj) = 1. _d 0
0287 ENDDO
0288 ENDIF
0289 ENDDO
0290 ENDDO
0291 ENDDO
0292 ENDDO
0293 #endif
0294
0295 #ifdef ALLOW_STREAMICE_FLUX_CONTROL
0296 DO bj = myByLo(myThid), myByHi(myThid)
0297 DO bi = myBxLo(myThid), myBxHi(myThid)
0298 DO j=1,sNy
0299 DO i=1,sNx
0300 u_bdry_values_SI (i,j,bi,bj) =
0301 & u_bdry_values_SI_base (i,j,bi,bj)
0302 v_bdry_values_SI (i,j,bi,bj) =
0303 & v_bdry_values_SI_base (i,j,bi,bj)
0304 ENDDO
0305 ENDDO
0306 ENDDO
0307 ENDDO
0308 #endif
0309
0310 #endif /* STREAMICE_GEOM_FILE_SETUP */
217ff6d33b Jean*0311
96b006450c dngo*0312
5ca83cd8f7 Dani*0313
0314
f1d1cc05cd Dani*0315 _EXCH_XY_RS(STREAMICE_calve_mask, myThid )
5ca83cd8f7 Dani*0316
0317 DO bj = myByLo(myThid), myByHi(myThid)
0318 DO bi = myBxLo(myThid), myBxHi(myThid)
0319 DO j=1,sNy
0320 DO i=1,sNx
0321
0322
0323
0fbff46b46 dngo*0324 IF (.not.usingCartesianGrid) THEN
0325
0326 k1AtC_str(i,j,bi,bj) = recip_rA(i,j,bi,bj) *
0327 & (dxG(i+1,j,bi,bj)-dxG(i,j,bi,bj))
0328 k2AtC_str(i,j,bi,bj) = recip_rA(i,j,bi,bj) *
0329 & (dyG(i,j+1,bi,bj)-dyG(i,j,bi,bj))
0330
0331 ELSE
0332
0333 k1AtC_str(i,j,bi,bj) = 0. _d 0
0334 k2AtC_str(i,j,bi,bj) = 0. _d 0
0335
0336 ENDIF
5ca83cd8f7 Dani*0337
0338 #ifdef STREAMICE_HYBRID_STRESS
0339 streamice_basal_geom (i,j,bi,bj) = 1.0
217ff6d33b Jean*0340 #endif
5ca83cd8f7 Dani*0341
0342
0343
0344 #ifndef STREAMICE_GEOM_FILE_SETUP
0345
0346 Gi = (myXGlobalLo-1)+(bi-1)*sNx+i
0347 Gj = (myYGlobalLo-1)+(bj-1)*sNy+j
0348 x = xC(i,j,bi,bj)
0349 y = yC(i,j,bi,bj)
0350
0351 STREAMICE_ufacemask_bdry (i,j,bi,bj) = -1.0
0352 STREAMICE_vfacemask_bdry (i,j,bi,bj) = -1.0
0353
0354 IF (Gi.EQ.1 .AND. .NOT. STREAMICE_EW_periodic) THEN
0355
0356 IF ((y .gt. min_y_noflow_WEST) .AND.
0357 & (y .le. max_y_noflow_WEST)) THEN
0358 STREAMICE_ufacemask_bdry (i,j,bi,bj) = 0.0
0359 ENDIF
0360 IF ((y .gt. min_y_noStress_WEST) .AND.
0361 & (y .le. max_y_noStress_WEST)) THEN
0362 STREAMICE_ufacemask_bdry (i,j,bi,bj) = 1.0
0363 ENDIF
0364 IF ((y .gt. min_y_FluxBdry_WEST) .AND.
0365 & (y .le. max_y_FluxBdry_WEST)) THEN
0366 STREAMICE_ufacemask_bdry (i,j,bi,bj) = 4.0
0367 u_flux_bdry_SI (i,j,bi,bj) = flux_bdry_val_WEST
0368 ENDIF
0369 IF ((y .gt. min_y_Dirich_WEST) .AND.
0370 & (y .le. max_y_Dirich_WEST)) THEN
0371 STREAMICE_ufacemask_bdry (i,j,bi,bj) = 3.0
0372 u_bdry_values_SI (i,j,bi,bj) = 0.0
0373 ENDIF
0374 IF ((y .gt. min_y_CFBC_WEST) .AND.
0375 & (y .le. max_y_CFBC_WEST)) THEN
0376 STREAMICE_ufacemask_bdry (i,j,bi,bj) = 2.0
0377 ENDIF
0378 ENDIF
0379
0380 IF (Gi.EQ.Nx .AND. .NOT. STREAMICE_EW_periodic) THEN
0381
0382 IF ((y .gt. min_y_noflow_EAST) .AND.
0383 & (y .le. max_y_noflow_EAST)) THEN
0384 STREAMICE_ufacemask_bdry (i,j,bi,bj) = 0.0
0385 ENDIF
0386 IF ((y .gt. min_y_noStress_EAST) .AND.
0387 & (y .le. max_y_noStress_EAST)) THEN
0388 STREAMICE_ufacemask_bdry (i,j,bi,bj) = 1.0
0389 ENDIF
0390 IF ((y .gt. min_y_FluxBdry_EAST) .AND.
0391 & (y .le. max_y_FluxBdry_EAST)) THEN
217ff6d33b Jean*0392 STREAMICE_ufacemask_bdry (i,j,bi,bj) = 4.0
5ca83cd8f7 Dani*0393 u_flux_bdry_SI (i,j,bi,bj) = flux_bdry_val_EAST
0394 ENDIF
0395 IF ((y .gt. min_y_Dirich_EAST) .AND.
0396 & (y .le. max_y_Dirich_EAST)) THEN
0397 STREAMICE_ufacemask_bdry (i,j,bi,bj) = 3.0
0398 u_bdry_values_SI (i,j,bi,bj) = 0. _d 0
0399 ENDIF
0400 IF ((y .gt. min_y_CFBC_EAST) .AND.
0401 & (y .le. max_y_CFBC_EAST)) THEN
0402 STREAMICE_ufacemask_bdry (i,j,bi,bj) = 2.0
0403 ENDIF
0404 ENDIF
0405
0406 IF (Gj.EQ.1 .AND. .NOT. STREAMICE_NS_periodic) THEN
0407
0408 IF ((x .gt. min_x_noflow_SOUTH) .AND.
0409 & (x .le. max_x_noflow_SOUTH)) THEN
0410 STREAMICE_vfacemask_bdry (i,j,bi,bj) = 0.0
0411 ENDIF
0412 IF ((x .gt. min_x_noStress_SOUTH) .AND.
0413 & (x .le. max_x_noStress_SOUTH)) THEN
0414 STREAMICE_vfacemask_bdry (i,j,bi,bj) = 1.0
0415 ENDIF
0416 IF ((x .gt. min_x_FluxBdry_SOUTH) .AND.
0417 & (x .le. max_x_FluxBdry_SOUTH)) THEN
0418 STREAMICE_vfacemask_bdry (i,j,bi,bj) = 4.0
dd082c38bc Dani*0419 v_flux_bdry_SI (i,j,bi,bj) = flux_bdry_val_SOUTH
5ca83cd8f7 Dani*0420 ENDIF
0421 IF ((x .gt. min_x_Dirich_SOUTH) .AND.
0422 & (x .le. max_x_Dirich_SOUTH)) THEN
0423 STREAMICE_vfacemask_bdry (i,j,bi,bj) = 3.0
0424 u_bdry_values_SI (i,j,bi,bj) = 0. _d 0
0425 ENDIF
0426 IF ((x .gt. min_x_CFBC_SOUTH) .AND.
0427 & (x .le. max_x_CFBC_SOUTH)) THEN
0428 STREAMICE_vfacemask_bdry (i,j,bi,bj) = 2.0
0429 ENDIF
0430 ENDIF
0431
0432 IF (Gj.EQ.Ny .AND. .NOT. STREAMICE_NS_periodic) THEN
0433
0434 IF ((x .gt. min_x_noflow_NORTH) .AND.
0435 & (x .le. max_x_noflow_NORTH)) THEN
0436 STREAMICE_vfacemask_bdry (i,j,bi,bj) = 0. _d 0
0437 ENDIF
0438 IF ((x .gt. min_x_noStress_NORTH) .AND.
0439 & (x .le. max_x_noStress_NORTH)) THEN
0440 STREAMICE_vfacemask_bdry (i,j,bi,bj) = 1.0
0441 ENDIF
0442 IF ((x .gt. min_x_FluxBdry_NORTH) .AND.
0443 & (x .le. max_x_FluxBdry_NORTH)) THEN
0444 STREAMICE_vfacemask_bdry (i,j,bi,bj) = 4.0
0445 v_flux_bdry_SI (i,j,bi,bj) = flux_bdry_val_NORTH
0446 ENDIF
0447 IF ((x .gt. min_x_Dirich_NORTH) .AND.
0448 & (x .le. max_x_Dirich_NORTH)) THEN
0449 STREAMICE_vfacemask_bdry (i,j,bi,bj) = 3.0
0450 v_bdry_values_SI (i,j,bi,bj) = 0. _d 0
0451 ENDIF
0452 IF ((x .gt. min_x_CFBC_NORTH) .AND.
0453 & (x .le. max_x_CFBC_NORTH)) THEN
0454 STREAMICE_vfacemask_bdry (i,j,bi,bj) = 2.0
0455 ENDIF
0456 ENDIF
0457
0458 #else /* ifndef STREAMICE_GEOM_FILE_SETUP */
96b006450c dngo*0459
5ca83cd8f7 Dani*0460
217ff6d33b Jean*0461 IF (temp_hmask(i,j,bi,bj).eq.1.0 .or.
0462 & temp_hmask(i,j,bi,bj).eq.0.0 .or.
5ca83cd8f7 Dani*0463 & temp_hmask(i-1,j,bi,bj).eq.1.0) THEN
0464
96b006450c dngo*0465
5ca83cd8f7 Dani*0466 maskFlag=INT(temp_ufacemask(i,j,bi,bj))
0467 IF (maskFlag.eq.2) THEN
0468 STREAMICE_ufacemask_bdry (i,j,bi,bj) = 2.0
bdd8102d3e Dani*0469 ELSEIF (maskflag.eq.4.0) THEN
0470 STREAMICE_ufacemask_bdry (i,j,bi,bj) = 4.0
5ca83cd8f7 Dani*0471 ELSEIF (maskFlag.eq.3) THEN
0472 STREAMICE_ufacemask_bdry (i,j,bi,bj) = 3.0
0473 ELSEIF (maskFlag.eq.1) THEN
0474 STREAMICE_ufacemask_bdry (i,j,bi,bj) = 1.0
217ff6d33b Jean*0475 ELSEIF ((maskFlag.eq.0) .or.
5ca83cd8f7 Dani*0476 & ((maskFlag.eq.-1) .and.
0477 & (temp_hmask(i-1,j,bi,bj).eq.-1.0))) THEN
0478 STREAMICE_ufacemask_bdry (i,j,bi,bj) = 0.0
6a651fd056 Dani*0479 ELSEIF (temp_hmask(i,j,bi,bj).eq.-1.0) THEN
d0bb3a34a9 Dani*0480 STREAMICE_ufacemask_bdry (i,j,bi,bj) = 0.0
5ca83cd8f7 Dani*0481 ELSE
0482 STREAMICE_ufacemask_bdry (i,j,bi,bj) = -1.0
0483 ENDIF
0484
0485 ENDIF
0486
0487 IF (temp_hmask(i,j,bi,bj).eq.1.0 .or.
0488 & temp_hmask(i,j,bi,bj).eq.0.0) THEN
0489
96b006450c dngo*0490
5ca83cd8f7 Dani*0491 maskFlag=INT(temp_ufacemask(i+1,j,bi,bj))
0492 IF (maskFlag.eq.2) THEN
0493 STREAMICE_ufacemask_bdry (i+1,j,bi,bj) = 2.0
bdd8102d3e Dani*0494 ELSEIF (maskFlag.eq.4.0) THEN
0495 STREAMICE_ufacemask_bdry (i+1,j,bi,bj) = 4.0
5ca83cd8f7 Dani*0496 ELSEIF (maskFlag.eq.3) THEN
0497 STREAMICE_ufacemask_bdry (i+1,j,bi,bj) = 3.0
0498 ELSEIF (maskFlag.eq.1) THEN
0499 STREAMICE_ufacemask_bdry (i+1,j,bi,bj) = 1.0
217ff6d33b Jean*0500 ELSEIF ((maskFlag.eq.0) .or.
5ca83cd8f7 Dani*0501 & ((maskFlag.eq.-1) .and.
0502 & (temp_hmask(i+1,j,bi,bj).eq.-1.0))) THEN
0503 STREAMICE_ufacemask_bdry (i+1,j,bi,bj) = 0.0
0504 ELSE
0505 STREAMICE_ufacemask_bdry (i+1,j,bi,bj) = -1.0
0506 ENDIF
0507
0508 ENDIF
0509
0510 IF (temp_hmask(i,j,bi,bj).eq.1.0 .or.
0511 & temp_hmask(i,j,bi,bj).eq.0.0 .or.
0512 & temp_hmask(i,j-1,bi,bj).eq.1.0) THEN
0513
96b006450c dngo*0514
5ca83cd8f7 Dani*0515 maskFlag=INT(temp_vfacemask(i,j,bi,bj))
0516 IF (maskFlag.eq.2) THEN
0517 STREAMICE_vfacemask_bdry (i,j,bi,bj) = 2.0
bdd8102d3e Dani*0518 ELSEIF (maskFlag.eq.4.0) THEN
0519 STREAMICE_vfacemask_bdry (i,j,bi,bj) = 4.0
5ca83cd8f7 Dani*0520 ELSEIF (maskFlag.eq.3) THEN
0521 STREAMICE_vfacemask_bdry (i,j,bi,bj) = 3.0
0522 ELSEIF (maskFlag.eq.1) THEN
0523 STREAMICE_vfacemask_bdry (i,j,bi,bj) = 1.0
217ff6d33b Jean*0524 ELSEIF ((maskFlag.eq.0) .or.
5ca83cd8f7 Dani*0525 & ((maskFlag.eq.-1) .and.
0526 & (temp_hmask(i,j-1,bi,bj).eq.-1.0))) THEN
0527 STREAMICE_vfacemask_bdry (i,j,bi,bj) = 0.0
6a651fd056 Dani*0528 ELSEIF (temp_hmask(i,j,bi,bj).eq.-1.0) THEN
0529 STREAMICE_vfacemask_bdry (i,j,bi,bj) = 0.0
6f6dd0226a Jean*0530 ELSE
5ca83cd8f7 Dani*0531 STREAMICE_vfacemask_bdry (i,j,bi,bj) = -1.0
0532 ENDIF
0533
0534 ENDIF
0535
0536 IF (temp_hmask(i,j,bi,bj).eq.1.0 .or.
0537 & temp_hmask(i,j,bi,bj).eq.0.0) THEN
217ff6d33b Jean*0538
96b006450c dngo*0539
5ca83cd8f7 Dani*0540 maskFlag=INT(temp_vfacemask(i,j+1,bi,bj))
0541 IF (maskFlag.eq.2) THEN
0542 STREAMICE_vfacemask_bdry (i,j+1,bi,bj) = 2.0
bdd8102d3e Dani*0543 ELSEIF (maskFlag.eq.4.0) THEN
0544 STREAMICE_vfacemask_bdry (i,j+1,bi,bj) = 4.0
5ca83cd8f7 Dani*0545 ELSEIF (maskFlag.eq.3) THEN
0546 STREAMICE_vfacemask_bdry (i,j+1,bi,bj) = 3.0
0547 ELSEIF (maskFlag.eq.1) THEN
0548 STREAMICE_vfacemask_bdry (i,j+1,bi,bj) = 1.0
217ff6d33b Jean*0549 ELSEIF ((maskFlag.eq.0) .or.
5ca83cd8f7 Dani*0550 & ((maskFlag.eq.-1) .and.
0551 & (temp_hmask(i,j+1,bi,bj).eq.-1.0))) THEN
0552 STREAMICE_vfacemask_bdry (i,j+1,bi,bj) = 0.0
0553 ELSE
0554 STREAMICE_vfacemask_bdry (i,j+1,bi,bj) = -1.0
0555 ENDIF
0556
0557 ENDIF
0558
0fbff46b46 dngo*0559 #endif /* ifndef STREAMICE_GEOM_FILE_SETUP */
217ff6d33b Jean*0560
5ca83cd8f7 Dani*0561 ENDDO
0562 ENDDO
0563 ENDDO
0564 ENDDO
0565
0566 #ifdef ALLOW_CTRL
0567 CALL ACTIVE_WRITE_GEN_RS( 'maskCtrlL', STREAMICE_ctrl_mask,
217ff6d33b Jean*0568 & 'XY', Nr, 1, .FALSE., 0, myThid, dummyRS )
5ca83cd8f7 Dani*0569 #endif
0570
0571 #ifdef ALLOW_COST
96b006450c dngo*0572
217ff6d33b Jean*0573 CALL WRITE_FLD_XY_RS ( 'maskCost', '',
5ca83cd8f7 Dani*0574 & STREAMICE_cost_mask, 0, myThid )
0575 #endif
0576
0577 _EXCH_XY_RL(k1AtC_str, myThid )
0578 _EXCH_XY_RL(k2AtC_str, myThid )
f1d1cc05cd Dani*0579 _EXCH_XY_RS(STREAMICE_ufacemask_bdry, myThid )
0580 _EXCH_XY_RS(STREAMICE_vfacemask_bdry, myThid )
5ca83cd8f7 Dani*0581 _EXCH_XY_RL(u_bdry_values_SI, myThid )
0582 _EXCH_XY_RL(v_bdry_values_SI, myThid )
0583 _EXCH_XY_RL(u_flux_bdry_SI, myThid )
0584 _EXCH_XY_RL(v_flux_bdry_SI, myThid )
0585
0586 Xquad (1) = .5 * (1.-1./sqrt(3.))
0587 Xquad (2) = .5 * (1.+1./sqrt(3.))
0588
0589 CALL STREAMICE_INIT_PHI( myThid )
217ff6d33b Jean*0590
0432abea0f Dani*0591 #if (defined (ALLOW_OPENAD) && defined (ALLOW_STREAMICE_OAD_FP) )
0592 #ifdef ALLOW_PETSC
0593 STREAMICE_need2createmat = .true.
0594 STREAMICE_need2destroymat = .true.
0595 #endif
0596 #endif
0597
6a6b1adb9c Jean*0598 #endif /* ALLOW_STREAMICE */
5ca83cd8f7 Dani*0599
0600 RETURN
0601 END