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

Diff of /MITgcm_contrib/bling/pkg/bling_remineralization.F

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

revision 1.2 by mmazloff, Sun Feb 28 21:49:24 2016 UTC revision 1.5 by jmc, Thu May 19 18:33:59 2016 UTC
# Line 106  C     P_recycle     :: recycling of newl Line 106  C     P_recycle     :: recycling of newl
106  C     Fe_recycle    :: recycling of newly-produced organic iron  C     Fe_recycle    :: recycling of newly-produced organic iron
107  c xxx to be completed  c xxx to be completed
108        INTEGER i,j,k                INTEGER i,j,k        
109          INTEGER bttmlyr
110        _RL PONflux_u        _RL PONflux_u
111        _RL POPflux_u        _RL POPflux_u
112        _RL PFEflux_u        _RL PFEflux_u
# Line 126  c xxx to be completed Line 127  c xxx to be completed
127        _RL lig_stability        _RL lig_stability
128        _RL FreeFe        _RL FreeFe
129        _RL Fe_ads_inorg(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)        _RL Fe_ads_inorg(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
130        _RL Fe_ads_org(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)        _RL Fe_ads_org
131        _RL log_btm_flx        _RL log_btm_flx
132        _RL Fe_reminp(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)        _RL Fe_reminp(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
133        _RL o2_upper        _RL o2_upper
# Line 155  CEOP Line 156  CEOP
156        
157  c ---------------------------------------------------------------------  c ---------------------------------------------------------------------
158  c  Initialize output and diagnostics  c  Initialize output and diagnostics
159    
160         DO k=1,Nr         DO k=1,Nr
161          DO j=jmin,jmax          DO j=jmin,jmax
162            DO i=imin,imax            DO i=imin,imax
               Fe_ads_org(i,j,k)   = 0. _d 0  
163                Fe_ads_inorg(i,j,k) = 0. _d 0                Fe_ads_inorg(i,j,k) = 0. _d 0
164                N_reminp(i,j,k)     = 0. _d 0                N_reminp(i,j,k)     = 0. _d 0
165                P_reminp(i,j,k)     = 0. _d 0                P_reminp(i,j,k)     = 0. _d 0
# Line 184  c  Initialize output and diagnostics Line 185  c  Initialize output and diagnostics
185  c ---------------------------------------------------------------------  c ---------------------------------------------------------------------
186  c  Remineralization  c  Remineralization
187                    
 CADJ STORE Fe_ads_org = comlev1, key = ikey_dynamics  
 cxx needed?  
   
188  C$TAF LOOP = parallel  C$TAF LOOP = parallel
189        DO j=jmin,jmax         DO j=jmin,jmax
190  C$TAF LOOP = parallel  C$TAF LOOP = parallel
191         DO i=imin,imax          DO i=imin,imax
 cmm C$TAF init upper_flux = static, Nr  
192    
193  C  Initialize upper flux  C  Initialize upper flux
194          PONflux_u            = 0. _d 0          PONflux_u            = 0. _d 0
# Line 200  C  Initialize upper flux Line 197  C  Initialize upper flux
197          CaCO3flux_u          = 0. _d 0          CaCO3flux_u          = 0. _d 0
198    
199          DO k=1,Nr          DO k=1,Nr
200  c C$TAF STORE PONflux_u = upper_flux  
201  c C$TAF STORE POPflux_u = upper_flux           Fe_ads_org   = 0. _d 0
202  c C$TAF STORE PFEflux_u = upper_flux  
203  c C$TAF STORE CaCO3flux_u = upper_flux  C ARE WE ON THE BOTTOM
204  CADJ STORE PONflux_u, POPflux_u, PFEflux_u, CaCO3flux_u =           bttmlyr = 1
205  CADJ &     comlev1, key = ikey_dynamics, kind = isbyte            IF (k.LT.Nr) THEN
206  CADJ STORE Fe_ads_org =             IF (hFacC(i,j,k+1,bi,bj).GT.0) bttmlyr = 0
207  CADJ &     comlev1, key = ikey_dynamics, kind = isbyte  C          we are not yet at the bottom
208  CMM)            ENDIF
209    
210           IF ( hFacC(i,j,k,bi,bj).gt.0. _d 0 ) THEN           IF ( hFacC(i,j,k,bi,bj).gt.0. _d 0 ) THEN
211    
# Line 249  C  CaCO3 flux leaving the cell Line 246  C  CaCO3 flux leaving the cell
246       &           *hFacC(i,j,k,bi,bj))       &           *hFacC(i,j,k,bi,bj))
247  C!! multiply by intercept_frac ???  C!! multiply by intercept_frac ???
248    
   
249  C  Start with cells that are not the deepest cells  C  Start with cells that are not the deepest cells
250            IF ((k.LT.Nr) .AND. (hFacC(i,j,k+1,bi,bj).GT.0)) THEN            IF (bttmlyr.EQ.0) THEN
   
251  C  Nutrient accumulation in a cell is given by the biological production  C  Nutrient accumulation in a cell is given by the biological production
252  C  (and instant remineralization) of particulate organic matter  C  (and instant remineralization) of particulate organic matter
253  C  plus flux thought upper interface minus flux through lower interface.  C  plus flux thought upper interface minus flux through lower interface.
# Line 267  C  (Since not deepest cell: hFacC=1) Line 262  C  (Since not deepest cell: hFacC=1)
262       &                    *drF(k) - CaCO3flux_l)*recip_drF(k)       &                    *drF(k) - CaCO3flux_l)*recip_drF(k)
263    
264             Fe_sed(i,j,k) = 0. _d 0             Fe_sed(i,j,k) = 0. _d 0
265    C NOW DO BOTTOM LAYER
   
266            ELSE            ELSE
267  C  If this layer is adjacent to bottom topography or it is the deepest  C  If this layer is adjacent to bottom topography or it is the deepest
268  C  cell of the domain, then remineralize/dissolve in this grid cell  C  cell of the domain, then remineralize/dissolve in this grid cell
# Line 294  C  Maximum value added for numerical sta Line 288  C  Maximum value added for numerical sta
288             Fe_sed(i,j,k) = min(1. _d -11,             Fe_sed(i,j,k) = min(1. _d -11,
289       &            max(epsln, FetoC_sed * POC_sed * recip_drF(k)       &            max(epsln, FetoC_sed * POC_sed * recip_drF(k)
290       &            *recip_hFacC(i,j,k,bi,bj)))       &            *recip_hFacC(i,j,k,bi,bj)))
291                  
292  #ifdef BLING_ADJOINT_SAFE  #ifdef BLING_ADJOINT_SAFE
293             Fe_sed(i,j,k) = 0. _d 0             Fe_sed(i,j,k) = 0. _d 0
294  #endif  #endif
# Line 412  c     &           min(0.5/PTRACERS_dTLev Line 406  c     &           min(0.5/PTRACERS_dTLev
406  c     &           *CtoP/NUTfac*12.01/wsink)**(0.58)*FreeFe  c     &           *CtoP/NUTfac*12.01/wsink)**(0.58)*FreeFe
407    
408  #ifndef BLING_ADJOINT_SAFE  #ifndef BLING_ADJOINT_SAFE
409              Fe_ads_org(i,j,k) =              Fe_ads_org =
410       &           kFE_org*(PONflux_l/(epsln + wsink)       &           kFE_org*(PONflux_l/(epsln + wsink)
411       &             * MasstoN)**(0.58)*FreeFe       &             * MasstoN)**(0.58)*FreeFe
412  #else  #else
413              Fe_ads_org(i,j,k) =              Fe_ads_org =
414       &           kFE_org*(PONflux_l/(epsln + wsink0)       &           kFE_org*(PONflux_l/(epsln + wsink0)
415       &             * MasstoN)**(0.58)*FreeFe       &             * MasstoN)**(0.58)*FreeFe
416  #endif  #endif
# Line 429  C  it is completely remineralized (fe 2+ Line 423  C  it is completely remineralized (fe 2+
423  C  in oxidizing environments).  C  in oxidizing environments).
424    
425             PFEflux_l = (PFEflux_u+(Fe_spm(i,j,k)+Fe_ads_inorg(i,j,k)             PFEflux_l = (PFEflux_u+(Fe_spm(i,j,k)+Fe_ads_inorg(i,j,k)
426       &            +Fe_ads_org(i,j,k))*drF(k)       &            +Fe_ads_org)*drF(k)
427       &            *hFacC(i,j,k,bi,bj))/(1+zremin*drF(k)       &            *hFacC(i,j,k,bi,bj))/(1+zremin*drF(k)
428       &            *hFacC(i,j,k,bi,bj))       &            *hFacC(i,j,k,bi,bj))
429    
# Line 449  c this is calculated last for the deepes Line 443  c this is calculated last for the deepes
443    
444             Fe_reminp(i,j,k) = (pfeflux_u+(Fe_spm(i,j,k)             Fe_reminp(i,j,k) = (pfeflux_u+(Fe_spm(i,j,k)
445       &            +Fe_ads_inorg(i,j,k)       &            +Fe_ads_inorg(i,j,k)
446       &            +Fe_ads_org(i,j,k))*drF(k)       &            +Fe_ads_org)*drF(k)
447       &            *hFacC(i,j,k,bi,bj)-pfeflux_l)*recip_drF(k)       &            *hFacC(i,j,k,bi,bj)-pfeflux_l)*recip_drF(k)
448       &            *recip_hFacC(i,j,k,bi,bj)       &            *recip_hFacC(i,j,k,bi,bj)
449  C!! there's an intercept_frac here... need to add  C!! there's an intercept_frac here... need to add
# Line 463  C  Prepare the tracers for the next laye Line 457  C  Prepare the tracers for the next laye
457    
458  c  c
459            Fe_reminsum(i,j,k) = Fe_reminp(i,j,k) + Fe_sed(i,j,k)            Fe_reminsum(i,j,k) = Fe_reminp(i,j,k) + Fe_sed(i,j,k)
460       &                       - Fe_ads_org(i,j,k) - Fe_ads_inorg(i,j,k)       &                       - Fe_ads_org - Fe_ads_inorg(i,j,k)
461  cc             Fe_reminsum(i,j,k) = 0. _d 0  cc             Fe_reminsum(i,j,k) = 0. _d 0
462    
463           ENDIF           ENDIF
464    
465             Fe_ads_org   = 0. _d 0
466    
467          ENDDO          ENDDO
468         ENDDO         ENDDO
469        ENDDO        ENDDO
470    
 CADJ STORE Fe_ads_org = comlev1, key = ikey_dynamics  
 cxx needed?  
   
   
471  c ---------------------------------------------------------------------  c ---------------------------------------------------------------------
472    
473  #ifdef ALLOW_DIAGNOSTICS  #ifdef ALLOW_DIAGNOSTICS
# Line 483  c -------------------------------------- Line 475  c --------------------------------------
475    
476  c 3d local variables  c 3d local variables
477  c        CALL DIAGNOSTICS_FILL(POC_flux,'BLGPOCF ',0,Nr,2,bi,bj,myThid)  c        CALL DIAGNOSTICS_FILL(POC_flux,'BLGPOCF ',0,Nr,2,bi,bj,myThid)
478          CALL DIAGNOSTICS_FILL(Fe_ads_inorg,'BLGFEAI',0,Nr,2,bi,bj,          CALL DIAGNOSTICS_FILL(Fe_ads_inorg, 'BLGFEAI ',0,Nr,2,bi,bj,
479       &       myThid)       &       myThid)
480          CALL DIAGNOSTICS_FILL(Fe_sed,'BLGFESED',0,Nr,2,bi,bj,myThid)          CALL DIAGNOSTICS_FILL(Fe_sed,   'BLGFESED',0,Nr,2,bi,bj,myThid)
481          CALL DIAGNOSTICS_FILL(Fe_reminp,'BLGFEREM',0,Nr,2,bi,bj,myThid)          CALL DIAGNOSTICS_FILL(Fe_reminp,'BLGFEREM',0,Nr,2,bi,bj,myThid)
482          CALL DIAGNOSTICS_FILL(N_den_benthic,'BLGNDENB',0,Nr,2,bi,bj,          CALL DIAGNOSTICS_FILL(N_den_benthic,'BLGNDENB',0,Nr,2,bi,bj,
483       &       myThid)       &       myThid)
484  c        CALL DIAGNOSTICS_FILL(N_den_pelag,'BLGNDENP',0,Nr,2,bi,bj,myThid)  c        CALL DIAGNOSTICS_FILL(N_den_pelag,'BLGNDENP',0,Nr,2,bi,bj,myThid)
485          CALL DIAGNOSTICS_FILL(N_reminp,'BLGNREM ',0,Nr,2,bi,bj,myThid)          CALL DIAGNOSTICS_FILL(N_reminp, 'BLGNREM ',0,Nr,2,bi,bj,myThid)
486          CALL DIAGNOSTICS_FILL(P_reminp,'BLGPREM ',0,Nr,2,bi,bj,myThid)          CALL DIAGNOSTICS_FILL(P_reminp, 'BLGPREM ',0,Nr,2,bi,bj,myThid)
487  c 2d local variables  c 2d local variables
488          CALL DIAGNOSTICS_FILL(Fe_burial,'BLGFEBUR',0,1,2,bi,bj,myThid)          CALL DIAGNOSTICS_FILL(Fe_burial,'BLGFEBUR',0,1,2,bi,bj,myThid)
489          CALL DIAGNOSTICS_FILL(NO3_sed,'BLGNSED ',0,1,2,bi,bj,myThid)          CALL DIAGNOSTICS_FILL(NO3_sed,  'BLGNSED ',0,1,2,bi,bj,myThid)
490          CALL DIAGNOSTICS_FILL(PO4_sed,'BLGPSED ',0,1,2,bi,bj,myThid)          CALL DIAGNOSTICS_FILL(PO4_sed,  'BLGPSED ',0,1,2,bi,bj,myThid)
491          CALL DIAGNOSTICS_FILL(O2_sed,'BLGO2SED',0,1,2,bi,bj,myThid)          CALL DIAGNOSTICS_FILL(O2_sed,   'BLGO2SED',0,1,2,bi,bj,myThid)
492  c these variables are currently 1d, could be 3d for diagnostics  c these variables are currently 1d, could be 3d for diagnostics
493  c (or diag_fill could be called inside loop - which is faster?)  c (or diag_fill could be called inside loop - which is faster?)
494  c        CALL DIAGNOSTICS_FILL(zremin,'BLGZREM ',0,Nr,2,bi,bj,myThid)  c        CALL DIAGNOSTICS_FILL(zremin,'BLGZREM ',0,Nr,2,bi,bj,myThid)

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.5

  ViewVC Help
Powered by ViewVC 1.1.22