File indexing completed on 2018-03-02 18:42:14 UTC
view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
229b6d70e7 Jean*0001 #include "MOM_FLUXFORM_OPTIONS.h"
0002
0003
0004
0005
0006
0007 SUBROUTINE MOM_UV_BOUNDARY (
0008 I bi,bj,k,
0009 I uFld, vFld,
0010 O uBnd, vBnd,
0011 I myTime, myIter, myThid )
0012
0013
0014
0015
0016
0017
0018
0019
0020 IMPLICIT NONE
0021 #include "SIZE.h"
0022 #include "EEPARAMS.h"
0023 #include "PARAMS.h"
0024 #include "GRID.h"
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034 INTEGER bi,bj
0035 INTEGER k
0036 _RL uFld(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
0037 _RL vFld(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
0038 _RL myTime
0039 INTEGER myIter
0040 INTEGER myThid
0041
0042
0043
0044
0045 _RL uBnd(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
0046 _RL vBnd(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
0047
0048 #ifdef MOM_BOUNDARY_CONSERVE
0049
0050
0051 INTEGER i,j
0052 INTEGER km1,kp1
0053 _RL maskM1, maskP1
0054 _RL uTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
0055 _RL vTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
0056 _RL aBndU(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
0057 _RL aBndV(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
0058 _RL aBndW(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
0059 _RL tmpVar
0060 LOGICAL useMomBndConserve
0061 PARAMETER ( useMomBndConserve = .TRUE. )
0062
0063
0064
0065 DO j=1-OLy,sNy+OLy
0066 DO i=1-OLx,sNx+OLx
0067 uBnd(i,j) = uFld(i,j,k,bi,bj)
0068 vBnd(i,j) = vFld(i,j,k,bi,bj)
0069 ENDDO
0070 ENDDO
0071
0072 IF ( useMomBndConserve ) THEN
0073
0074
0075 km1 = MAX( k-1, 1 )
0076 kp1 = MIN( k+1, Nr )
0077 maskM1 = 1.
0078 maskP1 = 1.
0079 IF ( k.EQ.1 ) maskM1 = 0.
0080 IF ( k.EQ.Nr ) maskP1 = 0.
0081 DO j=1-OLy,sNy+OLy
0082 DO i=1-OLx,sNx+OLx
0083 aBndU(i,j) = 0.
0084 aBndV(i,j) = 0.
0085 aBndW(i,j) = 0.
0086 ENDDO
0087 ENDDO
0088
0089
0090 DO j=1-OLy,sNy+OLy
0091 DO i=1-OLx,sNx+OLx
0092 uTrans(i,j) = uFld(i,j,k,bi,bj)
0093 & * dyG(i,j,bi,bj)*deepFacC(k)
0094 & * drF(k)*hFacW(i,j,k,bi,bj)*rhoFacC(k)
0095 vTrans(i,j) = vFld(i,j,k,bi,bj)
0096 & * dxG(i,j,bi,bj)*deepFacC(k)
0097 & * drF(k)*hFacS(i,j,k,bi,bj)*rhoFacC(k)
0098 ENDDO
0099 ENDDO
0100 DO j=1-OLy,sNy+OLy-1
0101 DO i=1-OLx,sNx+OLx-1
0102 aBndU(i,j) = uTrans(i+1,j)-uTrans(i,j)
0103 aBndV(i,j) = vTrans(i,j+1)-vTrans(i,j)
0104 aBndW(i,j) = ABS(aBndU(i,j)+aBndV(i,j))
0105 aBndU(i,j) = ABS(aBndU(i,j))
0106 aBndV(i,j) = ABS(aBndV(i,j))
0107 ENDDO
0108 ENDDO
0109
0110 DO j=1-OLy,sNy+OLy-1
0111 DO i=1-OLx,sNx+OLx-1
0112 tmpVar = aBndU(i,j)+aBndV(i,j)+aBndW(i,j)
0113 IF ( tmpVar.GT.0. ) THEN
0114 tmpVar = 1. _d 0 / tmpVar
0115 aBndU(i,j) = aBndU(i,j)*tmpVar
0116 aBndV(i,j) = aBndV(i,j)*tmpVar
0117 aBndW(i,j) = aBndW(i,j)*tmpVar
0118 ENDIF
0119 ENDDO
0120 ENDDO
0121
0122
0123
0124 DO j=1-OLy+1,sNy+OLy-1
0125 DO i=1-OLx+1,sNx+OLx-1
0126 IF (maskW(i,j,k,bi,bj).EQ.0.) THEN
0127
0128
0129
0130 uBnd(i,j) = (
0131 & (aBndU(i-1,j)+aBndU(i,j))
0132 & *(uFld(i-1,j,k,bi,bj)+uFld(i+1,j,k,bi,bj))
0133 & +(aBndV(i-1,j)+aBndV(i,j))
0134 & *(uFld(i,j-1,k,bi,bj)+uFld(i,j+1,k,bi,bj))
0135 & +(aBndW(i-1,j)+aBndW(i,j))
0136 & *(uFld(i,j,km1,bi,bj)*maskM1
0137 & +uFld(i,j,kp1,bi,bj)*maskP1)
0138 & )*2. _d 0
0139 ENDIF
0140 IF (maskS(i,j,k,bi,bj).EQ.0.) THEN
0141
0142
0143
0144 vBnd(i,j) = (
0145 & (aBndU(i,j-1)+aBndU(i,j))
0146 & *(vFld(i-1,j,k,bi,bj)+vFld(i+1,j,k,bi,bj))
0147 & +(aBndV(i,j-1)+aBndV(i,j))
0148 & *(vFld(i,j-1,k,bi,bj)+vFld(i,j+1,k,bi,bj))
0149 & +(aBndW(i,j-1)+aBndW(i,j))
0150 & *(vFld(i,j,km1,bi,bj)*maskM1
0151 & +vFld(i,j,kp1,bi,bj)*maskP1)
0152 & )*2. _d 0
0153 ENDIF
0154 ENDDO
0155 ENDDO
0156 ENDIF
0157 #endif /* MOM_BOUNDARY_CONSERVE */
0158
0159 RETURN
0160 END