LCOV - code coverage report
Current view: top level - cicecore/cicedyn/analysis - ice_diagnostics_bgc.F90 (source / functions) Hit Total Coverage
Test: 231018-211459:8916b9ff2c:1:quick Lines: 0 517 0.00 %
Date: 2023-10-18 15:30:36 Functions: 0 2 0.00 %

          Line data    Source code
       1             : !=======================================================================
       2             : 
       3             : ! Diagnostic information output during run
       4             : !
       5             : ! authors: Elizabeth C. Hunke, LANL
       6             : !          Bruce P. Briegleb, NCAR
       7             : !
       8             : ! 2004: Block structure added by William Lipscomb
       9             : ! 2006: Converted to free source form (F90) by Elizabeth Hunke
      10             : 
      11             :       module ice_diagnostics_bgc
      12             : 
      13             :       use ice_kinds_mod
      14             :       use ice_communicate, only: my_task, master_task
      15             :       use ice_constants, only: c0, mps_to_cmpdy, c100, p5, c1
      16             :       use ice_fileunits, only: nu_diag
      17             :       use ice_fileunits, only: flush_fileunit
      18             :       use ice_exit, only: abort_ice
      19             :       use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted
      20             :       use icepack_intfc, only: icepack_max_algae, icepack_max_aero
      21             :       use icepack_intfc, only: icepack_max_doc, icepack_max_don, icepack_max_fe
      22             :       use icepack_intfc, only: icepack_query_parameters, icepack_query_tracer_flags
      23             :       use icepack_intfc, only: icepack_query_tracer_indices
      24             : 
      25             :       implicit none
      26             :       private
      27             :       public :: hbrine_diags, bgc_diags
      28             : 
      29             : !=======================================================================
      30             : 
      31             :       contains
      32             : 
      33             : !=======================================================================
      34             : 
      35             : !
      36             : ! Writes diagnostic info (max, min, global sums, etc) to standard out
      37             : !
      38             : ! authors: Elizabeth C. Hunke, LANL
      39             : !          Bruce P. Briegleb, NCAR
      40             : !          Cecilia M. Bitz, UW
      41             : !          Nicole Jeffery, LANL
      42             : 
      43           0 :       subroutine hbrine_diags
      44             : 
      45             :       use ice_arrays_column, only: darcy_V
      46             :       use ice_broadcast, only: broadcast_scalar, broadcast_array
      47             :       use ice_diagnostics, only: npnt, print_points, pmloc, piloc, pjloc, pbloc
      48             :       use ice_domain_size, only: nilyr
      49             :       use ice_state, only: aice, aicen, vicen, vice, trcr, trcrn
      50             : 
      51             :       ! local variables
      52             : 
      53             :       integer (kind=int_kind) :: &
      54             :          i, j, k, n, iblk, &   ! LCOV_EXCL_LINE
      55             :          nt_sice, nt_fbri, ktherm
      56             : 
      57             :       ! fields at diagnostic points
      58             :       real (kind=dbl_kind), dimension(npnt) :: &
      59           0 :          phinS, phinS1, pdarcy_V, pfbri
      60             : 
      61             :       real (kind=dbl_kind), dimension(npnt,nilyr) :: &
      62           0 :          pSin, pSin1
      63             : 
      64             :       character(len=*), parameter :: subname = '(hbrine_diags)'
      65             : 
      66           0 :       call icepack_query_parameters(ktherm_out=ktherm)
      67           0 :       call icepack_query_tracer_indices(nt_sice_out=nt_sice, nt_fbri_out=nt_fbri)
      68           0 :       call icepack_warnings_flush(nu_diag)
      69           0 :       if (icepack_warnings_aborted()) call abort_ice(error_message=subname, &
      70           0 :          file=__FILE__, line=__LINE__)
      71             : 
      72             :       !-----------------------------------------------------------------
      73             :       ! Dynamic brine height
      74             :       !-----------------------------------------------------------------
      75             : 
      76           0 :       if (print_points) then
      77             : 
      78             :       !-----------------------------------------------------------------
      79             :       ! state of the ice and associated fluxes for 2 defined points
      80             :       ! NOTE these are computed for the last timestep only (not avg)
      81             :       !-----------------------------------------------------------------
      82             : 
      83           0 :          do n = 1, npnt
      84           0 :             if (my_task == pmloc(n)) then
      85           0 :                i = piloc(n)
      86           0 :                j = pjloc(n)
      87           0 :                iblk = pbloc(n)
      88           0 :                phinS1(n) = c0
      89           0 :                phinS(n) = c0
      90           0 :                pfbri(n) = trcrn(i,j,nt_fbri,1,iblk)
      91           0 :                pdarcy_V(n) = darcy_V(i,j,1,iblk)
      92           0 :                if (aice(i,j,iblk) > c0) &
      93           0 :                        phinS(n) = trcr(i,j,nt_fbri,iblk)*vice(i,j,iblk)/aice(i,j,iblk)
      94           0 :                if (aicen(i,j,1,iblk)> c0) &
      95             :                        phinS1(n) = trcrn(i,j,nt_fbri,1,iblk)*vicen(i,j,1,iblk)/&   ! LCOV_EXCL_LINE
      96           0 :                                                 aicen(i,j,1,iblk)
      97           0 :                do k = 1,nilyr
      98           0 :                   pSin1(n,k) = trcrn(i,j,nt_sice+k-1,1,iblk)
      99           0 :                   pSin(n,k)  = trcr(i,j,nt_sice+k-1,iblk)
     100             :                enddo
     101             :             endif                 ! my_task = pmloc
     102             : 
     103           0 :             call broadcast_array (pSin    (n,:), pmloc(n))
     104           0 :             call broadcast_array (pSin1   (n,:), pmloc(n))
     105           0 :             call broadcast_scalar(pfbri   (n),   pmloc(n))
     106           0 :             call broadcast_scalar(phinS1  (n),   pmloc(n))
     107           0 :             call broadcast_scalar(phinS   (n),   pmloc(n))
     108           0 :             call broadcast_scalar(pdarcy_V(n),   pmloc(n))
     109             :          enddo                  ! npnt
     110             :       endif                     ! print_points
     111             : 
     112             :       !-----------------------------------------------------------------
     113             :       ! start spewing
     114             :       !-----------------------------------------------------------------
     115             : 
     116           0 :       if (my_task == master_task) then
     117             : 
     118           0 :       call flush_fileunit(nu_diag)
     119             : 
     120             :       !-----------------------------------------------------------------
     121             :       ! diagnostics for Arctic and Antarctic points
     122             :       !-----------------------------------------------------------------
     123             : 
     124           0 :       if (print_points) then
     125           0 :          write(nu_diag,*) '------ hbrine ------'
     126           0 :          write(nu_diag,900) 'hbrine, (m)        = ',phinS(1),phinS(2)
     127           0 :          write(nu_diag,900) 'fbri, cat1 (m)     = ',pfbri(1),pfbri(2)
     128           0 :          write(nu_diag,900) 'hbrine cat1, (m)   = ',phinS1(1),phinS1(2)
     129           0 :          write(nu_diag,900) 'darcy_V cat1, (m/s)= ',pdarcy_V(1),pdarcy_V(2)
     130           0 :          if (ktherm == 2) then
     131           0 :             write(nu_diag,*) '                         '
     132           0 :             write(nu_diag,*) '------ Thermosaline Salinity ------'
     133           0 :             write(nu_diag,803) 'Sice1(1) cat1 S (ppt)','Sice1(2) cat1 S'
     134           0 :             write(nu_diag,*) '---------------------------------------------------'
     135           0 :             write(nu_diag,802) ((pSin1(n,k),n=1,2), k = 1,nilyr)
     136           0 :             write(nu_diag,*) '                         '
     137           0 :             write(nu_diag,803) 'Sice(1) bulk S (ppt) ','Sice(2) bulk S'
     138           0 :             write(nu_diag,*) '---------------------------------------------------'
     139           0 :             write(nu_diag,802) ((pSin(n,k),n=1,2), k = 1,nilyr)
     140           0 :             write(nu_diag,*) '                         '
     141             :          endif
     142             :       endif                   ! print_points
     143             :       endif                   ! my_task = master_task
     144             : 
     145             :   802 format (f24.17,2x,f24.17)
     146             :   803 format (a25,2x,a25)
     147             :   900 format (a25,2x,f24.17,2x,f24.17)
     148             : 
     149           0 :       end subroutine hbrine_diags
     150             : 
     151             : !=======================================================================
     152             : !
     153             : ! Writes diagnostic info (max, min, global sums, etc) to standard out
     154             : !
     155             : ! authors: Elizabeth C. Hunke, LANL
     156             : !          Nicole Jeffery, LANL
     157             : 
     158           0 :       subroutine bgc_diags
     159             : 
     160             :       use ice_arrays_column, only: ocean_bio, zfswin, fbio_atmice, fbio_snoice, &
     161             :           Zoo, grow_net, ice_bio_net, trcrn_sw
     162             :       use ice_broadcast, only: broadcast_scalar, broadcast_array
     163             :       use ice_diagnostics, only: npnt, print_points, pmloc, piloc, pjloc, pbloc
     164             :       use ice_domain_size, only: ncat, nblyr, n_algae, n_zaero, &
     165             :           n_doc, n_don, n_fed, n_fep, nilyr, nslyr
     166             :       use ice_flux_bgc, only: flux_bio, flux_bio_atm
     167             :       use ice_state, only: vicen, vice, trcr
     168             : 
     169             :       ! local variables
     170             : 
     171             :       integer (kind=int_kind) :: &
     172             :          i, j, k, n, nn, iblk,kk, klev
     173             :       ! fields at diagnostic points
     174             :       real (kind=dbl_kind), dimension(npnt) :: &
     175             :          pNit_sk, pAm_sk, pSil_sk, phum_sk, &   ! LCOV_EXCL_LINE
     176             :          pDMSPp_sk, pDMSPd_sk, pDMS_sk, &   ! LCOV_EXCL_LINE
     177             :          pNit_ac, pAm_ac, pSil_ac, pDMSP_ac, pDMS_ac, &   ! LCOV_EXCL_LINE
     178             :          pflux_NO, pflux_Am,  phum_ac, &   ! LCOV_EXCL_LINE
     179             :          pflux_snow_NO, pflux_snow_Am,  &   ! LCOV_EXCL_LINE
     180             :          pflux_atm_NO, pflux_atm_Am,  pgrow_net, &   ! LCOV_EXCL_LINE
     181           0 :          pflux_hum
     182             : 
     183             :       logical (kind=log_kind) :: &
     184             :          skl_bgc, z_tracers, dEdd_algae
     185             : 
     186             :       logical (kind=log_kind) :: &
     187             :          tr_bgc_DMS, tr_bgc_PON, &   ! LCOV_EXCL_LINE
     188             :          tr_bgc_N, tr_bgc_C, tr_bgc_DON, tr_zaero, tr_bgc_hum, &   ! LCOV_EXCL_LINE
     189             :          tr_bgc_Nit, tr_bgc_Am, tr_bgc_Sil, tr_bgc_Fe
     190             : 
     191             :       integer (kind=int_kind) :: &
     192             :          nt_fbri, nt_sice, nt_bgc_nit, nt_bgc_am, nt_bgc_sil, &   ! LCOV_EXCL_LINE
     193             :          nt_bgc_hum, nt_bgc_pon, nt_bgc_dmspp, nt_bgc_dmspd, nt_bgc_dms, &   ! LCOV_EXCL_LINE
     194             :          nlt_bgc_hum, nlt_bgc_Nit, nlt_bgc_Am, nlt_bgc_Sil, nlt_chl_sw, &   ! LCOV_EXCL_LINE
     195             :          nlt_bgc_DMSPp, nlt_bgc_DMS
     196             :       integer (kind=int_kind), dimension(icepack_max_algae) :: &
     197             :          nt_bgc_n, nlt_bgc_N
     198             :       integer (kind=int_kind), dimension(icepack_max_doc) :: &
     199             :          nt_bgc_doc, nlt_bgc_DOC
     200             :       integer (kind=int_kind), dimension(icepack_max_don) :: &
     201             :          nt_bgc_don, nlt_bgc_DON
     202             :       integer (kind=int_kind), dimension(icepack_max_aero) :: &
     203             :          nt_zaero, nlt_zaero, nlt_zaero_sw
     204             :       integer (kind=int_kind), dimension(icepack_max_fe) :: &
     205             :          nt_bgc_fed, nt_bgc_fep, nlt_bgc_Fed, nlt_bgc_Fep
     206             : 
     207             :       real (kind=dbl_kind), dimension(npnt,icepack_max_algae) :: &
     208           0 :          pN_ac, pN_tot, pN_sk, pflux_N
     209             :       real (kind=dbl_kind), dimension(npnt,icepack_max_doc) :: &
     210           0 :          pDOC_ac, pDOC_sk
     211             :       real (kind=dbl_kind), dimension(npnt,icepack_max_don) :: &
     212           0 :          pDON_ac, pDON_sk
     213             :       real (kind=dbl_kind), dimension(npnt,icepack_max_fe ) :: &
     214           0 :          pFed_ac,  pFed_sk, pFep_ac, pFep_sk
     215             :       real (kind=dbl_kind), dimension(npnt,icepack_max_aero) :: &
     216             :         pflux_zaero, pflux_snow_zaero, pflux_atm_zaero, &   ! LCOV_EXCL_LINE
     217           0 :         pflux_atm_zaero_s
     218             : 
     219             :       ! vertical  fields of category 1 at diagnostic points for bgc layer model
     220             :       real (kind=dbl_kind), dimension(npnt,2) :: &
     221           0 :          pNOs, pAms, pPONs, phums
     222             :       real (kind=dbl_kind), dimension(npnt,2,icepack_max_algae) :: &
     223           0 :          pNs
     224             :       real (kind=dbl_kind), dimension(npnt,2,icepack_max_doc) :: &
     225           0 :          pDOCs
     226             :       real (kind=dbl_kind), dimension(npnt,2,icepack_max_don) :: &
     227           0 :          pDONs
     228             :       real (kind=dbl_kind), dimension(npnt,2,icepack_max_fe ) :: &
     229           0 :          pFeds, pFeps
     230             :       real (kind=dbl_kind), dimension(npnt,2,icepack_max_aero) :: &
     231           0 :          pzaeros
     232             :       real (kind=dbl_kind), dimension(npnt,nblyr+1) :: &
     233           0 :          pNO, pAm, pPON, pzfswin, pZoo, phum
     234             :       real (kind=dbl_kind), dimension(npnt,nblyr+1,icepack_max_algae) :: &
     235           0 :          pN
     236             :       real (kind=dbl_kind), dimension(npnt,nblyr+1,icepack_max_aero) :: &
     237           0 :          pzaero
     238             :       real (kind=dbl_kind), dimension(npnt,nblyr+1,icepack_max_doc) :: &
     239           0 :          pDOC
     240             :       real (kind=dbl_kind), dimension(npnt,nblyr+1,icepack_max_don) :: &
     241           0 :          pDON
     242             :       real (kind=dbl_kind), dimension(npnt,nblyr+1,icepack_max_fe ) :: &
     243           0 :          pFed, pFep
     244             :       real (kind=dbl_kind), dimension (nblyr+1) :: &
     245           0 :          zspace
     246             :       real (kind=dbl_kind), dimension (npnt,nslyr+nilyr+2) :: &
     247           0 :          pchlsw
     248             :       real (kind=dbl_kind), dimension(npnt,nslyr+nilyr+2,icepack_max_aero) :: &
     249           0 :          pzaerosw
     250             :       character(len=*), parameter :: subname = '(bgc_diags)'
     251             : 
     252           0 :       call icepack_query_parameters(skl_bgc_out=skl_bgc, z_tracers_out=z_tracers, dEdd_algae_out=dEdd_algae)
     253             :       call icepack_query_tracer_flags( &
     254             :          tr_bgc_DMS_out=tr_bgc_DMS, tr_bgc_PON_out=tr_bgc_PON, &   ! LCOV_EXCL_LINE
     255             :          tr_bgc_N_out=tr_bgc_N, tr_bgc_C_out=tr_bgc_C, &   ! LCOV_EXCL_LINE
     256             :          tr_bgc_DON_out=tr_bgc_DON, tr_zaero_out=tr_zaero, tr_bgc_hum_out=tr_bgc_hum, &   ! LCOV_EXCL_LINE
     257             :          tr_bgc_Nit_out=tr_bgc_Nit, tr_bgc_Am_out=tr_bgc_Am, tr_bgc_Sil_out=tr_bgc_Sil, &   ! LCOV_EXCL_LINE
     258           0 :          tr_bgc_Fe_out=tr_bgc_Fe)
     259             :       call icepack_query_tracer_indices( &
     260             :          nt_fbri_out=nt_fbri, nt_sice_out=nt_sice, nt_zaero_out=nt_zaero, &   ! LCOV_EXCL_LINE
     261             :          nt_bgc_n_out=nt_bgc_n, nt_bgc_doc_out=nt_bgc_doc, nt_bgc_don_out=nt_bgc_don, &   ! LCOV_EXCL_LINE
     262             :          nt_bgc_fed_out=nt_bgc_fed, nt_bgc_fep_out=nt_bgc_fep, &   ! LCOV_EXCL_LINE
     263             :          nt_bgc_nit_out=nt_bgc_nit, nt_bgc_am_out=nt_bgc_am, nt_bgc_sil_out=nt_bgc_sil, &   ! LCOV_EXCL_LINE
     264             :          nt_bgc_hum_out=nt_bgc_hum, nt_bgc_pon_out=nt_bgc_pon, &   ! LCOV_EXCL_LINE
     265             :          nt_bgc_dmspp_out=nt_bgc_dmspp, nt_bgc_dmspd_out=nt_bgc_dmspd, nt_bgc_dms_out=nt_bgc_dms, &   ! LCOV_EXCL_LINE
     266             :          nlt_bgc_N_out=nlt_bgc_N, nlt_zaero_out=nlt_zaero, nlt_chl_sw_out=nlt_chl_sw, &   ! LCOV_EXCL_LINE
     267             :          nlt_zaero_sw_out=nlt_zaero_sw, nlt_bgc_Fed_out=nlt_bgc_Fed, nlt_bgc_Fep_out=nlt_bgc_Fep, &   ! LCOV_EXCL_LINE
     268             :          nlt_bgc_hum_out=nlt_bgc_hum, nlt_bgc_Nit_out=nlt_bgc_Nit, nlt_bgc_Am_out=nlt_bgc_Am, &   ! LCOV_EXCL_LINE
     269             :          nlt_bgc_Sil_out=nlt_bgc_Sil, &   ! LCOV_EXCL_LINE
     270             :          nlt_bgc_DOC_out=nlt_bgc_DOC, nlt_bgc_DON_out=nlt_bgc_DON, nlt_bgc_DMSPp_out=nlt_bgc_DMSPp, &   ! LCOV_EXCL_LINE
     271           0 :          nlt_bgc_DMS_out=nlt_bgc_DMS)
     272           0 :       call icepack_warnings_flush(nu_diag)
     273           0 :       if (icepack_warnings_aborted()) call abort_ice(error_message=subname, &
     274           0 :          file=__FILE__, line=__LINE__)
     275             : 
     276           0 :       zspace(:) = c1/real(nblyr,kind=dbl_kind)
     277           0 :       zspace(1) = zspace(1)*p5
     278           0 :       zspace(nblyr+1) = zspace(nblyr+1)*p5
     279             : 
     280           0 :       klev = 1+nilyr+nslyr
     281             :       !-----------------------------------------------------------------
     282             :       ! biogeochemical state of the ice
     283             :       !-----------------------------------------------------------------
     284             : 
     285           0 :       if (print_points) then
     286             : 
     287             :       !-----------------------------------------------------------------
     288             :       ! state of the ice and associated fluxes for 2 defined points
     289             :       ! NOTE these are computed for the last timestep only (not avg)
     290             :       !-----------------------------------------------------------------
     291             : 
     292           0 :          do n = 1, npnt
     293           0 :             if (my_task == pmloc(n)) then
     294           0 :                i = piloc(n)
     295           0 :                j = pjloc(n)
     296           0 :                iblk = pbloc(n)
     297           0 :                pAm_ac(n)   = c0
     298           0 :                pSil_ac(n)  = c0
     299           0 :                phum_ac(n)  = c0
     300           0 :                pDMSP_ac(n) = c0
     301           0 :                pDMS_ac(n)  = c0
     302           0 :                pN_ac(n,:)  = c0
     303           0 :                pDOC_ac(n,:)= c0
     304           0 :                pDON_ac(n,:)= c0
     305           0 :                pFed_ac(n,:)= c0
     306           0 :                pFep_ac(n,:)= c0
     307           0 :                pNit_ac(n) = c0
     308           0 :                if (tr_bgc_N) then
     309           0 :                  do k = 1,n_algae
     310           0 :                     pN_ac(n,k)    = ocean_bio(i,j,nlt_bgc_N(k),iblk)
     311             :                  enddo  !n_algae
     312             :                endif    !tr_bgc_N
     313           0 :                if (tr_bgc_C) then
     314           0 :                  do k = 1,n_doc
     315           0 :                     pDOC_ac(n,k)    = ocean_bio(i,j,nlt_bgc_DOC(k),iblk)
     316             :                  enddo  !n_algae
     317             :                endif    !tr_bgc_N
     318           0 :                if (tr_bgc_DON) then
     319           0 :                  do k = 1,n_don
     320           0 :                     pDON_ac(n,k)    = ocean_bio(i,j,nlt_bgc_DON(k),iblk)
     321             :                  enddo
     322             :                endif
     323           0 :                if (tr_bgc_Fe ) then
     324           0 :                  do k = 1,n_fed
     325           0 :                     pFed_ac (n,k)   = ocean_bio(i,j,nlt_bgc_Fed (k),iblk)
     326             :                  enddo
     327           0 :                  do k = 1,n_fep
     328           0 :                     pFep_ac (n,k)   = ocean_bio(i,j,nlt_bgc_Fep (k),iblk)
     329             :                  enddo
     330             :                endif
     331           0 :                if (tr_bgc_Nit) &
     332           0 :                pNit_ac(n)  = ocean_bio(i,j,nlt_bgc_Nit,iblk)  ! nit(i,j,iblk)
     333           0 :                if (tr_bgc_Am) &
     334           0 :                pAm_ac(n)   = ocean_bio(i,j,nlt_bgc_Am,iblk)   ! amm(i,j,iblk)
     335           0 :                if (tr_bgc_Sil) &
     336           0 :                pSil_ac(n)  = ocean_bio(i,j,nlt_bgc_Sil,iblk)  ! sil(i,j,iblk)
     337           0 :                if (tr_bgc_hum) &
     338           0 :                phum_ac(n)  = ocean_bio(i,j,nlt_bgc_hum,iblk)  ! hum(i,j,iblk)
     339           0 :                if (tr_bgc_DMS) then
     340           0 :                pDMSP_ac(n) = ocean_bio(i,j,nlt_bgc_DMSPp,iblk)! dmsp(i,j,iblk)
     341           0 :                pDMS_ac(n)  = ocean_bio(i,j,nlt_bgc_DMS,iblk)  ! dms(i,j,iblk)
     342             :                endif
     343             : 
     344             :                ! fluxes in mmol/m^2/d
     345             :                ! concentrations are bulk in mmol/m^3
     346             :                ! iron is in 10^-3 mmol/m^3  (nM)
     347             : 
     348           0 :                if (skl_bgc) then
     349           0 :                   pNit_sk(n)   = c0
     350           0 :                   pAm_sk(n)    = c0
     351           0 :                   pSil_sk(n)   = c0
     352           0 :                   phum_sk(n)   = c0
     353           0 :                   pDMSPp_sk(n) = c0
     354           0 :                   pDMSPd_sk(n) = c0
     355           0 :                   pDMS_sk(n)   = c0
     356           0 :                   pN_sk(n,:)   = c0
     357           0 :                   pflux_N(n,:) = c0
     358           0 :                   pDOC_sk(n,:) = c0
     359           0 :                   pDON_sk(n,:) = c0
     360           0 :                   pFed_sk(n,:) = c0
     361           0 :                   pFep_sk(n,:) = c0
     362             : 
     363           0 :                   do k = 1,n_algae
     364           0 :                     pN_sk(n,k)       = trcr    (i,j,nt_bgc_N(k),   iblk)
     365           0 :                     pflux_N(n,k)     = flux_bio(i,j,nlt_bgc_N(k),  iblk)*mps_to_cmpdy/c100
     366             :                   enddo
     367           0 :                   if (tr_bgc_C) then
     368           0 :                      do k = 1,n_doc
     369           0 :                         pDOC_sk(n,k) = trcr    (i,j,nt_bgc_DOC(k),   iblk)
     370             :                      enddo
     371             :                   endif
     372           0 :                   if (tr_bgc_DON) then
     373           0 :                      do k = 1,n_don
     374           0 :                         pDON_sk(n,k) = trcr    (i,j,nt_bgc_DON(k),   iblk)
     375             :                      enddo
     376             :                   endif
     377           0 :                   if (tr_bgc_Fe ) then
     378           0 :                      do k = 1,n_fed
     379           0 :                         pFed_sk (n,k)= trcr    (i,j,nt_bgc_Fed(k),   iblk)
     380             :                      enddo
     381           0 :                      do k = 1,n_fep
     382           0 :                         pFep_sk (n,k)= trcr    (i,j,nt_bgc_Fep(k),   iblk)
     383             :                      enddo
     384             :                   endif
     385           0 :                   if (tr_bgc_Nit) then
     386           0 :                      pNit_sk(n)  = trcr    (i,j, nt_bgc_Nit, iblk)
     387           0 :                      pflux_NO(n) = flux_bio(i,j,nlt_bgc_Nit, iblk)*mps_to_cmpdy/c100
     388             :                   endif
     389           0 :                   if (tr_bgc_Am) then
     390           0 :                      pAm_sk(n)   = trcr    (i,j, nt_bgc_Am,  iblk)
     391           0 :                      pflux_Am(n) = flux_bio(i,j,nlt_bgc_Am,  iblk)*mps_to_cmpdy/c100
     392             :                   endif
     393           0 :                   if (tr_bgc_Sil) then
     394           0 :                      pSil_sk(n)  = trcr    (i,j, nt_bgc_Sil, iblk)
     395             :                   endif
     396           0 :                   if (tr_bgc_hum) then
     397           0 :                      phum_sk(n)  = trcr    (i,j, nt_bgc_hum, iblk)
     398           0 :                      pflux_hum(n)= flux_bio(i,j,nlt_bgc_hum,  iblk)*mps_to_cmpdy/c100
     399             :                   endif
     400           0 :                   if (tr_bgc_DMS) then
     401           0 :                      pDMSPp_sk(n) = trcr   (i,j,nt_bgc_DMSPp,iblk)
     402           0 :                      pDMSPd_sk(n) = trcr   (i,j,nt_bgc_DMSPd,iblk)
     403           0 :                      pDMS_sk  (n) = trcr   (i,j,nt_bgc_DMS,  iblk)
     404             :                   endif
     405             : 
     406           0 :                elseif (z_tracers) then   ! zbgc
     407           0 :                   pflux_NO(n) = c0
     408           0 :                   pN_tot(n,:) = c0
     409           0 :                   pflux_Am(n) = c0
     410           0 :                   pflux_hum(n) = c0
     411           0 :                   pflux_atm_Am(n) = c0
     412           0 :                   pflux_snow_Am(n) = c0
     413           0 :                   pflux_N(n,:) = c0
     414           0 :                   pflux_NO(n) = c0
     415           0 :                   pflux_atm_NO(n) = c0
     416           0 :                   pflux_snow_NO(n) = c0
     417           0 :                   pflux_zaero(n,:) = c0
     418           0 :                   pflux_atm_zaero_s(n,:) = c0
     419           0 :                   pflux_atm_zaero(n,:) = c0
     420           0 :                   pflux_snow_zaero(n,:) = c0
     421           0 :                   if (tr_bgc_Nit) then
     422           0 :                     pflux_NO(n)       = flux_bio(i,j,nlt_bgc_Nit,iblk)*mps_to_cmpdy/c100
     423           0 :                     pflux_atm_NO(n)   = fbio_atmice(i,j,nlt_bgc_Nit,iblk)*mps_to_cmpdy/c100
     424           0 :                     pflux_snow_NO(n)  = fbio_snoice(i,j,nlt_bgc_Nit,iblk)*mps_to_cmpdy/c100
     425             :                   endif
     426           0 :                   if (tr_bgc_Am) then
     427           0 :                     pflux_Am(n)       = flux_bio(i,j,nlt_bgc_Am,iblk)*mps_to_cmpdy/c100
     428           0 :                     pflux_atm_Am(n)   = fbio_atmice(i,j,nlt_bgc_Am,iblk)*mps_to_cmpdy/c100
     429           0 :                     pflux_snow_Am(n)  = fbio_snoice(i,j,nlt_bgc_Am,iblk)*mps_to_cmpdy/c100
     430             :                   endif
     431           0 :                   if (tr_bgc_hum) then
     432           0 :                     pflux_hum(n)       = flux_bio(i,j,nlt_bgc_hum,iblk)*mps_to_cmpdy/c100
     433             :                   endif
     434           0 :                   if (tr_bgc_N)  then
     435           0 :                      do k = 1,n_algae
     436           0 :                      pflux_N(n,k)     = flux_bio(i,j,nlt_bgc_N(k),iblk)*mps_to_cmpdy/c100
     437             :                      enddo
     438             :                   endif
     439           0 :                   if (tr_zaero)  then
     440           0 :                      do k = 1,n_zaero
     441           0 :                      pflux_zaero(n,k)      = flux_bio(i,j,nlt_zaero(k),iblk)*mps_to_cmpdy/c100
     442           0 :                      pflux_atm_zaero_s(n,k)= flux_bio_atm(i,j,nlt_zaero(k),iblk)*mps_to_cmpdy/c100 !*aice
     443           0 :                      pflux_atm_zaero(n,k)  = fbio_atmice(i,j,nlt_zaero(k),iblk)*mps_to_cmpdy/c100
     444           0 :                      pflux_snow_zaero(n,k) = fbio_snoice(i,j,nlt_zaero(k),iblk)*mps_to_cmpdy/c100
     445             :                      enddo
     446             :                   endif
     447           0 :                   do k = 1, nblyr+1
     448           0 :                    pzfswin(n,k) = c0
     449           0 :                    pZoo(n,k) = c0
     450           0 :                    do nn = 1,ncat
     451           0 :                      pzfswin(n,k) = pzfswin(n,k) + zfswin(i,j,k,nn,iblk)*vicen(i,j,nn,iblk)
     452           0 :                      pZoo(n,k) = pZoo(n,k) + Zoo(i,j,k,nn,iblk)*vicen(i,j,nn,iblk)
     453             :                    enddo !nn
     454           0 :                    if (vice(i,j,iblk) > c0) then
     455           0 :                      pzfswin(n,k) = pzfswin(n,k)/vice(i,j,iblk)
     456           0 :                      pZoo(n,k)    = pZoo(n,k)/vice(i,j,iblk)
     457             :                    endif !vice
     458           0 :                    pAm(n,k) = c0
     459           0 :                    pN(n,k,:) = c0
     460           0 :                    pDOC(n,k,:) = c0
     461           0 :                    pDON(n,k,:) = c0
     462           0 :                    pFed(n,k,:) = c0
     463           0 :                    pFep(n,k,:) = c0
     464           0 :                    pzaero(n,k,:) = c0
     465           0 :                    pPON(n,k) = c0
     466           0 :                    phum(n,k) = c0
     467           0 :                    pNO(n,k) = c0
     468           0 :                    if (tr_bgc_Nit) pNO(n,k) =  trcr(i,j,nt_bgc_Nit+k-1,iblk)
     469           0 :                    if (tr_bgc_Am) pAm(n,k) =  trcr(i,j,nt_bgc_Am+k-1,iblk)
     470           0 :                    if (tr_bgc_N) then
     471           0 :                      do nn = 1, n_algae
     472           0 :                         pN(n,k,nn)   =  trcr(i,j,nt_bgc_N(nn)+k-1,iblk)
     473             :                      enddo
     474             :                    endif
     475           0 :                    if (tr_bgc_C) then
     476           0 :                      do nn = 1, n_doc
     477           0 :                         pDOC(n,k,nn)   =  trcr(i,j,nt_bgc_DOC(nn)+k-1,iblk)
     478             :                      enddo
     479             :                    endif
     480           0 :                    if (tr_bgc_DON) then
     481           0 :                      do nn = 1, n_don
     482           0 :                         pDON(n,k,nn)   =  trcr(i,j,nt_bgc_DON(nn)+k-1,iblk)
     483             :                      enddo
     484             :                    endif
     485           0 :                    if (tr_bgc_Fe)  then
     486           0 :                      do nn = 1, n_fed
     487           0 :                         pFed(n,k,nn)   =  trcr(i,j,nt_bgc_Fed(nn)+k-1,iblk)
     488             :                      enddo
     489           0 :                      do nn = 1, n_fep
     490           0 :                         pFep(n,k,nn)   =  trcr(i,j,nt_bgc_Fep(nn)+k-1,iblk)
     491             :                      enddo
     492             :                    endif
     493           0 :                    if (tr_zaero) then
     494           0 :                      do nn = 1, n_zaero
     495           0 :                         pzaero(n,k,nn)   =  trcr(i,j,nt_zaero(nn)+k-1,iblk)
     496             :                      enddo
     497             :                    endif
     498           0 :                    if (tr_bgc_PON) pPON(n,k) =  trcr(i,j,nt_bgc_PON+k-1,iblk)
     499           0 :                    if (tr_bgc_hum) phum(n,k) =  trcr(i,j,nt_bgc_hum+k-1,iblk)
     500             :                  enddo  !k
     501           0 :                  if (tr_bgc_N) then
     502           0 :                    do nn = 1,n_algae
     503           0 :                       pN_tot(n,nn) = ice_bio_net(i,j,nlt_bgc_N(nn),iblk)
     504             :                    enddo
     505           0 :                    pgrow_net(n) =  grow_net(i,j,iblk)
     506             :                  endif !tr_bgc_N
     507           0 :                  do k = 1,2  !snow concentration
     508           0 :                    pAms(n,k) = c0
     509           0 :                    pNs(n,k,:) = c0
     510           0 :                    pDOCs(n,k,:) = c0
     511           0 :                    pDONs(n,k,:) = c0
     512           0 :                    pFeds (n,k,:)= c0
     513           0 :                    pFeps (n,k,:)= c0
     514           0 :                    pzaeros(n,k,:) = c0
     515           0 :                    pPONs(n,k) = c0
     516           0 :                    phums(n,k) = c0
     517           0 :                    pNOs(n,k) = c0
     518           0 :                    if (tr_bgc_Nit) pNOs(n,k)  = trcr(i,j,nt_bgc_Nit+nblyr+k,iblk)
     519           0 :                    if (tr_bgc_Am) pAms(n,k) = trcr(i,j,nt_bgc_Am+nblyr+k,iblk)
     520           0 :                    if (tr_bgc_N) then
     521           0 :                      do nn = 1, n_algae
     522           0 :                        pNs(n,k,nn) =  trcr(i,j,nt_bgc_N(nn)+nblyr+k,iblk)
     523             :                      enddo
     524             :                    endif
     525           0 :                    if (tr_bgc_C) then
     526           0 :                      do nn = 1, n_doc
     527           0 :                        pDOCs(n,k,nn) =  trcr(i,j,nt_bgc_DOC(nn)+nblyr+k,iblk)
     528             :                      enddo
     529             :                    endif
     530           0 :                    if (tr_bgc_DON) then
     531           0 :                      do nn = 1, n_don
     532           0 :                        pDONs(n,k,nn) =  trcr(i,j,nt_bgc_DON(nn)+nblyr+k,iblk)
     533             :                      enddo
     534             :                    endif
     535           0 :                    if (tr_bgc_Fe ) then
     536           0 :                      do nn = 1, n_fed
     537           0 :                        pFeds(n,k,nn) =  trcr(i,j,nt_bgc_Fed(nn)+nblyr+k,iblk)
     538             :                      enddo
     539           0 :                      do nn = 1, n_fep
     540           0 :                        pFeps(n,k,nn) =  trcr(i,j,nt_bgc_Fep(nn)+nblyr+k,iblk)
     541             :                      enddo
     542             :                    endif
     543           0 :                    if (tr_zaero) then
     544           0 :                      do nn = 1, n_zaero
     545           0 :                        pzaeros(n,k,nn) =  trcr(i,j,nt_zaero(nn)+nblyr+k,iblk)
     546             :                      enddo
     547             :                    endif
     548           0 :                    if (tr_bgc_PON)pPONs(n,k) =trcr(i,j,nt_bgc_PON+nblyr+k,iblk)
     549           0 :                    if (tr_bgc_hum)phums(n,k) =trcr(i,j,nt_bgc_hum+nblyr+k,iblk)
     550             :                  enddo   !k
     551             :                endif
     552           0 :                pchlsw(n,:) = c0
     553           0 :                pzaerosw(n,:,:) = c0
     554           0 :                if (dEdd_algae) then
     555           0 :                  do k = 0, klev
     556           0 :                     if (tr_bgc_N) pchlsw(n,k+1) = trcrn_sw(i,j,nlt_chl_sw+k,1,iblk)
     557           0 :                     if (tr_zaero) then
     558           0 :                     do nn = 1,n_zaero
     559           0 :                        pzaerosw(n,k+1,nn) =  trcrn_sw(i,j,nlt_zaero_sw(nn) + k,1,iblk)
     560             :                     enddo
     561             :                     endif
     562             :                   enddo
     563             :                endif              ! dEdd_algae
     564             :             endif                 ! my_task = pmloc
     565             : 
     566           0 :             call broadcast_scalar   (pNit_ac          (n),     pmloc(n))
     567           0 :             call broadcast_scalar   (pAm_ac           (n),     pmloc(n))
     568           0 :             call broadcast_scalar   (pSil_ac          (n),     pmloc(n))
     569           0 :             call broadcast_scalar   (phum_ac          (n),     pmloc(n))
     570           0 :             call broadcast_scalar   (pDMSP_ac         (n),     pmloc(n))
     571           0 :             call broadcast_scalar   (pDMS_ac          (n),     pmloc(n))
     572           0 :             call broadcast_scalar   (pflux_NO         (n),     pmloc(n))
     573           0 :             call broadcast_scalar   (pflux_Am         (n),     pmloc(n))
     574           0 :             call broadcast_scalar   (pflux_hum        (n),     pmloc(n))
     575           0 :             call broadcast_array    (pN_ac            (n,:),   pmloc(n))
     576           0 :             call broadcast_array    (pflux_N          (n,:),   pmloc(n))
     577           0 :             call broadcast_array    (pDOC_ac          (n,:),   pmloc(n))
     578           0 :             call broadcast_array    (pDON_ac          (n,:),   pmloc(n))
     579           0 :             call broadcast_array    (pFed_ac          (n,:),   pmloc(n))
     580           0 :             call broadcast_array    (pFep_ac          (n,:),   pmloc(n))
     581           0 :             call broadcast_array    (pchlsw           (n,:),   pmloc(n))
     582           0 :             call broadcast_array    (pzaerosw         (n,:,:), pmloc(n))
     583           0 :             if (skl_bgc) then              ! skl_bgc
     584           0 :                call broadcast_array (pN_sk            (n,:),   pmloc(n))
     585           0 :                call broadcast_array (pDOC_sk          (n,:),   pmloc(n))
     586           0 :                call broadcast_array (pDON_sk          (n,:),   pmloc(n))
     587           0 :                call broadcast_array (pFed_sk          (n,:),   pmloc(n))
     588           0 :                call broadcast_array (pFep_sk          (n,:),   pmloc(n))
     589             : 
     590           0 :                call broadcast_scalar(pNit_sk          (n),     pmloc(n))
     591           0 :                call broadcast_scalar(pAm_sk           (n),     pmloc(n))
     592           0 :                call broadcast_scalar(pSil_sk          (n),     pmloc(n))
     593           0 :                call broadcast_scalar(phum_sk          (n),     pmloc(n))
     594           0 :                call broadcast_scalar(pDMSPp_sk        (n),     pmloc(n))
     595           0 :                call broadcast_scalar(pDMSPd_sk        (n),     pmloc(n))
     596           0 :                call broadcast_scalar(pDMS_sk          (n),     pmloc(n))
     597             :             endif   !tr_bgc_sk
     598             : 
     599           0 :             if (z_tracers) then                   !  z_bgc
     600           0 :                call broadcast_array (pN_tot           (n,:),   pmloc(n))
     601           0 :                call broadcast_array (pflux_zaero      (n,:),   pmloc(n))
     602           0 :                call broadcast_array (pflux_atm_zaero_s(n,:),   pmloc(n))
     603           0 :                call broadcast_array (pflux_atm_zaero  (n,:),   pmloc(n))
     604           0 :                call broadcast_array (pflux_snow_zaero (n,:),   pmloc(n))
     605           0 :                call broadcast_scalar(pflux_atm_NO     (n),     pmloc(n))
     606           0 :                call broadcast_scalar(pflux_atm_Am     (n),     pmloc(n))
     607           0 :                call broadcast_scalar(pflux_snow_NO    (n),     pmloc(n))
     608           0 :                call broadcast_scalar(pflux_snow_Am    (n),     pmloc(n))
     609           0 :                call broadcast_scalar(pgrow_net        (n),     pmloc(n))
     610           0 :                call broadcast_array (pzfswin          (n,:),   pmloc(n))
     611           0 :                call broadcast_array (pZoo             (n,:),   pmloc(n))
     612           0 :                call broadcast_array (pNO              (n,:),   pmloc(n))
     613           0 :                call broadcast_array (pAm              (n,:),   pmloc(n))
     614           0 :                call broadcast_array (pPON             (n,:),   pmloc(n))
     615           0 :                call broadcast_array (phum             (n,:),   pmloc(n))
     616           0 :                call broadcast_array (pN               (n,:,:), pmloc(n))
     617           0 :                call broadcast_array (pDOC             (n,:,:), pmloc(n))
     618           0 :                call broadcast_array (pDON             (n,:,:), pmloc(n))
     619           0 :                call broadcast_array (pFed             (n,:,:), pmloc(n))
     620           0 :                call broadcast_array (pFep             (n,:,:), pmloc(n))
     621           0 :                call broadcast_array (pzaero           (n,:,:), pmloc(n))
     622           0 :                call broadcast_array (pNOs             (n,:),   pmloc(n))
     623           0 :                call broadcast_array (pAms             (n,:),   pmloc(n))
     624           0 :                call broadcast_array (pPONs            (n,:),   pmloc(n))
     625           0 :                call broadcast_array (phums            (n,:),   pmloc(n))
     626           0 :                call broadcast_array (pNs              (n,:,:), pmloc(n))
     627           0 :                call broadcast_array (pDOCs            (n,:,:), pmloc(n))
     628           0 :                call broadcast_array (pDONs            (n,:,:), pmloc(n))
     629           0 :                call broadcast_array (pFeds            (n,:,:), pmloc(n))
     630           0 :                call broadcast_array (pFeps            (n,:,:), pmloc(n))
     631           0 :                call broadcast_array (pzaeros          (n,:,:), pmloc(n))
     632             :             endif    ! z_tracers
     633             :          enddo                  ! npnt
     634             :       endif                     ! print_points
     635             : 
     636             :       !-----------------------------------------------------------------
     637             :       ! start spewing
     638             :       !-----------------------------------------------------------------
     639             : 
     640           0 :       if (my_task == master_task) then
     641             : 
     642           0 :       call flush_fileunit(nu_diag)
     643             : 
     644             :       !-----------------------------------------------------------------
     645             :       ! diagnostics for Arctic and Antarctic points
     646             :       !-----------------------------------------------------------------
     647             : 
     648           0 :      if (print_points) then
     649           0 :        if (z_tracers) then
     650           0 :          write(nu_diag,803) 'zfswin(1) PAR  ','zfswin(2) PAR '
     651           0 :          write(nu_diag,*) '---------------------------------------------------'
     652           0 :          write(nu_diag,802) ((pzfswin(n,k),n=1,2), k = 1,nblyr+1)
     653           0 :          write(nu_diag,*) '      '
     654           0 :          write(nu_diag,803) 'Losses: Zoo(1)(mmol/m^3)  ','Zoo(2)'
     655           0 :          write(nu_diag,803) '        Brine Conc.       ',' Brine Conc'
     656           0 :          write(nu_diag,*) '---------------------------------------------------'
     657           0 :          write(nu_diag,802) ((pZoo(n,k),n=1,2), k = 1,nblyr+1)
     658           0 :          write(nu_diag,*) '      '
     659             :        endif
     660           0 :        if (tr_bgc_Nit) then
     661           0 :          write(nu_diag,*) '---------------------------------------------------'
     662           0 :          write(nu_diag,*) '    nitrate conc. (mmol/m^3) or flux (mmol/m^2/d)'
     663           0 :          write(nu_diag,900) 'Ocean conc       = ',pNit_ac(1),pNit_ac(2)
     664           0 :          write(nu_diag,900) 'ice-ocean flux   = ',pflux_NO(1),pflux_NO(2)
     665           0 :          if (skl_bgc) then
     666           0 :            write(nu_diag,900) 'Bulk ice conc.   = ',pNit_sk(1),pNit_sk(2)
     667           0 :          elseif (z_tracers) then
     668           0 :            write(nu_diag,900) 'atm-ice flux     = ',pflux_atm_NO(1),pflux_atm_NO(2)
     669           0 :            write(nu_diag,900) 'snow-ice flux    = ',pflux_snow_NO(1),pflux_snow_NO(2)
     670           0 :            write(nu_diag,*) '             snow + ice conc'
     671           0 :            write(nu_diag,803) '    nitrate(1)','   nitrate(2)'
     672           0 :            write(nu_diag,802) ((pNOs(n,k),n=1,2), k = 1,2)
     673           0 :            write(nu_diag,802) ((pNO(n,k),n=1,2), k = 1,nblyr+1)
     674           0 :            write(nu_diag,*) '    '
     675             :          endif
     676             :       endif
     677           0 :       if (tr_bgc_PON .and. z_tracers) then
     678           0 :            write(nu_diag,*) '---------------------------------------------------'
     679           0 :            write(nu_diag,*) '    PON snow + ice conc. (mmol/m^3)'
     680           0 :            write(nu_diag,803) '    PON(1)','    PON(2)'
     681           0 :            write(nu_diag,802) ((pPONs(n,k),n=1,2), k = 1,2)
     682           0 :            write(nu_diag,802) ((pPON(n,k),n=1,2), k = 1,nblyr+1)
     683           0 :            write(nu_diag,*) ' '
     684             :       endif
     685           0 :       if (tr_bgc_hum) then
     686           0 :            write(nu_diag,*) '---------------------------------------------------'
     687           0 :            write(nu_diag,*) '    hum snow + ice conc. (mmolC/m^3)'
     688           0 :            write(nu_diag,900) 'Ocean conc       = ',phum_ac(1),phum_ac(2)
     689           0 :            write(nu_diag,900) 'ice-ocean flux   = ',pflux_hum(1),pflux_hum(2)
     690           0 :          if (skl_bgc) then
     691           0 :            write(nu_diag,900) 'Bulk ice conc.   = ',phum_sk(1),phum_sk(2)
     692           0 :          elseif (z_tracers) then
     693           0 :            write(nu_diag,803) '    hum(1)','    hum(2)'
     694           0 :            write(nu_diag,802) ((phums(n,k),n=1,2), k = 1,2)
     695           0 :            write(nu_diag,802) ((phum(n,k),n=1,2), k = 1,nblyr+1)
     696           0 :            write(nu_diag,*) ' '
     697             :          endif
     698             :       endif
     699           0 :       if (tr_bgc_Am) then
     700           0 :          write(nu_diag,*) '---------------------------------------------------'
     701           0 :          write(nu_diag,*) '    ammonium conc. (mmol/m^3) or flux (mmol/m^2/d)'
     702           0 :          write(nu_diag,900) 'Ocean conc       = ',pAm_ac(1),pAm_ac(2)
     703           0 :          write(nu_diag,900) 'ice-ocean flux   = ',pflux_Am(1),pflux_Am(2)
     704           0 :          if (skl_bgc) then
     705           0 :            write(nu_diag,900) 'Bulk ice conc.   = ',pAm_sk(1),pAm_sk(2)
     706           0 :          elseif (z_tracers) then
     707           0 :            write(nu_diag,900) 'atm-ice flux     = ',pflux_atm_Am(1),pflux_atm_Am(2)
     708           0 :            write(nu_diag,900) 'snow-ice flux    = ',pflux_snow_Am(1),pflux_snow_Am(2)
     709           0 :            write(nu_diag,*) '             snow + ice conc.'
     710           0 :            write(nu_diag,803) '  ammonium(1)','  ammonium (2)'
     711           0 :            write(nu_diag,802) ((pAms(n,k),n=1,2), k = 1,2)
     712           0 :            write(nu_diag,802) ((pAm(n,k),n=1,2), k = 1,nblyr+1)
     713           0 :            write(nu_diag,*) '       '
     714             :          endif
     715             :       endif
     716           0 :       if (tr_bgc_N) then
     717           0 :          write(nu_diag,*) '---------------------------------------------------'
     718           0 :          write(nu_diag,901) 'tot algal growth (1/d) = ',pgrow_net(1),pgrow_net(2)
     719           0 :        do kk = 1,n_algae
     720           0 :          write(nu_diag,*) '  algal conc. (mmol N/m^3) or flux (mmol N/m^2/d)'
     721           0 :          write(nu_diag,1020) '  type:', kk
     722           0 :          write(nu_diag,900) 'Ocean conc           = ',pN_ac(1,kk),pN_ac(2,kk)
     723           0 :          write(nu_diag,900) 'ice-ocean flux       = ',pflux_N(1,kk),pflux_N(2,kk)
     724           0 :          if (skl_bgc) then
     725           0 :            write(nu_diag,900) 'Bulk ice conc.   = ',pN_sk(1,kk),pN_sk(2,kk)
     726           0 :          elseif (z_tracers) then
     727           0 :            write(nu_diag,900) 'Tot ice (mmolN/m^2) = ',pN_tot(1,kk),pN_tot(2,kk)
     728           0 :            write(nu_diag,*) '             snow + ice conc.'
     729           0 :            write(nu_diag,803) '  algal N(1)','  algal N(2) '
     730           0 :            write(nu_diag,802) ((pNs(n,k,kk),n=1,2), k = 1,2)
     731           0 :            write(nu_diag,802) ((pN(n,k,kk),n=1,2), k = 1,nblyr+1)
     732           0 :            write(nu_diag,*) '         '
     733             :          endif
     734             :        enddo
     735             :       endif
     736           0 :       if (tr_bgc_C) then
     737           0 :        do kk = 1,1 !n_doc
     738           0 :          write(nu_diag,*) '---------------------------------------------------'
     739           0 :          write(nu_diag,*) '  DOC conc. (mmol C/m^3)'
     740           0 :          write(nu_diag,1020) '  type:', kk
     741           0 :          write(nu_diag,900)  'Ocean conc       = ',(pDOC_ac(n,kk),n=1,2)
     742           0 :          if (skl_bgc) then
     743           0 :            write(nu_diag,900)'Bulk ice conc.   = ',pDOC_sk(1,kk),pDOC_sk(2,kk)
     744           0 :          elseif (z_tracers) then
     745           0 :            write(nu_diag,*) '             snow + ice conc.'
     746           0 :            write(nu_diag,803) '  DOC(1)','  DOC(2) '
     747           0 :            write(nu_diag,802) ((pDOCs(n,k,kk),n=1,2), k = 1,2)
     748           0 :            write(nu_diag,802) ((pDOC(n,k,kk),n=1,2), k = 1,nblyr+1)
     749           0 :            write(nu_diag,*) '      '
     750             :          endif
     751             :        enddo
     752             :       endif
     753           0 :       if (tr_bgc_DON) then
     754           0 :        do kk = 1,n_don
     755           0 :          write(nu_diag,*) '---------------------------------------------------'
     756           0 :          write(nu_diag,*) '  DON conc. (mmol N/m^3)'
     757           0 :          write(nu_diag,1020) '  type:', kk
     758           0 :          write(nu_diag,900)  'Ocean conc       = ',(pDON_ac(n,kk),n=1,2)
     759           0 :          if (skl_bgc) then
     760           0 :            write(nu_diag,900)'Bulk ice conc.   = ',pDON_sk(1,kk),pDON_sk(2,kk)
     761           0 :          elseif (z_tracers) then
     762           0 :            write(nu_diag,*) '             snow + ice conc.'
     763           0 :            write(nu_diag,803) '  DON(1)','  DON(2) '
     764           0 :            write(nu_diag,802) ((pDONs(n,k,kk),n=1,2), k = 1,2)
     765           0 :            write(nu_diag,802) ((pDON(n,k,kk),n=1,2), k = 1,nblyr+1)
     766           0 :            write(nu_diag,*) '      '
     767             :          endif
     768             :        enddo
     769             :       endif
     770           0 :       if (tr_bgc_Fe ) then
     771           0 :        do kk = 1,n_fed
     772           0 :          write(nu_diag,*) '---------------------------------------------------'
     773           0 :          write(nu_diag,*) ' dFe  conc. (nM)'
     774           0 :          write(nu_diag,1020) '  type:', kk
     775           0 :          write(nu_diag,900)  'Ocean conc       = ',(pFed_ac (n,kk),n=1,2)
     776           0 :          if (skl_bgc) then
     777           0 :            write(nu_diag,900)'Bulk ice conc.   = ',pFed_sk (1,kk),pFed_sk (2,kk)
     778           0 :          elseif (z_tracers) then
     779           0 :            write(nu_diag,*) '             snow + ice conc.'
     780           0 :            write(nu_diag,803) '  Fed (1)','  Fed (2) '
     781           0 :            write(nu_diag,802) ((pFeds (n,k,kk),n=1,2), k = 1,2)
     782           0 :            write(nu_diag,802) ((pFed (n,k,kk),n=1,2), k = 1,nblyr+1)
     783           0 :            write(nu_diag,*) '      '
     784             :          endif
     785             :        enddo
     786           0 :        do kk = 1,n_fep
     787           0 :          write(nu_diag,*) '---------------------------------------------------'
     788           0 :          write(nu_diag,*) ' pFe  conc. (nM)'
     789           0 :          write(nu_diag,1020) '  type:', kk
     790           0 :          write(nu_diag,900)  'Ocean conc       = ',(pFep_ac (n,kk),n=1,2)
     791           0 :          if (skl_bgc) then
     792           0 :            write(nu_diag,900)'Bulk ice conc.   = ',pFep_sk (1,kk),pFep_sk (2,kk)
     793           0 :          elseif (z_tracers) then
     794           0 :            write(nu_diag,*) '             snow + ice conc.'
     795           0 :            write(nu_diag,803) '  Fep (1)','  Fep (2) '
     796           0 :            write(nu_diag,802) ((pFeps (n,k,kk),n=1,2), k = 1,2)
     797           0 :            write(nu_diag,802) ((pFep (n,k,kk),n=1,2), k = 1,nblyr+1)
     798           0 :            write(nu_diag,*) '      '
     799             :          endif
     800             :        enddo
     801             :       endif
     802           0 :       if (tr_bgc_DMS) then
     803           0 :          write(nu_diag,*) '---------------------------------------------------'
     804           0 :          write(nu_diag,*) '    DMS (mmol/m^3)      '
     805           0 :          write(nu_diag,900) 'Ocean DMSP    = ',pDMSP_ac(1),pDMSP_ac(2)
     806           0 :          write(nu_diag,900) 'Ocean DMS     = ',pDMS_ac(1),pDMS_ac(2)
     807           0 :          if (skl_bgc) then
     808           0 :           write(nu_diag,900) 'Ice DMSPp    = ',pDMSPp_sk(1),pDMSPp_sk(2)
     809           0 :           write(nu_diag,900) 'Ice DMSPd    = ',pDMSPd_sk(1),pDMSPd_sk(2)
     810           0 :           write(nu_diag,900) 'Ice DMS      = ',pDMS_sk(1),pDMS_sk(2)
     811             :          endif
     812             :       endif
     813           0 :       if (tr_zaero .and. z_tracers) then
     814           0 :        do kk = 1,n_zaero
     815           0 :          write(nu_diag,*) '---------------------------------------------------'
     816           0 :          write(nu_diag,*) '  aerosol conc. (kg/m^3) or flux (kg/m^2/d)'
     817           0 :          write(nu_diag,1020) '  type: ',kk
     818           0 :          write(nu_diag,900) 'Atm source flux     = ',pflux_atm_zaero_s(1,kk),pflux_atm_zaero_s(2,kk)
     819           0 :          write(nu_diag,900) 'ice-ocean flux*aice = ',pflux_zaero(1,kk),pflux_zaero(2,kk)
     820           0 :          write(nu_diag,900) 'atm-ice flux*aice   = ',pflux_atm_zaero(1,kk),pflux_atm_zaero(2,kk)
     821           0 :          write(nu_diag,900) 'snow-ice flux*aice  = ',pflux_snow_zaero(1,kk),pflux_snow_zaero(2,kk)
     822           0 :          write(nu_diag,*) '             snow + ice conc.'
     823           0 :          write(nu_diag,803) ' aerosol(1)','    aerosol(2) '
     824           0 :          write(nu_diag,802) ((pzaeros(n,k,kk),n=1,2), k = 1,2)
     825           0 :          write(nu_diag,802) ((pzaero(n,k,kk),n=1,2), k = 1,nblyr+1)
     826           0 :          write(nu_diag,*) '            '
     827             :        enddo
     828             :       endif
     829           0 :       if (dEdd_algae) then
     830           0 :           if (tr_zaero) then
     831           0 :           do kk = 1,n_zaero
     832           0 :           write(nu_diag,*) '---------------------------------------------------'
     833           0 :           write(nu_diag,*) '  Cat 1 aerosol conc. (kg/m^3) on delta-Eddington grid  '
     834           0 :           write(nu_diag,802) ((pzaerosw(n,k,kk),n=1,2), k = 1,klev +1)
     835             :           enddo
     836             :           endif
     837           0 :          if (tr_bgc_N) then
     838           0 :          write(nu_diag,*) '---------------------------------------------------'
     839           0 :          write(nu_diag,*) '  Cat 1 chl (mg/m^3) on delta-Eddington grid  '
     840           0 :          write(nu_diag,802) ((pchlsw(n,k),n=1,2), k = 1,klev +1)
     841             :          endif
     842             :       endif
     843             :       endif                   ! print_points
     844             :       endif                   ! my_task = master_task
     845             : 
     846             :   802 format (f24.17,2x,f24.17)
     847             :   803 format (a25,2x,a25)
     848             :   900 format (a25,2x,f24.17,2x,f24.17)
     849             :   901 format (a25,2x,g24.17,2x,g24.17)
     850             :  1020 format (a30,2x,i6)    ! integer
     851             : 
     852           0 :       end subroutine bgc_diags
     853             : 
     854             : !=======================================================================
     855             : 
     856             :       end module ice_diagnostics_bgc
     857             : 
     858             : !=======================================================================

Generated by: LCOV version 1.14-6-g40580cd