From 8b0ae036a6865951d200dec8af6169f4b16ca73f Mon Sep 17 00:00:00 2001 From: Elizabeth Hunke Date: Fri, 16 Nov 2018 10:10:27 -0700 Subject: [PATCH] Refactor tracer initialization (#235) * separated namelist and tracer count from init_zbgc into input_zbgc * rearranged zbgc initialization, and namelist tracers iage, FY, lvl, pnd * input_data and init_zbgc split into 6 routines and rearranged * recombined input_zbgc2 with init_zbgc * minor cleanup * minor cleanup * update icepack * create count_tracers subroutine * eliminate max_ntrcr * remove max_nsw, n_bgc, nltrcr, n_trbgcz, n_trzs, n_trzaero, n_trbri, n_trbgcs * standardize subroutine argument definitions on single line, remove dead code, add input init aborts for bgc * update alt01 test, update some input checks * minor cleanup * minor updates * update alt01 and alt04 tests, add new debug tests, minor fixes --- .../cicedynB/analysis/ice_diagnostics.F90 | 6 +- .../cicedynB/analysis/ice_history_shared.F90 | 12 +- cicecore/cicedynB/dynamics/ice_dyn_eap.F90 | 24 +- cicecore/cicedynB/dynamics/ice_dyn_evp.F90 | 12 +- cicecore/cicedynB/dynamics/ice_dyn_shared.F90 | 57 +- .../dynamics/ice_transport_driver.F90 | 78 +- .../cicedynB/dynamics/ice_transport_remap.F90 | 99 +- cicecore/cicedynB/general/#ice_init.F90# | 1772 +++++++++++++++ cicecore/cicedynB/general/ice_flux.F90 | 27 +- cicecore/cicedynB/general/ice_flux_bgc.F90 | 5 +- cicecore/cicedynB/general/ice_forcing.F90 | 30 +- cicecore/cicedynB/general/ice_init.F90 | 398 +--- cicecore/cicedynB/general/ice_state.F90 | 32 +- cicecore/cicedynB/general/ice_step_mod.F90 | 15 +- cicecore/cicedynB/infrastructure/ice_grid.F90 | 14 +- .../infrastructure/ice_read_write.F90 | 39 +- .../infrastructure/ice_restart_driver.F90 | 22 +- .../cicedynB/infrastructure/ice_restoring.F90 | 12 +- .../io/io_binary/ice_restart.F90 | 6 +- .../io/io_netcdf/ice_restart.F90 | 6 +- .../infrastructure/io/io_pio/ice_restart.F90 | 6 +- cicecore/drivers/cesm/CICE_InitMod.F90 | 12 +- cicecore/drivers/cesm/CICE_RunMod.F90 | 12 +- cicecore/drivers/cice/CICE_InitMod.F90 | 50 +- cicecore/drivers/cice/CICE_RunMod.F90 | 12 +- cicecore/drivers/cice/CICE_RunMod.F90_debug | 12 +- cicecore/drivers/hadgem3/CICE_InitMod.F90 | 13 +- cicecore/drivers/hadgem3/CICE_RunMod.F90 | 12 +- cicecore/shared/ice_arrays_column.F90 | 17 +- cicecore/shared/ice_domain_size.F90 | 21 +- cicecore/shared/ice_init_column.F90 | 1915 +++++++++++------ configuration/scripts/ice_in | 9 - configuration/scripts/options/set_nml.alt01 | 2 - configuration/scripts/options/set_nml.alt04 | 3 + configuration/scripts/options/set_nml.bgcskl | 9 - .../scripts/options/set_nml.bgcsklclim | 9 - configuration/scripts/options/set_nml.bgcz | 9 - .../scripts/options/set_nml.bgczclim | 9 - configuration/scripts/tests/base_suite.ts | 8 + icepack | 2 +- 40 files changed, 3456 insertions(+), 1352 deletions(-) create mode 100644 cicecore/cicedynB/general/#ice_init.F90# diff --git a/cicecore/cicedynB/analysis/ice_diagnostics.F90 b/cicecore/cicedynB/analysis/ice_diagnostics.F90 index a7f92e944..ccabf3df2 100644 --- a/cicecore/cicedynB/analysis/ice_diagnostics.F90 +++ b/cicecore/cicedynB/analysis/ice_diagnostics.F90 @@ -1131,8 +1131,7 @@ subroutine total_energy (work) use ice_grid, only: tmask use ice_state, only: vicen, vsnon, trcrn - real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks), & - intent(out) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks), intent(out) :: & work ! total energy ! local variables @@ -1219,8 +1218,7 @@ subroutine total_salt (work) use ice_grid, only: tmask use ice_state, only: vicen, trcrn - real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks), & - intent(out) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks), intent(out) :: & work ! total salt ! local variables diff --git a/cicecore/cicedynB/analysis/ice_history_shared.F90 b/cicecore/cicedynB/analysis/ice_history_shared.F90 index 9c9e495c3..d8335e1f7 100644 --- a/cicecore/cicedynB/analysis/ice_history_shared.F90 +++ b/cicecore/cicedynB/analysis/ice_history_shared.F90 @@ -725,9 +725,8 @@ subroutine define_hist_field(id, vname, vunit, vcoord, vcellmeas, & ns, vhistfreq) use ice_calendar, only: histfreq, histfreq_n - use ice_domain_size, only: max_nstrm - integer (int_kind), dimension(max_nstrm), intent(out) :: & + integer (int_kind), dimension(:), intent(out) :: & ! max_nstrm id ! location in avail_fields array for use in ! later routines @@ -833,10 +832,9 @@ subroutine accum_hist_field_2D(id, iblk, field_accum, field) use ice_blocks, only: block, get_block use ice_calendar, only: nstreams use ice_domain, only: blocks_ice - use ice_domain_size, only: max_nstrm use ice_grid, only: tmask - integer (int_kind), dimension(max_nstrm), intent(in) :: & + integer (int_kind), dimension(:), intent(in) :: & ! max_nstrm id ! location in avail_fields array for use in ! later routines @@ -894,10 +892,9 @@ subroutine accum_hist_field_3D(id, iblk, ndim, field_accum, field) use ice_blocks, only: block, get_block use ice_calendar, only: nstreams use ice_domain, only: blocks_ice - use ice_domain_size, only: max_nstrm use ice_grid, only: tmask - integer (int_kind), dimension(max_nstrm), intent(in) :: & + integer (int_kind), dimension(:), intent(in) :: & ! max_nstrm id ! location in avail_fields array for use in ! later routines @@ -960,10 +957,9 @@ subroutine accum_hist_field_4D(id, iblk, ndim3, ndim4, field_accum, field) use ice_blocks, only: block, get_block use ice_calendar, only: nstreams use ice_domain, only: blocks_ice - use ice_domain_size, only: max_nstrm use ice_grid, only: tmask - integer (int_kind), dimension(max_nstrm), intent(in) :: & + integer (int_kind), dimension(:), intent(in) :: & ! max_nstrm id ! location in avail_fields array for use in ! later routines diff --git a/cicecore/cicedynB/dynamics/ice_dyn_eap.F90 b/cicecore/cicedynB/dynamics/ice_dyn_eap.F90 index 5ee0c8ba9..c123b7d8e 100644 --- a/cicecore/cicedynB/dynamics/ice_dyn_eap.F90 +++ b/cicecore/cicedynB/dynamics/ice_dyn_eap.F90 @@ -1204,8 +1204,7 @@ subroutine stress_eap (nx_block, ny_block, & ndte , & ! number of subcycles icellt ! no. of cells where icetmask = 1 - integer (kind=int_kind), dimension (nx_block*ny_block), & - intent(in) :: & + integer (kind=int_kind), dimension (nx_block*ny_block), intent(in) :: & indxti , & ! compressed index in i-direction indxtj ! compressed index in j-direction @@ -1227,19 +1226,16 @@ subroutine stress_eap (nx_block, ny_block, & cxm , & ! 0.5*HTN - 1.5*HTN tarear ! 1/tarea - real (kind=dbl_kind), dimension (nx_block,ny_block), & - intent(inout) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block), intent(inout) :: & stressp_1, stressp_2, stressp_3, stressp_4, & ! sigma11+sigma22 stressm_1, stressm_2, stressm_3, stressm_4, & ! sigma11-sigma22 stress12_1,stress12_2,stress12_3,stress12_4 ! sigma12 - real (kind=dbl_kind), dimension (nx_block,ny_block), & - intent(inout) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block), intent(inout) :: & a11_1, a11_2, a11_3, a11_4, & ! structure tensor a12_1, a12_2, a12_3, a12_4 ! structure tensor - real (kind=dbl_kind), dimension (nx_block,ny_block), & - intent(inout) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block), intent(inout) :: & shear , & ! strain rate II component (1/s) divu , & ! strain rate I component, velocity divergence (1/s) e11 , & ! components of strain rate tensor (1/s) @@ -1254,8 +1250,7 @@ subroutine stress_eap (nx_block, ny_block, & rdg_conv ! convergence term for ridging (1/s) ! rdg_shear ! shear term for ridging (1/s) - real (kind=dbl_kind), dimension(nx_block,ny_block,8), & - intent(out) :: & + real (kind=dbl_kind), dimension(nx_block,ny_block,8), intent(out) :: & strtmp ! stress combinations ! local variables @@ -1809,20 +1804,17 @@ subroutine stepa (nx_block, ny_block, & real (kind=dbl_kind), intent(in) :: & dtei ! 1/dte, where dte is subcycling timestep (1/s) - integer (kind=int_kind), dimension (nx_block*ny_block), & - intent(in) :: & + integer (kind=int_kind), dimension (nx_block*ny_block), intent(in) :: & indxti , & ! compressed index in i-direction indxtj ! compressed index in j-direction - real (kind=dbl_kind), dimension (nx_block,ny_block), & - intent(in) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block), intent(in) :: & ! ice stress tensor (kg/s^2) in each corner of T cell stressp_1, stressp_2, stressp_3, stressp_4, & ! sigma11+sigma22 stressm_1, stressm_2, stressm_3, stressm_4, & ! sigma11-sigma22 stress12_1, stress12_2, stress12_3, stress12_4 ! sigma12 - real (kind=dbl_kind), dimension (nx_block,ny_block), & - intent(inout) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block), intent(inout) :: & ! structure tensor () in each corner of T cell a11, a12, a11_1, a11_2, a11_3, a11_4, & ! components of a12_1, a12_2, a12_3, a12_4 ! structure tensor () diff --git a/cicecore/cicedynB/dynamics/ice_dyn_evp.F90 b/cicecore/cicedynB/dynamics/ice_dyn_evp.F90 index 8ffa5aaad..238824e7f 100644 --- a/cicecore/cicedynB/dynamics/ice_dyn_evp.F90 +++ b/cicecore/cicedynB/dynamics/ice_dyn_evp.F90 @@ -555,8 +555,7 @@ subroutine stress (nx_block, ny_block, & ksub , & ! subcycling step icellt ! no. of cells where icetmask = 1 - integer (kind=int_kind), dimension (nx_block*ny_block), & - intent(in) :: & + integer (kind=int_kind), dimension (nx_block*ny_block), intent(in) :: & indxti , & ! compressed index in i-direction indxtj ! compressed index in j-direction @@ -575,21 +574,18 @@ subroutine stress (nx_block, ny_block, & tarear , & ! 1/tarea tinyarea ! puny*tarea - real (kind=dbl_kind), dimension (nx_block,ny_block), & - intent(inout) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block), intent(inout) :: & stressp_1, stressp_2, stressp_3, stressp_4 , & ! sigma11+sigma22 stressm_1, stressm_2, stressm_3, stressm_4 , & ! sigma11-sigma22 stress12_1,stress12_2,stress12_3,stress12_4 ! sigma12 - real (kind=dbl_kind), dimension (nx_block,ny_block), & - intent(inout) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block), intent(inout) :: & shear , & ! strain rate II component (1/s) divu , & ! strain rate I component, velocity divergence (1/s) rdg_conv , & ! convergence term for ridging (1/s) rdg_shear ! shear term for ridging (1/s) - real (kind=dbl_kind), dimension(nx_block,ny_block,8), & - intent(out) :: & + real (kind=dbl_kind), dimension(nx_block,ny_block,8), intent(out) :: & str ! stress combinations ! local variables diff --git a/cicecore/cicedynB/dynamics/ice_dyn_shared.F90 b/cicecore/cicedynB/dynamics/ice_dyn_shared.F90 index f7fdb89e5..aacf599c6 100644 --- a/cicecore/cicedynB/dynamics/ice_dyn_shared.F90 +++ b/cicecore/cicedynB/dynamics/ice_dyn_shared.F90 @@ -297,26 +297,22 @@ subroutine dyn_prep1 (nx_block, ny_block, & nx_block, ny_block, & ! block dimensions ilo,ihi,jlo,jhi ! beginning and end of physical domain - real (kind=dbl_kind), dimension (nx_block,ny_block), & - intent(in) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block), intent(in) :: & aice , & ! concentration of ice vice , & ! volume per unit area of ice (m) vsno , & ! volume per unit area of snow (m) strairxT, & ! stress on ice by air, x-direction strairyT ! stress on ice by air, y-direction - logical (kind=log_kind), dimension (nx_block,ny_block), & - intent(in) :: & + logical (kind=log_kind), dimension (nx_block,ny_block), intent(in) :: & tmask ! land/boundary mask, thickness (T-cell) - real (kind=dbl_kind), dimension (nx_block,ny_block), & - intent(out) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block), intent(out) :: & strairx , & ! stress on ice by air, x-direction strairy , & ! stress on ice by air, y-direction tmass ! total mass of ice and snow (kg/m^2) - integer (kind=int_kind), dimension (nx_block,ny_block), & - intent(out) :: & + integer (kind=int_kind), dimension (nx_block,ny_block), intent(out) :: & icetmask ! ice extent mask (T-cell) ! local variables @@ -439,23 +435,19 @@ subroutine dyn_prep2 (nx_block, ny_block, & icellt , & ! no. of cells where icetmask = 1 icellu ! no. of cells where iceumask = 1 - integer (kind=int_kind), dimension (nx_block*ny_block), & - intent(out) :: & + integer (kind=int_kind), dimension (nx_block*ny_block), intent(out) :: & indxti , & ! compressed index in i-direction indxtj , & ! compressed index in j-direction indxui , & ! compressed index in i-direction indxuj ! compressed index in j-direction - logical (kind=log_kind), dimension (nx_block,ny_block), & - intent(in) :: & + logical (kind=log_kind), dimension (nx_block,ny_block), intent(in) :: & umask ! land/boundary mask, thickness (U-cell) - integer (kind=int_kind), dimension (nx_block,ny_block), & - intent(in) :: & + integer (kind=int_kind), dimension (nx_block,ny_block), intent(in) :: & icetmask ! ice extent mask (T-cell) - logical (kind=log_kind), dimension (nx_block,ny_block), & - intent(inout) :: & + logical (kind=log_kind), dimension (nx_block,ny_block), intent(inout) :: & iceumask ! ice extent mask (U-cell) real (kind=dbl_kind), dimension (nx_block,ny_block), intent(in) :: & @@ -472,8 +464,7 @@ subroutine dyn_prep2 (nx_block, ny_block, & real (kind=dbl_kind), intent(in) :: & dt ! time step - real (kind=dbl_kind), dimension (nx_block,ny_block), & - intent(out) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block), intent(out) :: & Tbu, & ! coefficient for basal stress (N/m^2) uvel_init,& ! x-component of velocity (m/s), beginning of time step vvel_init,& ! y-component of velocity (m/s), beginning of time step @@ -483,8 +474,7 @@ subroutine dyn_prep2 (nx_block, ny_block, & forcex , & ! work array: combined atm stress and ocn tilt, x forcey ! work array: combined atm stress and ocn tilt, y - real (kind=dbl_kind), dimension (nx_block,ny_block), & - intent(inout) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block), intent(inout) :: & fm , & ! Coriolis param. * mass in U-cell (kg/s) stressp_1, stressp_2, stressp_3, stressp_4 , & ! sigma11+sigma22 stressm_1, stressm_2, stressm_3, stressm_4 , & ! sigma11-sigma22 @@ -683,8 +673,7 @@ subroutine stepu (nx_block, ny_block, & icellu, & ! total count when iceumask is true ksub ! subcycling iteration - integer (kind=int_kind), dimension (nx_block*ny_block), & - intent(in) :: & + integer (kind=int_kind), dimension (nx_block*ny_block), intent(in) :: & indxui , & ! compressed index in i-direction indxuj ! compressed index in j-direction @@ -703,17 +692,14 @@ subroutine stepu (nx_block, ny_block, & fm , & ! Coriolis param. * mass in U-cell (kg/s) uarear ! 1/uarea - real (kind=dbl_kind), dimension(nx_block,ny_block,8), & - intent(in) :: & + real (kind=dbl_kind), dimension(nx_block,ny_block,8), intent(in) :: & str - real (kind=dbl_kind), dimension (nx_block,ny_block), & - intent(inout) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block), intent(inout) :: & uvel , & ! x-component of velocity (m/s) vvel ! y-component of velocity (m/s) - real (kind=dbl_kind), dimension (nx_block,ny_block), & - intent(inout) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block), intent(inout) :: & strocnx , & ! ice-ocean stress, x-direction strocny , & ! ice-ocean stress, y-direction strintx , & ! divergence of internal ice stress, x (N/m^2) @@ -721,8 +707,7 @@ subroutine stepu (nx_block, ny_block, & taubx , & ! basal stress, x-direction (N/m^2) tauby ! basal stress, y-direction (N/m^2) - real (kind=dbl_kind), dimension (nx_block,ny_block), & - intent(inout) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block), intent(inout) :: & Cw ! ocean-ice neutral drag coefficient ! local variables @@ -830,8 +815,7 @@ subroutine dyn_finish (nx_block, ny_block, & nx_block, ny_block, & ! block dimensions icellu ! total count when iceumask is true - integer (kind=int_kind), dimension (nx_block*ny_block), & - intent(in) :: & + integer (kind=int_kind), dimension (nx_block*ny_block), intent(in) :: & indxui , & ! compressed index in i-direction indxuj ! compressed index in j-direction @@ -847,8 +831,7 @@ subroutine dyn_finish (nx_block, ny_block, & strairx , & ! stress on ice by air, x-direction strairy ! stress on ice by air, y-direction - real (kind=dbl_kind), dimension (nx_block,ny_block), & - intent(inout) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block), intent(inout) :: & strocnx , & ! ice-ocean stress, x-direction strocny , & ! ice-ocean stress, y-direction strocnxT, & ! ice-ocean stress, x-direction @@ -860,8 +843,7 @@ subroutine dyn_finish (nx_block, ny_block, & i, j, ij real (kind=dbl_kind) :: vrel, rhow - real (kind=dbl_kind), dimension (nx_block,ny_block), & - intent(inout) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block), intent(inout) :: & Cw ! ocean-ice neutral drag coefficient character(len=*), parameter :: subname = '(dyn_finish)' @@ -938,8 +920,7 @@ subroutine basal_stress_coeff (nx_block, ny_block, & nx_block, ny_block, & ! block dimensions icellu ! no. of cells where icetmask = 1 - integer (kind=int_kind), dimension (nx_block*ny_block), & - intent(in) :: & + integer (kind=int_kind), dimension (nx_block*ny_block), intent(in) :: & indxui , & ! compressed index in i-direction indxuj ! compressed index in j-direction diff --git a/cicecore/cicedynB/dynamics/ice_transport_driver.F90 b/cicecore/cicedynB/dynamics/ice_transport_driver.F90 index 5a5414f14..7176ebce5 100644 --- a/cicecore/cicedynB/dynamics/ice_transport_driver.F90 +++ b/cicecore/cicedynB/dynamics/ice_transport_driver.F90 @@ -843,26 +843,21 @@ subroutine state_to_tracers (nx_block, ny_block, & ntrcr , & ! number of tracers in use ntrace ! number of tracers in use incl. hi, hs - real (kind=dbl_kind), dimension (nx_block,ny_block), & - intent(in) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block), intent(in) :: & aice0 ! fractional open water area - real (kind=dbl_kind), dimension (nx_block,ny_block,ncat), & - intent(in) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block,ncat), intent(in) :: & aicen ,&! fractional ice area vicen ,&! volume per unit area of ice (m) vsnon ! volume per unit area of snow (m) - real (kind=dbl_kind), dimension (nx_block,ny_block,ntrcr,ncat), & - intent(in) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block,ntrcr,ncat), intent(in) :: & trcrn ! ice area tracers - real (kind=dbl_kind), dimension (nx_block,ny_block,0:ncat), & - intent(out):: & + real (kind=dbl_kind), dimension (nx_block,ny_block,0:ncat), intent(out) :: & aim ! mean ice area in each grid cell - real (kind=dbl_kind), dimension (nx_block,ny_block,ntrace,ncat), & - intent(out) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block,ntrace,ncat), intent(out) :: & trm ! mean tracer values in each grid cell ! local variables @@ -973,26 +968,21 @@ subroutine tracers_to_state (nx_block, ny_block, & ntrcr , & ! number of tracers in use ntrace ! number of tracers in use incl. hi, hs - real (kind=dbl_kind), dimension (nx_block,ny_block,0:ncat), & - intent(in) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block,0:ncat), intent(in) :: & aim ! fractional ice area - real (kind=dbl_kind), dimension (nx_block,ny_block,ntrace,ncat), & - intent(in) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block,ntrace,ncat), intent(in) :: & trm ! mean tracer values in each grid cell - real (kind=dbl_kind), dimension (nx_block,ny_block), & - intent(inout) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block), intent(inout) :: & aice0 ! fractional ice area - real (kind=dbl_kind), dimension (nx_block,ny_block,ncat), & - intent(inout) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block,ncat), intent(inout) :: & aicen ,&! fractional ice area vicen ,&! volume per unit area of ice (m) vsnon ! volume per unit area of snow (m) - real (kind=dbl_kind), dimension (nx_block,ny_block,ntrcr,ncat), & - intent(inout) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block,ntrcr,ncat), intent(inout) :: & trcrn ! tracers ! local variables @@ -1161,17 +1151,14 @@ subroutine local_max_min (nx_block, ny_block, & nx_block, ny_block,&! block dimensions ilo,ihi,jlo,jhi ! beginning and end of physical domain - real (kind=dbl_kind), intent(in), & - dimension(nx_block,ny_block) :: & + real (kind=dbl_kind), intent(in), dimension(nx_block,ny_block) :: & aimask ! ice area mask - real (kind=dbl_kind), intent(in), & - dimension (nx_block,ny_block,ntrace) :: & + real (kind=dbl_kind), intent(in), dimension (nx_block,ny_block,ntrace) :: & trm ,&! tracer fields trmask ! tracer mask - real (kind=dbl_kind), intent(out), & - dimension (nx_block,ny_block,ntrace) :: & + real (kind=dbl_kind), intent(out), dimension (nx_block,ny_block,ntrace) :: & tmin ,&! local min tracer tmax ! local max tracer @@ -1271,8 +1258,7 @@ subroutine quasilocal_max_min (nx_block, ny_block, & nx_block, ny_block,&! block dimensions ilo,ihi,jlo,jhi ! beginning and end of physical domain - real (kind=dbl_kind), intent(inout), & - dimension (nx_block,ny_block,ntrace) :: & + real (kind=dbl_kind), intent(inout), dimension (nx_block,ny_block,ntrace) :: & tmin ,&! local min tracer tmax ! local max tracer @@ -1324,16 +1310,13 @@ subroutine check_monotonicity (nx_block, ny_block, & nx_block, ny_block,&! block dimensions ilo,ihi,jlo,jhi ! beginning and end of physical domain - real (kind=dbl_kind), intent(in), & - dimension (nx_block,ny_block) :: & + real (kind=dbl_kind), intent(in), dimension (nx_block,ny_block) :: & aim ! new ice area - real (kind=dbl_kind), intent(in), & - dimension (nx_block,ny_block,ntrace) :: & + real (kind=dbl_kind), intent(in), dimension (nx_block,ny_block,ntrace) :: & trm ! new tracers - real (kind=dbl_kind), intent(in), & - dimension (nx_block,ny_block,ntrace) :: & + real (kind=dbl_kind), intent(in), dimension (nx_block,ny_block,ntrace) :: & tmin ,&! local min tracer tmax ! local max tracer @@ -1474,22 +1457,18 @@ subroutine state_to_work (nx_block, ny_block, & integer (kind=int_kind), dimension (ntrcr), intent(in) :: & trcr_depend ! = 0 for aicen tracers, 1 for vicen, 2 for vsnon - real (kind=dbl_kind), dimension (nx_block,ny_block,ncat), & - intent(in) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block,ncat), intent(in) :: & aicen ,&! concentration of ice vicen ,&! volume per unit area of ice (m) vsnon ! volume per unit area of snow (m) - real (kind=dbl_kind), dimension (nx_block,ny_block,ntrcr,ncat), & - intent(in) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block,ntrcr,ncat), intent(in) :: & trcrn ! ice tracers - real (kind=dbl_kind), dimension (nx_block,ny_block), & - intent(in) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block), intent(in) :: & aice0 ! concentration of open water - real (kind=dbl_kind), dimension(nx_block,ny_block,narr), & - intent (out) :: & + real (kind=dbl_kind), dimension(nx_block,ny_block,narr), intent (out) :: & works ! work array ! local variables @@ -1639,18 +1618,15 @@ subroutine work_to_state (nx_block, ny_block, & real (kind=dbl_kind), intent (in) :: & works (nx_block,ny_block,narr) - real (kind=dbl_kind), dimension (nx_block,ny_block,ncat), & - intent(out) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block,ncat), intent(out) :: & aicen ,&! concentration of ice vicen ,&! volume per unit area of ice (m) vsnon ! volume per unit area of snow (m) - real (kind=dbl_kind), dimension (nx_block,ny_block,ntrcr,ncat), & - intent(out) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block,ntrcr,ncat),intent(out) :: & trcrn ! ice tracers - real (kind=dbl_kind), dimension (nx_block,ny_block), & - intent(out) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block), intent(out) :: & aice0 ! concentration of open water ! local variables @@ -1739,12 +1715,10 @@ subroutine upwind_field (nx_block, ny_block, & real (kind=dbl_kind), intent(in) :: & dt ! time step - real (kind=dbl_kind), dimension(nx_block,ny_block,narrays), & - intent(inout) :: & + real (kind=dbl_kind), dimension(nx_block,ny_block,narrays), intent(inout) :: & phi ! scalar field - real (kind=dbl_kind), dimension(nx_block,ny_block), & - intent(in):: & + real (kind=dbl_kind), dimension(nx_block,ny_block), intent(in) :: & uee, vnn ! cell edge velocities real (kind=dbl_kind), dimension(nx_block,ny_block), intent(in) :: & diff --git a/cicecore/cicedynB/dynamics/ice_transport_remap.F90 b/cicecore/cicedynB/dynamics/ice_transport_remap.F90 index d20f903b5..bf9d0f373 100644 --- a/cicecore/cicedynB/dynamics/ice_transport_remap.F90 +++ b/cicecore/cicedynB/dynamics/ice_transport_remap.F90 @@ -338,17 +338,14 @@ subroutine horizontal_remap (dt, ntrace, & integer (kind=int_kind), intent(in) :: & ntrace ! number of tracers in use - real (kind=dbl_kind), intent(in), & - dimension(nx_block,ny_block,max_blocks) :: & + real (kind=dbl_kind), intent(in), dimension(nx_block,ny_block,max_blocks) :: & uvel ,&! x-component of velocity (m/s) vvel ! y-component of velocity (m/s) - real (kind=dbl_kind), intent(inout), & - dimension (nx_block,ny_block,0:ncat,max_blocks) :: & + real (kind=dbl_kind), intent(inout), dimension (nx_block,ny_block,0:ncat,max_blocks) :: & mm ! mean mass values in each grid cell - real (kind=dbl_kind), intent(inout), & - dimension (nx_block,ny_block,ntrace,ncat,max_blocks) :: & + real (kind=dbl_kind), intent(inout), dimension (nx_block,ny_block,ntrace,ncat,max_blocks) :: & tm ! mean tracer values in each grid cell !------------------------------------------------------------------- @@ -894,25 +891,20 @@ subroutine make_masks (nx_block, ny_block, & integer (kind=int_kind), dimension(0:ncat), intent(out) :: & icells ! number of cells with ice - integer (kind=int_kind), dimension(nx_block*ny_block,0:ncat), & - intent(out) :: & + integer (kind=int_kind), dimension(nx_block*ny_block,0:ncat), intent(out) :: & indxi ,&! compressed i/j indices indxj - real (kind=dbl_kind), dimension (nx_block,ny_block,0:ncat), & - intent(in) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block,0:ncat), intent(in) :: & mm ! mean ice area in each grid cell - real (kind=dbl_kind), dimension (nx_block,ny_block,0:ncat), & - intent(out) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block,0:ncat), intent(out) :: & mmask ! = 1. if ice is present, else = 0. - real (kind=dbl_kind), dimension (nx_block, ny_block, ntrace, ncat), & - intent(in), optional :: & + real (kind=dbl_kind), dimension (nx_block, ny_block, ntrace, ncat), intent(in), optional :: & tm ! mean tracer values in each grid cell - real (kind=dbl_kind), dimension (nx_block, ny_block, ntrace, ncat), & - intent(out), optional :: & + real (kind=dbl_kind), dimension (nx_block, ny_block, ntrace, ncat), intent(out), optional :: & tmask ! = 1. if tracer is present, else = 0. ! local variables @@ -1075,31 +1067,26 @@ subroutine construct_fields (nx_block, ny_block, & indxi ,&! compressed i/j indices indxj - real (kind=dbl_kind), dimension (nx_block,ny_block), & - intent(in) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block), intent(in) :: & hm ,&! land/boundary mask, thickness (T-cell) xav, yav ,&! mean T-cell values of x, y xxav, yyav ! mean T-cell values of xx, yy ! xyav, ,&! mean T-cell values of xy ! xxxav,xxyav,xyyav,yyyav ! mean T-cell values of xxx, xxy, xyy, yyy - real (kind=dbl_kind), dimension (nx_block,ny_block), & - intent(in) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block), intent(in) :: & mm ,&! mean value of mass field mmask ! = 1. if ice is present, = 0. otherwise - real (kind=dbl_kind), dimension (nx_block,ny_block,ntrace), & - intent(in), optional :: & + real (kind=dbl_kind), dimension (nx_block,ny_block,ntrace), intent(in), optional :: & tm ,&! mean tracer tmask ! = 1. if tracer is present, = 0. otherwise - real (kind=dbl_kind), dimension (nx_block,ny_block), & - intent(out) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block), intent(out) :: & mc ,&! mass value at geometric center of cell mx, my ! limited derivative of mass wrt x and y - real (kind=dbl_kind), dimension (nx_block,ny_block,ntrace), & - intent(out), optional :: & + real (kind=dbl_kind), dimension (nx_block,ny_block,ntrace), intent(out), optional :: & tc ,&! tracer at geometric center of cell tx, ty ! limited derivative of tracer wrt x and y @@ -1376,8 +1363,7 @@ subroutine limited_gradient (nx_block, ny_block, & ilo,ihi,jlo,jhi ,&! beginning and end of physical domain nghost ! number of ghost cells - real (kind=dbl_kind), dimension (nx_block,ny_block), & - intent (in) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block), intent (in) :: & phi ,&! input tracer field (mean values in each grid cell) cnx ,&! x-coordinate of phi relative to geometric center of cell cny ,&! y-coordinate of phi relative to geometric center of cell @@ -1386,8 +1372,7 @@ subroutine limited_gradient (nx_block, ny_block, & ! For instance, aice has no physical meaning in land cells, ! and hice no physical meaning where aice = 0. - real (kind=dbl_kind), dimension (nx_block,ny_block), & - intent(out) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block), intent(out) :: & gx ,&! limited x-direction gradient gy ! limited y-direction gradient @@ -1729,24 +1714,20 @@ subroutine locate_triangles (nx_block, ny_block, & dxu ,&! E-W dimension of U-cell (m) dyu ! N-S dimension of U-cell (m) - real (kind=dbl_kind), dimension (nx_block,ny_block,0:nvert,ngroups), & - intent(out) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block,0:nvert,ngroups), intent(out) :: & xp, yp ! coordinates of triangle vertices - real (kind=dbl_kind), dimension (nx_block,ny_block,ngroups), & - intent(out) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block,ngroups), intent(out) :: & triarea ! area of departure triangle - integer (kind=int_kind), dimension (nx_block,ny_block,ngroups), & - intent(out) :: & + integer (kind=int_kind), dimension (nx_block,ny_block,ngroups), intent(out) :: & iflux ,&! i index of cell contributing transport jflux ! j index of cell contributing transport integer (kind=int_kind), dimension (ngroups), intent(out) :: & icells ! number of cells where triarea > puny - integer (kind=int_kind), dimension (nx_block*ny_block,ngroups), & - intent(out) :: & + integer (kind=int_kind), dimension (nx_block*ny_block,ngroups), intent(out) :: & indxi ,&! compressed index in i-direction indxj ! compressed index in j-direction @@ -3119,13 +3100,11 @@ subroutine triangle_coordinates (nx_block, ny_block, & integer (kind=int_kind), dimension (ngroups), intent(in) :: & icells ! number of cells where triarea > puny - integer (kind=int_kind), dimension (nx_block*ny_block,ngroups), & - intent(in) :: & + integer (kind=int_kind), dimension (nx_block*ny_block,ngroups), intent(in) :: & indxi ,&! compressed index in i-direction indxj ! compressed index in j-direction - real (kind=dbl_kind), intent(inout), & - dimension (nx_block, ny_block, 0:nvert, ngroups) :: & + real (kind=dbl_kind), intent(inout), dimension (nx_block, ny_block, 0:nvert, ngroups) :: & xp, yp ! coordinates of triangle points ! local variables @@ -3251,38 +3230,30 @@ subroutine transport_integrals (nx_block, ny_block, & integer (kind=int_kind), dimension (ngroups), intent(in) :: & icells ! number of cells where triarea > puny - integer (kind=int_kind), dimension (nx_block*ny_block,ngroups), & - intent(in) :: & + integer (kind=int_kind), dimension (nx_block*ny_block,ngroups), intent(in) :: & indxi ,&! compressed index in i-direction indxj ! compressed index in j-direction - real (kind=dbl_kind), intent(in), & - dimension (nx_block, ny_block, 0:nvert, ngroups) :: & + real (kind=dbl_kind), intent(in), dimension (nx_block, ny_block, 0:nvert, ngroups) :: & xp, yp ! coordinates of triangle points - real (kind=dbl_kind), intent(in), & - dimension (nx_block, ny_block, ngroups) :: & + real (kind=dbl_kind), intent(in), dimension (nx_block, ny_block, ngroups) :: & triarea ! triangle area - integer (kind=int_kind), intent(in), & - dimension (nx_block, ny_block, ngroups) :: & + integer (kind=int_kind), intent(in), dimension (nx_block, ny_block, ngroups) :: & iflux ,& jflux - real (kind=dbl_kind), intent(in), & - dimension (nx_block, ny_block) :: & + real (kind=dbl_kind), intent(in), dimension (nx_block, ny_block) :: & mc, mx, my - real (kind=dbl_kind), intent(out), & - dimension (nx_block, ny_block) :: & + real (kind=dbl_kind), intent(out), dimension (nx_block, ny_block) :: & mflx - real (kind=dbl_kind), intent(in), & - dimension (nx_block, ny_block, ntrace), optional :: & + real (kind=dbl_kind), intent(in), dimension (nx_block, ny_block, ntrace), optional :: & tc, tx, ty - real (kind=dbl_kind), intent(out), & - dimension (nx_block, ny_block, ntrace), optional :: & + real (kind=dbl_kind), intent(out), dimension (nx_block, ny_block, ntrace), optional :: & mtflx ! local variables @@ -3565,21 +3536,17 @@ subroutine update_fields (nx_block, ny_block, & tracer_type ,&! = 1, 2, or 3 (see comments above) depend ! tracer dependencies (see above) - real (kind=dbl_kind), dimension (nx_block, ny_block), & - intent(in) :: & + real (kind=dbl_kind), dimension (nx_block, ny_block), intent(in) :: & mflxe, mflxn ,&! mass transport across east and north cell edges tarear ! 1/tarea - real (kind=dbl_kind), dimension (nx_block, ny_block), & - intent(inout) :: & + real (kind=dbl_kind), dimension (nx_block, ny_block), intent(inout) :: & mm ! mass field (mean) - real (kind=dbl_kind), dimension (nx_block, ny_block, ntrace), & - intent(in), optional :: & + real (kind=dbl_kind), dimension (nx_block, ny_block, ntrace), intent(in), optional :: & mtflxe, mtflxn ! mass*tracer transport across E and N cell edges - real (kind=dbl_kind), dimension (nx_block, ny_block, ntrace), & - intent(inout), optional :: & + real (kind=dbl_kind), dimension (nx_block, ny_block, ntrace), intent(inout), optional :: & tm ! tracer fields logical (kind=log_kind), intent(inout) :: & diff --git a/cicecore/cicedynB/general/#ice_init.F90# b/cicecore/cicedynB/general/#ice_init.F90# new file mode 100644 index 000000000..0dabf808c --- /dev/null +++ b/cicecore/cicedynB/general/#ice_init.F90# @@ -0,0 +1,1772 @@ +!======================================================================= + +! parameter and variable initializations +! +! authors Elizabeth C. Hunke and William H. Lipscomb, LANL +! C. M. Bitz, UW +! +! 2004 WHL: Block structure added +! 2006 ECH: Added namelist variables, warnings. +! Replaced old default initial ice conditions with 3.14 version. +! Converted to free source form (F90). + + module ice_init + + use ice_kinds_mod + use ice_communicate, only: my_task, master_task, ice_barrier + use ice_constants, only: c0, c1, c2, c3, p2, p5 + use ice_exit, only: abort_ice + use ice_fileunits, only: nu_nml, nu_diag, nml_filename, diag_type, & + ice_stdout, get_fileunit, release_fileunit, bfbflag, flush_fileunit, & + ice_IOUnitsMinUnit, ice_IOUnitsMaxUnit + use ice_fileunits, only: inst_suffix + use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted + use icepack_intfc, only: icepack_aggregate + use icepack_intfc, only: icepack_init_trcr + use icepack_intfc, only: icepack_init_parameters + use icepack_intfc, only: icepack_init_tracer_flags + use icepack_intfc, only: icepack_init_tracer_numbers + use icepack_intfc, only: icepack_init_tracer_indices + use icepack_intfc, only: icepack_query_tracer_flags + use icepack_intfc, only: icepack_query_tracer_numbers + use icepack_intfc, only: icepack_query_tracer_indices + use icepack_intfc, only: icepack_query_parameters + + implicit none + private + + character(len=char_len_long),public :: & + ice_ic ! method of ice cover initialization + ! 'default' => latitude and sst dependent + ! 'none' => no ice + ! note: restart = .true. overwrites + + public :: input_data, init_state, set_state_var + +!======================================================================= + + contains + +!======================================================================= + +! Namelist variables, set to default values; may be altered +! at run time +! +! author Elizabeth C. Hunke, LANL + + subroutine input_data + + use ice_broadcast, only: broadcast_scalar, broadcast_array + use ice_diagnostics, only: diag_file, print_global, print_points, latpnt, lonpnt + use ice_domain, only: close_boundaries + use ice_domain_size, only: ncat, nilyr, nslyr, nblyr, & + n_aero, n_zaero, n_algae, & + n_doc, n_dic, n_don, n_fed, n_fep, & + max_nstrm + use ice_calendar, only: year_init, istep0, histfreq, histfreq_n, & + dumpfreq, dumpfreq_n, diagfreq, & + npt, dt, ndtd, days_per_year, use_leap_years, & + write_ic, dump_last + use ice_arrays_column, only: oceanmixed_ice + use ice_restart_column, only: restart_age, restart_FY, restart_lvl, & + restart_pond_cesm, restart_pond_lvl, restart_pond_topo, restart_aero + use ice_restart_shared, only: & + restart, restart_ext, restart_dir, restart_file, pointer_file, & + runid, runtype, use_restart_time, restart_format, lcdf64 + use ice_history_shared, only: hist_avg, history_dir, history_file, & + incond_dir, incond_file, version_name + use ice_flux, only: update_ocn_f, l_mpond_fresh + use ice_flux, only: default_season + use ice_flux_bgc, only: cpl_bgc + use ice_forcing, only: & + ycycle, fyear_init, dbug, & + atm_data_type, atm_data_dir, precip_units, & + atm_data_format, ocn_data_format, & + bgc_data_type, & + ocn_data_type, ocn_data_dir, & + oceanmixed_file, restore_ocn, trestore + use ice_arrays_column, only: bgc_data_dir, & + sil_data_type, nit_data_type, fe_data_type + use ice_grid, only: grid_file, gridcpl_file, kmt_file, & + bathymetry_file, use_bathymetry, & + grid_type, grid_format, & + dxrect, dyrect + use ice_dyn_shared, only: ndte, kdyn, revised_evp, yield_curve, & + basalstress, k1, Ktens, e_ratio, coriolis, & + kridge, ktransport + use ice_transport_driver, only: advection + use ice_restoring, only: restore_ice +#ifdef CESMCOUPLED + use shr_file_mod, only: shr_file_setIO +#endif + + ! local variables + + integer (kind=int_kind) :: & + nml_error, & ! namelist i/o error flag + n ! loop index + + character (len=6) :: chartmp + + logical :: exists + + real (kind=dbl_kind) :: ustar_min, albicev, albicei, albsnowv, albsnowi, & + ahmax, R_ice, R_pnd, R_snw, dT_mlt, rsnw_mlt, emissivity, & + mu_rdg, hs0, dpscale, rfracmin, rfracmax, pndaspect, hs1, hp1, & + a_rapid_mode, Rac_rapid_mode, aspect_rapid_mode, dSdt_slow_mode, & + phi_c_slow_mode, phi_i_mushy, kalg + + integer (kind=int_kind) :: ktherm, kstrength, krdg_partic, krdg_redist, natmiter, & + kitd, kcatbound + + character (len=char_len) :: shortwave, albedo_type, conduct, fbot_xfer_type, & + tfrz_option, frzpnd, atmbndy + + logical (kind=log_kind) :: calc_Tsfc, formdrag, highfreq, calc_strair + + logical (kind=log_kind) :: tr_iage, tr_FY, tr_lvl, tr_pond, tr_aero + logical (kind=log_kind) :: tr_pond_cesm, tr_pond_lvl, tr_pond_topo + integer (kind=int_kind) :: nt_Tsfc, nt_sice, nt_qice, nt_qsno, nt_iage, nt_FY + integer (kind=int_kind) :: nt_alvl, nt_vlvl, nt_apnd, nt_hpnd, nt_ipnd, nt_aero + integer (kind=int_kind) :: numin, numax ! unit number limits + + integer (kind=int_kind) :: rpcesm, rplvl, rptopo + real (kind=dbl_kind) :: Cf, puny + integer :: abort_flag + + character(len=*), parameter :: subname='(input_data)' + + !----------------------------------------------------------------- + ! Namelist variables + !----------------------------------------------------------------- + + namelist /setup_nml/ & + days_per_year, use_leap_years, year_init, istep0, & + dt, npt, ndtd, numin, & + runtype, runid, bfbflag, numax, & + ice_ic, restart, restart_dir, restart_file, & + restart_ext, use_restart_time, restart_format, lcdf64, & + pointer_file, dumpfreq, dumpfreq_n, dump_last, & + diagfreq, diag_type, diag_file, & + print_global, print_points, latpnt, lonpnt, & + dbug, histfreq, histfreq_n, hist_avg, & + history_dir, history_file, cpl_bgc, & + write_ic, incond_dir, incond_file, version_name + + namelist /grid_nml/ & + grid_format, grid_type, grid_file, kmt_file, & + bathymetry_file, use_bathymetry, & + ncat, nilyr, nslyr, nblyr, & + kcatbound, gridcpl_file, dxrect, dyrect, & + close_boundaries + + namelist /thermo_nml/ & + kitd, ktherm, conduct, & + a_rapid_mode, Rac_rapid_mode, aspect_rapid_mode, & + dSdt_slow_mode, phi_c_slow_mode, phi_i_mushy + + namelist /dynamics_nml/ & + kdyn, ndte, revised_evp, yield_curve, & + advection, coriolis, kridge, ktransport, & + kstrength, krdg_partic, krdg_redist, mu_rdg, & + e_ratio, Ktens, Cf, basalstress, & + k1 + + namelist /shortwave_nml/ & + shortwave, albedo_type, & + albicev, albicei, albsnowv, albsnowi, & + ahmax, R_ice, R_pnd, R_snw, & + dT_mlt, rsnw_mlt, kalg + + namelist /ponds_nml/ & + hs0, dpscale, frzpnd, & + rfracmin, rfracmax, pndaspect, hs1, & + hp1 + + namelist /forcing_nml/ & + formdrag, atmbndy, calc_strair, calc_Tsfc, & + highfreq, natmiter, ustar_min, emissivity, & + fbot_xfer_type, update_ocn_f, l_mpond_fresh, tfrz_option, & + oceanmixed_ice, restore_ice, restore_ocn, trestore, & + precip_units, default_season, & + atm_data_type, ocn_data_type, bgc_data_type, & + sil_data_type, nit_data_type, fe_data_type, & + fyear_init, ycycle, & + atm_data_dir, ocn_data_dir, bgc_data_dir, & + atm_data_format, ocn_data_format, & + oceanmixed_file + + namelist /tracer_nml/ & + tr_iage, restart_age, & + tr_FY, restart_FY, & + tr_lvl, restart_lvl, & + tr_pond_cesm, restart_pond_cesm, & + tr_pond_lvl, restart_pond_lvl, & + tr_pond_topo, restart_pond_topo, & + tr_aero, restart_aero, & + n_aero, n_zaero, n_algae, & + n_doc, n_dic, n_don, n_fed, n_fep + + !----------------------------------------------------------------- + ! default values + !----------------------------------------------------------------- + + abort_flag = 0 + + call icepack_query_parameters(puny_out=puny) +! nu_diag not yet defined +! call icepack_warnings_flush(nu_diag) +! if (icepack_warnings_aborted()) call abort_ice(error_message=subname//'Icepack Abort0', & +! file=__FILE__, line=__LINE__) + + days_per_year = 365 ! number of days in a year + use_leap_years= .false.! if true, use leap years (Feb 29) + year_init = 0 ! initial year + istep0 = 0 ! no. of steps taken in previous integrations, + ! real (dumped) or imagined (to set calendar) +#ifndef CESMCOUPLED + dt = 3600.0_dbl_kind ! time step, s +#endif + numin = 11 ! min allowed unit number + numax = 99 ! max allowed unit number + npt = 99999 ! total number of time steps (dt) + diagfreq = 24 ! how often diag output is written + print_points = .false. ! if true, print point data + print_global = .true. ! if true, print global diagnostic data + bfbflag = .false. ! if true, do bit-for-bit computations + diag_type = 'stdout' + diag_file = 'ice_diag.d' + histfreq(1) = '1' ! output frequency option for different streams + histfreq(2) = 'h' ! output frequency option for different streams + histfreq(3) = 'd' ! output frequency option for different streams + histfreq(4) = 'm' ! output frequency option for different streams + histfreq(5) = 'y' ! output frequency option for different streams + histfreq_n(:) = 1 ! output frequency + hist_avg = .true. ! if true, write time-averages (not snapshots) + history_dir = './' ! write to executable dir for default + history_file = 'iceh' ! history file name prefix + write_ic = .false. ! write out initial condition + cpl_bgc = .false. ! history file name prefix + incond_dir = history_dir ! write to history dir for default + incond_file = 'iceh_ic'! file prefix + dumpfreq='y' ! restart frequency option + dumpfreq_n = 1 ! restart frequency + dump_last = .false. ! write restart on last time step + restart = .false. ! if true, read restart files for initialization + restart_dir = './' ! write to executable dir for default + restart_file = 'iced' ! restart file name prefix + restart_ext = .false. ! if true, read/write ghost cells + use_restart_time = .true. ! if true, use time info written in file + pointer_file = 'ice.restart_file' + restart_format = 'nc' ! file format ('bin'=binary or 'nc'=netcdf or 'pio') + lcdf64 = .false. ! 64 bit offset for netCDF + ice_ic = 'default' ! latitude and sst-dependent + grid_format = 'bin' ! file format ('bin'=binary or 'nc'=netcdf) + grid_type = 'rectangular' ! define rectangular grid internally + grid_file = 'unknown_grid_file' + gridcpl_file = 'unknown_gridcpl_file' + bathymetry_file = 'unknown_bathymetry_file' + use_bathymetry = .false. + kmt_file = 'unknown_kmt_file' + version_name = 'unknown_version_name' + ncat = 0 + nilyr = 0 + nslyr = 0 + nblyr = 0 + + kitd = 1 ! type of itd conversions (0 = delta, 1 = linear) + kcatbound = 1 ! category boundary formula (0 = old, 1 = new, etc) + kdyn = 1 ! type of dynamics (-1, 0 = off, 1 = evp, 2 = eap) + ndtd = 1 ! dynamic time steps per thermodynamic time step + ndte = 120 ! subcycles per dynamics timestep: ndte=dt_dyn/dte + revised_evp = .false. ! if true, use revised procedure for evp dynamics + yield_curve = 'ellipse' + kstrength = 1 ! 1 = Rothrock 75 strength, 0 = Hibler 79 + krdg_partic = 1 ! 1 = new participation, 0 = Thorndike et al 75 + krdg_redist = 1 ! 1 = new redistribution, 0 = Hibler 80 + mu_rdg = 3 ! e-folding scale of ridged ice, krdg_partic=1 (m^0.5) + Cf = 17.0_dbl_kind ! ratio of ridging work to PE change in ridging + close_boundaries = .false. ! true = set land on edges of grid + basalstress= .false. ! if true, basal stress for landfast is on + k1 = 8.0_dbl_kind ! 1st free parameter for landfast parameterization + Ktens = 0.0_dbl_kind ! T=Ktens*P (tensile strength: see Konig and Holland, 2010) + e_ratio = 2.0_dbl_kind ! EVP ellipse aspect ratio + advection = 'remap' ! incremental remapping transport scheme + shortwave = 'ccsm3' ! 'ccsm3' or 'dEdd' (delta-Eddington) + albedo_type = 'ccsm3' ! 'ccsm3' or 'constant' + ktherm = 1 ! -1 = OFF, 0 = 0-layer, 1 = BL99, 2 = mushy thermo + conduct = 'bubbly' ! 'MU71' or 'bubbly' (Pringle et al 2007) + coriolis = 'latitude' ! latitude dependent, or 'constant' + kridge = 1 ! -1 = off, 1 = on + ktransport = 1 ! -1 = off, 1 = on + calc_Tsfc = .true. ! calculate surface temperature + update_ocn_f = .false. ! include fresh water and salt fluxes for frazil + ustar_min = 0.005 ! minimum friction velocity for ocean heat flux (m/s) + emissivity = 0.95 ! emissivity of snow and ice + l_mpond_fresh = .false. ! logical switch for including meltpond freshwater + ! flux feedback to ocean model + fbot_xfer_type = 'constant' ! transfer coefficient type for ocn heat flux + R_ice = 0.00_dbl_kind ! tuning parameter for sea ice + R_pnd = 0.00_dbl_kind ! tuning parameter for ponded sea ice + R_snw = 1.50_dbl_kind ! tuning parameter for snow over sea ice + dT_mlt = 1.5_dbl_kind ! change in temp to give non-melt to melt change + ! in snow grain radius + rsnw_mlt = 1500._dbl_kind ! maximum melting snow grain radius + kalg = 0.60_dbl_kind ! algae absorption coefficient for 0.5 m thick layer + ! 0.5 m path of 75 mg Chl a / m2 + hp1 = 0.01_dbl_kind ! critical pond lid thickness for topo ponds + hs0 = 0.03_dbl_kind ! snow depth for transition to bare sea ice (m) + hs1 = 0.03_dbl_kind ! snow depth for transition to bare pond ice (m) + dpscale = c1 ! alter e-folding time scale for flushing + frzpnd = 'cesm' ! melt pond refreezing parameterization + rfracmin = 0.15_dbl_kind ! minimum retained fraction of meltwater + rfracmax = 0.85_dbl_kind ! maximum retained fraction of meltwater + pndaspect = 0.8_dbl_kind ! ratio of pond depth to area fraction + albicev = 0.78_dbl_kind ! visible ice albedo for h > ahmax + albicei = 0.36_dbl_kind ! near-ir ice albedo for h > ahmax + albsnowv = 0.98_dbl_kind ! cold snow albedo, visible + albsnowi = 0.70_dbl_kind ! cold snow albedo, near IR + ahmax = 0.3_dbl_kind ! thickness above which ice albedo is constant (m) + atmbndy = 'default' ! or 'constant' + default_season = 'winter' ! default forcing data, if data is not read in + fyear_init = 1900 ! first year of forcing cycle + ycycle = 1 ! number of years in forcing cycle + atm_data_format = 'bin' ! file format ('bin'=binary or 'nc'=netcdf) + atm_data_type = 'default' + atm_data_dir = ' ' + calc_strair = .true. ! calculate wind stress + formdrag = .false. ! calculate form drag + highfreq = .false. ! calculate high frequency RASM coupling + natmiter = 5 ! number of iterations for atm boundary layer calcs + precip_units = 'mks' ! 'mm_per_month' or + ! 'mm_per_sec' = 'mks' = kg/m^2 s + tfrz_option = 'mushy' ! freezing temp formulation + oceanmixed_ice = .false. ! if true, use internal ocean mixed layer + ocn_data_format = 'bin' ! file format ('bin'=binary or 'nc'=netcdf) + bgc_data_type = 'default' + sil_data_type = 'default' + nit_data_type = 'default' + fe_data_type = 'default' + bgc_data_dir = 'unknown_bgc_data_dir' + ocn_data_type = 'default' + ocn_data_dir = 'unknown_ocn_data_dir' + oceanmixed_file = 'unknown_oceanmixed_file' ! ocean forcing data + restore_ocn = .false. ! restore sst if true + trestore = 90 ! restoring timescale, days (0 instantaneous) + restore_ice = .false. ! restore ice state on grid edges if true + dbug = .false. ! true writes diagnostics for input forcing + + latpnt(1) = 90._dbl_kind ! latitude of diagnostic point 1 (deg) + lonpnt(1) = 0._dbl_kind ! longitude of point 1 (deg) + latpnt(2) = -65._dbl_kind ! latitude of diagnostic point 2 (deg) + lonpnt(2) = -45._dbl_kind ! longitude of point 2 (deg) + +#ifndef CESMCOUPLED + runid = 'unknown' ! run ID used in CESM and for machine 'bering' + runtype = 'initial' ! run type: 'initial', 'continue' +#endif + + ! extra tracers + tr_iage = .false. ! ice age + restart_age = .false. ! ice age restart + tr_FY = .false. ! ice age + restart_FY = .false. ! ice age restart + tr_lvl = .false. ! level ice + restart_lvl = .false. ! level ice restart + tr_pond_cesm = .false. ! CESM melt ponds + restart_pond_cesm = .false. ! melt ponds restart + tr_pond_lvl = .false. ! level-ice melt ponds + restart_pond_lvl = .false. ! melt ponds restart + tr_pond_topo = .false. ! explicit melt ponds (topographic) + restart_pond_topo = .false. ! melt ponds restart + tr_aero = .false. ! aerosols + restart_aero = .false. ! aerosols restart + + n_aero = 0 + n_zaero = 0 + n_algae = 0 + n_doc = 0 + n_dic = 0 + n_don = 0 + n_fed = 0 + n_fep = 0 + + ! mushy layer gravity drainage physics + a_rapid_mode = 0.5e-3_dbl_kind ! channel radius for rapid drainage mode (m) + Rac_rapid_mode = 10.0_dbl_kind ! critical Rayleigh number + aspect_rapid_mode = 1.0_dbl_kind ! aspect ratio (larger is wider) + dSdt_slow_mode = -1.5e-7_dbl_kind ! slow mode drainage strength (m s-1 K-1) + phi_c_slow_mode = 0.05_dbl_kind ! critical liquid fraction porosity cutoff + phi_i_mushy = 0.85_dbl_kind ! liquid fraction of congelation ice + + !----------------------------------------------------------------- + ! read from input file + !----------------------------------------------------------------- + +#ifdef CESMCOUPLED + nml_filename = 'ice_in'//trim(inst_suffix) +#endif + + call get_fileunit(nu_nml) + + if (my_task == master_task) then + open (nu_nml, file=nml_filename, status='old',iostat=nml_error) + if (nml_error /= 0) then + nml_error = -1 + else + nml_error = 1 + endif + + do while (nml_error > 0) + print*,'Reading setup_nml' + read(nu_nml, nml=setup_nml,iostat=nml_error) + if (nml_error /= 0) exit + print*,'Reading grid_nml' + read(nu_nml, nml=grid_nml,iostat=nml_error) + if (nml_error /= 0) exit + print*,'Reading tracer_nml' + read(nu_nml, nml=tracer_nml,iostat=nml_error) + if (nml_error /= 0) exit + print*,'Reading thermo_nml' + read(nu_nml, nml=thermo_nml,iostat=nml_error) + if (nml_error /= 0) exit + print*,'Reading dynamics_nml' + read(nu_nml, nml=dynamics_nml,iostat=nml_error) + if (nml_error /= 0) exit + print*,'Reading shortwave_nml' + read(nu_nml, nml=shortwave_nml,iostat=nml_error) + if (nml_error /= 0) exit + print*,'Reading ponds_nml' + read(nu_nml, nml=ponds_nml,iostat=nml_error) + if (nml_error /= 0) exit + print*,'Reading forcing_nml' + read(nu_nml, nml=forcing_nml,iostat=nml_error) + if (nml_error /= 0) exit + end do + if (nml_error == 0) close(nu_nml) + endif + call broadcast_scalar(nml_error, master_task) + if (nml_error /= 0) then + call abort_ice(subname//'ERROR: reading namelist', & + file=__FILE__, line=__LINE__) + endif + call release_fileunit(nu_nml) + + !----------------------------------------------------------------- + ! set up diagnostics output and resolve conflicts + !----------------------------------------------------------------- + +#ifdef CESMCOUPLED + ! Note in CESMCOUPLED mode diag_file is not utilized and + ! runid and runtype are obtained from the driver, not from the namelist + + if (my_task == master_task) then + history_file = trim(runid) // ".cice" // trim(inst_suffix) //".h" + restart_file = trim(runid) // ".cice" // trim(inst_suffix) //".r" + incond_file = trim(runid) // ".cice" // trim(inst_suffix) //".i" + inquire(file='ice_modelio.nml'//trim(inst_suffix),exist=exists) + if (exists) then + call get_fileUnit(nu_diag) + call shr_file_setIO('ice_modelio.nml'//trim(inst_suffix),nu_diag) + end if + else + ! each task gets unique ice log filename when if test is true, for debugging + if (1 == 0) then + call get_fileUnit(nu_diag) + write(str,'(a,i4.4)') "ice.log.task_",my_task + open(nu_diag,file=str) + endif + end if + if (trim(ice_ic) /= 'default' .and. trim(ice_ic) /= 'none') then + restart = .true. + end if +#else + if (trim(diag_type) == 'file') call get_fileunit(nu_diag) +#endif + + !----------------------------------------------------------------- + ! broadcast namelist settings + !----------------------------------------------------------------- + + call broadcast_scalar(numin, master_task) + call broadcast_scalar(numax, master_task) + call broadcast_scalar(days_per_year, master_task) + call broadcast_scalar(use_leap_years, master_task) + call broadcast_scalar(year_init, master_task) + call broadcast_scalar(istep0, master_task) + call broadcast_scalar(dt, master_task) + call broadcast_scalar(npt, master_task) + call broadcast_scalar(diagfreq, master_task) + call broadcast_scalar(print_points, master_task) + call broadcast_scalar(print_global, master_task) + call broadcast_scalar(bfbflag, master_task) + call broadcast_scalar(diag_type, master_task) + call broadcast_scalar(diag_file, master_task) + do n = 1, max_nstrm + call broadcast_scalar(histfreq(n), master_task) + enddo + call broadcast_array(histfreq_n, master_task) + call broadcast_scalar(hist_avg, master_task) + call broadcast_scalar(history_dir, master_task) + call broadcast_scalar(history_file, master_task) + call broadcast_scalar(write_ic, master_task) + call broadcast_scalar(cpl_bgc, master_task) + call broadcast_scalar(incond_dir, master_task) + call broadcast_scalar(incond_file, master_task) + call broadcast_scalar(dumpfreq, master_task) + call broadcast_scalar(dumpfreq_n, master_task) + call broadcast_scalar(dump_last, master_task) + call broadcast_scalar(restart_file, master_task) + call broadcast_scalar(restart, master_task) + call broadcast_scalar(restart_dir, master_task) + call broadcast_scalar(restart_ext, master_task) + call broadcast_scalar(use_restart_time, master_task) + call broadcast_scalar(restart_format, master_task) + call broadcast_scalar(lcdf64, master_task) + call broadcast_scalar(pointer_file, master_task) + call broadcast_scalar(ice_ic, master_task) + call broadcast_scalar(grid_format, master_task) + call broadcast_scalar(dxrect, master_task) + call broadcast_scalar(dyrect, master_task) + call broadcast_scalar(close_boundaries, master_task) + call broadcast_scalar(grid_type, master_task) + call broadcast_scalar(grid_file, master_task) + call broadcast_scalar(gridcpl_file, master_task) + call broadcast_scalar(bathymetry_file, master_task) + call broadcast_scalar(use_bathymetry, master_task) + call broadcast_scalar(kmt_file, master_task) + call broadcast_scalar(kitd, master_task) + call broadcast_scalar(kcatbound, master_task) + call broadcast_scalar(kdyn, master_task) + call broadcast_scalar(ndtd, master_task) + call broadcast_scalar(ndte, master_task) + call broadcast_scalar(revised_evp, master_task) + call broadcast_scalar(yield_curve, master_task) + call broadcast_scalar(kstrength, master_task) + call broadcast_scalar(krdg_partic, master_task) + call broadcast_scalar(krdg_redist, master_task) + call broadcast_scalar(mu_rdg, master_task) + call broadcast_scalar(Cf, master_task) + call broadcast_scalar(basalstress, master_task) + call broadcast_scalar(k1, master_task) + call broadcast_scalar(Ktens, master_task) + call broadcast_scalar(e_ratio, master_task) + call broadcast_scalar(advection, master_task) + call broadcast_scalar(shortwave, master_task) + call broadcast_scalar(albedo_type, master_task) + call broadcast_scalar(ktherm, master_task) + call broadcast_scalar(coriolis, master_task) + call broadcast_scalar(kridge, master_task) + call broadcast_scalar(ktransport, master_task) + call broadcast_scalar(conduct, master_task) + call broadcast_scalar(R_ice, master_task) + call broadcast_scalar(R_pnd, master_task) + call broadcast_scalar(R_snw, master_task) + call broadcast_scalar(dT_mlt, master_task) + call broadcast_scalar(rsnw_mlt, master_task) + call broadcast_scalar(kalg, master_task) + call broadcast_scalar(hp1, master_task) + call broadcast_scalar(hs0, master_task) + call broadcast_scalar(hs1, master_task) + call broadcast_scalar(dpscale, master_task) + call broadcast_scalar(frzpnd, master_task) + call broadcast_scalar(rfracmin, master_task) + call broadcast_scalar(rfracmax, master_task) + call broadcast_scalar(pndaspect, master_task) + call broadcast_scalar(albicev, master_task) + call broadcast_scalar(albicei, master_task) + call broadcast_scalar(albsnowv, master_task) + call broadcast_scalar(albsnowi, master_task) + call broadcast_scalar(ahmax, master_task) + call broadcast_scalar(atmbndy, master_task) + call broadcast_scalar(fyear_init, master_task) + call broadcast_scalar(ycycle, master_task) + call broadcast_scalar(atm_data_format, master_task) + call broadcast_scalar(atm_data_type, master_task) + call broadcast_scalar(atm_data_dir, master_task) + call broadcast_scalar(calc_strair, master_task) + call broadcast_scalar(calc_Tsfc, master_task) + call broadcast_scalar(formdrag, master_task) + call broadcast_scalar(highfreq, master_task) + call broadcast_scalar(natmiter, master_task) + call broadcast_scalar(update_ocn_f, master_task) + call broadcast_scalar(l_mpond_fresh, master_task) + call broadcast_scalar(ustar_min, master_task) + call broadcast_scalar(emissivity, master_task) + call broadcast_scalar(fbot_xfer_type, master_task) + call broadcast_scalar(precip_units, master_task) + call broadcast_scalar(oceanmixed_ice, master_task) + call broadcast_scalar(tfrz_option, master_task) + call broadcast_scalar(ocn_data_format, master_task) + call broadcast_scalar(bgc_data_type, master_task) + call broadcast_scalar(sil_data_type, master_task) + call broadcast_scalar(nit_data_type, master_task) + call broadcast_scalar(fe_data_type, master_task) + call broadcast_scalar(bgc_data_dir, master_task) + call broadcast_scalar(ocn_data_type, master_task) + call broadcast_scalar(ocn_data_dir, master_task) + call broadcast_scalar(oceanmixed_file, master_task) + call broadcast_scalar(restore_ocn, master_task) + call broadcast_scalar(trestore, master_task) + call broadcast_scalar(restore_ice, master_task) + call broadcast_scalar(dbug, master_task) + call broadcast_array (latpnt(1:2), master_task) + call broadcast_array (lonpnt(1:2), master_task) + call broadcast_scalar(runid, master_task) + call broadcast_scalar(runtype, master_task) + + if (dbug) & ! else only master_task writes to file + call broadcast_scalar(nu_diag, master_task) + + ! tracers + call broadcast_scalar(tr_iage, master_task) + call broadcast_scalar(restart_age, master_task) + call broadcast_scalar(tr_FY, master_task) + call broadcast_scalar(restart_FY, master_task) + call broadcast_scalar(tr_lvl, master_task) + call broadcast_scalar(restart_lvl, master_task) + call broadcast_scalar(tr_pond_cesm, master_task) + call broadcast_scalar(restart_pond_cesm, master_task) + call broadcast_scalar(tr_pond_lvl, master_task) + call broadcast_scalar(restart_pond_lvl, master_task) + call broadcast_scalar(tr_pond_topo, master_task) + call broadcast_scalar(restart_pond_topo, master_task) + call broadcast_scalar(tr_aero, master_task) + call broadcast_scalar(restart_aero, master_task) + call broadcast_scalar(ncat, master_task) + call broadcast_scalar(nilyr, master_task) + call broadcast_scalar(nslyr, master_task) + call broadcast_scalar(nblyr, master_task) + call broadcast_scalar(n_aero, master_task) + call broadcast_scalar(n_zaero, master_task) + call broadcast_scalar(n_algae, master_task) + call broadcast_scalar(n_doc, master_task) + call broadcast_scalar(n_dic, master_task) + call broadcast_scalar(n_don, master_task) + call broadcast_scalar(n_fed, master_task) + call broadcast_scalar(n_fep, master_task) + call broadcast_scalar(a_rapid_mode, master_task) + call broadcast_scalar(Rac_rapid_mode, master_task) + call broadcast_scalar(aspect_rapid_mode, master_task) + call broadcast_scalar(dSdt_slow_mode, master_task) + call broadcast_scalar(phi_c_slow_mode, master_task) + call broadcast_scalar(phi_i_mushy, master_task) + +#ifdef CESMCOUPLED + pointer_file = trim(pointer_file) // trim(inst_suffix) +#endif + + !----------------------------------------------------------------- + ! verify inputs + !----------------------------------------------------------------- + + if (my_task == master_task) then + if (trim(diag_type) == 'file') then + write(ice_stdout,*) 'Diagnostic output will be in file ',diag_file + open (nu_diag, file=diag_file, status='unknown') + endif + write(nu_diag,*) '--------------------------------' + write(nu_diag,*) ' ',subname + write(nu_diag,*) ' CICE model diagnostic output ' + write(nu_diag,*) '--------------------------------' + write(nu_diag,*) ' ' + endif + + if (trim(runtype) == 'continue' .and. .not.restart) then + if (my_task == master_task) & + write(nu_diag,*) subname//' WARNING: runtype=continue, setting restart=.true.' + restart = .true. + endif + + if (trim(runtype) /= 'continue' .and. restart .and. & + (ice_ic == 'none' .or. ice_ic == 'default')) then + if (my_task == master_task) & + write(nu_diag,*) subname//' WARNING: runtype ne continue and ice_ic=none|default, setting restart=.false.' + restart = .false. + endif + + if (trim(runtype) /= 'continue' .and. (ice_ic == 'none' .or. ice_ic == 'default')) then + if (my_task == master_task) & + write(nu_diag,*) subname//' WARNING: ice_ic = none or default, setting restart flags to .false.' + restart = .false. + restart_aero = .false. + restart_age = .false. + restart_fy = .false. + restart_lvl = .false. + restart_pond_cesm = .false. + restart_pond_lvl = .false. + restart_pond_topo = .false. + restart_bgc = .false. + restart_hbrine = .false. + restart_zsal = .false. +! tcraig, OK to leave as true, needed for boxrestore case +! restart_ext = .false. + endif + + if (trim(runtype) == 'initial' .and. .not.(restart) .and. & + ice_ic /= 'none' .and. ice_ic /= 'default') then + if (my_task == master_task) then + write(nu_diag,*) subname//' ERROR: runtype, restart, ice_ic are inconsistent:' + write(nu_diag,*) subname//' ERROR: runtype=',trim(runtype), 'restart=',restart, 'ice_ic=',trim(ice_ic) + write(nu_diag,*) subname//' ERROR: Please review user guide' + endif + abort_flag = 1 + endif + +#ifndef ncdf + if (grid_format /= 'bin' .or. atm_data_format /= 'bin' .or. ocn_data_format /= 'bin') then + if (my_task == master_task) then + write(nu_diag,*) subname//' ERROR: ncdf CPP flag unset, data formats must be bin' + write(nu_diag,*) subname//' ERROR: check grid_format, atm_data_format, ocn_data_format or set ncdf CPP' + endif + abort_flag = 2 + endif +#endif + + if (advection /= 'remap' .and. advection /= 'upwind' .and. advection /= 'none') then + if (my_task == master_task) write(nu_diag,*) subname//' ERROR: invalid advection=',trim(advection) + abort_flag = 3 + endif + + if (ncat == 1 .and. kitd == 1) then + if (my_task == master_task) then + write(nu_diag,*) subname//' ERROR: kitd incompatability: ncat=1 and kitd=1' + write(nu_diag,*) subname//' ERROR: Remapping the ITD is not allowed for ncat=1.' + write(nu_diag,*) subname//' ERROR: Use kitd = 0 (delta function ITD) with kcatbound = 0' + write(nu_diag,*) subname//' ERROR: or for column configurations use kcatbound = -1' + endif + abort_flag = 4 + endif + + if (ncat /= 1 .and. kcatbound == -1) then + if (my_task == master_task) then + write(nu_diag,*) subname//' ERROR: ITD required for ncat > 1' + write(nu_diag,*) subname//' ERROR: ncat=',ncat,' kcatbound=',kcatbound + write(nu_diag,*) subname//' ERROR: Please review user guide' + endif + abort_flag = 5 + endif + + if (kdyn == 2 .and. revised_evp) then + if (my_task == master_task) then + write(nu_diag,*) subname//' WARNING: revised_evp = T with EAP dynamics' + write(nu_diag,*) subname//' WARNING: revised_evp is ignored' + endif + revised_evp = .false. + endif + + rpcesm = 0 + rplvl = 0 + rptopo = 0 + if (tr_pond_cesm) rpcesm = 1 + if (tr_pond_lvl ) rplvl = 1 + if (tr_pond_topo) rptopo = 1 + + tr_pond = .false. ! explicit melt ponds + if (rpcesm + rplvl + rptopo > 0) tr_pond = .true. + + if (rpcesm + rplvl + rptopo > 1) then + if (my_task == master_task) then + write(nu_diag,*) subname//' ERROR: Must use only one melt pond scheme' + endif + abort_flag = 6 + endif + + if (tr_pond_lvl .and. .not. tr_lvl) then + if (my_task == master_task) then + write(nu_diag,*) subname//' ERROR: tr_pond_lvl=T but tr_lvl=F' + endif + abort_flag = 30 + endif + +! tcraig - this was originally implemented by resetting hs0=0. EH says it might be OK +! to not reset it but extra calculations are done and it might not be bfb. In our +! testing, we should explicitly set hs0 to 0. when setting tr_pond_lvl=T, and otherwise +! this will abort (safest option until additional testing is done) + if (tr_pond_lvl .and. abs(hs0) > puny) then + if (my_task == master_task) then + write(nu_diag,*) subname//' ERROR: tr_pond_lvl=T and hs0 /= 0' + endif + abort_flag = 7 + endif + + if (trim(shortwave) /= 'dEdd' .and. tr_pond .and. calc_tsfc) then + if (my_task == master_task) then + write(nu_diag,*) subname//' ERROR: tr_pond=T, calc_tsfc=T, invalid shortwave' + write(nu_diag,*) subname//' ERROR: Must use shortwave=dEdd' + endif + abort_flag = 8 + endif + + if (tr_aero .and. n_aero==0) then + if (my_task == master_task) then + write(nu_diag,*) subname//' ERROR: aerosols activated but' + write(nu_diag,*) subname//' ERROR: not allocated in tracer array.' + write(nu_diag,*) subname//' ERROR: Activate in compilation script.' + endif + abort_flag = 9 + endif + + if (trim(shortwave) /= 'dEdd' .and. tr_aero) then + if (my_task == master_task) then + write(nu_diag,*) subname//' ERROR: tr_aero=T, invalid shortwave' + write(nu_diag,*) subname//' ERROR: Must use shortwave=dEdd' + endif + abort_flag = 10 + endif + + if ((rfracmin < -puny .or. rfracmin > c1+puny) .or. & + (rfracmax < -puny .or. rfracmax > c1+puny) .or. & + (rfracmin > rfracmax)) then + if (my_task == master_task) then + write(nu_diag,*) subname//' ERROR: rfracmin, rfracmax must be between 0 and 1' + write(nu_diag,*) subname//' ERROR: and rfracmax >= rfracmin' + endif + abort_flag = 11 + endif + rfracmin = min(max(rfracmin,c0),c1) + rfracmax = min(max(rfracmax,c0),c1) + + if (trim(atm_data_type) == 'monthly' .and. calc_strair) then + if (my_task == master_task) write(nu_diag,*) subname//' ERROR: atm_data_type=monthly and calc_strair=T' + abort_flag = 12 + endif + + if (ktherm == 2 .and. .not. calc_Tsfc) then + if (my_task == master_task) write(nu_diag,*) subname//' ERROR: ktherm = 2 and calc_Tsfc=F' + abort_flag = 13 + endif + +! tcraig, is it really OK for users to run inconsistently? +! ech: yes, for testing sensitivities. It's not recommended for science runs + if (ktherm == 1 .and. trim(tfrz_option) /= 'linear_salt') then + if (my_task == master_task) then + write(nu_diag,*) subname//' WARNING: ktherm = 1 and tfrz_option = ',trim(tfrz_option) + write(nu_diag,*) subname//' WARNING: For consistency, set tfrz_option = linear_salt' + endif + endif + if (ktherm == 2 .and. trim(tfrz_option) /= 'mushy') then + if (my_task == master_task) then + write(nu_diag,*) subname//' WARNING: ktherm = 2 and tfrz_option = ',trim(tfrz_option) + write(nu_diag,*) subname//' WARNING: For consistency, set tfrz_option = mushy' + endif + endif +!tcraig + + if (formdrag) then + if (trim(atmbndy) == 'constant') then + if (my_task == master_task) write(nu_diag,*) subname//' ERROR: formdrag=T and atmbndy=constant' + abort_flag = 14 + endif + + if (.not. calc_strair) then + if (my_task == master_task) write(nu_diag,*) subname//' ERROR: formdrag=T and calc_strair=F' + abort_flag = 15 + endif + + if (.not. tr_pond) then + if (my_task == master_task) write(nu_diag,*) subname//' ERROR: formdrag=T and tr_pond=F' + abort_flag = 16 + endif + + if (tr_pond_cesm) then + if (my_task == master_task) write(nu_diag,*) subname//' ERROR: formdrag=T and frzpnd=cesm' + abort_flag = 17 + endif + + if (.not. tr_lvl) then + if (my_task == master_task) write(nu_diag,*) subname//' ERROR: formdrag=T and tr_lvl=F' + abort_flag = 18 + endif + endif + + if (trim(fbot_xfer_type) == 'Cdn_ocn' .and. .not. formdrag) then + if (my_task == master_task) write(nu_diag,*) subname//' ERROR: formdrag=F and fbot_xfer_type=Cdn_ocn' + abort_flag = 19 + endif + + ice_IOUnitsMinUnit = numin + ice_IOUnitsMaxUnit = numax + + call icepack_init_parameters(Cf_in=Cf) + call icepack_warnings_flush(nu_diag) + if (icepack_warnings_aborted()) call abort_ice(error_message=subname//'Icepack Abort1', & + file=__FILE__, line=__LINE__) + + !----------------------------------------------------------------- + ! spew + !----------------------------------------------------------------- + + if (my_task == master_task) then + + write(nu_diag,*) ' Document ice_in namelist parameters:' + write(nu_diag,*) ' ==================================== ' + write(nu_diag,*) ' ' + if (trim(runid) /= 'unknown') & + write(nu_diag,*) ' runid = ', & + trim(runid) + write(nu_diag,1030) ' runtype = ', & + trim(runtype) + write(nu_diag,1020) ' days_per_year = ', days_per_year + write(nu_diag,1010) ' use_leap_years = ', use_leap_years + write(nu_diag,1020) ' year_init = ', year_init + write(nu_diag,1020) ' istep0 = ', istep0 + write(nu_diag,1000) ' dt = ', dt + write(nu_diag,1020) ' npt = ', npt + write(nu_diag,1020) ' diagfreq = ', diagfreq + write(nu_diag,1010) ' print_global = ', print_global + write(nu_diag,1010) ' print_points = ', print_points + write(nu_diag,1010) ' bfbflag = ', bfbflag + write(nu_diag,1020) ' numin = ', numin + write(nu_diag,1020) ' numax = ', numax + write(nu_diag,1050) ' histfreq = ', histfreq(:) + write(nu_diag,1040) ' histfreq_n = ', histfreq_n(:) + write(nu_diag,1010) ' hist_avg = ', hist_avg + if (.not. hist_avg) write(nu_diag,*) 'History data will be snapshots' + write(nu_diag,*) ' history_dir = ', & + trim(history_dir) + write(nu_diag,*) ' history_file = ', & + trim(history_file) + if (write_ic) then + write(nu_diag,*) 'Initial condition will be written in ', & + trim(incond_dir) + endif + write(nu_diag,1030) ' dumpfreq = ', & + trim(dumpfreq) + write(nu_diag,1020) ' dumpfreq_n = ', dumpfreq_n + write(nu_diag,1010) ' dump_last = ', dump_last + write(nu_diag,1010) ' restart = ', restart + write(nu_diag,*) ' restart_dir = ', & + trim(restart_dir) + write(nu_diag,*) ' restart_ext = ', restart_ext + write(nu_diag,*) ' restart_format = ', & + trim(restart_format) + write(nu_diag,*) ' lcdf64 = ', & + lcdf64 + write(nu_diag,*) ' restart_file = ', & + trim(restart_file) + write(nu_diag,*) ' pointer_file = ', & + trim(pointer_file) + write(nu_diag,*) ' use_restart_time = ', use_restart_time + write(nu_diag,*) ' ice_ic = ', & + trim(ice_ic) + write(nu_diag,*) ' grid_type = ', & + trim(grid_type) + if (trim(grid_type) /= 'rectangular' .or. & + trim(grid_type) /= 'column') then + write(nu_diag,*) ' grid_file = ', & + trim(grid_file) + write(nu_diag,*) ' gridcpl_file = ', & + trim(gridcpl_file) + write(nu_diag,*) ' bathymetry_file = ', & + trim(bathymetry_file) + write(nu_diag,*) ' use_bathymetry = ', & + use_bathymetry + write(nu_diag,*) ' kmt_file = ', & + trim(kmt_file) + endif + write(nu_diag,1020) ' kitd = ', kitd + write(nu_diag,1020) ' kcatbound = ', & + kcatbound + write(nu_diag,1010) ' close_boundaries = ', & + close_boundaries + if (kdyn == 1) then + write(nu_diag,1021) ' kdyn = ','evp ', kdyn + elseif (kdyn == 2) then + write(nu_diag,1021) ' kdyn = ','eap ', kdyn + else + write(nu_diag,1020) ' kdyn = ', kdyn + endif + write(nu_diag,1020) ' ndtd = ', ndtd + write(nu_diag,1020) ' ndte = ', ndte + write(nu_diag,1010) ' revised_evp = ', & + revised_evp + if (kdyn == 1) & + write(nu_diag,*) ' yield_curve = ', & + trim(yield_curve) + write(nu_diag,1020) ' kstrength = ', kstrength + write(nu_diag,1030) ' coriolis = ', coriolis + write(nu_diag,1020) ' kridge = ', kridge + write(nu_diag,1020) ' ktransport = ', ktransport + write(nu_diag,1020) ' krdg_partic = ', & + krdg_partic + write(nu_diag,1020) ' krdg_redist = ', & + krdg_redist + if (krdg_redist == 1) & + write(nu_diag,1000) ' mu_rdg = ', mu_rdg + if (kstrength == 1) & + write(nu_diag,1000) ' Cf = ', Cf + write(nu_diag,1010) ' basalstress = ', basalstress + write(nu_diag,1005) ' k1 = ', k1 + write(nu_diag,1005) ' Ktens = ', Ktens + write(nu_diag,1005) ' e_ratio = ', e_ratio + write(nu_diag,1030) ' advection = ', & + trim(advection) + write(nu_diag,1030) ' shortwave = ', & + trim(shortwave) + if (cpl_bgc) then + write(nu_diag,1000) ' BGC coupling is switched ON' + else + write(nu_diag,1000) ' BGC coupling is switched OFF' + endif + + if (trim(shortwave) == 'dEdd') then + write(nu_diag,1000) ' R_ice = ', R_ice + write(nu_diag,1000) ' R_pnd = ', R_pnd + write(nu_diag,1000) ' R_snw = ', R_snw + write(nu_diag,1000) ' dT_mlt = ', dT_mlt + write(nu_diag,1000) ' rsnw_mlt = ', rsnw_mlt + write(nu_diag,1000) ' kalg = ', kalg + write(nu_diag,1000) ' hp1 = ', hp1 + write(nu_diag,1000) ' hs0 = ', hs0 + else + write(nu_diag,1030) ' albedo_type = ', & + trim(albedo_type) + write(nu_diag,1000) ' albicev = ', albicev + write(nu_diag,1000) ' albicei = ', albicei + write(nu_diag,1000) ' albsnowv = ', albsnowv + write(nu_diag,1000) ' albsnowi = ', albsnowi + write(nu_diag,1000) ' ahmax = ', ahmax + endif + + write(nu_diag,1000) ' rfracmin = ', rfracmin + write(nu_diag,1000) ' rfracmax = ', rfracmax + if (tr_pond_lvl) then + write(nu_diag,1000) ' hs1 = ', hs1 + write(nu_diag,1000) ' dpscale = ', dpscale + write(nu_diag,1030) ' frzpnd = ', trim(frzpnd) + endif + if (tr_pond .and. .not. tr_pond_lvl) & + write(nu_diag,1000) ' pndaspect = ', pndaspect + + write(nu_diag,1020) ' ktherm = ', ktherm + if (ktherm == 1) & + write(nu_diag,1030) ' conduct = ', conduct + if (ktherm == 2) then + write(nu_diag,1005) ' a_rapid_mode = ', a_rapid_mode + write(nu_diag,1005) ' Rac_rapid_mode = ', Rac_rapid_mode + write(nu_diag,1005) ' aspect_rapid_mode = ', aspect_rapid_mode + write(nu_diag,1005) ' dSdt_slow_mode = ', dSdt_slow_mode + write(nu_diag,1005) ' phi_c_slow_mode = ', phi_c_slow_mode + write(nu_diag,1005) ' phi_i_mushy = ', phi_i_mushy + endif + + write(nu_diag,1030) ' atmbndy = ', & + trim(atmbndy) + write(nu_diag,1010) ' formdrag = ', formdrag + write(nu_diag,1010) ' highfreq = ', highfreq + write(nu_diag,1020) ' natmiter = ', natmiter + write(nu_diag,1010) ' calc_strair = ', calc_strair + write(nu_diag,1010) ' calc_Tsfc = ', calc_Tsfc + + write(nu_diag,1020) ' fyear_init = ', & + fyear_init + write(nu_diag,1020) ' ycycle = ', ycycle + write(nu_diag,*) ' atm_data_type = ', & + trim(atm_data_type) + if (trim(atm_data_type) /= 'default') then + write(nu_diag,*) ' atm_data_dir = ', & + trim(atm_data_dir) + write(nu_diag,*) ' precip_units = ', & + trim(precip_units) + elseif (trim(atm_data_type)=='default') then + write(nu_diag,*) ' default_season = ', trim(default_season) + endif + + write(nu_diag,1010) ' update_ocn_f = ', update_ocn_f + write(nu_diag,1010) ' l_mpond_fresh = ', l_mpond_fresh + write(nu_diag,1005) ' ustar_min = ', ustar_min + write(nu_diag,1005) ' emissivity = ', emissivity + write(nu_diag, *) ' fbot_xfer_type = ', & + trim(fbot_xfer_type) + write(nu_diag,1010) ' oceanmixed_ice = ', & + oceanmixed_ice + write(nu_diag,*) ' tfrz_option = ', & + trim(tfrz_option) + if (trim(bgc_data_type) == 'ncar' .or. & + trim(ocn_data_type) == 'ncar') then + write(nu_diag,*) ' oceanmixed_file = ', & + trim(oceanmixed_file) + endif + write(nu_diag,*) ' bgc_data_type = ', & + trim(bgc_data_type) + write(nu_diag,*) ' sil_data_type = ', & + trim(sil_data_type) + write(nu_diag,*) ' nit_data_type = ', & + trim(nit_data_type) + write(nu_diag,*) ' fe_data_type = ', & + trim(fe_data_type) + write(nu_diag,*) ' bgc_data_dir = ', & + trim(bgc_data_dir) + write(nu_diag,*) ' ocn_data_type = ', & + trim(ocn_data_type) + if (trim(bgc_data_type) /= 'default' .or. & + trim(ocn_data_type) /= 'default') then + write(nu_diag,*) ' ocn_data_dir = ', & + trim(ocn_data_dir) + write(nu_diag,1010) ' restore_ocn = ', & + restore_ocn + endif + write(nu_diag,1010) ' restore_ice = ', & + restore_ice + if (restore_ice .or. restore_ocn) & + write(nu_diag,1020) ' trestore = ', trestore + +#ifdef coupled + if( oceanmixed_ice ) then + write(nu_diag,*) subname//' WARNING ** WARNING ** WARNING ** WARNING ' + write(nu_diag,*) subname//' WARNING: coupled CPP and oceanmixed_ice namelist are BOTH ON' + write(nu_diag,*) subname//' WARNING: Ocean data received from coupler will' + write(nu_diag,*) subname//' WARNING: be altered by mixed layer routine!' + write(nu_diag,*) subname//' WARNING ** WARNING ** WARNING ** WARNING ' + write(nu_diag,*) ' ' + endif +#endif + + write(nu_diag,*) ' ' + write(nu_diag,'(a30,2f8.2)') 'Diagnostic point 1: lat, lon =', & + latpnt(1), lonpnt(1) + write(nu_diag,'(a30,2f8.2)') 'Diagnostic point 2: lat, lon =', & + latpnt(2), lonpnt(2) + + ! tracers + write(nu_diag,1010) ' tr_iage = ', tr_iage + write(nu_diag,1010) ' restart_age = ', restart_age + write(nu_diag,1010) ' tr_FY = ', tr_FY + write(nu_diag,1010) ' restart_FY = ', restart_FY + write(nu_diag,1010) ' tr_lvl = ', tr_lvl + write(nu_diag,1010) ' restart_lvl = ', restart_lvl + write(nu_diag,1010) ' tr_pond_cesm = ', tr_pond_cesm + write(nu_diag,1010) ' restart_pond_cesm = ', restart_pond_cesm + write(nu_diag,1010) ' tr_pond_lvl = ', tr_pond_lvl + write(nu_diag,1010) ' restart_pond_lvl = ', restart_pond_lvl + write(nu_diag,1010) ' tr_pond_topo = ', tr_pond_topo + write(nu_diag,1010) ' restart_pond_topo = ', restart_pond_topo + write(nu_diag,1010) ' tr_aero = ', tr_aero + write(nu_diag,1010) ' restart_aero = ', restart_aero + + write(nu_diag,1020) ' ncat = ', ncat + write(nu_diag,1020) ' nilyr = ', nilyr + write(nu_diag,1020) ' nslyr = ', nslyr + write(nu_diag,1020) ' nblyr = ', nblyr + write(nu_diag,1020) ' n_aero = ', n_aero + write(nu_diag,1020) ' n_zaero = ', n_zaero + write(nu_diag,1020) ' n_algae = ', n_algae + write(nu_diag,1020) ' n_doc = ', n_doc + write(nu_diag,1020) ' n_dic = ', n_dic + write(nu_diag,1020) ' n_don = ', n_don + write(nu_diag,1020) ' n_fed = ', n_fed + write(nu_diag,1020) ' n_fep = ', n_fep + + endif ! my_task = master_task + + write(nu_diag,*) ' ' + if (grid_type /= 'displaced_pole' .and. & + grid_type /= 'tripole' .and. & + grid_type /= 'column' .and. & + grid_type /= 'rectangular' .and. & + grid_type /= 'cpom_grid' .and. & + grid_type /= 'regional' .and. & + grid_type /= 'latlon' ) then + if (my_task == master_task) write(nu_diag,*) subname//' ERROR: unknown grid_type=',trim(grid_type) + abort_flag = 20 + endif + + call flush_fileunit(nu_diag) + call icepack_init_parameters(ustar_min_in=ustar_min, albicev_in=albicev, albicei_in=albicei, & + albsnowv_in=albsnowv, albsnowi_in=albsnowi, natmiter_in=natmiter, emissivity_in=emissivity, & + ahmax_in=ahmax, shortwave_in=shortwave, albedo_type_in=albedo_type, R_ice_in=R_ice, R_pnd_in=R_pnd, & + R_snw_in=R_snw, dT_mlt_in=dT_mlt, rsnw_mlt_in=rsnw_mlt, & + kstrength_in=kstrength, krdg_partic_in=krdg_partic, krdg_redist_in=krdg_redist, mu_rdg_in=mu_rdg, & + atmbndy_in=atmbndy, calc_strair_in=calc_strair, formdrag_in=formdrag, highfreq_in=highfreq, & + kitd_in=kitd, kcatbound_in=kcatbound, hs0_in=hs0, dpscale_in=dpscale, frzpnd_in=frzpnd, & + rfracmin_in=rfracmin, rfracmax_in=rfracmax, pndaspect_in=pndaspect, hs1_in=hs1, hp1_in=hp1, & + ktherm_in=ktherm, calc_Tsfc_in=calc_Tsfc, conduct_in=conduct, & + a_rapid_mode_in=a_rapid_mode, Rac_rapid_mode_in=Rac_rapid_mode, & + aspect_rapid_mode_in=aspect_rapid_mode, dSdt_slow_mode_in=dSdt_slow_mode, & + phi_c_slow_mode_in=phi_c_slow_mode, phi_i_mushy_in=phi_i_mushy, & + tfrz_option_in=tfrz_option, kalg_in=kalg, fbot_xfer_type_in=fbot_xfer_type) + call icepack_init_tracer_flags(tr_iage_in=tr_iage, tr_FY_in=tr_FY, & + tr_lvl_in=tr_lvl, tr_aero_in=tr_aero, tr_pond_in=tr_pond, & + tr_pond_cesm_in=tr_pond_cesm, tr_pond_lvl_in=tr_pond_lvl, tr_pond_topo_in=tr_pond_topo) + + call flush_fileunit(nu_diag) + call ice_barrier() + if (abort_flag /= 0) then + write(nu_diag,*) subname,' ERROR: abort_flag=',abort_flag + call abort_ice (subname//' ABORTING on input ERRORS', & + file=__FILE__, line=__LINE__) + endif + + 1000 format (a30,2x,f9.2) ! a30 to align formatted, unformatted statements + 1005 format (a30,2x,f9.6) ! float + 1010 format (a30,2x,l6) ! logical + 1020 format (a30,2x,i6) ! integer + 1021 format (a30,2x,a8,i6) ! char, int + 1030 format (a30, a8) ! character + 1040 format (a30,2x,6i6) ! integer + 1050 format (a30,2x,6a6) ! character + + end subroutine input_data + +!======================================================================= + +! Initialize state for the itd model +! +! authors: C. M. Bitz, UW +! William H. Lipscomb, LANL + + subroutine init_state + + use ice_blocks, only: block, get_block, nx_block, ny_block + use ice_domain, only: nblocks, blocks_ice + use ice_domain_size, only: ncat, nilyr, nslyr, n_aero + use ice_flux, only: sst, Tf, Tair, salinz, Tmltz + use ice_grid, only: tmask, ULON, TLAT + use ice_state, only: trcr_depend, aicen, trcrn, vicen, vsnon, & + aice0, aice, vice, vsno, trcr, aice_init, bound_state, & + n_trcr_strata, nt_strata, trcr_base + + integer (kind=int_kind) :: & + ilo, ihi , & ! physical domain indices + jlo, jhi , & ! physical domain indices + iglob(nx_block), & ! global indices + jglob(ny_block), & ! global indices + i, j , & ! horizontal indices + k , & ! vertical index + it , & ! tracer index + iblk ! block index + + logical (kind=log_kind) :: & + heat_capacity ! from icepack + + integer (kind=int_kind) :: ntrcr + logical (kind=log_kind) :: tr_iage, tr_FY, tr_lvl, tr_aero + logical (kind=log_kind) :: tr_pond_cesm, tr_pond_lvl, tr_pond_topo + integer (kind=int_kind) :: nt_Tsfc, nt_sice, nt_qice, nt_qsno, nt_iage, nt_fy + integer (kind=int_kind) :: nt_alvl, nt_vlvl, nt_apnd, nt_hpnd, nt_ipnd, nt_aero + + type (block) :: & + this_block ! block information for current block + + character(len=*), parameter :: subname='(init_state)' + + !----------------------------------------------------------------- + + call icepack_query_parameters(heat_capacity_out=heat_capacity) + call icepack_query_tracer_numbers(ntrcr_out=ntrcr) + call icepack_query_tracer_flags(tr_iage_out=tr_iage, tr_FY_out=tr_FY, & + tr_lvl_out=tr_lvl, tr_aero_out=tr_aero, & + tr_pond_cesm_out=tr_pond_cesm, tr_pond_lvl_out=tr_pond_lvl, tr_pond_topo_out=tr_pond_topo) + call icepack_query_tracer_indices(nt_Tsfc_out=nt_Tsfc, nt_sice_out=nt_sice, & + nt_qice_out=nt_qice, nt_qsno_out=nt_qsno, nt_iage_out=nt_iage, nt_fy_out=nt_fy, & + nt_alvl_out=nt_alvl, nt_vlvl_out=nt_vlvl, nt_apnd_out=nt_apnd, nt_hpnd_out=nt_hpnd, & + nt_ipnd_out=nt_ipnd, nt_aero_out=nt_aero) + call icepack_warnings_flush(nu_diag) + if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & + file=__FILE__, line=__LINE__) + + !----------------------------------------------------------------- + ! Check number of layers in ice and snow. + !----------------------------------------------------------------- + + if (my_task == master_task) then + + if (nilyr < 1) then + write(nu_diag,*) subname//' ERROR: Must have at least one ice layer' + write(nu_diag,*) subname//' ERROR: nilyr =', nilyr + call abort_ice (error_message=subname//' Not enough ice layers', & + file=__FILE__, line=__LINE__) + endif + + if (nslyr < 1) then + write(nu_diag,*) subname//' ERROR: Must have at least one snow layer' + write(nu_diag,*) subname//' ERROR: nslyr =', nslyr + call abort_ice(error_message=subname//' Not enough snow layers', & + file=__FILE__, line=__LINE__) + endif + + if (.not.heat_capacity) then + + if (nilyr > 1) then + write(nu_diag,*) subname//' ERROR: Must have nilyr = 1 if heat_capacity=F' + write(nu_diag,*) subname//' ERROR: nilyr =', nilyr + call abort_ice(error_message=subname//' Too many ice layers', & + file=__FILE__, line=__LINE__) + endif + + if (nslyr > 1) then + write(nu_diag,*) subname//' ERROR: Must have nslyr = 1 if heat_capacity=F' + write(nu_diag,*) subname//' ERROR: nslyr =', nslyr + call abort_ice(error_message=subname//' Too many snow layers', & + file=__FILE__, line=__LINE__) + endif + + endif ! heat_capacity = F + + endif ! my_task + + !----------------------------------------------------------------- + ! Set tracer types + !----------------------------------------------------------------- + + trcr_depend(nt_Tsfc) = 0 ! ice/snow surface temperature + do k = 1, nilyr + trcr_depend(nt_sice + k - 1) = 1 ! volume-weighted ice salinity + trcr_depend(nt_qice + k - 1) = 1 ! volume-weighted ice enthalpy + enddo + do k = 1, nslyr + trcr_depend(nt_qsno + k - 1) = 2 ! volume-weighted snow enthalpy + enddo + if (tr_iage) trcr_depend(nt_iage) = 1 ! volume-weighted ice age + if (tr_FY) trcr_depend(nt_FY) = 0 ! area-weighted first-year ice area + if (tr_lvl) trcr_depend(nt_alvl) = 0 ! level ice area + if (tr_lvl) trcr_depend(nt_vlvl) = 1 ! level ice volume + if (tr_pond_cesm) then + trcr_depend(nt_apnd) = 0 ! melt pond area + trcr_depend(nt_hpnd) = 2+nt_apnd ! melt pond depth + endif + if (tr_pond_lvl) then + trcr_depend(nt_apnd) = 2+nt_alvl ! melt pond area + trcr_depend(nt_hpnd) = 2+nt_apnd ! melt pond depth + trcr_depend(nt_ipnd) = 2+nt_apnd ! refrozen pond lid + endif + if (tr_pond_topo) then + trcr_depend(nt_apnd) = 0 ! melt pond area + trcr_depend(nt_hpnd) = 2+nt_apnd ! melt pond depth + trcr_depend(nt_ipnd) = 2+nt_apnd ! refrozen pond lid + endif + if (tr_aero) then ! volume-weighted aerosols + do it = 1, n_aero + trcr_depend(nt_aero+(it-1)*4 ) = 2 ! snow + trcr_depend(nt_aero+(it-1)*4+1) = 2 ! snow + trcr_depend(nt_aero+(it-1)*4+2) = 1 ! ice + trcr_depend(nt_aero+(it-1)*4+3) = 1 ! ice + enddo + endif + + trcr_base = c0 + + do it = 1, ntrcr + ! mask for base quantity on which tracers are carried + if (trcr_depend(it) == 0) then ! area + trcr_base(it,1) = c1 + elseif (trcr_depend(it) == 1) then ! ice volume + trcr_base(it,2) = c1 + elseif (trcr_depend(it) == 2) then ! snow volume + trcr_base(it,3) = c1 + else + trcr_base(it,1) = c1 ! default: ice area + trcr_base(it,2) = c0 + trcr_base(it,3) = c0 + endif + + ! initialize number of underlying tracer layers + n_trcr_strata(it) = 0 + ! default indices of underlying tracer layers + nt_strata (it,1) = 0 + nt_strata (it,2) = 0 + enddo + + if (tr_pond_cesm) then + n_trcr_strata(nt_hpnd) = 1 ! melt pond depth + nt_strata (nt_hpnd,1) = nt_apnd ! on melt pond area + endif + if (tr_pond_lvl) then + n_trcr_strata(nt_apnd) = 1 ! melt pond area + nt_strata (nt_apnd,1) = nt_alvl ! on level ice area + n_trcr_strata(nt_hpnd) = 2 ! melt pond depth + nt_strata (nt_hpnd,2) = nt_apnd ! on melt pond area + nt_strata (nt_hpnd,1) = nt_alvl ! on level ice area + n_trcr_strata(nt_ipnd) = 2 ! refrozen pond lid + nt_strata (nt_ipnd,2) = nt_apnd ! on melt pond area + nt_strata (nt_ipnd,1) = nt_alvl ! on level ice area + endif + if (tr_pond_topo) then + n_trcr_strata(nt_hpnd) = 1 ! melt pond depth + nt_strata (nt_hpnd,1) = nt_apnd ! on melt pond area + n_trcr_strata(nt_ipnd) = 1 ! refrozen pond lid + nt_strata (nt_ipnd,1) = nt_apnd ! on melt pond area + endif + + !----------------------------------------------------------------- + ! Set state variables + !----------------------------------------------------------------- + + !$OMP PARALLEL DO PRIVATE(iblk,ilo,ihi,jlo,jhi,this_block, & + !$OMP iglob,jglob) + do iblk = 1, nblocks + + this_block = get_block(blocks_ice(iblk),iblk) + ilo = this_block%ilo + ihi = this_block%ihi + jlo = this_block%jlo + jhi = this_block%jhi + iglob = this_block%i_glob + jglob = this_block%j_glob + + call set_state_var (nx_block, ny_block, & + ilo, ihi, jlo, jhi, & + iglob, jglob, & + ice_ic, tmask(:,:, iblk), & + ULON (:,:, iblk), & + TLAT (:,:, iblk), & + Tair (:,:, iblk), sst (:,:, iblk), & + Tf (:,:, iblk), & + salinz(:,:,:, iblk), Tmltz(:,:,:, iblk), & + aicen(:,:, :,iblk), trcrn(:,:,:,:,iblk), & + vicen(:,:, :,iblk), vsnon(:,:, :,iblk)) + + enddo ! iblk + !$OMP END PARALLEL DO + + !----------------------------------------------------------------- + ! ghost cell updates + !----------------------------------------------------------------- + + call bound_state (aicen, & + vicen, vsnon, & + ntrcr, trcrn) + + !----------------------------------------------------------------- + ! compute aggregate ice state and open water area + !----------------------------------------------------------------- + + !$OMP PARALLEL DO PRIVATE(iblk,it,i,j) + do iblk = 1, nblocks + + do j = 1, ny_block + do i = 1, nx_block + aice(i,j,iblk) = c0 + vice(i,j,iblk) = c0 + vsno(i,j,iblk) = c0 + do it = 1, ntrcr + trcr(i,j,it,iblk) = c0 + enddo + + if (tmask(i,j,iblk)) & + call icepack_aggregate (ncat, & + aicen(i,j,:,iblk), & + trcrn(i,j,1:ntrcr,:,iblk), & + vicen(i,j,:,iblk), & + vsnon(i,j,:,iblk), & + aice (i,j, iblk), & + trcr (i,j,1:ntrcr,iblk), & + vice (i,j, iblk), & + vsno (i,j, iblk), & + aice0(i,j, iblk), & + ntrcr, & + trcr_depend (1:ntrcr),& + trcr_base (1:ntrcr,:),& + n_trcr_strata(1:ntrcr),& + nt_strata (1:ntrcr,:)) + + aice_init(i,j,iblk) = aice(i,j,iblk) + + enddo + enddo + + enddo ! iblk + !$OMP END PARALLEL DO + + call icepack_warnings_flush(nu_diag) + if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & + file=__FILE__, line=__LINE__) + + end subroutine init_state + +!======================================================================= + +! Initialize state in each ice thickness category +! +! authors: C. M. Bitz +! William H. Lipscomb, LANL + + subroutine set_state_var (nx_block, ny_block, & + ilo, ihi, jlo, jhi, & + iglob, jglob, & + ice_ic, tmask, & + ULON, & + TLAT, & + Tair, sst, & + Tf, & + salinz, Tmltz, & + aicen, trcrn, & + vicen, vsnon) + + use ice_arrays_column, only: hin_max + use ice_domain_size, only: nilyr, nslyr, nx_global, ny_global, ncat + use ice_grid, only: grid_type + use ice_forcing, only: atm_data_type + + integer (kind=int_kind), intent(in) :: & + nx_block, ny_block, & ! block dimensions + ilo, ihi , & ! physical domain indices + jlo, jhi , & ! + iglob(nx_block) , & ! global indices + jglob(ny_block) ! + + character(len=char_len_long), intent(in) :: & + ice_ic ! method of ice cover initialization + + logical (kind=log_kind), dimension (nx_block,ny_block), intent(in) :: & + tmask ! true for ice/ocean cells + + real (kind=dbl_kind), dimension (nx_block,ny_block), intent(in) :: & + ULON , & ! longitude of velocity pts (radians) + TLAT ! latitude of temperature pts (radians) + + real (kind=dbl_kind), dimension (nx_block,ny_block), intent(in) :: & + Tair , & ! air temperature (K) + Tf , & ! freezing temperature (C) + sst ! sea surface temperature (C) + + real (kind=dbl_kind), dimension (nx_block,ny_block,nilyr), intent(in) :: & + salinz , & ! initial salinity profile + Tmltz ! initial melting temperature profile + + real (kind=dbl_kind), dimension (nx_block,ny_block,ncat), intent(out) :: & + aicen , & ! concentration of ice + vicen , & ! volume per unit area of ice (m) + vsnon ! volume per unit area of snow (m) + + real (kind=dbl_kind), intent(out), dimension (:,:,:,:) :: & ! (nx_block,ny_block,ntrcr,ncat) + trcrn ! ice tracers + ! 1: surface temperature of ice/snow (C) + + ! local variables + + integer (kind=int_kind) :: & + i, j , & ! horizontal indices + ij , & ! horizontal index, combines i and j loops + k , & ! ice layer index + n , & ! thickness category index + it , & ! tracer index + icells ! number of cells initialized with ice + + integer (kind=int_kind), dimension(nx_block*ny_block) :: & + indxi, indxj ! compressed indices for cells with aicen > puny + + real (kind=dbl_kind) :: & + Tsfc, sum, hbar, puny, rhos, Lfresh, rad_to_deg + + real (kind=dbl_kind), dimension(ncat) :: & + ainit, hinit ! initial area, thickness + + real (kind=dbl_kind), dimension(nilyr) :: & + qin ! ice enthalpy (J/m3) + + real (kind=dbl_kind), dimension(nslyr) :: & + qsn ! snow enthalpy (J/m3) + + real (kind=dbl_kind), parameter :: & + hsno_init = 0.20_dbl_kind , & ! initial snow thickness (m) + edge_init_nh = 70._dbl_kind, & ! initial ice edge, N.Hem. (deg) + edge_init_sh = -60._dbl_kind ! initial ice edge, S.Hem. (deg) + + logical (kind=log_kind) :: tr_brine, tr_lvl + integer (kind=int_kind) :: ntrcr + integer (kind=int_kind) :: nt_Tsfc, nt_qice, nt_qsno, nt_sice + integer (kind=int_kind) :: nt_fbri, nt_alvl, nt_vlvl + + character(len=*), parameter :: subname='(set_state_var)' + + !----------------------------------------------------------------- + + call icepack_query_tracer_numbers(ntrcr_out=ntrcr) + call icepack_query_tracer_flags(tr_brine_out=tr_brine, tr_lvl_out=tr_lvl) + call icepack_query_tracer_indices( nt_Tsfc_out=nt_Tsfc, nt_qice_out=nt_qice, & + nt_qsno_out=nt_qsno, nt_sice_out=nt_sice, & + nt_fbri_out=nt_fbri, nt_alvl_out=nt_alvl, nt_vlvl_out=nt_vlvl) + call icepack_query_parameters(rhos_out=rhos, Lfresh_out=Lfresh, puny_out=puny, & + rad_to_deg_out=rad_to_deg) + call icepack_warnings_flush(nu_diag) + if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & + file=__FILE__, line=__LINE__) + + indxi(:) = 0 + indxj(:) = 0 + + ! Initialize state variables. + ! If restarting, these values are overwritten. + + do n = 1, ncat + do j = 1, ny_block + do i = 1, nx_block + aicen(i,j,n) = c0 + vicen(i,j,n) = c0 + vsnon(i,j,n) = c0 + trcrn(i,j,nt_Tsfc,n) = Tf(i,j) ! surface temperature + if (ntrcr >= 2) then + do it = 2, ntrcr + trcrn(i,j,it,n) = c0 + enddo + endif + if (tr_lvl) trcrn(i,j,nt_alvl,n) = c1 + if (tr_lvl) trcrn(i,j,nt_vlvl,n) = c1 + if (tr_brine) trcrn(i,j,nt_fbri,n) = c1 + do k = 1, nilyr + trcrn(i,j,nt_sice+k-1,n) = salinz(i,j,k) + enddo + do k = 1, nslyr + trcrn(i,j,nt_qsno+k-1,n) = -rhos * Lfresh + enddo + enddo + enddo + enddo + + if (trim(ice_ic) == 'default') then + + !----------------------------------------------------------------- + ! Place ice where ocean surface is cold. + ! Note: If SST is not read from a file, then the ocean is assumed + ! to be at its freezing point everywhere, and ice will + ! extend to the prescribed edges. + !----------------------------------------------------------------- + + if (trim(atm_data_type) == 'box') then + + hbar = c2 ! initial ice thickness + do n = 1, ncat + hinit(n) = c0 + ainit(n) = c0 + if (hbar > hin_max(n-1) .and. hbar < hin_max(n)) then + hinit(n) = hbar + ainit(n) = 0.50 !echmod symm + endif + enddo + + else + + ! initial category areas in cells with ice + hbar = c3 ! initial ice thickness with greatest area + ! Note: the resulting average ice thickness + ! tends to be less than hbar due to the + ! nonlinear distribution of ice thicknesses + sum = c0 + do n = 1, ncat + if (n < ncat) then + hinit(n) = p5*(hin_max(n-1) + hin_max(n)) ! m + else ! n=ncat + hinit(n) = (hin_max(n-1) + c1) ! m + endif + ! parabola, max at h=hbar, zero at h=0, 2*hbar + ainit(n) = max(c0, (c2*hbar*hinit(n) - hinit(n)**2)) + sum = sum + ainit(n) + enddo + do n = 1, ncat + ainit(n) = ainit(n) / (sum + puny/ncat) ! normalize + enddo + + endif ! atm_data_type + + if (trim(grid_type) == 'rectangular') then + + ! place ice on left side of domain + icells = 0 + do j = jlo, jhi + do i = ilo, ihi + if (tmask(i,j)) then + if (ULON(i,j) < -50./rad_to_deg) then + icells = icells + 1 + indxi(icells) = i + indxj(icells) = j + endif ! ULON + endif ! tmask + enddo ! i + enddo ! j + + else + + ! place ice at high latitudes where ocean sfc is cold + icells = 0 + do j = jlo, jhi + do i = ilo, ihi + if (tmask(i,j)) then + ! place ice in high latitudes where ocean sfc is cold + if ( (sst (i,j) <= Tf(i,j)+p2) .and. & + (TLAT(i,j) < edge_init_sh/rad_to_deg .or. & + TLAT(i,j) > edge_init_nh/rad_to_deg) ) then + icells = icells + 1 + indxi(icells) = i + indxj(icells) = j + endif ! cold surface + endif ! tmask + enddo ! i + enddo ! j + + endif ! rectgrid + + do n = 1, ncat + + ! ice volume, snow volume +!DIR$ CONCURRENT !Cray +!cdir nodep !NEC +!ocl novrec !Fujitsu + do ij = 1, icells + i = indxi(ij) + j = indxj(ij) + + aicen(i,j,n) = ainit(n) + + if (trim(atm_data_type) == 'box') then + if (hinit(n) > c0) then +! ! constant slope from 0 to 1 in x direction + aicen(i,j,n) = (real(iglob(i), kind=dbl_kind)-p5) & + / (real(nx_global,kind=dbl_kind)) +! ! constant slope from 0 to 0.5 in x direction +! aicen(i,j,n) = (real(iglob(i), kind=dbl_kind)-p5) & +! / (real(nx_global,kind=dbl_kind)) * p5 + ! quadratic +! aicen(i,j,n) = max(c0,(real(iglob(i), kind=dbl_kind)-p5) & +! / (real(nx_global,kind=dbl_kind)) & +! * (real(jglob(j), kind=dbl_kind)-p5) & +! / (real(ny_global,kind=dbl_kind)) * p5) +! aicen(i,j,n) = max(c0,(real(nx_global, kind=dbl_kind) & +! - real(iglob(i), kind=dbl_kind)-p5) & +! / (real(nx_global,kind=dbl_kind)) & +! * (real(ny_global, kind=dbl_kind) & +! - real(jglob(j), kind=dbl_kind)-p5) & +! / (real(ny_global,kind=dbl_kind)) * p5) + endif + vicen(i,j,n) = hinit(n) * aicen(i,j,n) ! m + else + vicen(i,j,n) = hinit(n) * ainit(n) ! m + endif + vsnon(i,j,n) = min(aicen(i,j,n)*hsno_init,p2*vicen(i,j,n)) + + call icepack_init_trcr(Tair(i,j), Tf(i,j), & + salinz(i,j,:), Tmltz(i,j,:), & + Tsfc, & + nilyr, nslyr, & + qin(:), qsn(:)) + + ! surface temperature + trcrn(i,j,nt_Tsfc,n) = Tsfc ! deg C + ! ice enthalpy, salinity + do k = 1, nilyr + trcrn(i,j,nt_qice+k-1,n) = qin(k) + trcrn(i,j,nt_sice+k-1,n) = salinz(i,j,k) + enddo + ! snow enthalpy + do k = 1, nslyr + trcrn(i,j,nt_qsno+k-1,n) = qsn(k) + enddo ! nslyr + ! brine fraction + if (tr_brine) trcrn(i,j,nt_fbri,n) = c1 + + enddo ! ij + enddo ! ncat + endif ! ice_ic + + call icepack_warnings_flush(nu_diag) + if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & + file=__FILE__, line=__LINE__) + + end subroutine set_state_var + +!======================================================================= + + end module ice_init + +!======================================================================= diff --git a/cicecore/cicedynB/general/ice_flux.F90 b/cicecore/cicedynB/general/ice_flux.F90 index be06417d1..d162ec468 100644 --- a/cicecore/cicedynB/general/ice_flux.F90 +++ b/cicecore/cicedynB/general/ice_flux.F90 @@ -972,24 +972,20 @@ subroutine scale_fluxes (nx_block, ny_block, & nbtrcr , & ! number of biology tracers max_aero ! maximum number of aerosols - logical (kind=log_kind), dimension (nx_block,ny_block), & - intent(in) :: & + logical (kind=log_kind), dimension (nx_block,ny_block), intent(in) :: & tmask ! land/boundary mask, thickness (T-cell) - real (kind=dbl_kind), dimension(nx_block,ny_block), & - intent(in):: & + real (kind=dbl_kind), dimension(nx_block,ny_block), intent(in) :: & aice , & ! fractional ice area Tf , & ! freezing temperature (C) Tair , & ! surface air temperature (K) Qa ! sfc air specific humidity (kg/kg) - real (kind=dbl_kind), dimension(nx_block,ny_block), optional, & - intent(in):: & + real (kind=dbl_kind), dimension(nx_block,ny_block), optional, intent(in) :: & wind ! wind speed (m/s) - real (kind=dbl_kind), dimension(nx_block,ny_block), & - intent(inout):: & + real (kind=dbl_kind), dimension(nx_block,ny_block), intent(inout) :: & strairxT, & ! air/ice zonal stress (N/m**2) strairyT, & ! air/ice merdnl stress (N/m**2) fsens , & ! sensible heat flx (W/m**2) @@ -1008,27 +1004,22 @@ subroutine scale_fluxes (nx_block, ny_block, & alvdf , & ! visible, diffuse (fraction) alidf ! near-ir, diffuse (fraction) - real (kind=dbl_kind), dimension(nx_block,ny_block), optional, & - intent(inout):: & + real (kind=dbl_kind), dimension(nx_block,ny_block), optional, intent(inout) :: & Uref ! air speed reference level (m/s) - real (kind=dbl_kind), dimension(nx_block,ny_block,nbtrcr), & - intent(inout):: & + real (kind=dbl_kind), dimension(nx_block,ny_block,nbtrcr), intent(inout) :: & flux_bio ! tracer flux to ocean from biology (mmol/m2/s) - real (kind=dbl_kind), dimension(nx_block,ny_block,max_aero), & - intent(inout):: & + real (kind=dbl_kind), dimension(nx_block,ny_block,max_aero), intent(inout) :: & faero_ocn ! aerosol flux to ocean (kg/m2/s) ! For hadgem drivers. Assumes either both fields are passed or neither - real (kind=dbl_kind), dimension(nx_block,ny_block), & - intent(inout), optional :: & + real (kind=dbl_kind), dimension(nx_block,ny_block), intent(inout), optional :: & fsurf , & ! surface heat flux (W/m**2) fcondtop ! top surface conductive flux (W/m**2) ! zsalinity fluxes - real (kind=dbl_kind), dimension(nx_block,ny_block), & - intent(inout):: & + real (kind=dbl_kind), dimension(nx_block,ny_block), intent(inout) :: & fzsal , & ! salt flux to ocean with prognositic salinity (kg/m2/s) fzsal_g ! Gravity drainage salt flux to ocean (kg/m2/s) diff --git a/cicecore/cicedynB/general/ice_flux_bgc.F90 b/cicecore/cicedynB/general/ice_flux_bgc.F90 index 3dc7d4146..2ff193b2f 100644 --- a/cicecore/cicedynB/general/ice_flux_bgc.F90 +++ b/cicecore/cicedynB/general/ice_flux_bgc.F90 @@ -167,8 +167,9 @@ subroutine bgcflux_ice_to_ocn(nx_block, & use ice_constants, only: c0 use ice_domain_size, only: n_zaero, n_algae, n_doc, n_dic, n_don, n_fed, n_fep - - real(kind=dbl_kind), dimension(:,:,:), intent(in) :: flux_bio + + real(kind=dbl_kind), dimension(:,:,:), intent(in) :: & + flux_bio real(kind=dbl_kind), dimension(:,:), intent(out):: & f_nit, & ! nitrate flux mmol/m^2/s positive to ocean f_sil, & ! silicate flux mmol/m^2/s diff --git a/cicecore/cicedynB/general/ice_forcing.F90 b/cicecore/cicedynB/general/ice_forcing.F90 index 6eaf4151b..9de3d35ae 100644 --- a/cicecore/cicedynB/general/ice_forcing.F90 +++ b/cicecore/cicedynB/general/ice_forcing.F90 @@ -658,8 +658,7 @@ subroutine read_data (flag, recd, yr, ixm, ixx, ixp, & ! relative to recd maxrec ! maximum record value - real (kind=dbl_kind), dimension(nx_block,ny_block,2,max_blocks), & - intent(inout) :: & + real (kind=dbl_kind), dimension(nx_block,ny_block,2,max_blocks), intent(inout) :: & field_data ! 2 values needed for interpolation integer (kind=int_kind), intent(in) :: & @@ -817,8 +816,7 @@ subroutine read_data_nc (flag, recd, yr, ixm, ixx, ixp, & field_loc, & ! location of field on staggered grid field_type ! type of field (scalar, vector, angle) - real (kind=dbl_kind), dimension(nx_block,ny_block,2,max_blocks), & - intent(out) :: & + real (kind=dbl_kind), dimension(nx_block,ny_block,2,max_blocks), intent(out) :: & field_data ! 2 values needed for interpolation ! local variables @@ -957,8 +955,7 @@ subroutine read_clim_data (readflag, recd, ixm, ixx, ixp, & field_loc, & ! location of field on staggered grid field_type ! type of field (scalar, vector, angle) - real (kind=dbl_kind), dimension(nx_block,ny_block,2,max_blocks), & - intent(inout) :: & + real (kind=dbl_kind), dimension(nx_block,ny_block,2,max_blocks), intent(inout) :: & field_data ! 2 values needed for interpolation ! local variables @@ -1043,8 +1040,7 @@ subroutine read_clim_data_nc (readflag, recd, ixm, ixx, ixp, & field_loc, & ! location of field on staggered grid field_type ! type of field (scalar, vector, angle) - real (kind=dbl_kind), dimension(nx_block,ny_block,2,max_blocks), & - intent(out) :: & + real (kind=dbl_kind), dimension(nx_block,ny_block,2,max_blocks), intent(out) :: & field_data ! 2 values needed for interpolation ! local variables @@ -1226,12 +1222,10 @@ subroutine interpolate_data (field_data, field) use ice_domain, only: nblocks - real (kind=dbl_kind), dimension(nx_block,ny_block,2,max_blocks), & - intent(in) :: & + real (kind=dbl_kind), dimension(nx_block,ny_block,2,max_blocks), intent(in) :: & field_data ! 2 values used for interpolation - real (kind=dbl_kind), dimension(nx_block,ny_block,max_blocks), & - intent(out) :: & + real (kind=dbl_kind), dimension(nx_block,ny_block,max_blocks), intent(out) :: & field ! interpolated field ! local variables @@ -1312,8 +1306,7 @@ subroutine prepare_forcing (nx_block, ny_block, & aice , & ! ice area fraction hm ! land mask - real (kind=dbl_kind), dimension(nx_block,ny_block), & - intent(inout) :: & + real (kind=dbl_kind), dimension(nx_block,ny_block), intent(inout) :: & fsw , & ! incoming shortwave radiation (W/m^2) cldf , & ! cloud fraction frain , & ! rainfall rate (kg/m^2 s) @@ -2146,8 +2139,7 @@ subroutine compute_shortwave(nx_block, ny_block, & cldf , & ! cloud fraction hm ! land mask - real (kind=dbl_kind), dimension(nx_block,ny_block), & - intent(inout) :: & + real (kind=dbl_kind), dimension(nx_block,ny_block), intent(inout) :: & fsw ! shortwave real (kind=dbl_kind) :: & @@ -2207,8 +2199,7 @@ subroutine Qa_fixLY(nx_block, ny_block, Tair, Qa) real (kind=dbl_kind), dimension(nx_block,ny_block), intent(in) :: & Tair ! air temperature - real (kind=dbl_kind), dimension(nx_block,ny_block), & - intent(inout) :: & + real (kind=dbl_kind), dimension(nx_block,ny_block), intent(inout) :: & Qa ! specific humidity real (kind=dbl_kind), dimension (nx_block,ny_block) :: & @@ -3924,8 +3915,7 @@ subroutine read_data_nc_point (flag, recd, yr, ixm, ixx, ixp, & field_loc, & ! location of field on staggered grid field_type ! type of field (scalar, vector, angle) - real (kind=dbl_kind), dimension(2), & - intent(inout) :: & + real (kind=dbl_kind), dimension(2), intent(inout) :: & field_data ! 2 values needed for interpolation character(len=*), parameter :: subname = '(read_data_nc_point)' diff --git a/cicecore/cicedynB/general/ice_init.F90 b/cicecore/cicedynB/general/ice_init.F90 index dc925a9e7..94d28e147 100644 --- a/cicecore/cicedynB/general/ice_init.F90 +++ b/cicecore/cicedynB/general/ice_init.F90 @@ -33,13 +33,16 @@ module ice_init use icepack_intfc, only: icepack_query_parameters implicit none + private - character(len=char_len_long) :: & + character(len=char_len_long),public :: & ice_ic ! method of ice cover initialization ! 'default' => latitude and sst dependent ! 'none' => no ice ! note: restart = .true. overwrites + public :: input_data, init_state, set_state_var + !======================================================================= contains @@ -59,9 +62,7 @@ subroutine input_data use ice_domain_size, only: ncat, nilyr, nslyr, nblyr, & n_aero, n_zaero, n_algae, & n_doc, n_dic, n_don, n_fed, n_fep, & - n_trbgcz, n_trzs, n_trbri, n_trzaero, & - n_trage, n_trfy, n_trlvl, n_trpnd, n_trbgcs, & - n_bgc, nltrcr, max_nsw, max_ntrcr, max_nstrm + max_nstrm use ice_calendar, only: year_init, istep0, histfreq, histfreq_n, & dumpfreq, dumpfreq_n, diagfreq, & npt, dt, ndtd, days_per_year, use_leap_years, & @@ -102,8 +103,8 @@ subroutine input_data ! local variables integer (kind=int_kind) :: & - nml_error, & ! namelist i/o error flag - n ! loop index + nml_error, & ! namelist i/o error flag + n ! loop index character (len=6) :: chartmp @@ -123,21 +124,20 @@ subroutine input_data logical (kind=log_kind) :: calc_Tsfc, formdrag, highfreq, calc_strair - integer (kind=int_kind) :: ntrcr logical (kind=log_kind) :: tr_iage, tr_FY, tr_lvl, tr_pond, tr_aero logical (kind=log_kind) :: tr_pond_cesm, tr_pond_lvl, tr_pond_topo integer (kind=int_kind) :: nt_Tsfc, nt_sice, nt_qice, nt_qsno, nt_iage, nt_FY integer (kind=int_kind) :: nt_alvl, nt_vlvl, nt_apnd, nt_hpnd, nt_ipnd, nt_aero integer (kind=int_kind) :: numin, numax ! unit number limits - real (kind=real_kind) :: rpcesm, rplvl, rptopo + integer (kind=int_kind) :: rpcesm, rplvl, rptopo real (kind=dbl_kind) :: Cf, puny integer :: abort_flag character(len=*), parameter :: subname='(input_data)' !----------------------------------------------------------------- - ! Namelist variables. + ! Namelist variables !----------------------------------------------------------------- namelist /setup_nml/ & @@ -205,9 +205,7 @@ subroutine input_data tr_pond_topo, restart_pond_topo, & tr_aero, restart_aero, & n_aero, n_zaero, n_algae, & - n_doc, n_dic, n_don, n_fed, n_fep, & - n_trbgcz, n_trzs, n_trbri, n_trzaero, & - n_trage, n_trfy, n_trlvl, n_trpnd, n_trbgcs + n_doc, n_dic, n_don, n_fed, n_fep !----------------------------------------------------------------- ! default values @@ -392,15 +390,6 @@ subroutine input_data n_don = 0 n_fed = 0 n_fep = 0 - n_trbgcz = 0 - n_trzs = 0 - n_trbri = 0 - n_trzaero = 0 - n_trage = 0 - n_trfy = 0 - n_trlvl = 0 - n_trpnd = 0 - n_trbgcs = 0 ! mushy layer gravity drainage physics a_rapid_mode = 0.5e-3_dbl_kind ! channel radius for rapid drainage mode (m) @@ -656,15 +645,6 @@ subroutine input_data call broadcast_scalar(n_don, master_task) call broadcast_scalar(n_fed, master_task) call broadcast_scalar(n_fep, master_task) - call broadcast_scalar(n_trbgcz, master_task) - call broadcast_scalar(n_trzs, master_task) - call broadcast_scalar(n_trbri, master_task) - call broadcast_scalar(n_trzaero, master_task) - call broadcast_scalar(n_trage, master_task) - call broadcast_scalar(n_trfy, master_task) - call broadcast_scalar(n_trlvl, master_task) - call broadcast_scalar(n_trpnd, master_task) - call broadcast_scalar(n_trbgcs, master_task) call broadcast_scalar(a_rapid_mode, master_task) call broadcast_scalar(Rac_rapid_mode, master_task) call broadcast_scalar(aspect_rapid_mode, master_task) @@ -686,6 +666,7 @@ subroutine input_data open (nu_diag, file=diag_file, status='unknown') endif write(nu_diag,*) '--------------------------------' + write(nu_diag,*) ' ',subname write(nu_diag,*) ' CICE model diagnostic output ' write(nu_diag,*) '--------------------------------' write(nu_diag,*) ' ' @@ -693,20 +674,20 @@ subroutine input_data if (trim(runtype) == 'continue' .and. .not.restart) then if (my_task == master_task) & - write(nu_diag,*) 'WARNING: runtype=continue, setting restart=.true.' + write(nu_diag,*) subname//' WARNING: runtype=continue, setting restart=.true.' restart = .true. endif if (trim(runtype) /= 'continue' .and. restart .and. & (ice_ic == 'none' .or. ice_ic == 'default')) then if (my_task == master_task) & - write(nu_diag,*) 'WARNING: runtype ne continue and ice_ic=none|default, setting restart=.false.' + write(nu_diag,*) subname//' WARNING: runtype ne continue and ice_ic=none|default, setting restart=.false.' restart = .false. endif if (trim(runtype) /= 'continue' .and. (ice_ic == 'none' .or. ice_ic == 'default')) then if (my_task == master_task) & - write(nu_diag,*) 'WARNING: ice_ic = none or default, setting restart flags to .false.' + write(nu_diag,*) subname//' WARNING: ice_ic = none or default, setting restart flags to .false.' restart = .false. restart_aero = .false. restart_age = .false. @@ -715,10 +696,6 @@ subroutine input_data restart_pond_cesm = .false. restart_pond_lvl = .false. restart_pond_topo = .false. -! tcraig, probably needs to be uncommented when we can test bgc -! restart_bgc = .false. -! restart_hbrine = .false. -! restart_zsal = .false. ! tcraig, OK to leave as true, needed for boxrestore case ! restart_ext = .false. endif @@ -726,9 +703,9 @@ subroutine input_data if (trim(runtype) == 'initial' .and. .not.(restart) .and. & ice_ic /= 'none' .and. ice_ic /= 'default') then if (my_task == master_task) then - write(nu_diag,*) 'ERROR: runtype, restart, ice_ic are inconsistent:' - write(nu_diag,*) 'ERROR: runtype=',trim(runtype), 'restart=',restart, 'ice_ic=',trim(ice_ic) - write(nu_diag,*) 'ERROR: Please review user guide' + write(nu_diag,*) subname//' ERROR: runtype, restart, ice_ic are inconsistent:' + write(nu_diag,*) subname//' ERROR: runtype=',trim(runtype), 'restart=',restart, 'ice_ic=',trim(ice_ic) + write(nu_diag,*) subname//' ERROR: Please review user guide' endif abort_flag = 1 endif @@ -736,68 +713,67 @@ subroutine input_data #ifndef ncdf if (grid_format /= 'bin' .or. atm_data_format /= 'bin' .or. ocn_data_format /= 'bin') then if (my_task == master_task) then - write(nu_diag,*)'ERROR: ncdf CPP flag unset, data formats must be bin' - write(nu_diag,*)'ERROR: check grid_format, atm_data_format, ocn_data_format or set ncdf CPP' + write(nu_diag,*) subname//' ERROR: ncdf CPP flag unset, data formats must be bin' + write(nu_diag,*) subname//' ERROR: check grid_format, atm_data_format, ocn_data_format or set ncdf CPP' endif abort_flag = 2 endif #endif if (advection /= 'remap' .and. advection /= 'upwind' .and. advection /= 'none') then - if (my_task == master_task) write(nu_diag,*)'ERROR: invalid advection=',trim(advection) + if (my_task == master_task) write(nu_diag,*) subname//' ERROR: invalid advection=',trim(advection) abort_flag = 3 endif if (ncat == 1 .and. kitd == 1) then if (my_task == master_task) then - write(nu_diag,*) 'ERROR: kitd incompatability: ncat=1 and kitd=1' - write(nu_diag,*) 'ERROR: Remapping the ITD is not allowed for ncat=1.' - write(nu_diag,*) 'ERROR: Use kitd = 0 (delta function ITD) with kcatbound = 0' - write(nu_diag,*) 'ERROR: or for column configurations use kcatbound = -1' + write(nu_diag,*) subname//' ERROR: kitd incompatability: ncat=1 and kitd=1' + write(nu_diag,*) subname//' ERROR: Remapping the ITD is not allowed for ncat=1.' + write(nu_diag,*) subname//' ERROR: Use kitd = 0 (delta function ITD) with kcatbound = 0' + write(nu_diag,*) subname//' ERROR: or for column configurations use kcatbound = -1' endif abort_flag = 4 endif if (ncat /= 1 .and. kcatbound == -1) then if (my_task == master_task) then - write(nu_diag,*) 'ERROR: ITD required for ncat > 1' - write(nu_diag,*) 'ERROR: ncat=',ncat,' kcatbound=',kcatbound - write(nu_diag,*) 'ERROR: Please review user guide' + write(nu_diag,*) subname//' ERROR: ITD required for ncat > 1' + write(nu_diag,*) subname//' ERROR: ncat=',ncat,' kcatbound=',kcatbound + write(nu_diag,*) subname//' ERROR: Please review user guide' endif abort_flag = 5 endif if (kdyn == 2 .and. revised_evp) then if (my_task == master_task) then - write(nu_diag,*) 'WARNING: revised_evp = T with EAP dynamics' - write(nu_diag,*) 'WARNING: revised_evp is ignored' + write(nu_diag,*) subname//' WARNING: revised_evp = T with EAP dynamics' + write(nu_diag,*) subname//' WARNING: revised_evp is ignored' endif revised_evp = .false. endif - rpcesm = c0 - rplvl = c0 - rptopo = c0 - if (tr_pond_cesm) rpcesm = c1 - if (tr_pond_lvl ) rplvl = c1 - if (tr_pond_topo) rptopo = c1 + rpcesm = 0 + rplvl = 0 + rptopo = 0 + if (tr_pond_cesm) rpcesm = 1 + if (tr_pond_lvl ) rplvl = 1 + if (tr_pond_topo) rptopo = 1 tr_pond = .false. ! explicit melt ponds - if (rpcesm + rplvl + rptopo > puny) tr_pond = .true. + if (rpcesm + rplvl + rptopo > 0) tr_pond = .true. - if (rpcesm + rplvl + rptopo > c1 + puny) then + if (rpcesm + rplvl + rptopo > 1) then if (my_task == master_task) then - write(nu_diag,*) 'ERROR: Must use only one melt pond scheme' + write(nu_diag,*) subname//' ERROR: Must use only one melt pond scheme' endif abort_flag = 6 endif if (tr_pond_lvl .and. .not. tr_lvl) then if (my_task == master_task) then - write(nu_diag,*) 'WARNING: tr_pond_lvl=T but tr_lvl=F' - write(nu_diag,*) 'WARNING: Setting tr_lvl=T' + write(nu_diag,*) subname//' ERROR: tr_pond_lvl=T but tr_lvl=F' endif - tr_lvl = .true. + abort_flag = 30 endif ! tcraig - this was originally implemented by resetting hs0=0. EH says it might be OK @@ -806,32 +782,32 @@ subroutine input_data ! this will abort (safest option until additional testing is done) if (tr_pond_lvl .and. abs(hs0) > puny) then if (my_task == master_task) then - write(nu_diag,*) 'ERROR: tr_pond_lvl=T and hs0 /= 0' + write(nu_diag,*) subname//' ERROR: tr_pond_lvl=T and hs0 /= 0' endif abort_flag = 7 endif if (trim(shortwave) /= 'dEdd' .and. tr_pond .and. calc_tsfc) then if (my_task == master_task) then - write(nu_diag,*) 'ERROR: tr_pond=T, calc_tsfc=T, invalid shortwave' - write(nu_diag,*) 'ERROR: Must use shortwave=dEdd' + write(nu_diag,*) subname//' ERROR: tr_pond=T, calc_tsfc=T, invalid shortwave' + write(nu_diag,*) subname//' ERROR: Must use shortwave=dEdd' endif abort_flag = 8 endif if (tr_aero .and. n_aero==0) then if (my_task == master_task) then - write(nu_diag,*) 'ERROR: aerosols activated but' - write(nu_diag,*) 'ERROR: not allocated in tracer array.' - write(nu_diag,*) 'ERROR: Activate in compilation script.' + write(nu_diag,*) subname//' ERROR: aerosols activated but' + write(nu_diag,*) subname//' ERROR: not allocated in tracer array.' + write(nu_diag,*) subname//' ERROR: Activate in compilation script.' endif abort_flag = 9 endif if (trim(shortwave) /= 'dEdd' .and. tr_aero) then if (my_task == master_task) then - write(nu_diag,*) 'ERROR: tr_aero=T, invalid shortwave' - write(nu_diag,*) 'ERROR: Must use shortwave=dEdd' + write(nu_diag,*) subname//' ERROR: tr_aero=T, invalid shortwave' + write(nu_diag,*) subname//' ERROR: Must use shortwave=dEdd' endif abort_flag = 10 endif @@ -840,8 +816,8 @@ subroutine input_data (rfracmax < -puny .or. rfracmax > c1+puny) .or. & (rfracmin > rfracmax)) then if (my_task == master_task) then - write(nu_diag,*) 'ERROR: rfracmin, rfracmax must be between 0 and 1' - write(nu_diag,*) 'ERROR: and rfracmax >= rfracmin' + write(nu_diag,*) subname//' ERROR: rfracmin, rfracmax must be between 0 and 1' + write(nu_diag,*) subname//' ERROR: and rfracmax >= rfracmin' endif abort_flag = 11 endif @@ -849,55 +825,61 @@ subroutine input_data rfracmax = min(max(rfracmax,c0),c1) if (trim(atm_data_type) == 'monthly' .and. calc_strair) then - if (my_task == master_task) write(nu_diag,*)'ERROR: atm_data_type=monthly and calc_strair=T' + if (my_task == master_task) write(nu_diag,*) subname//' ERROR: atm_data_type=monthly and calc_strair=T' abort_flag = 12 endif if (ktherm == 2 .and. .not. calc_Tsfc) then - if (my_task == master_task) write(nu_diag,*) 'ERROR: ktherm = 2 and calc_Tsfc=F' + if (my_task == master_task) write(nu_diag,*) subname//' ERROR: ktherm = 2 and calc_Tsfc=F' abort_flag = 13 endif ! tcraig, is it really OK for users to run inconsistently? +! ech: yes, for testing sensitivities. It's not recommended for science runs if (ktherm == 1 .and. trim(tfrz_option) /= 'linear_salt') then if (my_task == master_task) then - write(nu_diag,*) 'WARNING: ktherm = 1 and tfrz_option = ',trim(tfrz_option) - write(nu_diag,*) 'WARNING: For consistency, set tfrz_option = linear_salt' + write(nu_diag,*) subname//' WARNING: ktherm = 1 and tfrz_option = ',trim(tfrz_option) + write(nu_diag,*) subname//' WARNING: For consistency, set tfrz_option = linear_salt' endif endif if (ktherm == 2 .and. trim(tfrz_option) /= 'mushy') then if (my_task == master_task) then - write(nu_diag,*) 'WARNING: ktherm = 2 and tfrz_option = ',trim(tfrz_option) - write(nu_diag,*) 'WARNING: For consistency, set tfrz_option = mushy' + write(nu_diag,*) subname//' WARNING: ktherm = 2 and tfrz_option = ',trim(tfrz_option) + write(nu_diag,*) subname//' WARNING: For consistency, set tfrz_option = mushy' endif endif !tcraig if (formdrag) then if (trim(atmbndy) == 'constant') then - if (my_task == master_task) write(nu_diag,*) 'ERROR: formdrag=T and atmbndy=constant' + if (my_task == master_task) write(nu_diag,*) subname//' ERROR: formdrag=T and atmbndy=constant' abort_flag = 14 endif if (.not. calc_strair) then - if (my_task == master_task) write(nu_diag,*) 'ERROR: formdrag=T and calc_strair=F' + if (my_task == master_task) write(nu_diag,*) subname//' ERROR: formdrag=T and calc_strair=F' abort_flag = 15 endif - if (tr_pond_cesm) then - if (my_task == master_task) write(nu_diag,*)'ERROR: formdrag=T and frzpnd=cesm' + if (.not. tr_pond) then + if (my_task == master_task) write(nu_diag,*) subname//' ERROR: formdrag=T and tr_pond=F' abort_flag = 16 endif - if (.not. tr_lvl) then - if (my_task == master_task) write(nu_diag,*) 'ERROR: formdrag=T and tr_lvl=F' + if (tr_pond_cesm) then + if (my_task == master_task) write(nu_diag,*) subname//' ERROR: formdrag=T and frzpnd=cesm' abort_flag = 17 endif + + if (.not. tr_lvl) then + if (my_task == master_task) write(nu_diag,*) subname//' ERROR: formdrag=T and tr_lvl=F' + abort_flag = 18 + endif endif if (trim(fbot_xfer_type) == 'Cdn_ocn' .and. .not. formdrag) then - if (my_task == master_task) write(nu_diag,*) 'ERROR: formdrag=F and fbot_xfer_type=Cdn_ocn' - abort_flag = 18 + if (my_task == master_task) write(nu_diag,*) subname//' ERROR: formdrag=F and fbot_xfer_type=Cdn_ocn' + abort_flag = 19 endif ice_IOUnitsMinUnit = numin @@ -1129,11 +1111,11 @@ subroutine input_data #ifdef coupled if( oceanmixed_ice ) then - write(nu_diag,*) 'WARNING ** WARNING ** WARNING ** WARNING ' - write(nu_diag,*) 'WARNING: coupled CPP and oceanmixed_ice namelist are BOTH ON' - write(nu_diag,*) 'WARNING: Ocean data received from coupler will' - write(nu_diag,*) 'WARNING: be altered by mixed layer routine!' - write(nu_diag,*) 'WARNING ** WARNING ** WARNING ** WARNING ' + write(nu_diag,*) subname//' WARNING ** WARNING ** WARNING ** WARNING ' + write(nu_diag,*) subname//' WARNING: coupled CPP and oceanmixed_ice namelist are BOTH ON' + write(nu_diag,*) subname//' WARNING: Ocean data received from coupler will' + write(nu_diag,*) subname//' WARNING: be altered by mixed layer routine!' + write(nu_diag,*) subname//' WARNING ** WARNING ** WARNING ** WARNING ' write(nu_diag,*) ' ' endif #endif @@ -1172,129 +1154,8 @@ subroutine input_data write(nu_diag,1020) ' n_don = ', n_don write(nu_diag,1020) ' n_fed = ', n_fed write(nu_diag,1020) ' n_fep = ', n_fep - write(nu_diag,1020) ' n_trbgcz = ', n_trbgcz - write(nu_diag,1020) ' n_trzs = ', n_trzs - write(nu_diag,1020) ' n_trbri = ', n_trbri - write(nu_diag,1020) ' n_trzaero = ', n_trzaero - write(nu_diag,1020) ' n_trage = ', n_trage - write(nu_diag,1020) ' n_trfy = ', n_trfy - write(nu_diag,1020) ' n_trlvl = ', n_trlvl - write(nu_diag,1020) ' n_trpnd = ', n_trpnd - write(nu_diag,1020) ' n_trbgcs = ', n_trbgcs - - n_bgc = (n_algae*2 + n_doc + n_dic + n_don + n_fed + & - n_fep + n_zaero + 8) ! nit, am, sil, dmspp, dmspd, dms, pon, humic - nltrcr = (n_bgc*n_trbgcz+n_trzs)*n_trbri ! number of zbgc (includes zaero) - ! and zsalinity tracers - max_nsw = (nilyr+nslyr+2) & ! total chlorophyll plus aerosols - * (1+n_trzaero) ! number of tracers active in shortwave calculation - max_ntrcr = 1 & ! 1 = surface temperature - + nilyr & ! ice salinity - + nilyr & ! ice enthalpy - + nslyr & ! snow enthalpy - !!!!! optional tracers: - + n_trage & ! age - + n_trfy & ! first-year area - + n_trlvl*2 & ! level/deformed ice - + n_trpnd*3 & ! ponds - + n_aero*4 & ! number of aerosols * 4 aero layers - + n_trbri & ! brine height - + n_trbgcs*n_bgc & ! skeletal layer BGC - + n_trzs *n_trbri* nblyr & ! zsalinity (off if n_trbri=0) - + n_bgc*n_trbgcz*n_trbri*(nblyr+3) & ! zbgc (off if n_trbri=0) - + n_bgc*n_trbgcz & ! mobile/stationary phase tracer - + 1 ! for unused tracer flags - - nt_Tsfc = 1 ! index tracers, starting with Tsfc = 1 - ntrcr = 1 ! count tracers, starting with Tsfc = 1 - - nt_qice = ntrcr + 1 - ntrcr = ntrcr + nilyr ! qice in nilyr layers - - nt_qsno = ntrcr + 1 - ntrcr = ntrcr + nslyr ! qsno in nslyr layers - - nt_sice = ntrcr + 1 - ntrcr = ntrcr + nilyr ! sice in nilyr layers - - nt_iage = max_ntrcr - if (tr_iage) then - ntrcr = ntrcr + 1 - nt_iage = ntrcr ! chronological ice age - endif - - nt_FY = max_ntrcr - if (tr_FY) then - ntrcr = ntrcr + 1 - nt_FY = ntrcr ! area of first year ice - endif - - nt_alvl = max_ntrcr - nt_vlvl = max_ntrcr - if (tr_lvl) then - ntrcr = ntrcr + 1 - nt_alvl = ntrcr - ntrcr = ntrcr + 1 - nt_vlvl = ntrcr - endif - - nt_apnd = max_ntrcr - nt_hpnd = max_ntrcr - nt_ipnd = max_ntrcr - if (tr_pond) then ! all explicit melt pond schemes - ntrcr = ntrcr + 1 - nt_apnd = ntrcr - ntrcr = ntrcr + 1 - nt_hpnd = ntrcr - if (tr_pond_lvl) then - ntrcr = ntrcr + 1 ! refrozen pond ice lid thickness - nt_ipnd = ntrcr ! on level-ice ponds (if frzpnd='hlid') - endif - if (tr_pond_topo) then - ntrcr = ntrcr + 1 ! - nt_ipnd = ntrcr ! refrozen pond ice lid thickness - endif - endif - ! tcraig, tcx, this is a BAD kludge, NTRAERO should be 0 if tr_aero is false - nt_aero = max_ntrcr - 4*n_aero - if (tr_aero) then - nt_aero = ntrcr + 1 - ntrcr = ntrcr + 4*n_aero ! 4 dEdd layers, n_aero species - endif - - if (ntrcr > max_ntrcr-1) then - if (my_task == master_task) then - write(nu_diag,*) 'ERROR: max_ntrcr-1 < number of namelist tracers' - write(nu_diag,*) 'ERROR: max_ntrcr-1 = ',max_ntrcr-1,' ntrcr = ',ntrcr - endif - abort_flag = 19 - endif - - write(nu_diag,*) ' ' - write(nu_diag,1020) ' n_bgc = ', n_bgc - write(nu_diag,1020) ' nltrcr = ', nltrcr - write(nu_diag,1020) ' max_nsw = ', max_nsw - write(nu_diag,1020) ' max_ntrcr = ', max_ntrcr - write(nu_diag,*) ' ' - write(nu_diag,1020) ' ntrcr = ', ntrcr - write(nu_diag,*) ' ' - write(nu_diag,1020) ' nt_sice = ', nt_sice - write(nu_diag,1020) ' nt_qice = ', nt_qice - write(nu_diag,1020) ' nt_qsno = ', nt_qsno - write(nu_diag,*)' ' - write(nu_diag,1020) ' nilyr = ', nilyr - write(nu_diag,1020) ' nslyr = ', nslyr - write(nu_diag,*)' ' - - 1000 format (a30,2x,f9.2) ! a30 to align formatted, unformatted statements - 1005 format (a30,2x,f9.6) ! float - 1010 format (a30,2x,l6) ! logical - 1020 format (a30,2x,i6) ! integer - 1021 format (a30,2x,a8,i6) ! char, int - 1030 format (a30, a8) ! character - 1040 format (a30,2x,6i6) ! integer - 1050 format (a30,2x,6a6) ! character + endif ! my_task = master_task write(nu_diag,*) ' ' if (grid_type /= 'displaced_pole' .and. & @@ -1303,50 +1164,11 @@ subroutine input_data grid_type /= 'rectangular' .and. & grid_type /= 'cpom_grid' .and. & grid_type /= 'regional' .and. & - grid_type /= 'latlon' ) then - if (my_task == master_task) write(nu_diag,*)'ERROR: unknown grid_type=',trim(grid_type) + grid_type /= 'latlon' ) then + if (my_task == master_task) write(nu_diag,*) subname//' ERROR: unknown grid_type=',trim(grid_type) abort_flag = 20 endif - endif ! my_task = master_task - - call broadcast_scalar(ntrcr, master_task) - call broadcast_scalar(nt_Tsfc, master_task) - call broadcast_scalar(nt_sice, master_task) - call broadcast_scalar(nt_qice, master_task) - call broadcast_scalar(nt_qsno, master_task) - call broadcast_scalar(nt_iage, master_task) - call broadcast_scalar(nt_FY, master_task) - call broadcast_scalar(nt_alvl, master_task) - call broadcast_scalar(nt_vlvl, master_task) - call broadcast_scalar(nt_apnd, master_task) - call broadcast_scalar(nt_hpnd, master_task) - call broadcast_scalar(nt_ipnd, master_task) - call broadcast_scalar(nt_aero, master_task) - call broadcast_scalar(n_bgc, master_task) - call broadcast_scalar(nltrcr, master_task) - call broadcast_scalar(max_nsw, master_task) - call broadcast_scalar(max_ntrcr,master_task) - - if (formdrag) then - if (nt_apnd==0) then - if (my_task == master_task) write(nu_diag,*)'ERROR: formdrag=T, nt_apnd=',nt_apnd - abort_flag = 21 - elseif (nt_hpnd==0) then - if (my_task == master_task) write(nu_diag,*)'ERROR: formdrag=T, nt_hpnd=',nt_hpnd - abort_flag = 22 - elseif (nt_ipnd==0) then - if (my_task == master_task) write(nu_diag,*)'ERROR: formdrag=T, nt_ipnd=',nt_ipnd - abort_flag = 23 - elseif (nt_alvl==0) then - if (my_task == master_task) write(nu_diag,*)'ERROR: formdrag=T, nt_alvl=',nt_alvl - abort_flag = 24 - elseif (nt_vlvl==0) then - if (my_task == master_task) write(nu_diag,*)'ERROR: formdrag=T, nt_vlvl=',nt_vlvl - abort_flag = 25 - endif - endif - call flush_fileunit(nu_diag) call icepack_init_parameters(ustar_min_in=ustar_min, albicev_in=albicev, albicei_in=albicei, & albsnowv_in=albsnowv, albsnowi_in=albsnowi, natmiter_in=natmiter, emissivity_in=emissivity, & @@ -1361,17 +1183,9 @@ subroutine input_data aspect_rapid_mode_in=aspect_rapid_mode, dSdt_slow_mode_in=dSdt_slow_mode, & phi_c_slow_mode_in=phi_c_slow_mode, phi_i_mushy_in=phi_i_mushy, & tfrz_option_in=tfrz_option, kalg_in=kalg, fbot_xfer_type_in=fbot_xfer_type) - call icepack_init_tracer_numbers(ntrcr_in=ntrcr) call icepack_init_tracer_flags(tr_iage_in=tr_iage, tr_FY_in=tr_FY, & tr_lvl_in=tr_lvl, tr_aero_in=tr_aero, tr_pond_in=tr_pond, & tr_pond_cesm_in=tr_pond_cesm, tr_pond_lvl_in=tr_pond_lvl, tr_pond_topo_in=tr_pond_topo) - call icepack_init_tracer_indices(nt_Tsfc_in=nt_Tsfc, nt_sice_in=nt_sice, & - nt_qice_in=nt_qice, nt_qsno_in=nt_qsno, nt_iage_in=nt_iage, nt_fy_in=nt_fy, & - nt_alvl_in=nt_alvl, nt_vlvl_in=nt_vlvl, nt_apnd_in=nt_apnd, nt_hpnd_in=nt_hpnd, & - nt_ipnd_in=nt_ipnd, nt_aero_in=nt_aero) - call icepack_warnings_flush(nu_diag) - if (icepack_warnings_aborted()) call abort_ice(error_message=subname//' Icepack Abort2', & - file=__FILE__, line=__LINE__) call flush_fileunit(nu_diag) call ice_barrier() @@ -1381,6 +1195,15 @@ subroutine input_data file=__FILE__, line=__LINE__) endif + 1000 format (a30,2x,f9.2) ! a30 to align formatted, unformatted statements + 1005 format (a30,2x,f9.6) ! float + 1010 format (a30,2x,l6) ! logical + 1020 format (a30,2x,i6) ! integer + 1021 format (a30,2x,a8,i6) ! char, int + 1030 format (a30, a8) ! character + 1040 format (a30,2x,6i6) ! integer + 1050 format (a30,2x,6a6) ! character + end subroutine input_data !======================================================================= @@ -1394,7 +1217,7 @@ subroutine init_state use ice_blocks, only: block, get_block, nx_block, ny_block use ice_domain, only: nblocks, blocks_ice - use ice_domain_size, only: ncat, nilyr, nslyr, max_ntrcr, n_aero + use ice_domain_size, only: ncat, nilyr, nslyr, n_aero use ice_flux, only: sst, Tf, Tair, salinz, Tmltz use ice_grid, only: tmask, ULON, TLAT use ice_state, only: trcr_depend, aicen, trcrn, vicen, vsnon, & @@ -1425,6 +1248,8 @@ subroutine init_state character(len=*), parameter :: subname='(init_state)' + !----------------------------------------------------------------- + call icepack_query_parameters(heat_capacity_out=heat_capacity) call icepack_query_tracer_numbers(ntrcr_out=ntrcr) call icepack_query_tracer_flags(tr_iage_out=tr_iage, tr_FY_out=tr_FY, & @@ -1445,15 +1270,15 @@ subroutine init_state if (my_task == master_task) then if (nilyr < 1) then - write(nu_diag,*) 'ERROR: Must have at least one ice layer' - write(nu_diag,*) 'ERROR: nilyr =', nilyr + write(nu_diag,*) subname//' ERROR: Must have at least one ice layer' + write(nu_diag,*) subname//' ERROR: nilyr =', nilyr call abort_ice (error_message=subname//' Not enough ice layers', & file=__FILE__, line=__LINE__) endif if (nslyr < 1) then - write(nu_diag,*) 'ERROR: Must have at least one snow layer' - write(nu_diag,*) 'ERROR: nslyr =', nslyr + write(nu_diag,*) subname//' ERROR: Must have at least one snow layer' + write(nu_diag,*) subname//' ERROR: nslyr =', nslyr call abort_ice(error_message=subname//' Not enough snow layers', & file=__FILE__, line=__LINE__) endif @@ -1461,15 +1286,15 @@ subroutine init_state if (.not.heat_capacity) then if (nilyr > 1) then - write(nu_diag,*) 'ERROR: Must have nilyr = 1 if heat_capacity=F' - write(nu_diag,*) 'ERROR: nilyr =', nilyr + write(nu_diag,*) subname//' ERROR: Must have nilyr = 1 if heat_capacity=F' + write(nu_diag,*) subname//' ERROR: nilyr =', nilyr call abort_ice(error_message=subname//' Too many ice layers', & file=__FILE__, line=__LINE__) endif if (nslyr > 1) then - write(nu_diag,*) 'ERROR: Must have nslyr = 1 if heat_capacity=F' - write(nu_diag,*) 'ERROR: nslyr =', nslyr + write(nu_diag,*) subname//' ERROR: Must have nslyr = 1 if heat_capacity=F' + write(nu_diag,*) subname//' ERROR: nslyr =', nslyr call abort_ice(error_message=subname//' Too many snow layers', & file=__FILE__, line=__LINE__) endif @@ -1612,7 +1437,7 @@ subroutine init_state aice(i,j,iblk) = c0 vice(i,j,iblk) = c0 vsno(i,j,iblk) = c0 - do it = 1, max_ntrcr + do it = 1, ntrcr trcr(i,j,it,iblk) = c0 enddo @@ -1667,7 +1492,7 @@ subroutine set_state_var (nx_block, ny_block, & vicen, vsnon) use ice_arrays_column, only: hin_max - use ice_domain_size, only: nilyr, nslyr, nx_global, ny_global, max_ntrcr, ncat + use ice_domain_size, only: nilyr, nslyr, nx_global, ny_global, ncat use ice_grid, only: grid_type use ice_forcing, only: atm_data_type @@ -1681,12 +1506,10 @@ subroutine set_state_var (nx_block, ny_block, & character(len=char_len_long), intent(in) :: & ice_ic ! method of ice cover initialization - logical (kind=log_kind), dimension (nx_block,ny_block), & - intent(in) :: & + logical (kind=log_kind), dimension (nx_block,ny_block), intent(in) :: & tmask ! true for ice/ocean cells - real (kind=dbl_kind), dimension (nx_block,ny_block), & - intent(in) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block), intent(in) :: & ULON , & ! longitude of velocity pts (radians) TLAT ! latitude of temperature pts (radians) @@ -1695,19 +1518,16 @@ subroutine set_state_var (nx_block, ny_block, & Tf , & ! freezing temperature (C) sst ! sea surface temperature (C) - real (kind=dbl_kind), dimension (nx_block,ny_block,nilyr), & - intent(in) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block,nilyr), intent(in) :: & salinz , & ! initial salinity profile Tmltz ! initial melting temperature profile - real (kind=dbl_kind), dimension (nx_block,ny_block,ncat), & - intent(out) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block,ncat), intent(out) :: & aicen , & ! concentration of ice vicen , & ! volume per unit area of ice (m) vsnon ! volume per unit area of snow (m) - real (kind=dbl_kind), dimension (nx_block,ny_block,max_ntrcr,ncat), & - intent(out) :: & + real (kind=dbl_kind), intent(out), dimension (:,:,:,:) :: & ! (nx_block,ny_block,ntrcr,ncat) trcrn ! ice tracers ! 1: surface temperature of ice/snow (C) @@ -1742,11 +1562,15 @@ subroutine set_state_var (nx_block, ny_block, & edge_init_sh = -60._dbl_kind ! initial ice edge, S.Hem. (deg) logical (kind=log_kind) :: tr_brine, tr_lvl + integer (kind=int_kind) :: ntrcr integer (kind=int_kind) :: nt_Tsfc, nt_qice, nt_qsno, nt_sice integer (kind=int_kind) :: nt_fbri, nt_alvl, nt_vlvl character(len=*), parameter :: subname='(set_state_var)' + !----------------------------------------------------------------- + + call icepack_query_tracer_numbers(ntrcr_out=ntrcr) call icepack_query_tracer_flags(tr_brine_out=tr_brine, tr_lvl_out=tr_lvl) call icepack_query_tracer_indices( nt_Tsfc_out=nt_Tsfc, nt_qice_out=nt_qice, & nt_qsno_out=nt_qsno, nt_sice_out=nt_sice, & @@ -1770,8 +1594,8 @@ subroutine set_state_var (nx_block, ny_block, & vicen(i,j,n) = c0 vsnon(i,j,n) = c0 trcrn(i,j,nt_Tsfc,n) = Tf(i,j) ! surface temperature - if (max_ntrcr >= 2) then - do it = 2, max_ntrcr + if (ntrcr >= 2) then + do it = 2, ntrcr trcrn(i,j,it,n) = c0 enddo endif diff --git a/cicecore/cicedynB/general/ice_state.F90 b/cicecore/cicedynB/general/ice_state.F90 index e3d681d4b..dfaee78ee 100644 --- a/cicecore/cicedynB/general/ice_state.F90 +++ b/cicecore/cicedynB/general/ice_state.F90 @@ -37,9 +37,12 @@ module ice_state use ice_kinds_mod use ice_constants, only: field_loc_center, field_type_scalar, c0 - use ice_domain_size, only: max_blocks, ncat, max_ntrcr + use ice_domain_size, only: max_blocks, ncat use ice_blocks, only: nx_block, ny_block use ice_exit, only: abort_ice + use ice_fileunits, only: nu_diag + use icepack_intfc, only: icepack_query_tracer_numbers + use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted implicit none private @@ -133,7 +136,13 @@ module ice_state ! Allocate space for all state variables ! subroutine alloc_state - integer (int_kind) :: ierr + integer (int_kind) :: ntrcr, ierr + character(len=*),parameter :: subname='(alloc_state)' + + call icepack_query_tracer_numbers(ntrcr_out=ntrcr) + call icepack_warnings_flush(nu_diag) + if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & + file=__FILE__, line=__LINE__) allocate ( & aice (nx_block,ny_block,max_blocks) , & ! concentration of ice @@ -152,16 +161,16 @@ subroutine alloc_state aicen_init(nx_block,ny_block,ncat,max_blocks) , & ! initial ice concentration, for linear ITD vicen_init(nx_block,ny_block,ncat,max_blocks) , & ! initial ice volume (m), for linear ITD vsnon_init(nx_block,ny_block,ncat,max_blocks) , & ! initial snow volume (m), for aerosol - trcr (nx_block,ny_block,max_ntrcr,max_blocks) , & ! ice tracers: 1: surface temperature of ice/snow (C) - trcrn (nx_block,ny_block,max_ntrcr,ncat,max_blocks) , & ! tracers: 1: surface temperature of ice/snow (C) + trcr (nx_block,ny_block,ntrcr,max_blocks) , & ! ice tracers: 1: surface temperature of ice/snow (C) + trcrn (nx_block,ny_block,ntrcr,ncat,max_blocks) , & ! tracers: 1: surface temperature of ice/snow (C) stat=ierr) if (ierr/=0) call abort_ice('(alloc_state): Out of memory1') allocate ( & - trcr_depend(max_ntrcr) , & ! - n_trcr_strata(max_ntrcr) , & ! number of underlying tracer layers - nt_strata(max_ntrcr,2) , & ! indices of underlying tracer layers - trcr_base(max_ntrcr,3) , & ! = 0 or 1 depending on tracer dependency, (1) aice, (2) vice, (3) vsno + trcr_depend(ntrcr) , & ! + n_trcr_strata(ntrcr) , & ! number of underlying tracer layers + nt_strata(ntrcr,2) , & ! indices of underlying tracer layers + trcr_base(ntrcr,3) , & ! = 0 or 1 depending on tracer dependency, (1) aice, (2) vice, (3) vsno stat=ierr) if (ierr/=0) call abort_ice('(alloc_state): Out of memory2') @@ -190,15 +199,12 @@ subroutine bound_state (aicen, & integer (kind=int_kind), intent(in) :: & ntrcr ! number of tracers in use - real (kind=dbl_kind), & - dimension(nx_block,ny_block,ncat,max_blocks), intent(inout) :: & + real (kind=dbl_kind), dimension(nx_block,ny_block,ncat,max_blocks), intent(inout) :: & aicen , & ! fractional ice area vicen , & ! volume per unit area of ice (m) vsnon ! volume per unit area of snow (m) - real (kind=dbl_kind), & - dimension(nx_block,ny_block,max_ntrcr,ncat,max_blocks), & - intent(inout) :: & + real (kind=dbl_kind), intent(inout), dimension(:,:,:,:,:) :: & ! (nx_block,ny_block,ntrcr,ncat,max_blocks) trcrn ! ice tracers ! local variables diff --git a/cicecore/cicedynB/general/ice_step_mod.F90 b/cicecore/cicedynB/general/ice_step_mod.F90 index a78d4ed66..13b2fd399 100644 --- a/cicecore/cicedynB/general/ice_step_mod.F90 +++ b/cicecore/cicedynB/general/ice_step_mod.F90 @@ -395,7 +395,7 @@ subroutine step_therm2 (dt, iblk) use ice_blocks, only: block, get_block use ice_calendar, only: yday use ice_domain, only: blocks_ice - use ice_domain_size, only: ncat, nilyr, nslyr, n_aero, nblyr, nltrcr + use ice_domain_size, only: ncat, nilyr, nslyr, n_aero, nblyr use ice_flux, only: fresh, frain, fpond, frzmlt, frazil, frz_onset, & update_ocn_f, fsalt, Tf, sss, salinz, fhocn, rside, & meltl, frazil_diag @@ -418,18 +418,29 @@ subroutine step_therm2 (dt, iblk) i, j ! horizontal indices integer (kind=int_kind) :: & - ntrcr, nbtrcr + ntrcr, nbtrcr, nltrcr + + logical (kind=log_kind) :: & + z_tracers type (block) :: & this_block ! block information for current block character(len=*), parameter :: subname = '(step_therm2)' + call icepack_query_parameters(z_tracers_out=z_tracers) call icepack_query_tracer_numbers(ntrcr_out=ntrcr, nbtrcr_out=nbtrcr) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & file=__FILE__, line=__LINE__) + ! tcraig, nltrcr used to be the number of zbgc tracers, but it's used as a zbgc flag in icepack + if (z_tracers) then + nltrcr = 1 + else + nltrcr = 0 + endif + this_block = get_block(blocks_ice(iblk),iblk) ilo = this_block%ilo ihi = this_block%ihi diff --git a/cicecore/cicedynB/infrastructure/ice_grid.F90 b/cicecore/cicedynB/infrastructure/ice_grid.F90 index ff0bcc3eb..f74e6447f 100644 --- a/cicecore/cicedynB/infrastructure/ice_grid.F90 +++ b/cicecore/cicedynB/infrastructure/ice_grid.F90 @@ -1812,8 +1812,7 @@ subroutine t2ugrid_vector (work) use ice_constants, only: field_loc_center, field_type_vector use ice_domain_size, only: max_blocks - real (kind=dbl_kind), dimension(nx_block,ny_block,max_blocks), & - intent(inout) :: & + real (kind=dbl_kind), dimension(nx_block,ny_block,max_blocks), intent(inout) :: & work ! local variables @@ -1903,8 +1902,7 @@ subroutine u2tgrid_vector (work) use ice_constants, only: field_loc_NEcorner, field_type_vector use ice_domain_size, only: max_blocks - real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks), & - intent(inout) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks), intent(inout) :: & work ! local variables @@ -2189,11 +2187,11 @@ subroutine gridbox_verts(work_g,vbounds) field_loc_NEcorner, field_type_scalar use ice_domain_size, only: max_blocks - real (kind=dbl_kind), dimension(:,:), intent(in) :: work_g + real (kind=dbl_kind), dimension(:,:), intent(in) :: & + work_g - real (kind=dbl_kind), & - dimension(4,nx_block,ny_block,max_blocks), & - intent(out) :: vbounds + real (kind=dbl_kind), dimension(4,nx_block,ny_block,max_blocks), intent(out) :: & + vbounds integer (kind=int_kind) :: & i,j ! index counters diff --git a/cicecore/cicedynB/infrastructure/ice_read_write.F90 b/cicecore/cicedynB/infrastructure/ice_read_write.F90 index 20eff9765..bfedb26e2 100644 --- a/cicecore/cicedynB/infrastructure/ice_read_write.F90 +++ b/cicecore/cicedynB/infrastructure/ice_read_write.F90 @@ -162,8 +162,7 @@ subroutine ice_read_xyt(nu, nrec, work, atype, diag, & nu , & ! unit number nrec ! record number (0 for sequential access) - real (kind=dbl_kind), dimension(nx_block,ny_block,max_blocks), & - intent(out) :: & + real (kind=dbl_kind), dimension(nx_block,ny_block,max_blocks), intent(out) :: & work ! output array (real, 8-byte) character (len=4), intent(in) :: & @@ -308,8 +307,7 @@ subroutine ice_read_xyzt(nu, nrec, work, atype, diag, & nu , & ! unit number nrec ! record number (0 for sequential access) - real (kind=dbl_kind), dimension(nx_block,ny_block,nblyr+2,max_blocks), & - intent(out) :: & + real (kind=dbl_kind), dimension(nx_block,ny_block,nblyr+2,max_blocks), intent(out) :: & work ! output array (real, 8-byte) character (len=4), intent(in) :: & @@ -456,8 +454,7 @@ subroutine ice_read_global (nu, nrec, work_g, atype, diag, & nu , & ! unit number nrec ! record number (0 for sequential access) - real (kind=dbl_kind), dimension(nx_global,ny_global), & - intent(out) :: & + real (kind=dbl_kind), dimension(nx_global,ny_global), intent(out) :: & work_g ! output array (real, 8-byte) character (len=4) :: & @@ -567,8 +564,7 @@ subroutine ice_read_ext(nu, nrec, work, atype, diag, & nu , & ! unit number nrec ! record number (0 for sequential access) - real (kind=dbl_kind), dimension(nx_block,ny_block,max_blocks), & - intent(out) :: & + real (kind=dbl_kind), dimension(nx_block,ny_block,max_blocks), intent(out) :: & work ! output array (real, 8-byte) character (len=4), intent(in) :: & @@ -698,8 +694,7 @@ subroutine ice_write_xyt(nu, nrec, work, atype, diag) nu , & ! unit number nrec ! record number (0 for sequential access) - real (kind=dbl_kind), dimension(nx_block,ny_block,max_blocks), & - intent(in) :: & + real (kind=dbl_kind), dimension(nx_block,ny_block,max_blocks), intent(in) :: & work ! input array (real, 8-byte) character (len=4), intent(in) :: & @@ -1057,8 +1052,7 @@ subroutine ice_read_nc_xy(fid, nrec, varname, work, diag, & character (len=*), intent(in) :: & varname ! field name in netcdf file - real (kind=dbl_kind), dimension(nx_block,ny_block,max_blocks), & - intent(out) :: & + real (kind=dbl_kind), dimension(nx_block,ny_block,max_blocks), intent(out) :: & work ! output array (real, 8-byte) logical (kind=log_kind), optional, intent(in) :: & @@ -1230,8 +1224,7 @@ subroutine ice_read_nc_xyz(fid, nrec, varname, work, diag, & logical (kind=log_kind), intent(in) :: & diag ! if true, write diagnostic output - real (kind=dbl_kind), dimension(nx_block,ny_block,ncat,max_blocks), & - intent(out) :: & + real (kind=dbl_kind), dimension(nx_block,ny_block,ncat,max_blocks), intent(out) :: & work ! output array (real, 8-byte) logical (kind=log_kind), optional, intent(in) :: & @@ -1410,8 +1403,7 @@ subroutine ice_read_nc_point(fid, nrec, varname, work, diag, & field_loc, & ! location of field on staggered grid field_type ! type of field (scalar, vector, angle) - real (kind=dbl_kind), & - intent(out) :: & + real (kind=dbl_kind), intent(out) :: & work ! output variable (real, 8-byte) ! local variables @@ -1504,8 +1496,7 @@ subroutine ice_read_nc_z(fid, nrec, varname, work, diag, & field_loc, & ! location of field on staggered grid field_type ! type of field (scalar, vector, angle) - real (kind=dbl_kind), dimension(nilyr), & - intent(out) :: & + real (kind=dbl_kind), dimension(nilyr), intent(out) :: & work ! output array (real, 8-byte) ! local variables @@ -1597,8 +1588,7 @@ subroutine ice_write_nc_xy(fid, nrec, varid, work, diag, & logical (kind=log_kind), optional, intent(in) :: & restart_ext ! if true, write extended grid - real (kind=dbl_kind), dimension(nx_block,ny_block,max_blocks), & - intent(in) :: & + real (kind=dbl_kind), dimension(nx_block,ny_block,max_blocks), intent(in) :: & work ! output array (real, 8-byte) character (len=*), optional, intent(in) :: & @@ -1717,8 +1707,7 @@ subroutine ice_write_nc_xyz(fid, nrec, varid, work, diag, & logical (kind=log_kind), optional, intent(in) :: & restart_ext ! if true, read extended grid - real (kind=dbl_kind), dimension(nx_block,ny_block,ncat,max_blocks), & - intent(in) :: & + real (kind=dbl_kind), dimension(nx_block,ny_block,ncat,max_blocks), intent(in) :: & work ! output array (real, 8-byte) character (len=*), optional, intent(in) :: & @@ -1844,8 +1833,7 @@ subroutine ice_read_global_nc (fid, nrec, varname, work_g, diag) character (char_len), intent(in) :: & varname ! field name in netcdf file - real (kind=dbl_kind), dimension(nx_global,ny_global), & - intent(out) :: & + real (kind=dbl_kind), dimension(nx_global,ny_global), intent(out) :: & work_g ! output array (real, 8-byte) logical (kind=log_kind) :: & @@ -1992,8 +1980,7 @@ subroutine ice_read_nc_uv(fid, nrec, nzlev, varname, work, diag, & character (len=*), intent(in) :: & varname ! field name in netcdf file - real (kind=dbl_kind), dimension(nx_block,ny_block,max_blocks), & - intent(out) :: & + real (kind=dbl_kind), dimension(nx_block,ny_block,max_blocks), intent(out) :: & work ! output array (real, 8-byte) logical (kind=log_kind), optional, intent(in) :: & diff --git a/cicecore/cicedynB/infrastructure/ice_restart_driver.F90 b/cicecore/cicedynB/infrastructure/ice_restart_driver.F90 index f0ddaaadd..f9a42714e 100644 --- a/cicecore/cicedynB/infrastructure/ice_restart_driver.F90 +++ b/cicecore/cicedynB/infrastructure/ice_restart_driver.F90 @@ -29,7 +29,7 @@ module ice_restart_driver use ice_fileunits, only: nu_diag, nu_rst_pointer, nu_restart, nu_dump use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted use icepack_intfc, only: icepack_aggregate - use icepack_intfc, only: icepack_query_tracer_indices + use icepack_intfc, only: icepack_query_tracer_indices, icepack_query_tracer_numbers implicit none private @@ -203,7 +203,7 @@ subroutine restartfile (ice_ic) use ice_communicate, only: my_task, master_task use ice_domain, only: nblocks, halo_info use ice_domain_size, only: nilyr, nslyr, ncat, & - max_ntrcr, max_blocks + max_blocks use ice_flux, only: scale_factor, swvdr, swvdf, swidr, swidf, & strocnxT, strocnyT, sst, frzmlt, iceumask, & stressp_1, stressp_2, stressp_3, stressp_4, & @@ -223,6 +223,7 @@ subroutine restartfile (ice_ic) integer (kind=int_kind) :: & i, j, k, iblk, & ! counting indices + ntrcr, & ! number of tracers nt_Tsfc, nt_sice, nt_qice, nt_qsno logical (kind=log_kind) :: & @@ -235,6 +236,11 @@ subroutine restartfile (ice_ic) character(len=*), parameter :: subname = '(restartfile)' + call icepack_query_tracer_numbers(ntrcr_out=ntrcr) + call icepack_warnings_flush(nu_diag) + if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & + file=__FILE__, line=__LINE__) + call icepack_query_tracer_indices(nt_Tsfc_out=nt_Tsfc, nt_sice_out=nt_sice, & nt_qice_out=nt_qice, nt_qsno_out=nt_qsno) call icepack_warnings_flush(nu_diag) @@ -497,7 +503,7 @@ subroutine restartfile (ice_ic) vice (i,j, iblk), & vsno (i,j, iblk), & aice0(i,j, iblk), & - max_ntrcr, & + ntrcr, & trcr_depend, & trcr_base, & n_trcr_strata, & @@ -534,7 +540,7 @@ subroutine restartfile_v4 (ice_ic) use ice_communicate, only: my_task, master_task use ice_domain, only: nblocks, distrb_info use ice_domain_size, only: nilyr, nslyr, ncat, nx_global, ny_global, & - max_ntrcr, max_blocks + max_blocks use ice_flux, only: scale_factor, swvdr, swvdf, swidr, swidf, & strocnxT, strocnyT, sst, frzmlt, iceumask, & stressp_1, stressp_2, stressp_3, stressp_4, & @@ -553,6 +559,7 @@ subroutine restartfile_v4 (ice_ic) integer (kind=int_kind) :: & i, j, k, n, iblk, & ! counting indices + ntrcr, & ! number of tracers nt_Tsfc, nt_sice, nt_qice, nt_qsno, & iignore ! dummy variable @@ -573,6 +580,11 @@ subroutine restartfile_v4 (ice_ic) character(len=*), parameter :: subname = '(restartfile_v4)' + call icepack_query_tracer_numbers(ntrcr_out=ntrcr) + call icepack_warnings_flush(nu_diag) + if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & + file=__FILE__, line=__LINE__) + call icepack_query_tracer_indices(nt_Tsfc_out=nt_Tsfc, nt_sice_out=nt_sice, & nt_qice_out=nt_qice, nt_qsno_out=nt_qsno) call icepack_warnings_flush(nu_diag) @@ -854,7 +866,7 @@ subroutine restartfile_v4 (ice_ic) vice (i,j, iblk), & vsno (i,j, iblk), & aice0(i,j, iblk), & - max_ntrcr, & + ntrcr, & trcr_depend, & trcr_base, & n_trcr_strata, & diff --git a/cicecore/cicedynB/infrastructure/ice_restoring.F90 b/cicecore/cicedynB/infrastructure/ice_restoring.F90 index 5ac3253a8..fbf0d3b07 100644 --- a/cicecore/cicedynB/infrastructure/ice_restoring.F90 +++ b/cicecore/cicedynB/infrastructure/ice_restoring.F90 @@ -315,23 +315,19 @@ subroutine set_restore_var (nx_block, ny_block, & Tair , & ! air temperature (K) Tf ! freezing temperature (C) - real (kind=dbl_kind), dimension (nx_block,ny_block,nilyr), & - intent(in) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block,nilyr), intent(in) :: & salinz , & ! initial salinity profile Tmltz ! initial melting temperature profile - logical (kind=log_kind), dimension (nx_block,ny_block), & - intent(in) :: & + logical (kind=log_kind), dimension (nx_block,ny_block), intent(in) :: & tmask ! true for ice/ocean cells - real (kind=dbl_kind), dimension (nx_block,ny_block,ncat), & - intent(out) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block,ncat), intent(out) :: & aicen , & ! concentration of ice vicen , & ! volume per unit area of ice (m) vsnon ! volume per unit area of snow (m) - real (kind=dbl_kind), dimension (nx_block,ny_block,ntrcr,ncat), & - intent(out) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block,ntrcr,ncat), intent(out) :: & trcrn ! ice tracers ! 1: surface temperature of ice/snow (C) diff --git a/cicecore/cicedynB/infrastructure/io/io_binary/ice_restart.F90 b/cicecore/cicedynB/infrastructure/io/io_binary/ice_restart.F90 index eaa513e91..a9aaef525 100644 --- a/cicecore/cicedynB/infrastructure/io/io_binary/ice_restart.F90 +++ b/cicecore/cicedynB/infrastructure/io/io_binary/ice_restart.F90 @@ -617,8 +617,7 @@ subroutine read_restart_field(nu,nrec,work,atype,vname,ndim3, & ndim3 , & ! third dimension nrec ! record number (0 for sequential access) - real (kind=dbl_kind), dimension(nx_block,ny_block,ndim3,max_blocks), & - intent(inout) :: & + real (kind=dbl_kind), dimension(nx_block,ny_block,ndim3,max_blocks), intent(inout) :: & work ! input array (real, 8-byte) character (len=4), intent(in) :: & @@ -685,8 +684,7 @@ subroutine write_restart_field(nu,nrec,work,atype,vname,ndim3,diag) ndim3 , & ! third dimension nrec ! record number (0 for sequential access) - real (kind=dbl_kind), dimension(nx_block,ny_block,ndim3,max_blocks), & - intent(in) :: & + real (kind=dbl_kind), dimension(nx_block,ny_block,ndim3,max_blocks), intent(in) :: & work ! input array (real, 8-byte) character (len=4), intent(in) :: & diff --git a/cicecore/cicedynB/infrastructure/io/io_netcdf/ice_restart.F90 b/cicecore/cicedynB/infrastructure/io/io_netcdf/ice_restart.F90 index 7e9e93e01..83f9bee1a 100644 --- a/cicecore/cicedynB/infrastructure/io/io_netcdf/ice_restart.F90 +++ b/cicecore/cicedynB/infrastructure/io/io_netcdf/ice_restart.F90 @@ -625,8 +625,7 @@ subroutine read_restart_field(nu,nrec,work,atype,vname,ndim3, & ndim3 , & ! third dimension nrec ! record number (0 for sequential access) - real (kind=dbl_kind), dimension(nx_block,ny_block,ndim3,max_blocks), & - intent(inout) :: & + real (kind=dbl_kind), dimension(nx_block,ny_block,ndim3,max_blocks), intent(inout) :: & work ! input array (real, 8-byte) character (len=4), intent(in) :: & @@ -710,8 +709,7 @@ subroutine write_restart_field(nu,nrec,work,atype,vname,ndim3,diag) ndim3 , & ! third dimension nrec ! record number (0 for sequential access) - real (kind=dbl_kind), dimension(nx_block,ny_block,ndim3,max_blocks), & - intent(in) :: & + real (kind=dbl_kind), dimension(nx_block,ny_block,ndim3,max_blocks), intent(in) :: & work ! input array (real, 8-byte) character (len=4), intent(in) :: & diff --git a/cicecore/cicedynB/infrastructure/io/io_pio/ice_restart.F90 b/cicecore/cicedynB/infrastructure/io/io_pio/ice_restart.F90 index 64a6bea86..cee9d32d5 100644 --- a/cicecore/cicedynB/infrastructure/io/io_pio/ice_restart.F90 +++ b/cicecore/cicedynB/infrastructure/io/io_pio/ice_restart.F90 @@ -645,8 +645,7 @@ subroutine read_restart_field(nu,nrec,work,atype,vname,ndim3,diag, & ndim3 , & ! third dimension nrec ! record number (0 for sequential access) - real (kind=dbl_kind), dimension(nx_block,ny_block,ndim3,max_blocks), & - intent(inout) :: & + real (kind=dbl_kind), dimension(nx_block,ny_block,ndim3,max_blocks), intent(inout) :: & work ! input array (real, 8-byte) character (len=4), intent(in) :: & @@ -753,8 +752,7 @@ subroutine write_restart_field(nu,nrec,work,atype,vname,ndim3,diag) ndim3 , & ! third dimension nrec ! record number (0 for sequential access) - real (kind=dbl_kind), dimension(nx_block,ny_block,ndim3,max_blocks), & - intent(in) :: & + real (kind=dbl_kind), dimension(nx_block,ny_block,ndim3,max_blocks), intent(in) :: & work ! input array (real, 8-byte) character (len=4), intent(in) :: & diff --git a/cicecore/drivers/cesm/CICE_InitMod.F90 b/cicecore/drivers/cesm/CICE_InitMod.F90 index 3c27ce358..5a7e4ec84 100644 --- a/cicecore/drivers/cesm/CICE_InitMod.F90 +++ b/cicecore/drivers/cesm/CICE_InitMod.F90 @@ -18,6 +18,7 @@ module CICE_InitMod use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted use icepack_intfc, only: icepack_query_parameters use icepack_intfc, only: icepack_query_tracer_flags, icepack_query_tracer_indices + use icepack_intfc, only: icepack_query_tracer_numbers implicit none private @@ -211,7 +212,7 @@ subroutine init_restart use ice_calendar, only: time, calendar use icepack_intfc, only: icepack_aggregate use ice_domain, only: nblocks - use ice_domain_size, only: ncat, max_ntrcr, n_aero + use ice_domain_size, only: ncat, n_aero use ice_dyn_eap, only: read_restart_eap use ice_dyn_shared, only: kdyn use ice_flux, only: sss @@ -242,6 +243,8 @@ subroutine init_restart tr_pond_cesm, tr_pond_lvl, & tr_pond_topo, tr_aero, tr_brine, & skl_bgc, z_tracers, solve_zsal + integer (kind=int_kind) :: & + ntrcr integer (kind=int_kind) :: & nt_alvl, nt_vlvl, & nt_apnd, nt_hpnd, nt_ipnd, & @@ -249,6 +252,11 @@ subroutine init_restart character(len=*), parameter :: subname = '(init_restart)' + call icepack_query_tracer_numbers(ntrcr_out=ntrcr) + call icepack_warnings_flush(nu_diag) + if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & + file=__FILE__, line=__LINE__) + call icepack_query_parameters(skl_bgc_out=skl_bgc, z_tracers_out=z_tracers, solve_zsal_out=solve_zsal) call icepack_query_tracer_flags(tr_iage_out=tr_iage, tr_FY_out=tr_FY, tr_lvl_out=tr_lvl, & tr_pond_cesm_out=tr_pond_cesm, tr_pond_lvl_out=tr_pond_lvl, & @@ -400,7 +408,7 @@ subroutine init_restart vice (i,j, iblk), & vsno (i,j, iblk), & aice0(i,j, iblk), & - max_ntrcr, & + ntrcr, & trcr_depend, & trcr_base, & n_trcr_strata, & diff --git a/cicecore/drivers/cesm/CICE_RunMod.F90 b/cicecore/drivers/cesm/CICE_RunMod.F90 index 9a41ac707..704a96ab0 100644 --- a/cicecore/drivers/cesm/CICE_RunMod.F90 +++ b/cicecore/drivers/cesm/CICE_RunMod.F90 @@ -583,21 +583,17 @@ subroutine sfcflux_to_ocn(nx_block, ny_block, & integer (kind=int_kind), intent(in) :: & nx_block, ny_block ! block dimensions - logical (kind=log_kind), dimension (nx_block,ny_block), & - intent(in) :: & + logical (kind=log_kind), dimension (nx_block,ny_block), intent(in) :: & tmask ! land/boundary mask, thickness (T-cell) - real (kind=dbl_kind), dimension(nx_block,ny_block), & - intent(in):: & + real (kind=dbl_kind), dimension(nx_block,ny_block), intent(in):: & aice ! initial ice concentration - real (kind=dbl_kind), dimension(nx_block,ny_block,ncat), & - intent(in) :: & + real (kind=dbl_kind), dimension(nx_block,ny_block,ncat), intent(in) :: & fsurfn_f, & ! net surface heat flux (provided as forcing) flatn_f ! latent heat flux (provided as forcing) - real (kind=dbl_kind), dimension(nx_block,ny_block), & - intent(inout):: & + real (kind=dbl_kind), dimension(nx_block,ny_block), intent(inout):: & fresh , & ! fresh water flux to ocean (kg/m2/s) fhocn ! actual ocn/ice heat flx (W/m**2) diff --git a/cicecore/drivers/cice/CICE_InitMod.F90 b/cicecore/drivers/cice/CICE_InitMod.F90 index 536813bfb..dd88ac532 100644 --- a/cicecore/drivers/cice/CICE_InitMod.F90 +++ b/cicecore/drivers/cice/CICE_InitMod.F90 @@ -20,7 +20,7 @@ module CICE_InitMod use icepack_intfc, only: icepack_configure use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted use icepack_intfc, only: icepack_query_parameters, icepack_query_tracer_flags, & - icepack_query_tracer_indices + icepack_query_tracer_indices, icepack_query_tracer_numbers implicit none private @@ -79,7 +79,7 @@ subroutine cice_init use ice_history, only: init_hist, accum_hist use ice_restart_shared, only: restart, runid, runtype use ice_init, only: input_data, init_state - use ice_init_column, only: init_thermo_vertical, init_shortwave, init_zbgc + use ice_init_column, only: init_thermo_vertical, init_shortwave, init_zbgc, input_zbgc, count_tracers use ice_kinds_mod use ice_restoring, only: ice_HaloRestore_init use ice_timers, only: timer_total, init_ice_timers, ice_timer_start @@ -103,8 +103,8 @@ subroutine cice_init file=__FILE__,line= __LINE__) call input_data ! namelist variables - - if (trim(runid) == 'bering') call check_finished_file + call input_zbgc ! vertical biogeochemistry namelist + call count_tracers ! count tracers call init_domain_blocks ! set up block decomposition call init_grid1 ! domain distribution @@ -117,7 +117,7 @@ subroutine cice_init call init_ice_timers ! initialize all timers call ice_timer_start(timer_total) ! start timing entire run call init_grid2 ! grid variables - call init_zbgc ! vertical biogeochemistry namelist + call init_zbgc ! vertical biogeochemistry initialization call init_calendar ! initialize some calendar stuff call init_hist (dt) ! initialize output history file @@ -216,7 +216,7 @@ subroutine init_restart use ice_calendar, only: time, calendar use ice_constants, only: c0 use ice_domain, only: nblocks - use ice_domain_size, only: ncat, max_ntrcr, n_aero + use ice_domain_size, only: ncat, n_aero use ice_dyn_eap, only: read_restart_eap use ice_dyn_shared, only: kdyn use ice_grid, only: tmask @@ -243,12 +243,19 @@ subroutine init_restart tr_iage, tr_FY, tr_lvl, tr_pond_cesm, tr_pond_lvl, & tr_pond_topo, tr_aero, tr_brine, & skl_bgc, z_tracers, solve_zsal + integer(kind=int_kind) :: & + ntrcr integer(kind=int_kind) :: & nt_alvl, nt_vlvl, nt_apnd, nt_hpnd, nt_ipnd, & nt_iage, nt_FY, nt_aero character(len=*), parameter :: subname = '(init_restart)' + call icepack_query_tracer_numbers(ntrcr_out=ntrcr) + call icepack_warnings_flush(nu_diag) + if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & + file=__FILE__, line=__LINE__) + call icepack_query_parameters(skl_bgc_out=skl_bgc, & z_tracers_out=z_tracers, solve_zsal_out=solve_zsal) call icepack_query_tracer_flags(tr_iage_out=tr_iage, tr_FY_out=tr_FY, & @@ -398,7 +405,7 @@ subroutine init_restart vice (i,j, iblk), & vsno (i,j, iblk), & aice0(i,j, iblk), & - max_ntrcr, & + ntrcr, & trcr_depend, & trcr_base, & n_trcr_strata, & @@ -418,35 +425,6 @@ subroutine init_restart end subroutine init_restart -!======================================================================= -! -! Check whether a file indicating that the previous run finished cleanly -! If so, then do not continue the current restart. This is needed only -! for runs on machine 'bering' (set using runid = 'bering'). -! -! author: Adrian Turner, LANL - - subroutine check_finished_file() - - use ice_communicate, only: my_task, master_task - use ice_restart_shared, only: restart_dir - - character(len=char_len_long) :: filename - logical :: lexist = .false. - character(len=*), parameter :: subname='(check_finished_file)' - - if (my_task == master_task) then - - filename = trim(restart_dir)//"finished" - inquire(file=filename, exist=lexist) - if (lexist) then - call abort_ice(subname//"ERROR: Found already finished file - quitting") - end if - - endif - - end subroutine check_finished_file - !======================================================================= end module CICE_InitMod diff --git a/cicecore/drivers/cice/CICE_RunMod.F90 b/cicecore/drivers/cice/CICE_RunMod.F90 index ca7a5bd82..54a0caaac 100644 --- a/cicecore/drivers/cice/CICE_RunMod.F90 +++ b/cicecore/drivers/cice/CICE_RunMod.F90 @@ -580,21 +580,17 @@ subroutine sfcflux_to_ocn(nx_block, ny_block, & integer (kind=int_kind), intent(in) :: & nx_block, ny_block ! block dimensions - logical (kind=log_kind), dimension (nx_block,ny_block), & - intent(in) :: & + logical (kind=log_kind), dimension (nx_block,ny_block), intent(in) :: & tmask ! land/boundary mask, thickness (T-cell) - real (kind=dbl_kind), dimension(nx_block,ny_block), & - intent(in):: & + real (kind=dbl_kind), dimension(nx_block,ny_block), intent(in):: & aice ! initial ice concentration - real (kind=dbl_kind), dimension(nx_block,ny_block,ncat), & - intent(in) :: & + real (kind=dbl_kind), dimension(nx_block,ny_block,ncat), intent(in) :: & fsurfn_f, & ! net surface heat flux (provided as forcing) flatn_f ! latent heat flux (provided as forcing) - real (kind=dbl_kind), dimension(nx_block,ny_block), & - intent(inout):: & + real (kind=dbl_kind), dimension(nx_block,ny_block), intent(inout):: & fresh , & ! fresh water flux to ocean (kg/m2/s) fhocn ! actual ocn/ice heat flx (W/m**2) diff --git a/cicecore/drivers/cice/CICE_RunMod.F90_debug b/cicecore/drivers/cice/CICE_RunMod.F90_debug index 9ffe0094a..f0631b936 100644 --- a/cicecore/drivers/cice/CICE_RunMod.F90_debug +++ b/cicecore/drivers/cice/CICE_RunMod.F90_debug @@ -612,21 +612,17 @@ integer (kind=int_kind), intent(in) :: & nx_block, ny_block ! block dimensions - logical (kind=log_kind), dimension (nx_block,ny_block), & - intent(in) :: & + logical (kind=log_kind), dimension (nx_block,ny_block), intent(in) :: & tmask ! land/boundary mask, thickness (T-cell) - real (kind=dbl_kind), dimension(nx_block,ny_block), & - intent(in):: & + real (kind=dbl_kind), dimension(nx_block,ny_block), intent(in):: & aice ! initial ice concentration - real (kind=dbl_kind), dimension(nx_block,ny_block,ncat), & - intent(in) :: & + real (kind=dbl_kind), dimension(nx_block,ny_block,ncat), intent(in) :: & fsurfn_f, & ! net surface heat flux (provided as forcing) flatn_f ! latent heat flux (provided as forcing) - real (kind=dbl_kind), dimension(nx_block,ny_block), & - intent(inout):: & + real (kind=dbl_kind), dimension(nx_block,ny_block), intent(inout):: & fresh , & ! fresh water flux to ocean (kg/m2/s) fhocn ! actual ocn/ice heat flx (W/m**2) diff --git a/cicecore/drivers/hadgem3/CICE_InitMod.F90 b/cicecore/drivers/hadgem3/CICE_InitMod.F90 index b171afe1c..17c3f5d6f 100644 --- a/cicecore/drivers/hadgem3/CICE_InitMod.F90 +++ b/cicecore/drivers/hadgem3/CICE_InitMod.F90 @@ -20,7 +20,7 @@ module CICE_InitMod use icepack_intfc, only: icepack_configure use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted use icepack_intfc, only: icepack_query_parameters, icepack_query_tracer_flags, & - icepack_query_tracer_indices + icepack_query_tracer_indices, icepack_query_tracer_numbers implicit none private @@ -217,7 +217,7 @@ subroutine init_restart use ice_calendar, only: time, calendar use ice_constants, only: c0 use ice_domain, only: nblocks - use ice_domain_size, only: ncat, max_ntrcr, n_aero + use ice_domain_size, only: ncat, n_aero use ice_dyn_eap, only: read_restart_eap use ice_dyn_shared, only: kdyn use ice_flux, only: sss @@ -245,10 +245,17 @@ subroutine init_restart tr_iage, tr_FY, tr_lvl, tr_pond_cesm, tr_pond_lvl, & tr_pond_topo, tr_aero, tr_brine, & skl_bgc, z_tracers, solve_zsal + integer(kind=int_kind) :: & + ntrcr integer(kind=int_kind) :: & nt_alvl, nt_vlvl, nt_apnd, nt_hpnd, nt_ipnd, & nt_iage, nt_FY, nt_aero + call icepack_query_tracer_numbers(ntrcr_out=ntrcr) + call icepack_warnings_flush(nu_diag) + if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & + file=__FILE__, line=__LINE__) + call icepack_query_parameters(skl_bgc_out=skl_bgc, & z_tracers_out=z_tracers, solve_zsal_out=solve_zsal) call icepack_query_tracer_flags(tr_iage_out=tr_iage, tr_FY_out=tr_FY, & @@ -398,7 +405,7 @@ subroutine init_restart vice (i,j, iblk), & vsno (i,j, iblk), & aice0(i,j, iblk), & - max_ntrcr, & + ntrcr, & trcr_depend, & trcr_base, & n_trcr_strata, & diff --git a/cicecore/drivers/hadgem3/CICE_RunMod.F90 b/cicecore/drivers/hadgem3/CICE_RunMod.F90 index 6741521b9..998766f16 100644 --- a/cicecore/drivers/hadgem3/CICE_RunMod.F90 +++ b/cicecore/drivers/hadgem3/CICE_RunMod.F90 @@ -558,21 +558,17 @@ subroutine sfcflux_to_ocn(nx_block, ny_block, & integer (kind=int_kind), intent(in) :: & nx_block, ny_block ! block dimensions - logical (kind=log_kind), dimension (nx_block,ny_block), & - intent(in) :: & + logical (kind=log_kind), dimension (nx_block,ny_block), intent(in) :: & tmask ! land/boundary mask, thickness (T-cell) - real (kind=dbl_kind), dimension(nx_block,ny_block), & - intent(in):: & + real (kind=dbl_kind), dimension(nx_block,ny_block), intent(in):: & aice ! initial ice concentration - real (kind=dbl_kind), dimension(nx_block,ny_block,ncat), & - intent(in) :: & + real (kind=dbl_kind), dimension(nx_block,ny_block,ncat), intent(in) :: & fsurfn_f, & ! net surface heat flux (provided as forcing) flatn_f ! latent heat flux (provided as forcing) - real (kind=dbl_kind), dimension(nx_block,ny_block), & - intent(inout):: & + real (kind=dbl_kind), dimension(nx_block,ny_block), intent(inout):: & fresh , & ! fresh water flux to ocean (kg/m2/s) fhocn ! actual ocn/ice heat flx (W/m**2) diff --git a/cicecore/shared/ice_arrays_column.F90 b/cicecore/shared/ice_arrays_column.F90 index 689d9a477..2ac4c4a3c 100644 --- a/cicecore/shared/ice_arrays_column.F90 +++ b/cicecore/shared/ice_arrays_column.F90 @@ -12,10 +12,10 @@ module ice_arrays_column use ice_fileunits, only: nu_diag use ice_blocks, only: nx_block, ny_block use ice_domain_size, only: max_blocks, ncat, nilyr, nslyr, & - nblyr, max_ntrcr + nblyr use icepack_intfc, only: icepack_nspint use icepack_intfc, only: icepack_query_tracer_sizes, icepack_query_parameters, & - icepack_warnings_flush, icepack_warnings_aborted + icepack_warnings_flush, icepack_warnings_aborted, icepack_query_tracer_numbers implicit none private @@ -281,11 +281,12 @@ subroutine alloc_arrays_column use ice_exit, only: abort_ice integer (int_kind) :: nspint, max_nbtrcr, max_algae, max_aero, & nmodal1, nmodal2, max_don - integer (int_kind) :: ierr + integer (int_kind) :: ierr, ntrcr character(len=*),parameter :: subname='(alloc_arrays_column)' ! call icepack_query_parameters(nspint_out=nspint) + call icepack_query_tracer_numbers(ntrcr_out=ntrcr) call icepack_query_tracer_sizes( max_nbtrcr_out=max_nbtrcr, & max_algae_out=max_algae, max_aero_out=max_aero, & nmodal1_out=nmodal1, nmodal2_out=nmodal2, max_don_out=max_don) @@ -367,7 +368,7 @@ subroutine alloc_arrays_column ocean_bio_all(nx_block,ny_block,max_nbtrcr,max_blocks), & ! fixed order, all values even for tracers false ice_bio_net (nx_block,ny_block,max_nbtrcr,max_blocks), & ! depth integrated tracer (mmol/m^2) snow_bio_net (nx_block,ny_block,max_nbtrcr,max_blocks), & ! depth integrated snow tracer (mmol/m^2) - trcrn_sw (nx_block,ny_block,max_ntrcr,ncat,max_blocks), & ! bgc tracers active in the delta-Eddington shortwave + trcrn_sw (nx_block,ny_block,ntrcr,ncat,max_blocks), & ! bgc tracers active in the delta-Eddington shortwave algal_peak (nx_block,ny_block,max_algae,max_blocks), & ! vertical location of algal maximum, 0 if no maximum stat=ierr) if (ierr/=0) call abort_ice(subname//': Out of Memory2') @@ -394,14 +395,6 @@ subroutine alloc_arrays_column stat=ierr) if (ierr/=0) call abort_ice(subname//' Out of Memory4') - allocate( & - R_C2N_DON(max_don), & ! carbon to nitrogen mole ratio of DON pool - R_C2N(max_algae), & ! algal C to N (mole/mole) - R_chl2N(max_algae), & ! 3 algal chlorophyll to N (mg/mmol) - R_Si2N(max_algae), & ! silica to nitrogen mole ratio for algal groups - stat=ierr) - if (ierr/=0) call abort_ice(subname//' Out of Memory5') - end subroutine alloc_arrays_column !======================================================================= diff --git a/cicecore/shared/ice_domain_size.F90 b/cicecore/shared/ice_domain_size.F90 index 96d2b5f52..9eb25668b 100644 --- a/cicecore/shared/ice_domain_size.F90 +++ b/cicecore/shared/ice_domain_size.F90 @@ -31,6 +31,7 @@ module ice_domain_size ncat , & ! number of categories nilyr , & ! number of ice layers per category nslyr , & ! number of snow layers per category + nblyr , & ! number of bio/brine layers per category n_aero , & ! number of aerosols in use n_zaero , & ! number of z aerosols in use n_algae , & ! number of algae in use @@ -38,25 +39,7 @@ module ice_domain_size n_dic , & ! number of DIC pools in use n_don , & ! number of DON pools in use n_fed , & ! number of Fe pools in use dissolved Fe - n_fep , & ! number of Fe pools in use particulate Fe - nblyr , & ! number of bio/brine layers per category - n_trbgcz , & ! zbgc - n_trzs , & ! zsalinity - n_trbri , & ! brine height - n_trzaero , & ! tracers active in shortwave calculation - n_trage , & ! age - n_trfy , & ! first-year area - n_trlvl , & ! level/deformed ice - n_trpnd , & ! ponds - n_trbgcs ! skeleltel layer bgc - - ! derived from namelist above - - integer (kind=int_kind), public :: & - n_bgc , & ! nit, am, sil, dmspp, dmspd, dms, pon, humic - nltrcr , & ! number of zbgc (includes zaero) and zsalinity tracers - max_nsw , & ! - max_ntrcr ! + n_fep ! number of Fe pools in use particulate Fe integer (kind=int_kind), public, parameter :: & max_nstrm = 5 ! max number of history output streams diff --git a/cicecore/shared/ice_init_column.F90 b/cicecore/shared/ice_init_column.F90 index 2ee9da12a..3418f2257 100644 --- a/cicecore/shared/ice_init_column.F90 +++ b/cicecore/shared/ice_init_column.F90 @@ -4,21 +4,19 @@ ! ! author: Elizabeth C. Hunke, LANL ! -! 2014: Moved subroutines from column package modules - module ice_init_column use ice_kinds_mod use ice_constants + use ice_communicate, only: my_task, master_task, ice_barrier use ice_domain_size, only: ncat, max_blocks - use ice_domain_size, only: max_ntrcr, nblyr, nilyr, nslyr + use ice_domain_size, only: nblyr, nilyr, nslyr use ice_domain_size, only: n_aero, n_zaero, n_algae use ice_domain_size, only: n_doc, n_dic, n_don - use ice_domain_size, only: n_fed, n_fep, max_nsw, n_bgc - use ice_domain_size, only: n_trzs, n_trbri, n_trbgcs, n_algae, n_trbgcz + use ice_domain_size, only: n_fed, n_fep use ice_fileunits, only: nu_diag use ice_fileunits, only: nu_nml, nml_filename, get_fileunit, & - release_fileunit + release_fileunit, flush_fileunit use ice_exit, only: abort_ice use icepack_intfc, only: icepack_max_don, icepack_max_doc, icepack_max_dic use icepack_intfc, only: icepack_max_algae, icepack_max_aero, icepack_max_fe @@ -43,7 +41,77 @@ module ice_init_column public :: init_thermo_vertical, init_shortwave, & init_age, init_FY, init_lvl, & init_meltponds_cesm, init_meltponds_lvl, init_meltponds_topo, & - init_aerosol, init_bgc, init_hbrine, init_zbgc + init_aerosol, init_bgc, init_hbrine, init_zbgc, input_zbgc, & + count_tracers + + ! namelist parameters needed locally + + real (kind=dbl_kind) :: & + tau_min , tau_max , & + nitratetype , ammoniumtype , silicatetype, & + dmspptype , dmspdtype , humtype + + real (kind=dbl_kind), dimension(icepack_max_dic) :: & + dictype + + real (kind=dbl_kind), dimension(icepack_max_algae) :: & + algaltype ! tau_min for both retention and release + + real (kind=dbl_kind), dimension(icepack_max_doc) :: & + doctype + + real (kind=dbl_kind), dimension(icepack_max_don) :: & + dontype + + real (kind=dbl_kind), dimension(icepack_max_fe) :: & + fedtype + + real (kind=dbl_kind), dimension(icepack_max_fe) :: & + feptype + + real (kind=dbl_kind), dimension(icepack_max_aero) :: & + zaerotype + + real (kind=dbl_kind) :: & + grid_o, l_sk, grid_o_t, initbio_frac, & + frazil_scav, grid_oS, l_skS, & + phi_snow, & + ratio_Si2N_diatoms , ratio_Si2N_sp , ratio_Si2N_phaeo , & + ratio_S2N_diatoms , ratio_S2N_sp , ratio_S2N_phaeo , & + ratio_Fe2C_diatoms , ratio_Fe2C_sp , ratio_Fe2C_phaeo , & + ratio_Fe2N_diatoms , ratio_Fe2N_sp , ratio_Fe2N_phaeo , & + ratio_Fe2DON , ratio_Fe2DOC_s , ratio_Fe2DOC_l , & + fr_resp , & + algal_vel , R_dFe2dust , dustFe_sol , & + chlabs_diatoms , chlabs_sp , chlabs_phaeo , & + alpha2max_low_diatoms,alpha2max_low_sp , alpha2max_low_phaeo, & + beta2max_diatoms , beta2max_sp , beta2max_phaeo , & + mu_max_diatoms , mu_max_sp , mu_max_phaeo , & + grow_Tdep_diatoms , grow_Tdep_sp , grow_Tdep_phaeo , & + fr_graze_diatoms , fr_graze_sp , fr_graze_phaeo , & + mort_pre_diatoms , mort_pre_sp , mort_pre_phaeo , & + mort_Tdep_diatoms , mort_Tdep_sp , mort_Tdep_phaeo , & + k_exude_diatoms , k_exude_sp , k_exude_phaeo , & + K_Nit_diatoms , K_Nit_sp , K_Nit_phaeo , & + K_Am_diatoms , K_Am_sp , K_Am_phaeo , & + K_Sil_diatoms , K_Sil_sp , K_Sil_phaeo , & + K_Fe_diatoms , K_Fe_sp , K_Fe_phaeo , & + f_don_protein , kn_bac_protein , f_don_Am_protein , & + f_doc_s , f_doc_l , f_exude_s , & + f_exude_l , k_bac_s , k_bac_l , & + T_max , fsal , op_dep_min , & + fr_graze_s , fr_graze_e , fr_mort2min , & + fr_dFe , k_nitrif , t_iron_conv , & + max_loss , max_dfe_doc1 , fr_resp_s , & + y_sk_DMS , t_sk_conv , t_sk_ox , & + algaltype_diatoms , algaltype_sp , algaltype_phaeo , & + doctype_s , doctype_l , dontype_protein , & + fedtype_1 , feptype_1 , zaerotype_bc1 , & + zaerotype_bc2 , zaerotype_dust1 , zaerotype_dust2 , & + zaerotype_dust3 , zaerotype_dust4 , ratio_C2N_diatoms , & + ratio_C2N_sp , ratio_C2N_phaeo , ratio_chl2N_diatoms, & + ratio_chl2N_sp , ratio_chl2N_phaeo , F_abs_chl_diatoms , & + F_abs_chl_sp , F_abs_chl_phaeo , ratio_C2N_proteins !======================================================================= @@ -117,7 +185,6 @@ subroutine init_shortwave use ice_blocks, only: block, get_block, nx_block, ny_block use ice_calendar, only: dt, calendar_type, & days_per_year, nextsw_cday, yday, sec - use ice_communicate, only: my_task use ice_diagnostics, only: npnt, print_points, pmloc, piloc, pjloc, & diagnostic_abort use ice_domain, only: nblocks, blocks_ice @@ -155,11 +222,9 @@ subroutine init_shortwave real (kind=dbl_kind), dimension(ncat) :: & fbri ! brine height to ice thickness - real(kind= dbl_kind), dimension(max_ntrcr, ncat) :: & - ztrcr - - real(kind= dbl_kind), dimension(max_ntrcr, ncat) :: & - ztrcr_sw + real(kind=dbl_kind), allocatable :: & + ztrcr(:,:), & ! + ztrcr_sw(:,:) ! logical (kind=log_kind) :: tr_brine, tr_zaero, tr_bgc_n integer (kind=int_kind) :: nt_alvl, nt_apnd, nt_hpnd, nt_ipnd, nt_aero, & @@ -183,6 +248,9 @@ subroutine init_shortwave if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & file=__FILE__,line= __LINE__) + allocate(ztrcr(ntrcr, ncat)) + allocate(ztrcr_sw(ntrcr, ncat)) + !!$OMP PARALLEL DO PRIVATE(iblk,i,j,n,ilo,ihi,jlo,jhi,this_block, & !!$OMP l_print_point,debug,ipoint) do iblk=1,nblocks @@ -387,6 +455,8 @@ subroutine init_shortwave enddo ! j enddo ! iblk + deallocate(ztrcr, ztrcr_sw) + call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & file=__FILE__, line=__LINE__) @@ -548,8 +618,8 @@ subroutine init_bgc() type (block) :: & this_block ! block information for current block - real(kind=dbl_kind), dimension(max_ntrcr,ncat) :: & - trcrn_bgc + real(kind=dbl_kind), allocatable :: & + trcrn_bgc(:,:) real(kind=dbl_kind), dimension(nilyr,ncat) :: & sicen @@ -565,6 +635,18 @@ subroutine init_bgc() ! Initialize + call icepack_query_parameters(solve_zsal_out=solve_zsal) + call icepack_query_tracer_numbers(nbtrcr_out=nbtrcr, ntrcr_out=ntrcr, ntrcr_o_out=ntrcr_o) + call icepack_query_tracer_indices(nt_sice_out=nt_sice, nt_bgc_S_out=nt_bgc_S) + call icepack_query_tracer_sizes(max_nbtrcr_out=max_nbtrcr, & + max_algae_out=max_algae, max_don_out=max_don, max_doc_out=max_doc, & + max_dic_out=max_dic, max_aero_out=max_aero, max_fe_out=max_fe) + call icepack_warnings_flush(nu_diag) + if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & + file=__FILE__,line= __LINE__) + + allocate(trcrn_bgc(ntrcr,ncat)) + bphi(:,:,:,:,:) = c0 ! initial porosity for no ice iDi (:,:,:,:,:) = c0 ! interface diffusivity bTiz(:,:,:,:,:) = c0 ! initial bio grid ice temperature @@ -579,16 +661,6 @@ subroutine init_bgc() RayleighR = c0 RayleighC = .false. - call icepack_query_parameters(solve_zsal_out=solve_zsal) - call icepack_query_tracer_numbers(nbtrcr_out=nbtrcr, ntrcr_out=ntrcr, ntrcr_o_out=ntrcr_o) - call icepack_query_tracer_indices(nt_sice_out=nt_sice, nt_bgc_S_out=nt_bgc_S) - call icepack_query_tracer_sizes(max_nbtrcr_out=max_nbtrcr, & - max_algae_out=max_algae, max_don_out=max_don, max_doc_out=max_doc, & - max_dic_out=max_dic, max_aero_out=max_aero, max_fe_out=max_fe) - call icepack_warnings_flush(nu_diag) - if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & - file=__FILE__,line= __LINE__) - !----------------------------------------------------------------- ! zsalinity initialization !----------------------------------------------------------------- @@ -708,7 +780,6 @@ subroutine init_bgc() file=__FILE__, line=__LINE__) if (.not. restart_bgc) then - !$OMP PARALLEL DO PRIVATE(iblk,i,j,n,ilo,ihi,jlo,jhi,this_block) do iblk = 1, nblocks @@ -741,6 +812,8 @@ subroutine init_bgc() if (restart_zsal .or. restart_bgc) call read_restart_bgc + deallocate(trcrn_bgc) + end subroutine init_bgc !======================================================================= @@ -792,82 +865,19 @@ end subroutine init_hbrine ! author Elizabeth C. Hunke, LANL ! Nicole Jeffery, LANL - subroutine init_zbgc + subroutine input_zbgc + use ice_arrays_column, only: restore_bgc use ice_broadcast, only: broadcast_scalar - use ice_communicate, only: my_task, master_task use ice_restart_column, only: restart_bgc, restart_zsal, & restart_hbrine + use ice_restart_shared, only: restart use ice_state, only: trcr_base, trcr_depend, n_trcr_strata, & nt_strata - use ice_arrays_column, only: bgc_data_dir - use ice_arrays_column, only: sil_data_type, nit_data_type, fe_data_type - use ice_arrays_column, only: R_C2N, R_chl2N, R_C2N_DON, R_Si2N character (len=char_len) :: & shortwave ! from icepack - integer (kind=int_kind) :: & - ntrcr, nbtrcr, nbtrcr_sw, & - ntrcr_o, nt_fbri, & - nt_bgc_Nit, nt_bgc_Am, nt_bgc_Sil, & - nt_bgc_DMS, nt_bgc_PON, nt_bgc_S, & - nt_bgc_DMSPp, nt_bgc_DMSPd, & - nt_zbgc_frac, nlt_chl_sw, & - nlt_bgc_Nit, nlt_bgc_Am, nlt_bgc_Sil, & - nlt_bgc_DMS, nlt_bgc_DMSPp, nlt_bgc_DMSPd, & - nlt_bgc_PON, & - nt_bgc_hum, nlt_bgc_hum - - integer (kind=int_kind), dimension(icepack_max_aero) :: & - nlt_zaero_sw ! points to aerosol in trcrn_sw - - integer (kind=int_kind), dimension(icepack_max_algae) :: & - nlt_bgc_N , & ! algae - nlt_bgc_chl - - integer (kind=int_kind), dimension(icepack_max_doc) :: & - nlt_bgc_DOC ! disolved organic carbon - - integer (kind=int_kind), dimension(icepack_max_don) :: & - nlt_bgc_DON ! - - integer (kind=int_kind), dimension(icepack_max_dic) :: & - nlt_bgc_DIC ! disolved inorganic carbon - - integer (kind=int_kind), dimension(icepack_max_fe) :: & - nlt_bgc_Fed , & ! - nlt_bgc_Fep ! - - integer (kind=int_kind), dimension(icepack_max_aero) :: & - nlt_zaero ! non-reacting layer aerosols - - integer (kind=int_kind), dimension(icepack_max_algae) :: & - nt_bgc_N , & ! diatoms, phaeocystis, pico/small - nt_bgc_chl ! diatoms, phaeocystis, pico/small - - integer (kind=int_kind), dimension(icepack_max_doc) :: & - nt_bgc_DOC ! dissolved organic carbon - - integer (kind=int_kind), dimension(icepack_max_don) :: & - nt_bgc_DON ! dissolved organic nitrogen - - integer (kind=int_kind), dimension(icepack_max_dic) :: & - nt_bgc_DIC ! dissolved inorganic carbon - - integer (kind=int_kind), dimension(icepack_max_fe) :: & - nt_bgc_Fed, & ! dissolved iron - nt_bgc_Fep ! particulate iron - - integer (kind=int_kind), dimension(icepack_max_aero) :: & - nt_zaero ! black carbon and other aerosols - - integer (kind=int_kind), dimension(icepack_max_nbtrcr) :: & - bio_index_o ! relates nlt_bgc_NO to ocean concentration index - - integer (kind=int_kind), dimension(icepack_max_nbtrcr) :: & - bio_index ! relates bio indices, ie. nlt_bgc_N to nt_bgc_N - logical (kind=log_kind) :: & tr_brine, & tr_bgc_Nit, tr_bgc_Am, tr_bgc_Sil, & @@ -881,75 +891,11 @@ subroutine init_zbgc logical (kind=log_kind) :: & solve_zsal, skl_bgc, z_tracers, scale_bgc, solve_zbgc, dEdd_algae, & - modal_aero, restore_bgc + modal_aero character (char_len) :: & bgc_flux_type - real (kind=dbl_kind) :: & - grid_o, l_sk, grid_o_t, initbio_frac, & - frazil_scav, grid_oS, l_skS, & - phi_snow, & - ratio_Si2N_diatoms , ratio_Si2N_sp , ratio_Si2N_phaeo , & - ratio_S2N_diatoms , ratio_S2N_sp , ratio_S2N_phaeo , & - ratio_Fe2C_diatoms , ratio_Fe2C_sp , ratio_Fe2C_phaeo , & - ratio_Fe2N_diatoms , ratio_Fe2N_sp , ratio_Fe2N_phaeo , & - ratio_Fe2DON , ratio_Fe2DOC_s , ratio_Fe2DOC_l , & - fr_resp , tau_min , tau_max , & - algal_vel , R_dFe2dust , dustFe_sol , & - chlabs_diatoms , chlabs_sp , chlabs_phaeo , & - alpha2max_low_diatoms,alpha2max_low_sp , alpha2max_low_phaeo, & - beta2max_diatoms , beta2max_sp , beta2max_phaeo , & - mu_max_diatoms , mu_max_sp , mu_max_phaeo , & - grow_Tdep_diatoms , grow_Tdep_sp , grow_Tdep_phaeo , & - fr_graze_diatoms , fr_graze_sp , fr_graze_phaeo , & - mort_pre_diatoms , mort_pre_sp , mort_pre_phaeo , & - mort_Tdep_diatoms , mort_Tdep_sp , mort_Tdep_phaeo , & - k_exude_diatoms , k_exude_sp , k_exude_phaeo , & - K_Nit_diatoms , K_Nit_sp , K_Nit_phaeo , & - K_Am_diatoms , K_Am_sp , K_Am_phaeo , & - K_Sil_diatoms , K_Sil_sp , K_Sil_phaeo , & - K_Fe_diatoms , K_Fe_sp , K_Fe_phaeo , & - f_don_protein , kn_bac_protein , f_don_Am_protein , & - f_doc_s , f_doc_l , f_exude_s , & - f_exude_l , k_bac_s , k_bac_l , & - T_max , fsal , op_dep_min , & - fr_graze_s , fr_graze_e , fr_mort2min , & - fr_dFe , k_nitrif , t_iron_conv , & - max_loss , max_dfe_doc1 , fr_resp_s , & - y_sk_DMS , t_sk_conv , t_sk_ox , & - algaltype_diatoms , algaltype_sp , algaltype_phaeo , & - nitratetype , ammoniumtype , silicatetype , & - dmspptype , dmspdtype , humtype , & - doctype_s , doctype_l , dontype_protein , & - fedtype_1 , feptype_1 , zaerotype_bc1 , & - zaerotype_bc2 , zaerotype_dust1 , zaerotype_dust2 , & - zaerotype_dust3 , zaerotype_dust4 , ratio_C2N_diatoms , & - ratio_C2N_sp , ratio_C2N_phaeo , ratio_chl2N_diatoms, & - ratio_chl2N_sp , ratio_chl2N_phaeo , F_abs_chl_diatoms , & - F_abs_chl_sp , F_abs_chl_phaeo , ratio_C2N_proteins - - real (kind=dbl_kind), dimension(icepack_max_dic) :: & - dictype - - real (kind=dbl_kind), dimension(icepack_max_algae) :: & - algaltype ! tau_min for both retention and release - - real (kind=dbl_kind), dimension(icepack_max_doc) :: & - doctype - - real (kind=dbl_kind), dimension(icepack_max_don) :: & - dontype - - real (kind=dbl_kind), dimension(icepack_max_fe) :: & - fedtype - - real (kind=dbl_kind), dimension(icepack_max_fe) :: & - feptype - - real (kind=dbl_kind), dimension(icepack_max_aero) :: & - zaerotype - real (kind=dbl_kind), dimension(icepack_max_algae) :: & F_abs_chl ! to scale absorption in Dedd @@ -990,38 +936,12 @@ subroutine init_zbgc f_exude , & ! fraction of exuded carbon to each DOC pool k_bac ! Bacterial degredation of DOC (1/d) - real (kind=dbl_kind), dimension(icepack_max_nbtrcr) :: & - zbgc_frac_init,&! initializes mobile fraction - bgc_tracer_type ! described tracer in mobile or stationary phases - ! < 0 is purely mobile (eg. nitrate) - ! > 0 has timescales for transitions between - ! phases based on whether the ice is melting or growing - - real (kind=dbl_kind), dimension(icepack_max_nbtrcr) :: & - zbgc_init_frac, & ! fraction of ocean tracer concentration in new ice - tau_ret, & ! retention timescale (s), mobile to stationary phase - tau_rel ! release timescale (s), stationary to mobile phase - integer (kind=int_kind) :: & - nml_error, & ! namelist i/o error flag - k, mm , & ! loop index - ntd , & ! for tracer dependency calculation - nk , & ! - nt_depend + nml_error, & ! namelist i/o error flag + k, mm , & ! loop index + ierr, abort_flag - character(len=*), parameter :: subname='(init_zbgc)' - - !------------------------------------------------------------ - ! Tracers have mobile and stationary phases. - ! ice growth allows for retention, ice melt facilitates mobility - ! bgc_tracer_type defines the exchange timescales between these phases - ! -1 : entirely in the mobile phase, no exchange (this is the default) - ! 0 : retention time scale is tau_min, release time scale is tau_max - ! 1 : retention time scale is tau_max, release time scale is tau_min - ! 0.5: retention time scale is tau_min, release time scale is tau_min - ! 2 : retention time scale is tau_max, release time scale is tau_max - ! tau_min and tau_max are defined in icepack_intfc.f90 - !------------------------------------------------------------ + character(len=*), parameter :: subname='(input_zbgc)' !----------------------------------------------------------------- ! namelist variables @@ -1074,7 +994,10 @@ subroutine init_zbgc ratio_chl2N_sp , ratio_chl2N_phaeo , F_abs_chl_diatoms , & F_abs_chl_sp , F_abs_chl_phaeo , ratio_C2N_proteins - call icepack_query_tracer_numbers(ntrcr_out=ntrcr) + !----------------------------------------------------------------- + + abort_flag = 0 + call icepack_query_tracer_flags(tr_aero_out=tr_aero) call icepack_query_parameters(ktherm_out=ktherm, shortwave_out=shortwave) call icepack_warnings_flush(nu_diag) @@ -1270,40 +1193,8 @@ subroutine init_zbgc call release_fileunit(nu_nml) !----------------------------------------------------------------- - ! zsalinity and brine + ! broadcast !----------------------------------------------------------------- - if (solve_zsal .and. n_trzs == 0) then - write(nu_diag,*) subname,'WARNING: solve_zsal=T but 0 zsalinity tracers' - write(nu_diag,*) subname,'WARNING: setting solve_zsal = F' - solve_zsal = .false. - elseif (solve_zsal .and. nblyr < 1) then - write(nu_diag,*) subname,'WARNING: solve_zsal=T but 0 zsalinity tracers' - write(nu_diag,*) subname,'WARNING: setting solve_zsal = F' - solve_zsal = .false. - endif - - if (solve_zsal .and. ((.not. tr_brine) .or. (ktherm /= 1))) then - write(nu_diag,*) subname,'WARNING: solve_zsal needs tr_brine=T and ktherm=1' - write(nu_diag,*) subname,'WARNING: setting tr_brine=T and ktherm=1' - tr_brine = .true. - ktherm = 1 - endif - - if (tr_brine .and. n_trbri == 0 ) then - write(nu_diag,*) & - subname,'WARNING: tr_brine=T but no brine height compiled' - write(nu_diag,*) & - subname,'WARNING: setting solve_zsal and tr_brine = F' - solve_zsal = .false. - tr_brine = .false. - elseif (tr_brine .and. nblyr < 1 ) then - write(nu_diag,*) & - subname,'WARNING: tr_brine=T but no biology layers compiled' - write(nu_diag,*) & - subname,'WARNING: setting solve_zsal and tr_brine = F' - solve_zsal = .false. - tr_brine = .false. - endif call broadcast_scalar(solve_zsal, master_task) call broadcast_scalar(restart_zsal, master_task) @@ -1314,113 +1205,6 @@ subroutine init_zbgc call broadcast_scalar(grid_oS, master_task) call broadcast_scalar(l_skS, master_task) - if (my_task == master_task) then - write(nu_diag,1010) ' tr_brine = ', tr_brine - if (tr_brine) then - write(nu_diag,1010) ' restart_hbrine = ', restart_hbrine - write(nu_diag,1005) ' phi_snow = ', phi_snow - endif - if (solve_zsal) then - write(nu_diag,1010) ' solve_zsal = ', solve_zsal - write(nu_diag,1010) ' restart_zsal = ', restart_zsal - write(nu_diag,1000) ' grid_oS = ', grid_oS - write(nu_diag,1005) ' l_skS = ', l_skS - endif - endif - - !----------------------------------------------------------------- - ! biogeochemistry - !----------------------------------------------------------------- - - if (.not. tr_brine) then - if (solve_zbgc) then - write(nu_diag,*) subname,'WARNING: tr_brine = F and solve_zbgc = T' - write(nu_diag,*) subname,'WARNING: setting solve_zbgc = F' - solve_zbgc = .false. - endif - if (tr_zaero) then - write(nu_diag,*) subname,'WARNING: tr_brine = F and tr_zaero = T' - write(nu_diag,*) subname,'WARNING: setting tr_zaero = F' - tr_zaero = .false. - endif - endif - - if ((skl_bgc .AND. solve_zbgc) .or. (skl_bgc .AND. z_tracers)) & - call abort_ice(subname//'ERROR: bgc and solve_zbgc or z_tracers are both true') - - if (skl_bgc .AND. tr_zaero) then - write(nu_diag,*) subname,'WARNING: skl bgc does not use vertical tracers' - write(nu_diag,*) subname,'WARNING: setting tr_zaero = F' - tr_zaero = .false. - endif - - if (dEdd_algae .AND. trim(shortwave) /= 'dEdd') then - write(nu_diag,*) subname,'WARNING: dEdd_algae = T but shortwave /= dEdd' - write(nu_diag,*) subname,'WARNING: setting dEdd_algae = F' - dEdd_algae = .false. - endif - - if (dEdd_algae .AND. (.NOT. tr_bgc_N) .AND. (.NOT. tr_zaero)) then - write(nu_diag,*) subname,'WARNING: need tr_bgc_N or tr_zaero for dEdd_algae' - write(nu_diag,*) subname,'WARNING: setting dEdd_algae = F' - dEdd_algae = .false. - endif - - if (modal_aero .AND. (.NOT. tr_zaero) .AND. (.NOT. tr_aero)) then - modal_aero = .false. - endif - - if (modal_aero .AND. trim(shortwave) /= 'dEdd') then - write(nu_diag,*) subname,'WARNING: modal_aero = T but shortwave /= dEdd' - write(nu_diag,*) subname,'WARNING: setting modal_aero = F' - modal_aero = .false. - endif - if (n_algae > icepack_max_algae) call abort_ice(subname//'ERROR: number of algal & - & types exceeds icepack_max_algae') - if (n_doc > icepack_max_doc) call abort_ice(subname//'ERROR: number of doc & - & types exceeds icepack_max_doc') - if (n_dic > icepack_max_doc) call abort_ice(subname//'ERROR: number of dic & - & types exceeds icepack_max_dic') - if (n_don > icepack_max_don) call abort_ice(subname//'ERROR: number of don & - & types exceeds icepack_max_don') - if (n_fed > icepack_max_fe ) call abort_ice(subname//'ERROR: number of dissolved fe & - & types exceeds icepack_max_fe ') - if (n_fep > icepack_max_fe ) call abort_ice(subname//'ERROR: number of particulate fe & - & types exceeds icepack_max_fe ') - if ((n_trbgcs == 0 .and. skl_bgc) .or. (n_algae == 0 .and. skl_bgc)) then - write(nu_diag,*) & - subname,'WARNING: skl_bgc=T but 0 bgc or algal tracers compiled' - write(nu_diag,*) & - subname,'WARNING: setting skl_bgc = F' - skl_bgc = .false. - endif - - if ((n_trbgcz == 0 .and. solve_zbgc) .or. (n_algae == 0 .and. solve_zbgc)) then - write(nu_diag,*) & - subname,'WARNING: solve_zbgc=T but 0 zbgc or algal tracers compiled' - write(nu_diag,*) & - subname,'WARNING: setting solve_zbgc = F' - solve_zbgc = .false. - endif - - if (solve_zbgc .and. .not. z_tracers) z_tracers = .true. - if (skl_bgc .or. solve_zbgc) then - tr_bgc_N = .true. ! minimum NP biogeochemistry - tr_bgc_Nit = .true. - else - tr_bgc_N = .false. - tr_bgc_C = .false. - tr_bgc_chl = .false. - tr_bgc_Nit = .false. - tr_bgc_Am = .false. - tr_bgc_Sil = .false. - tr_bgc_hum = .false. - tr_bgc_DMS = .false. - tr_bgc_PON = .false. - tr_bgc_DON = .false. - tr_bgc_Fe = .false. - endif - call broadcast_scalar(solve_zbgc, master_task) call broadcast_scalar(skl_bgc, master_task) call broadcast_scalar(restart_bgc, master_task) @@ -1438,14 +1222,6 @@ subroutine init_zbgc call broadcast_scalar(tr_bgc_DON, master_task) call broadcast_scalar(tr_bgc_Fe, master_task) - !----------------------------------------------------------------- - ! z layer aerosols - !----------------------------------------------------------------- - if (tr_zaero .and. .not. z_tracers) z_tracers = .true. - - if (n_zaero > icepack_max_aero) call abort_ice(subname//'ERROR: & - & number of z aerosols exceeds icepack_max_aero') - call broadcast_scalar(z_tracers, master_task) call broadcast_scalar(tr_zaero, master_task) call broadcast_scalar(dEdd_algae, master_task) @@ -1571,33 +1347,235 @@ subroutine init_zbgc call broadcast_scalar(F_abs_chl_phaeo , master_task) call broadcast_scalar(ratio_C2N_proteins , master_task) - if (skl_bgc .and. n_bgc < 2) then - write (nu_diag,*) subname,' ' - write (nu_diag,*) subname,'comp_ice must have number of bgc tracers >= 2' - write (nu_diag,*) subname,'number of bgc tracers compiled:',n_bgc - call abort_ice (subname//'ERROR: skl_bgc and n_bgc < 2') + !----------------------------------------------------------------- + ! zsalinity and brine + !----------------------------------------------------------------- + + if (.not.restart) then + if (my_task == master_task) & + write(nu_diag,*) subname//' WARNING: restart = false, setting bgc restart flags to false' + restart_bgc = .false. + restart_hbrine = .false. + restart_zsal = .false. endif - if (solve_zbgc .and. n_bgc < 2) then - write (nu_diag,*) subname,' ' - write (nu_diag,*) subname,'comp_ice must have number of zbgc tracers >= 2' - write (nu_diag,*) subname,'number of bgc tracers compiled:',n_bgc - call abort_ice (subname//'ERROR: solve_zbgc and n_bgc < 2') + if (solve_zsal .and. nblyr < 1) then + if (my_task == master_task) then + write(nu_diag,*) subname,' ERROR: solve_zsal=T but 0 zsalinity tracers' + endif + abort_flag = 101 + endif + + if (solve_zsal .and. ((.not. tr_brine) .or. (ktherm /= 1))) then + if (my_task == master_task) then + write(nu_diag,*) subname,' ERROR: solve_zsal needs tr_brine=T and ktherm=1' + endif + abort_flag = 102 endif - if (tr_zaero .and. n_zaero < 1) then - write (nu_diag,*) subname,' ' - write (nu_diag,*) subname,'comp_ice must have number of n_zaero > 0' - write (nu_diag,*) subname,'in order to solve z aerosols:',n_zaero - call abort_ice (subname//'ERROR: tr_zaero and tr zaero < 1') + if (tr_brine .and. nblyr < 1 ) then + if (my_task == master_task) then + write(nu_diag,*) subname,' ERROR: tr_brine=T but no biology layers compiled' + endif + abort_flag = 103 + endif + + !----------------------------------------------------------------- + ! biogeochemistry + !----------------------------------------------------------------- + + if (.not. tr_brine) then + if (solve_zbgc) then + if (my_task == master_task) then + write(nu_diag,*) subname,' ERROR: tr_brine = F and solve_zbgc = T' + endif + abort_flag = 104 + endif + if (tr_zaero) then + if (my_task == master_task) then + write(nu_diag,*) subname,' ERROR: tr_brine = F and tr_zaero = T' + endif + abort_flag = 105 + endif + endif + + if ((skl_bgc .AND. solve_zbgc) .or. (skl_bgc .AND. z_tracers)) then + if (my_task == master_task) then + write(nu_diag,*) subname,' ERROR: skl_bgc and solve_zbgc or z_tracers are both true' + endif + abort_flag = 106 + endif + + if (skl_bgc .AND. tr_zaero) then + if (my_task == master_task) then + write(nu_diag,*) subname,' ERROR: skl_bgc does not use vertical tracers' + endif + abort_flag = 107 + endif + + if (dEdd_algae .AND. trim(shortwave) /= 'dEdd') then + if (my_task == master_task) then + write(nu_diag,*) subname,' ERROR: dEdd_algae = T but shortwave /= dEdd' + endif + abort_flag = 108 + endif + + if (dEdd_algae .AND. (.NOT. tr_bgc_N) .AND. (.NOT. tr_zaero)) then + if (my_task == master_task) then + write(nu_diag,*) subname,' ERROR: need tr_bgc_N or tr_zaero for dEdd_algae' + endif + abort_flag = 109 + endif + + if (modal_aero .AND. (.NOT. tr_zaero) .AND. (.NOT. tr_aero)) then + if (my_task == master_task) then + write(nu_diag,*) subname,' ERROR: modal_aero T with tr_zaero and tr_aero' + endif + abort_flag = 110 + endif + + if (modal_aero .AND. trim(shortwave) /= 'dEdd') then + if (my_task == master_task) then + write(nu_diag,*) subname,' ERROR: modal_aero = T but shortwave /= dEdd' + endif + abort_flag = 111 + endif + if (n_algae > icepack_max_algae) then + if (my_task == master_task) then + write(nu_diag,*) subname//'ERROR: number of algal types exceeds icepack_max_algae' + endif + abort_flag = 112 + endif + if (n_doc > icepack_max_doc) then + if (my_task == master_task) then + write(nu_diag,*) subname//'ERROR: number of doc types exceeds icepack_max_doc' + endif + abort_flag = 113 + endif + if (n_dic > icepack_max_doc) then + if (my_task == master_task) then + write(nu_diag,*) subname//'ERROR: number of dic types exceeds icepack_max_dic' + endif + abort_flag = 114 + endif + if (n_don > icepack_max_don) then + if (my_task == master_task) then + write(nu_diag,*) subname//'ERROR: number of don types exceeds icepack_max_don' + endif + abort_flag = 115 + endif + if (n_fed > icepack_max_fe ) then + if (my_task == master_task) then + write(nu_diag,*) subname//'ERROR: number of dissolved fe types exceeds icepack_max_fe ' + endif + abort_flag = 116 + endif + if (n_fep > icepack_max_fe ) then + if (my_task == master_task) then + write(nu_diag,*) subname//'ERROR: number of particulate fe types exceeds icepack_max_fe ' + endif + abort_flag = 117 + endif + + if (n_algae == 0 .and. skl_bgc) then + if (my_task == master_task) then + write(nu_diag,*) subname//'ERROR: skl_bgc=T but 0 bgc or algal tracers compiled' + endif + abort_flag = 118 + endif + + if (n_algae == 0 .and. solve_zbgc) then + if (my_task == master_task) then + write(nu_diag,*) subname//'ERROR: solve_zbgc=T but 0 zbgc or algal tracers compiled' + endif + abort_flag = 119 + endif + + if (solve_zbgc .and. .not. z_tracers) then + if (my_task == master_task) then + write(nu_diag,*) subname//'ERROR: solve_zbgc=T but not z_tracers' + endif + abort_flag = 120 + endif + + if (skl_bgc .or. solve_zbgc) then + if (.not. tr_bgc_N) then + if (my_task == master_task) then + write(nu_diag,*) subname//'ERROR: tr_bgc_N must be on for bgc' + endif + abort_flag = 121 + endif + if (.not. tr_bgc_Nit) then + if (my_task == master_task) then + write(nu_diag,*) subname//'ERROR: tr_bgc_Nit must be on for bgc' + endif + abort_flag = 122 + endif + else + ! tcraig, allow bgc to be turned off in this case? + tr_bgc_N = .false. + tr_bgc_C = .false. + tr_bgc_chl = .false. + tr_bgc_Nit = .false. + tr_bgc_Am = .false. + tr_bgc_Sil = .false. + tr_bgc_hum = .false. + tr_bgc_DMS = .false. + tr_bgc_PON = .false. + tr_bgc_DON = .false. + tr_bgc_Fe = .false. + endif + + !----------------------------------------------------------------- + ! z layer aerosols + !----------------------------------------------------------------- + if (tr_zaero .and. .not. z_tracers) then + if (my_task == master_task) then + write(nu_diag,*) subname//'ERROR: tr_zaero and not z_tracers' + endif + abort_flag = 123 + endif + + if (n_zaero > icepack_max_aero) then + if (my_task == master_task) then + write(nu_diag,*) subname//'ERROR: number of z aerosols exceeds icepack_max_aero' + endif + abort_flag = 124 + endif + + !----------------------------------------------------------------- + ! output + !----------------------------------------------------------------- + + if (my_task == master_task) then + write(nu_diag,1010) ' tr_brine = ', tr_brine + if (tr_brine) then + write(nu_diag,1010) ' restart_hbrine = ', restart_hbrine + write(nu_diag,1005) ' phi_snow = ', phi_snow + endif + write(nu_diag,1010) ' solve_zsal = ', solve_zsal + if (solve_zsal) then + write(nu_diag,1010) ' restart_zsal = ', restart_zsal + write(nu_diag,1000) ' grid_oS = ', grid_oS + write(nu_diag,1005) ' l_skS = ', l_skS + endif + endif + + !----------------------------------------------------------------- + ! abort if abort flag is set + !----------------------------------------------------------------- + + call flush_fileunit(nu_diag) + call ice_barrier() + if (abort_flag /= 0) then + write(nu_diag,*) subname,' ERROR: abort_flag=',abort_flag + call abort_ice (subname//' ABORTING on input ERRORS', & + file=__FILE__, line=__LINE__) endif -! tcx, tcraig, this is not set yet -! call icepack_init_tracer_indices( & -! nbtrcr_in=nbtrcr) -! call icepack_warnings_flush(nu_diag) -! if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & -! file=__FILE__, line=__LINE__) + !----------------------------------------------------------------- + ! set values in icepack + !----------------------------------------------------------------- call icepack_init_parameters( & ktherm_in=ktherm, shortwave_in=shortwave, solve_zsal_in=solve_zsal, & @@ -1607,108 +1585,941 @@ subroutine init_zbgc bgc_flux_type_in=bgc_flux_type, grid_o_in=grid_o, l_sk_in=l_sk, & initbio_frac_in=initbio_frac, & grid_oS_in=grid_oS, l_skS_in=l_skS, & - phi_snow_in=phi_snow, & + phi_snow_in=phi_snow, frazil_scav_in = frazil_scav, & modal_aero_in=modal_aero) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & file=__FILE__, line=__LINE__) - !----------------------------------------------------------------- - ! initialize zbgc tracer indices - !----------------------------------------------------------------- + call icepack_init_tracer_flags(tr_brine_in=tr_brine, & + tr_bgc_Nit_in=tr_bgc_Nit, tr_bgc_Am_in =tr_bgc_Am, tr_bgc_Sil_in=tr_bgc_Sil, & + tr_bgc_DMS_in=tr_bgc_DMS, tr_bgc_PON_in=tr_bgc_PON, & + tr_bgc_N_in =tr_bgc_N, tr_bgc_C_in =tr_bgc_C, tr_bgc_chl_in=tr_bgc_chl, & + tr_bgc_DON_in=tr_bgc_DON, tr_bgc_Fe_in =tr_bgc_Fe, tr_zaero_in =tr_zaero, & + tr_bgc_hum_in=tr_bgc_hum) + call icepack_warnings_flush(nu_diag) + if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & + file=__FILE__, line=__LINE__) + + 1000 format (a30,2x,f9.2) ! a30 to align formatted, unformatted statements + 1005 format (a30,2x,f9.6) ! float + 1010 format (a30,2x,l6) ! logical + 1020 format (a30,2x,i6) ! integer + 1030 format (a30, a8) ! character + + end subroutine input_zbgc + +!======================================================================= + +! Count and index tracers +! +! author Elizabeth C. Hunke, LANL + + subroutine count_tracers + + use ice_broadcast, only: broadcast_scalar, broadcast_array + use ice_diagnostics, only: diag_file, print_global, print_points, latpnt, lonpnt + use ice_domain, only: close_boundaries + use ice_domain_size, only: ncat, nilyr, nslyr, nblyr, & + n_aero, n_zaero, n_algae, n_doc, n_dic, n_don, n_fed, n_fep, max_nstrm + use ice_calendar, only: year_init, istep0, histfreq, histfreq_n, & + dumpfreq, dumpfreq_n, diagfreq, npt, dt, ndtd, days_per_year, & + use_leap_years, write_ic, dump_last + use ice_arrays_column, only: oceanmixed_ice, restore_bgc + use ice_arrays_column, only: bgc_data_dir, sil_data_type, nit_data_type, fe_data_type + use ice_restart_column, only: restart_age, restart_FY, restart_lvl, & + restart_pond_cesm, restart_pond_lvl, restart_pond_topo, restart_aero, & + restart_bgc + use ice_restart_shared, only: & + restart, restart_ext, restart_dir, restart_file, pointer_file, & + runid, runtype, use_restart_time, restart_format, lcdf64 + use ice_history_shared, only: hist_avg, history_dir, history_file, & + incond_dir, incond_file, version_name + use ice_flux, only: update_ocn_f, l_mpond_fresh + use ice_flux, only: default_season + use ice_flux_bgc, only: cpl_bgc + use ice_forcing, only: & + ycycle, fyear_init, dbug, & + atm_data_type, atm_data_dir, precip_units, & + atm_data_format, ocn_data_format, & + bgc_data_type, ocn_data_type, ocn_data_dir, & + oceanmixed_file, restore_ocn, trestore + use ice_grid, only: grid_file, gridcpl_file, kmt_file, & + bathymetry_file, use_bathymetry, & + grid_type, grid_format, & + dxrect, dyrect + use ice_dyn_shared, only: ndte, kdyn, revised_evp, yield_curve, & + basalstress, k1, Ktens, e_ratio, coriolis, kridge, ktransport + use ice_transport_driver, only: advection + use ice_restoring, only: restore_ice +#ifdef CESMCOUPLED + use shr_file_mod, only: shr_file_setIO +#endif + + ! local variables + + integer (kind=int_kind) :: & + nml_error, & ! namelist i/o error flag + n , & ! loop index + k, mm , & ! loop index + nk , & ! layer index + nk_bgc , & ! layer index + ierr + + character (len=6) :: chartmp + + logical :: exists + + real (kind=dbl_kind) :: ustar_min, albicev, albicei, albsnowv, albsnowi, & + ahmax, R_ice, R_pnd, R_snw, dT_mlt, rsnw_mlt, emissivity, & + mu_rdg, hs0, dpscale, rfracmin, rfracmax, pndaspect, hs1, hp1, & + a_rapid_mode, Rac_rapid_mode, aspect_rapid_mode, dSdt_slow_mode, & + phi_c_slow_mode, phi_i_mushy, kalg + + integer (kind=int_kind) :: ktherm, kstrength, krdg_partic, krdg_redist, natmiter, & + kitd, kcatbound + + character (len=char_len) :: shortwave, albedo_type, conduct, fbot_xfer_type, & + tfrz_option, frzpnd, atmbndy + + logical (kind=log_kind) :: calc_Tsfc, formdrag, highfreq, calc_strair + + integer (kind=int_kind) :: ntrcr + logical (kind=log_kind) :: tr_iage, tr_FY, tr_lvl, tr_pond, tr_aero + logical (kind=log_kind) :: tr_pond_cesm, tr_pond_lvl, tr_pond_topo + integer (kind=int_kind) :: nt_Tsfc, nt_sice, nt_qice, nt_qsno, nt_iage, nt_FY + integer (kind=int_kind) :: nt_alvl, nt_vlvl, nt_apnd, nt_hpnd, nt_ipnd, nt_aero + + integer (kind=int_kind) :: & + nbtrcr, nbtrcr_sw, & + ntrcr_o, nt_fbri, & + nt_bgc_Nit, nt_bgc_Am, nt_bgc_Sil, & + nt_bgc_DMS, nt_bgc_PON, nt_bgc_S, & + nt_bgc_DMSPp, nt_bgc_DMSPd, & + nt_zbgc_frac, nlt_chl_sw, & + nlt_bgc_Nit, nlt_bgc_Am, nlt_bgc_Sil, & + nlt_bgc_DMS, nlt_bgc_DMSPp, nlt_bgc_DMSPd, & + nlt_bgc_PON, nt_bgc_hum, nlt_bgc_hum + + integer (kind=int_kind), dimension(icepack_max_aero) :: & + nlt_zaero_sw ! points to aerosol in trcrn_sw + + integer (kind=int_kind), dimension(icepack_max_algae) :: & + nlt_bgc_N , & ! algae + nlt_bgc_chl + + integer (kind=int_kind), dimension(icepack_max_doc) :: & + nlt_bgc_DOC ! disolved organic carbon + + integer (kind=int_kind), dimension(icepack_max_don) :: & + nlt_bgc_DON ! + + integer (kind=int_kind), dimension(icepack_max_dic) :: & + nlt_bgc_DIC ! disolved inorganic carbon + + integer (kind=int_kind), dimension(icepack_max_fe) :: & + nlt_bgc_Fed , & ! + nlt_bgc_Fep ! + + integer (kind=int_kind), dimension(icepack_max_aero) :: & + nlt_zaero ! non-reacting layer aerosols + + integer (kind=int_kind), dimension(icepack_max_algae) :: & + nt_bgc_N , & ! diatoms, phaeocystis, pico/small + nt_bgc_chl ! diatoms, phaeocystis, pico/small + + integer (kind=int_kind), dimension(icepack_max_doc) :: & + nt_bgc_DOC ! dissolved organic carbon + + integer (kind=int_kind), dimension(icepack_max_don) :: & + nt_bgc_DON ! dissolved organic nitrogen + + integer (kind=int_kind), dimension(icepack_max_dic) :: & + nt_bgc_DIC ! dissolved inorganic carbon + + integer (kind=int_kind), dimension(icepack_max_fe) :: & + nt_bgc_Fed, & ! dissolved iron + nt_bgc_Fep ! particulate iron + + integer (kind=int_kind), dimension(icepack_max_aero) :: & + nt_zaero ! black carbon and other aerosols + + logical (kind=log_kind) :: & + tr_brine, & + tr_bgc_Nit, tr_bgc_Am, tr_bgc_Sil, & + tr_bgc_DMS, tr_bgc_PON, & + tr_bgc_N, tr_bgc_C, tr_bgc_chl, & + tr_bgc_DON, tr_bgc_Fe, tr_zaero, & + tr_bgc_hum + + logical (kind=log_kind) :: & + solve_zsal, skl_bgc, z_tracers, scale_bgc, solve_zbgc, dEdd_algae, & + modal_aero + + character (char_len) :: & + bgc_flux_type + + real (kind=dbl_kind), dimension(icepack_max_algae) :: & + F_abs_chl ! to scale absorption in Dedd + + real (kind=dbl_kind), dimension(icepack_max_algae) :: & + R_S2N , & ! algal S to N (mole/mole) + ! Marchetti et al 2006, 3 umol Fe/mol C for iron limited Pseudo-nitzschia + R_Fe2C , & ! algal Fe to carbon (umol/mmol) + R_Fe2N ! algal Fe to N (umol/mmol) + + real (kind=dbl_kind), dimension(icepack_max_don) :: & + R_Fe2DON ! Fe to N of DON (nmol/umol) + + real (kind=dbl_kind), dimension(icepack_max_doc) :: & + R_Fe2DOC ! Fe to C of DOC (nmol/umol) + + real (kind=dbl_kind), dimension(icepack_max_algae) :: & + chlabs , & ! chla absorption 1/m/(mg/m^3) + alpha2max_low , & ! light limitation (1/(W/m^2)) + beta2max , & ! light inhibition (1/(W/m^2)) + mu_max , & ! maximum growth rate (1/d) + grow_Tdep , & ! T dependence of growth (1/C) + fr_graze , & ! fraction of algae grazed + mort_pre , & ! mortality (1/day) + mort_Tdep , & ! T dependence of mortality (1/C) + k_exude , & ! algal carbon exudation rate (1/d) + K_Nit , & ! nitrate half saturation (mmol/m^3) + K_Am , & ! ammonium half saturation (mmol/m^3) + K_Sil , & ! silicon half saturation (mmol/m^3) + K_Fe ! iron half saturation or micromol/m^3 + + real (kind=dbl_kind), dimension(icepack_max_DON) :: & + f_don , & ! fraction of spilled grazing to DON + kn_bac , & ! Bacterial degredation of DON (1/d) + f_don_Am ! fraction of remineralized DON to Am + + real (kind=dbl_kind), dimension(icepack_max_DOC) :: & + f_doc , & ! fraction of mort_N that goes to each doc pool + f_exude , & ! fraction of exuded carbon to each DOC pool + k_bac ! Bacterial degredation of DOC (1/d) + + real (kind=dbl_kind) :: Cf, puny + + character(len=*), parameter :: subname='(count_tracers)' + + !----------------------------------------------------------------- + + call icepack_query_parameters( & + ktherm_out=ktherm, shortwave_out=shortwave, solve_zsal_out=solve_zsal, & + skl_bgc_out=skl_bgc, z_tracers_out=z_tracers, scale_bgc_out=scale_bgc, & + dEdd_algae_out=dEdd_algae, & + solve_zbgc_out=solve_zbgc, & + bgc_flux_type_out=bgc_flux_type, grid_o_out=grid_o, l_sk_out=l_sk, & + initbio_frac_out=initbio_frac, & + grid_oS_out=grid_oS, l_skS_out=l_skS, & + phi_snow_out=phi_snow, frazil_scav_out = frazil_scav, & + modal_aero_out=modal_aero) + call icepack_warnings_flush(nu_diag) + if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & + file=__FILE__, line=__LINE__) + + call icepack_query_tracer_flags(tr_iage_out=tr_iage, tr_FY_out=tr_FY, & + tr_lvl_out=tr_lvl, tr_aero_out=tr_aero, tr_pond_out=tr_pond, & + tr_pond_cesm_out=tr_pond_cesm, tr_pond_lvl_out=tr_pond_lvl, tr_pond_topo_out=tr_pond_topo, & + tr_brine_out=tr_brine, & + tr_bgc_Nit_out=tr_bgc_Nit, tr_bgc_Am_out =tr_bgc_Am, tr_bgc_Sil_out=tr_bgc_Sil, & + tr_bgc_DMS_out=tr_bgc_DMS, tr_bgc_PON_out=tr_bgc_PON, & + tr_bgc_N_out =tr_bgc_N, tr_bgc_C_out =tr_bgc_C, tr_bgc_chl_out=tr_bgc_chl, & + tr_bgc_DON_out=tr_bgc_DON, tr_bgc_Fe_out =tr_bgc_Fe, tr_zaero_out =tr_zaero, & + tr_bgc_hum_out=tr_bgc_hum) + call icepack_warnings_flush(nu_diag) + if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & + file=__FILE__, line=__LINE__) + + if (my_task == master_task) then + write(nu_diag,1020) ' n_aero = ', n_aero + write(nu_diag,1020) ' n_zaero = ', n_zaero + write(nu_diag,1020) ' n_algae = ', n_algae + write(nu_diag,1020) ' n_doc = ', n_doc + write(nu_diag,1020) ' n_dic = ', n_dic + write(nu_diag,1020) ' n_don = ', n_don + write(nu_diag,1020) ' n_fed = ', n_fed + write(nu_diag,1020) ' n_fep = ', n_fep + endif ! my_task = master_task + + ntrcr = 0 + + ntrcr = ntrcr + 1 ! count tracers, starting with Tsfc = 1 + nt_Tsfc = ntrcr ! index tracers, starting with Tsfc = 1 + + nt_qice = ntrcr + 1 + ntrcr = ntrcr + nilyr ! qice in nilyr layers + + nt_qsno = ntrcr + 1 + ntrcr = ntrcr + nslyr ! qsno in nslyr layers + + nt_sice = ntrcr + 1 + ntrcr = ntrcr + nilyr ! sice in nilyr layers + + nt_iage = 0 + if (tr_iage) then + ntrcr = ntrcr + 1 + nt_iage = ntrcr ! chronological ice age + endif + + nt_FY = 0 + if (tr_FY) then + ntrcr = ntrcr + 1 + nt_FY = ntrcr ! area of first year ice + endif + + nt_alvl = 0 + nt_vlvl = 0 + if (tr_lvl) then + ntrcr = ntrcr + 1 + nt_alvl = ntrcr + ntrcr = ntrcr + 1 + nt_vlvl = ntrcr + endif + + nt_apnd = 0 + nt_hpnd = 0 + nt_ipnd = 0 + if (tr_pond) then ! all explicit melt pond schemes + ntrcr = ntrcr + 1 + nt_apnd = ntrcr + ntrcr = ntrcr + 1 + nt_hpnd = ntrcr + if (tr_pond_lvl) then + ntrcr = ntrcr + 1 ! refrozen pond ice lid thickness + nt_ipnd = ntrcr ! on level-ice ponds (if frzpnd='hlid') + endif + if (tr_pond_topo) then + ntrcr = ntrcr + 1 ! + nt_ipnd = ntrcr ! refrozen pond ice lid thickness + endif + endif + + nt_aero = 0 + if (tr_aero) then + nt_aero = ntrcr + 1 + ntrcr = ntrcr + 4*n_aero ! 4 dEdd layers, n_aero species + else +!tcx, modify code so we don't have to reset n_aero here + n_aero = 0 + endif + + !----------------------------------------------------------------- + ! initialize zbgc tracer indices + !----------------------------------------------------------------- + + nbtrcr = 0 + nbtrcr_sw = 0 + + ! vectors of size icepack_max_algae + nlt_bgc_N(:) = 0 + nlt_bgc_chl(:) = 0 + nt_bgc_N(:) = 0 + nt_bgc_chl(:) = 0 + + ! vectors of size icepack_max_dic + nlt_bgc_DIC(:) = 0 + nt_bgc_DIC(:) = 0 + + ! vectors of size icepack_max_doc + nlt_bgc_DOC(:) = 0 + nt_bgc_DOC(:) = 0 + + ! vectors of size icepack_max_don + nlt_bgc_DON(:) = 0 + nt_bgc_DON(:) = 0 + + ! vectors of size icepack_max_fe + nlt_bgc_Fed(:) = 0 + nlt_bgc_Fep(:) = 0 + nt_bgc_Fed(:) = 0 + nt_bgc_Fep(:) = 0 + + ! vectors of size icepack_max_aero + nlt_zaero(:) = 0 + nlt_zaero_sw(:) = 0 + nt_zaero(:) = 0 + + nlt_bgc_Nit = 0 + nlt_bgc_Am = 0 + nlt_bgc_Sil = 0 + nlt_bgc_DMSPp = 0 + nlt_bgc_DMSPd = 0 + nlt_bgc_DMS = 0 + nlt_bgc_PON = 0 + nlt_bgc_hum = 0 +! nlt_bgc_C = 0 + nlt_chl_sw = 0 + + nt_bgc_Nit = 0 + nt_bgc_Am = 0 + nt_bgc_Sil = 0 + nt_bgc_DMSPp = 0 + nt_bgc_DMSPd = 0 + nt_bgc_DMS = 0 + nt_bgc_PON = 0 + nt_bgc_hum = 0 +! nt_bgc_C = 0 + + ntrcr_o = ntrcr + nt_fbri = 0 + if (tr_brine) then + nt_fbri = ntrcr + 1 ! ice volume fraction with salt + ntrcr = ntrcr + 1 + endif + + nt_bgc_S = 0 + if (solve_zsal) then ! .true. only if tr_brine = .true. + nt_bgc_S = ntrcr + 1 + ntrcr = ntrcr + nblyr + endif + + if (skl_bgc .or. z_tracers) then + + if (skl_bgc) then + nk = 1 + elseif (z_tracers) then ! defined on nblyr+1 in ice + ! and 2 snow layers (snow surface + interior) + nk = nblyr + 1 + endif ! skl_bgc or z_tracers + nk_bgc = nk ! number of bgc layers in ice + if (nk > 1) nk_bgc = nk + 2 ! number of bgc layers in ice and snow + + !----------------------------------------------------------------- + ! count tracers and assign tracer indices + !----------------------------------------------------------------- + + if (tr_bgc_N) then + do mm = 1, n_algae + nt_bgc_N(mm) = ntrcr + 1 + do k = 1, nk_bgc + ntrcr = ntrcr + 1 + enddo + nbtrcr = nbtrcr + 1 + nlt_bgc_N(mm) = nbtrcr + enddo ! mm + endif ! tr_bgc_N + + if (tr_bgc_Nit) then + nt_bgc_Nit = ntrcr + 1 + do k = 1, nk_bgc + ntrcr = ntrcr + 1 + enddo + nbtrcr = nbtrcr + 1 + nlt_bgc_Nit = nbtrcr + endif ! tr_bgc_Nit + + if (tr_bgc_C) then + ! + ! Algal C is not yet distinct from algal N + ! * Reqires exudation and/or changing C:N ratios + ! for implementation + ! + ! do mm = 1,n_algae + ! nt_bgc_C(mm) = ntrcr + 1 + ! do k = 1, nk_bgc + ! ntrcr = ntrcr + 1 + ! enddo + ! nbtrcr = nbtrcr + 1 + ! nlt_bgc_C(mm) = nbtrcr + ! enddo ! mm + + do mm = 1, n_doc + nt_bgc_DOC(mm) = ntrcr + 1 + do k = 1, nk_bgc + ntrcr = ntrcr + 1 + enddo + nbtrcr = nbtrcr + 1 + nlt_bgc_DOC(mm) = nbtrcr + enddo ! mm + do mm = 1, n_dic + nt_bgc_DIC(mm) = ntrcr + 1 + do k = 1, nk_bgc + ntrcr = ntrcr + 1 + enddo + nbtrcr = nbtrcr + 1 + nlt_bgc_DIC(mm) = nbtrcr + enddo ! mm + endif ! tr_bgc_C + + if (tr_bgc_chl) then + do mm = 1, n_algae + nt_bgc_chl(mm) = ntrcr + 1 + do k = 1, nk_bgc + ntrcr = ntrcr + 1 + enddo + nbtrcr = nbtrcr + 1 + nlt_bgc_chl(mm) = nbtrcr + enddo ! mm + endif ! tr_bgc_chl + + if (tr_bgc_Am) then + nt_bgc_Am = ntrcr + 1 + do k = 1, nk_bgc + ntrcr = ntrcr + 1 + enddo + nbtrcr = nbtrcr + 1 + nlt_bgc_Am = nbtrcr + endif + if (tr_bgc_Sil) then + nt_bgc_Sil = ntrcr + 1 + do k = 1, nk_bgc + ntrcr = ntrcr + 1 + enddo + nbtrcr = nbtrcr + 1 + nlt_bgc_Sil = nbtrcr + endif + + if (tr_bgc_DMS) then ! all together + nt_bgc_DMSPp = ntrcr + 1 + do k = 1, nk_bgc + ntrcr = ntrcr + 1 + enddo + nbtrcr = nbtrcr + 1 + nlt_bgc_DMSPp = nbtrcr + + nt_bgc_DMSPd = ntrcr + 1 + do k = 1, nk_bgc + ntrcr = ntrcr + 1 + enddo + nbtrcr = nbtrcr + 1 + nlt_bgc_DMSPd = nbtrcr + + nt_bgc_DMS = ntrcr + 1 + do k = 1, nk_bgc + ntrcr = ntrcr + 1 + enddo + nbtrcr = nbtrcr + 1 + nlt_bgc_DMS = nbtrcr + endif + + if (tr_bgc_PON) then + nt_bgc_PON = ntrcr + 1 + do k = 1, nk_bgc + ntrcr = ntrcr + 1 + enddo + nbtrcr = nbtrcr + 1 + nlt_bgc_PON = nbtrcr + endif + + if (tr_bgc_DON) then + do mm = 1, n_don + nt_bgc_DON(mm) = ntrcr + 1 + do k = 1, nk_bgc + ntrcr = ntrcr + 1 + enddo + nbtrcr = nbtrcr + 1 + nlt_bgc_DON(mm) = nbtrcr + enddo ! mm + endif ! tr_bgc_DON + + if (tr_bgc_Fe) then + do mm = 1, n_fed + nt_bgc_Fed(mm) = ntrcr + 1 + do k = 1, nk_bgc + ntrcr = ntrcr + 1 + enddo + nbtrcr = nbtrcr + 1 + nlt_bgc_Fed(mm) = nbtrcr + enddo ! mm + do mm = 1, n_fep + nt_bgc_Fep(mm) = ntrcr + 1 + do k = 1, nk_bgc + ntrcr = ntrcr + 1 + enddo + nbtrcr = nbtrcr + 1 + nlt_bgc_Fep(mm) = nbtrcr + enddo ! mm + endif ! tr_bgc_Fe + + if (tr_bgc_hum) then + nt_bgc_hum = ntrcr + 1 + do k = 1, nk_bgc + ntrcr = ntrcr + 1 + enddo + nbtrcr = nbtrcr + 1 + nlt_bgc_hum = nbtrcr + endif + + endif ! skl_bgc .or. z_tracers + + if (z_tracers) then ! defined on nblyr+1 in ice + ! and 2 snow layers (snow surface + interior) + ! z layer aerosols + if (tr_zaero) then + do mm = 1, n_zaero + nt_zaero(mm) = ntrcr + 1 + do k = 1, nk_bgc + ntrcr = ntrcr + 1 + enddo + nbtrcr = nbtrcr + 1 + nlt_zaero(mm) = nbtrcr + enddo ! mm + endif ! tr_zaero + + nt_zbgc_frac = 0 + if (nbtrcr > 0) then + nt_zbgc_frac = ntrcr + 1 + ntrcr = ntrcr + nbtrcr + endif + endif ! z_tracers + +!tcx, +1 here is the unused tracer, want to get rid of it + ntrcr = ntrcr + 1 + +!tcx, reset unusaed tracer index, eventually get rid of it. + if (nt_iage <= 0) nt_iage = ntrcr + if (nt_FY <= 0) nt_FY = ntrcr + if (nt_alvl <= 0) nt_alvl = ntrcr + if (nt_vlvl <= 0) nt_vlvl = ntrcr + if (nt_apnd <= 0) nt_apnd = ntrcr + if (nt_hpnd <= 0) nt_hpnd = ntrcr + if (nt_ipnd <= 0) nt_ipnd = ntrcr + if (nt_aero <= 0) nt_aero = ntrcr + if (nt_fbri <= 0) nt_fbri = ntrcr + if (nt_bgc_S <= 0) nt_bgc_S = ntrcr + + if (my_task == master_task) then + write(nu_diag,*) ' ' + write(nu_diag,1020) ' ntrcr = ', ntrcr + write(nu_diag,*) ' ' + write(nu_diag,1020) ' nt_sice = ', nt_sice + write(nu_diag,1020) ' nt_qice = ', nt_qice + write(nu_diag,1020) ' nt_qsno = ', nt_qsno + write(nu_diag,*)' ' + write(nu_diag,1020) ' nilyr = ', nilyr + write(nu_diag,1020) ' nslyr = ', nslyr + write(nu_diag,*)' ' + + if (skl_bgc) then + + write(nu_diag,1010) ' skl_bgc = ', skl_bgc + write(nu_diag,1030) ' bgc_flux_type = ', bgc_flux_type + write(nu_diag,1010) ' restart_bgc = ', restart_bgc + write(nu_diag,1010) ' restore_bgc = ', restore_bgc + write(nu_diag,1020) ' number of bio tracers = ', nbtrcr + write(nu_diag,1020) ' number of Isw tracers = ', nbtrcr_sw + write(nu_diag,1020) ' number of autotrophs = ', n_algae + write(nu_diag,1020) ' number of doc = ', n_doc + write(nu_diag,1020) ' number of dic = ', n_dic + write(nu_diag,1020) ' number of don = ', n_don + write(nu_diag,1020) ' number of fed = ', n_fed + write(nu_diag,1020) ' number of fep = ', n_fep + write(nu_diag,1010) ' tr_bgc_N = ', tr_bgc_N + write(nu_diag,1010) ' tr_bgc_C = ', tr_bgc_C + write(nu_diag,1010) ' tr_bgc_chl = ', tr_bgc_chl + write(nu_diag,1010) ' tr_bgc_Nit = ', tr_bgc_Nit + write(nu_diag,1010) ' tr_bgc_Am = ', tr_bgc_Am + write(nu_diag,1010) ' tr_bgc_Sil = ', tr_bgc_Sil + write(nu_diag,1010) ' tr_bgc_hum = ', tr_bgc_hum + write(nu_diag,1010) ' tr_bgc_DMS = ', tr_bgc_DMS + write(nu_diag,1010) ' tr_bgc_PON = ', tr_bgc_PON + write(nu_diag,1010) ' tr_bgc_DON = ', tr_bgc_DON + write(nu_diag,1010) ' tr_bgc_Fe = ', tr_bgc_Fe + + elseif (z_tracers) then + + write(nu_diag,1010) ' restart_bgc = ', restart_bgc + write(nu_diag,1010) ' dEdd_algae = ', dEdd_algae + write(nu_diag,1010) ' modal_aero = ', modal_aero + write(nu_diag,1010) ' scale_bgc = ', scale_bgc + write(nu_diag,1010) ' solve_zbgc = ', solve_zbgc + write(nu_diag,1020) ' number of ztracers = ', nbtrcr + write(nu_diag,1020) ' number of Isw tracers = ', nbtrcr_sw + write(nu_diag,1020) ' number of autotrophs = ', n_algae + write(nu_diag,1020) ' number of doc = ', n_doc + write(nu_diag,1020) ' number of dic = ', n_dic + write(nu_diag,1020) ' number of fed = ', n_fed + write(nu_diag,1020) ' number of fep = ', n_fep + write(nu_diag,1020) ' number of aerosols = ', n_zaero + write(nu_diag,1010) ' tr_zaero = ', tr_zaero + write(nu_diag,1010) ' tr_bgc_Nit = ', tr_bgc_Nit + write(nu_diag,1010) ' tr_bgc_N = ', tr_bgc_N + write(nu_diag,1010) ' tr_bgc_Am = ', tr_bgc_Am + write(nu_diag,1010) ' tr_bgc_C = ', tr_bgc_C + write(nu_diag,1010) ' tr_bgc_Sil = ', tr_bgc_Sil + write(nu_diag,1010) ' tr_bgc_hum = ', tr_bgc_hum + write(nu_diag,1010) ' tr_bgc_chl = ', tr_bgc_chl + write(nu_diag,1010) ' tr_bgc_DMS = ', tr_bgc_DMS + write(nu_diag,1010) ' tr_bgc_PON = ', tr_bgc_PON + write(nu_diag,1010) ' tr_bgc_DON = ', tr_bgc_DON + write(nu_diag,1010) ' tr_bgc_Fe = ', tr_bgc_Fe + ! bio parameters + write(nu_diag,1000) ' grid_o = ', grid_o + write(nu_diag,1000) ' grid_o_t = ', grid_o_t + write(nu_diag,1005) ' l_sk = ', l_sk + write(nu_diag,1000) ' initbio_frac = ', initbio_frac + write(nu_diag,1000) ' frazil_scav = ', frazil_scav + + endif ! skl_bgc or solve_bgc + + 1000 format (a30,2x,f9.2) ! a30 to align formatted, unformatted statements + 1005 format (a30,2x,f9.6) ! float + 1010 format (a30,2x,l6) ! logical + 1020 format (a30,2x,i6) ! integer + 1021 format (a30,2x,a8,i6) ! char, int + 1030 format (a30, a8) ! character + endif ! my_task = master_task + + call flush_fileunit(nu_diag) + + call icepack_init_tracer_numbers(ntrcr_in=ntrcr, & + ntrcr_o_in=ntrcr_o, nbtrcr_in=nbtrcr, nbtrcr_sw_in=nbtrcr_sw) + call icepack_init_tracer_indices(nt_Tsfc_in=nt_Tsfc, nt_sice_in=nt_sice, & + nt_qice_in=nt_qice, nt_qsno_in=nt_qsno, nt_iage_in=nt_iage, nt_fy_in=nt_fy, & + nt_alvl_in=nt_alvl, nt_vlvl_in=nt_vlvl, nt_apnd_in=nt_apnd, nt_hpnd_in=nt_hpnd, & + nt_ipnd_in=nt_ipnd, nt_aero_in=nt_aero, & + nt_fbri_in=nt_fbri, & + nt_bgc_Nit_in=nt_bgc_Nit, nt_bgc_Am_in=nt_bgc_Am, nt_bgc_Sil_in=nt_bgc_Sil, & + nt_bgc_DMS_in=nt_bgc_DMS, nt_bgc_PON_in=nt_bgc_PON, nt_bgc_S_in=nt_bgc_S, & + nt_bgc_N_in=nt_bgc_N, nt_bgc_chl_in=nt_bgc_chl, & + nt_bgc_DOC_in=nt_bgc_DOC, nt_bgc_DON_in=nt_bgc_DON, nt_bgc_DIC_in=nt_bgc_DIC, & + nt_zaero_in=nt_zaero, nt_bgc_DMSPp_in=nt_bgc_DMSPp, nt_bgc_DMSPd_in=nt_bgc_DMSPd, & + nt_bgc_Fed_in=nt_bgc_Fed, nt_bgc_Fep_in=nt_bgc_Fep, nt_zbgc_frac_in=nt_zbgc_frac, & + nlt_zaero_sw_in=nlt_zaero_sw, nlt_chl_sw_in=nlt_chl_sw, nlt_bgc_Sil_in=nlt_bgc_Sil, & + nlt_bgc_N_in=nlt_bgc_N, nlt_bgc_Nit_in=nlt_bgc_Nit, nlt_bgc_Am_in=nlt_bgc_Am, & + nlt_bgc_DMS_in=nlt_bgc_DMS, nlt_bgc_DMSPp_in=nlt_bgc_DMSPp, nlt_bgc_DMSPd_in=nlt_bgc_DMSPd, & + nlt_zaero_in=nlt_zaero, nlt_bgc_chl_in=nlt_bgc_chl, & + nlt_bgc_DIC_in=nlt_bgc_DIC, nlt_bgc_DOC_in=nlt_bgc_DOC, nlt_bgc_PON_in=nlt_bgc_PON, & + nlt_bgc_DON_in=nlt_bgc_DON, nlt_bgc_Fed_in=nlt_bgc_Fed, nlt_bgc_Fep_in=nlt_bgc_Fep, & + nt_bgc_hum_in=nt_bgc_hum, nlt_bgc_hum_in=nlt_bgc_hum, & + n_algae_in=n_algae, & + n_DOC_in=n_DOC, n_DON_in=n_DON, n_DIC_in=n_DIC, & + n_fed_in=n_fed, n_fep_in=n_fep, n_zaero_in=n_zaero) + call icepack_warnings_flush(nu_diag) + if (icepack_warnings_aborted()) call abort_ice(error_message=subname//' Icepack Abort2', & + file=__FILE__, line=__LINE__) + + end subroutine count_tracers + +!======================================================================= + +! Initialize vertical biogeochemistry +! +! author Elizabeth C. Hunke, LANL +! Nicole Jeffery, LANL + + subroutine init_zbgc + + use ice_broadcast, only: broadcast_scalar + use ice_state, only: trcr_base, trcr_depend, n_trcr_strata, & + nt_strata + use ice_arrays_column, only: R_C2N, R_chl2N, R_C2N_DON, R_Si2N + + integer (kind=int_kind) :: & + nbtrcr, nbtrcr_sw, nt_fbri, & + nt_bgc_Nit, nt_bgc_Am, nt_bgc_Sil, & + nt_bgc_DMS, nt_bgc_PON, nt_bgc_S, & + nt_bgc_DMSPp, nt_bgc_DMSPd, & + nt_zbgc_frac, nlt_chl_sw, & + nlt_bgc_Nit, nlt_bgc_Am, nlt_bgc_Sil, & + nlt_bgc_DMS, nlt_bgc_DMSPp, nlt_bgc_DMSPd, & + nlt_bgc_PON, nt_bgc_hum, nlt_bgc_hum + + integer (kind=int_kind), dimension(icepack_max_aero) :: & + nlt_zaero_sw ! points to aerosol in trcrn_sw + + integer (kind=int_kind), dimension(icepack_max_algae) :: & + nlt_bgc_N , & ! algae + nlt_bgc_chl + + integer (kind=int_kind), dimension(icepack_max_doc) :: & + nlt_bgc_DOC ! disolved organic carbon + + integer (kind=int_kind), dimension(icepack_max_don) :: & + nlt_bgc_DON ! + + integer (kind=int_kind), dimension(icepack_max_dic) :: & + nlt_bgc_DIC ! disolved inorganic carbon + + integer (kind=int_kind), dimension(icepack_max_fe) :: & + nlt_bgc_Fed , & ! + nlt_bgc_Fep ! + + integer (kind=int_kind), dimension(icepack_max_aero) :: & + nlt_zaero ! non-reacting layer aerosols + + integer (kind=int_kind), dimension(icepack_max_algae) :: & + nt_bgc_N , & ! diatoms, phaeocystis, pico/small + nt_bgc_chl ! diatoms, phaeocystis, pico/small + + integer (kind=int_kind), dimension(icepack_max_doc) :: & + nt_bgc_DOC ! dissolved organic carbon + + integer (kind=int_kind), dimension(icepack_max_don) :: & + nt_bgc_DON ! dissolved organic nitrogen + + integer (kind=int_kind), dimension(icepack_max_dic) :: & + nt_bgc_DIC ! dissolved inorganic carbon + + integer (kind=int_kind), dimension(icepack_max_fe) :: & + nt_bgc_Fed, & ! dissolved iron + nt_bgc_Fep ! particulate iron + + integer (kind=int_kind), dimension(icepack_max_aero) :: & + nt_zaero ! black carbon and other aerosols + + integer (kind=int_kind), dimension(icepack_max_nbtrcr) :: & + bio_index_o ! relates nlt_bgc_NO to ocean concentration index + + integer (kind=int_kind), dimension(icepack_max_nbtrcr) :: & + bio_index ! relates bio indices, ie. nlt_bgc_N to nt_bgc_N + + logical (kind=log_kind) :: & + tr_brine, & + tr_bgc_Nit, tr_bgc_Am, tr_bgc_Sil, & + tr_bgc_DMS, tr_bgc_PON, & + tr_bgc_N, tr_bgc_C, tr_bgc_chl, & + tr_bgc_DON, tr_bgc_Fe, tr_zaero, & + tr_bgc_hum, tr_aero + + real (kind=dbl_kind) :: & + initbio_frac, & + frazil_scav + + real (kind=dbl_kind), dimension(icepack_max_nbtrcr) :: & + zbgc_frac_init,&! initializes mobile fraction + bgc_tracer_type ! described tracer in mobile or stationary phases + ! < 0 is purely mobile (eg. nitrate) + ! > 0 has timescales for transitions between + ! phases based on whether the ice is melting or growing + + real (kind=dbl_kind), dimension(icepack_max_nbtrcr) :: & + zbgc_init_frac, & ! fraction of ocean tracer concentration in new ice + tau_ret, & ! retention timescale (s), mobile to stationary phase + tau_rel ! release timescale (s), stationary to mobile phase + + logical (kind=log_kind) :: & + skl_bgc, z_tracers, dEdd_algae, solve_zsal + + real (kind=dbl_kind), dimension(icepack_max_algae) :: & + F_abs_chl ! to scale absorption in Dedd + + real (kind=dbl_kind), dimension(icepack_max_algae) :: & + R_S2N , & ! algal S to N (mole/mole) + ! Marchetti et al 2006, 3 umol Fe/mol C for iron limited Pseudo-nitzschia + R_Fe2C , & ! algal Fe to carbon (umol/mmol) + R_Fe2N ! algal Fe to N (umol/mmol) - ntrcr_o = ntrcr - nt_fbri = 0 - if (tr_brine) then - nt_fbri = ntrcr + 1 ! ice volume fraction with salt - ntrcr = ntrcr + 1 - trcr_depend(nt_fbri) = 1 ! volume-weighted - trcr_base (nt_fbri,1) = c0 ! volume-weighted - trcr_base (nt_fbri,2) = c1 ! volume-weighted - trcr_base (nt_fbri,3) = c0 ! volume-weighted - n_trcr_strata(nt_fbri) = 0 - nt_strata (nt_fbri,1) = 0 - nt_strata (nt_fbri,2) = 0 - endif + real (kind=dbl_kind), dimension(icepack_max_don) :: & + R_Fe2DON ! Fe to N of DON (nmol/umol) - ntd = 0 ! if nt_fbri /= 0 then use fbri dependency - if (nt_fbri == 0) ntd = -1 ! otherwise make tracers depend on ice volume + real (kind=dbl_kind), dimension(icepack_max_doc) :: & + R_Fe2DOC ! Fe to C of DOC (nmol/umol) - if (solve_zsal) then ! .true. only if tr_brine = .true. - nt_bgc_S = ntrcr + 1 - ntrcr = ntrcr + nblyr - do k = 1,nblyr - trcr_depend(nt_bgc_S + k - 1) = 2 + nt_fbri + ntd - trcr_base (nt_bgc_S,1) = c0 ! default: ice area - trcr_base (nt_bgc_S,2) = c1 - trcr_base (nt_bgc_S,3) = c0 - n_trcr_strata(nt_bgc_S) = 1 - nt_strata(nt_bgc_S,1) = nt_fbri - nt_strata(nt_bgc_S,2) = 0 - enddo - endif + real (kind=dbl_kind), dimension(icepack_max_algae) :: & + chlabs , & ! chla absorption 1/m/(mg/m^3) + alpha2max_low , & ! light limitation (1/(W/m^2)) + beta2max , & ! light inhibition (1/(W/m^2)) + mu_max , & ! maximum growth rate (1/d) + grow_Tdep , & ! T dependence of growth (1/C) + fr_graze , & ! fraction of algae grazed + mort_pre , & ! mortality (1/day) + mort_Tdep , & ! T dependence of mortality (1/C) + k_exude , & ! algal carbon exudation rate (1/d) + K_Nit , & ! nitrate half saturation (mmol/m^3) + K_Am , & ! ammonium half saturation (mmol/m^3) + K_Sil , & ! silicon half saturation (mmol/m^3) + K_Fe ! iron half saturation or micromol/m^3 - !----------------------------------------------------------------- - ! biogeochemistry - !----------------------------------------------------------------- + real (kind=dbl_kind), dimension(icepack_max_DON) :: & + f_don , & ! fraction of spilled grazing to DON + kn_bac , & ! Bacterial degredation of DON (1/d) + f_don_Am ! fraction of remineralized DON to Am - nbtrcr = 0 - nbtrcr_sw = 0 + real (kind=dbl_kind), dimension(icepack_max_DOC) :: & + f_doc , & ! fraction of mort_N that goes to each doc pool + f_exude , & ! fraction of exuded carbon to each DOC pool + k_bac ! Bacterial degredation of DOC (1/d) - ! vectors of size icepack_max_algae - nlt_bgc_N(:) = 0 - nlt_bgc_chl(:) = 0 - nt_bgc_N(:) = 0 - nt_bgc_chl(:) = 0 + integer (kind=int_kind) :: & + k, mm , & ! loop index + nk , & ! layer index + ierr - ! vectors of size icepack_max_dic - nlt_bgc_DIC(:) = 0 - nt_bgc_DIC(:) = 0 + integer (kind=int_kind) :: & + ntd , & ! for tracer dependency calculation + nt_depend - ! vectors of size icepack_max_doc - nlt_bgc_DOC(:) = 0 - nt_bgc_DOC(:) = 0 + character(len=*), parameter :: subname='(init_zbgc)' - ! vectors of size icepack_max_don - nlt_bgc_DON(:) = 0 - nt_bgc_DON(:) = 0 + !------------------------------------------------------------ + ! Tracers have mobile and stationary phases. + ! ice growth allows for retention, ice melt facilitates mobility + ! bgc_tracer_type defines the exchange timescales between these phases + ! -1 : entirely in the mobile phase, no exchange (this is the default) + ! 0 : retention time scale is tau_min, release time scale is tau_max + ! 1 : retention time scale is tau_max, release time scale is tau_min + ! 0.5: retention time scale is tau_min, release time scale is tau_min + ! 2 : retention time scale is tau_max, release time scale is tau_max + ! tau_min and tau_max are defined in icepack_intfc.f90 + !------------------------------------------------------------ - ! vectors of size icepack_max_fe - nlt_bgc_Fed(:) = 0 - nlt_bgc_Fep(:) = 0 - nt_bgc_Fed(:) = 0 - nt_bgc_Fep(:) = 0 + !----------------------------------------------------------------- + ! get values from icepack + !----------------------------------------------------------------- - ! vectors of size icepack_max_aero - nlt_zaero(:) = 0 - nlt_zaero_sw(:) = 0 - nt_zaero(:) = 0 + call icepack_query_parameters( & + solve_zsal_out=solve_zsal, & + skl_bgc_out=skl_bgc, z_tracers_out=z_tracers, & + dEdd_algae_out=dEdd_algae, & + grid_o_out=grid_o, l_sk_out=l_sk, & + initbio_frac_out=initbio_frac, & + grid_oS_out=grid_oS, l_skS_out=l_skS, & + phi_snow_out=phi_snow, frazil_scav_out = frazil_scav) + call icepack_warnings_flush(nu_diag) + if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & + file=__FILE__, line=__LINE__) - nlt_bgc_Nit = 0 - nlt_bgc_Am = 0 - nlt_bgc_Sil = 0 - nlt_bgc_DMSPp = 0 - nlt_bgc_DMSPd = 0 - nlt_bgc_DMS = 0 - nlt_bgc_PON = 0 - nlt_bgc_hum = 0 - nlt_chl_sw = 0 - bio_index(:) = 0 - bio_index_o(:) = 0 + call icepack_query_tracer_numbers( & + nbtrcr_out=nbtrcr, nbtrcr_sw_out=nbtrcr_sw) + call icepack_warnings_flush(nu_diag) + if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & + file=__FILE__, line=__LINE__) - nt_bgc_Nit = 0 - nt_bgc_Am = 0 - nt_bgc_Sil = 0 - nt_bgc_DMSPp = 0 - nt_bgc_DMSPd = 0 - nt_bgc_DMS = 0 - nt_bgc_PON = 0 - nt_bgc_hum = 0 + call icepack_query_tracer_flags( & + tr_brine_out =tr_brine, & + tr_bgc_Nit_out=tr_bgc_Nit, tr_bgc_Am_out=tr_bgc_Am, tr_bgc_Sil_out=tr_bgc_Sil, & + tr_bgc_DMS_out=tr_bgc_DMS, tr_bgc_PON_out=tr_bgc_PON, & + tr_bgc_N_out =tr_bgc_N, tr_bgc_C_out =tr_bgc_C, tr_bgc_chl_out=tr_bgc_chl, & + tr_bgc_DON_out=tr_bgc_DON, tr_bgc_Fe_out=tr_bgc_Fe, tr_zaero_out =tr_zaero, & + tr_bgc_hum_out=tr_bgc_hum) + call icepack_warnings_flush(nu_diag) + if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & + file=__FILE__, line=__LINE__) + + call icepack_query_tracer_indices( & + nt_fbri_out=nt_fbri, & + nt_bgc_Nit_out=nt_bgc_Nit, nt_bgc_Am_out=nt_bgc_Am, nt_bgc_Sil_out=nt_bgc_Sil, & + nt_bgc_DMS_out=nt_bgc_DMS, nt_bgc_PON_out=nt_bgc_PON, nt_bgc_S_out=nt_bgc_S, & + nt_bgc_N_out=nt_bgc_N, nt_bgc_chl_out=nt_bgc_chl, & + nt_bgc_DOC_out=nt_bgc_DOC, nt_bgc_DON_out=nt_bgc_DON, nt_bgc_DIC_out=nt_bgc_DIC, & + nt_zaero_out=nt_zaero, nt_bgc_DMSPp_out=nt_bgc_DMSPp, nt_bgc_DMSPd_out=nt_bgc_DMSPd, & + nt_bgc_Fed_out=nt_bgc_Fed, nt_bgc_Fep_out=nt_bgc_Fep, nt_zbgc_frac_out=nt_zbgc_frac, & + nlt_zaero_sw_out=nlt_zaero_sw, nlt_chl_sw_out=nlt_chl_sw, nlt_bgc_Sil_out=nlt_bgc_Sil, & + nlt_bgc_N_out=nlt_bgc_N, nlt_bgc_Nit_out=nlt_bgc_Nit, nlt_bgc_Am_out=nlt_bgc_Am, & + nlt_bgc_DMS_out=nlt_bgc_DMS, nlt_bgc_DMSPp_out=nlt_bgc_DMSPp, nlt_bgc_DMSPd_out=nlt_bgc_DMSPd, & + nlt_zaero_out=nlt_zaero, nlt_bgc_chl_out=nlt_bgc_chl, & + nlt_bgc_DIC_out=nlt_bgc_DIC, nlt_bgc_DOC_out=nlt_bgc_DOC, nlt_bgc_PON_out=nlt_bgc_PON, & + nlt_bgc_DON_out=nlt_bgc_DON, nlt_bgc_Fed_out=nlt_bgc_Fed, nlt_bgc_Fep_out=nlt_bgc_Fep, & + nt_bgc_hum_out=nt_bgc_hum, nlt_bgc_hum_out=nlt_bgc_hum) + call icepack_warnings_flush(nu_diag) + if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & + file=__FILE__, line=__LINE__) -!echmod: move this back into init_zbgc? !----------------------------------------------------------------- ! Define array parameters !----------------------------------------------------------------- + + allocate( & + R_C2N_DON(icepack_max_don), & ! carbon to nitrogen mole ratio of DON pool + R_C2N(icepack_max_algae), & ! algal C to N (mole/mole) + R_chl2N(icepack_max_algae), & ! 3 algal chlorophyll to N (mg/mmol) + R_Si2N(icepack_max_algae), & ! silica to nitrogen mole ratio for algal groups + stat=ierr) + if (ierr/=0) call abort_ice(subname//' Out of Memory') + R_Si2N(1) = ratio_Si2N_diatoms R_Si2N(2) = ratio_Si2N_sp R_Si2N(3) = ratio_Si2N_phaeo @@ -1739,7 +2550,7 @@ subroutine init_zbgc R_Fe2DON(1) = ratio_Fe2DON R_C2N_DON(1) = ratio_C2N_proteins - + R_Fe2DOC(1) = ratio_Fe2DOC_s R_Fe2DOC(2) = ratio_Fe2DOC_l R_Fe2DOC(3) = c0 @@ -1807,17 +2618,16 @@ subroutine init_zbgc f_exude(2) = f_exude_l k_bac(1) = k_bac_s k_bac(2) = k_bac_l -!echmod: end move this back into init_zbgc dictype(:) = -c1 - + algaltype(1) = algaltype_diatoms algaltype(2) = algaltype_sp algaltype(3) = algaltype_phaeo doctype(1) = doctype_s doctype(2) = doctype_l - + dontype(1) = dontype_protein fedtype(1) = fedtype_1 @@ -1830,7 +2640,6 @@ subroutine init_zbgc zaerotype(5) = zaerotype_dust3 zaerotype(6) = zaerotype_dust4 -!echmod types do not need to be in icepack for zbgc? call icepack_init_zbgc ( & R_S2N_in=R_S2N, R_Fe2C_in=R_Fe2C, R_Fe2N_in=R_Fe2N, R_C2N_in=R_C2N, & R_chl2N_in=R_chl2N, F_abs_chl_in=F_abs_chl, R_Fe2DON_in=R_Fe2DON, R_Fe2DOC_in=R_Fe2DOC, & @@ -1849,45 +2658,55 @@ subroutine init_zbgc if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & file=__FILE__, line=__LINE__) - if (skl_bgc) then + !----------------------------------------------------------------- + ! assign tracer dependencies + ! bgc_tracer_type: < 0 purely mobile , >= 0 stationary + !------------------------------------------------------------------ - nk = 1 - nt_depend = 0 + if (tr_brine) then + trcr_depend(nt_fbri) = 1 ! volume-weighted + trcr_base (nt_fbri,1) = c0 ! volume-weighted + trcr_base (nt_fbri,2) = c1 ! volume-weighted + trcr_base (nt_fbri,3) = c0 ! volume-weighted + n_trcr_strata(nt_fbri) = 0 + nt_strata (nt_fbri,1) = 0 + nt_strata (nt_fbri,2) = 0 + endif - if (dEdd_algae) then - nlt_chl_sw = 1 - nbtrcr_sw = nilyr+nslyr+2 ! only the bottom layer - ! will be nonzero - endif - - elseif (z_tracers) then ! defined on nblyr+1 in ice - ! and 2 snow layers (snow surface + interior) + ntd = 0 ! if nt_fbri /= 0 then use fbri dependency + if (nt_fbri == 0) ntd = -1 ! otherwise make tracers depend on ice volume - nk = nblyr + 1 - nt_depend = 2 + nt_fbri + ntd + if (solve_zsal) then ! .true. only if tr_brine = .true. + do k = 1,nblyr + trcr_depend(nt_bgc_S + k - 1) = 2 + nt_fbri + ntd + trcr_base (nt_bgc_S,1) = c0 ! default: ice area + trcr_base (nt_bgc_S,2) = c1 + trcr_base (nt_bgc_S,3) = c0 + n_trcr_strata(nt_bgc_S) = 1 + nt_strata(nt_bgc_S,1) = nt_fbri + nt_strata(nt_bgc_S,2) = 0 + enddo + endif - if (tr_bgc_N) then - if (dEdd_algae) then - nlt_chl_sw = 1 - nbtrcr_sw = nilyr+nslyr+2 - endif - endif ! tr_bgc_N + bio_index(:) = 0 + bio_index_o(:) = 0 + if (skl_bgc) then + nk = 1 + nt_depend = 0 + elseif (z_tracers) then ! defined on nblyr+1 in ice + ! and 2 snow layers (snow surface + interior) + nk = nblyr + 1 + nt_depend = 2 + nt_fbri + ntd endif ! skl_bgc or z_tracers if (skl_bgc .or. z_tracers) then - !----------------------------------------------------------------- - ! assign tracer indices and dependencies - ! bgc_tracer_type: < 0 purely mobile , >= 0 stationary - !------------------------------------------------------------------ - if (tr_bgc_N) then do mm = 1, n_algae call init_bgc_trcr(nk, nt_fbri, & nt_bgc_N(mm), nlt_bgc_N(mm), & algaltype(mm), nt_depend, & - ntrcr, nbtrcr, & bgc_tracer_type, trcr_depend, & trcr_base, n_trcr_strata, & nt_strata, bio_index) @@ -1899,7 +2718,6 @@ subroutine init_zbgc call init_bgc_trcr(nk, nt_fbri, & nt_bgc_Nit, nlt_bgc_Nit, & nitratetype, nt_depend, & - ntrcr, nbtrcr, & bgc_tracer_type, trcr_depend, & trcr_base, n_trcr_strata, & nt_strata, bio_index) @@ -1916,7 +2734,6 @@ subroutine init_zbgc ! call init_bgc_trcr(nk, nt_fbri, & ! nt_bgc_C(mm), nlt_bgc_C(mm), & ! algaltype(mm), nt_depend, & - ! ntrcr, nbtrcr, & ! bgc_tracer_type, trcr_depend, & ! trcr_base, n_trcr_strata, & ! nt_strata, bio_index) @@ -1927,7 +2744,6 @@ subroutine init_zbgc call init_bgc_trcr(nk, nt_fbri, & nt_bgc_DOC(mm), nlt_bgc_DOC(mm), & doctype(mm), nt_depend, & - ntrcr, nbtrcr, & bgc_tracer_type, trcr_depend, & trcr_base, n_trcr_strata, & nt_strata, bio_index) @@ -1937,7 +2753,6 @@ subroutine init_zbgc call init_bgc_trcr(nk, nt_fbri, & nt_bgc_DIC(mm), nlt_bgc_DIC(mm), & dictype(mm), nt_depend, & - ntrcr, nbtrcr, & bgc_tracer_type, trcr_depend, & trcr_base, n_trcr_strata, & nt_strata, bio_index) @@ -1950,7 +2765,6 @@ subroutine init_zbgc call init_bgc_trcr(nk, nt_fbri, & nt_bgc_chl(mm), nlt_bgc_chl(mm), & algaltype(mm), nt_depend, & - ntrcr, nbtrcr, & bgc_tracer_type, trcr_depend, & trcr_base, n_trcr_strata, & nt_strata, bio_index) @@ -1962,7 +2776,6 @@ subroutine init_zbgc call init_bgc_trcr(nk, nt_fbri, & nt_bgc_Am, nlt_bgc_Am, & ammoniumtype, nt_depend, & - ntrcr, nbtrcr, & bgc_tracer_type, trcr_depend, & trcr_base, n_trcr_strata, & nt_strata, bio_index) @@ -1972,7 +2785,6 @@ subroutine init_zbgc call init_bgc_trcr(nk, nt_fbri, & nt_bgc_Sil, nlt_bgc_Sil, & silicatetype, nt_depend, & - ntrcr, nbtrcr, & bgc_tracer_type, trcr_depend, & trcr_base, n_trcr_strata, & nt_strata, bio_index) @@ -1982,7 +2794,6 @@ subroutine init_zbgc call init_bgc_trcr(nk, nt_fbri, & nt_bgc_DMSPp, nlt_bgc_DMSPp, & dmspptype, nt_depend, & - ntrcr, nbtrcr, & bgc_tracer_type, trcr_depend, & trcr_base, n_trcr_strata, & nt_strata, bio_index) @@ -1991,7 +2802,6 @@ subroutine init_zbgc call init_bgc_trcr(nk, nt_fbri, & nt_bgc_DMSPd, nlt_bgc_DMSPd, & dmspdtype, nt_depend, & - ntrcr, nbtrcr, & bgc_tracer_type, trcr_depend, & trcr_base, n_trcr_strata, & nt_strata, bio_index) @@ -2000,7 +2810,6 @@ subroutine init_zbgc call init_bgc_trcr(nk, nt_fbri, & nt_bgc_DMS, nlt_bgc_DMS, & dmspdtype, nt_depend, & - ntrcr, nbtrcr, & bgc_tracer_type, trcr_depend, & trcr_base, n_trcr_strata, & nt_strata, bio_index) @@ -2010,7 +2819,6 @@ subroutine init_zbgc call init_bgc_trcr(nk, nt_fbri, & nt_bgc_PON, nlt_bgc_PON, & nitratetype, nt_depend, & - ntrcr, nbtrcr, & bgc_tracer_type, trcr_depend, & trcr_base, n_trcr_strata, & nt_strata, bio_index) @@ -2021,7 +2829,6 @@ subroutine init_zbgc call init_bgc_trcr(nk, nt_fbri, & nt_bgc_DON(mm), nlt_bgc_DON(mm), & dontype(mm), nt_depend, & - ntrcr, nbtrcr, & bgc_tracer_type, trcr_depend, & trcr_base, n_trcr_strata, & nt_strata, bio_index) @@ -2033,7 +2840,6 @@ subroutine init_zbgc call init_bgc_trcr(nk, nt_fbri, & nt_bgc_Fed(mm), nlt_bgc_Fed(mm), & fedtype(mm), nt_depend, & - ntrcr, nbtrcr, & bgc_tracer_type, trcr_depend, & trcr_base, n_trcr_strata, & nt_strata, bio_index) @@ -2044,7 +2850,6 @@ subroutine init_zbgc call init_bgc_trcr(nk, nt_fbri, & nt_bgc_Fep(mm), nlt_bgc_Fep(mm), & feptype(mm), nt_depend, & - ntrcr, nbtrcr, & bgc_tracer_type, trcr_depend, & trcr_base, n_trcr_strata, & nt_strata, bio_index) @@ -2057,7 +2862,6 @@ subroutine init_zbgc call init_bgc_trcr(nk, nt_fbri, & nt_bgc_hum, nlt_bgc_hum, & humtype, nt_depend, & - ntrcr, nbtrcr, & bgc_tracer_type, trcr_depend, & trcr_base, n_trcr_strata, & nt_strata, bio_index) @@ -2066,8 +2870,24 @@ subroutine init_zbgc endif endif ! skl_bgc or z_tracers - if (z_tracers) then ! defined on nblyr+1 in ice + if (skl_bgc) then + if (dEdd_algae) then + nlt_chl_sw = 1 + nbtrcr_sw = nilyr+nslyr+2 ! only the bottom layer will be nonzero + endif + + elseif (z_tracers) then ! defined on nblyr+1 in ice ! and 2 snow layers (snow surface + interior) + if (tr_bgc_N) then + if (dEdd_algae) then + nlt_chl_sw = 1 + nbtrcr_sw = nilyr+nslyr+2 + endif + endif ! tr_bgc_N + endif ! skl_bgc or z_tracers + + if (z_tracers) then ! defined on nblyr+1 in ice + ! and 2 snow layers (snow surface + interior) nk = nblyr + 1 nt_depend = 2 + nt_fbri + ntd @@ -2082,7 +2902,6 @@ subroutine init_zbgc call init_bgc_trcr(nk, nt_fbri, & nt_zaero(mm), nlt_zaero(mm), & zaerotype(mm), nt_depend, & - ntrcr, nbtrcr, & bgc_tracer_type, trcr_depend, & trcr_base, n_trcr_strata, & nt_strata, bio_index) @@ -2091,11 +2910,7 @@ subroutine init_zbgc enddo ! mm endif ! tr_zaero -!echmod keep trcr indices etc here but move zbgc_frac_init, zbgc_init_frac, tau_ret, tau_rel to icepack - nt_zbgc_frac = 0 if (nbtrcr > 0) then - nt_zbgc_frac = ntrcr + 1 - ntrcr = ntrcr + nbtrcr do k = 1,nbtrcr zbgc_frac_init(k) = c1 trcr_depend(nt_zbgc_frac+k-1) = 2+nt_fbri @@ -2141,46 +2956,8 @@ subroutine init_zbgc call icepack_init_zbgc( & zbgc_init_frac_in=zbgc_init_frac, tau_ret_in=tau_ret, tau_rel_in=tau_rel, & zbgc_frac_init_in=zbgc_frac_init, bgc_tracer_type_in=bgc_tracer_type) - call icepack_warnings_flush(nu_diag) - if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & - file=__FILE__, line=__LINE__) - - call icepack_init_tracer_numbers( & - ntrcr_in=ntrcr, ntrcr_o_in=ntrcr_o, nbtrcr_in=nbtrcr, nbtrcr_sw_in=nbtrcr_sw) - call icepack_warnings_flush(nu_diag) - if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & - file=__FILE__, line=__LINE__) - - call icepack_init_tracer_flags( & - tr_brine_in =tr_brine, & - tr_bgc_Nit_in=tr_bgc_Nit, tr_bgc_Am_in =tr_bgc_Am, tr_bgc_Sil_in=tr_bgc_Sil, & - tr_bgc_DMS_in=tr_bgc_DMS, tr_bgc_PON_in=tr_bgc_PON, & - tr_bgc_N_in =tr_bgc_N, tr_bgc_C_in =tr_bgc_C, tr_bgc_chl_in=tr_bgc_chl, & - tr_bgc_DON_in=tr_bgc_DON, tr_bgc_Fe_in =tr_bgc_Fe, tr_zaero_in =tr_zaero, & - tr_bgc_hum_in=tr_bgc_hum) - call icepack_warnings_flush(nu_diag) - if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & - file=__FILE__, line=__LINE__) - call icepack_init_tracer_indices( & nbtrcr_in=nbtrcr, & - nt_fbri_in=nt_fbri, & - nt_bgc_Nit_in=nt_bgc_Nit, nt_bgc_Am_in=nt_bgc_Am, nt_bgc_Sil_in=nt_bgc_Sil, & - nt_bgc_DMS_in=nt_bgc_DMS, nt_bgc_PON_in=nt_bgc_PON, nt_bgc_S_in=nt_bgc_S, & - nt_bgc_N_in=nt_bgc_N, nt_bgc_chl_in=nt_bgc_chl, & - nt_bgc_DOC_in=nt_bgc_DOC, nt_bgc_DON_in=nt_bgc_DON, nt_bgc_DIC_in=nt_bgc_DIC, & - nt_zaero_in=nt_zaero, nt_bgc_DMSPp_in=nt_bgc_DMSPp, nt_bgc_DMSPd_in=nt_bgc_DMSPd, & - nt_bgc_Fed_in=nt_bgc_Fed, nt_bgc_Fep_in=nt_bgc_Fep, nt_zbgc_frac_in=nt_zbgc_frac, & - nlt_zaero_sw_in=nlt_zaero_sw, nlt_chl_sw_in=nlt_chl_sw, nlt_bgc_Sil_in=nlt_bgc_Sil, & - nlt_bgc_N_in=nlt_bgc_N, nlt_bgc_Nit_in=nlt_bgc_Nit, nlt_bgc_Am_in=nlt_bgc_Am, & - nlt_bgc_DMS_in=nlt_bgc_DMS, nlt_bgc_DMSPp_in=nlt_bgc_DMSPp, nlt_bgc_DMSPd_in=nlt_bgc_DMSPd, & - nlt_bgc_chl_in=nlt_bgc_chl, nlt_zaero_in=nlt_zaero, & - nlt_bgc_DIC_in=nlt_bgc_DIC, nlt_bgc_DOC_in=nlt_bgc_DOC, nlt_bgc_PON_in=nlt_bgc_PON, & - nlt_bgc_DON_in=nlt_bgc_DON, nlt_bgc_Fed_in=nlt_bgc_Fed, nlt_bgc_Fep_in=nlt_bgc_Fep, & - nt_bgc_hum_in=nt_bgc_hum, nlt_bgc_hum_in=nlt_bgc_hum, & - n_algae_in=n_algae, & - n_DOC_in=n_DOC, n_DON_in=n_DON, n_DIC_in=n_DIC, & - n_fed_in=n_fed, n_fep_in=n_fep, n_zaero_in=n_zaero, & bio_index_o_in=bio_index_o, bio_index_in=bio_index) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & @@ -2197,80 +2974,19 @@ subroutine init_zbgc endif if (.NOT. dEdd_algae) nbtrcr_sw = 1 - if (nbtrcr_sw > max_nsw) then - write (nu_diag,*) subname,' ' - write (nu_diag,*) subname,'nbtrcr_sw > max_nsw' - write (nu_diag,*) subname,'nbtrcr_sw, max_nsw:',nbtrcr_sw, max_nsw - call abort_ice (subname//'ERROR: nbtrcr_sw > max_nsw') - endif - - if (ntrcr > max_ntrcr) then - write(nu_diag,*) subname,'max_ntrcr < number of namelist tracers' - write(nu_diag,*) subname,'max_ntrcr = ',max_ntrcr,' ntrcr = ',ntrcr - call abort_ice(subname//'ERROR: max_ntrcr < number of namelist tracers') - endif - !----------------------------------------------------------------- ! spew !----------------------------------------------------------------- if (my_task == master_task) then if (skl_bgc) then - write(nu_diag,1010) ' skl_bgc = ', skl_bgc - write(nu_diag,1030) ' bgc_flux_type = ', bgc_flux_type - write(nu_diag,1010) ' restart_bgc = ', restart_bgc - write(nu_diag,1010) ' restore_bgc = ', restore_bgc write(nu_diag,1020) ' number of bio tracers = ', nbtrcr write(nu_diag,1020) ' number of Isw tracers = ', nbtrcr_sw - write(nu_diag,1020) ' number of autotrophs = ', n_algae - write(nu_diag,1020) ' number of doc = ', n_doc - write(nu_diag,1020) ' number of dic = ', n_dic - write(nu_diag,1020) ' number of don = ', n_don - write(nu_diag,1020) ' number of fed = ', n_fed - write(nu_diag,1020) ' number of fep = ', n_fep - write(nu_diag,1010) ' tr_bgc_N = ', tr_bgc_N - write(nu_diag,1010) ' tr_bgc_C = ', tr_bgc_C - write(nu_diag,1010) ' tr_bgc_chl = ', tr_bgc_chl - write(nu_diag,1010) ' tr_bgc_Nit = ', tr_bgc_Nit - write(nu_diag,1010) ' tr_bgc_Am = ', tr_bgc_Am - write(nu_diag,1010) ' tr_bgc_Sil = ', tr_bgc_Sil - write(nu_diag,1010) ' tr_bgc_hum = ', tr_bgc_hum - write(nu_diag,1010) ' tr_bgc_DMS = ', tr_bgc_DMS - write(nu_diag,1010) ' tr_bgc_PON = ', tr_bgc_PON - write(nu_diag,1010) ' tr_bgc_DON = ', tr_bgc_DON - write(nu_diag,1010) ' tr_bgc_Fe = ', tr_bgc_Fe elseif (z_tracers) then - write(nu_diag,1010) ' restart_bgc = ', restart_bgc - write(nu_diag,1010) ' dEdd_algae = ', dEdd_algae - write(nu_diag,1010) ' modal_aero = ', modal_aero - write(nu_diag,1010) ' scale_bgc = ', scale_bgc - write(nu_diag,1010) ' solve_zbgc = ', solve_zbgc write(nu_diag,1020) ' number of ztracers = ', nbtrcr write(nu_diag,1020) ' number of Isw tracers = ', nbtrcr_sw - write(nu_diag,1020) ' number of autotrophs = ', n_algae - write(nu_diag,1020) ' number of doc = ', n_doc - write(nu_diag,1020) ' number of dic = ', n_dic - write(nu_diag,1020) ' number of fed = ', n_fed - write(nu_diag,1020) ' number of fep = ', n_fep - write(nu_diag,1020) ' number of aerosols = ', n_zaero - write(nu_diag,1010) ' tr_zaero = ', tr_zaero - write(nu_diag,1010) ' tr_bgc_Nit = ', tr_bgc_Nit - write(nu_diag,1010) ' tr_bgc_N = ', tr_bgc_N - write(nu_diag,1010) ' tr_bgc_Am = ', tr_bgc_Am - write(nu_diag,1010) ' tr_bgc_C = ', tr_bgc_C - write(nu_diag,1010) ' tr_bgc_Sil = ', tr_bgc_Sil - write(nu_diag,1010) ' tr_bgc_hum = ', tr_bgc_hum - write(nu_diag,1010) ' tr_bgc_chl = ', tr_bgc_chl - write(nu_diag,1010) ' tr_bgc_DMS = ', tr_bgc_DMS - write(nu_diag,1010) ' tr_bgc_PON = ', tr_bgc_PON - write(nu_diag,1010) ' tr_bgc_DON = ', tr_bgc_DON - write(nu_diag,1010) ' tr_bgc_Fe = ', tr_bgc_Fe - !bio parameters - write(nu_diag,1000) ' grid_o = ', grid_o - write(nu_diag,1000) ' grid_o_t = ', grid_o_t - write(nu_diag,1005) ' l_sk = ', l_sk write(nu_diag,1000) ' initbio_frac = ', initbio_frac write(nu_diag,1000) ' frazil_scav = ', frazil_scav @@ -2278,10 +2994,7 @@ subroutine init_zbgc endif ! master_task 1000 format (a30,2x,f9.2) ! a30 to align formatted, unformatted statements - 1005 format (a30,2x,f9.6) ! float - 1010 format (a30,2x,l6) ! logical 1020 format (a30,2x,i6) ! integer - 1030 format (a30, a8) ! character end subroutine init_zbgc @@ -2290,7 +3003,6 @@ end subroutine init_zbgc subroutine init_bgc_trcr(nk, nt_fbri, & nt_bgc, nlt_bgc, & bgctype, nt_depend, & - ntrcr, nbtrcr, & bgc_tracer_type, trcr_depend, & trcr_base, n_trcr_strata, & nt_strata, bio_index) @@ -2298,13 +3010,9 @@ subroutine init_bgc_trcr(nk, nt_fbri, & integer (kind=int_kind), intent(in) :: & nk , & ! counter nt_depend , & ! tracer dependency index - nt_fbri - - integer (kind=int_kind), intent(inout) :: & - ntrcr , & ! number of tracers - nbtrcr , & ! number of bio tracers nt_bgc , & ! tracer index - nlt_bgc ! bio tracer index + nlt_bgc , & ! bio tracer index + nt_fbri integer (kind=int_kind), dimension(:), intent(inout) :: & trcr_depend , & ! tracer dependencies @@ -2341,15 +3049,10 @@ subroutine init_bgc_trcr(nk, nt_fbri, & !-------- - nt_bgc = ntrcr + 1 - nbtrcr = nbtrcr + 1 - nlt_bgc = nbtrcr - bgc_tracer_type(nbtrcr) = bgctype + bgc_tracer_type(nlt_bgc) = bgctype - if (nk > 1) then - ! include vertical bgc in snow + if (nk > 1) then ! include vertical bgc in snow do k = nk, nk+1 - ntrcr = ntrcr + 1 trcr_depend (nt_bgc + k ) = 2 ! snow volume trcr_base (nt_bgc + k,1) = c0 trcr_base (nt_bgc + k,2) = c0 @@ -2374,8 +3077,7 @@ subroutine init_bgc_trcr(nk, nt_fbri, & nt_strata2 = 0 endif ! nk - do k = 1, nk !in ice - ntrcr = ntrcr + 1 + do k = 1, nk ! in ice trcr_depend (nt_bgc + k - 1 ) = nt_depend trcr_base (nt_bgc + k - 1,1) = trcr_base1 trcr_base (nt_bgc + k - 1,2) = trcr_base2 @@ -2394,4 +3096,3 @@ end subroutine init_bgc_trcr end module ice_init_column !======================================================================= - diff --git a/configuration/scripts/ice_in b/configuration/scripts/ice_in index ec43c1039..79770f8c4 100644 --- a/configuration/scripts/ice_in +++ b/configuration/scripts/ice_in @@ -70,15 +70,6 @@ n_don = 0 n_fed = 0 n_fep = 0 - n_trbgcz = 0 - n_trzs = 0 - n_trbri = 0 - n_trzaero = 0 - n_trage = 1 - n_trfy = 1 - n_trlvl = 1 - n_trpnd = 1 - n_trbgcs = 0 tr_iage = .true. restart_age = .false. tr_FY = .true. diff --git a/configuration/scripts/options/set_nml.alt01 b/configuration/scripts/options/set_nml.alt01 index a447dfaa7..8b66913c6 100644 --- a/configuration/scripts/options/set_nml.alt01 +++ b/configuration/scripts/options/set_nml.alt01 @@ -19,9 +19,7 @@ basalstress = .true. use_bathymetry = .true. shortwave = 'ccsm3' albedo_type = 'constant' -formdrag = .true. calc_Tsfc = .true. atm_data_type = 'default' highfreq = .true. -fbot_xfer_type = 'Cdn_ocn' tfrz_option = 'minus1p8' diff --git a/configuration/scripts/options/set_nml.alt04 b/configuration/scripts/options/set_nml.alt04 index f14b4e3f5..0d50176fa 100644 --- a/configuration/scripts/options/set_nml.alt04 +++ b/configuration/scripts/options/set_nml.alt04 @@ -15,6 +15,9 @@ kitd = 0 ktherm = 1 conduct = 'MU71' kdyn = 1 +fbot_xfer_type = 'Cdn_ocn' +shortwave = 'dEdd' +formdrag = .true. #advection = 'upwind' # tc-leads to science failure kstrength = 0 krdg_partic = 0 diff --git a/configuration/scripts/options/set_nml.bgcskl b/configuration/scripts/options/set_nml.bgcskl index 7b6f07135..ec9d955a7 100644 --- a/configuration/scripts/options/set_nml.bgcskl +++ b/configuration/scripts/options/set_nml.bgcskl @@ -2,15 +2,6 @@ nilyr = 7 nslyr = 1 ncat = 5 nblyr = 1 -n_trage = 1 -n_trfy = 1 -n_trlvl = 1 -n_trpnd = 1 -n_trbri = 1 -n_trzs = 0 -n_trbgcs = 1 -n_trbgcz = 0 -n_trzaero = 0 n_aero = 0 n_zaero = 0 n_algae = 3 diff --git a/configuration/scripts/options/set_nml.bgcsklclim b/configuration/scripts/options/set_nml.bgcsklclim index 412e1f798..d4269fe86 100644 --- a/configuration/scripts/options/set_nml.bgcsklclim +++ b/configuration/scripts/options/set_nml.bgcsklclim @@ -2,15 +2,6 @@ nilyr = 7 nslyr = 1 ncat = 5 nblyr = 1 -n_trage = 1 -n_trfy = 1 -n_trlvl = 1 -n_trpnd = 1 -n_trbri = 1 -n_trzs = 0 -n_trbgcs = 1 -n_trbgcz = 0 -n_trzaero = 0 n_aero = 0 n_zaero = 0 n_algae = 3 diff --git a/configuration/scripts/options/set_nml.bgcz b/configuration/scripts/options/set_nml.bgcz index 321e87124..e8668e7a9 100644 --- a/configuration/scripts/options/set_nml.bgcz +++ b/configuration/scripts/options/set_nml.bgcz @@ -2,15 +2,6 @@ nilyr = 7 nslyr = 1 ncat = 5 nblyr = 7 -n_trage = 1 -n_trfy = 1 -n_trlvl = 1 -n_trpnd = 1 -n_trbri = 1 -n_trzs = 0 -n_trbgcs = 0 -n_trbgcz = 1 -n_trzaero = 1 n_aero = 0 n_zaero = 3 n_algae = 3 diff --git a/configuration/scripts/options/set_nml.bgczclim b/configuration/scripts/options/set_nml.bgczclim index 17967d275..99e68b35e 100644 --- a/configuration/scripts/options/set_nml.bgczclim +++ b/configuration/scripts/options/set_nml.bgczclim @@ -2,15 +2,6 @@ nilyr = 7 nslyr = 1 ncat = 5 nblyr = 7 -n_trage = 1 -n_trfy = 1 -n_trlvl = 1 -n_trpnd = 1 -n_trbri = 1 -n_trzs = 0 -n_trbgcs = 0 -n_trbgcz = 1 -n_trzaero = 1 n_aero = 0 n_zaero = 3 n_algae = 3 diff --git a/configuration/scripts/tests/base_suite.ts b/configuration/scripts/tests/base_suite.ts index 6426ae928..2dde5a4cc 100644 --- a/configuration/scripts/tests/base_suite.ts +++ b/configuration/scripts/tests/base_suite.ts @@ -17,10 +17,18 @@ restart gx3 8x2 alt02 restart gx3 4x2 alt03 restart gx3 4x4 alt04 restart gx3 4x4 alt05 +restart gx3 6x2 alt01,debug,short +restart gx3 8x2 alt02,debug,short +restart gx3 4x2 alt03,debug,short +smoke gx3 4x4 alt04,debug,short +smoke gx3 4x4 alt05,debug,short restart gbox128 4x2 none restart gbox128 4x2 boxdyn +restart gbox128 4x2 boxdyn,debug restart gbox128 2x2 boxadv,short +smoke gbox128 2x2 boxadv,short,debug restart gbox128 4x4 boxrestore +smoke gbox128 4x4 boxrestore,debug restart gbox80 1x1 box2001 smoke gx3 8x2 bgcz smoke gx3 8x2 bgcz,debug diff --git a/icepack b/icepack index 0b4ee4e33..5d22a61ad 160000 --- a/icepack +++ b/icepack @@ -1 +1 @@ -Subproject commit 0b4ee4e33feb97bdf49503a3c1d34bfdf3046d71 +Subproject commit 5d22a61ada14c8d0ec9c50c615df80b4a036ad53