/[MITgcm]/MITgcm/pkg/gchem/gchem_calc_tendency.F
ViewVC logotype

Annotation of /MITgcm/pkg/gchem/gchem_calc_tendency.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download)
Sun Nov 28 23:48:30 2004 UTC (19 years, 6 months ago) by mlosch
Branch: MAIN
CVS Tags: checkpoint56a_post
o GCHEM: finish reorganizating the package
  - forward_step calls GCHEM_CALC_TENDENDY, which computes gchemTendency
    (introduces another 3D-array for each passive tracer, but only if
    GCHEM_SEPARATE_FORCING is undefined. For GCHEM_SEPARATE_FORCING
    gchemTendency is not needed because the timestep is done separately)
  - gchemTendency is added to gPtr in GCHEM_FORCING_INT
  - GCHEM is now---more or less cleanly---separate from PTRACERS
  - to bo done: handling of surfaceForcingPtr that is needed for KPP not
    so clear to me how that should be done in a general way.

1 mlosch 1.1 C $Header: $
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     Cml iMin = 1-OLx+2
84     Cml iMax = sNx+OLx-1
85     Cml jMin = 1-OLy+2
86     Cml jMax = sNy+OLy-1
87     iMin = 1
88     iMax = sNx
89     jMin = 1
90     jMax = sNy
91     C DO iTracer = 1, PTRACER_NumInUse
92     C DO K = 1, Nr
93     C DO J = 1-Oly, sNy+Oly
94     C DO I = 1-Olx, sNx+Olx
95     C gchemTendency(I,J,K,bi,bj,iTracer) = your specific model
96     C ENDDO
97     C ENDDO
98     C ENDDO
99     C ENDDO
100    
101     #ifdef ALLOW_CFC
102     ccccccccccccccccccccccccc
103     c chemical forcing c
104     ccccccccccccccccccccccccc
105     ccccccccccccccccccccccccccc CFC cccccccccccccccccccccccccccccccc
106     c
107     K = 1
108     CML DO kLoc=1,Nr
109     CML DO j=1-OLy,sNy+OLy
110     CML DO i=1-OLx,sNx+OLx
111     CML PtrLoc (I,J,kLoc) = Ptracer(I,J,kLoc,bi,bj,1)
112     CML gPtrLoc(I,J,kLoc) = gPtr(I,J,kLoc,bi,bj,1)
113     CML ENDDO
114     CML ENDDO
115     CML ENDDO
116     CML call CFC11_Forcing( PtrLoc, gPtrLoc,
117     CML & bi,bj,imin,imax,jmin,jmax,
118     CML & myIter,myTime,myThid)
119     CML DO kLoc=1,Nr
120     CML DO j=1-OLy,sNy+OLy
121     CML DO i=1-OLx,sNx+OLx
122     CML Ptracer(I,J,kLoc,bi,bj,1) = PtrLoc (I,J,kLoc)
123     CML gPtr(I,J,kLoc,bi,bj,1) = gPtrLoc(I,J,kLoc)
124     CML ENDDO
125     CML ENDDO
126     CML ENDDO
127     CML ENDIF
128     CML if (iTracer.eq.2.and.k.eq.1) THEN
129     CML DO kLoc=1,Nr
130     CML DO j=1-OLy,sNy+OLy
131     CML DO i=1-OLx,sNx+OLx
132     CML PtrLoc (I,J,kLoc) = Ptracer(I,J,kLoc,bi,bj,2)
133     CML gPtrLoc(I,J,kLoc) = gPtr(I,J,kLoc,bi,bj,2)
134     CML ENDDO
135     CML ENDDO
136     CML ENDDO
137     CML call CFC12_Forcing( PtrLoc, gPtrLoc,
138     CML & bi,bj,imin,imax,jmin,jmax,
139     CML & myIter,myTime,myThid)
140     CML DO kLoc=1,Nr
141     CML DO j=1-OLy,sNy+OLy
142     CML DO i=1-OLx,sNx+OLx
143     CML Ptracer(I,J,kLoc,bi,bj,2) = PtrLoc (I,J,kLoc)
144     CML gPtr(I,J,kLoc,bi,bj,2) = gPtrLoc(I,J,kLoc)
145     CML ENDDO
146     CML ENDDO
147     CML ENDDO
148     CML ENDIF
149     CALL CFC11_FORCING( Ptracer (1-Olx,1-Oly,1,bi,bj,1),
150     & gchemTendency(1-Olx,1-Oly,1,bi,bj,1),
151     & bi, bj, imin, imax, jmin, jmax,
152     & myIter, myTime, myThid )
153     CALL CFC12_FORCING( Ptracer (1-Olx,1-Oly,1,bi,bj,2),
154     & gchemTendency(1-Olx,1-Oly,1,bi,bj,2),
155     & bi, bj, imin, imax, jmin, jmax,
156     & myIter, myTime, myThid )
157    
158     cccccccccccccccccccccccccc END CFC cccccccccccccccccccccccccccccccccc
159     #endif /* ALLOW_CFC */
160     C end of tile-loops
161     ENDDO
162     ENDDO
163     # endif /* GCHEM_SEPARATE_FORCING */
164     #endif /* ALLOW_GCHEM */
165    
166     RETURN
167     END

  ViewVC Help
Powered by ViewVC 1.1.22