1 |
C $Header: /u/gcmpack/MITgcm/pkg/ptracers/ptracers_apply_forcing.F,v 1.3 2016/08/23 18:29:49 jahn Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "PTRACERS_OPTIONS.h" |
5 |
|
6 |
CBOP |
7 |
C !ROUTINE: PTRACERS_APPLY_FORCING |
8 |
|
9 |
C !INTERFACE: ========================================================== |
10 |
SUBROUTINE PTRACERS_APPLY_FORCING( |
11 |
U gPtracer, |
12 |
I surfForcPtr, |
13 |
I iMin,iMax,jMin,jMax, k, bi, bj, |
14 |
I iTracer, myTime, myIter, myThid ) |
15 |
|
16 |
C !DESCRIPTION: |
17 |
C Apply passive tracer forcing, i.e., sources and sinks of tracer, |
18 |
C by adding forcing terms to the tendency array |
19 |
|
20 |
C !USES: =============================================================== |
21 |
IMPLICIT NONE |
22 |
#include "SIZE.h" |
23 |
#include "EEPARAMS.h" |
24 |
#include "PARAMS.h" |
25 |
#include "GRID.h" |
26 |
#include "PTRACERS_SIZE.h" |
27 |
#include "PTRACERS_PARAMS.h" |
28 |
#include "PTRACERS_FIELDS.h" |
29 |
|
30 |
C !INPUT PARAMETERS: =================================================== |
31 |
C gPtracer :: the tendency array |
32 |
C surfForcPtr :: surface forcing term |
33 |
C iMin iMax jMin jMax :: working range of tile for applying forcing |
34 |
C k :: vertical level number |
35 |
C bi,bj :: tile indices |
36 |
C iTracer :: tracer number |
37 |
C myIter :: time-step number |
38 |
C myTime :: model time |
39 |
C myThid :: thread number |
40 |
_RL gPtracer (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
41 |
_RL surfForcPtr(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
42 |
INTEGER iMin,iMax,jMin,jMax |
43 |
INTEGER k, bi,bj, iTracer |
44 |
_RL myTime |
45 |
INTEGER myIter |
46 |
INTEGER myThid |
47 |
|
48 |
C !OUTPUT PARAMETERS: ================================================== |
49 |
C gPtracer :: updates tendency array |
50 |
|
51 |
#ifdef ALLOW_PTRACERS |
52 |
|
53 |
C !LOCAL VARIABLES: ==================================================== |
54 |
C i,j :: loop indices |
55 |
INTEGER i,j |
56 |
C number of surface interface layer |
57 |
INTEGER kSurface |
58 |
CEOP |
59 |
|
60 |
IF ( usingPCoords ) THEN |
61 |
kSurface = Nr |
62 |
ELSE |
63 |
kSurface = 1 |
64 |
ENDIF |
65 |
|
66 |
C-- Surface forcing term surfForcPtr is previously computed by |
67 |
C PTRACERS_FORCING_SURF (and stored as surfaceForcingPTr) |
68 |
C because it is needed by KPP_TRANSPORT_PTR. |
69 |
|
70 |
#ifdef ALLOW_GCHEM |
71 |
IF ( useGCHEM ) THEN |
72 |
CALL GCHEM_ADD_TENDENCY( |
73 |
U gPtracer, |
74 |
I iMin,iMax,jMin,jMax, k, bi, bj, |
75 |
I iTracer, myTime, myIter, myThid ) |
76 |
ENDIF |
77 |
#endif /* ALLOW_GCHEM */ |
78 |
|
79 |
IF ( k .EQ. kSurface ) THEN |
80 |
DO j=jMin,jMax |
81 |
DO i=iMin,iMax |
82 |
gPtracer(i,j) = gPtracer(i,j) |
83 |
& + surfForcPtr(i,j) |
84 |
& *recip_drF(k)*recip_hFacC(i,j,k,bi,bj) |
85 |
ENDDO |
86 |
ENDDO |
87 |
ELSE |
88 |
C- Case of age-tracer: in the interior, set aging tendency to one: |
89 |
DO j=jMin,jMax |
90 |
DO i=iMin,iMax |
91 |
gPtracer(i,j) = gPtracer(i,j) |
92 |
& + 1. _d 0 * maskC(i,j,k,bi,bj) |
93 |
ENDDO |
94 |
ENDDO |
95 |
ENDIF |
96 |
|
97 |
IF (PTRACERS_linFSConserve(iTracer)) THEN |
98 |
IF (k .EQ. kSurface) THEN |
99 |
DO j=0,sNy+1 |
100 |
DO i=0,sNx+1 |
101 |
gPtracer(i,j) = gPtracer(i,j) |
102 |
& +meanSurfCorPTr(iTracer)*recip_drF(k) |
103 |
& *_recip_hFacC(i,j,k,bi,bj) |
104 |
ENDDO |
105 |
ENDDO |
106 |
ENDIF |
107 |
ENDIF |
108 |
|
109 |
#ifdef ALLOW_RBCS |
110 |
IF ( useRBCS ) THEN |
111 |
CALL RBCS_ADD_TENDENCY( |
112 |
U gPtracer, |
113 |
I k, bi, bj, iTracer+2, |
114 |
I myTime, myIter, myThid ) |
115 |
ENDIF |
116 |
#endif /* ALLOW_RBCS */ |
117 |
|
118 |
#endif /* ALLOW_PTRACERS */ |
119 |
|
120 |
RETURN |
121 |
END |