LCOV - code coverage report
Current view: top level - icepack/columnphysics - icepack_tracers.F90 (source / functions) Coverage Total Hit
Test: 250115-172326:736c1771a8:7:first,quick,base,travis,io,gridsys,unittest Lines: 91.67 % 504 462
Test Date: 2025-01-15 16:42:12 Functions: 100.00 % 10 10

            Line data    Source code
       1              : !=======================================================================
       2              : ! Indices and flags associated with the tracer infrastructure.
       3              : ! Grid-dependent and max_trcr-dependent arrays are declared in ice_state.F90.
       4              : !
       5              : ! author Elizabeth C. Hunke, LANL
       6              : 
       7              :       module icepack_tracers
       8              : 
       9              :       use icepack_kinds
      10              :       use icepack_parameters, only: c0, c1, puny, rhos, rsnw_fall, rhosnew
      11              :       use icepack_parameters, only: snwredist, snwgrain
      12              :       use icepack_warnings, only: warnstr, icepack_warnings_add
      13              :       use icepack_warnings, only: icepack_warnings_setabort, icepack_warnings_aborted
      14              : 
      15              :       implicit none
      16              : 
      17              :       private
      18              :       public :: icepack_compute_tracers
      19              :       public :: icepack_init_tracer_flags
      20              :       public :: icepack_query_tracer_flags
      21              :       public :: icepack_write_tracer_flags
      22              :       public :: icepack_init_tracer_indices
      23              :       public :: icepack_query_tracer_indices
      24              :       public :: icepack_write_tracer_indices
      25              :       public :: icepack_init_tracer_sizes
      26              :       public :: icepack_query_tracer_sizes
      27              :       public :: icepack_write_tracer_sizes
      28              : 
      29              :       !-----------------------------------------------------------------
      30              :       ! dimensions
      31              :       !-----------------------------------------------------------------
      32              :       integer (kind=int_kind), parameter, public :: &
      33              :          max_iso    =   3       , & ! maximum number of isotopes   ! LCOV_EXCL_LINE
      34              :          nmodal1    =   10      , & ! dimension for modal aerosol radiation parameters   ! LCOV_EXCL_LINE
      35              :          nmodal2    =   8       , & ! dimension for modal aerosol radiation parameters   ! LCOV_EXCL_LINE
      36              :          max_algae  =   3       , & ! maximum number of algal types   ! LCOV_EXCL_LINE
      37              :          max_dic    =   1       , & ! maximum number of dissolved inorganic carbon types   ! LCOV_EXCL_LINE
      38              :          max_doc    =   3       , & ! maximum number of dissolved organic carbon types   ! LCOV_EXCL_LINE
      39              :          max_don    =   1       , & ! maximum number of dissolved organic nitrogen types   ! LCOV_EXCL_LINE
      40              :          max_fe     =   2       , & ! maximum number of iron types   ! LCOV_EXCL_LINE
      41              :          max_aero   =   6       , & ! maximum number of aerosols   ! LCOV_EXCL_LINE
      42              :          max_nbtrcr = max_algae*2 & ! algal nitrogen and chlorophyll   ! LCOV_EXCL_LINE
      43              :                     + max_dic     & ! dissolved inorganic carbon   ! LCOV_EXCL_LINE
      44              :                     + max_doc     & ! dissolved organic carbon   ! LCOV_EXCL_LINE
      45              :                     + max_don     & ! dissolved organic nitrogen   ! LCOV_EXCL_LINE
      46              :                     + 5           & ! nitrate, ammonium, silicate, PON, and humics   ! LCOV_EXCL_LINE
      47              :                     + 3           & ! DMSPp, DMSPd, DMS   ! LCOV_EXCL_LINE
      48              :                     + max_fe*2    & ! dissolved Fe and  particulate Fe   ! LCOV_EXCL_LINE
      49              :                     + max_aero      ! aerosols
      50              : 
      51              :       integer (kind=int_kind), public :: &
      52              :          ntrcr        = 0, & ! number of tracers in use   ! LCOV_EXCL_LINE
      53              :          ntrcr_o      = 0, & ! number of non-bio tracers in use   ! LCOV_EXCL_LINE
      54              :          ncat         = 0, & ! number of ice categories in use   ! LCOV_EXCL_LINE
      55              :          nilyr        = 0, & ! number of ice layers per category   ! LCOV_EXCL_LINE
      56              :          nslyr        = 0, & ! number of snow layers per category   ! LCOV_EXCL_LINE
      57              :          nblyr        = 0, & ! number of bio/brine layers per category   ! LCOV_EXCL_LINE
      58              :          nfsd         = 0, & ! number of fsd layers   ! LCOV_EXCL_LINE
      59              :          n_iso        = 0, & ! number of isotopes in use   ! LCOV_EXCL_LINE
      60              :          n_aero       = 0, & ! number of aerosols in use   ! LCOV_EXCL_LINE
      61              :          n_zaero      = 0, & ! number of z aerosols in use   ! LCOV_EXCL_LINE
      62              :          n_algae      = 0, & ! number of algae in use   ! LCOV_EXCL_LINE
      63              :          n_doc        = 0, & ! number of DOC pools in use   ! LCOV_EXCL_LINE
      64              :          n_dic        = 0, & ! number of DIC pools in use   ! LCOV_EXCL_LINE
      65              :          n_don        = 0, & ! number of DON pools in use   ! LCOV_EXCL_LINE
      66              :          n_fed        = 0, & ! number of Fe  pools in use dissolved Fe   ! LCOV_EXCL_LINE
      67              :          n_fep        = 0    ! number of Fe  pools in use particulate Fe
      68              : 
      69              :       integer (kind=int_kind), public :: &
      70              :          nt_Tsfc      = 0, & ! ice/snow temperature   ! LCOV_EXCL_LINE
      71              :          nt_qice      = 0, & ! volume-weighted ice enthalpy (in layers)   ! LCOV_EXCL_LINE
      72              :          nt_qsno      = 0, & ! volume-weighted snow enthalpy (in layers)   ! LCOV_EXCL_LINE
      73              :          nt_sice      = 0, & ! volume-weighted ice bulk salinity (CICE grid layers)   ! LCOV_EXCL_LINE
      74              :          nt_fbri      = 0, & ! volume fraction of ice with dynamic salt (hinS/vicen*aicen)   ! LCOV_EXCL_LINE
      75              :          nt_iage      = 0, & ! volume-weighted ice age   ! LCOV_EXCL_LINE
      76              :          nt_FY        = 0, & ! area-weighted first-year ice area   ! LCOV_EXCL_LINE
      77              :          nt_alvl      = 0, & ! level ice area fraction   ! LCOV_EXCL_LINE
      78              :          nt_vlvl      = 0, & ! level ice volume fraction   ! LCOV_EXCL_LINE
      79              :          nt_apnd      = 0, & ! melt pond area fraction   ! LCOV_EXCL_LINE
      80              :          nt_hpnd      = 0, & ! melt pond depth   ! LCOV_EXCL_LINE
      81              :          nt_ipnd      = 0, & ! melt pond refrozen lid thickness   ! LCOV_EXCL_LINE
      82              :          nt_fsd       = 0, & ! floe size distribution   ! LCOV_EXCL_LINE
      83              :          nt_smice     = 0, & ! mass of ice in snow   ! LCOV_EXCL_LINE
      84              :          nt_smliq     = 0, & ! mass of liquid water in snow   ! LCOV_EXCL_LINE
      85              :          nt_rhos      = 0, & ! snow density   ! LCOV_EXCL_LINE
      86              :          nt_rsnw      = 0, & ! snow grain radius   ! LCOV_EXCL_LINE
      87              :          nt_isosno    = 0, & ! starting index for isotopes in snow   ! LCOV_EXCL_LINE
      88              :          nt_isoice    = 0, & ! starting index for isotopes in ice   ! LCOV_EXCL_LINE
      89              :          nt_aero      = 0, & ! starting index for aerosols in ice   ! LCOV_EXCL_LINE
      90              :          nt_bgc_Nit   = 0, & ! nutrients   ! LCOV_EXCL_LINE
      91              :          nt_bgc_Am    = 0, & !   ! LCOV_EXCL_LINE
      92              :          nt_bgc_Sil   = 0, & !   ! LCOV_EXCL_LINE
      93              :          nt_bgc_DMSPp = 0, & ! trace gases (skeletal layer)   ! LCOV_EXCL_LINE
      94              :          nt_bgc_DMSPd = 0, & !   ! LCOV_EXCL_LINE
      95              :          nt_bgc_DMS   = 0, & !   ! LCOV_EXCL_LINE
      96              :          nt_bgc_PON   = 0, & ! zooplankton and detritus   ! LCOV_EXCL_LINE
      97              :          nt_bgc_hum   = 0, & ! humic material   ! LCOV_EXCL_LINE
      98              :          nt_zbgc_frac = 0, & ! fraction of tracer in the mobile phase   ! LCOV_EXCL_LINE
      99              :          nt_bgc_S     = 0    ! Bulk salinity in fraction ice with dynamic salinity (Bio grid) (deprecated)
     100              : 
     101              :       logical (kind=log_kind), public :: &
     102              :          tr_iage      = .false., & ! if .true., use age tracer   ! LCOV_EXCL_LINE
     103              :          tr_FY        = .false., & ! if .true., use first-year area tracer   ! LCOV_EXCL_LINE
     104              :          tr_lvl       = .false., & ! if .true., use level ice tracer   ! LCOV_EXCL_LINE
     105              :          tr_pond      = .false., & ! if .true., use melt pond tracer   ! LCOV_EXCL_LINE
     106              :          tr_pond_lvl  = .false., & ! if .true., use level-ice pond tracer   ! LCOV_EXCL_LINE
     107              :          tr_pond_topo = .false., & ! if .true., use explicit topography-based ponds   ! LCOV_EXCL_LINE
     108              :          tr_snow      = .false., & ! if .true., use snow redistribution or metamorphosis tracers   ! LCOV_EXCL_LINE
     109              :          tr_iso       = .false., & ! if .true., use isotope tracers   ! LCOV_EXCL_LINE
     110              :          tr_aero      = .false., & ! if .true., use aerosol tracers   ! LCOV_EXCL_LINE
     111              :          tr_brine     = .false., & ! if .true., brine height differs from ice thickness   ! LCOV_EXCL_LINE
     112              :          tr_fsd       = .false.    ! if .true., use floe size distribution
     113              : 
     114              :       !-----------------------------------------------------------------
     115              :       !  biogeochemistry
     116              :       !-----------------------------------------------------------------
     117              : 
     118              :       logical (kind=log_kind), public :: &
     119              :          tr_zaero     = .false., & ! if .true., black carbon as tracers  (n_zaero)   ! LCOV_EXCL_LINE
     120              :          tr_bgc_Nit   = .false., & ! if .true. Nitrate tracer in ice   ! LCOV_EXCL_LINE
     121              :          tr_bgc_N     = .false., & ! if .true., algal nitrogen tracers  (n_algae)   ! LCOV_EXCL_LINE
     122              :          tr_bgc_DON   = .false., & ! if .true., DON pools are tracers  (n_don)   ! LCOV_EXCL_LINE
     123              :          tr_bgc_C     = .false., & ! if .true., algal carbon tracers + DOC and DIC   ! LCOV_EXCL_LINE
     124              :          tr_bgc_chl   = .false., & ! if .true., algal chlorophyll tracers   ! LCOV_EXCL_LINE
     125              :          tr_bgc_Am    = .false., & ! if .true., ammonia/um as nutrient tracer   ! LCOV_EXCL_LINE
     126              :          tr_bgc_Sil   = .false., & ! if .true., silicon as nutrient tracer   ! LCOV_EXCL_LINE
     127              :          tr_bgc_DMS   = .false., & ! if .true., DMS as tracer   ! LCOV_EXCL_LINE
     128              :          tr_bgc_Fe    = .false., & ! if .true., Fe as  tracer   ! LCOV_EXCL_LINE
     129              :          tr_bgc_PON   = .false., & ! if .true., PON as tracer   ! LCOV_EXCL_LINE
     130              :          tr_bgc_hum   = .false.    ! if .true., humic material as tracer
     131              : 
     132              :       integer (kind=int_kind), public :: &
     133              :          nbtrcr       = 0, & ! number of bgc tracers in use   ! LCOV_EXCL_LINE
     134              :          nbtrcr_sw    = 0, & ! number of bgc tracers which impact shortwave   ! LCOV_EXCL_LINE
     135              :          nlt_chl_sw   = 0    ! points to total chla in trcrn_sw
     136              : 
     137              :       integer (kind=int_kind), dimension(max_aero), public :: &
     138              :          nlt_zaero_sw = 0    ! points to aerosol in trcrn_sw
     139              : 
     140              :       integer (kind=int_kind), dimension(max_algae), public :: &
     141              :          nlt_bgc_N    = 0, & ! algae   ! LCOV_EXCL_LINE
     142              :          nlt_bgc_C    = 0, & !   ! LCOV_EXCL_LINE
     143              :          nlt_bgc_chl  = 0    !
     144              : 
     145              :       integer (kind=int_kind), dimension(max_doc), public :: &
     146              :          nlt_bgc_DOC  = 0    ! disolved organic carbon
     147              : 
     148              :       integer (kind=int_kind), dimension(max_don), public :: &
     149              :          nlt_bgc_DON  = 0    !
     150              : 
     151              :       integer (kind=int_kind), dimension(max_dic), public :: &
     152              :          nlt_bgc_DIC  = 0    ! disolved inorganic carbon
     153              : 
     154              :       integer (kind=int_kind), dimension(max_fe), public :: &
     155              :          nlt_bgc_Fed  = 0, & !   ! LCOV_EXCL_LINE
     156              :          nlt_bgc_Fep  = 0    !
     157              : 
     158              :       integer (kind=int_kind), dimension(max_aero), public :: &
     159              :          nlt_zaero    = 0    ! non-reacting layer aerosols
     160              : 
     161              :       integer (kind=int_kind), public :: &
     162              :          nlt_bgc_Nit  = 0, & ! nutrients   ! LCOV_EXCL_LINE
     163              :          nlt_bgc_Am   = 0, & !   ! LCOV_EXCL_LINE
     164              :          nlt_bgc_Sil  = 0, & !   ! LCOV_EXCL_LINE
     165              :          nlt_bgc_DMSPp= 0, & ! trace gases (skeletal layer)   ! LCOV_EXCL_LINE
     166              :          nlt_bgc_DMSPd= 0, & !   ! LCOV_EXCL_LINE
     167              :          nlt_bgc_DMS  = 0, & !   ! LCOV_EXCL_LINE
     168              :          nlt_bgc_PON  = 0, & ! zooplankton and detritus   ! LCOV_EXCL_LINE
     169              :          nlt_bgc_hum  = 0    ! humic material
     170              : 
     171              :       integer (kind=int_kind), dimension(max_algae), public :: &
     172              :          nt_bgc_N     = 0, & ! diatoms, phaeocystis, pico/small   ! LCOV_EXCL_LINE
     173              :          nt_bgc_C     = 0, & ! diatoms, phaeocystis, pico/small   ! LCOV_EXCL_LINE
     174              :          nt_bgc_chl   = 0    ! diatoms, phaeocystis, pico/small
     175              : 
     176              :       integer (kind=int_kind), dimension(max_doc), public :: &
     177              :          nt_bgc_DOC   = 0    !  dissolved organic carbon
     178              : 
     179              :       integer (kind=int_kind), dimension(max_don), public :: &
     180              :          nt_bgc_DON   = 0    !  dissolved organic nitrogen
     181              : 
     182              :       integer (kind=int_kind), dimension(max_dic), public :: &
     183              :          nt_bgc_DIC   = 0    !  dissolved inorganic carbon
     184              : 
     185              :       integer (kind=int_kind), dimension(max_fe), public :: &
     186              :          nt_bgc_Fed   = 0, & !  dissolved iron   ! LCOV_EXCL_LINE
     187              :          nt_bgc_Fep   = 0    !  particulate iron
     188              : 
     189              :       integer (kind=int_kind), dimension(max_aero), public :: &
     190              :          nt_zaero     = 0    !  black carbon and other aerosols
     191              : 
     192              :       integer (kind=int_kind), dimension(max_nbtrcr), public :: &
     193              :          bio_index_o  = 0    ! relates nlt_bgc_NO to ocean concentration index
     194              :                              ! see ocean_bio_all
     195              : 
     196              :       integer (kind=int_kind), dimension(max_nbtrcr), public :: &
     197              :          bio_index    = 0    ! relates bio indices, ie.  nlt_bgc_N to nt_bgc_N
     198              : 
     199              : !=======================================================================
     200              : 
     201              :       contains
     202              : 
     203              : !=======================================================================
     204              : !autodocument_start icepack_init_tracer_flags
     205              : ! set tracer active flags
     206              : 
     207         8444 :       subroutine icepack_init_tracer_flags(&
     208              :            tr_iage_in, tr_FY_in, tr_lvl_in, tr_snow_in, &   ! LCOV_EXCL_LINE
     209              :            tr_pond_in, tr_pond_lvl_in, tr_pond_topo_in, &   ! LCOV_EXCL_LINE
     210              :            tr_fsd_in, tr_aero_in, tr_iso_in, tr_brine_in, tr_zaero_in, &   ! LCOV_EXCL_LINE
     211              :            tr_bgc_Nit_in, tr_bgc_N_in, tr_bgc_DON_in, tr_bgc_C_in, tr_bgc_chl_in, &   ! LCOV_EXCL_LINE
     212              :            tr_bgc_Am_in, tr_bgc_Sil_in, tr_bgc_DMS_in, tr_bgc_Fe_in, tr_bgc_hum_in, &   ! LCOV_EXCL_LINE
     213              :            tr_bgc_PON_in)
     214              : 
     215              :         logical, intent(in), optional :: &
     216              :              tr_iage_in      , & ! if .true., use age tracer   ! LCOV_EXCL_LINE
     217              :              tr_FY_in        , & ! if .true., use first-year area tracer   ! LCOV_EXCL_LINE
     218              :              tr_lvl_in       , & ! if .true., use level ice tracer   ! LCOV_EXCL_LINE
     219              :              tr_pond_in      , & ! if .true., use melt pond tracer   ! LCOV_EXCL_LINE
     220              :              tr_pond_lvl_in  , & ! if .true., use level-ice pond tracer   ! LCOV_EXCL_LINE
     221              :              tr_pond_topo_in , & ! if .true., use explicit topography-based ponds   ! LCOV_EXCL_LINE
     222              :              tr_snow_in      , & ! if .true., use snow redistribution or metamorphosis tracers   ! LCOV_EXCL_LINE
     223              :              tr_fsd_in       , & ! if .true., use floe size distribution tracers   ! LCOV_EXCL_LINE
     224              :              tr_iso_in       , & ! if .true., use isotope tracers   ! LCOV_EXCL_LINE
     225              :              tr_aero_in      , & ! if .true., use aerosol tracers   ! LCOV_EXCL_LINE
     226              :              tr_brine_in     , & ! if .true., brine height differs from ice thickness   ! LCOV_EXCL_LINE
     227              :              tr_zaero_in     , & ! if .true., black carbon is tracers  (n_zaero)   ! LCOV_EXCL_LINE
     228              :              tr_bgc_Nit_in   , & ! if .true., Nitrate tracer in ice   ! LCOV_EXCL_LINE
     229              :              tr_bgc_N_in     , & ! if .true., algal nitrogen tracers  (n_algae)   ! LCOV_EXCL_LINE
     230              :              tr_bgc_DON_in   , & ! if .true., DON pools are tracers  (n_don)   ! LCOV_EXCL_LINE
     231              :              tr_bgc_C_in     , & ! if .true., algal carbon tracers + DOC and DIC   ! LCOV_EXCL_LINE
     232              :              tr_bgc_chl_in   , & ! if .true., algal chlorophyll tracers   ! LCOV_EXCL_LINE
     233              :              tr_bgc_Am_in    , & ! if .true., ammonia/um as nutrient tracer   ! LCOV_EXCL_LINE
     234              :              tr_bgc_Sil_in   , & ! if .true., silicon as nutrient tracer   ! LCOV_EXCL_LINE
     235              :              tr_bgc_DMS_in   , & ! if .true., DMS as product tracer   ! LCOV_EXCL_LINE
     236              :              tr_bgc_Fe_in    , & ! if .true., Fe as product tracer   ! LCOV_EXCL_LINE
     237              :              tr_bgc_hum_in   , & ! if .true., hum as product tracer   ! LCOV_EXCL_LINE
     238              :              tr_bgc_PON_in       ! if .true., PON as product tracer
     239              : 
     240              : !autodocument_end
     241              : 
     242              :         character(len=*),parameter :: subname='(icepack_init_tracer_flags)'
     243              : 
     244         8444 :         if (present(tr_iage_in)) tr_iage = tr_iage_in
     245         8444 :         if (present(tr_FY_in)  ) tr_FY   = tr_FY_in
     246         8444 :         if (present(tr_lvl_in) ) tr_lvl  = tr_lvl_in
     247         8444 :         if (present(tr_pond_in)) tr_pond = tr_pond_in
     248         8444 :         if (present(tr_pond_lvl_in) ) tr_pond_lvl  = tr_pond_lvl_in
     249         8444 :         if (present(tr_pond_topo_in)) tr_pond_topo = tr_pond_topo_in
     250         8444 :         if (present(tr_snow_in)   ) tr_snow    = tr_snow_in
     251         8444 :         if (present(tr_fsd_in)    ) tr_fsd     = tr_fsd_in
     252         8444 :         if (present(tr_iso_in)    ) tr_iso     = tr_iso_in
     253         8444 :         if (present(tr_aero_in)   ) tr_aero    = tr_aero_in
     254         8444 :         if (present(tr_brine_in)  ) tr_brine   = tr_brine_in
     255         8444 :         if (present(tr_zaero_in)  ) tr_zaero   = tr_zaero_in
     256         8444 :         if (present(tr_bgc_Nit_in)) tr_bgc_Nit = tr_bgc_Nit_in
     257         8444 :         if (present(tr_bgc_N_in)  ) tr_bgc_N   = tr_bgc_N_in
     258         8444 :         if (present(tr_bgc_DON_in)) tr_bgc_DON = tr_bgc_DON_in
     259         8444 :         if (present(tr_bgc_C_in)  ) tr_bgc_C   = tr_bgc_C_in
     260         8444 :         if (present(tr_bgc_chl_in)) tr_bgc_chl = tr_bgc_chl_in
     261         8444 :         if (present(tr_bgc_Am_in) ) tr_bgc_Am  = tr_bgc_Am_in
     262         8444 :         if (present(tr_bgc_Sil_in)) tr_bgc_Sil = tr_bgc_Sil_in
     263         8444 :         if (present(tr_bgc_DMS_in)) tr_bgc_DMS = tr_bgc_DMS_in
     264         8444 :         if (present(tr_bgc_Fe_in )) tr_bgc_Fe  = tr_bgc_Fe_in
     265         8444 :         if (present(tr_bgc_hum_in)) tr_bgc_hum = tr_bgc_hum_in
     266         8444 :         if (present(tr_bgc_PON_in)) tr_bgc_PON = tr_bgc_PON_in
     267              : 
     268         8444 :       end subroutine icepack_init_tracer_flags
     269              : 
     270              : !=======================================================================
     271              : !autodocument_start icepack_query_tracer_flags
     272              : ! query tracer active flags
     273              : 
     274    102929009 :       subroutine icepack_query_tracer_flags(&
     275              :            tr_iage_out, tr_FY_out, tr_lvl_out, tr_snow_out, &   ! LCOV_EXCL_LINE
     276              :            tr_pond_out, tr_pond_lvl_out, tr_pond_topo_out, &   ! LCOV_EXCL_LINE
     277              :            tr_fsd_out, tr_aero_out, tr_iso_out, tr_brine_out, tr_zaero_out, &   ! LCOV_EXCL_LINE
     278              :            tr_bgc_Nit_out, tr_bgc_N_out, tr_bgc_DON_out, tr_bgc_C_out, tr_bgc_chl_out, &   ! LCOV_EXCL_LINE
     279              :            tr_bgc_Am_out, tr_bgc_Sil_out, tr_bgc_DMS_out, tr_bgc_Fe_out, tr_bgc_hum_out, &   ! LCOV_EXCL_LINE
     280              :            tr_bgc_PON_out)
     281              : 
     282              :         logical, intent(out), optional :: &
     283              :              tr_iage_out      , & ! if .true., use age tracer   ! LCOV_EXCL_LINE
     284              :              tr_FY_out        , & ! if .true., use first-year area tracer   ! LCOV_EXCL_LINE
     285              :              tr_lvl_out       , & ! if .true., use level ice tracer   ! LCOV_EXCL_LINE
     286              :              tr_pond_out      , & ! if .true., use melt pond tracer   ! LCOV_EXCL_LINE
     287              :              tr_pond_lvl_out  , & ! if .true., use level-ice pond tracer   ! LCOV_EXCL_LINE
     288              :              tr_pond_topo_out , & ! if .true., use explicit topography-based ponds   ! LCOV_EXCL_LINE
     289              :              tr_snow_out      , & ! if .true., use snow redistribution or metamorphosis tracers   ! LCOV_EXCL_LINE
     290              :              tr_fsd_out       , & ! if .true., use floe size distribution   ! LCOV_EXCL_LINE
     291              :              tr_iso_out       , & ! if .true., use isotope tracers   ! LCOV_EXCL_LINE
     292              :              tr_aero_out      , & ! if .true., use aerosol tracers   ! LCOV_EXCL_LINE
     293              :              tr_brine_out     , & ! if .true., brine height differs from ice thickness   ! LCOV_EXCL_LINE
     294              :              tr_zaero_out     , & ! if .true., black carbon is tracers  (n_zaero)   ! LCOV_EXCL_LINE
     295              :              tr_bgc_Nit_out   , & ! if .true., Nitrate tracer in ice   ! LCOV_EXCL_LINE
     296              :              tr_bgc_N_out     , & ! if .true., algal nitrogen tracers  (n_algae)   ! LCOV_EXCL_LINE
     297              :              tr_bgc_DON_out   , & ! if .true., DON pools are tracers  (n_don)   ! LCOV_EXCL_LINE
     298              :              tr_bgc_C_out     , & ! if .true., algal carbon tracers + DOC and DIC   ! LCOV_EXCL_LINE
     299              :              tr_bgc_chl_out   , & ! if .true., algal chlorophyll tracers   ! LCOV_EXCL_LINE
     300              :              tr_bgc_Am_out    , & ! if .true., ammonia/um as nutrient tracer   ! LCOV_EXCL_LINE
     301              :              tr_bgc_Sil_out   , & ! if .true., silicon as nutrient tracer   ! LCOV_EXCL_LINE
     302              :              tr_bgc_DMS_out   , & ! if .true., DMS as product tracer   ! LCOV_EXCL_LINE
     303              :              tr_bgc_Fe_out    , & ! if .true., Fe as product tracer   ! LCOV_EXCL_LINE
     304              :              tr_bgc_hum_out   , & ! if .true., hum as product tracer   ! LCOV_EXCL_LINE
     305              :              tr_bgc_PON_out       ! if .true., PON as product tracer
     306              : 
     307              : !autodocument_end
     308              : 
     309              :         character(len=*),parameter :: subname='(icepack_query_tracer_flags)'
     310              : 
     311    102929009 :         if (present(tr_iage_out)) tr_iage_out = tr_iage
     312    102929009 :         if (present(tr_FY_out)  ) tr_FY_out   = tr_FY
     313    102929009 :         if (present(tr_lvl_out) ) tr_lvl_out  = tr_lvl
     314    102929009 :         if (present(tr_pond_out)) tr_pond_out = tr_pond
     315    102929009 :         if (present(tr_pond_lvl_out) ) tr_pond_lvl_out  = tr_pond_lvl
     316    102929009 :         if (present(tr_pond_topo_out)) tr_pond_topo_out = tr_pond_topo
     317    102929009 :         if (present(tr_snow_out)   ) tr_snow_out    = tr_snow
     318    102929009 :         if (present(tr_fsd_out)    ) tr_fsd_out     = tr_fsd
     319    102929009 :         if (present(tr_iso_out)    ) tr_iso_out     = tr_iso
     320    102929009 :         if (present(tr_aero_out)   ) tr_aero_out    = tr_aero
     321    102929009 :         if (present(tr_brine_out)  ) tr_brine_out   = tr_brine
     322    102929009 :         if (present(tr_zaero_out)  ) tr_zaero_out   = tr_zaero
     323    102929009 :         if (present(tr_bgc_Nit_out)) tr_bgc_Nit_out = tr_bgc_Nit
     324    102929009 :         if (present(tr_bgc_N_out)  ) tr_bgc_N_out   = tr_bgc_N
     325    102929009 :         if (present(tr_bgc_DON_out)) tr_bgc_DON_out = tr_bgc_DON
     326    102929009 :         if (present(tr_bgc_C_out)  ) tr_bgc_C_out   = tr_bgc_C
     327    102929009 :         if (present(tr_bgc_chl_out)) tr_bgc_chl_out = tr_bgc_chl
     328    102929009 :         if (present(tr_bgc_Am_out) ) tr_bgc_Am_out  = tr_bgc_Am
     329    102929009 :         if (present(tr_bgc_Sil_out)) tr_bgc_Sil_out = tr_bgc_Sil
     330    102929009 :         if (present(tr_bgc_DMS_out)) tr_bgc_DMS_out = tr_bgc_DMS
     331    102929009 :         if (present(tr_bgc_Fe_out )) tr_bgc_Fe_out  = tr_bgc_Fe
     332    102929009 :         if (present(tr_bgc_hum_out)) tr_bgc_hum_out = tr_bgc_hum
     333    102929009 :         if (present(tr_bgc_PON_out)) tr_bgc_PON_out = tr_bgc_PON
     334              : 
     335    102929009 :       end subroutine icepack_query_tracer_flags
     336              : 
     337              : !=======================================================================
     338              : !autodocument_start icepack_write_tracer_flags
     339              : ! write tracer active flags
     340              : 
     341          375 :       subroutine icepack_write_tracer_flags(iounit)
     342              : 
     343              :         integer, intent(in) :: iounit
     344              : 
     345              : !autodocument_end
     346              : 
     347              :         character(len=*),parameter :: subname='(icepack_write_tracer_flags)'
     348              : 
     349          375 :         write(iounit,*) subname//":"
     350          375 :         write(iounit,*) "  tr_iage = ",tr_iage
     351          375 :         write(iounit,*) "  tr_FY   = ",tr_FY
     352          375 :         write(iounit,*) "  tr_lvl  = ",tr_lvl
     353          375 :         write(iounit,*) "  tr_pond = ",tr_pond
     354          375 :         write(iounit,*) "  tr_pond_lvl  = ",tr_pond_lvl
     355          375 :         write(iounit,*) "  tr_pond_topo = ",tr_pond_topo
     356          375 :         write(iounit,*) "  tr_snow    = ",tr_snow
     357          375 :         write(iounit,*) "  tr_fsd     = ",tr_fsd
     358          375 :         write(iounit,*) "  tr_iso     = ",tr_iso
     359          375 :         write(iounit,*) "  tr_aero    = ",tr_aero
     360          375 :         write(iounit,*) "  tr_brine   = ",tr_brine
     361          375 :         write(iounit,*) "  tr_zaero   = ",tr_zaero
     362          375 :         write(iounit,*) "  tr_bgc_Nit = ",tr_bgc_Nit
     363          375 :         write(iounit,*) "  tr_bgc_N   = ",tr_bgc_N
     364          375 :         write(iounit,*) "  tr_bgc_DON = ",tr_bgc_DON
     365          375 :         write(iounit,*) "  tr_bgc_C   = ",tr_bgc_C
     366          375 :         write(iounit,*) "  tr_bgc_chl = ",tr_bgc_chl
     367          375 :         write(iounit,*) "  tr_bgc_Am  = ",tr_bgc_Am
     368          375 :         write(iounit,*) "  tr_bgc_Sil = ",tr_bgc_Sil
     369          375 :         write(iounit,*) "  tr_bgc_DMS = ",tr_bgc_DMS
     370          375 :         write(iounit,*) "  tr_bgc_Fe  = ",tr_bgc_Fe
     371          375 :         write(iounit,*) "  tr_bgc_hum = ",tr_bgc_hum
     372          375 :         write(iounit,*) "  tr_bgc_PON = ",tr_bgc_PON
     373              : 
     374          375 :       end subroutine icepack_write_tracer_flags
     375              : 
     376              : !=======================================================================
     377              : !autodocument_start icepack_init_tracer_indices
     378              : ! set the number of column tracer indices
     379              : 
     380         8444 :       subroutine icepack_init_tracer_indices(&
     381              :            nt_Tsfc_in, nt_qice_in, nt_qsno_in, nt_sice_in, &   ! LCOV_EXCL_LINE
     382              :            nt_fbri_in, nt_iage_in, nt_FY_in, &   ! LCOV_EXCL_LINE
     383              :            nt_alvl_in, nt_vlvl_in, nt_apnd_in, nt_hpnd_in, nt_ipnd_in, &   ! LCOV_EXCL_LINE
     384              :            nt_smice_in, nt_smliq_in, nt_rhos_in, nt_rsnw_in, &   ! LCOV_EXCL_LINE
     385              :            nt_fsd_in, nt_isosno_in, nt_isoice_in, &   ! LCOV_EXCL_LINE
     386        16888 :            nt_aero_in, nt_zaero_in, nt_bgc_C_in, &   ! LCOV_EXCL_LINE
     387        33776 :            nt_bgc_N_in, nt_bgc_chl_in, nt_bgc_DOC_in, nt_bgc_DON_in, &   ! LCOV_EXCL_LINE
     388        25332 :            nt_bgc_DIC_in, nt_bgc_Fed_in, nt_bgc_Fep_in, nt_bgc_Nit_in, nt_bgc_Am_in, &   ! LCOV_EXCL_LINE
     389              :            nt_bgc_Sil_in, nt_bgc_DMSPp_in, nt_bgc_DMSPd_in, nt_bgc_DMS_in, nt_bgc_hum_in, &   ! LCOV_EXCL_LINE
     390        33776 :            nt_bgc_PON_in, nlt_zaero_in, nlt_bgc_C_in, nlt_bgc_N_in, nlt_bgc_chl_in, &   ! LCOV_EXCL_LINE
     391        33776 :            nlt_bgc_DOC_in, nlt_bgc_DON_in, nlt_bgc_DIC_in, nlt_bgc_Fed_in, &   ! LCOV_EXCL_LINE
     392         8444 :            nlt_bgc_Fep_in, nlt_bgc_Nit_in, nlt_bgc_Am_in, nlt_bgc_Sil_in, &   ! LCOV_EXCL_LINE
     393              :            nlt_bgc_DMSPp_in, nlt_bgc_DMSPd_in, nlt_bgc_DMS_in, nlt_bgc_hum_in, &   ! LCOV_EXCL_LINE
     394              :            nlt_bgc_PON_in, nt_zbgc_frac_in, nt_bgc_S_in, nlt_chl_sw_in, &   ! LCOV_EXCL_LINE
     395         8444 :            nlt_zaero_sw_in, &   ! LCOV_EXCL_LINE
     396         8444 :            bio_index_o_in, bio_index_in)
     397              : 
     398              :         integer, intent(in), optional :: &
     399              :              nt_Tsfc_in, & ! ice/snow temperature   ! LCOV_EXCL_LINE
     400              :              nt_qice_in, & ! volume-weighted ice enthalpy (in layers)   ! LCOV_EXCL_LINE
     401              :              nt_qsno_in, & ! volume-weighted snow enthalpy (in layers)   ! LCOV_EXCL_LINE
     402              :              nt_sice_in, & ! volume-weighted ice bulk salinity (CICE grid layers)   ! LCOV_EXCL_LINE
     403              :              nt_fbri_in, & ! volume fraction of ice with dynamic salt (hinS/vicen*aicen)   ! LCOV_EXCL_LINE
     404              :              nt_iage_in, & ! volume-weighted ice age   ! LCOV_EXCL_LINE
     405              :              nt_FY_in,   & ! area-weighted first-year ice area   ! LCOV_EXCL_LINE
     406              :              nt_alvl_in, & ! level ice area fraction   ! LCOV_EXCL_LINE
     407              :              nt_vlvl_in, & ! level ice volume fraction   ! LCOV_EXCL_LINE
     408              :              nt_apnd_in, & ! melt pond area fraction   ! LCOV_EXCL_LINE
     409              :              nt_hpnd_in, & ! melt pond depth   ! LCOV_EXCL_LINE
     410              :              nt_ipnd_in, & ! melt pond refrozen lid thickness   ! LCOV_EXCL_LINE
     411              :              nt_smice_in,& ! mass of ice in snow   ! LCOV_EXCL_LINE
     412              :              nt_smliq_in,& ! mass of liquid water in snow   ! LCOV_EXCL_LINE
     413              :              nt_rhos_in, & ! snow density   ! LCOV_EXCL_LINE
     414              :              nt_rsnw_in, & ! snow grain radius   ! LCOV_EXCL_LINE
     415              :              nt_fsd_in,  & ! floe size distribution   ! LCOV_EXCL_LINE
     416              :              nt_isosno_in,  & ! starting index for isotopes in snow   ! LCOV_EXCL_LINE
     417              :              nt_isoice_in,  & ! starting index for isotopes in ice   ! LCOV_EXCL_LINE
     418              :              nt_aero_in,    & ! starting index for aerosols in ice   ! LCOV_EXCL_LINE
     419              :              nt_bgc_Nit_in, & ! nutrients   ! LCOV_EXCL_LINE
     420              :              nt_bgc_Am_in,  & !   ! LCOV_EXCL_LINE
     421              :              nt_bgc_Sil_in, & !   ! LCOV_EXCL_LINE
     422              :              nt_bgc_DMSPp_in,&! trace gases (skeletal layer)   ! LCOV_EXCL_LINE
     423              :              nt_bgc_DMSPd_in,&!   ! LCOV_EXCL_LINE
     424              :              nt_bgc_DMS_in, & !   ! LCOV_EXCL_LINE
     425              :              nt_bgc_hum_in, & !   ! LCOV_EXCL_LINE
     426              :              nt_bgc_PON_in, & ! zooplankton and detritus   ! LCOV_EXCL_LINE
     427              :              nlt_bgc_Nit_in,& ! nutrients   ! LCOV_EXCL_LINE
     428              :              nlt_bgc_Am_in, & !   ! LCOV_EXCL_LINE
     429              :              nlt_bgc_Sil_in,& !   ! LCOV_EXCL_LINE
     430              :              nlt_bgc_DMSPp_in,&! trace gases (skeletal layer)   ! LCOV_EXCL_LINE
     431              :              nlt_bgc_DMSPd_in,&!   ! LCOV_EXCL_LINE
     432              :              nlt_bgc_DMS_in,& !   ! LCOV_EXCL_LINE
     433              :              nlt_bgc_hum_in,& !   ! LCOV_EXCL_LINE
     434              :              nlt_bgc_PON_in,& ! zooplankton and detritus   ! LCOV_EXCL_LINE
     435              :              nt_zbgc_frac_in,&! fraction of tracer in the mobile phase   ! LCOV_EXCL_LINE
     436              :              nt_bgc_S_in,   & ! (deprecated, was related to zsalinity)   ! LCOV_EXCL_LINE
     437              :              nlt_chl_sw_in    ! points to total chla in trcrn_sw
     438              : 
     439              :         integer (kind=int_kind), dimension(:), intent(in), optional :: &
     440              :              bio_index_o_in, &   ! LCOV_EXCL_LINE
     441              :              bio_index_in
     442              : 
     443              :         integer (kind=int_kind), dimension(:), intent(in), optional :: &
     444              :              nt_bgc_N_in ,  & ! diatoms, phaeocystis, pico/small   ! LCOV_EXCL_LINE
     445              :              nt_bgc_C_in ,  & ! diatoms, phaeocystis, pico/small   ! LCOV_EXCL_LINE
     446              :              nt_bgc_chl_in, & ! diatoms, phaeocystis, pico/small   ! LCOV_EXCL_LINE
     447              :              nlt_bgc_N_in , & ! diatoms, phaeocystis, pico/small   ! LCOV_EXCL_LINE
     448              :              nlt_bgc_C_in , & ! diatoms, phaeocystis, pico/small   ! LCOV_EXCL_LINE
     449              :              nlt_bgc_chl_in   ! diatoms, phaeocystis, pico/small
     450              : 
     451              :         integer (kind=int_kind), dimension(:), intent(in), optional :: &
     452              :              nt_bgc_DOC_in, & !  dissolved organic carbon   ! LCOV_EXCL_LINE
     453              :              nlt_bgc_DOC_in   !  dissolved organic carbon
     454              : 
     455              :         integer (kind=int_kind), dimension(:), intent(in), optional :: &
     456              :              nt_bgc_DON_in, & !  dissolved organic nitrogen   ! LCOV_EXCL_LINE
     457              :              nlt_bgc_DON_in   !  dissolved organic nitrogen
     458              : 
     459              :         integer (kind=int_kind), dimension(:), intent(in), optional :: &
     460              :              nt_bgc_DIC_in, & ! dissolved inorganic carbon   ! LCOV_EXCL_LINE
     461              :              nlt_bgc_DIC_in   !  dissolved inorganic carbon
     462              : 
     463              :         integer (kind=int_kind), dimension(:), intent(in), optional :: &
     464              :              nt_bgc_Fed_in, & !  dissolved iron   ! LCOV_EXCL_LINE
     465              :              nt_bgc_Fep_in, & !  particulate iron   ! LCOV_EXCL_LINE
     466              :              nlt_bgc_Fed_in,& !  dissolved iron   ! LCOV_EXCL_LINE
     467              :              nlt_bgc_Fep_in   !  particulate iron
     468              : 
     469              :         integer (kind=int_kind), dimension(:), intent(in), optional :: &
     470              :              nt_zaero_in,   & !  black carbon and other aerosols   ! LCOV_EXCL_LINE
     471              :              nlt_zaero_in,  & !  black carbon and other aerosols   ! LCOV_EXCL_LINE
     472              :              nlt_zaero_sw_in  ! black carbon and dust in trcrn_sw
     473              : 
     474              : !autodocument_end
     475              : 
     476              :         ! local
     477              :         integer (kind=int_kind) :: nsiz
     478              :         character(len=*),parameter :: subname='(icepack_init_tracer_indices)'
     479              : 
     480         8444 :         if (present(nt_Tsfc_in)) nt_Tsfc = nt_Tsfc_in
     481         8444 :         if (present(nt_qice_in)) nt_qice = nt_qice_in
     482         8444 :         if (present(nt_qsno_in)) nt_qsno = nt_qsno_in
     483         8444 :         if (present(nt_sice_in)) nt_sice = nt_sice_in
     484         8444 :         if (present(nt_fbri_in)) nt_fbri = nt_fbri_in
     485         8444 :         if (present(nt_iage_in)) nt_iage = nt_iage_in
     486         8444 :         if (present(nt_FY_in)  ) nt_FY   = nt_FY_in
     487         8444 :         if (present(nt_alvl_in)) nt_alvl = nt_alvl_in
     488         8444 :         if (present(nt_vlvl_in)) nt_vlvl = nt_vlvl_in
     489         8444 :         if (present(nt_apnd_in)) nt_apnd = nt_apnd_in
     490         8444 :         if (present(nt_hpnd_in)) nt_hpnd = nt_hpnd_in
     491         8444 :         if (present(nt_ipnd_in)) nt_ipnd = nt_ipnd_in
     492         8444 :         if (present(nt_fsd_in) ) nt_fsd  = nt_fsd_in
     493         8444 :         if (present(nt_smice_in)     ) nt_smice      = nt_smice_in
     494         8444 :         if (present(nt_smliq_in)     ) nt_smliq      = nt_smliq_in
     495         8444 :         if (present(nt_rhos_in)      ) nt_rhos       = nt_rhos_in
     496         8444 :         if (present(nt_rsnw_in)      ) nt_rsnw       = nt_rsnw_in
     497         8444 :         if (present(nt_isosno_in)    ) nt_isosno     = nt_isosno_in
     498         8444 :         if (present(nt_isoice_in)    ) nt_isoice     = nt_isoice_in
     499         8444 :         if (present(nt_aero_in)      ) nt_aero       = nt_aero_in
     500         8444 :         if (present(nt_bgc_Nit_in)   ) nt_bgc_Nit    = nt_bgc_Nit_in
     501         8444 :         if (present(nt_bgc_Am_in)    ) nt_bgc_Am     = nt_bgc_Am_in
     502         8444 :         if (present(nt_bgc_Sil_in)   ) nt_bgc_Sil    = nt_bgc_Sil_in
     503         8444 :         if (present(nt_bgc_DMSPp_in) ) nt_bgc_DMSPp  = nt_bgc_DMSPp_in
     504         8444 :         if (present(nt_bgc_DMSPd_in) ) nt_bgc_DMSPd  = nt_bgc_DMSPd_in
     505         8444 :         if (present(nt_bgc_DMS_in)   ) nt_bgc_DMS    = nt_bgc_DMS_in
     506         8444 :         if (present(nt_bgc_hum_in)   ) nt_bgc_hum    = nt_bgc_hum_in
     507         8444 :         if (present(nt_bgc_PON_in)   ) nt_bgc_PON    = nt_bgc_PON_in
     508         8444 :         if (present(nlt_bgc_Nit_in)  ) nlt_bgc_Nit   = nlt_bgc_Nit_in
     509         8444 :         if (present(nlt_bgc_Am_in)   ) nlt_bgc_Am    = nlt_bgc_Am_in
     510         8444 :         if (present(nlt_bgc_Sil_in)  ) nlt_bgc_Sil   = nlt_bgc_Sil_in
     511         8444 :         if (present(nlt_bgc_DMSPp_in)) nlt_bgc_DMSPp = nlt_bgc_DMSPp_in
     512         8444 :         if (present(nlt_bgc_DMSPd_in)) nlt_bgc_DMSPd = nlt_bgc_DMSPd_in
     513         8444 :         if (present(nlt_bgc_DMS_in)  ) nlt_bgc_DMS   = nlt_bgc_DMS_in
     514         8444 :         if (present(nlt_bgc_hum_in)  ) nlt_bgc_hum   = nlt_bgc_hum_in
     515         8444 :         if (present(nlt_bgc_PON_in)  ) nlt_bgc_PON   = nlt_bgc_PON_in
     516         8444 :         if (present(nlt_chl_sw_in)   ) nlt_chl_sw    = nlt_chl_sw_in
     517         8444 :         if (present(nt_zbgc_frac_in) ) nt_zbgc_frac  = nt_zbgc_frac_in
     518         8444 :         if (present(nt_bgc_S_in)     ) nt_bgc_S      = nt_bgc_S_in
     519              : 
     520         8444 :         if (present(bio_index_in)) then
     521         4222 :            nsiz = size(bio_index_in)
     522         4222 :            if (size(bio_index) < nsiz) then
     523            0 :               call icepack_warnings_add(subname//'error in bio_index size')
     524            0 :               call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
     525              :            else
     526       126660 :               bio_index(1:nsiz) = bio_index_in(1:nsiz)
     527              :            endif
     528              :         endif
     529              : 
     530         8444 :         if (present(bio_index_o_in)) then
     531         4222 :            nsiz = size(bio_index_o_in)
     532         4222 :            if (size(bio_index_o) < nsiz) then
     533            0 :               call icepack_warnings_add(subname//'error in bio_index_o size')
     534            0 :               call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
     535              :            else
     536       126660 :               bio_index_o(1:nsiz) = bio_index_o_in(1:nsiz)
     537              :            endif
     538              :         endif
     539              : 
     540         8444 :         if (present(nt_bgc_N_in)) then
     541         4222 :            nsiz = size(nt_bgc_N_in)
     542         4222 :            if (size(nt_bgc_N) < nsiz) then
     543            0 :               call icepack_warnings_add(subname//'error in nt_bgc_N size')
     544            0 :               call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
     545              :            else
     546        16888 :               nt_bgc_N(1:nsiz) = nt_bgc_N_in(1:nsiz)
     547              :            endif
     548              :         endif
     549              : 
     550         8444 :         if (present(nlt_bgc_N_in)) then
     551         4222 :            nsiz = size(nlt_bgc_N_in)
     552         4222 :            if (size(nlt_bgc_N) < nsiz) then
     553            0 :               call icepack_warnings_add(subname//'error in nlt_bgc_N size')
     554            0 :               call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
     555              :            else
     556        16888 :               nlt_bgc_N(1:nsiz) = nlt_bgc_N_in(1:nsiz)
     557              :            endif
     558              :         endif
     559              : 
     560         8444 :         if (present(nt_bgc_chl_in)) then
     561         4222 :            nsiz = size(nt_bgc_chl_in)
     562         4222 :            if (size(nt_bgc_chl) < nsiz) then
     563            0 :               call icepack_warnings_add(subname//'error in nt_bgc_chl size')
     564            0 :               call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
     565              :            else
     566        16888 :               nt_bgc_chl(1:nsiz) = nt_bgc_chl_in(1:nsiz)
     567              :            endif
     568              :         endif
     569              : 
     570         8444 :         if (present(nlt_bgc_chl_in)) then
     571         4222 :            nsiz = size(nlt_bgc_chl_in)
     572         4222 :            if (size(nlt_bgc_chl) < nsiz) then
     573            0 :               call icepack_warnings_add(subname//'error in nlt_bgc_chl size')
     574            0 :               call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
     575              :            else
     576        16888 :               nlt_bgc_chl(1:nsiz) = nlt_bgc_chl_in(1:nsiz)
     577              :            endif
     578              :         endif
     579              : 
     580              : ! algal C is not yet distinct from algal N
     581         8444 :         if (present(nt_bgc_C_in) .or. present(nlt_bgc_C_in)) then
     582            0 :            call icepack_warnings_add(subname//'error bgc_C not supported')
     583            0 :            call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
     584              :         endif
     585              : 
     586              : !        if (present(nt_bgc_C_in)) then
     587              : !           nsiz = size(nt_bgc_C_in)
     588              : !           if (size(nt_bgc_C) < nsiz) then
     589              : !              call icepack_warnings_add(subname//'error in nt_bgc_C size')
     590              : !              call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
     591              : !           else
     592              : !              nt_bgc_C(1:nsiz) = nt_bgc_C_in(1:nsiz)
     593              : !           endif
     594              : !        endif
     595              : 
     596              : !        if (present(nlt_bgc_C_in)) then
     597              : !           nsiz = size(nlt_bgc_C_in)
     598              : !           if (size(nlt_bgc_C) < nsiz) then
     599              : !              call icepack_warnings_add(subname//'error in nlt_bgc_C size')
     600              : !              call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
     601              : !           else
     602              : !              nlt_bgc_C(1:nsiz) = nlt_bgc_C_in(1:nsiz)
     603              : !           endif
     604              : !        endif
     605              : 
     606         8444 :         if (present(nt_bgc_DOC_in)) then
     607         4222 :            nsiz = size(nt_bgc_DOC_in)
     608         4222 :            if (size(nt_bgc_DOC) < nsiz) then
     609            0 :               call icepack_warnings_add(subname//'error in nt_bgc_DOC size')
     610            0 :               call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
     611              :            else
     612        16888 :               nt_bgc_DOC(1:nsiz) = nt_bgc_DOC_in(1:nsiz)
     613              :            endif
     614              :         endif
     615              : 
     616         8444 :         if (present(nlt_bgc_DOC_in)) then
     617         4222 :            nsiz = size(nlt_bgc_DOC_in)
     618         4222 :            if (size(nlt_bgc_DOC) < nsiz) then
     619            0 :               call icepack_warnings_add(subname//'error in nlt_bgc_DOC size')
     620            0 :               call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
     621              :            else
     622        16888 :               nlt_bgc_DOC(1:nsiz) = nlt_bgc_DOC_in(1:nsiz)
     623              :            endif
     624              :         endif
     625              : 
     626         8444 :         if (present(nt_bgc_DON_in)) then
     627         4222 :            nsiz = size(nt_bgc_DON_in)
     628         4222 :            if (size(nt_bgc_DON) < nsiz) then
     629            0 :               call icepack_warnings_add(subname//'error in nt_bgc_DON size')
     630            0 :               call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
     631              :            else
     632         8444 :               nt_bgc_DON(1:nsiz) = nt_bgc_DON_in(1:nsiz)
     633              :            endif
     634              :         endif
     635              : 
     636         8444 :         if (present(nlt_bgc_DON_in)) then
     637         4222 :            nsiz = size(nlt_bgc_DON_in)
     638         4222 :            if (size(nlt_bgc_DON) < nsiz) then
     639            0 :               call icepack_warnings_add(subname//'error in nlt_bgc_DON size')
     640            0 :               call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
     641              :            else
     642         8444 :               nlt_bgc_DON(1:nsiz) = nlt_bgc_DON_in(1:nsiz)
     643              :            endif
     644              :         endif
     645              : 
     646         8444 :         if (present(nt_bgc_DIC_in)) then
     647         4222 :            nsiz = size(nt_bgc_DIC_in)
     648         4222 :            if (size(nt_bgc_DIC) < nsiz) then
     649            0 :               call icepack_warnings_add(subname//'error in nt_bgc_DIC size')
     650            0 :               call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
     651              :            else
     652         8444 :               nt_bgc_DIC(1:nsiz) = nt_bgc_DIC_in(1:nsiz)
     653              :            endif
     654              :         endif
     655              : 
     656         8444 :         if (present(nlt_bgc_DIC_in)) then
     657         4222 :            nsiz = size(nlt_bgc_DIC_in)
     658         4222 :            if (size(nlt_bgc_DIC) < nsiz) then
     659            0 :               call icepack_warnings_add(subname//'error in nlt_bgc_DIC size')
     660            0 :               call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
     661              :            else
     662         8444 :               nlt_bgc_DIC(1:nsiz) = nlt_bgc_DIC_in(1:nsiz)
     663              :            endif
     664              :         endif
     665              : 
     666         8444 :         if (present(nt_bgc_Fed_in)) then
     667         4222 :            nsiz = size(nt_bgc_Fed_in)
     668         4222 :            if (size(nt_bgc_Fed) < nsiz) then
     669            0 :               call icepack_warnings_add(subname//'error in nt_bgc_Fed size')
     670            0 :               call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
     671              :            else
     672        12666 :               nt_bgc_Fed(1:nsiz) = nt_bgc_Fed_in(1:nsiz)
     673              :            endif
     674              :         endif
     675              : 
     676         8444 :         if (present(nlt_bgc_Fed_in)) then
     677         4222 :            nsiz = size(nlt_bgc_Fed_in)
     678         4222 :            if (size(nlt_bgc_Fed) < nsiz) then
     679            0 :               call icepack_warnings_add(subname//'error in nlt_bgc_Fed size')
     680            0 :               call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
     681              :            else
     682        12666 :               nlt_bgc_Fed(1:nsiz) = nlt_bgc_Fed_in(1:nsiz)
     683              :            endif
     684              :         endif
     685              : 
     686         8444 :         if (present(nt_bgc_Fep_in)) then
     687         4222 :            nsiz = size(nt_bgc_Fep_in)
     688         4222 :            if (size(nt_bgc_Fep) < nsiz) then
     689            0 :               call icepack_warnings_add(subname//'error in nt_bgc_Fep size')
     690            0 :               call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
     691              :            else
     692        12666 :               nt_bgc_Fep(1:nsiz) = nt_bgc_Fep_in(1:nsiz)
     693              :            endif
     694              :         endif
     695              : 
     696         8444 :         if (present(nlt_bgc_Fep_in)) then
     697         4222 :            nsiz = size(nlt_bgc_Fep_in)
     698         4222 :            if (size(nlt_bgc_Fep) < nsiz) then
     699            0 :               call icepack_warnings_add(subname//'error in nlt_bgc_Fep size')
     700            0 :               call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
     701              :            else
     702        12666 :               nlt_bgc_Fep(1:nsiz) = nlt_bgc_Fep_in(1:nsiz)
     703              :            endif
     704              :         endif
     705              : 
     706         8444 :         if (present(nt_zaero_in)) then
     707         4222 :            nsiz = size(nt_zaero_in)
     708         4222 :            if (size(nt_zaero) < nsiz) then
     709            0 :               call icepack_warnings_add(subname//'error in nt_zaero size')
     710            0 :               call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
     711              :            else
     712        29554 :               nt_zaero(1:nsiz) = nt_zaero_in(1:nsiz)
     713              :            endif
     714              :         endif
     715              : 
     716         8444 :         if (present(nlt_zaero_in)) then
     717         4222 :            nsiz = size(nlt_zaero_in)
     718         4222 :            if (size(nlt_zaero) < nsiz) then
     719            0 :               call icepack_warnings_add(subname//'error in nlt_zaero size')
     720            0 :               call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
     721              :            else
     722        29554 :               nlt_zaero(1:nsiz) = nlt_zaero_in(1:nsiz)
     723              :            endif
     724              :         endif
     725              : 
     726         8444 :         if (present(nlt_zaero_sw_in)) then
     727         4222 :            nsiz = size(nlt_zaero_sw_in)
     728         4222 :            if (size(nlt_zaero_sw) < nsiz) then
     729            0 :               call icepack_warnings_add(subname//'error in nlt_zaero_sw size')
     730            0 :               call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
     731              :            else
     732        29554 :               nlt_zaero_sw(1:nsiz) = nlt_zaero_sw_in(1:nsiz)
     733              :            endif
     734              :         endif
     735              : 
     736         8444 :       end subroutine icepack_init_tracer_indices
     737              : 
     738              : !=======================================================================
     739              : !autodocument_start icepack_query_tracer_indices
     740              : ! query the number of column tracer indices
     741              : 
     742    125164759 :       subroutine icepack_query_tracer_indices(&
     743              :            nt_Tsfc_out, nt_qice_out, nt_qsno_out, nt_sice_out, &   ! LCOV_EXCL_LINE
     744              :            nt_fbri_out, nt_iage_out, nt_FY_out, &   ! LCOV_EXCL_LINE
     745              :            nt_alvl_out, nt_vlvl_out, nt_apnd_out, nt_hpnd_out, nt_ipnd_out, &   ! LCOV_EXCL_LINE
     746              :            nt_smice_out, nt_smliq_out, nt_rhos_out, nt_rsnw_out, &   ! LCOV_EXCL_LINE
     747              :            nt_fsd_out, nt_isosno_out, nt_isoice_out, &   ! LCOV_EXCL_LINE
     748    250329518 :            nt_aero_out, nt_zaero_out, nt_bgc_C_out, &   ! LCOV_EXCL_LINE
     749    500659036 :            nt_bgc_N_out, nt_bgc_chl_out, nt_bgc_DOC_out, nt_bgc_DON_out, &   ! LCOV_EXCL_LINE
     750    375494277 :            nt_bgc_DIC_out, nt_bgc_Fed_out, nt_bgc_Fep_out, nt_bgc_Nit_out, nt_bgc_Am_out, &   ! LCOV_EXCL_LINE
     751              :            nt_bgc_Sil_out, nt_bgc_DMSPp_out, nt_bgc_DMSPd_out, nt_bgc_DMS_out, nt_bgc_hum_out, &   ! LCOV_EXCL_LINE
     752    500659036 :            nt_bgc_PON_out, nlt_zaero_out, nlt_bgc_C_out, nlt_bgc_N_out, nlt_bgc_chl_out, &   ! LCOV_EXCL_LINE
     753    500659036 :            nlt_bgc_DOC_out, nlt_bgc_DON_out, nlt_bgc_DIC_out, nlt_bgc_Fed_out, &   ! LCOV_EXCL_LINE
     754    125164759 :            nlt_bgc_Fep_out, nlt_bgc_Nit_out, nlt_bgc_Am_out, nlt_bgc_Sil_out, &   ! LCOV_EXCL_LINE
     755              :            nlt_bgc_DMSPp_out, nlt_bgc_DMSPd_out, nlt_bgc_DMS_out, nlt_bgc_hum_out, &   ! LCOV_EXCL_LINE
     756              :            nlt_bgc_PON_out, nt_zbgc_frac_out, nt_bgc_S_out, nlt_chl_sw_out, &   ! LCOV_EXCL_LINE
     757    125164759 :            nlt_zaero_sw_out, &   ! LCOV_EXCL_LINE
     758    125164759 :            bio_index_o_out, bio_index_out)
     759              : 
     760              :         integer, intent(out), optional :: &
     761              :              nt_Tsfc_out, & ! ice/snow temperature   ! LCOV_EXCL_LINE
     762              :              nt_qice_out, & ! volume-weighted ice enthalpy (in layers)   ! LCOV_EXCL_LINE
     763              :              nt_qsno_out, & ! volume-weighted snow enthalpy (in layers)   ! LCOV_EXCL_LINE
     764              :              nt_sice_out, & ! volume-weighted ice bulk salinity (CICE grid layers)   ! LCOV_EXCL_LINE
     765              :              nt_fbri_out, & ! volume fraction of ice with dynamic salt (hinS/vicen*aicen)   ! LCOV_EXCL_LINE
     766              :              nt_iage_out, & ! volume-weighted ice age   ! LCOV_EXCL_LINE
     767              :              nt_FY_out, & ! area-weighted first-year ice area   ! LCOV_EXCL_LINE
     768              :              nt_alvl_out, & ! level ice area fraction   ! LCOV_EXCL_LINE
     769              :              nt_vlvl_out, & ! level ice volume fraction   ! LCOV_EXCL_LINE
     770              :              nt_apnd_out, & ! melt pond area fraction   ! LCOV_EXCL_LINE
     771              :              nt_hpnd_out, & ! melt pond depth   ! LCOV_EXCL_LINE
     772              :              nt_ipnd_out, & ! melt pond refrozen lid thickness   ! LCOV_EXCL_LINE
     773              :              nt_smice_out,& ! mass of ice in snow   ! LCOV_EXCL_LINE
     774              :              nt_smliq_out,& ! mass of liquid water in snow   ! LCOV_EXCL_LINE
     775              :              nt_rhos_out, & ! snow density   ! LCOV_EXCL_LINE
     776              :              nt_rsnw_out, & ! snow grain radius   ! LCOV_EXCL_LINE
     777              :              nt_fsd_out,  & ! floe size distribution   ! LCOV_EXCL_LINE
     778              :              nt_isosno_out,  & ! starting index for isotopes in snow   ! LCOV_EXCL_LINE
     779              :              nt_isoice_out,  & ! starting index for isotopes in ice   ! LCOV_EXCL_LINE
     780              :              nt_aero_out,    & ! starting index for aerosols in ice   ! LCOV_EXCL_LINE
     781              :              nt_bgc_Nit_out, & ! nutrients   ! LCOV_EXCL_LINE
     782              :              nt_bgc_Am_out,  & !   ! LCOV_EXCL_LINE
     783              :              nt_bgc_Sil_out, & !   ! LCOV_EXCL_LINE
     784              :              nt_bgc_DMSPp_out,&! trace gases (skeletal layer)   ! LCOV_EXCL_LINE
     785              :              nt_bgc_DMSPd_out,&!   ! LCOV_EXCL_LINE
     786              :              nt_bgc_DMS_out, & !   ! LCOV_EXCL_LINE
     787              :              nt_bgc_hum_out, & !   ! LCOV_EXCL_LINE
     788              :              nt_bgc_PON_out, & ! zooplankton and detritus   ! LCOV_EXCL_LINE
     789              :              nlt_bgc_Nit_out,& ! nutrients   ! LCOV_EXCL_LINE
     790              :              nlt_bgc_Am_out, & !   ! LCOV_EXCL_LINE
     791              :              nlt_bgc_Sil_out,& !   ! LCOV_EXCL_LINE
     792              :              nlt_bgc_DMSPp_out,&! trace gases (skeletal layer)   ! LCOV_EXCL_LINE
     793              :              nlt_bgc_DMSPd_out,&!   ! LCOV_EXCL_LINE
     794              :              nlt_bgc_DMS_out,& !   ! LCOV_EXCL_LINE
     795              :              nlt_bgc_hum_out,& !   ! LCOV_EXCL_LINE
     796              :              nlt_bgc_PON_out,& ! zooplankton and detritus   ! LCOV_EXCL_LINE
     797              :              nt_zbgc_frac_out,&! fraction of tracer in the mobile phase   ! LCOV_EXCL_LINE
     798              :              nt_bgc_S_out,   & ! (deprecated, was related to zsalinity)   ! LCOV_EXCL_LINE
     799              :              nlt_chl_sw_out    ! points to total chla in trcrn_sw
     800              : 
     801              :         integer (kind=int_kind), dimension(:), intent(out), optional :: &
     802              :              bio_index_o_out, &   ! LCOV_EXCL_LINE
     803              :              bio_index_out
     804              : 
     805              :         integer (kind=int_kind), dimension(:), intent(out), optional :: &
     806              :              nt_bgc_N_out ,  & ! diatoms, phaeocystis, pico/small   ! LCOV_EXCL_LINE
     807              :              nt_bgc_C_out ,  & ! diatoms, phaeocystis, pico/small   ! LCOV_EXCL_LINE
     808              :              nt_bgc_chl_out, & ! diatoms, phaeocystis, pico/small   ! LCOV_EXCL_LINE
     809              :              nlt_bgc_N_out , & ! diatoms, phaeocystis, pico/small   ! LCOV_EXCL_LINE
     810              :              nlt_bgc_C_out , & ! diatoms, phaeocystis, pico/small   ! LCOV_EXCL_LINE
     811              :              nlt_bgc_chl_out   ! diatoms, phaeocystis, pico/small
     812              : 
     813              :         integer (kind=int_kind), dimension(:), intent(out), optional :: &
     814              :              nt_bgc_DOC_out, & !  dissolved organic carbon   ! LCOV_EXCL_LINE
     815              :              nlt_bgc_DOC_out   !  dissolved organic carbon
     816              : 
     817              :         integer (kind=int_kind), dimension(:), intent(out), optional :: &
     818              :              nt_bgc_DON_out, & !  dissolved organic nitrogen   ! LCOV_EXCL_LINE
     819              :              nlt_bgc_DON_out   !  dissolved organic nitrogen
     820              : 
     821              :         integer (kind=int_kind), dimension(:), intent(out), optional :: &
     822              :              nt_bgc_DIC_out, & ! dissolved inorganic carbon   ! LCOV_EXCL_LINE
     823              :              nlt_bgc_DIC_out   !  dissolved inorganic carbon
     824              : 
     825              :         integer (kind=int_kind), dimension(:), intent(out), optional :: &
     826              :              nt_bgc_Fed_out, & !  dissolved iron   ! LCOV_EXCL_LINE
     827              :              nt_bgc_Fep_out, & !  particulate iron   ! LCOV_EXCL_LINE
     828              :              nlt_bgc_Fed_out,& !  dissolved iron   ! LCOV_EXCL_LINE
     829              :              nlt_bgc_Fep_out   !  particulate iron
     830              : 
     831              :         integer (kind=int_kind), dimension(:), intent(out), optional :: &
     832              :              nt_zaero_out,   & !  black carbon and other aerosols   ! LCOV_EXCL_LINE
     833              :              nlt_zaero_out,  & !  black carbon and other aerosols   ! LCOV_EXCL_LINE
     834              :              nlt_zaero_sw_out  ! black carbon and dust in trcrn_sw
     835              : 
     836              : !autodocument_end
     837              : 
     838              :         character(len=*),parameter :: subname='(icepack_query_tracer_indices)'
     839              : 
     840    125164759 :         if (present(nt_Tsfc_out)) nt_Tsfc_out = nt_Tsfc
     841    125164759 :         if (present(nt_qice_out)) nt_qice_out = nt_qice
     842    125164759 :         if (present(nt_qsno_out)) nt_qsno_out = nt_qsno
     843    125164759 :         if (present(nt_sice_out)) nt_sice_out = nt_sice
     844    125164759 :         if (present(nt_fbri_out)) nt_fbri_out = nt_fbri
     845    125164759 :         if (present(nt_iage_out)) nt_iage_out = nt_iage
     846    125164759 :         if (present(nt_FY_out)  ) nt_FY_out   = nt_FY
     847    125164759 :         if (present(nt_alvl_out)) nt_alvl_out = nt_alvl
     848    125164759 :         if (present(nt_vlvl_out)) nt_vlvl_out = nt_vlvl
     849    125164759 :         if (present(nt_apnd_out)) nt_apnd_out = nt_apnd
     850    125164759 :         if (present(nt_hpnd_out)) nt_hpnd_out = nt_hpnd
     851    125164759 :         if (present(nt_ipnd_out)) nt_ipnd_out = nt_ipnd
     852    125164759 :         if (present(nt_fsd_out) ) nt_fsd_out  = nt_fsd
     853    125164759 :         if (present(nt_smice_out)     ) nt_smice_out      = nt_smice
     854    125164759 :         if (present(nt_smliq_out)     ) nt_smliq_out      = nt_smliq
     855    125164759 :         if (present(nt_rhos_out)      ) nt_rhos_out       = nt_rhos
     856    125164759 :         if (present(nt_rsnw_out)      ) nt_rsnw_out       = nt_rsnw
     857    125164759 :         if (present(nt_isosno_out)    ) nt_isosno_out     = nt_isosno
     858    125164759 :         if (present(nt_isoice_out)    ) nt_isoice_out     = nt_isoice
     859    125164759 :         if (present(nt_aero_out)      ) nt_aero_out       = nt_aero
     860    125164759 :         if (present(nt_bgc_Nit_out)   ) nt_bgc_Nit_out    = nt_bgc_Nit
     861    125164759 :         if (present(nt_bgc_Am_out)    ) nt_bgc_Am_out     = nt_bgc_Am
     862    125164759 :         if (present(nt_bgc_Sil_out)   ) nt_bgc_Sil_out    = nt_bgc_Sil
     863    125164759 :         if (present(nt_bgc_DMSPp_out) ) nt_bgc_DMSPp_out  = nt_bgc_DMSPp
     864    125164759 :         if (present(nt_bgc_DMSPd_out) ) nt_bgc_DMSPd_out  = nt_bgc_DMSPd
     865    125164759 :         if (present(nt_bgc_DMS_out)   ) nt_bgc_DMS_out    = nt_bgc_DMS
     866    125164759 :         if (present(nt_bgc_hum_out)   ) nt_bgc_hum_out    = nt_bgc_hum
     867    125164759 :         if (present(nt_bgc_PON_out)   ) nt_bgc_PON_out    = nt_bgc_PON
     868    125164759 :         if (present(nlt_bgc_Nit_out)  ) nlt_bgc_Nit_out   = nlt_bgc_Nit
     869    125164759 :         if (present(nlt_bgc_Am_out)   ) nlt_bgc_Am_out    = nlt_bgc_Am
     870    125164759 :         if (present(nlt_bgc_Sil_out)  ) nlt_bgc_Sil_out   = nlt_bgc_Sil
     871    125164759 :         if (present(nlt_bgc_DMSPp_out)) nlt_bgc_DMSPp_out = nlt_bgc_DMSPp
     872    125164759 :         if (present(nlt_bgc_DMSPd_out)) nlt_bgc_DMSPd_out = nlt_bgc_DMSPd
     873    125164759 :         if (present(nlt_bgc_DMS_out)  ) nlt_bgc_DMS_out   = nlt_bgc_DMS
     874    125164759 :         if (present(nlt_bgc_hum_out)  ) nlt_bgc_hum_out   = nlt_bgc_hum
     875    125164759 :         if (present(nlt_bgc_PON_out)  ) nlt_bgc_PON_out   = nlt_bgc_PON
     876    125164759 :         if (present(nlt_chl_sw_out)   ) nlt_chl_sw_out    = nlt_chl_sw
     877    125164759 :         if (present(nt_zbgc_frac_out) ) nt_zbgc_frac_out  = nt_zbgc_frac
     878    125164759 :         if (present(nt_bgc_S_out)     ) nt_bgc_S_out      = nt_bgc_S
     879              : 
     880    417995623 :         if (present(bio_index_o_out) ) bio_index_o_out  = bio_index_o
     881    125164759 :         if (present(bio_index_out)   ) bio_index_out    = bio_index
     882    186003670 :         if (present(nt_bgc_N_out)    ) nt_bgc_N_out     = nt_bgc_N
     883    155696218 :         if (present(nlt_bgc_N_out)   ) nlt_bgc_N_out    = nlt_bgc_N
     884    155674465 :         if (present(nt_bgc_C_out)    ) nt_bgc_C_out     = nt_bgc_C
     885    155672527 :         if (present(nlt_bgc_C_out)   ) nlt_bgc_C_out    = nlt_bgc_C
     886    155687131 :         if (present(nt_bgc_chl_out)  ) nt_bgc_chl_out   = nt_bgc_chl
     887    155685193 :         if (present(nlt_bgc_chl_out) ) nlt_bgc_chl_out  = nlt_bgc_chl
     888    155698156 :         if (present(nt_bgc_DOC_out)  ) nt_bgc_DOC_out   = nt_bgc_DOC
     889    155696218 :         if (present(nlt_bgc_DOC_out) ) nlt_bgc_DOC_out  = nlt_bgc_DOC
     890    135342558 :         if (present(nt_bgc_DON_out)  ) nt_bgc_DON_out   = nt_bgc_DON
     891    135341912 :         if (present(nlt_bgc_DON_out) ) nlt_bgc_DON_out  = nlt_bgc_DON
     892    135338883 :         if (present(nt_bgc_DIC_out)  ) nt_bgc_DIC_out   = nt_bgc_DIC
     893    135338237 :         if (present(nlt_bgc_DIC_out) ) nlt_bgc_DIC_out  = nlt_bgc_DIC
     894    145520357 :         if (present(nt_bgc_Fed_out)  ) nt_bgc_Fed_out   = nt_bgc_Fed
     895    145519065 :         if (present(nlt_bgc_Fed_out) ) nlt_bgc_Fed_out  = nlt_bgc_Fed
     896    145520357 :         if (present(nt_bgc_Fep_out)  ) nt_bgc_Fep_out   = nt_bgc_Fep
     897    145519065 :         if (present(nlt_bgc_Fep_out) ) nlt_bgc_Fep_out  = nlt_bgc_Fep
     898    246842581 :         if (present(nt_zaero_out)    ) nt_zaero_out     = nt_zaero
     899    247143853 :         if (present(nlt_zaero_out)   ) nlt_zaero_out    = nlt_zaero
     900    246813373 :         if (present(nlt_zaero_sw_out)) nlt_zaero_sw_out = nlt_zaero_sw
     901              : 
     902    125164759 :       end subroutine icepack_query_tracer_indices
     903              : 
     904              : !=======================================================================
     905              : !autodocument_start icepack_write_tracer_indices
     906              : ! write the number of column tracer indices
     907              : 
     908          375 :       subroutine icepack_write_tracer_indices(iounit)
     909              : 
     910              :         integer, intent(in) :: iounit
     911              : 
     912              : !autodocument_end
     913              : 
     914              :         ! local
     915              :         integer (kind=int_kind) :: k
     916              :         character(len=*),parameter :: subname='(icepack_write_tracer_indices)'
     917              : 
     918          375 :         write(iounit,*) subname//":"
     919          375 :         write(iounit,*) "  nt_Tsfc = ",nt_Tsfc
     920          375 :         write(iounit,*) "  nt_qice = ",nt_qice
     921          375 :         write(iounit,*) "  nt_qsno = ",nt_qsno
     922          375 :         write(iounit,*) "  nt_sice = ",nt_sice
     923          375 :         write(iounit,*) "  nt_fbri = ",nt_fbri
     924          375 :         write(iounit,*) "  nt_iage = ",nt_iage
     925          375 :         write(iounit,*) "  nt_FY   = ",nt_FY
     926          375 :         write(iounit,*) "  nt_alvl = ",nt_alvl
     927          375 :         write(iounit,*) "  nt_vlvl = ",nt_vlvl
     928          375 :         write(iounit,*) "  nt_apnd = ",nt_apnd
     929          375 :         write(iounit,*) "  nt_hpnd = ",nt_hpnd
     930          375 :         write(iounit,*) "  nt_ipnd = ",nt_ipnd
     931          375 :         write(iounit,*) "  nt_fsd  = ",nt_fsd
     932          375 :         write(iounit,*) "  nt_smice      = ",nt_smice
     933          375 :         write(iounit,*) "  nt_smliq      = ",nt_smliq
     934          375 :         write(iounit,*) "  nt_rhos       = ",nt_rhos
     935          375 :         write(iounit,*) "  nt_rsnw       = ",nt_rsnw
     936          375 :         write(iounit,*) "  nt_isosno     = ",nt_isosno
     937          375 :         write(iounit,*) "  nt_isoice     = ",nt_isoice
     938          375 :         write(iounit,*) "  nt_aero       = ",nt_aero
     939          375 :         write(iounit,*) "  nt_bgc_Nit    = ",nt_bgc_Nit
     940          375 :         write(iounit,*) "  nt_bgc_Am     = ",nt_bgc_Am
     941          375 :         write(iounit,*) "  nt_bgc_Sil    = ",nt_bgc_Sil
     942          375 :         write(iounit,*) "  nt_bgc_DMSPp  = ",nt_bgc_DMSPp
     943          375 :         write(iounit,*) "  nt_bgc_DMSPd  = ",nt_bgc_DMSPd
     944          375 :         write(iounit,*) "  nt_bgc_DMS    = ",nt_bgc_DMS
     945          375 :         write(iounit,*) "  nt_bgc_hum    = ",nt_bgc_hum
     946          375 :         write(iounit,*) "  nt_bgc_PON    = ",nt_bgc_PON
     947          375 :         write(iounit,*) "  nlt_bgc_Nit   = ",nlt_bgc_Nit
     948          375 :         write(iounit,*) "  nlt_bgc_Am    = ",nlt_bgc_Am
     949          375 :         write(iounit,*) "  nlt_bgc_Sil   = ",nlt_bgc_Sil
     950          375 :         write(iounit,*) "  nlt_bgc_DMSPp = ",nlt_bgc_DMSPp
     951          375 :         write(iounit,*) "  nlt_bgc_DMSPd = ",nlt_bgc_DMSPd
     952          375 :         write(iounit,*) "  nlt_bgc_DMS   = ",nlt_bgc_DMS
     953          375 :         write(iounit,*) "  nlt_bgc_hum   = ",nlt_bgc_hum
     954          375 :         write(iounit,*) "  nlt_bgc_PON   = ",nlt_bgc_PON
     955          375 :         write(iounit,*) "  nlt_chl_sw    = ",nlt_chl_sw
     956          375 :         write(iounit,*) "  nt_zbgc_frac  = ",nt_zbgc_frac
     957          375 :         write(iounit,*) "  nt_bgc_S      = ",nt_bgc_S," (deprecated)"
     958              : 
     959          375 :         write(iounit,*) "  max_nbtrcr = ",max_nbtrcr
     960        11250 :         do k = 1, max_nbtrcr
     961        10875 :            write(iounit,*) "  bio_index_o(k) = ",k,bio_index_o(k)
     962        11250 :            write(iounit,*) "  bio_index(k)   = ",k,bio_index(k)
     963              :         enddo
     964              : 
     965          375 :         write(iounit,*) "  max_algae = ",max_algae
     966         1500 :         do k = 1, max_algae
     967         1125 :            write(iounit,*) "  nt_bgc_N(k)  = ",k,nt_bgc_N(k)
     968         1125 :            write(iounit,*) "  nlt_bgc_N(k) = ",k,nlt_bgc_N(k)
     969         1125 :            write(iounit,*) "  nt_bgc_C(k)  = ",k,nt_bgc_C(k)
     970         1125 :            write(iounit,*) "  nlt_bgc_C(k) = ",k,nlt_bgc_C(k)
     971         1125 :            write(iounit,*) "  nt_bgc_chl(k)  = ",k,nt_bgc_chl(k)
     972         1500 :            write(iounit,*) "  nlt_bgc_chl(k) = ",k,nlt_bgc_chl(k)
     973              :         enddo
     974              : 
     975          375 :         write(iounit,*) "  max_DOC = ",max_DOC
     976         1500 :         do k = 1, max_DOC
     977         1125 :            write(iounit,*) "  nt_bgc_DOC(k)  = ",k,nt_bgc_DOC(k)
     978         1500 :            write(iounit,*) "  nlt_bgc_DOC(k) = ",k,nlt_bgc_DOC(k)
     979              :         enddo
     980              : 
     981          375 :         write(iounit,*) "  max_DON = ",max_DON
     982          750 :         do k = 1, max_DON
     983          375 :            write(iounit,*) "  nt_bgc_DON(k)  = ",k,nt_bgc_DON(k)
     984          750 :            write(iounit,*) "  nlt_bgc_DON(k) = ",k,nlt_bgc_DON(k)
     985              :         enddo
     986              : 
     987          375 :         write(iounit,*) "  max_DIC = ",max_DIC
     988          750 :         do k = 1, max_DIC
     989          375 :            write(iounit,*) "  nt_bgc_DIC(k)  = ",k,nt_bgc_DIC(k)
     990          750 :            write(iounit,*) "  nlt_bgc_DIC(k) = ",k,nlt_bgc_DIC(k)
     991              :         enddo
     992              : 
     993          375 :         write(iounit,*) "  max_fe = ",max_fe
     994         1125 :         do k = 1, max_fe
     995          750 :            write(iounit,*) "  nt_bgc_Fed(k)  = ",k,nt_bgc_Fed(k)
     996          750 :            write(iounit,*) "  nlt_bgc_Fed(k) = ",k,nlt_bgc_Fed(k)
     997          750 :            write(iounit,*) "  nt_bgc_Fep(k)  = ",k,nt_bgc_Fep(k)
     998         1125 :            write(iounit,*) "  nlt_bgc_Fep(k) = ",k,nlt_bgc_Fep(k)
     999              :         enddo
    1000              : 
    1001          375 :         write(iounit,*) "  max_aero = ",max_aero
    1002         2625 :         do k = 1, max_aero
    1003         2250 :            write(iounit,*) "  nt_zaero(k)     = ",k,nt_zaero(k)
    1004         2250 :            write(iounit,*) "  nlt_zaero(k)    = ",k,nlt_zaero(k)
    1005         2625 :            write(iounit,*) "  nlt_zaero_sw(k) = ",k,nlt_zaero_sw(k)
    1006              :         enddo
    1007              : 
    1008          375 :       end subroutine icepack_write_tracer_indices
    1009              : 
    1010              : !=======================================================================
    1011              : !autodocument_start icepack_init_tracer_sizes
    1012              : ! set the number of column tracers
    1013              : 
    1014        12666 :       subroutine icepack_init_tracer_sizes(&
    1015              :          ncat_in, nilyr_in, nslyr_in, nblyr_in, nfsd_in  , &   ! LCOV_EXCL_LINE
    1016              :          n_algae_in, n_DOC_in, n_aero_in, n_iso_in, &   ! LCOV_EXCL_LINE
    1017              :          n_DON_in, n_DIC_in, n_fed_in, n_fep_in, n_zaero_in, &   ! LCOV_EXCL_LINE
    1018              :          ntrcr_in, ntrcr_o_in, nbtrcr_in, nbtrcr_sw_in)
    1019              : 
    1020              :       integer (kind=int_kind), intent(in), optional :: &
    1021              :          ncat_in   , & ! Categories   ! LCOV_EXCL_LINE
    1022              :          nfsd_in   , & !   ! LCOV_EXCL_LINE
    1023              :          nilyr_in  , & ! Layers   ! LCOV_EXCL_LINE
    1024              :          nslyr_in  , & !   ! LCOV_EXCL_LINE
    1025              :          nblyr_in  , & !   ! LCOV_EXCL_LINE
    1026              :          n_algae_in, & ! Dimensions   ! LCOV_EXCL_LINE
    1027              :          n_DOC_in  , & !   ! LCOV_EXCL_LINE
    1028              :          n_DON_in  , & !   ! LCOV_EXCL_LINE
    1029              :          n_DIC_in  , & !   ! LCOV_EXCL_LINE
    1030              :          n_fed_in  , & !   ! LCOV_EXCL_LINE
    1031              :          n_fep_in  , & !   ! LCOV_EXCL_LINE
    1032              :          n_zaero_in, & !   ! LCOV_EXCL_LINE
    1033              :          n_iso_in  , & !   ! LCOV_EXCL_LINE
    1034              :          n_aero_in , & !   ! LCOV_EXCL_LINE
    1035              :          ntrcr_in  , & ! number of tracers in use   ! LCOV_EXCL_LINE
    1036              :          ntrcr_o_in, & ! number of non-bio tracers in use   ! LCOV_EXCL_LINE
    1037              :          nbtrcr_in , & ! number of bio tracers in use   ! LCOV_EXCL_LINE
    1038              :          nbtrcr_sw_in  ! number of shortwave bio tracers in use
    1039              : 
    1040              : !autodocument_end
    1041              : 
    1042              :         character(len=*),parameter :: subname='(icepack_init_tracer_sizes)'
    1043              : 
    1044        12666 :         if (present(ncat_in)     ) ncat      = ncat_in
    1045        12666 :         if (present(nilyr_in)    ) nilyr     = nilyr_in
    1046        12666 :         if (present(nslyr_in)    ) nslyr     = nslyr_in
    1047        12666 :         if (present(nblyr_in)    ) nblyr     = nblyr_in
    1048        12666 :         if (present(nfsd_in)     ) nfsd      = nfsd_in
    1049              : 
    1050        12666 :         if (present(n_algae_in)  ) n_algae   = n_algae_in
    1051        12666 :         if (present(n_DOC_in)    ) n_DOC     = n_DOC_in
    1052        12666 :         if (present(n_DON_in)    ) n_DON     = n_DON_in
    1053        12666 :         if (present(n_DIC_in)    ) n_DIC     = n_DIC_in
    1054        12666 :         if (present(n_fed_in)    ) n_fed     = n_fed_in
    1055        12666 :         if (present(n_fep_in)    ) n_fep     = n_fep_in
    1056        12666 :         if (present(n_zaero_in)  ) n_zaero   = n_zaero_in
    1057        12666 :         if (present(n_iso_in)    ) n_iso     = n_iso_in
    1058        12666 :         if (present(n_aero_in)   ) n_aero    = n_aero_in
    1059              : 
    1060        12666 :         if (present(ntrcr_in)    ) ntrcr     = ntrcr_in
    1061        12666 :         if (present(ntrcr_o_in)  ) ntrcr_o   = ntrcr_o_in
    1062        12666 :         if (present(nbtrcr_in)   ) nbtrcr    = nbtrcr_in
    1063        12666 :         if (present(nbtrcr_sw_in)) nbtrcr_sw = nbtrcr_sw_in
    1064              : 
    1065        12666 :       end subroutine icepack_init_tracer_sizes
    1066              : 
    1067              : !=======================================================================
    1068              : !autodocument_start icepack_query_tracer_sizes
    1069              : ! query the number of column tracers
    1070              : 
    1071     64983045 :       subroutine icepack_query_tracer_sizes(&
    1072              :          max_algae_out  , max_dic_out    , max_doc_out      , &   ! LCOV_EXCL_LINE
    1073              :          max_don_out    , max_fe_out     , nmodal1_out      , &   ! LCOV_EXCL_LINE
    1074              :          nmodal2_out    , max_aero_out   , max_nbtrcr_out   , &   ! LCOV_EXCL_LINE
    1075              :          ncat_out, nilyr_out, nslyr_out, nblyr_out, nfsd_out, &   ! LCOV_EXCL_LINE
    1076              :          n_algae_out, n_DOC_out, n_aero_out, n_iso_out, &   ! LCOV_EXCL_LINE
    1077              :          n_DON_out, n_DIC_out, n_fed_out, n_fep_out, n_zaero_out, &   ! LCOV_EXCL_LINE
    1078              :          ntrcr_out, ntrcr_o_out, nbtrcr_out, nbtrcr_sw_out)
    1079              : 
    1080              :       integer (kind=int_kind), intent(out), optional :: &
    1081              :          max_algae_out  , & ! maximum number of algal types   ! LCOV_EXCL_LINE
    1082              :          max_dic_out    , & ! maximum number of dissolved inorganic carbon types   ! LCOV_EXCL_LINE
    1083              :          max_doc_out    , & ! maximum number of dissolved organic carbon types   ! LCOV_EXCL_LINE
    1084              :          max_don_out    , & ! maximum number of dissolved organic nitrogen types   ! LCOV_EXCL_LINE
    1085              :          max_fe_out     , & ! maximum number of iron types   ! LCOV_EXCL_LINE
    1086              :          nmodal1_out    , & ! dimension for modal aerosol radiation parameters   ! LCOV_EXCL_LINE
    1087              :          nmodal2_out    , & ! dimension for modal aerosol radiation parameters   ! LCOV_EXCL_LINE
    1088              :          max_aero_out   , & ! maximum number of aerosols   ! LCOV_EXCL_LINE
    1089              :          max_nbtrcr_out     ! algal nitrogen and chlorophyll
    1090              : 
    1091              :       integer (kind=int_kind), intent(out), optional :: &
    1092              :          ncat_out   , & ! Categories   ! LCOV_EXCL_LINE
    1093              :          nfsd_out   , & !   ! LCOV_EXCL_LINE
    1094              :          nilyr_out  , & ! Layers   ! LCOV_EXCL_LINE
    1095              :          nslyr_out  , & !   ! LCOV_EXCL_LINE
    1096              :          nblyr_out  , & !   ! LCOV_EXCL_LINE
    1097              :          n_algae_out, & ! Dimensions   ! LCOV_EXCL_LINE
    1098              :          n_DOC_out  , & !   ! LCOV_EXCL_LINE
    1099              :          n_DON_out  , & !   ! LCOV_EXCL_LINE
    1100              :          n_DIC_out  , & !   ! LCOV_EXCL_LINE
    1101              :          n_fed_out  , & !   ! LCOV_EXCL_LINE
    1102              :          n_fep_out  , & !   ! LCOV_EXCL_LINE
    1103              :          n_zaero_out, & !   ! LCOV_EXCL_LINE
    1104              :          n_iso_out  , & !   ! LCOV_EXCL_LINE
    1105              :          n_aero_out , & !   ! LCOV_EXCL_LINE
    1106              :          ntrcr_out  , & ! number of tracers in use   ! LCOV_EXCL_LINE
    1107              :          ntrcr_o_out, & ! number of non-bio tracers in use   ! LCOV_EXCL_LINE
    1108              :          nbtrcr_out , & ! number of bio tracers in use   ! LCOV_EXCL_LINE
    1109              :          nbtrcr_sw_out  ! number of shortwave bio tracers in use
    1110              : 
    1111              : !autodocument_end
    1112              : 
    1113              :         character(len=*),parameter :: subname='(icepack_query_tracer_sizes)'
    1114              : 
    1115     64983045 :         if (present(max_algae_out))  max_algae_out = max_algae
    1116     64983045 :         if (present(max_dic_out))    max_dic_out   = max_dic
    1117     64983045 :         if (present(max_doc_out))    max_doc_out   = max_doc
    1118     64983045 :         if (present(max_don_out))    max_don_out   = max_don
    1119     64983045 :         if (present(max_fe_out))     max_fe_out    = max_fe
    1120     64983045 :         if (present(nmodal1_out))    nmodal1_out   = nmodal1
    1121     64983045 :         if (present(nmodal2_out))    nmodal2_out   = nmodal2
    1122     64983045 :         if (present(max_aero_out))   max_aero_out  = max_aero
    1123     64983045 :         if (present(max_nbtrcr_out)) max_nbtrcr_out= max_nbtrcr
    1124              : 
    1125     64983045 :         if (present(ncat_out)     ) ncat_out      = ncat
    1126     64983045 :         if (present(nilyr_out)    ) nilyr_out     = nilyr
    1127     64983045 :         if (present(nslyr_out)    ) nslyr_out     = nslyr
    1128     64983045 :         if (present(nblyr_out)    ) nblyr_out     = nblyr
    1129     64983045 :         if (present(nfsd_out)     ) nfsd_out      = nfsd
    1130              : 
    1131     64983045 :         if (present(n_algae_out)  ) n_algae_out   = n_algae
    1132     64983045 :         if (present(n_DOC_out)    ) n_DOC_out     = n_DOC
    1133     64983045 :         if (present(n_DON_out)    ) n_DON_out     = n_DON
    1134     64983045 :         if (present(n_DIC_out)    ) n_DIC_out     = n_DIC
    1135     64983045 :         if (present(n_fed_out)    ) n_fed_out     = n_fed
    1136     64983045 :         if (present(n_fep_out)    ) n_fep_out     = n_fep
    1137     64983045 :         if (present(n_zaero_out)  ) n_zaero_out   = n_zaero
    1138     64983045 :         if (present(n_aero_out)   ) n_aero_out    = n_aero
    1139     64983045 :         if (present(n_iso_out)    ) n_iso_out     = n_iso
    1140              : 
    1141     64983045 :         if (present(ntrcr_out)    ) ntrcr_out     = ntrcr
    1142     64983045 :         if (present(ntrcr_o_out)  ) ntrcr_o_out   = ntrcr_o
    1143     64983045 :         if (present(nbtrcr_out)   ) nbtrcr_out    = nbtrcr
    1144     64983045 :         if (present(nbtrcr_sw_out)) nbtrcr_sw_out = nbtrcr_sw
    1145              : 
    1146     64983045 :       end subroutine icepack_query_tracer_sizes
    1147              : 
    1148              : !=======================================================================
    1149              : !autodocument_start icepack_write_tracer_sizes
    1150              : ! write the number of column tracers
    1151              : 
    1152          375 :       subroutine icepack_write_tracer_sizes(iounit)
    1153              : 
    1154              :       integer (kind=int_kind), intent(in) :: iounit
    1155              : 
    1156              : !autodocument_end
    1157              : 
    1158              :         character(len=*),parameter :: subname='(icepack_write_tracer_sizes)'
    1159              : 
    1160          375 :         write(iounit,*) subname//":"
    1161          375 :         write(iounit,*) "  fixed parameters: "
    1162          375 :         write(iounit,*) "  max_algae_out =", max_algae
    1163          375 :         write(iounit,*) "  max_dic_out   =", max_dic
    1164          375 :         write(iounit,*) "  max_doc_out   =", max_doc
    1165          375 :         write(iounit,*) "  max_don_out   =", max_don
    1166          375 :         write(iounit,*) "  max_fe_out    =", max_fe
    1167          375 :         write(iounit,*) "  nmodal1_out   =", nmodal1
    1168          375 :         write(iounit,*) "  nmodal2_out   =", nmodal2
    1169          375 :         write(iounit,*) "  max_iso_out   =", max_iso
    1170          375 :         write(iounit,*) "  max_aero_out  =", max_aero
    1171          375 :         write(iounit,*) "  max_nbtrcr_out=", max_nbtrcr
    1172              : 
    1173          375 :         write(iounit,*) "  model defined parameters: "
    1174          375 :         write(iounit,*) "  ncat      = ",ncat
    1175          375 :         write(iounit,*) "  nilyr     = ",nilyr
    1176          375 :         write(iounit,*) "  nslyr     = ",nslyr
    1177          375 :         write(iounit,*) "  nblyr     = ",nblyr
    1178          375 :         write(iounit,*) "  nfsd      = ",nfsd
    1179          375 :         write(iounit,*) "  n_algae   = ",n_algae
    1180          375 :         write(iounit,*) "  n_DOC     = ",n_DOC
    1181          375 :         write(iounit,*) "  n_DON     = ",n_DON
    1182          375 :         write(iounit,*) "  n_DIC     = ",n_DIC
    1183          375 :         write(iounit,*) "  n_fed     = ",n_fed
    1184          375 :         write(iounit,*) "  n_fep     = ",n_fep
    1185          375 :         write(iounit,*) "  n_zaero   = ",n_zaero
    1186          375 :         write(iounit,*) "  n_aero    = ",n_aero
    1187          375 :         write(iounit,*) "  n_iso     = ",n_iso
    1188          375 :         write(iounit,*) "  ntrcr     = ",ntrcr
    1189          375 :         write(iounit,*) "  ntrcr_o   = ",ntrcr_o
    1190          375 :         write(iounit,*) "  nbtrcr    = ",nbtrcr
    1191          375 :         write(iounit,*) "  nbtrcr_sw = ",nbtrcr_sw
    1192              : 
    1193          375 :       end subroutine icepack_write_tracer_sizes
    1194              : 
    1195              : !=======================================================================
    1196              : !autodocument_start icepack_compute_tracers
    1197              : ! Compute tracer fields.
    1198              : ! Given atrcrn = aicen*trcrn (or vicen*trcrn, vsnon*trcrn), compute trcrn.
    1199              : 
    1200            0 :       subroutine icepack_compute_tracers (trcr_depend,               &
    1201            0 :                                           atrcrn,    aicen,          &   ! LCOV_EXCL_LINE
    1202              :                                           vicen,     vsnon,          &   ! LCOV_EXCL_LINE
    1203  29459452580 :                                           trcr_base, n_trcr_strata,  &   ! LCOV_EXCL_LINE
    1204  29459452580 :                                           nt_strata, trcrn, Tf)
    1205              : 
    1206              :       integer (kind=int_kind), dimension (:), intent(in) :: &
    1207              :          trcr_depend, & ! = 0 for aicen tracers, 1 for vicen, 2 for vsnon   ! LCOV_EXCL_LINE
    1208              :          n_trcr_strata  ! number of underlying tracer layers
    1209              : 
    1210              :       real (kind=dbl_kind), dimension (:,:), intent(in) :: &
    1211              :          trcr_base      ! = 0 or 1 depending on tracer dependency
    1212              :                         ! argument 2:  (1) aice, (2) vice, (3) vsno
    1213              : 
    1214              :       integer (kind=int_kind), dimension (:,:), intent(in) :: &
    1215              :          nt_strata      ! indices of underlying tracer layers
    1216              : 
    1217              :       real (kind=dbl_kind), dimension (:), intent(in) :: &
    1218              :          atrcrn    ! aicen*trcrn or vicen*trcrn or vsnon*trcrn
    1219              : 
    1220              :       real (kind=dbl_kind), intent(in) :: &
    1221              :          aicen , & ! concentration of ice   ! LCOV_EXCL_LINE
    1222              :          vicen , & ! volume per unit area of ice          (m)   ! LCOV_EXCL_LINE
    1223              :          vsnon     ! volume per unit area of snow         (m)
    1224              : 
    1225              :       real (kind=dbl_kind), dimension (:), intent(out) :: &
    1226              :          trcrn     ! ice tracers
    1227              : 
    1228              :       real (kind=dbl_kind), intent(in) :: &
    1229              :          Tf        ! Freezing point
    1230              : 
    1231              : !autodocument_end
    1232              : 
    1233              :       ! local variables
    1234              : 
    1235              :       integer (kind=int_kind) :: &
    1236              :          it,     & ! tracer index   ! LCOV_EXCL_LINE
    1237              :          itl,    & ! tracer index   ! LCOV_EXCL_LINE
    1238              :          ntr,    & ! tracer index   ! LCOV_EXCL_LINE
    1239              :          k         ! loop index
    1240              : 
    1241              :       real (kind=dbl_kind), dimension(3) :: &
    1242              :          divisor   ! base quantity on which tracers are carried
    1243              : 
    1244              :       real (kind=dbl_kind) :: &
    1245              :          work      ! temporary scalar
    1246              : 
    1247              :       character(len=*),parameter :: subname='(icepack_compute_tracers)'
    1248              : 
    1249              :       !-----------------------------------------------------------------
    1250              :       ! Compute new tracers
    1251              :       !-----------------------------------------------------------------
    1252              : 
    1253  >49377*10^7 :       do it = 1, ntrcr
    1254  >47904*10^7 :          divisor(1) = trcr_base(it,1)*aicen
    1255  >47904*10^7 :          divisor(2) = trcr_base(it,2)*vicen
    1256  >47904*10^7 :          divisor(3) = trcr_base(it,3)*vsnon
    1257              : 
    1258  >49377*10^7 :          if (trcr_depend(it) == 0) then ! ice area tracers
    1259  59865103937 :             if (aicen > puny) then
    1260  16291591487 :                trcrn(it) = atrcrn(it) / aicen
    1261              :             else
    1262  43573512450 :                trcrn(it) = c0
    1263  43573512450 :                if (it == nt_Tsfc) then
    1264  10666547314 :                   trcrn(it) = Tf  ! surface temperature
    1265              :                endif
    1266              :             endif
    1267              : 
    1268              :          else
    1269              : 
    1270  >41917*10^7 :             work = c0
    1271  >16767*10^8 :             do k = 1, 3
    1272  >16767*10^8 :                if (divisor(k) > c0) then
    1273  95579033823 :                   work = atrcrn(it) / divisor(k)
    1274              :                endif
    1275              :             enddo
    1276  >41917*10^7 :             trcrn(it) = work                ! save it
    1277  >41917*10^7 :             if (n_trcr_strata(it) > 0) then          ! additional tracer layers
    1278  >11129*10^7 :                do itl = 1, n_trcr_strata(it)
    1279  69458567769 :                   ntr = nt_strata(it,itl)
    1280  >11129*10^7 :                   if (trcrn(ntr) > c0) then
    1281  14850820864 :                       trcrn(it) = trcrn(it) / trcrn(ntr)
    1282              :                   else
    1283  54607746905 :                       trcrn(it) = c0
    1284              :                   endif
    1285              :                enddo
    1286              :             endif
    1287              : 
    1288              :          endif ! trcr_depend=0
    1289              : 
    1290              :       enddo
    1291              : 
    1292  14729726290 :       if (vicen <= c0 .and. tr_brine) trcrn(nt_fbri) = c1
    1293  14729726290 :       if (vsnon <= c0) then
    1294  11147195945 :          if (snwredist(1:3) == 'ITD') then
    1295    344401476 :             trcrn(nt_rhos :nt_rhos +nslyr-1) = rhosnew
    1296              :          endif
    1297  11147195945 :          if (snwgrain) then
    1298   2993304438 :             trcrn(nt_rsnw :nt_rsnw +nslyr-1) = rsnw_fall
    1299   2993304438 :             trcrn(nt_smice:nt_smice+nslyr-1) = rhos
    1300              :          endif
    1301              :       endif ! vsnon <= 0
    1302              : 
    1303  14729726290 :       end subroutine icepack_compute_tracers
    1304              : 
    1305              : !=======================================================================
    1306              : 
    1307              :       end module icepack_tracers
    1308              : 
    1309              : !=======================================================================
        

Generated by: LCOV version 2.0-1