1 |
C $Header: /u/gcmpack/MITgcm/pkg/generic_advdiff/gad_c2_impl_r.F,v 1.6 2011/12/01 14:14:43 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "GAD_OPTIONS.h" |
5 |
|
6 |
CBOP |
7 |
C !ROUTINE: GAD_C2_IMPL_R |
8 |
C !INTERFACE: |
9 |
SUBROUTINE GAD_C2_IMPL_R( |
10 |
I bi,bj,k, iMin,iMax,jMin,jMax, |
11 |
I deltaTarg, rTrans, recip_hFac, |
12 |
O a3d, b3d, c3d, |
13 |
I myThid ) |
14 |
|
15 |
C !DESCRIPTION: |
16 |
C Compute matrix element to solve vertical advection implicitly |
17 |
C using centered second-order scheme The contribution of vertical |
18 |
C transport at interface k is added to matrix lines k and k-1. |
19 |
|
20 |
C !USES: |
21 |
IMPLICIT NONE |
22 |
|
23 |
C == Global variables === |
24 |
#include "SIZE.h" |
25 |
#include "GRID.h" |
26 |
#include "EEPARAMS.h" |
27 |
#include "PARAMS.h" |
28 |
|
29 |
C !INPUT/OUTPUT PARAMETERS: |
30 |
C == Routine Arguments == |
31 |
C bi,bj :: tile indices |
32 |
C k :: vertical level |
33 |
C iMin,iMax :: computation domain |
34 |
C jMin,jMax :: computation domain |
35 |
C deltaTarg :: time step |
36 |
C rTrans :: vertical volume transport |
37 |
C recip_hFac :: inverse of cell open-depth factor |
38 |
C a3d :: lower diagonal of the tridiagonal matrix |
39 |
C b3d :: main diagonal of the tridiagonal matrix |
40 |
C c3d :: upper diagonal of the tridiagonal matrix |
41 |
C myThid :: thread number |
42 |
INTEGER bi,bj,k |
43 |
INTEGER iMin,iMax,jMin,jMax |
44 |
_RL deltaTarg(Nr) |
45 |
_RL rTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
46 |
_RS recip_hFac(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
47 |
_RL a3d (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
48 |
_RL b3d (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
49 |
_RL c3d (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
50 |
INTEGER myThid |
51 |
|
52 |
C == Local Variables == |
53 |
C i,j :: loop indices |
54 |
C rCenter :: centered contribution |
55 |
INTEGER i,j |
56 |
_RL rCenter |
57 |
CEOP |
58 |
|
59 |
C-- process interior interface only: |
60 |
IF ( k.GT.1 .AND. k.LE.Nr ) THEN |
61 |
|
62 |
C-- Add centered contribution |
63 |
DO j=jMin,jMax |
64 |
DO i=iMin,iMax |
65 |
rCenter = 0.5 _d 0 *rTrans(i,j)*recip_rA(i,j,bi,bj)*rkSign |
66 |
a3d(i,j,k) = a3d(i,j,k) |
67 |
& - rCenter*deltaTarg(k) |
68 |
& *recip_hFac(i,j,k)*recip_drF(k) |
69 |
& *recip_deepFac2C(k)*recip_rhoFacC(k) |
70 |
b3d(i,j,k) = b3d(i,j,k) |
71 |
& - rCenter*deltaTarg(k) |
72 |
& *recip_hFac(i,j,k)*recip_drF(k) |
73 |
& *recip_deepFac2C(k)*recip_rhoFacC(k) |
74 |
b3d(i,j,k-1) = b3d(i,j,k-1) |
75 |
& + rCenter*deltaTarg(k-1) |
76 |
& *recip_hFac(i,j,k-1)*recip_drF(k-1) |
77 |
& *recip_deepFac2C(k-1)*recip_rhoFacC(k-1) |
78 |
c3d(i,j,k-1) = c3d(i,j,k-1) |
79 |
& + rCenter*deltaTarg(k-1) |
80 |
& *recip_hFac(i,j,k-1)*recip_drF(k-1) |
81 |
& *recip_deepFac2C(k-1)*recip_rhoFacC(k-1) |
82 |
ENDDO |
83 |
ENDDO |
84 |
|
85 |
C-- process interior interface only: end |
86 |
ENDIF |
87 |
|
88 |
RETURN |
89 |
END |