/[MITgcm]/MITgcm_contrib/darwin2/pkg/monod/monod_forcing.F
ViewVC logotype

Diff of /MITgcm_contrib/darwin2/pkg/monod/monod_forcing.F

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

revision 1.1 by jahn, Wed Apr 13 18:56:25 2011 UTC revision 1.7 by stephd, Fri Jun 29 20:41:59 2012 UTC
# Line 43  c ANNA include wavebands_params.h Line 43  c ANNA include wavebands_params.h
43  #include "WAVEBANDS_PARAMS.h"  #include "WAVEBANDS_PARAMS.h"
44  #endif  #endif
45    
46    c choice which field to take pCO2 from for pCO2limit
47    c this assumes we use Ttendency from offline
48    #include "FFIELDS.h"
49    
50    
51  C     === Global variables ===  C     === Global variables ===
52  c tracers  c tracers
53         _RL Ptr(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy,nDarwin)         _RL Ptr(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy,nDarwin)
# Line 68  c plankton arrays Line 73  c plankton arrays
73        _RL  Phy_k(npmax,Nr)        _RL  Phy_k(npmax,Nr)
74        _RL  Phyup(npmax)        _RL  Phyup(npmax)
75        _RL  part_k(Nr)        _RL  part_k(Nr)
76    #ifdef ALLOW_CDOM
77          _RL cdom_k(Nr)
78    #endif
79  c iron partitioning  c iron partitioning
80        _RL  freefe(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)        _RL  freefe(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
81  c some working variables  c some working variables
# Line 111  C      always need for diagnostics Line 119  C      always need for diagnostics
119        _RL  Diver2(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)        _RL  Diver2(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
120        _RL  Diver3(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)        _RL  Diver3(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
121        _RL  Diver4(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)        _RL  Diver4(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
122          _RL Shannon(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
123          _RL Simpson(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
124    
125        _RL  tmpphy(npmax)        _RL  tmpphy(npmax)
126        _RL  totphy, biotot, maxphy, phymax        _RL  totphy, biotot, maxphy, phymax
# Line 124  C      always need for diagnostics Line 134  C      always need for diagnostics
134        _RL chlup(npmax)        _RL chlup(npmax)
135  #endif  #endif
136  #endif  #endif
137    #ifdef ALLOW_CDOM
138          _RL cdoml  
139          _RL dcdoml
140    #endif
141    
142  #ifdef ALLOW_DIAGNOSTICS  #ifdef ALLOW_DIAGNOSTICS
143  COJ for diagnostics  COJ for diagnostics
# Line 185  c some local variables Line 199  c some local variables
199         _RL PSiupl         _RL PSiupl
200         _RL Tlocal         _RL Tlocal
201         _RL Slocal         _RL Slocal
202           _RL pCO2local
203         _RL Qswlocal         _RL Qswlocal
204         _RL NH4l         _RL NH4l
205         _RL NO2l         _RL NO2l
# Line 248  c tendencies Line 263  c tendencies
263         _RL do2l         _RL do2l
264         _RL dZooCl(nzmax)         _RL dZooCl(nzmax)
265  c air-sea fluxes  c air-sea fluxes
266         _RL flxCO2(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)         _RL flxCO2(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
267         _RL flxALK(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)         _RL flxALK(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
268         _RL flxO2(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)         _RL flxO2(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
269  #endif  #endif
270    
271         _RL tot_Nfix         _RL tot_Nfix
# Line 277  c Line 292  c
292             Diver2(i,j,k)=0. _d 0             Diver2(i,j,k)=0. _d 0
293             Diver3(i,j,k)=0. _d 0             Diver3(i,j,k)=0. _d 0
294             Diver4(i,j,k)=0. _d 0             Diver4(i,j,k)=0. _d 0
295               Shannon(i,j,k)=0. _d 0
296               Simpson(i,j,k)=1. _d 0
297  #endif  #endif
298    
299  #ifdef ALLOW_DIAGNOSTICS  #ifdef ALLOW_DIAGNOSTICS
300  COJ for diagnostics  COJ for diagnostics
301             PParr(i,j,k) = 0. _d 0             PParr(i,j,k) = 0. _d 0
302             Nfixarr(i,j,k) = 0. _d 0             Nfixarr(i,j,k) = 0. _d 0
303    #ifdef DAR_DIAG_CHL
304               GeiderChlarr(i,j,k) = 0. _d 0
305               GeiderChl2Carr(i,j,k) = 0. _d 0
306               DoneyChlarr(i,j,k) = 0. _d 0
307               DoneyChl2Carr(i,j,k) = 0. _d 0
308               CloernChlarr(i,j,k) = 0. _d 0
309               CloernChl2Carr(i,j,k) = 0. _d 0
310    #endif
311  c ANNA_TAVE  c ANNA_TAVE
312  #ifdef WAVES_DIAG_PCHL  #ifdef WAVES_DIAG_PCHL
313             DO np=1,npmax             DO np=1,npmax
# Line 405  C ========================== i,j loops = Line 430  C ========================== i,j loops =
430  c ------------ these are convenient ------------------------------------  c ------------ these are convenient ------------------------------------
431           DO k=1,Nr           DO k=1,Nr
432            part_k(k)  = max(Ptr(i,j,k,bi,bj,iPOP),0. _d 0)            part_k(k)  = max(Ptr(i,j,k,bi,bj,iPOP),0. _d 0)
433    #ifdef ALLOW_CDOM
434              cdom_k(k)  = max(Ptr(i,j,k,bi,bj,iCDOM),0. _d 0)
435    #endif
436            DO np = 1,npmax            DO np = 1,npmax
437              Phy_k(np,k) = max(Ptr(i,j,k,bi,bj,iPhy+np-1),0. _d 0)              Phy_k(np,k) = max(Ptr(i,j,k,bi,bj,iPhy+np-1),0. _d 0)
438  #ifdef GEIDER  #ifdef GEIDER
# Line 420  c ------------ these are convenient ---- Line 448  c ------------ these are convenient ----
448  c ------------ GET CDOM_k FOR WAVEBANDS_3D and RADTRANS ----------------  c ------------ GET CDOM_k FOR WAVEBANDS_3D and RADTRANS ----------------
449  #ifdef WAVEBANDS  #ifdef WAVEBANDS
450  #if defined(DAR_CALC_ACDOM) || defined(DAR_RADTRANS)  #if defined(DAR_CALC_ACDOM) || defined(DAR_RADTRANS)
451    #ifdef ALLOW_CDOM
452            call MONOD_ACDOM(cdom_k,
453         O                     acdom_k,
454         I                     myThid)
455    #else
456           call MONOD_ACDOM(phychl_k,aphy_chl,aw,           call MONOD_ACDOM(phychl_k,aphy_chl,aw,
457       O                     acdom_k,       O                     acdom_k,
458       I                     myThid)       I                     myThid)
459    #endif
460  #else  #else
461           DO k=1,Nr           DO k=1,Nr
462            DO ilam = 1,tlam            DO ilam = 1,tlam
# Line 657  c brute force... Line 691  c brute force...
691               psil  = max(Ptr(i,j,k,bi,bj,iPOSi ),0. _d 0)               psil  = max(Ptr(i,j,k,bi,bj,iPOSi ),0. _d 0)
692               NH4l  = max(Ptr(i,j,k,bi,bj,iNH4  ),0. _d 0)               NH4l  = max(Ptr(i,j,k,bi,bj,iNH4  ),0. _d 0)
693               NO2l  = max(Ptr(i,j,k,bi,bj,iNO2  ),0. _d 0)               NO2l  = max(Ptr(i,j,k,bi,bj,iNO2  ),0. _d 0)
694    #ifdef ALLOW_CDOM
695                 cdoml = max(Ptr(i,j,k,bi,bj,iCDOM  ),0. _d 0)
696    #endif
697  #ifdef ALLOW_CARBON  #ifdef ALLOW_CARBON
698               dicl  = max(Ptr(i,j,k,bi,bj,iDIC  ),0. _d 0)               dicl  = max(Ptr(i,j,k,bi,bj,iDIC  ),0. _d 0)
699               docl  = max(Ptr(i,j,k,bi,bj,iDOC  ),0. _d 0)               docl  = max(Ptr(i,j,k,bi,bj,iDOC  ),0. _d 0)
# Line 727  c ratio of maximum species Line 764  c ratio of maximum species
764                      Diver4(i,j,k)=Diver4(i,j,k)+1. _d 0                      Diver4(i,j,k)=Diver4(i,j,k)+1. _d 0
765                   endif                   endif
766                 enddo                 enddo
767    c           totphy > thresh0
768                endif
769    c Shannon and Simpson indices
770                Shannon(i,j,k) = 0. _d 0
771    c note: minimal valid value is 1, but we set to zero below threshold
772                Simpson(i,j,k) = 0. _d 0
773                if (totphy.gt.shannon_thresh) then
774                  do np=1,npmax
775                   if (Phy(np) .gt. 0. _d 0) then
776                    tmpphy(np) = Phy(np)/totphy
777                    Shannon(i,j,k)=Shannon(i,j,k)+tmpphy(np)*LOG(tmpphy(np))
778                    Simpson(i,j,k)=Simpson(i,j,k)+tmpphy(np)*tmpphy(np)
779                   endif
780                  enddo
781                  Shannon(i,j,k) = -Shannon(i,j,k)
782                  Simpson(i,j,k) = 1./Simpson(i,j,k)
783              endif              endif
784  #endif  #endif
785    
# Line 763  c for explicit sinking of particulate ma Line 816  c for explicit sinking of particulate ma
816               Slocal = salt(i,j,k,bi,bj)               Slocal = salt(i,j,k,bi,bj)
817  #endif  #endif
818    
819    c choice where to get pCO2 from
820    c taking from igsm dic run - fed through Tflux array
821    c               pCO2local=surfaceForcingT(i,j,bi,bj)
822    c or from darwin carbon module
823    #ifdef ALLOW_CARBON
824                   pCO2local=pCO2(i,j,bi,bj)
825    #else
826                   pCO2local=280. _d -6
827    #endif
828    
829               freefu = max(freefe(i,j,k),0. _d 0)               freefu = max(freefe(i,j,k),0. _d 0)
830               if (k.eq.1) then               if (k.eq.1) then
831                 inputFel = inputFe(i,j,bi,bj)                 inputFel = inputFe(i,j,bi,bj)
# Line 807  c set tendencies to 0 Line 870  c set tendencies to 0
870                 dphychl(np)=0. _d 0                 dphychl(np)=0. _d 0
871               enddo               enddo
872  #endif  #endif
873    #ifdef ALLOW_CDOM
874                dcdoml=0. _d 0
875    #endif
876  #ifdef ALLOW_CARBON  #ifdef ALLOW_CARBON
877               ddicl=0. _d 0               ddicl=0. _d 0
878               ddocl=0. _d 0               ddocl=0. _d 0
# Line 876  c ANNA pass extra variables if WAVEBANDS Line 942  c ANNA pass extra variables if WAVEBANDS
942       I                       pofeupl, psiupl,       I                       pofeupl, psiupl,
943       I                       PARl,       I                       PARl,
944       I                       Tlocal, Slocal,       I                       Tlocal, Slocal,
945         I                       pCO2local,
946       I                       freefu, inputFel,       I                       freefu, inputFel,
947       I                       bottom, dzlocal,       I                       bottom, dzlocal,
948       O                       Rstarl, RNstarl,       O                       Rstarl, RNstarl,
# Line 906  c ANNA pass extra variables if WAVEBANDS Line 973  c ANNA pass extra variables if WAVEBANDS
973       I                       dphychl,       I                       dphychl,
974       I                       chlup,       I                       chlup,
975  #endif  #endif
976    #ifdef ALLOW_CDOM
977         O                       dcdoml,
978         I                       cdoml,
979    #endif
980  #ifdef WAVEBANDS  #ifdef WAVEBANDS
981       I                       PARw_k(1,k),       I                       PARw_k(1,k),
982  #endif  #endif
# Line 931  c            endif Line 1002  c            endif
1002  c  c
1003  #ifdef IRON_SED_SOURCE  #ifdef IRON_SED_SOURCE
1004  c only above minimum depth (continental shelf)  c only above minimum depth (continental shelf)
1005               if (rF(k).lt.depthfesed) then               if (rF(k).gt.-depthfesed) then
1006  c only if bottom layer  c only if bottom layer
1007                 if (bottom.eq.1.0 _d 0) then                 if (bottom.eq.1.0 _d 0) then
1008  #ifdef IRON_SED_SOURCE_VARIABLE  #ifdef IRON_SED_SOURCE_VARIABLE
# Line 966  c Line 1037  c
1037               picupl = PICl               picupl = PICl
1038  c include surface forcing  c include surface forcing
1039               if (k.eq.1) then               if (k.eq.1) then
1040                ddicl  =  ddicl  + flxCO2(i,j,bi,bj)                ddicl  =  ddicl  + flxCO2(i,j)
1041                dalkl  =  dalkl  + flxALK(i,j,bi,bj)                dalkl  =  dalkl  + flxALK(i,j)
1042                do2l   =  do2l   + flxO2(i,j,bi,bj)                do2l   =  do2l   + flxO2(i,j)
1043               endif               endif
1044  #endif  #endif
1045  c  c
# Line 1112  c in darwin_plankton this is stored for Line 1183  c in darwin_plankton this is stored for
1183  #endif  #endif
1184  #endif  #endif
1185           ENDDO           ENDDO
1186    #ifdef ALLOW_CDOM
1187              Ptr(i,j,k,bi,bj,iCDOM ) = Ptr(i,j,k,bi,bj,iCDOM ) +
1188         &                                  dtplankton*dcdoml
1189    #endif
1190  #ifdef ALLOW_CARBON  #ifdef ALLOW_CARBON
1191            Ptr(i,j,k,bi,bj,iDIC ) = Ptr(i,j,k,bi,bj,iDIC ) +            Ptr(i,j,k,bi,bj,iDIC ) = Ptr(i,j,k,bi,bj,iDIC ) +
1192       &                                  dtplankton*ddicl       &                                  dtplankton*ddicl
# Line 1331  Coj            no Eu at surface (yet) Line 1406  Coj            no Eu at surface (yet)
1406  #ifdef ALLOW_CARBON  #ifdef ALLOW_CARBON
1407               if (k.eq.1) then               if (k.eq.1) then
1408                SURave(i,j,bi,bj)    =SURave(i,j,bi,bj)+                SURave(i,j,bi,bj)    =SURave(i,j,bi,bj)+
1409       &                              flxCO2(i,j,bi,bj)*dtplankton       &                              flxCO2(i,j)*dtplankton
1410                SURCave(i,j,bi,bj)    =SURCave(i,j,bi,bj)+                SURCave(i,j,bi,bj)    =SURCave(i,j,bi,bj)+
1411       &                              FluxCO2(i,j,bi,bj)*dtplankton       &                              FluxCO2(i,j,bi,bj)*dtplankton
1412                SUROave(i,j,bi,bj)   =SUROave(i,j,bi,bj)+                SUROave(i,j,bi,bj)   =SUROave(i,j,bi,bj)+
1413       &                              flxO2(i,j,bi,bj)*dtplankton       &                              flxO2(i,j)*dtplankton
1414                pCO2ave(i,j,bi,bj)   =pCO2ave(i,j,bi,bj)+                pCO2ave(i,j,bi,bj)   =pCO2ave(i,j,bi,bj)+
1415       &                              pCO2(i,j,bi,bj)*dtplankton       &                              pCO2(i,j,bi,bj)*dtplankton
1416                pHave(i,j,bi,bj)     =pHave(i,j,bi,bj)+                pHave(i,j,bi,bj)     =pHave(i,j,bi,bj)+
# Line 1438  c ANNA end TAVE Line 1513  c ANNA end TAVE
1513          WRITE(diagname,'(A8)') 'Diver4  '          WRITE(diagname,'(A8)') 'Diver4  '
1514          CALL DIAGNOSTICS_FILL( Diver4(1-Olx,1-Oly,1), diagname,          CALL DIAGNOSTICS_FILL( Diver4(1-Olx,1-Oly,1), diagname,
1515       &                         0,Nr,2,bi,bj,myThid )       &                         0,Nr,2,bi,bj,myThid )
1516            WRITE(diagname,'(A8)') 'Shannon '
1517            CALL DIAGNOSTICS_FILL( Shannon(1-Olx,1-Oly,1), diagname,
1518         &                         0,Nr,2,bi,bj,myThid )
1519            WRITE(diagname,'(A8)') 'Simpson '
1520            CALL DIAGNOSTICS_FILL( Simpson(1-Olx,1-Oly,1), diagname,
1521         &                         0,Nr,2,bi,bj,myThid )
1522  #endif  #endif
1523  #ifdef ALLOW_DIAZ  #ifdef ALLOW_DIAZ
1524  #ifdef DAR_DIAG_NFIXP  #ifdef DAR_DIAG_NFIXP
# Line 1463  c ANNA end TAVE Line 1544  c ANNA end TAVE
1544       &                         0,Nr,2,bi,bj,myThid )       &                         0,Nr,2,bi,bj,myThid )
1545  #endif  #endif
1546  #ifdef ALLOW_CARBON  #ifdef ALLOW_CARBON
1547          CALL DIAGNOSTICS_FILL( flxCO2(1-Olx,1-Oly,bi,bj), 'DICTFLX ',          CALL DIAGNOSTICS_FILL( flxCO2(1-Olx,1-Oly), 'DICTFLX ',
1548       &                         0,1,2,bi,bj,myThid )       &                         0,1,2,bi,bj,myThid )
1549          CALL DIAGNOSTICS_FILL( FluxCO2(1-Olx,1-Oly,bi,bj), 'DICCFLX ',          CALL DIAGNOSTICS_FILL( FluxCO2(1-Olx,1-Oly,bi,bj), 'DICCFLX ',
1550       &                         0,1,2,bi,bj,myThid )       &                         0,1,2,bi,bj,myThid )
1551          CALL DIAGNOSTICS_FILL( flxO2(1-Olx,1-Oly,bi,bj), 'DICOFLX ',          CALL DIAGNOSTICS_FILL( flxO2(1-Olx,1-Oly), 'DICOFLX ',
1552       &                         0,1,2,bi,bj,myThid )       &                         0,1,2,bi,bj,myThid )
1553          CALL DIAGNOSTICS_FILL( pCO2(1-Olx,1-Oly,bi,bj), 'DICPCO2 ',          CALL DIAGNOSTICS_FILL( pCO2(1-Olx,1-Oly,bi,bj), 'DICPCO2 ',
1554       &                         0,1,2,bi,bj,myThid )       &                         0,1,2,bi,bj,myThid )

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.7

  ViewVC Help
Powered by ViewVC 1.1.22