1 |
C $Header: /u/gcmpack/MITgcm/pkg/gchem/gchem_calc_tendency.F,v 1.2 2004/11/29 03:34:55 mlosch Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "GCHEM_OPTIONS.h" |
5 |
|
6 |
CBOP |
7 |
C !ROUTINE: GCHEM_CALC_TENDENCY |
8 |
|
9 |
C !INTERFACE: ========================================================== |
10 |
SUBROUTINE GCHEM_CALC_TENDENCY( |
11 |
I myTime, myIter, myThid ) |
12 |
|
13 |
C !DESCRIPTION: |
14 |
C In the case of GCHEM_SEPARATE_FORCING not defined, |
15 |
C this subroutine computes the tracer tendencies due to a |
16 |
C bio-geogchemistry or ecosystem model and stores them on an array |
17 |
C gchemTendency, that will be incorporated into regular timestepping in |
18 |
C in ptracers_intergrate.F |
19 |
C The current example uses the CFC package, but his is meant to |
20 |
C be replaced by anything that the user provides. |
21 |
|
22 |
C !USES: =============================================================== |
23 |
IMPLICIT NONE |
24 |
#include "SIZE.h" |
25 |
#include "GRID.h" |
26 |
#include "DYNVARS.h" |
27 |
#include "EEPARAMS.h" |
28 |
#include "PARAMS.h" |
29 |
#include "PTRACERS_SIZE.h" |
30 |
#include "PTRACERS_PARAMS.h" |
31 |
#include "PTRACERS_FIELDS.h" |
32 |
#include "GCHEM.h" |
33 |
#include "GCHEM_FIELDS.h" |
34 |
|
35 |
C !INPUT PARAMETERS: =================================================== |
36 |
C myThid :: thread number |
37 |
C myIter :: current timestep |
38 |
C myTime :: current time |
39 |
INTEGER myThid, myIter |
40 |
_RL myTime |
41 |
|
42 |
#ifdef ALLOW_GCHEM |
43 |
# ifndef GCHEM_SEPARATE_FORCING |
44 |
C !LOCAL VARIABLES: ==================================================== |
45 |
C i,j :: loop indices |
46 |
C iTracer :: ptracer number |
47 |
C bi,bj :: tile indices |
48 |
C k :: vertical level |
49 |
INTEGER i,j |
50 |
INTEGER niter |
51 |
INTEGER iTracer |
52 |
INTEGER bi,bj,imin,imax,jmin,jmax,k |
53 |
#ifdef ALLOW_CFC |
54 |
INTEGER kLoc |
55 |
_RL PtrLoc(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr) |
56 |
_RL gPtrLoc(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr) |
57 |
#endif /* ALLOW_CFC */ |
58 |
CEOP |
59 |
|
60 |
C gchemTendency is re-initialized here |
61 |
DO iTracer = 1, PTRACERS_numInUse |
62 |
DO bj=myByLo(myThid),myByHi(myThid) |
63 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
64 |
DO K = 1, Nr |
65 |
DO J = 1-Oly, sNy+Oly |
66 |
DO I = 1-Olx, sNx+Olx |
67 |
gchemTendency(I,J,K,bi,bj,iTracer) = 0. _d 0 |
68 |
ENDDO |
69 |
ENDDO |
70 |
ENDDO |
71 |
ENDDO |
72 |
ENDDO |
73 |
ENDDO |
74 |
C |
75 |
C Here is the place for code to compute bio-geochemical |
76 |
C tendency terms (sometimes referred to as source-minus-sink |
77 |
C terms). The tendencies are stored on gchemTendency, as show |
78 |
C in the CFC-example. |
79 |
C |
80 |
C loop over tiles |
81 |
DO bj=myByLo(myThid),myByHi(myThid) |
82 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
83 |
C define horizontal loop ranges |
84 |
iMin = 1 |
85 |
iMax = sNx |
86 |
jMin = 1 |
87 |
jMax = sNy |
88 |
C DO iTracer = 1, PTRACER_NumInUse |
89 |
C DO K = 1, Nr |
90 |
C DO J = 1-Oly, sNy+Oly |
91 |
C DO I = 1-Olx, sNx+Olx |
92 |
C gchemTendency(I,J,K,bi,bj,iTracer) = your specific model |
93 |
C ENDDO |
94 |
C ENDDO |
95 |
C ENDDO |
96 |
C ENDDO |
97 |
|
98 |
#ifdef ALLOW_CFC |
99 |
ccccccccccccccccccccccccc |
100 |
c chemical forcing c |
101 |
ccccccccccccccccccccccccc |
102 |
ccccccccccccccccccccccccccc CFC cccccccccccccccccccccccccccccccc |
103 |
c |
104 |
K = 1 |
105 |
CALL CFC11_FORCING( Ptracer (1-Olx,1-Oly,1,bi,bj,1), |
106 |
& gchemTendency(1-Olx,1-Oly,1,bi,bj,1), |
107 |
& bi, bj, imin, imax, jmin, jmax, |
108 |
& myIter, myTime, myThid ) |
109 |
CALL CFC12_FORCING( Ptracer (1-Olx,1-Oly,1,bi,bj,2), |
110 |
& gchemTendency(1-Olx,1-Oly,1,bi,bj,2), |
111 |
& bi, bj, imin, imax, jmin, jmax, |
112 |
& myIter, myTime, myThid ) |
113 |
|
114 |
cccccccccccccccccccccccccc END CFC cccccccccccccccccccccccccccccccccc |
115 |
#endif /* ALLOW_CFC */ |
116 |
C end of tile-loops |
117 |
ENDDO |
118 |
ENDDO |
119 |
# endif /* GCHEM_SEPARATE_FORCING */ |
120 |
#endif /* ALLOW_GCHEM */ |
121 |
|
122 |
RETURN |
123 |
END |