1 |
mlosch |
1.4 |
C $Header: /u/gcmpack/MITgcm/pkg/ptracers/ptracers_implicit.F,v 1.3 2005/03/25 00:29:17 heimbach Exp $ |
2 |
jmc |
1.1 |
C $Name: $ |
3 |
|
|
|
4 |
|
|
#include "PTRACERS_OPTIONS.h" |
5 |
|
|
|
6 |
|
|
CBOP |
7 |
|
|
C !ROUTINE: PTRACERS_IMPLICIT |
8 |
|
|
|
9 |
|
|
C !INTERFACE: ========================================================== |
10 |
|
|
SUBROUTINE PTRACERS_IMPLICIT( |
11 |
|
|
U kappaRk, |
12 |
|
|
I bi, bj, myTime, myIter, myThid ) |
13 |
|
|
|
14 |
|
|
C !DESCRIPTION: |
15 |
|
|
C Calls the implicit vertical advection/diffusion routine |
16 |
|
|
C for each passive tracer. |
17 |
|
|
|
18 |
|
|
C !USES: =============================================================== |
19 |
|
|
IMPLICIT NONE |
20 |
|
|
#include "SIZE.h" |
21 |
|
|
#include "EEPARAMS.h" |
22 |
|
|
#include "PTRACERS_SIZE.h" |
23 |
|
|
#include "PTRACERS.h" |
24 |
|
|
#include "PARAMS.h" |
25 |
|
|
#include "GRID.h" |
26 |
|
|
#include "GAD.h" |
27 |
|
|
#include "DYNVARS.h" |
28 |
|
|
#ifdef ALLOW_AUTODIFF_TAMC |
29 |
|
|
# include "tamc.h" |
30 |
|
|
# include "tamc_keys.h" |
31 |
|
|
#endif |
32 |
|
|
|
33 |
|
|
C !INPUT PARAMETERS: =================================================== |
34 |
|
|
C bi,bj :: tile indices |
35 |
|
|
C myTime :: time in simulation |
36 |
|
|
C myIter :: iteration number in simulation |
37 |
|
|
C myThid :: thread number |
38 |
|
|
INTEGER bi,bj |
39 |
|
|
_RL myTime |
40 |
|
|
INTEGER myIter |
41 |
|
|
INTEGER myThid |
42 |
|
|
|
43 |
|
|
C !OUTPUT PARAMETERS: ================================================== |
44 |
|
|
C KappaRk :: vertical diffusion coefficient |
45 |
|
|
_RL kappaRk(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
46 |
|
|
|
47 |
|
|
#ifdef ALLOW_PTRACERS |
48 |
|
|
|
49 |
|
|
C !LOCAL VARIABLES: ==================================================== |
50 |
|
|
C iTracer :: tracer index |
51 |
|
|
INTEGER iTracer |
52 |
|
|
INTEGER iMin,iMax,jMin,jMax |
53 |
|
|
INTEGER GAD_TR |
54 |
mlosch |
1.4 |
INTEGER K |
55 |
jmc |
1.1 |
CEOP |
56 |
|
|
|
57 |
|
|
iMin=0 |
58 |
|
|
iMax=sNx+1 |
59 |
|
|
jMin=0 |
60 |
|
|
jMax=sNy+1 |
61 |
|
|
|
62 |
|
|
C Loop over tracers |
63 |
|
|
DO iTracer=1,PTRACERS_numInUse |
64 |
|
|
|
65 |
|
|
#ifdef ALLOW_AUTODIFF_TAMC |
66 |
|
|
act0 = iTracer - 1 |
67 |
|
|
max0 = PTRACERS_num |
68 |
|
|
act1 = bi - myBxLo(myThid) |
69 |
|
|
max1 = myBxHi(myThid) - myBxLo(myThid) + 1 |
70 |
|
|
act2 = bj - myByLo(myThid) |
71 |
|
|
max2 = myByHi(myThid) - myByLo(myThid) + 1 |
72 |
|
|
act3 = myThid - 1 |
73 |
|
|
max3 = nTx*nTy |
74 |
|
|
act4 = ikey_dynamics - 1 |
75 |
|
|
iptrkey = (act0 + 1) |
76 |
|
|
& + act1*max0 |
77 |
|
|
& + act2*max0*max1 |
78 |
|
|
& + act3*max0*max1*max2 |
79 |
|
|
& + act4*max0*max1*max2*max3 |
80 |
|
|
#endif /* ALLOW_AUTODIFF_TAMC */ |
81 |
|
|
|
82 |
|
|
GAD_TR = GAD_TR1 + iTracer - 1 |
83 |
|
|
IF ( implicitDiffusion ) THEN |
84 |
|
|
CALL CALC_3D_DIFFUSIVITY( |
85 |
|
|
I bi,bj,iMin,iMax,jMin,jMax, |
86 |
|
|
I GAD_TR, |
87 |
|
|
I PTRACERS_useGMRedi(iTracer),PTRACERS_useKPP(iTracer), |
88 |
|
|
O kappaRk, |
89 |
|
|
I myThid) |
90 |
|
|
ENDIF |
91 |
|
|
|
92 |
|
|
#ifdef ALLOW_AUTODIFF_TAMC |
93 |
heimbach |
1.3 |
CADJ STORE kappaRk(:,:,:) = comlev1_bibj_ptracers, |
94 |
|
|
CADJ & key=iptrkey, byte=isbyte |
95 |
jmc |
1.1 |
CADJ STORE gPtr(:,:,:,bi,bj,iTracer) = comlev1_bibj_ptracers, |
96 |
|
|
CADJ & key=iptrkey, byte=isbyte |
97 |
|
|
#endif /* ALLOW_AUTODIFF_TAMC */ |
98 |
|
|
|
99 |
|
|
#ifdef INCLUDE_IMPLVERTADV_CODE |
100 |
jmc |
1.2 |
IF ( PTRACERS_ImplVertAdv(iTracer) ) THEN |
101 |
jmc |
1.1 |
|
102 |
|
|
CALL GAD_IMPLICIT_R( |
103 |
|
|
I PTRACERS_ImplVertAdv(iTracer), |
104 |
|
|
I PTRACERS_advScheme(iTracer), GAD_TR, |
105 |
|
|
I kappaRk, wVel, pTracer(1-Olx,1-Oly,1,1,1,iTracer), |
106 |
|
|
U gPtr(1-Olx,1-Oly,1,1,1,iTracer), |
107 |
|
|
I bi, bj, myTime, myIter, myThid ) |
108 |
|
|
|
109 |
|
|
ELSEIF ( implicitDiffusion ) THEN |
110 |
|
|
#else /* INCLUDE_IMPLVERTADV_CODE */ |
111 |
|
|
IF ( implicitDiffusion ) THEN |
112 |
|
|
#endif /* INCLUDE_IMPLVERTADV_CODE */ |
113 |
|
|
|
114 |
|
|
CALL IMPLDIFF( |
115 |
|
|
I bi, bj, iMin, iMax, jMin, jMax, |
116 |
jmc |
1.2 |
I GAD_TR, kappaRk, recip_HFacC, |
117 |
jmc |
1.1 |
U gPtr(1-Olx,1-Oly,1,1,1,iTracer), |
118 |
|
|
I myThid ) |
119 |
|
|
|
120 |
mlosch |
1.4 |
#ifdef ALLOW_OBCS |
121 |
|
|
C-- Apply open boundary conditions |
122 |
|
|
IF ( useOBCS ) THEN |
123 |
|
|
DO K=1,Nr |
124 |
|
|
CALL OBCS_APPLY_PTRACER( |
125 |
|
|
I bi, bj, K, iTracer, |
126 |
|
|
U gPtr(1-Olx,1-Oly,K,bi,bj,iTracer), |
127 |
|
|
I myThid ) |
128 |
|
|
ENDDO |
129 |
|
|
ENDIF |
130 |
|
|
#endif /* ALLOW_OBCS */ |
131 |
|
|
|
132 |
jmc |
1.1 |
ENDIF |
133 |
|
|
C End of tracer loop |
134 |
|
|
ENDDO |
135 |
|
|
|
136 |
|
|
#endif /* ALLOW_PTRACERS */ |
137 |
|
|
|
138 |
|
|
RETURN |
139 |
|
|
END |