1 |
C $Header: /u/gcmpack/MITgcm/pkg/mom_common/mom_calc_hdiv.F,v 1.1 2004/05/24 18:40:57 adcroft 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) |
44 |
ENDDO |
45 |
ENDDO |
46 |
|
47 |
ELSEIF (hDivScheme.EQ.2) THEN |
48 |
DO J=1-Oly,sNy+Oly-1 |
49 |
DO I=1-Olx,sNx+Olx-1 |
50 |
C This discretization takes into account the fractional areas |
51 |
C due to the lopping. Whether we should do this is not clear! |
52 |
hDiv(I,J)= |
53 |
& ( ( uFld(i+1, j )*dyg(i+1, j ,bi,bj)*hFacW(i+1, j ,K,bi,bj) |
54 |
& -uFld( i , j )*dyg( i , j ,bi,bj)*hFacW( i , j ,K,bi,bj) ) |
55 |
& +( vFld( i ,j+1)*dxg( i ,j+1,bi,bj)*hFacS( i ,j+1,K,bi,bj) |
56 |
& -vFld( i , j )*dxg( i , j ,bi,bj)*hFacS( i , j ,K,bi,bj) ) |
57 |
& )*recip_rA(I,J,bi,bj) |
58 |
& *recip_hFacC(i,j,k,bi,bj) |
59 |
ENDDO |
60 |
ENDDO |
61 |
|
62 |
ELSE |
63 |
STOP 'S/R MOM_CALC_HDIV: We should never reach this point!' |
64 |
ENDIF |
65 |
|
66 |
RETURN |
67 |
END |