/[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.8 by jahn, Sat Jun 30 19:23:04 2012 UTC
# Line 21  C======================================= Line 21  C=======================================
21  #include "PARAMS.h"  #include "PARAMS.h"
22  #include "GRID.h"  #include "GRID.h"
23  #include "DYNVARS.h"  #include "DYNVARS.h"
24  #ifdef USE_QSW  c for Qsw and/or surfaceForcingT
25    c choice which field to take pCO2 from for pCO2limit
26    c this assumes we use Ttendency from offline
27  #include "FFIELDS.h"  #include "FFIELDS.h"
 #endif  
28  #ifdef ALLOW_LONGSTEP  #ifdef ALLOW_LONGSTEP
29  #include "LONGSTEP.h"  #include "LONGSTEP.h"
30  #endif  #endif
# Line 43  c ANNA include wavebands_params.h Line 44  c ANNA include wavebands_params.h
44  #include "WAVEBANDS_PARAMS.h"  #include "WAVEBANDS_PARAMS.h"
45  #endif  #endif
46    
47    
48  C     === Global variables ===  C     === Global variables ===
49  c tracers  c tracers
50         _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 70  c plankton arrays
70        _RL  Phy_k(npmax,Nr)        _RL  Phy_k(npmax,Nr)
71        _RL  Phyup(npmax)        _RL  Phyup(npmax)
72        _RL  part_k(Nr)        _RL  part_k(Nr)
73    #ifdef ALLOW_CDOM
74          _RL cdom_k(Nr)
75    #endif
76  c iron partitioning  c iron partitioning
77        _RL  freefe(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)        _RL  freefe(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
78  c some working variables  c some working variables
# Line 111  C      always need for diagnostics Line 116  C      always need for diagnostics
116        _RL  Diver2(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)        _RL  Diver2(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
117        _RL  Diver3(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)        _RL  Diver3(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
118        _RL  Diver4(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)        _RL  Diver4(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
119          _RL Shannon(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
120          _RL Simpson(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
121    
122        _RL  tmpphy(npmax)        _RL  tmpphy(npmax)
123        _RL  totphy, biotot, maxphy, phymax        _RL  totphy, biotot, maxphy, phymax
# Line 124  C      always need for diagnostics Line 131  C      always need for diagnostics
131        _RL chlup(npmax)        _RL chlup(npmax)
132  #endif  #endif
133  #endif  #endif
134    #ifdef ALLOW_CDOM
135          _RL cdoml  
136          _RL dcdoml
137    #endif
138    
139  #ifdef ALLOW_DIAGNOSTICS  #ifdef ALLOW_DIAGNOSTICS
140  COJ for diagnostics  COJ for diagnostics
# Line 185  c some local variables Line 196  c some local variables
196         _RL PSiupl         _RL PSiupl
197         _RL Tlocal         _RL Tlocal
198         _RL Slocal         _RL Slocal
199           _RL pCO2local
200         _RL Qswlocal         _RL Qswlocal
201         _RL NH4l         _RL NH4l
202         _RL NO2l         _RL NO2l
# Line 248  c tendencies Line 260  c tendencies
260         _RL do2l         _RL do2l
261         _RL dZooCl(nzmax)         _RL dZooCl(nzmax)
262  c air-sea fluxes  c air-sea fluxes
263         _RL flxCO2(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)         _RL flxCO2(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
264         _RL flxALK(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)         _RL flxALK(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
265         _RL flxO2(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)         _RL flxO2(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
266  #endif  #endif
267    
268         _RL tot_Nfix         _RL tot_Nfix
# Line 277  c Line 289  c
289             Diver2(i,j,k)=0. _d 0             Diver2(i,j,k)=0. _d 0
290             Diver3(i,j,k)=0. _d 0             Diver3(i,j,k)=0. _d 0
291             Diver4(i,j,k)=0. _d 0             Diver4(i,j,k)=0. _d 0
292               Shannon(i,j,k)=0. _d 0
293               Simpson(i,j,k)=1. _d 0
294  #endif  #endif
295    
296  #ifdef ALLOW_DIAGNOSTICS  #ifdef ALLOW_DIAGNOSTICS
297  COJ for diagnostics  COJ for diagnostics
298             PParr(i,j,k) = 0. _d 0             PParr(i,j,k) = 0. _d 0
299             Nfixarr(i,j,k) = 0. _d 0             Nfixarr(i,j,k) = 0. _d 0
300    #ifdef DAR_DIAG_CHL
301               GeiderChlarr(i,j,k) = 0. _d 0
302               GeiderChl2Carr(i,j,k) = 0. _d 0
303               DoneyChlarr(i,j,k) = 0. _d 0
304               DoneyChl2Carr(i,j,k) = 0. _d 0
305               CloernChlarr(i,j,k) = 0. _d 0
306               CloernChl2Carr(i,j,k) = 0. _d 0
307    #endif
308  c ANNA_TAVE  c ANNA_TAVE
309  #ifdef WAVES_DIAG_PCHL  #ifdef WAVES_DIAG_PCHL
310             DO np=1,npmax             DO np=1,npmax
# Line 405  C ========================== i,j loops = Line 427  C ========================== i,j loops =
427  c ------------ these are convenient ------------------------------------  c ------------ these are convenient ------------------------------------
428           DO k=1,Nr           DO k=1,Nr
429            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)
430    #ifdef ALLOW_CDOM
431              cdom_k(k)  = max(Ptr(i,j,k,bi,bj,iCDOM),0. _d 0)
432    #endif
433            DO np = 1,npmax            DO np = 1,npmax
434              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)
435  #ifdef GEIDER  #ifdef GEIDER
# Line 420  c ------------ these are convenient ---- Line 445  c ------------ these are convenient ----
445  c ------------ GET CDOM_k FOR WAVEBANDS_3D and RADTRANS ----------------  c ------------ GET CDOM_k FOR WAVEBANDS_3D and RADTRANS ----------------
446  #ifdef WAVEBANDS  #ifdef WAVEBANDS
447  #if defined(DAR_CALC_ACDOM) || defined(DAR_RADTRANS)  #if defined(DAR_CALC_ACDOM) || defined(DAR_RADTRANS)
448    #ifdef ALLOW_CDOM
449            call MONOD_ACDOM(cdom_k,
450         O                     acdom_k,
451         I                     myThid)
452    #else
453           call MONOD_ACDOM(phychl_k,aphy_chl,aw,           call MONOD_ACDOM(phychl_k,aphy_chl,aw,
454       O                     acdom_k,       O                     acdom_k,
455       I                     myThid)       I                     myThid)
456    #endif
457  #else  #else
458           DO k=1,Nr           DO k=1,Nr
459            DO ilam = 1,tlam            DO ilam = 1,tlam
# Line 657  c brute force... Line 688  c brute force...
688               psil  = max(Ptr(i,j,k,bi,bj,iPOSi ),0. _d 0)               psil  = max(Ptr(i,j,k,bi,bj,iPOSi ),0. _d 0)
689               NH4l  = max(Ptr(i,j,k,bi,bj,iNH4  ),0. _d 0)               NH4l  = max(Ptr(i,j,k,bi,bj,iNH4  ),0. _d 0)
690               NO2l  = max(Ptr(i,j,k,bi,bj,iNO2  ),0. _d 0)               NO2l  = max(Ptr(i,j,k,bi,bj,iNO2  ),0. _d 0)
691    #ifdef ALLOW_CDOM
692                 cdoml = max(Ptr(i,j,k,bi,bj,iCDOM  ),0. _d 0)
693    #endif
694  #ifdef ALLOW_CARBON  #ifdef ALLOW_CARBON
695               dicl  = max(Ptr(i,j,k,bi,bj,iDIC  ),0. _d 0)               dicl  = max(Ptr(i,j,k,bi,bj,iDIC  ),0. _d 0)
696               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 761  c ratio of maximum species
761                      Diver4(i,j,k)=Diver4(i,j,k)+1. _d 0                      Diver4(i,j,k)=Diver4(i,j,k)+1. _d 0
762                   endif                   endif
763                 enddo                 enddo
764    c           totphy > thresh0
765                endif
766    c Shannon and Simpson indices
767                Shannon(i,j,k) = 0. _d 0
768    c note: minimal valid value is 1, but we set to zero below threshold
769                Simpson(i,j,k) = 0. _d 0
770                if (totphy.gt.shannon_thresh) then
771                  do np=1,npmax
772                   if (Phy(np) .gt. 0. _d 0) then
773                    tmpphy(np) = Phy(np)/totphy
774                    Shannon(i,j,k)=Shannon(i,j,k)+tmpphy(np)*LOG(tmpphy(np))
775                    Simpson(i,j,k)=Simpson(i,j,k)+tmpphy(np)*tmpphy(np)
776                   endif
777                  enddo
778                  Shannon(i,j,k) = -Shannon(i,j,k)
779                  Simpson(i,j,k) = 1./Simpson(i,j,k)
780              endif              endif
781  #endif  #endif
782    
# Line 763  c for explicit sinking of particulate ma Line 813  c for explicit sinking of particulate ma
813               Slocal = salt(i,j,k,bi,bj)               Slocal = salt(i,j,k,bi,bj)
814  #endif  #endif
815    
816    c choice where to get pCO2 from
817    c taking from igsm dic run - fed through Tflux array
818    c               pCO2local=surfaceForcingT(i,j,bi,bj)
819    c or from darwin carbon module
820    #ifdef ALLOW_CARBON
821                   pCO2local=pCO2(i,j,bi,bj)
822    #else
823                   pCO2local=280. _d -6
824    #endif
825    
826               freefu = max(freefe(i,j,k),0. _d 0)               freefu = max(freefe(i,j,k),0. _d 0)
827               if (k.eq.1) then               if (k.eq.1) then
828                 inputFel = inputFe(i,j,bi,bj)                 inputFel = inputFe(i,j,bi,bj)
# Line 807  c set tendencies to 0 Line 867  c set tendencies to 0
867                 dphychl(np)=0. _d 0                 dphychl(np)=0. _d 0
868               enddo               enddo
869  #endif  #endif
870    #ifdef ALLOW_CDOM
871                dcdoml=0. _d 0
872    #endif
873  #ifdef ALLOW_CARBON  #ifdef ALLOW_CARBON
874               ddicl=0. _d 0               ddicl=0. _d 0
875               ddocl=0. _d 0               ddocl=0. _d 0
# Line 876  c ANNA pass extra variables if WAVEBANDS Line 939  c ANNA pass extra variables if WAVEBANDS
939       I                       pofeupl, psiupl,       I                       pofeupl, psiupl,
940       I                       PARl,       I                       PARl,
941       I                       Tlocal, Slocal,       I                       Tlocal, Slocal,
942         I                       pCO2local,
943       I                       freefu, inputFel,       I                       freefu, inputFel,
944       I                       bottom, dzlocal,       I                       bottom, dzlocal,
945       O                       Rstarl, RNstarl,       O                       Rstarl, RNstarl,
# Line 906  c ANNA pass extra variables if WAVEBANDS Line 970  c ANNA pass extra variables if WAVEBANDS
970       I                       dphychl,       I                       dphychl,
971       I                       chlup,       I                       chlup,
972  #endif  #endif
973    #ifdef ALLOW_CDOM
974         O                       dcdoml,
975         I                       cdoml,
976    #endif
977  #ifdef WAVEBANDS  #ifdef WAVEBANDS
978       I                       PARw_k(1,k),       I                       PARw_k(1,k),
979  #endif  #endif
# Line 931  c            endif Line 999  c            endif
999  c  c
1000  #ifdef IRON_SED_SOURCE  #ifdef IRON_SED_SOURCE
1001  c only above minimum depth (continental shelf)  c only above minimum depth (continental shelf)
1002               if (rF(k).lt.depthfesed) then               if (rF(k).gt.-depthfesed) then
1003  c only if bottom layer  c only if bottom layer
1004                 if (bottom.eq.1.0 _d 0) then                 if (bottom.eq.1.0 _d 0) then
1005  #ifdef IRON_SED_SOURCE_VARIABLE  #ifdef IRON_SED_SOURCE_VARIABLE
# Line 966  c Line 1034  c
1034               picupl = PICl               picupl = PICl
1035  c include surface forcing  c include surface forcing
1036               if (k.eq.1) then               if (k.eq.1) then
1037                ddicl  =  ddicl  + flxCO2(i,j,bi,bj)                ddicl  =  ddicl  + flxCO2(i,j)
1038                dalkl  =  dalkl  + flxALK(i,j,bi,bj)                dalkl  =  dalkl  + flxALK(i,j)
1039                do2l   =  do2l   + flxO2(i,j,bi,bj)                do2l   =  do2l   + flxO2(i,j)
1040               endif               endif
1041  #endif  #endif
1042  c  c
# Line 1112  c in darwin_plankton this is stored for Line 1180  c in darwin_plankton this is stored for
1180  #endif  #endif
1181  #endif  #endif
1182           ENDDO           ENDDO
1183    #ifdef ALLOW_CDOM
1184              Ptr(i,j,k,bi,bj,iCDOM ) = Ptr(i,j,k,bi,bj,iCDOM ) +
1185         &                                  dtplankton*dcdoml
1186    #endif
1187  #ifdef ALLOW_CARBON  #ifdef ALLOW_CARBON
1188            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 ) +
1189       &                                  dtplankton*ddicl       &                                  dtplankton*ddicl
# Line 1331  Coj            no Eu at surface (yet) Line 1403  Coj            no Eu at surface (yet)
1403  #ifdef ALLOW_CARBON  #ifdef ALLOW_CARBON
1404               if (k.eq.1) then               if (k.eq.1) then
1405                SURave(i,j,bi,bj)    =SURave(i,j,bi,bj)+                SURave(i,j,bi,bj)    =SURave(i,j,bi,bj)+
1406       &                              flxCO2(i,j,bi,bj)*dtplankton       &                              flxCO2(i,j)*dtplankton
1407                SURCave(i,j,bi,bj)    =SURCave(i,j,bi,bj)+                SURCave(i,j,bi,bj)    =SURCave(i,j,bi,bj)+
1408       &                              FluxCO2(i,j,bi,bj)*dtplankton       &                              FluxCO2(i,j,bi,bj)*dtplankton
1409                SUROave(i,j,bi,bj)   =SUROave(i,j,bi,bj)+                SUROave(i,j,bi,bj)   =SUROave(i,j,bi,bj)+
1410       &                              flxO2(i,j,bi,bj)*dtplankton       &                              flxO2(i,j)*dtplankton
1411                pCO2ave(i,j,bi,bj)   =pCO2ave(i,j,bi,bj)+                pCO2ave(i,j,bi,bj)   =pCO2ave(i,j,bi,bj)+
1412       &                              pCO2(i,j,bi,bj)*dtplankton       &                              pCO2(i,j,bi,bj)*dtplankton
1413                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 1510  c ANNA end TAVE
1510          WRITE(diagname,'(A8)') 'Diver4  '          WRITE(diagname,'(A8)') 'Diver4  '
1511          CALL DIAGNOSTICS_FILL( Diver4(1-Olx,1-Oly,1), diagname,          CALL DIAGNOSTICS_FILL( Diver4(1-Olx,1-Oly,1), diagname,
1512       &                         0,Nr,2,bi,bj,myThid )       &                         0,Nr,2,bi,bj,myThid )
1513            WRITE(diagname,'(A8)') 'Shannon '
1514            CALL DIAGNOSTICS_FILL( Shannon(1-Olx,1-Oly,1), diagname,
1515         &                         0,Nr,2,bi,bj,myThid )
1516            WRITE(diagname,'(A8)') 'Simpson '
1517            CALL DIAGNOSTICS_FILL( Simpson(1-Olx,1-Oly,1), diagname,
1518         &                         0,Nr,2,bi,bj,myThid )
1519  #endif  #endif
1520  #ifdef ALLOW_DIAZ  #ifdef ALLOW_DIAZ
1521  #ifdef DAR_DIAG_NFIXP  #ifdef DAR_DIAG_NFIXP
# Line 1463  c ANNA end TAVE Line 1541  c ANNA end TAVE
1541       &                         0,Nr,2,bi,bj,myThid )       &                         0,Nr,2,bi,bj,myThid )
1542  #endif  #endif
1543  #ifdef ALLOW_CARBON  #ifdef ALLOW_CARBON
1544          CALL DIAGNOSTICS_FILL( flxCO2(1-Olx,1-Oly,bi,bj), 'DICTFLX ',          CALL DIAGNOSTICS_FILL( flxCO2(1-Olx,1-Oly), 'DICTFLX ',
1545       &                         0,1,2,bi,bj,myThid )       &                         0,1,2,bi,bj,myThid )
1546          CALL DIAGNOSTICS_FILL( FluxCO2(1-Olx,1-Oly,bi,bj), 'DICCFLX ',          CALL DIAGNOSTICS_FILL( FluxCO2(1-Olx,1-Oly,bi,bj), 'DICCFLX ',
1547       &                         0,1,2,bi,bj,myThid )       &                         0,1,2,bi,bj,myThid )
1548          CALL DIAGNOSTICS_FILL( flxO2(1-Olx,1-Oly,bi,bj), 'DICOFLX ',          CALL DIAGNOSTICS_FILL( flxO2(1-Olx,1-Oly), 'DICOFLX ',
1549       &                         0,1,2,bi,bj,myThid )       &                         0,1,2,bi,bj,myThid )
1550          CALL DIAGNOSTICS_FILL( pCO2(1-Olx,1-Oly,bi,bj), 'DICPCO2 ',          CALL DIAGNOSTICS_FILL( pCO2(1-Olx,1-Oly,bi,bj), 'DICPCO2 ',
1551       &                         0,1,2,bi,bj,myThid )       &                         0,1,2,bi,bj,myThid )

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

  ViewVC Help
Powered by ViewVC 1.1.22