File indexing completed on 2023-02-03 06:09:48 UTC
view on githubraw file Latest commit edb66560 on 2023-02-02 23:32:31 UTC
95feb8c90d Jean*0001 #include "BLING_OPTIONS.h"
9f0da36f91 Jean*0002 #ifdef ALLOW_EXF
0003 # include "EXF_OPTIONS.h"
0004 #endif
a284455135 Matt*0005 #ifdef ALLOW_AUTODIFF
0006 # include "AUTODIFF_OPTIONS.h"
0007 #endif
95feb8c90d Jean*0008
0009
a284455135 Matt*0010 SUBROUTINE BLING_MAIN( PTR_DIC, PTR_ALK, PTR_O2,
e0f9a7ba0b Matt*0011 #ifndef USE_BLING_V1
0012 U PTR_NO3, PTR_PO4, PTR_FE,
0013 U PTR_DON, PTR_DOP,
0014 #ifdef USE_SIBLING
0015 U PTR_SI,
0016 #endif
95feb8c90d Jean*0017 #ifdef ADVECT_PHYTO
e0f9a7ba0b Matt*0018 U PTR_PHY,
0019 #endif
0020 #else
0021 U PTR_PO4, PTR_DOP, PTR_FE,
95feb8c90d Jean*0022 #endif
e0f9a7ba0b Matt*0023 I bi, bj, imin, imax, jmin, jmax,
0024 I myTime, myIter, myThid)
95feb8c90d Jean*0025
4ac06494d5 Matt*0026
95feb8c90d Jean*0027
4ac06494d5 Matt*0028
95feb8c90d Jean*0029
4ac06494d5 Matt*0030
e0f9a7ba0b Matt*0031
4ac06494d5 Matt*0032
0033
95feb8c90d Jean*0034
e0f9a7ba0b Matt*0035 IMPLICIT NONE
95feb8c90d Jean*0036
0037
0038 #include "SIZE.h"
0039 #include "EEPARAMS.h"
0040 #include "PARAMS.h"
0041 #include "GRID.h"
0042 #include "PTRACERS_SIZE.h"
0043 #include "PTRACERS_PARAMS.h"
0044 #ifdef ALLOW_EXF
9f0da36f91 Jean*0045 # include "EXF_INTERP_SIZE.h"
95feb8c90d Jean*0046 # include "EXF_FIELDS.h"
0047 #endif
a284455135 Matt*0048 #include "BLING_VARS.h"
0049 #ifdef ALLOW_AUTODIFF_TAMC
95feb8c90d Jean*0050 # include "tamc.h"
0051 #endif
0052
0053
0054
0055
0056
0057
0058
0059
0060 INTEGER bi, bj, imin, imax, jmin, jmax
0061 _RL myTime
0062 INTEGER myIter
0063 INTEGER myThid
0064
0065
0066
0067
0068
e0f9a7ba0b Matt*0069
0070
0071
0072
95feb8c90d Jean*0073
0074 _RL PTR_DIC(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
0075 _RL PTR_ALK(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
0076 _RL PTR_O2 (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
e0f9a7ba0b Matt*0077 _RL PTR_FE (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
0078 _RL PTR_PO4(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
95feb8c90d Jean*0079 _RL PTR_DOP(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
e0f9a7ba0b Matt*0080 #ifndef USE_BLING_V1
0081 _RL PTR_NO3(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
0082 _RL PTR_DON(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
0083 #ifdef USE_SIBLING
0084 _RL PTR_SI (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
0085 #endif
95feb8c90d Jean*0086 #ifdef ADVECT_PHYTO
0087 _RL PTR_PHY(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
0088 #endif
e0f9a7ba0b Matt*0089 #endif
95feb8c90d Jean*0090
0091
0092
e0f9a7ba0b Matt*0093
95feb8c90d Jean*0094
e0f9a7ba0b Matt*0095
95feb8c90d Jean*0096
e0f9a7ba0b Matt*0097
0098
95feb8c90d Jean*0099
0100 INTEGER i,j,k
0101 _RL G_DIC(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
0102 _RL G_ALK(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
0103 _RL G_O2 (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
e0f9a7ba0b Matt*0104 _RL G_FE (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
0105 _RL G_PO4(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
95feb8c90d Jean*0106 _RL G_DOP(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
0107 _RL surf_DIC(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
cab777d667 Matt*0108 _RL surf_Fe(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
e0f9a7ba0b Matt*0109 _RL surf_O2(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
cc42131cc8 Matt*0110 _RL FluxO2(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
e0f9a7ba0b Matt*0111 _RL runoff_PO4(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
0112 #ifndef USE_BLING_V1
0113 _RL G_NO3(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
0114 _RL G_DON(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
0115 #ifdef USE_SIBLING
0116 _RL G_SI (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
0117 #endif
0118 #endif
7c50f07931 Mart*0119 #ifdef ALLOW_AUTODIFF_TAMC
edb6656069 Mart*0120 INTEGER tkey
7c50f07931 Mart*0121 #endif
95feb8c90d Jean*0122
0123
0124
0125
0126
a284455135 Matt*0127 #ifdef ALLOW_AUTODIFF_TAMC
edb6656069 Mart*0128 tkey = bi + (bj - 1)*nSx + (ikey_dynamics - 1)*nSx*nSy
a284455135 Matt*0129 #endif
95feb8c90d Jean*0130 DO j=jmin,jmax
0131 DO i=imin,imax
e0f9a7ba0b Matt*0132 surf_DIC(i,j) = 0. _d 0
0133 surf_O2(i,j) = 0. _d 0
0134 surf_Fe(i,j) = 0. _d 0
0135 fluxO2(i,j) = 0. _d 0
0136 runoff_PO4(i,j) = 0. _d 0
0137 ENDDO
0138 ENDDO
0139 DO j=jmin,jmax
0140 DO i=imin,imax
95feb8c90d Jean*0141 DO k=1,Nr
0142 G_DIC(i,j,k) = 0. _d 0
0143 G_ALK(i,j,k) = 0. _d 0
0144 G_O2(i,j,k) = 0. _d 0
e0f9a7ba0b Matt*0145 G_FE(i,j,k) = 0. _d 0
0146 G_PO4(i,j,k) = 0. _d 0
95feb8c90d Jean*0147 G_DOP(i,j,k) = 0. _d 0
e0f9a7ba0b Matt*0148 #ifndef USE_BLING_V1
0149 G_NO3(i,j,k) = 0. _d 0
0150 G_DON(i,j,k) = 0. _d 0
0151 #ifdef USE_SIBLING
0152 G_SI(i,j,k) = 0. _d 0
0153 #endif
0154 #endif
95feb8c90d Jean*0155 ENDDO
0156 ENDDO
0157 ENDDO
e0f9a7ba0b Matt*0158
079948e6a6 Matt*0159
95feb8c90d Jean*0160
0161 CALL BLING_AIRSEAFLUX(
e0f9a7ba0b Matt*0162 I PTR_DIC, PTR_ALK, PTR_O2, PTR_PO4,
0163 #ifdef USE_SIBLING
0164 I PTR_SI,
0165 #endif
cc42131cc8 Matt*0166 U surf_DIC, surf_O2, fluxO2,
95feb8c90d Jean*0167 I bi, bj, imin, imax, jmin, jmax,
e0f9a7ba0b Matt*0168 I myTime, myIter, myThid)
95feb8c90d Jean*0169
a284455135 Matt*0170 #ifdef ALLOW_AUTODIFF_TAMC
edb6656069 Mart*0171
a284455135 Matt*0172 #endif
95feb8c90d Jean*0173
0174
0175
0176 CALL BLING_CARBONATE_SYS(
0177 I PTR_DIC, PTR_ALK, PTR_PO4,
e0f9a7ba0b Matt*0178 #ifdef USE_SIBLING
0179 I PTR_SI,
0180 #endif
95feb8c90d Jean*0181 I bi, bj, imin, imax, jmin, jmax,
e0f9a7ba0b Matt*0182 I myTime, myIter, myThid)
95feb8c90d Jean*0183
0184
0185
e0f9a7ba0b Matt*0186
0187 #ifndef USE_BLING_V1
0188 CALL BLING_BIO_NITROGEN(
0189 I PTR_O2, PTR_FE, PTR_PO4, PTR_DOP,
0190 I PTR_NO3, PTR_DON,
0191 #ifdef USE_SIBLING
0192 I PTR_SI,
0193 #endif
95feb8c90d Jean*0194 #ifdef ADVECT_PHYTO
e0f9a7ba0b Matt*0195 I PTR_PHY,
95feb8c90d Jean*0196 #endif
e0f9a7ba0b Matt*0197 U G_DIC, G_ALK, G_O2, G_FE,
0198 U G_PO4, G_DOP, G_NO3, G_DON,
12e63fa857 Jean*0199 #ifdef USE_SIBLING
0200 U G_SI,
0201 #endif
95feb8c90d Jean*0202 I bi, bj, imin, imax, jmin, jmax,
e0f9a7ba0b Matt*0203 I myTime, myIter, myThid)
0204 #else
0205 CALL BLING_BIO(
0206 I PTR_O2, PTR_FE, PTR_PO4, PTR_DOP,
0207 U G_DIC, G_ALK, G_O2, G_FE,
0208 U G_PO4, G_DOP,
0209 I bi, bj, imin, imax, jmin, jmax,
0210 I myTime, myIter, myThid)
0211 #endif
95feb8c90d Jean*0212
0213
0214
0215
0216
7c50f07931 Mart*0217
95feb8c90d Jean*0218
e0f9a7ba0b Matt*0219 #ifdef ALLOW_EXF
0220 DO j=jmin,jmax
0221 IF (YC(i,j,bi,bj).gt.-60.0) THEN
0222 DO i=imin,imax
0223 runoff_PO4(i,j) = river_conc_po4*runoff(i,j,bi,bj)
0224 & *recip_drF(1)*recip_hFacC(i,j,1,bi,bj)
0225 ENDDO
0226 ENDIF
95feb8c90d Jean*0227 ENDDO
e0f9a7ba0b Matt*0228 #endif
95feb8c90d Jean*0229
0230
0231
0232
e0f9a7ba0b Matt*0233
95feb8c90d Jean*0234
0235
0236 DO j=jmin,jmax
0237 DO i=imin,imax
cab777d667 Matt*0238
e0f9a7ba0b Matt*0239 G_DIC(i,j,1) = G_DIC(i,j,1) + surf_DIC(i,j)
0240 & + runoff_PO4(i,j)*CtoN*NtoP
0241 G_ALK(i,j,1) = G_ALK(i,j,1)
0242 & - runoff_PO4(i,j)*NtoP
0243 G_O2(i,j,1) = G_O2(i,j,1) + surf_O2(i,j)
0244 surf_Fe(i,j) = alpfe*InputFe(i,j,bi,bj)
0245 G_FE(i,j,1) = G_FE(i,j,1) + surf_Fe(i,j)
0246 & * recip_drF(1) * recip_hFacC(i,j,1,bi,bj)
0247 G_PO4(i,j,1) = G_PO4(i,j,1) + runoff_PO4(i,j)
0248 G_DOP(i,j,1) = G_DOP(i,j,1)
0249 & + runoff_PO4(i,j)*river_dom_to_nut
0250 #ifndef USE_BLING_V1
0251 G_NO3(i,j,1) = G_NO3(i,j,1) + runoff_PO4(i,j)*NtoP
0252 G_DON(i,j,1) = G_DON(i,j,1)
0253 & + runoff_PO4(i,j)*NtoP*river_dom_to_nut
0254
0255 #endif
95feb8c90d Jean*0256 ENDDO
0257 ENDDO
0258
0259
0260
0261 DO k=1,Nr
0262 DO j=jmin,jmax
0263 DO i=imin,imax
0264 PTR_DIC(i,j,k)=PTR_DIC(i,j,k)+G_DIC(i,j,k)*PTRACERS_dTLev(k)
0265 PTR_ALK(i,j,k)=PTR_ALK(i,j,k)+G_ALK(i,j,k)*PTRACERS_dTLev(k)
cab777d667 Matt*0266 PTR_O2 (i,j,k)=PTR_O2 (i,j,k)+G_O2 (i,j,k)*PTRACERS_dTLev(k)
95feb8c90d Jean*0267 PTR_FE (i,j,k)=PTR_FE (i,j,k)+G_FE (i,j,k)*PTRACERS_dTLev(k)
e0f9a7ba0b Matt*0268 PTR_PO4(i,j,k)=PTR_PO4(i,j,k)+G_PO4(i,j,k)*PTRACERS_dTLev(k)
95feb8c90d Jean*0269 PTR_DOP(i,j,k)=PTR_DOP(i,j,k)+G_DOP(i,j,k)*PTRACERS_dTLev(k)
e0f9a7ba0b Matt*0270 #ifndef USE_BLING_V1
0271 PTR_NO3(i,j,k)=PTR_NO3(i,j,k)+G_NO3(i,j,k)*PTRACERS_dTLev(k)
0272 PTR_DON(i,j,k)=PTR_DON(i,j,k)+G_DON(i,j,k)*PTRACERS_dTLev(k)
0273 #ifdef USE_SIBLING
0274 PTR_SI (i,j,k)=PTR_SI (i,j,k)+G_SI (i,j,k)*PTRACERS_dTLev(k)
0275 #endif
0276 #endif
95feb8c90d Jean*0277 ENDDO
0278 ENDDO
0279 ENDDO
0280
0281
0282 #ifdef ALLOW_DIAGNOSTICS
0283 IF ( useDiagnostics ) THEN
0284 CALL DIAGNOSTICS_FILL(pH ,'BLGPH3D ',0,Nr,1,bi,bj,myThid)
0285 CALL DIAGNOSTICS_FILL(OmegaAr ,'BLGOMAR ',0,Nr,1,bi,bj,myThid)
0286 CALL DIAGNOSTICS_FILL(pCO2 ,'BLGPCO2 ',0,1 ,1,bi,bj,myThid)
0287 CALL DIAGNOSTICS_FILL(fluxCO2 ,'BLGCFLX ',0,1 ,1,bi,bj,myThid)
cc42131cc8 Matt*0288 CALL DIAGNOSTICS_FILL(fluxO2 ,'BLGOFLX ',0,1 ,2,bi,bj,myThid)
e0f9a7ba0b Matt*0289 CALL DIAGNOSTICS_FILL(surf_Fe ,'BLGSURFE',0,1, 2,bi,bj,myThid)
a284455135 Matt*0290 CALL DIAGNOSTICS_FILL(apco2,'BLGapco2',0,1, 1,bi,bj,myThid)
95feb8c90d Jean*0291 ENDIF
0292 #endif /* ALLOW_DIAGNOSTICS */
0293
0294 RETURN
0295 END