1 |
C $Header: /u/gcmpack/MITgcm/pkg/mom_common/mom_calc_hdiv.F,v 1.4 2011/05/03 19:27:26 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "MOM_COMMON_OPTIONS.h" |
5 |
|
6 |
SUBROUTINE MOM_CALC_HDIV( |
7 |
I bi,bj,k, hDivScheme, |
8 |
I uFld, vFld, |
9 |
O hDiv, |
10 |
I myThid ) |
11 |
IMPLICIT NONE |
12 |
C *==========================================================* |
13 |
C | S/R MOM_CALC_HDIV | |
14 |
C *==========================================================* |
15 |
C *==========================================================* |
16 |
|
17 |
C == Global variables == |
18 |
#include "SIZE.h" |
19 |
#include "EEPARAMS.h" |
20 |
#include "PARAMS.h" |
21 |
#include "GRID.h" |
22 |
C == Routine arguments == |
23 |
C myThid - Instance number for this innvocation of CALC_MOM_RHS |
24 |
INTEGER bi,bj,k,hDivScheme |
25 |
_RL uFld(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
26 |
_RL vFld(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
27 |
_RL hDiv(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
28 |
INTEGER myThid |
29 |
|
30 |
C == Local variables == |
31 |
INTEGER i,j |
32 |
|
33 |
IF (hDivScheme.EQ.1) THEN |
34 |
DO j=1-OLy,sNy+OLy-1 |
35 |
DO i=1-OLx,sNx+OLx-1 |
36 |
C This discretization is the straight forward horizontal divergence |
37 |
C that only considers the horizontal grid variations. |
38 |
hDiv(i,j)=( |
39 |
& uFld(i+1, j )*dyG(i+1, j ,bi,bj) |
40 |
& -uFld( i , j )*dyG( i , j ,bi,bj) |
41 |
& +vFld( i ,j+1)*dxG( i ,j+1,bi,bj) |
42 |
& -vFld( i , j )*dxG( i , j ,bi,bj) |
43 |
& )*recip_rA(i,j,bi,bj)*recip_deepFacC(k) |
44 |
#ifdef ALLOW_OBCS |
45 |
& *maskInC(i,j,bi,bj) |
46 |
#endif |
47 |
ENDDO |
48 |
ENDDO |
49 |
|
50 |
ELSEIF (hDivScheme.EQ.2) THEN |
51 |
DO j=1-OLy,sNy+OLy-1 |
52 |
DO i=1-OLx,sNx+OLx-1 |
53 |
C This discretization takes into account the fractional areas |
54 |
C due to the lopping. Whether we should do this is not clear! |
55 |
hDiv(i,j)= |
56 |
& ( ( uFld(i+1, j )*dyG(i+1, j ,bi,bj)*hFacW(i+1, j ,k,bi,bj) |
57 |
& -uFld( i , j )*dyG( i , j ,bi,bj)*hFacW( i , j ,k,bi,bj) ) |
58 |
& +( vFld( i ,j+1)*dxG( i ,j+1,bi,bj)*hFacS( i ,j+1,k,bi,bj) |
59 |
& -vFld( i , j )*dxG( i , j ,bi,bj)*hFacS( i , j ,k,bi,bj) ) |
60 |
& )*recip_rA(i,j,bi,bj)*recip_deepFacC(k) |
61 |
& *_recip_hFacC(i,j,k,bi,bj) |
62 |
#ifdef ALLOW_OBCS |
63 |
& *maskInC(i,j,bi,bj) |
64 |
#endif |
65 |
ENDDO |
66 |
ENDDO |
67 |
|
68 |
ELSE |
69 |
STOP 'S/R MOM_CALC_HDIV: We should never reach this point!' |
70 |
ENDIF |
71 |
|
72 |
RETURN |
73 |
END |