/[MITgcm]/MITgcm/pkg/mom_fluxform/mom_uv_boundary.F
ViewVC logotype

Contents of /MITgcm/pkg/mom_fluxform/mom_uv_boundary.F

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


Revision 1.1 - (show annotations) (download)
Sun Oct 28 21:38:21 2007 UTC (16 years, 6 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, checkpoint63p, checkpoint63q, checkpoint63r, checkpoint63s, checkpoint63l, checkpoint63m, checkpoint63n, checkpoint63o, checkpoint63h, checkpoint63i, checkpoint63j, checkpoint63k, checkpoint63d, checkpoint63e, checkpoint63f, checkpoint63g, checkpoint63a, checkpoint63b, checkpoint63c, checkpoint64, checkpoint65, checkpoint60, checkpoint61, checkpoint62, checkpoint63, 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, checkpoint59q, checkpoint59p, checkpoint59r, checkpoint59m, checkpoint59l, checkpoint59o, checkpoint59n, checkpoint59k, checkpoint59j, checkpoint62c, checkpoint62b, checkpoint62a, checkpoint62g, checkpoint62f, checkpoint62e, checkpoint62d, checkpoint62k, checkpoint62j, checkpoint62i, checkpoint62h, checkpoint62o, checkpoint62n, checkpoint62m, checkpoint62l, checkpoint62s, checkpoint62r, checkpoint62q, checkpoint62p, checkpoint62w, checkpoint62v, checkpoint62u, checkpoint62t, checkpoint62z, checkpoint62y, checkpoint62x, checkpoint61f, checkpoint61g, checkpoint61d, checkpoint61e, checkpoint61b, checkpoint61c, checkpoint61a, checkpoint61n, checkpoint61o, checkpoint61l, checkpoint61m, checkpoint61j, checkpoint61k, checkpoint61h, checkpoint61i, checkpoint61v, checkpoint61w, checkpoint61t, checkpoint61u, checkpoint61r, checkpoint61s, checkpoint61p, checkpoint61q, checkpoint61z, checkpoint61x, checkpoint61y, HEAD
Special version of momentum advection intended to conserve momentum
next to a bathymetry step or a coastline edge.

1 C $Header: $
2 C $Name: $
3
4 #include "MOM_FLUXFORM_OPTIONS.h"
5
6 CBOP
7 C !ROUTINE: MOM_UV_BOUNDARY
8
9 C !INTERFACE: ==========================================================
10 SUBROUTINE MOM_UV_BOUNDARY (
11 I bi,bj,k,
12 I uFld, vFld,
13 O uBnd, vBnd,
14 I myTime, myIter, myThid )
15
16 C !DESCRIPTION:
17 C Set velocity at a boundary for a momentum conserving advection
18 C Note: really conserve momentum when "steps" (vertical plane)
19 C or coastline (horizontal plane) are only 1 grid-point wide.
20
21 C !USES: ===============================================================
22 C == Global variables ==
23 IMPLICIT NONE
24 #include "SIZE.h"
25 #include "EEPARAMS.h"
26 #include "PARAMS.h"
27 #include "GRID.h"
28
29 C !INPUT PARAMETERS: ===================================================
30 C bi,bj :: tile indices
31 C k :: vertical level
32 C uFld :: zonal velocity
33 C vFld :: meridional velocity
34 C myTime :: current time
35 C myIter :: current iteration number
36 C myThid :: My Thread Id. number
37 INTEGER bi,bj
38 INTEGER k
39 _RL uFld(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
40 _RL vFld(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
41 _RL myTime
42 INTEGER myIter
43 INTEGER myThid
44
45 C !OUTPUT PARAMETERS: ==================================================
46 C uBnd :: zonal velocity extended to boundaries
47 C vBnd :: meridional velocity extended to boundaries
48 _RL uBnd(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
49 _RL vBnd(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
50
51 #ifdef MOM_BOUNDARY_CONSERVE
52 C !LOCAL VARIABLES: ====================================================
53 C i,j :: loop indices
54 INTEGER i,j
55 INTEGER km1,kp1
56 _RL maskM1, maskP1
57 _RL uTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
58 _RL vTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
59 _RL aBndU(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
60 _RL aBndV(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
61 _RL aBndW(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
62 _RL tmpVar
63 LOGICAL useMomBndConserve
64 PARAMETER ( useMomBndConserve = .TRUE. )
65 CEOP
66
67 C Initialise output array
68 DO j=1-OLy,sNy+OLy
69 DO i=1-OLx,sNx+OLx
70 uBnd(i,j) = uFld(i,j,k,bi,bj)
71 vBnd(i,j) = vFld(i,j,k,bi,bj)
72 ENDDO
73 ENDDO
74
75 IF ( useMomBndConserve ) THEN
76
77 C- Initialise intermediate arrays:
78 km1 = MAX( k-1, 1 )
79 kp1 = MIN( k+1, Nr )
80 maskM1 = 1.
81 maskP1 = 1.
82 IF ( k.EQ.1 ) maskM1 = 0.
83 IF ( k.EQ.Nr ) maskP1 = 0.
84 DO j=1-OLy,sNy+OLy
85 DO i=1-OLx,sNx+OLx
86 aBndU(i,j) = 0.
87 aBndV(i,j) = 0.
88 aBndW(i,j) = 0.
89 ENDDO
90 ENDDO
91
92 C- Calculate Divergence in 3 directions:
93 DO j=1-OLy,sNy+OLy
94 DO i=1-OLx,sNx+OLx
95 uTrans(i,j) = uFld(i,j,k,bi,bj)
96 & * dyG(i,j,bi,bj)*deepFacC(k)
97 & * drF(k)*hFacW(i,j,k,bi,bj)*rhoFacC(k)
98 vTrans(i,j) = vFld(i,j,k,bi,bj)
99 & * dxG(i,j,bi,bj)*deepFacC(k)
100 & * drF(k)*hFacS(i,j,k,bi,bj)*rhoFacC(k)
101 ENDDO
102 ENDDO
103 DO j=1-OLy,sNy+OLy-1
104 DO i=1-OLx,sNx+OLx-1
105 aBndU(i,j) = uTrans(i+1,j)-uTrans(i,j)
106 aBndV(i,j) = vTrans(i,j+1)-vTrans(i,j)
107 aBndW(i,j) = ABS(aBndU(i,j)+aBndV(i,j))
108 aBndU(i,j) = ABS(aBndU(i,j))
109 aBndV(i,j) = ABS(aBndV(i,j))
110 ENDDO
111 ENDDO
112 C- Normalise by the sum:
113 DO j=1-OLy,sNy+OLy-1
114 DO i=1-OLx,sNx+OLx-1
115 tmpVar = aBndU(i,j)+aBndV(i,j)+aBndW(i,j)
116 IF ( tmpVar.GT.0. ) THEN
117 tmpVar = 1. _d 0 / tmpVar
118 aBndU(i,j) = aBndU(i,j)*tmpVar
119 aBndV(i,j) = aBndV(i,j)*tmpVar
120 aBndW(i,j) = aBndW(i,j)*tmpVar
121 ENDIF
122 ENDDO
123 ENDDO
124
125 C- At a boundary, replace uFld,vFld by a weighted average
126 C Note: multiply by 2 to cancel the 1/2 factor in advections S/R
127 DO j=1-OLy+1,sNy+OLy-1
128 DO i=1-OLx+1,sNx+OLx-1
129 IF (maskW(i,j,k,bi,bj).EQ.0.) THEN
130 C Note: only 1 set of aBnd_U,V,W is non-zero (either i-1 or i)
131 C and only 1 uFld is non-zero (either i-1 or i+1)
132 C and only 1 uFld is non-zero (either k-1 or k+1)
133 uBnd(i,j) = (
134 & (aBndU(i-1,j)+aBndU(i,j))
135 & *(uFld(i-1,j,k,bi,bj)+uFld(i+1,j,k,bi,bj))
136 & +(aBndV(i-1,j)+aBndV(i,j))
137 & *(uFld(i,j-1,k,bi,bj)+uFld(i,j+1,k,bi,bj))
138 & +(aBndW(i-1,j)+aBndW(i,j))
139 & *(uFld(i,j,km1,bi,bj)*maskM1
140 & +uFld(i,j,kp1,bi,bj)*maskP1)
141 & )*2. _d 0
142 ENDIF
143 IF (maskS(i,j,k,bi,bj).EQ.0.) THEN
144 C Note: only 1 set of aBnd_U,V,W is non-zero (either j-1 or j)
145 C and only 1 vFld is non-zero (either j-1 or j+1)
146 C and only 1 vFld is non-zero (either k-1 or k+1)
147 vBnd(i,j) = (
148 & (aBndU(i,j-1)+aBndU(i,j))
149 & *(vFld(i-1,j,k,bi,bj)+vFld(i+1,j,k,bi,bj))
150 & +(aBndV(i,j-1)+aBndV(i,j))
151 & *(vFld(i,j-1,k,bi,bj)+vFld(i,j+1,k,bi,bj))
152 & +(aBndW(i,j-1)+aBndW(i,j))
153 & *(vFld(i,j,km1,bi,bj)*maskM1
154 & +vFld(i,j,kp1,bi,bj)*maskP1)
155 & )*2. _d 0
156 ENDIF
157 ENDDO
158 ENDDO
159 ENDIF
160 #endif /* MOM_BOUNDARY_CONSERVE */
161
162 RETURN
163 END

  ViewVC Help
Powered by ViewVC 1.1.22