--- MITgcm_contrib/bling/pkg/bling_remineralization.F 2016/02/28 21:49:24 1.2 +++ MITgcm_contrib/bling/pkg/bling_remineralization.F 2016/05/19 16:30:00 1.4 @@ -1,4 +1,4 @@ -C $Header: /home/ubuntu/mnt/e9_copy/MITgcm_contrib/bling/pkg/bling_remineralization.F,v 1.2 2016/02/28 21:49:24 mmazloff Exp $ +C $Header: /home/ubuntu/mnt/e9_copy/MITgcm_contrib/bling/pkg/bling_remineralization.F,v 1.4 2016/05/19 16:30:00 mmazloff Exp $ C $Name: $ #include "BLING_OPTIONS.h" @@ -106,6 +106,7 @@ C Fe_recycle :: recycling of newly-produced organic iron c xxx to be completed INTEGER i,j,k + INTEGER bttmlyr _RL PONflux_u _RL POPflux_u _RL PFEflux_u @@ -126,7 +127,7 @@ _RL lig_stability _RL FreeFe _RL Fe_ads_inorg(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) - _RL Fe_ads_org(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) + _RL Fe_ads_org _RL log_btm_flx _RL Fe_reminp(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) _RL o2_upper @@ -155,10 +156,10 @@ c --------------------------------------------------------------------- c Initialize output and diagnostics + DO k=1,Nr DO j=jmin,jmax DO i=imin,imax - Fe_ads_org(i,j,k) = 0. _d 0 Fe_ads_inorg(i,j,k) = 0. _d 0 N_reminp(i,j,k) = 0. _d 0 P_reminp(i,j,k) = 0. _d 0 @@ -184,14 +185,10 @@ c --------------------------------------------------------------------- c Remineralization -CADJ STORE Fe_ads_org = comlev1, key = ikey_dynamics -cxx needed? - C$TAF LOOP = parallel - DO j=jmin,jmax + DO j=jmin,jmax C$TAF LOOP = parallel - DO i=imin,imax -cmm C$TAF init upper_flux = static, Nr + DO i=imin,imax C Initialize upper flux PONflux_u = 0. _d 0 @@ -200,15 +197,15 @@ CaCO3flux_u = 0. _d 0 DO k=1,Nr -c C$TAF STORE PONflux_u = upper_flux -c C$TAF STORE POPflux_u = upper_flux -c C$TAF STORE PFEflux_u = upper_flux -c C$TAF STORE CaCO3flux_u = upper_flux -CADJ STORE PONflux_u, POPflux_u, PFEflux_u, CaCO3flux_u = -CADJ & comlev1, key = ikey_dynamics, kind = isbyte -CADJ STORE Fe_ads_org = -CADJ & comlev1, key = ikey_dynamics, kind = isbyte -CMM) + + Fe_ads_org = 0. _d 0 + +C ARE WE ON THE BOTTOM + bttmlyr = 1 + IF (k.LT.Nr) THEN + IF (hFacC(i,j,k+1,bi,bj).GT.0) bttmlyr = 0 +C we are not yet at the bottom + ENDIF IF ( hFacC(i,j,k,bi,bj).gt.0. _d 0 ) THEN @@ -249,10 +246,8 @@ & *hFacC(i,j,k,bi,bj)) C!! multiply by intercept_frac ??? - C Start with cells that are not the deepest cells - IF ((k.LT.Nr) .AND. (hFacC(i,j,k+1,bi,bj).GT.0)) THEN - + IF (bttmlyr.EQ.0) THEN C Nutrient accumulation in a cell is given by the biological production C (and instant remineralization) of particulate organic matter C plus flux thought upper interface minus flux through lower interface. @@ -267,8 +262,7 @@ & *drF(k) - CaCO3flux_l)*recip_drF(k) Fe_sed(i,j,k) = 0. _d 0 - - +C NOW DO BOTTOM LAYER ELSE C If this layer is adjacent to bottom topography or it is the deepest C cell of the domain, then remineralize/dissolve in this grid cell @@ -294,7 +288,7 @@ Fe_sed(i,j,k) = min(1. _d -11, & max(epsln, FetoC_sed * POC_sed * recip_drF(k) & *recip_hFacC(i,j,k,bi,bj))) - + #ifdef BLING_ADJOINT_SAFE Fe_sed(i,j,k) = 0. _d 0 #endif @@ -412,11 +406,11 @@ c & *CtoP/NUTfac*12.01/wsink)**(0.58)*FreeFe #ifndef BLING_ADJOINT_SAFE - Fe_ads_org(i,j,k) = + Fe_ads_org = & kFE_org*(PONflux_l/(epsln + wsink) & * MasstoN)**(0.58)*FreeFe #else - Fe_ads_org(i,j,k) = + Fe_ads_org = & kFE_org*(PONflux_l/(epsln + wsink0) & * MasstoN)**(0.58)*FreeFe #endif @@ -429,7 +423,7 @@ C in oxidizing environments). PFEflux_l = (PFEflux_u+(Fe_spm(i,j,k)+Fe_ads_inorg(i,j,k) - & +Fe_ads_org(i,j,k))*drF(k) + & +Fe_ads_org)*drF(k) & *hFacC(i,j,k,bi,bj))/(1+zremin*drF(k) & *hFacC(i,j,k,bi,bj)) @@ -449,7 +443,7 @@ Fe_reminp(i,j,k) = (pfeflux_u+(Fe_spm(i,j,k) & +Fe_ads_inorg(i,j,k) - & +Fe_ads_org(i,j,k))*drF(k) + & +Fe_ads_org)*drF(k) & *hFacC(i,j,k,bi,bj)-pfeflux_l)*recip_drF(k) & *recip_hFacC(i,j,k,bi,bj) C!! there's an intercept_frac here... need to add @@ -463,19 +457,17 @@ c Fe_reminsum(i,j,k) = Fe_reminp(i,j,k) + Fe_sed(i,j,k) - & - Fe_ads_org(i,j,k) - Fe_ads_inorg(i,j,k) + & - Fe_ads_org - Fe_ads_inorg(i,j,k) cc Fe_reminsum(i,j,k) = 0. _d 0 ENDIF + Fe_ads_org = 0. _d 0 + ENDDO ENDDO ENDDO -CADJ STORE Fe_ads_org = comlev1, key = ikey_dynamics -cxx needed? - - c --------------------------------------------------------------------- #ifdef ALLOW_DIAGNOSTICS