LCOV - code coverage report
Current view: top level - cicecore/drivers/standalone/cice - CICE_InitMod.F90 (source / functions) Hit Total Coverage
Test: 231018-211459:8916b9ff2c:1:quick Lines: 140 199 70.35 %
Date: 2023-10-18 15:30:36 Functions: 3 3 100.00 %

          Line data    Source code
       1             : !=======================================================================
       2             : !
       3             : !  This module contains the CICE initialization routine that sets model
       4             : !  parameters and initializes the grid and CICE state variables.
       5             : !
       6             : !  authors Elizabeth C. Hunke, LANL
       7             : !          William H. Lipscomb, LANL
       8             : !          Philip W. Jones, LANL
       9             : !
      10             : ! 2006: Converted to free form source (F90) by Elizabeth Hunke
      11             : ! 2008: E. Hunke moved ESMF code to its own driver
      12             : 
      13             :       module CICE_InitMod
      14             : 
      15             :       use ice_kinds_mod
      16             :       use ice_exit, only: abort_ice
      17             :       use ice_fileunits, only: init_fileunits, nu_diag
      18             :       use ice_memusage, only: ice_memusage_init, ice_memusage_print
      19             :       use icepack_intfc, only: icepack_aggregate
      20             :       use icepack_intfc, only: icepack_init_itd, icepack_init_itd_hist
      21             :       use icepack_intfc, only: icepack_init_fsd_bounds, icepack_init_wave
      22             :       use icepack_intfc, only: icepack_init_snow, icepack_init_radiation
      23             :       use icepack_intfc, only: icepack_configure
      24             :       use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted
      25             :       use icepack_intfc, only: icepack_query_parameters, icepack_query_tracer_flags, &
      26             :           icepack_query_tracer_indices, icepack_query_tracer_sizes
      27             : 
      28             :       implicit none
      29             :       private
      30             :       public :: CICE_Initialize, cice_init
      31             : 
      32             : !=======================================================================
      33             : 
      34             :       contains
      35             : 
      36             : !=======================================================================
      37             : 
      38             : !  Initialize the basic state, grid and all necessary parameters for
      39             : !  running the CICE model.  Return the initial state in routine
      40             : !  export state.
      41             : !  Note: This initialization driver is designed for standalone and
      42             : !        CESM-coupled applications.  For other
      43             : !        applications (e.g., standalone CAM), this driver would be
      44             : !        replaced by a different driver that calls subroutine cice_init,
      45             : !        where most of the work is done.
      46             : 
      47          37 :       subroutine CICE_Initialize
      48             : 
      49             :       character(len=*), parameter :: subname='(CICE_Initialize)'
      50             :    !--------------------------------------------------------------------
      51             :    ! model initialization
      52             :    !--------------------------------------------------------------------
      53             : 
      54          37 :       call cice_init
      55             : 
      56          37 :       end subroutine CICE_Initialize
      57             : 
      58             : !=======================================================================
      59             : !
      60             : !  Initialize CICE model.
      61             : 
      62          37 :       subroutine cice_init
      63             : 
      64             :       use ice_arrays_column, only: hin_max, c_hi_range, alloc_arrays_column
      65             :       use ice_arrays_column, only: floe_rad_l, floe_rad_c, &
      66             :           floe_binwidth, c_fsd_range
      67             :       use ice_state, only: alloc_state
      68             :       use ice_flux_bgc, only: alloc_flux_bgc
      69             :       use ice_calendar, only: dt, dt_dyn, write_ic, &
      70             :           init_calendar, advance_timestep, calc_timesteps
      71             :       use ice_communicate, only: init_communicate, my_task, master_task
      72             :       use ice_diagnostics, only: init_diags
      73             :       use ice_domain, only: init_domain_blocks
      74             :       use ice_domain_size, only: ncat, nfsd
      75             :       use ice_dyn_eap, only: init_eap
      76             :       use ice_dyn_evp, only: init_evp
      77             :       use ice_dyn_vp, only: init_vp
      78             :       use ice_dyn_shared, only: kdyn
      79             :       use ice_flux, only: init_coupler_flux, init_history_therm, &
      80             :           init_history_dyn, init_flux_atm, init_flux_ocn, alloc_flux
      81             :       use ice_forcing, only: init_forcing_ocn, init_forcing_atmo, &
      82             :           get_forcing_atmo, get_forcing_ocn, get_wave_spec, init_snowtable
      83             :       use ice_forcing_bgc, only: get_forcing_bgc, get_atm_bgc, &
      84             :           faero_default, alloc_forcing_bgc, fiso_default
      85             :       use ice_grid, only: init_grid1, init_grid2, alloc_grid
      86             :       use ice_history, only: init_hist, accum_hist
      87             :       use ice_restart_shared, only: restart, runtype
      88             :       use ice_init, only: input_data, init_state
      89             :       use ice_init_column, only: init_thermo_vertical, init_shortwave, init_zbgc, input_zbgc, count_tracers
      90             :       use ice_kinds_mod
      91             :       use ice_restoring, only: ice_HaloRestore_init
      92             :       use ice_timers, only: timer_total, init_ice_timers, ice_timer_start
      93             :       use ice_transport_driver, only: init_transport
      94             : 
      95             :       logical(kind=log_kind) :: tr_aero, tr_zaero, skl_bgc, z_tracers, &
      96             :          tr_iso, tr_fsd, wave_spec, tr_snow
      97             :       character(len=char_len) :: snw_aging_table
      98             :       character(len=*), parameter :: subname = '(cice_init)'
      99             : 
     100          37 :       call init_communicate     ! initial setup for message passing
     101          37 :       call init_fileunits       ! unit numbers
     102             : 
     103             :       ! tcx debug, this will create a different logfile for each pe
     104             :       ! if (my_task /= master_task) nu_diag = 100+my_task
     105             : 
     106          37 :       call icepack_configure()  ! initialize icepack
     107          37 :       call icepack_warnings_flush(nu_diag)
     108          37 :       if (icepack_warnings_aborted()) call abort_ice(trim(subname), &
     109           0 :           file=__FILE__,line= __LINE__)
     110             : 
     111          37 :       call input_data           ! namelist variables
     112          37 :       call input_zbgc           ! vertical biogeochemistry namelist
     113          37 :       call count_tracers        ! count tracers
     114             : 
     115             :       ! Call this as early as possible, must be after memory_stats is read
     116          37 :       if (my_task == master_task) then
     117           7 :          call ice_memusage_init(nu_diag)
     118           7 :          call ice_memusage_print(nu_diag,subname//':start')
     119             :       endif
     120             : 
     121          37 :       call init_domain_blocks   ! set up block decomposition
     122          37 :       call init_grid1           ! domain distribution
     123          37 :       call alloc_grid           ! allocate grid arrays
     124          37 :       call alloc_arrays_column  ! allocate column arrays
     125          37 :       call alloc_state          ! allocate state arrays
     126          37 :       call alloc_flux_bgc       ! allocate flux_bgc arrays
     127          37 :       call alloc_flux           ! allocate flux arrays
     128          37 :       call init_ice_timers      ! initialize all timers
     129          37 :       call ice_timer_start(timer_total)   ! start timing entire run
     130          37 :       call init_grid2           ! grid variables
     131          37 :       call init_zbgc            ! vertical biogeochemistry initialization
     132          37 :       call init_calendar        ! initialize some calendar stuff
     133          37 :       call init_hist (dt)       ! initialize output history file
     134             : 
     135          37 :       if (kdyn == 1) then
     136          37 :          call init_evp
     137           0 :       else if (kdyn == 2) then
     138           0 :          call init_eap          ! define eap dynamics parameters, variables
     139           0 :       else if (kdyn == 3) then
     140           0 :          call init_vp           ! define vp dynamics parameters, variables
     141             :       endif
     142             : 
     143          37 :       call init_coupler_flux    ! initialize fluxes exchanged with coupler
     144             : 
     145          37 :       call init_thermo_vertical ! initialize vertical thermodynamics
     146             : 
     147          37 :       call icepack_init_itd(ncat=ncat, hin_max=hin_max)  ! ice thickness distribution
     148          37 :       if (my_task == master_task) then
     149           7 :          call icepack_init_itd_hist(ncat=ncat, hin_max=hin_max, c_hi_range=c_hi_range) ! output
     150             :       endif
     151             : 
     152          37 :       call icepack_query_tracer_flags(tr_fsd_out=tr_fsd)
     153          37 :       call icepack_warnings_flush(nu_diag)
     154          37 :       if (icepack_warnings_aborted()) call abort_ice(trim(subname), &
     155           0 :           file=__FILE__,line= __LINE__)
     156             : 
     157          37 :       if (tr_fsd) call icepack_init_fsd_bounds (nfsd, & ! floe size distribution
     158             :          floe_rad_l,    &  ! fsd size lower bound in m (radius)   ! LCOV_EXCL_LINE
     159             :          floe_rad_c,    &  ! fsd size bin centre in m (radius)   ! LCOV_EXCL_LINE
     160             :          floe_binwidth, &  ! fsd size bin width in m (radius)   ! LCOV_EXCL_LINE
     161             :          c_fsd_range,   &  ! string for history output   ! LCOV_EXCL_LINE
     162           0 :          write_diags=(my_task == master_task))  ! write diag on master only
     163             : 
     164          37 :       call icepack_warnings_flush(nu_diag)
     165          37 :       if (icepack_warnings_aborted()) call abort_ice(error_message=subname, &
     166           0 :          file=__FILE__, line=__LINE__)
     167             : 
     168          37 :       call init_forcing_ocn(dt) ! initialize sss and sst from data
     169          37 :       call init_state           ! initialize the ice state
     170          37 :       call init_transport       ! initialize horizontal transport
     171          37 :       call ice_HaloRestore_init ! restored boundary conditions
     172             : 
     173             :       call icepack_query_parameters(skl_bgc_out=skl_bgc, z_tracers_out=z_tracers, &
     174          37 :           wave_spec_out=wave_spec, snw_aging_table_out=snw_aging_table)
     175          37 :       call icepack_warnings_flush(nu_diag)
     176          37 :       if (icepack_warnings_aborted()) call abort_ice(trim(subname), &
     177           0 :           file=__FILE__,line= __LINE__)
     178             : 
     179          37 :       if (skl_bgc .or. z_tracers) call alloc_forcing_bgc ! allocate biogeochemistry arrays
     180             : 
     181          37 :       call init_restart         ! initialize restart variables
     182          37 :       call init_diags           ! initialize diagnostic output points
     183          37 :       call init_history_therm   ! initialize thermo history variables
     184          37 :       call init_history_dyn     ! initialize dynamic history variables
     185          37 :       call calc_timesteps       ! update timestep counter if not using npt_unit="1"
     186          37 :       call icepack_init_radiation ! initialize icepack shortwave tables
     187             : 
     188          37 :       call icepack_query_tracer_flags(tr_aero_out=tr_aero, tr_zaero_out=tr_zaero)
     189          37 :       call icepack_query_tracer_flags(tr_iso_out=tr_iso, tr_snow_out=tr_snow)
     190          37 :       call icepack_warnings_flush(nu_diag)
     191          37 :       if (icepack_warnings_aborted()) call abort_ice(trim(subname), &
     192           0 :           file=__FILE__,line= __LINE__)
     193             : 
     194             :       ! Initialize shortwave components using swdn from previous timestep
     195             :       ! if restarting. These components will be scaled to current forcing
     196             :       ! in prep_radiation.
     197          37 :       if (trim(runtype) == 'continue' .or. restart) &
     198          29 :          call init_shortwave    ! initialize radiative transfer
     199             : 
     200          37 :       if (write_ic) call accum_hist(dt) ! write initial conditions
     201             : 
     202             : ! tcraig, use advance_timestep here
     203             : !      istep  = istep  + 1    ! update time step counters
     204             : !      istep1 = istep1 + 1
     205             : !      time = time + dt       ! determine the time and date
     206             : !      call calendar(time)    ! at the end of the first timestep
     207          37 :       call advance_timestep()
     208             : 
     209             :    !--------------------------------------------------------------------
     210             :    ! coupler communication or forcing data initialization
     211             :    !--------------------------------------------------------------------
     212             : 
     213          37 :       call init_forcing_atmo    ! initialize atmospheric forcing (standalone)
     214             : 
     215          37 :       if (tr_fsd .and. wave_spec) call get_wave_spec ! wave spectrum in ice
     216          37 :       call get_forcing_atmo     ! atmospheric forcing from data
     217          37 :       call get_forcing_ocn(dt)  ! ocean forcing from data
     218             : 
     219             :       ! snow aging lookup table initialization
     220          37 :       if (tr_snow) then         ! advanced snow physics
     221           0 :          call icepack_init_snow()
     222           0 :          call icepack_warnings_flush(nu_diag)
     223           0 :          if (icepack_warnings_aborted()) call abort_ice(error_message=subname, &
     224           0 :             file=__FILE__, line=__LINE__)
     225           0 :          if (snw_aging_table(1:4) /= 'test') then
     226           0 :             call init_snowtable()
     227             :          endif
     228             :       endif
     229             : 
     230             :       ! isotopes
     231          37 :       if (tr_iso)     call fiso_default                 ! default values
     232             : 
     233             :       ! aerosols
     234             :       ! if (tr_aero)  call faero_data                   ! data file
     235             :       ! if (tr_zaero) call fzaero_data                  ! data file (gx1)
     236          37 :       if (tr_aero .or. tr_zaero)  call faero_default    ! default values
     237          37 :       if (skl_bgc .or. z_tracers) call get_forcing_bgc  ! biogeochemistry
     238          37 :       if (z_tracers) call get_atm_bgc                   ! biogeochemistry
     239             : 
     240          37 :       if (runtype == 'initial' .and. .not. restart) &
     241           8 :          call init_shortwave    ! initialize radiative transfer using current swdn
     242             : 
     243          37 :       call init_flux_atm        ! initialize atmosphere fluxes sent to coupler
     244          37 :       call init_flux_ocn        ! initialize ocean fluxes sent to coupler
     245             : 
     246          37 :       if (my_task == master_task) then
     247           7 :          call ice_memusage_print(nu_diag,subname//':end')
     248             :       endif
     249             : 
     250         111 :       end subroutine cice_init
     251             : 
     252             : !=======================================================================
     253             : 
     254          37 :       subroutine init_restart
     255             : 
     256             :       use ice_arrays_column, only: dhsn
     257             :       use ice_blocks, only: nx_block, ny_block
     258             :       use ice_calendar, only: calendar
     259             :       use ice_constants, only: c0
     260             :       use ice_domain, only: nblocks
     261             :       use ice_domain_size, only: ncat, n_iso, n_aero, nfsd, nslyr
     262             :       use ice_dyn_eap, only: read_restart_eap
     263             :       use ice_dyn_shared, only: kdyn
     264             :       use ice_grid, only: tmask
     265             :       use ice_init, only: ice_ic
     266             :       use ice_init_column, only: init_age, init_FY, init_lvl, init_snowtracers, &
     267             :           init_meltponds_lvl, init_meltponds_topo, &   ! LCOV_EXCL_LINE
     268             :           init_isotope, init_aerosol, init_hbrine, init_bgc, init_fsd
     269             :       use ice_restart_column, only: restart_age, read_restart_age, &
     270             :           restart_FY, read_restart_FY, restart_lvl, read_restart_lvl, &   ! LCOV_EXCL_LINE
     271             :           restart_pond_lvl, read_restart_pond_lvl, &   ! LCOV_EXCL_LINE
     272             :           restart_pond_topo, read_restart_pond_topo, &   ! LCOV_EXCL_LINE
     273             :           restart_snow, read_restart_snow, &   ! LCOV_EXCL_LINE
     274             :           restart_fsd, read_restart_fsd, &   ! LCOV_EXCL_LINE
     275             :           restart_iso, read_restart_iso, &   ! LCOV_EXCL_LINE
     276             :           restart_aero, read_restart_aero, &   ! LCOV_EXCL_LINE
     277             :           restart_hbrine, read_restart_hbrine, &   ! LCOV_EXCL_LINE
     278             :           restart_bgc
     279             :       use ice_flux, only: Tf
     280             :       use ice_restart_driver, only: restartfile
     281             :       use ice_restart_shared, only: runtype, restart
     282             :       use ice_state ! almost everything
     283             : 
     284             :       integer(kind=int_kind) :: &
     285             :          i, j        , & ! horizontal indices   ! LCOV_EXCL_LINE
     286             :          iblk            ! block index
     287             :       logical(kind=log_kind) :: &
     288             :           tr_iage, tr_FY, tr_lvl, tr_pond_lvl, &   ! LCOV_EXCL_LINE
     289             :           tr_pond_topo, tr_snow, tr_fsd, tr_iso, tr_aero, tr_brine, &   ! LCOV_EXCL_LINE
     290             :           skl_bgc, z_tracers
     291             :       integer(kind=int_kind) :: &
     292             :           ntrcr
     293             :       integer(kind=int_kind) :: &
     294             :           nt_alvl, nt_vlvl, nt_apnd, nt_hpnd, nt_ipnd, &   ! LCOV_EXCL_LINE
     295             :           nt_smice, nt_smliq, nt_rhos, nt_rsnw, &   ! LCOV_EXCL_LINE
     296             :           nt_iage, nt_FY, nt_aero, nt_fsd, nt_isosno, nt_isoice
     297             : 
     298             :       character(len=*), parameter :: subname = '(init_restart)'
     299             : 
     300          37 :       call icepack_query_tracer_sizes(ntrcr_out=ntrcr)
     301          37 :       call icepack_warnings_flush(nu_diag)
     302          37 :       if (icepack_warnings_aborted()) call abort_ice(error_message=subname, &
     303           0 :           file=__FILE__, line=__LINE__)
     304             : 
     305             :       call icepack_query_parameters(skl_bgc_out=skl_bgc, &
     306          37 :            z_tracers_out=z_tracers)
     307             :       call icepack_query_tracer_flags(tr_iage_out=tr_iage, tr_FY_out=tr_FY, &
     308             :            tr_lvl_out=tr_lvl, tr_pond_lvl_out=tr_pond_lvl, &   ! LCOV_EXCL_LINE
     309             :            tr_pond_topo_out=tr_pond_topo, tr_aero_out=tr_aero, tr_brine_out=tr_brine, &   ! LCOV_EXCL_LINE
     310          37 :            tr_snow_out=tr_snow, tr_fsd_out=tr_fsd, tr_iso_out=tr_iso)
     311             :       call icepack_query_tracer_indices(nt_alvl_out=nt_alvl, nt_vlvl_out=nt_vlvl, &
     312             :            nt_apnd_out=nt_apnd, nt_hpnd_out=nt_hpnd, nt_ipnd_out=nt_ipnd, &   ! LCOV_EXCL_LINE
     313             :            nt_iage_out=nt_iage, nt_FY_out=nt_FY, nt_aero_out=nt_aero, nt_fsd_out=nt_fsd, &   ! LCOV_EXCL_LINE
     314             :            nt_smice_out=nt_smice, nt_smliq_out=nt_smliq, &   ! LCOV_EXCL_LINE
     315             :            nt_rhos_out=nt_rhos, nt_rsnw_out=nt_rsnw, &   ! LCOV_EXCL_LINE
     316          37 :            nt_isosno_out=nt_isosno, nt_isoice_out=nt_isoice)
     317          37 :       call icepack_warnings_flush(nu_diag)
     318          37 :       if (icepack_warnings_aborted()) call abort_ice(error_message=subname, &
     319           0 :          file=__FILE__, line=__LINE__)
     320             : 
     321          37 :       if (trim(runtype) == 'continue') then
     322             :          ! start from core restart file
     323          12 :          call restartfile()           ! given by pointer in ice_in
     324          12 :          call calendar()              ! update time parameters
     325          12 :          if (kdyn == 2) call read_restart_eap ! EAP
     326          25 :       else if (restart) then          ! ice_ic = core restart file
     327          17 :          call restartfile (ice_ic)    !  or 'default' or 'none'
     328             :          !!! uncomment to create netcdf
     329             :          ! call restartfile_v4 (ice_ic)  ! CICE v4.1 binary restart file
     330             :          !!! uncomment if EAP restart data exists
     331             :          ! if (kdyn == 2) call read_restart_eap
     332             :       endif
     333             : 
     334             :       ! tracers
     335             :       ! ice age tracer
     336          37 :       if (tr_iage) then
     337          37 :          if (trim(runtype) == 'continue') &
     338          12 :               restart_age = .true.
     339          37 :          if (restart_age) then
     340          12 :             call read_restart_age
     341             :          else
     342         153 :             do iblk = 1, nblocks
     343         153 :                call init_age(trcrn(:,:,nt_iage,:,iblk))
     344             :             enddo ! iblk
     345             :          endif
     346             :       endif
     347             :       ! first-year area tracer
     348          37 :       if (tr_FY) then
     349          37 :          if (trim(runtype) == 'continue') restart_FY = .true.
     350          37 :          if (restart_FY) then
     351          12 :             call read_restart_FY
     352             :          else
     353         153 :             do iblk = 1, nblocks
     354         153 :                call init_FY(trcrn(:,:,nt_FY,:,iblk))
     355             :             enddo ! iblk
     356             :          endif
     357             :       endif
     358             :       ! level ice tracer
     359          37 :       if (tr_lvl) then
     360          37 :          if (trim(runtype) == 'continue') restart_lvl = .true.
     361          37 :          if (restart_lvl) then
     362          12 :             call read_restart_lvl
     363             :          else
     364         153 :             do iblk = 1, nblocks
     365           0 :                call init_lvl(iblk,trcrn(:,:,nt_alvl,:,iblk), &
     366         153 :                              trcrn(:,:,nt_vlvl,:,iblk))
     367             :             enddo ! iblk
     368             :          endif
     369             :       endif
     370             :       ! level-ice melt ponds
     371          37 :       if (tr_pond_lvl) then
     372          37 :          if (trim(runtype) == 'continue') &
     373          12 :               restart_pond_lvl = .true.
     374          37 :          if (restart_pond_lvl) then
     375          12 :             call read_restart_pond_lvl
     376             :          else
     377         153 :             do iblk = 1, nblocks
     378           0 :                call init_meltponds_lvl(trcrn(:,:,nt_apnd,:,iblk), &
     379             :                                        trcrn(:,:,nt_hpnd,:,iblk), &   ! LCOV_EXCL_LINE
     380             :                                        trcrn(:,:,nt_ipnd,:,iblk), &   ! LCOV_EXCL_LINE
     381         153 :                                        dhsn(:,:,:,iblk))
     382             :             enddo ! iblk
     383             :          endif
     384             :       endif
     385             :       ! topographic melt ponds
     386          37 :       if (tr_pond_topo) then
     387           0 :          if (trim(runtype) == 'continue') &
     388           0 :               restart_pond_topo = .true.
     389           0 :          if (restart_pond_topo) then
     390           0 :             call read_restart_pond_topo
     391             :          else
     392           0 :             do iblk = 1, nblocks
     393           0 :                call init_meltponds_topo(trcrn(:,:,nt_apnd,:,iblk), &
     394             :                                         trcrn(:,:,nt_hpnd,:,iblk), &   ! LCOV_EXCL_LINE
     395           0 :                                         trcrn(:,:,nt_ipnd,:,iblk))
     396             :             enddo ! iblk
     397             :          endif ! .not. restart_pond
     398             :       endif
     399             : 
     400             :       ! snow redistribution/metamorphism
     401          37 :       if (tr_snow) then
     402           0 :          if (trim(runtype) == 'continue') restart_snow = .true.
     403           0 :          if (restart_snow) then
     404           0 :             call read_restart_snow
     405             :          else
     406           0 :             do iblk = 1, nblocks
     407           0 :                call init_snowtracers(trcrn(:,:,nt_smice:nt_smice+nslyr-1,:,iblk), &
     408             :                                      trcrn(:,:,nt_smliq:nt_smliq+nslyr-1,:,iblk), &   ! LCOV_EXCL_LINE
     409             :                                      trcrn(:,:,nt_rhos :nt_rhos +nslyr-1,:,iblk), &   ! LCOV_EXCL_LINE
     410           0 :                                      trcrn(:,:,nt_rsnw :nt_rsnw +nslyr-1,:,iblk))
     411             :             enddo ! iblk
     412             :          endif
     413             :       endif
     414             : 
     415             :       ! floe size distribution
     416          37 :       if (tr_fsd) then
     417           0 :          if (trim(runtype) == 'continue') restart_fsd = .true.
     418           0 :          if (restart_fsd) then
     419           0 :             call read_restart_fsd
     420             :          else
     421           0 :             call init_fsd(trcrn(:,:,nt_fsd:nt_fsd+nfsd-1,:,:))
     422             :          endif
     423             :       endif
     424             : 
     425             :       ! isotopes
     426          37 :       if (tr_iso) then
     427           0 :          if (trim(runtype) == 'continue') restart_iso = .true.
     428           0 :          if (restart_iso) then
     429           0 :             call read_restart_iso
     430             :          else
     431           0 :             do iblk = 1, nblocks
     432           0 :                call init_isotope(trcrn(:,:,nt_isosno:nt_isosno+n_iso-1,:,iblk), &
     433           0 :                                  trcrn(:,:,nt_isoice:nt_isoice+n_iso-1,:,iblk))
     434             :             enddo ! iblk
     435             :          endif
     436             :       endif
     437             : 
     438          37 :       if (tr_aero) then ! ice aerosol
     439           0 :          if (trim(runtype) == 'continue') restart_aero = .true.
     440           0 :          if (restart_aero) then
     441           0 :             call read_restart_aero
     442             :          else
     443           0 :             do iblk = 1, nblocks
     444           0 :                call init_aerosol(trcrn(:,:,nt_aero:nt_aero+4*n_aero-1,:,iblk))
     445             :             enddo ! iblk
     446             :          endif ! .not. restart_aero
     447             :       endif
     448             : 
     449          37 :       if (trim(runtype) == 'continue') then
     450          12 :          if (tr_brine) &
     451           0 :              restart_hbrine = .true.
     452          12 :          if (skl_bgc .or. z_tracers) &
     453           0 :              restart_bgc = .true.
     454             :       endif
     455             : 
     456          37 :       if (tr_brine .or. skl_bgc) then ! brine height tracer
     457           0 :          call init_hbrine
     458           0 :          if (tr_brine .and. restart_hbrine) call read_restart_hbrine
     459             :       endif
     460             : 
     461          37 :       if (skl_bgc .or. z_tracers) then ! biogeochemistry
     462           0 :          if (tr_fsd) then
     463           0 :             write (nu_diag,*) 'FSD implementation incomplete for use with BGC'
     464           0 :             call icepack_warnings_flush(nu_diag)
     465           0 :             if (icepack_warnings_aborted()) call abort_ice(error_message=subname, &
     466           0 :                file=__FILE__, line=__LINE__)
     467             :          endif
     468           0 :          call init_bgc
     469             :       endif
     470             : 
     471             :       !-----------------------------------------------------------------
     472             :       ! aggregate tracers
     473             :       !-----------------------------------------------------------------
     474             : 
     475          20 :       !$OMP PARALLEL DO PRIVATE(iblk)
     476          50 :       do iblk = 1, nblocks
     477        1276 :       do j = 1, ny_block
     478       50267 :       do i = 1, nx_block
     479       50234 :          if (tmask(i,j,iblk)) then
     480             :             call icepack_aggregate(ncat  = ncat,                  &
     481             :                                    aicen = aicen(i,j,:,iblk),     &   ! LCOV_EXCL_LINE
     482             :                                    trcrn = trcrn(i,j,:,:,iblk),   &   ! LCOV_EXCL_LINE
     483             :                                    vicen = vicen(i,j,:,iblk),     &   ! LCOV_EXCL_LINE
     484             :                                    vsnon = vsnon(i,j,:,iblk),     &   ! LCOV_EXCL_LINE
     485             :                                    aice  = aice (i,j,  iblk),     &   ! LCOV_EXCL_LINE
     486             :                                    trcr  = trcr (i,j,:,iblk),     &   ! LCOV_EXCL_LINE
     487             :                                    vice  = vice (i,j,  iblk),     &   ! LCOV_EXCL_LINE
     488             :                                    vsno  = vsno (i,j,  iblk),     &   ! LCOV_EXCL_LINE
     489             :                                    aice0 = aice0(i,j,  iblk),     &   ! LCOV_EXCL_LINE
     490             :                                    ntrcr = ntrcr,                 &   ! LCOV_EXCL_LINE
     491             :                                    trcr_depend   = trcr_depend,   &   ! LCOV_EXCL_LINE
     492             :                                    trcr_base     = trcr_base,     &   ! LCOV_EXCL_LINE
     493             :                                    n_trcr_strata = n_trcr_strata, &   ! LCOV_EXCL_LINE
     494             :                                    nt_strata     = nt_strata,     &   ! LCOV_EXCL_LINE
     495       43389 :                                    Tf            = Tf(i,j,iblk))
     496             :          else
     497             :             ! tcraig, reset all tracer values on land to zero
     498      710514 :             trcrn(i,j,:,:,iblk) = c0
     499             :          endif
     500             :       enddo
     501             :       enddo
     502             :       enddo
     503             :       !$OMP END PARALLEL DO
     504             : 
     505          37 :       call icepack_warnings_flush(nu_diag)
     506          37 :       if (icepack_warnings_aborted()) call abort_ice(error_message=subname, &
     507           0 :          file=__FILE__, line=__LINE__)
     508             : 
     509          74 :       end subroutine init_restart
     510             : 
     511             : !=======================================================================
     512             : 
     513             :       end module CICE_InitMod
     514             : 
     515             : !=======================================================================

Generated by: LCOV version 1.14-6-g40580cd