/[MITgcm]/MITgcm/pkg/bling/bling_main.F
ViewVC logotype

Contents of /MITgcm/pkg/bling/bling_main.F

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


Revision 1.9 - (show annotations) (download)
Thu Mar 16 17:03:26 2017 UTC (7 years, 1 month ago) by mmazloff
Branch: MAIN
CVS Tags: checkpoint66g, checkpoint66f, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, HEAD
Changes since 1.8: +29 -3 lines
spring cleaning. minor changes

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

  ViewVC Help
Powered by ViewVC 1.1.22