1 |
jmc |
1.5 |
C $Header: /u/gcmpack/MITgcm/pkg/generic_advdiff/gad_diff_r.F,v 1.4 2004/10/21 21:26:10 jmc Exp $ |
2 |
adcroft |
1.2 |
C $Name: $ |
3 |
adcroft |
1.1 |
|
4 |
|
|
#include "GAD_OPTIONS.h" |
5 |
|
|
|
6 |
adcroft |
1.2 |
CBOP |
7 |
|
|
C !ROUTINE: GAD_DIFF_R |
8 |
|
|
|
9 |
|
|
C !INTERFACE: ========================================================== |
10 |
adcroft |
1.1 |
SUBROUTINE GAD_DIFF_R( |
11 |
|
|
I bi,bj,k, |
12 |
|
|
I KappaR, |
13 |
|
|
I tracer, |
14 |
|
|
O dfr, |
15 |
|
|
I myThid ) |
16 |
adcroft |
1.2 |
|
17 |
|
|
C !DESCRIPTION: |
18 |
adcroft |
1.3 |
C Calculates the area integrated vertical flux due to down-gradient |
19 |
|
|
C diffusion of a tracer: |
20 |
adcroft |
1.2 |
C \begin{equation*} |
21 |
adcroft |
1.3 |
C F^r_{diff} = - A^r \kappa_r \frac{1}{\Delta r_c} \delta_k \theta |
22 |
adcroft |
1.2 |
C \end{equation*} |
23 |
|
|
|
24 |
|
|
C !USES: =============================================================== |
25 |
adcroft |
1.1 |
IMPLICIT NONE |
26 |
|
|
#include "SIZE.h" |
27 |
|
|
#include "GRID.h" |
28 |
|
|
#include "EEPARAMS.h" |
29 |
|
|
#include "PARAMS.h" |
30 |
|
|
|
31 |
adcroft |
1.2 |
C !INPUT PARAMETERS: =================================================== |
32 |
|
|
C bi,bj :: tile indices |
33 |
|
|
C k :: vertical level |
34 |
|
|
C KappaR :: vertical diffusivity |
35 |
|
|
C tracer :: tracer field |
36 |
|
|
C myThid :: thread number |
37 |
adcroft |
1.1 |
INTEGER bi,bj,k |
38 |
jmc |
1.4 |
_RL KappaR(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
39 |
adcroft |
1.1 |
_RL tracer(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy) |
40 |
adcroft |
1.2 |
INTEGER myThid |
41 |
|
|
|
42 |
|
|
C !OUTPUT PARAMETERS: ================================================== |
43 |
|
|
C dfr :: vertical diffusive flux |
44 |
adcroft |
1.1 |
_RL dfr (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
45 |
|
|
|
46 |
adcroft |
1.2 |
C !LOCAL VARIABLES: ==================================================== |
47 |
|
|
C i,j :: loop indices |
48 |
|
|
C km1 :: =k+1 for k<Nr, =Nr for k>-Nr |
49 |
adcroft |
1.1 |
INTEGER i,j,km1 |
50 |
adcroft |
1.3 |
CEOP |
51 |
adcroft |
1.1 |
|
52 |
|
|
km1=max(1,k-1) |
53 |
|
|
|
54 |
|
|
IF (k.eq.1 .OR. k.gt.Nr) THEN |
55 |
|
|
DO j=1-Oly,sNy+Oly |
56 |
|
|
DO i=1-Olx,sNx+Olx |
57 |
|
|
dfr(i,j) = 0. |
58 |
|
|
ENDDO |
59 |
|
|
ENDDO |
60 |
|
|
ELSE |
61 |
|
|
DO j=1-Oly,sNy+Oly |
62 |
|
|
DO i=1-Olx,sNx+Olx |
63 |
|
|
dfr(i,j) = |
64 |
|
|
& -_rA(i,j,bi,bj) |
65 |
jmc |
1.4 |
& *KappaR(i,j)*recip_drC(k) |
66 |
jmc |
1.5 |
& *(Tracer(i,j,k,bi,bj)-Tracer(i,j,km1,bi,bj))*rkSign |
67 |
adcroft |
1.1 |
ENDDO |
68 |
|
|
ENDDO |
69 |
|
|
ENDIF |
70 |
|
|
|
71 |
|
|
RETURN |
72 |
|
|
END |