1 |
edhill |
1.2 |
C $Header: /u/gcmpack/MITgcm/pkg/generic_advdiff/gad_c2_impl_r.F,v 1.1 2004/01/07 21:37:59 jmc Exp $ |
2 |
jmc |
1.1 |
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, |
12 |
|
|
O a3d, b3d, c3d, |
13 |
|
|
I myThid ) |
14 |
|
|
|
15 |
edhill |
1.2 |
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 |
jmc |
1.1 |
|
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 |
edhill |
1.2 |
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 a3d :: lower diagonal of the tridiagonal matrix |
38 |
|
|
C b3d :: main diagonal of the tridiagonal matrix |
39 |
|
|
C c3d :: upper diagonal of the tridiagonal matrix |
40 |
|
|
C myThid :: thread number |
41 |
jmc |
1.1 |
INTEGER bi,bj,k |
42 |
|
|
INTEGER iMin,iMax,jMin,jMax |
43 |
|
|
_RL deltaTarg |
44 |
|
|
_RL rTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
45 |
|
|
_RL a3d (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
46 |
|
|
_RL b3d (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
47 |
|
|
_RL c3d (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
48 |
|
|
INTEGER myThid |
49 |
|
|
|
50 |
|
|
C == Local Variables == |
51 |
edhill |
1.2 |
C i,j :: loop indices |
52 |
|
|
C rCenter :: centered contribution |
53 |
jmc |
1.1 |
INTEGER i,j |
54 |
|
|
_RL rCenter |
55 |
|
|
CEOP |
56 |
|
|
|
57 |
|
|
IF ( k.GT.Nr .OR. k.LT.2 ) RETURN |
58 |
|
|
|
59 |
|
|
C-- Add centered contribution |
60 |
|
|
DO j=jMin,jMax |
61 |
|
|
DO i=iMin,iMax |
62 |
|
|
rCenter = 0.5 _d 0 *deltaTarg*rTrans(i,j) |
63 |
|
|
& *recip_rA(i,j,bi,bj)*rkFac |
64 |
|
|
a3d(i,j,k) = a3d(i,j,k) |
65 |
|
|
& + rCenter |
66 |
|
|
& *recip_hFacC(i,j,k,bi,bj)*recip_drF(k) |
67 |
|
|
b3d(i,j,k) = b3d(i,j,k) |
68 |
|
|
& + rCenter |
69 |
|
|
& *recip_hFacC(i,j,k,bi,bj)*recip_drF(k) |
70 |
|
|
b3d(i,j,k-1) = b3d(i,j,k-1) |
71 |
|
|
& - rCenter |
72 |
|
|
& *recip_hFacC(i,j,k-1,bi,bj)*recip_drF(k-1) |
73 |
|
|
c3d(i,j,k-1) = c3d(i,j,k-1) |
74 |
|
|
& - rCenter |
75 |
|
|
& *recip_hFacC(i,j,k-1,bi,bj)*recip_drF(k-1) |
76 |
|
|
ENDDO |
77 |
|
|
ENDDO |
78 |
|
|
|
79 |
|
|
RETURN |
80 |
|
|
END |