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

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

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


Revision 1.2 - (show annotations) (download)
Thu Jun 5 21:26:26 2014 UTC (11 years, 1 month ago) by mmazloff
Branch: MAIN
Changes since 1.1: +3 -3 lines
cleaning and updating

1 C $Header: /u/gcmpack/MITgcm_contrib/bling/pkg/bling_main.F,v 1.1 2014/05/23 17:33:43 mmazloff Exp $
2 C $Name: $
3
4 #include "BLING_OPTIONS.h"
5
6 CBOP
7 subroutine BLING_MAIN( PTR_DIC, PTR_ALK, PTR_NUT,
8 & PTR_DOM, PTR_O2, PTR_FE,
9 & bi, bj, imin, imax, jmin, jmax,
10 & myIter, myTime, myThid)
11
12 C ==========================================================
13 C | subroutine bling_main
14 C | o updates all the tracers for the effects of air-sea exchange,
15 C | biological production, and remineralization.
16 C ==========================================================
17
18 implicit none
19
20 C === Global variables ===
21 #include "SIZE.h"
22 #include "EEPARAMS.h"
23 #include "PARAMS.h"
24 #include "GRID.h"
25 #include "BLING_VARS.h"
26 #include "PTRACERS_SIZE.h"
27 #include "PTRACERS_PARAMS.h"
28 #ifdef ALLOW_EXF
29 # include "EXF_FIELDS.h"
30 #endif
31 #ifdef ALLOW_AUTODIFF_TAMC
32 # include "tamc.h"
33 #endif
34
35 C === Routine arguments ===
36 C bi,bj :: tile indices
37 C iMin,iMax :: computation domain: 1rst index range
38 C jMin,jMax :: computation domain: 2nd index range
39 C myTime :: current time
40 C myIter :: current timestep
41 C myThid :: thread Id. number
42 INTEGER bi, bj, imin, imax, jmin, jmax
43 _RL myTime
44 INTEGER myIter
45 INTEGER myThid
46 C === Input ===
47 C PTR_DIC :: dissolved inorganic carbon
48 C PTR_ALK :: alkalinity
49 C PTR_NUT :: macro-nutrient concentration
50 C PTR_DOM :: dissolved organic matter concentration
51 C PTR_O2 :: oxygen concentration
52 C PTR_FE :: iron concentration
53 _RL PTR_DIC(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
54 _RL PTR_ALK(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
55 _RL PTR_NUT(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
56 _RL PTR_DOM(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
57 _RL PTR_O2 (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
58 _RL PTR_FE (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
59
60
61 C === Local variables ===
62 C i,j,k :: loop indices
63 C G* :: tendency term for the tracers
64 C SURC :: tendency of DIC due to air-sea exchange
65 C SURO :: tendency of O2 due to air-sea exchange
66 C NUT_uptake :: nutrient uptake for biological production
67 C POM_prod :: nutrient converted to particulate
68 C organic matter
69 C DOM_prod :: nutrient converted to dissolved organic
70 C matter
71 C DOM_remin :: DOM remineralization
72 C POM_remin :: POM sinking and instant remineralization
73 C NUT_remin :: Total nutrient remineralization
74 C NUT_recyc :: Fast nutrient recycling
75 C Fe_uptake :: iron converted to particulate organic or
76 C inorganic (colloidal) iron
77 C Fe_remin :: particulate iron converted to total iron
78 C CaCO3_prod :: uptake of carbonate ions for CaCO3 formation
79 C CaCO3_diss :: dissolution of CaCO3
80 C Car :: carbonate ion biological production
81 C BioUp :: DIC biological production (<0)
82 C Remin :: DIC remineralization
83 C runoff* :: tendency due to river runoff
84
85 INTEGER i,j,k
86 _RL GDIC(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
87 _RL GALK(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
88 _RL GNUT(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
89 _RL GDOM(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
90 _RL GO2 (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
91 _RL GFE (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
92 _RL SURC(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
93 _RL SURO(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
94 _RL NUT_uptake(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
95 _RL NUT_remin (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
96 _RL NUT_recyc (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
97 _RL POM_remin (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
98 _RL POM_diss (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
99 _RL POM_prod (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
100 _RL DOM_prod (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
101 _RL DOM_remin (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
102 _RL CaCO3_prod(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
103 _RL CaCO3_diss(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
104 _RL Fe_uptake (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
105 _RL Fe_remin (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
106 _RL runoff_dic(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
107 _RL runoff_alk(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
108 _RL runoff_nut(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
109 _RL runoff_dom(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
110 _RL runoff_o2 (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
111 _RL runoff_fe (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
112 _RL BioUp (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
113 _RL Remin (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
114 _RL Car (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
115
116 CEOP
117
118 C-----------------------------------------------------------
119 C Initialize local variables
120
121 DO k=1,Nr
122 DO j=1-OLy,sNy+OLy
123 DO i=1-OLx,sNx+OLx
124 GDIC(i,j,k) = 0. _d 0
125 GALK(i,j,k) = 0. _d 0
126 GNUT(i,j,k) = 0. _d 0
127 GDOM(i,j,k) = 0. _d 0
128 GO2(i,j,k) = 0. _d 0
129 GFE(i,j,k) = 0. _d 0
130 NUT_uptake(i,j,k) = 0. _d 0
131 NUT_remin(i,j,k) = 0. _d 0
132 NUT_recyc(i,j,k) = 0. _d 0
133 DOM_remin(i,j,k) = 0. _d 0
134 POM_remin(i,j,k) = 0. _d 0
135 DOM_prod(i,j,k) = 0. _d 0
136 POM_prod(i,j,k) = 0. _d 0
137 CaCO3_prod(i,j,k) = 0. _d 0
138 CaCO3_diss(i,j,k) = 0. _d 0
139 Fe_uptake(i,j,k) = 0. _d 0
140 Fe_remin(i,j,k) = 0. _d 0
141 BioUp(i,j,k) = 0. _d 0
142 Remin(i,j,k) = 0. _d 0
143 Car(i,j,k) = 0. _d 0
144 ENDDO
145 ENDDO
146 ENDDO
147 DO j=1-OLy,sNy+OLy
148 DO i=1-OLx,sNx+OLx
149 SURC(i,j) = 0. _d 0
150 SURO(i,j) = 0. _d 0
151 runoff_dic(i,j) = 0. _d 0
152 runoff_alk(i,j) = 0. _d 0
153 runoff_nut(i,j) = 0. _d 0
154 runoff_dom(i,j) = 0. _d 0
155 runoff_o2(i,j) = 0. _d 0
156 runoff_fe(i,j) = 0. _d 0
157 ENDDO
158 ENDDO
159
160 C-----------------------------------------------------------
161 C carbon and oxygen air-sea interaction
162 CALL BLING_AIRSEAFLUX(
163 I PTR_DIC, PTR_ALK, PTR_NUT, PTR_O2,
164 U SURC, SURO,
165 I bi, bj, imin, imax, jmin, jmax,
166 I myIter, myTime, myThid)
167
168 C$TAF STORE irr_mem = comlev1, key = ikey_dynamics, kind=isbyte
169 C$TAF STORE irr_inst = comlev1, key = ikey_dynamics, kind=isbyte
170 C$TAF STORE P_sm = comlev1, key = ikey_dynamics, kind=isbyte
171 C$TAF STORE P_lg = comlev1, key = ikey_dynamics, kind=isbyte
172
173 C-----------------------------------------------------------
174 C biological production of organic matter
175 CALL BLING_PROD(
176 I PTR_NUT, PTR_FE, PTR_DOM, PTR_O2,
177 U NUT_uptake, POM_prod, DOM_prod,
178 U Fe_uptake, CaCO3_prod,
179 I bi, bj, imin, imax, jmin, jmax,
180 I myIter, myTime, myThid)
181
182 C-----------------------------------------------------------
183 C determine calcite saturation for use in bling_remin
184 CALL BLING_CARBONATE_SYS(
185 I PTR_DIC, PTR_ALK, PTR_NUT,
186 I bi, bj, imin, imax, jmin, jmax,
187 I myIter, myTime, myThid)
188
189 C-----------------------------------------------------------
190 C flux of NUT, CaCO3, and Fe from remineralization
191 CALL BLING_REMIN(
192 I PTR_O2, PTR_FE,
193 U POM_prod, Fe_uptake, CaCO3_prod,
194 U POM_remin, POM_diss, Fe_remin, CaCO3_diss,
195 I bi, bj, imin, imax, jmin, jmax,
196 I myIter, myTime, myThid)
197
198 C$TAF STORE P_sm = comlev1, key = ikey_dynamics, kind=isbyte
199 C$TAF STORE P_lg = comlev1, key = ikey_dynamics, kind=isbyte
200
201 C-----------------------------------------------------------
202 C Calculate river runoff source
203 C Tracers are already diluted by freswater input, P-E+R
204 C This accounts for tracer concentration in river runoff
205 DO j=jmin,jmax
206 DO i=imin,imax
207 #ifdef ALLOW_EXF
208 runoff_dic(i,j) = riverconc_DIC*runoff(i,j,bi,bj)
209 & *recip_drF(1)*recip_hFacC(i,j,1,bi,bj)
210 runoff_alk(i,j) = riverconc_ALK*runoff(i,j,bi,bj)
211 & *recip_drF(1)*recip_hFacC(i,j,1,bi,bj)
212 runoff_nut(i,j) = riverconc_NUT*runoff(i,j,bi,bj)
213 & *recip_drF(1)*recip_hFacC(i,j,1,bi,bj)
214 runoff_dom(i,j) = riverconc_DOM*runoff(i,j,bi,bj)
215 & *recip_drF(1)*recip_hFacC(i,j,1,bi,bj)
216 runoff_o2(i,j) = riverconc_O2 *runoff(i,j,bi,bj)
217 & *recip_drF(1)*recip_hFacC(i,j,1,bi,bj)
218 runoff_fe(i,j) = riverconc_FE *runoff(i,j,bi,bj)
219 & *recip_drF(1)*recip_hFacC(i,j,1,bi,bj)
220 C else it is 0 as initialized
221 #endif
222 ENDDO
223 ENDDO
224
225 C-----------------------------------------------------------
226 C add all tendencies
227 DO k=1,Nr
228 DO j=jmin,jmax
229 DO i=imin,imax
230
231 C Dissolved organic matter slow remineralization
232 #ifdef BLING_NO_NEG
233 DOM_remin(i,j,k) = MAX(maskC(i,j,k,bi,bj)*gamma_DOM
234 & *PTR_DOM(i,j,k),0. _d 0)
235 #else
236 DOM_remin(i,j,k) = maskC(i,j,k,bi,bj)*gamma_DOM
237 & *PTR_DOM(i,j,k)
238 #endif
239 C Total nutrient remin, recycling
240 NUT_remin(i,j,k) = POM_remin(i,j,k) + DOM_remin(i,j,k)
241 NUT_recyc(i,j,k) = NUT_uptake(i,j,k) - POM_prod(i,j,k)
242 & - DOM_prod(i,j,k)
243
244 C Carbon system diagnostics
245 C Change in DIC from primary production, from recycling and
246 C remineralization, change in carbonate ions concentration
247 C from biological activity:
248 BioUp(i,j,k) = -NUT_uptake(i,j,k)*CtoP/NUTfac
249 Remin(i,j,k) = (DOM_remin(i,j,k) + NUT_recyc(i,j,k)
250 & + POM_remin(i,j,k))*CtoP/NUTfac
251 Car(i,j,k) = CaCO3_diss(i,j,k) - CaCO3_prod(i,j,k)
252
253 C Tendencies
254 GNUT(i,j,k) = -NUT_uptake(i,j,k) + NUT_recyc(i,j,k)
255 & + DOM_remin(i,j,k) + POM_remin(i,j,k)
256
257 GDOM(i,j,k) = DOM_prod(i,j,k) - DOM_remin(i,j,k)
258 & + POM_diss(i,j,k)
259
260 GALK(i,j,k) = 2. _d 0*Car(i,j,k) - NtoP/NUTfac*GNUT(i,j,k)
261
262 GDIC(i,j,k) = BioUp(i,j,k) + Remin(i,j,k) + Car(i,j,k)
263
264 if ( PTR_O2(i,j,k) .GT. O2_min ) then
265 GO2(i,j,k) = O2toP/NUTfac*GNUT(i,j,k)
266 else
267 GO2(i,j,k) = 0. _d 0
268 endif
269
270 GFE(i,j,k) = Fe_remin(i,j,k) - Fe_uptake(i,j,k)
271
272 ENDDO
273 ENDDO
274 ENDDO
275
276 C-----------------------------------------------------------
277 C adding surface tendencies due to air-sea exchange
278 C adding surface tendencies due to river runoff
279 C adding aeolian iron source
280 DO j=jmin,jmax
281 DO i=imin,imax
282 GDIC(i,j,1)=GDIC(i,j,1)+runoff_dic(i,j)+SURC(i,j)
283 GALK(i,j,1)=GALK(i,j,1)+runoff_alk(i,j)
284 GNUT(i,j,1)=GNUT(i,j,1)+runoff_nut(i,j)
285 GDOM(i,j,1)=GDOM(i,j,1)+runoff_dom(i,j)
286 GO2(i,j,1) =GO2(i,j,1) +runoff_o2(i,j) +SURO(i,j)
287 GFE(i,j,1) =GFE(i,j,1) +runoff_fe(i,j)
288 & +alpfe*InputFe(i,j,bi,bj)*recip_drF(1)
289 & *recip_hFacC(i,j,1,bi,bj)
290 ENDDO
291 ENDDO
292
293 C-----------------------------------------------------------
294 C update
295 DO k=1,Nr
296 DO j=jmin,jmax
297 DO i=imin,imax
298 PTR_DIC(i,j,k)= PTR_DIC(i,j,k)+GDIC(i,j,k)*PTRACERS_dTLev(k)
299 PTR_ALK(i,j,k)= PTR_ALK(i,j,k)+GALK(i,j,k)*PTRACERS_dTLev(k)
300 PTR_NUT(i,j,k)= PTR_NUT(i,j,k)+GNUT(i,j,k)*PTRACERS_dTLev(k)
301 PTR_DOM(i,j,k)= PTR_DOM(i,j,k)+GDOM(i,j,k)*PTRACERS_dTLev(k)
302 PTR_O2(i,j,k) = PTR_O2(i,j,k) +GO2(i,j,k) *PTRACERS_dTLev(k)
303 PTR_FE(i,j,k) = PTR_FE(i,j,k) +GFE(i,j,k) *PTRACERS_dTLev(k)
304 ENDDO
305 ENDDO
306 ENDDO
307
308 C-----------------------------------------------------------
309 #ifdef ALLOW_DIAGNOSTICS
310 IF ( useDiagnostics ) THEN
311 CALL DIAGNOSTICS_FILL(BioUp ,'BLGBIOA ',0,Nr,2,bi,bj,myThid)
312 CALL DIAGNOSTICS_FILL(Remin ,'BLGREMI ',0,Nr,2,bi,bj,myThid)
313 CALL DIAGNOSTICS_FILL(Car ,'BLGCARB ',0,Nr,2,bi,bj,myThid)
314 CALL DIAGNOSTICS_FILL(pH ,'BLGPH3D ',0,Nr,1,bi,bj,myThid)
315 CALL DIAGNOSTICS_FILL(OmegaAr ,'BLGOMAR ',0,Nr,1,bi,bj,myThid)
316 CALL DIAGNOSTICS_FILL(pCO2 ,'BLGPCO2 ',0,1 ,1,bi,bj,myThid)
317 CALL DIAGNOSTICS_FILL(fluxCO2 ,'BLGCFLX ',0,1 ,1,bi,bj,myThid)
318 CALL DIAGNOSTICS_FILL(SURC ,'BLGTFLX ',0,1 ,2,bi,bj,myThid)
319 CALL DIAGNOSTICS_FILL(SURO ,'BLGOFLX ',0,1 ,2,bi,bj,myThid)
320 ENDIF
321 #endif /* ALLOW_DIAGNOSTICS */
322
323 RETURN
324 END
325
326
327

  ViewVC Help
Powered by ViewVC 1.1.22