1 |
C $Header: /u/gcmpack/MITgcm/pkg/gchem/gchem_calc_tendency.F,v 1.1 2004/11/28 23:48:30 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.h" |
31 |
#include "GCHEM.h" |
32 |
#include "GCHEM_FIELDS.h" |
33 |
|
34 |
C !INPUT PARAMETERS: =================================================== |
35 |
C myThid :: thread number |
36 |
C myIter :: current timestep |
37 |
C myTime :: current time |
38 |
INTEGER myThid, myIter |
39 |
_RL myTime |
40 |
|
41 |
#ifdef ALLOW_GCHEM |
42 |
# ifndef GCHEM_SEPARATE_FORCING |
43 |
C !LOCAL VARIABLES: ==================================================== |
44 |
C i,j :: loop indices |
45 |
C iTracer :: ptracer number |
46 |
C bi,bj :: tile indices |
47 |
C k :: vertical level |
48 |
INTEGER i,j |
49 |
INTEGER niter |
50 |
INTEGER iTracer |
51 |
INTEGER bi,bj,imin,imax,jmin,jmax,k |
52 |
#ifdef ALLOW_CFC |
53 |
INTEGER kLoc |
54 |
_RL PtrLoc(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr) |
55 |
_RL gPtrLoc(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr) |
56 |
#endif /* ALLOW_CFC */ |
57 |
CEOP |
58 |
|
59 |
C gchemTendency is re-initialized here |
60 |
DO iTracer = 1, PTRACERS_numInUse |
61 |
DO bj=myByLo(myThid),myByHi(myThid) |
62 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
63 |
DO K = 1, Nr |
64 |
DO J = 1-Oly, sNy+Oly |
65 |
DO I = 1-Olx, sNx+Olx |
66 |
gchemTendency(I,J,K,bi,bj,iTracer) = 0. _d 0 |
67 |
ENDDO |
68 |
ENDDO |
69 |
ENDDO |
70 |
ENDDO |
71 |
ENDDO |
72 |
ENDDO |
73 |
C |
74 |
C Here is the place for code to compute bio-geochemical |
75 |
C tendency terms (sometimes referred to as source-minus-sink |
76 |
C terms). The tendencies are stored on gchemTendency, as show |
77 |
C in the CFC-example. |
78 |
C |
79 |
C loop over tiles |
80 |
DO bj=myByLo(myThid),myByHi(myThid) |
81 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
82 |
C define horizontal loop ranges |
83 |
iMin = 1 |
84 |
iMax = sNx |
85 |
jMin = 1 |
86 |
jMax = sNy |
87 |
C DO iTracer = 1, PTRACER_NumInUse |
88 |
C DO K = 1, Nr |
89 |
C DO J = 1-Oly, sNy+Oly |
90 |
C DO I = 1-Olx, sNx+Olx |
91 |
C gchemTendency(I,J,K,bi,bj,iTracer) = your specific model |
92 |
C ENDDO |
93 |
C ENDDO |
94 |
C ENDDO |
95 |
C ENDDO |
96 |
|
97 |
#ifdef ALLOW_CFC |
98 |
ccccccccccccccccccccccccc |
99 |
c chemical forcing c |
100 |
ccccccccccccccccccccccccc |
101 |
ccccccccccccccccccccccccccc CFC cccccccccccccccccccccccccccccccc |
102 |
c |
103 |
K = 1 |
104 |
CALL CFC11_FORCING( Ptracer (1-Olx,1-Oly,1,bi,bj,1), |
105 |
& gchemTendency(1-Olx,1-Oly,1,bi,bj,1), |
106 |
& bi, bj, imin, imax, jmin, jmax, |
107 |
& myIter, myTime, myThid ) |
108 |
CALL CFC12_FORCING( Ptracer (1-Olx,1-Oly,1,bi,bj,2), |
109 |
& gchemTendency(1-Olx,1-Oly,1,bi,bj,2), |
110 |
& bi, bj, imin, imax, jmin, jmax, |
111 |
& myIter, myTime, myThid ) |
112 |
|
113 |
cccccccccccccccccccccccccc END CFC cccccccccccccccccccccccccccccccccc |
114 |
#endif /* ALLOW_CFC */ |
115 |
C end of tile-loops |
116 |
ENDDO |
117 |
ENDDO |
118 |
# endif /* GCHEM_SEPARATE_FORCING */ |
119 |
#endif /* ALLOW_GCHEM */ |
120 |
|
121 |
RETURN |
122 |
END |