1 |
C $Header: /u/gcmpack/MITgcm_contrib/bling/pkg/bling_main.F,v 1.3 2016/02/28 21:49:24 mmazloff Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "BLING_OPTIONS.h" |
5 |
|
6 |
CBOP |
7 |
subroutine BLING_MAIN( PTR_DIC, PTR_ALK, PTR_O2, PTR_NO3, |
8 |
& PTR_PO4, PTR_FE, PTR_DON, PTR_DOP, |
9 |
#ifdef ADVECT_PHYTO |
10 |
& PTR_PHY, |
11 |
#endif |
12 |
& bi, bj, imin, imax, jmin, jmax, |
13 |
& myIter, myTime, myThid) |
14 |
|
15 |
C ========================================================== |
16 |
C | subroutine bling_main |
17 |
C | o updates all the tracers for the effects of air-sea exchange, |
18 |
C | biological production, and remineralization. |
19 |
C ========================================================== |
20 |
|
21 |
implicit none |
22 |
|
23 |
C === Global variables === |
24 |
#include "SIZE.h" |
25 |
#include "EEPARAMS.h" |
26 |
#include "PARAMS.h" |
27 |
#include "GRID.h" |
28 |
#include "BLING_VARS.h" |
29 |
#include "PTRACERS_SIZE.h" |
30 |
#include "PTRACERS_PARAMS.h" |
31 |
#ifdef ALLOW_EXF |
32 |
# include "EXF_FIELDS.h" |
33 |
#endif |
34 |
#ifdef ALLOW_AUTODIFF |
35 |
# include "tamc.h" |
36 |
#endif |
37 |
|
38 |
C === Routine arguments === |
39 |
C bi,bj :: tile indices |
40 |
C iMin,iMax :: computation domain: 1rst index range |
41 |
C jMin,jMax :: computation domain: 2nd index range |
42 |
C myTime :: current time |
43 |
C myIter :: current timestep |
44 |
C myThid :: thread Id. number |
45 |
INTEGER bi, bj, imin, imax, jmin, jmax |
46 |
_RL myTime |
47 |
INTEGER myIter |
48 |
INTEGER myThid |
49 |
C === Input === |
50 |
C PTR_DIC :: dissolved inorganic carbon |
51 |
C PTR_ALK :: alkalinity |
52 |
C PTR_NO3 :: nitrate concentration |
53 |
C PTR_PO4 :: phosphate concentration |
54 |
C PTR_DON :: dissolved organic nitrogen concentration |
55 |
C PTR_DOP :: dissolved organic phosphorus concentration |
56 |
C PTR_O2 :: oxygen concentration |
57 |
C PTR_FE :: iron concentration |
58 |
C PTR_PHY :: total phytoplankton biomass |
59 |
_RL PTR_DIC(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
60 |
_RL PTR_ALK(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
61 |
_RL PTR_NO3(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
62 |
_RL PTR_PO4(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
63 |
_RL PTR_FE (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
64 |
_RL PTR_O2 (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
65 |
_RL PTR_DON(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
66 |
_RL PTR_DOP(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
67 |
#ifdef ADVECT_PHYTO |
68 |
_RL PTR_PHY(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
69 |
#endif |
70 |
|
71 |
C === Local variables === |
72 |
C i,j,k :: loop indices |
73 |
C G_xx :: tendency term for the tracers |
74 |
C surf_DIC :: tendency of DIC due to air-sea exchange |
75 |
C surf_O2 :: tendency of O2 due to air-sea exchange |
76 |
C runoff_bgc :: tendency due to river runoff |
77 |
|
78 |
INTEGER i,j,k |
79 |
_RL G_DIC(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
80 |
_RL G_ALK(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
81 |
_RL G_NO3(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
82 |
_RL G_PO4(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
83 |
_RL G_FE (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
84 |
_RL G_O2 (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
85 |
_RL G_DON(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
86 |
_RL G_DOP(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
87 |
_RL G_CaCO3(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
88 |
#ifdef ADVECT_PHYTO |
89 |
_RL G_PHY(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
90 |
#endif |
91 |
_RL bio_DIC(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
92 |
_RL surf_DIC(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
93 |
_RL surf_O2(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
94 |
_RL irr_eff(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
95 |
_RL mld(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
96 |
cxx _RL runoff_bgc(1-OLx:sNx+OLx,1-OLy:sNy+OLy,PTRACERS_num) |
97 |
_RL runoff_bgc(1-OLx:sNx+OLx,1-OLy:sNy+OLy,8) |
98 |
CEOP |
99 |
|
100 |
c----------------------------------------------------------- |
101 |
c Initialize local variables |
102 |
|
103 |
DO j=jmin,jmax |
104 |
DO i=imin,imax |
105 |
DO k=1,Nr |
106 |
G_DIC(i,j,k) = 0. _d 0 |
107 |
G_ALK(i,j,k) = 0. _d 0 |
108 |
G_NO3(i,j,k) = 0. _d 0 |
109 |
G_PO4(i,j,k) = 0. _d 0 |
110 |
G_FE(i,j,k) = 0. _d 0 |
111 |
G_O2(i,j,k) = 0. _d 0 |
112 |
G_DON(i,j,k) = 0. _d 0 |
113 |
G_DOP(i,j,k) = 0. _d 0 |
114 |
G_CaCO3(i,j,k) = 0. _d 0 |
115 |
#ifdef ADVECT_PHYTO |
116 |
G_PHY(i,j,k) = 0. _d 0 |
117 |
#endif |
118 |
irr_eff(i,j,k) = 0. _d 0 |
119 |
ENDDO |
120 |
cxx DO k=1,PTRACERS_num |
121 |
DO k=1,8 |
122 |
runoff_bgc(i,j,k) = 0. _d 0 |
123 |
ENDDO |
124 |
bio_DIC(i,j,k) = 0. _d 0 |
125 |
surf_DIC(i,j) = 0. _d 0 |
126 |
surf_O2(i,j) = 0. _d 0 |
127 |
mld(i,j) = 0. _d 0 |
128 |
ENDDO |
129 |
ENDDO |
130 |
|
131 |
c----------------------------------------------------------- |
132 |
c carbon and oxygen air-sea interaction |
133 |
CALL BLING_AIRSEAFLUX( |
134 |
I PTR_DIC, PTR_ALK, PTR_O2, |
135 |
I PTR_NO3, PTR_PO4, |
136 |
U surf_DIC, surf_O2, |
137 |
I bi, bj, imin, imax, jmin, jmax, |
138 |
I myIter, myTime, myThid) |
139 |
|
140 |
CADJ STORE ph = comlev1, key = ikey_dynamics, |
141 |
CADJ & kind = isbyte |
142 |
|
143 |
c----------------------------------------------------------- |
144 |
c determine calcite saturation for remineralization |
145 |
CALL BLING_CARBONATE_SYS( |
146 |
I PTR_DIC, PTR_ALK, PTR_PO4, |
147 |
I bi, bj, imin, imax, jmin, jmax, |
148 |
I myIter, myTime, myThid) |
149 |
|
150 |
C----------------------------------------------------------- |
151 |
C biological activity |
152 |
CALL BLING_PROD( |
153 |
I PTR_NO3, PTR_PO4, PTR_FE, |
154 |
I PTR_O2, PTR_DON, PTR_DOP, |
155 |
#ifdef ADVECT_PHYTO |
156 |
PTR_PHY, |
157 |
#endif |
158 |
U G_NO3, G_PO4, G_FE, |
159 |
U G_O2, G_DON, G_DOP, G_CACO3, |
160 |
I bi, bj, imin, imax, jmin, jmax, |
161 |
I myIter, myTime, myThid) |
162 |
|
163 |
|
164 |
C----------------------------------------------------------- |
165 |
C Calculate river runoff source |
166 |
C Tracers are already diluted by freswater input, P-E+R |
167 |
C This accounts for tracer concentration in river runoff |
168 |
|
169 |
cxx DO k=1,PTRACERS_num |
170 |
DO k=1,8 |
171 |
DO j=jmin,jmax |
172 |
DO i=imin,imax |
173 |
|
174 |
c#ifdef ALLOW_EXF |
175 |
c runoff_bgc(i,j,k) = river_conc_trac(k)*runoff(i,j,bi,bj) |
176 |
c & *recip_drF(1)*recip_hFacC(i,j,1,bi,bj) |
177 |
c#else |
178 |
c runoff_bgc(i,j,k) = 0. _d 0 |
179 |
c#endif |
180 |
|
181 |
ENDDO |
182 |
ENDDO |
183 |
ENDDO |
184 |
|
185 |
|
186 |
|
187 |
c --------------------------------------------------------------------- |
188 |
|
189 |
|
190 |
c Carbon system |
191 |
cxx check |
192 |
|
193 |
DO j=jmin,jmax |
194 |
DO i=imin,imax |
195 |
DO k=1,Nr |
196 |
|
197 |
IF (hFacC(i,j,k,bi,bj) .gt. 0. _d 0) THEN |
198 |
|
199 |
G_ALK(i,j,k) = - G_NO3(i,j,k) |
200 |
& + 2. _d 0*G_CaCO3(i,j,k) |
201 |
|
202 |
G_DIC(i,j,k) = CtoN * G_NO3(i,j,k) |
203 |
& + G_CaCO3(i,j,k) |
204 |
|
205 |
|
206 |
c For diagnostics |
207 |
bio_DIC(i,j,k) = G_DIC(i,j,k) |
208 |
|
209 |
ENDIF |
210 |
|
211 |
ENDDO |
212 |
ENDDO |
213 |
ENDDO |
214 |
|
215 |
|
216 |
|
217 |
C----------------------------------------------------------- |
218 |
C adding surface tendencies due to air-sea exchange |
219 |
C adding surface tendencies due to river runoff |
220 |
C adding aeolian iron source |
221 |
|
222 |
DO j=jmin,jmax |
223 |
DO i=imin,imax |
224 |
G_DIC(i,j,1) = G_DIC(i,j,1) + runoff_bgc(i,j,1) |
225 |
& + surf_DIC(i,j) |
226 |
G_ALK(i,j,1) = G_ALK(i,j,1) + runoff_bgc(i,j,2) |
227 |
G_NO3(i,j,1) = G_NO3(i,j,1) + runoff_bgc(i,j,3) |
228 |
G_PO4(i,j,1) = G_PO4(i,j,1) + runoff_bgc(i,j,4) |
229 |
G_FE(i,j,1) = G_FE(i,j,1) + runoff_bgc(i,j,5) |
230 |
& + alpfe*InputFe(i,j,bi,bj)*recip_drF(1) |
231 |
& * recip_hFacC(i,j,1,bi,bj) |
232 |
G_O2(i,j,1) = G_O2(i,j,1) + runoff_bgc(i,j,6) |
233 |
& + surf_O2(i,j) |
234 |
G_DON(i,j,1) = G_DON(i,j,1) + runoff_bgc(i,j,7) |
235 |
G_DOP(i,j,1) = G_DOP(i,j,1) + runoff_bgc(i,j,8) |
236 |
ENDDO |
237 |
ENDDO |
238 |
|
239 |
C----------------------------------------------------------- |
240 |
C update |
241 |
DO k=1,Nr |
242 |
DO j=jmin,jmax |
243 |
DO i=imin,imax |
244 |
PTR_DIC(i,j,k)=PTR_DIC(i,j,k)+G_DIC(i,j,k)*PTRACERS_dTLev(k) |
245 |
PTR_ALK(i,j,k)=PTR_ALK(i,j,k)+G_ALK(i,j,k)*PTRACERS_dTLev(k) |
246 |
PTR_NO3(i,j,k)=PTR_NO3(i,j,k)+G_NO3(i,j,k)*PTRACERS_dTLev(k) |
247 |
PTR_PO4(i,j,k)=PTR_PO4(i,j,k)+G_PO4(i,j,k)*PTRACERS_dTLev(k) |
248 |
PTR_FE (i,j,k)=PTR_FE (i,j,k)+G_FE (i,j,k)*PTRACERS_dTLev(k) |
249 |
PTR_O2 (i,j,k)=PTR_O2 (i,j,k)+G_O2 (i,j,k)*PTRACERS_dTLev(k) |
250 |
PTR_DON(i,j,k)=PTR_DON(i,j,k)+G_DON(i,j,k)*PTRACERS_dTLev(k) |
251 |
PTR_DOP(i,j,k)=PTR_DOP(i,j,k)+G_DOP(i,j,k)*PTRACERS_dTLev(k) |
252 |
#ifdef ADVECT_PHYTO |
253 |
PTR_PHY(i,j,k)=PTR_PHY(i,j,k)+G_PHY(i,j,k)*PTRACERS_dTLev(k) |
254 |
#endif |
255 |
ENDDO |
256 |
ENDDO |
257 |
ENDDO |
258 |
|
259 |
C----------------------------------------------------------- |
260 |
#ifdef ALLOW_DIAGNOSTICS |
261 |
IF ( useDiagnostics ) THEN |
262 |
CALL DIAGNOSTICS_FILL(bio_DIC ,'BLGBIOA ',0,Nr,2,bi,bj,myThid) |
263 |
CALL DIAGNOSTICS_FILL(pH ,'BLGPH3D ',0,Nr,1,bi,bj,myThid) |
264 |
CALL DIAGNOSTICS_FILL(OmegaAr ,'BLGOMAR ',0,Nr,1,bi,bj,myThid) |
265 |
CALL DIAGNOSTICS_FILL(pCO2 ,'BLGPCO2 ',0,1 ,1,bi,bj,myThid) |
266 |
CALL DIAGNOSTICS_FILL(fluxCO2 ,'BLGCFLX ',0,1 ,1,bi,bj,myThid) |
267 |
CALL DIAGNOSTICS_FILL(surf_DIC,'BLGTFLX ',0,1 ,2,bi,bj,myThid) |
268 |
CALL DIAGNOSTICS_FILL(surf_O2 ,'BLGOFLX ',0,1 ,2,bi,bj,myThid) |
269 |
ENDIF |
270 |
#endif /* ALLOW_DIAGNOSTICS */ |
271 |
|
272 |
RETURN |
273 |
END |
274 |
|
275 |
|
276 |
|