1 |
jahn |
1.2 |
C $Header: /u/gcmpack/MITgcm_contrib/darwin2/pkg/quota/quota_cons.F,v 1.1 2011/04/13 18:56:26 jahn Exp $ |
2 |
jahn |
1.1 |
C $Name: $ |
3 |
|
|
|
4 |
|
|
#include "CPP_OPTIONS.h" |
5 |
|
|
#include "PTRACERS_OPTIONS.h" |
6 |
|
|
#include "DARWIN_OPTIONS.h" |
7 |
|
|
|
8 |
|
|
#ifdef ALLOW_PTRACERS |
9 |
|
|
#ifdef ALLOW_DARWIN |
10 |
|
|
#ifdef ALLOW_QUOTA |
11 |
|
|
|
12 |
|
|
c============================================================= |
13 |
|
|
c subroutine DARWIN_cons |
14 |
|
|
c check conservation in the model |
15 |
|
|
C============================================================== |
16 |
|
|
SUBROUTINE QUOTA_Cons( |
17 |
|
|
& myTime,myIter,myThid) |
18 |
|
|
#include "SIZE.h" |
19 |
|
|
#include "EEPARAMS.h" |
20 |
|
|
#include "PARAMS.h" |
21 |
|
|
#include "GRID.h" |
22 |
|
|
#include "PTRACERS_SIZE.h" |
23 |
|
|
#include "PTRACERS_PARAMS.h" |
24 |
|
|
#include "PTRACERS_FIELDS.h" |
25 |
|
|
#include "GCHEM.h" |
26 |
|
|
|
27 |
|
|
#include "QUOTA_SIZE.h" |
28 |
|
|
#include "QUOTA.h" |
29 |
|
|
#include "DARWIN_IO.h" |
30 |
|
|
|
31 |
|
|
#include "DYNVARS.h" |
32 |
|
|
|
33 |
|
|
C === Global variables === |
34 |
|
|
_RL myTime |
35 |
|
|
INTEGER myIter |
36 |
|
|
INTEGER myThid |
37 |
|
|
|
38 |
|
|
#ifdef CHECK_CONS |
39 |
|
|
C============== Local variables ============================================ |
40 |
|
|
_RL tmptotC |
41 |
|
|
_RL tmptotN |
42 |
|
|
_RL tmptotP |
43 |
|
|
_RL tmptotF |
44 |
|
|
_RL tmptotS |
45 |
|
|
_RL vol, voltot |
46 |
|
|
|
47 |
|
|
INTEGER i,j,k,bi,bj |
48 |
|
|
INTEGER ii, jp, ko, npnum |
49 |
|
|
|
50 |
|
|
_BEGIN_MASTER(myThid) |
51 |
|
|
c |
52 |
|
|
tmptotC=0. _d 0 |
53 |
|
|
tmptotN=0. _d 0 |
54 |
|
|
#ifdef PQUOTA |
55 |
|
|
tmptotP=0. _d 0 |
56 |
|
|
#endif |
57 |
|
|
#ifdef FQUOTA |
58 |
|
|
tmptotF=0. _d 0 |
59 |
|
|
#endif |
60 |
|
|
#ifdef SQUOTA |
61 |
|
|
tmptotS=0. _d 0 |
62 |
|
|
#endif |
63 |
|
|
|
64 |
|
|
voltot =0. _d 0 |
65 |
|
|
|
66 |
|
|
DO bj=myByLo(myThid),myByHi(myThid) |
67 |
|
|
DO bi=myBxLo(myThid),myBxHi(myThid) |
68 |
|
|
|
69 |
|
|
DO i=1,sNx |
70 |
|
|
DO j=1,sNy |
71 |
|
|
do k= 1, NR |
72 |
|
|
c----------------------------------------------------------------- |
73 |
|
|
vol=rA(i,j,bi,bj)*drF(k) |
74 |
|
|
voltot=voltot+vol |
75 |
|
|
c................................................................. |
76 |
|
|
c Carbon budget |
77 |
|
|
tmptotC=tmptotC+Ptracer(i,j,k,bi,bj,iDIC)*vol !DIC |
78 |
|
|
do jp=1,npmax ! loop Plankton |
79 |
|
|
npnum=ibiomass-1 + (iCarb-1)*npmax + jp |
80 |
|
|
tmptotC=tmptotC+Ptracer(i,j,k,bi,bj,npnum)*vol !C biomass |
81 |
|
|
enddo |
82 |
|
|
do ko=1,komax ! loop OM |
83 |
|
|
npnum=iorgmat-1 + (iCarb-1)*komax + ko |
84 |
|
|
tmptotC=tmptotC+Ptracer(i,j,k,bi,bj,npnum)*vol !DOC/POC |
85 |
|
|
enddo |
86 |
|
|
c................................................................. |
87 |
|
|
c Nitrogen budget |
88 |
|
|
tmptotN=tmptotN+Ptracer(i,j,k,bi,bj,iNO3)*vol !NO3 |
89 |
|
|
#ifdef AMMON |
90 |
|
|
tmptotN=tmptotN+Ptracer(i,j,k,bi,bj,iNH4)*vol !NH4 |
91 |
|
|
#endif |
92 |
|
|
#ifdef NITRITE |
93 |
|
|
tmptotN=tmptotN+Ptracer(i,j,k,bi,bj,iNO2)*vol !NO2 |
94 |
|
|
#endif |
95 |
|
|
do jp=1,npmax ! loop Plankton |
96 |
|
|
npnum=ibiomass-1 + (iNitr-1)*npmax + jp |
97 |
|
|
tmptotN=tmptotN+Ptracer(i,j,k,bi,bj,npnum)*vol !N biomass |
98 |
|
|
enddo |
99 |
|
|
do ko=1,komax ! loop OM |
100 |
|
|
npnum=iorgmat-1 + (iNitr-1)*komax + ko |
101 |
|
|
tmptotN=tmptotN+Ptracer(i,j,k,bi,bj,npnum)*vol !DON/PON |
102 |
|
|
enddo |
103 |
|
|
c................................................................. |
104 |
|
|
#ifdef PQUOTA |
105 |
|
|
c Phosphorous budget |
106 |
|
|
tmptotP=tmptotP+Ptracer(i,j,k,bi,bj,iPO4)*vol !PO4 |
107 |
|
|
do jp=1,npmax ! loop Plankton |
108 |
|
|
npnum=ibiomass-1 + (iPhos-1)*npmax + jp |
109 |
|
|
tmptotP=tmptotP+Ptracer(i,j,k,bi,bj,npnum)*vol !P biomass |
110 |
|
|
enddo |
111 |
|
|
do ko=1,komax ! loop OM |
112 |
|
|
npnum=iorgmat-1 + (iPhos-1)*komax + ko |
113 |
|
|
tmptotP=tmptotP+Ptracer(i,j,k,bi,bj,npnum)*vol !DOP/POP |
114 |
|
|
enddo |
115 |
|
|
#endif |
116 |
|
|
c................................................................. |
117 |
|
|
#ifdef FQUOTA |
118 |
|
|
c Iron budget |
119 |
|
|
tmptotF=tmptotF+Ptracer(i,j,k,bi,bj,iFeT)*vol !Fe |
120 |
|
|
do jp=1,npmax ! loop Plankton |
121 |
|
|
npnum=ibiomass-1 + (iIron-1)*npmax + jp |
122 |
|
|
tmptotF=tmptotF+Ptracer(i,j,k,bi,bj,npnum)*vol !Fe biomass |
123 |
|
|
enddo |
124 |
|
|
do ko=1,komax ! loop OM |
125 |
|
|
npnum=iorgmat-1 + (iIron-1)*komax + ko |
126 |
|
|
tmptotF=tmptotF+Ptracer(i,j,k,bi,bj,npnum)*vol !DOFe/POFe |
127 |
|
|
enddo |
128 |
|
|
#endif |
129 |
|
|
c................................................................. |
130 |
|
|
#ifdef SQUOTA |
131 |
|
|
c Silica budget |
132 |
|
|
tmptotS=tmptotS+Ptracer(i,j,k,bi,bj,iSi)*vol !Si |
133 |
|
|
do jp=1,npmax ! loop Plankton |
134 |
|
|
npnum=ibiomass-1 + (iSili-1)*npmax + jp |
135 |
|
|
tmptotF=tmptotF+Ptracer(i,j,k,bi,bj,npnum)*vol !Si biomass |
136 |
|
|
enddo |
137 |
|
|
npnum=iorgmat-1 + (iSili-1)*komax + 2 |
138 |
|
|
tmptotS=tmptotS+Ptracer(i,j,k,bi,bj,npnum)*vol !POSi |
139 |
|
|
#endif |
140 |
|
|
c------------------------------------------------------------ |
141 |
|
|
enddo |
142 |
|
|
ENDDO |
143 |
|
|
ENDDO |
144 |
|
|
ENDDO |
145 |
|
|
ENDDO |
146 |
|
|
|
147 |
|
|
_GLOBAL_SUM_RL(tmptotC,myThid) |
148 |
|
|
print*,'tmptotC',tmptotC |
149 |
jahn |
1.2 |
write(DAR_cons_unitC,*), myIter, tmptotC, tmptotC/voltot |
150 |
jahn |
1.1 |
_GLOBAL_SUM_RL(tmptotN,myThid) |
151 |
|
|
print*,'tmptotN',tmptotN |
152 |
jahn |
1.2 |
write(DAR_cons_unitN,*), myIter, tmptotN, tmptotN/voltot |
153 |
jahn |
1.1 |
#ifdef PQUOTA |
154 |
|
|
_GLOBAL_SUM_RL(tmptotP,myThid) |
155 |
|
|
print*,'tmptotP',tmptotP |
156 |
jahn |
1.2 |
write(DAR_cons_unitP,*), myIter, tmptotP, tmptotP/voltot |
157 |
jahn |
1.1 |
#endif |
158 |
|
|
#ifdef FQUOTA |
159 |
|
|
_GLOBAL_SUM_RL(tmptotF,myThid) |
160 |
|
|
print*,'tmptotF',tmptotF |
161 |
jahn |
1.2 |
write(DAR_cons_unitF,*), myIter, tmptotF, tmptotF/voltot |
162 |
jahn |
1.1 |
#endif |
163 |
|
|
#ifdef SQUOTA |
164 |
|
|
_GLOBAL_SUM_RL(tmptotS,myThid) |
165 |
|
|
print*,'tmptotS',tmptotS |
166 |
jahn |
1.2 |
write(DAR_cons_unitS,*), myIter, tmptotS, tmptotS/voltot |
167 |
jahn |
1.1 |
#endif |
168 |
|
|
print*,'-----------------------------------' |
169 |
|
|
_END_MASTER(myThid) |
170 |
|
|
|
171 |
|
|
C-- Everyone else must wait |
172 |
|
|
_BARRIER |
173 |
|
|
#endif |
174 |
|
|
c |
175 |
|
|
c ----------------------------------------------------- |
176 |
|
|
RETURN |
177 |
|
|
END |
178 |
|
|
#endif /*ALLOW_QUOTA*/ |
179 |
|
|
#endif /*DARWIN*/ |
180 |
|
|
#endif /*ALLOW_PTRACERS*/ |
181 |
|
|
|
182 |
|
|
C============================================================================ |