/[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.3 - (show annotations) (download)
Sun Feb 28 21:49:24 2016 UTC (9 years, 4 months ago) by mmazloff
Branch: MAIN
Changes since 1.2: +175 -213 lines
Update to BLING version 2

1 C $Header: $
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 cxx C$TAF STORE irr_inst = comlev1, key = ikey_dynamics, kind=isbyte
141 C$TAF STORE irr_mem = comlev1, key = ikey_dynamics, kind=isbyte
142 #ifndef ADVECT_PHYTO
143 C$TAF STORE P_sm = comlev1, key = ikey_dynamics, kind=isbyte
144 C$TAF STORE P_lg = comlev1, key = ikey_dynamics, kind=isbyte
145 C$TAF STORE P_diaz = comlev1, key = ikey_dynamics, kind=isbyte
146 #endif
147
148 c-----------------------------------------------------------
149 c determine calcite saturation for remineralization
150 CALL BLING_CARBONATE_SYS(
151 I PTR_DIC, PTR_ALK, PTR_PO4,
152 I bi, bj, imin, imax, jmin, jmax,
153 I myIter, myTime, myThid)
154
155
156 C-----------------------------------------------------------
157 C biological activity
158 CALL BLING_PROD(
159 I PTR_NO3, PTR_PO4, PTR_FE,
160 I PTR_O2, PTR_DON, PTR_DOP,
161 #ifdef ADVECT_PHYTO
162 PTR_PHY,
163 #endif
164 U G_NO3, G_PO4, G_FE,
165 U G_O2, G_DON, G_DOP, G_CACO3,
166 I bi, bj, imin, imax, jmin, jmax,
167 I myIter, myTime, myThid)
168
169
170 #ifndef ADVECT_PHYTO
171 C$TAF STORE P_sm = comlev1, key = ikey_dynamics, kind=isbyte
172 C$TAF STORE P_lg = comlev1, key = ikey_dynamics, kind=isbyte
173 C$TAF STORE P_diaz = comlev1, key = ikey_dynamics, kind=isbyte
174 #endif
175
176
177 C-----------------------------------------------------------
178 C Calculate river runoff source
179 C Tracers are already diluted by freswater input, P-E+R
180 C This accounts for tracer concentration in river runoff
181
182 cxx DO k=1,PTRACERS_num
183 DO k=1,8
184 DO j=jmin,jmax
185 DO i=imin,imax
186
187 c#ifdef ALLOW_EXF
188 c runoff_bgc(i,j,k) = river_conc_trac(k)*runoff(i,j,bi,bj)
189 c & *recip_drF(1)*recip_hFacC(i,j,1,bi,bj)
190 c#else
191 c runoff_bgc(i,j,k) = 0. _d 0
192 c#endif
193
194 ENDDO
195 ENDDO
196 ENDDO
197
198
199
200 c ---------------------------------------------------------------------
201
202
203 c Carbon system
204 cxx check
205
206 DO j=jmin,jmax
207 DO i=imin,imax
208 DO k=1,Nr
209
210 IF (hFacC(i,j,k,bi,bj) .gt. 0. _d 0) THEN
211
212 G_ALK(i,j,k) = - G_NO3(i,j,k)
213 & + 2. _d 0*G_CaCO3(i,j,k)
214
215 G_DIC(i,j,k) = CtoN * G_NO3(i,j,k)
216 & + G_CaCO3(i,j,k)
217
218
219 c For diagnostics
220 bio_DIC(i,j,k) = G_DIC(i,j,k)
221
222 ENDIF
223
224 ENDDO
225 ENDDO
226 ENDDO
227
228
229
230 C-----------------------------------------------------------
231 C adding surface tendencies due to air-sea exchange
232 C adding surface tendencies due to river runoff
233 C adding aeolian iron source
234
235 DO j=jmin,jmax
236 DO i=imin,imax
237 G_DIC(i,j,1) = G_DIC(i,j,1) + runoff_bgc(i,j,1)
238 & + surf_DIC(i,j)
239 G_ALK(i,j,1) = G_ALK(i,j,1) + runoff_bgc(i,j,2)
240 G_NO3(i,j,1) = G_NO3(i,j,1) + runoff_bgc(i,j,3)
241 G_PO4(i,j,1) = G_PO4(i,j,1) + runoff_bgc(i,j,4)
242 G_FE(i,j,1) = G_FE(i,j,1) + runoff_bgc(i,j,5)
243 & + alpfe*InputFe(i,j,bi,bj)*recip_drF(1)
244 & * recip_hFacC(i,j,1,bi,bj)
245 G_O2(i,j,1) = G_O2(i,j,1) + runoff_bgc(i,j,6)
246 & + surf_O2(i,j)
247 G_DON(i,j,1) = G_DON(i,j,1) + runoff_bgc(i,j,7)
248 G_DOP(i,j,1) = G_DOP(i,j,1) + runoff_bgc(i,j,8)
249 ENDDO
250 ENDDO
251
252 C-----------------------------------------------------------
253 C update
254 DO k=1,Nr
255 DO j=jmin,jmax
256 DO i=imin,imax
257 PTR_DIC(i,j,k)=PTR_DIC(i,j,k)+G_DIC(i,j,k)*PTRACERS_dTLev(k)
258 PTR_ALK(i,j,k)=PTR_ALK(i,j,k)+G_ALK(i,j,k)*PTRACERS_dTLev(k)
259 PTR_NO3(i,j,k)=PTR_NO3(i,j,k)+G_NO3(i,j,k)*PTRACERS_dTLev(k)
260 PTR_PO4(i,j,k)=PTR_PO4(i,j,k)+G_PO4(i,j,k)*PTRACERS_dTLev(k)
261 PTR_FE (i,j,k)=PTR_FE (i,j,k)+G_FE (i,j,k)*PTRACERS_dTLev(k)
262 PTR_O2 (i,j,k)=PTR_O2 (i,j,k)+G_O2 (i,j,k)*PTRACERS_dTLev(k)
263 PTR_DON(i,j,k)=PTR_DON(i,j,k)+G_DON(i,j,k)*PTRACERS_dTLev(k)
264 PTR_DOP(i,j,k)=PTR_DOP(i,j,k)+G_DOP(i,j,k)*PTRACERS_dTLev(k)
265 #ifdef ADVECT_PHYTO
266 PTR_PHY(i,j,k)=PTR_PHY(i,j,k)+G_PHY(i,j,k)*PTRACERS_dTLev(k)
267 #endif
268 ENDDO
269 ENDDO
270 ENDDO
271
272 C-----------------------------------------------------------
273 #ifdef ALLOW_DIAGNOSTICS
274 IF ( useDiagnostics ) THEN
275 CALL DIAGNOSTICS_FILL(bio_DIC ,'BLGBIOA ',0,Nr,2,bi,bj,myThid)
276 CALL DIAGNOSTICS_FILL(pH ,'BLGPH3D ',0,Nr,1,bi,bj,myThid)
277 CALL DIAGNOSTICS_FILL(OmegaAr ,'BLGOMAR ',0,Nr,1,bi,bj,myThid)
278 CALL DIAGNOSTICS_FILL(pCO2 ,'BLGPCO2 ',0,1 ,1,bi,bj,myThid)
279 CALL DIAGNOSTICS_FILL(fluxCO2 ,'BLGCFLX ',0,1 ,1,bi,bj,myThid)
280 CALL DIAGNOSTICS_FILL(surf_DIC,'BLGTFLX ',0,1 ,2,bi,bj,myThid)
281 CALL DIAGNOSTICS_FILL(surf_O2 ,'BLGOFLX ',0,1 ,2,bi,bj,myThid)
282 ENDIF
283 #endif /* ALLOW_DIAGNOSTICS */
284
285 RETURN
286 END
287
288
289

  ViewVC Help
Powered by ViewVC 1.1.22