diff --git a/cicecore/cicedynB/analysis/ice_history_fsd.F90 b/cicecore/cicedynB/analysis/ice_history_fsd.F90 index b44869445..43afc1e27 100644 --- a/cicecore/cicedynB/analysis/ice_history_fsd.F90 +++ b/cicecore/cicedynB/analysis/ice_history_fsd.F90 @@ -116,24 +116,6 @@ subroutine init_hist_fsd_2D call abort_ice(subname//'ERROR: reading icefields_fsd_nml') endif - if (.not. tr_fsd) then - f_afsd = 'x' - f_afsdn = 'x' - f_dafsd_newi = 'x' - f_dafsd_latg = 'x' - f_dafsd_latm = 'x' - f_dafsd_wave = 'x' - f_dafsd_weld = 'x' - f_wave_sig_ht = 'x' - f_fsdrad = 'x' - f_fsdperim = 'x' - endif - if ((.not. tr_fsd) .or. (.not. wave_spec)) then - f_aice_ww = 'x' - f_diam_ww = 'x' - f_hice_ww = 'x' - endif - call broadcast_scalar (f_afsd, master_task) call broadcast_scalar (f_afsdn, master_task) call broadcast_scalar (f_dafsd_newi, master_task) @@ -184,6 +166,24 @@ subroutine init_hist_fsd_2D enddo ! nstreams + else ! tr_fsd + + f_afsd = 'x' + f_afsdn = 'x' + f_dafsd_newi = 'x' + f_dafsd_latg = 'x' + f_dafsd_latm = 'x' + f_dafsd_wave = 'x' + f_dafsd_weld = 'x' + f_wave_sig_ht = 'x' + f_fsdrad = 'x' + f_fsdperim = 'x' + if (.not. wave_spec) then + f_aice_ww = 'x' + f_diam_ww = 'x' + f_hice_ww = 'x' + endif + endif ! tr_fsd end subroutine init_hist_fsd_2D diff --git a/cicecore/cicedynB/dynamics/ice_dyn_evp.F90 b/cicecore/cicedynB/dynamics/ice_dyn_evp.F90 index b9c797a9f..e47a9eab2 100644 --- a/cicecore/cicedynB/dynamics/ice_dyn_evp.F90 +++ b/cicecore/cicedynB/dynamics/ice_dyn_evp.F90 @@ -143,6 +143,8 @@ subroutine evp (dt) type (block) :: & this_block ! block information for current block + + logical (kind=log_kind), save :: first_time = .true. character(len=*), parameter :: subname = '(evp)' @@ -349,7 +351,10 @@ subroutine evp (dt) endif call ice_timer_start(timer_evp_2d) if (kevp_kernel > 0) then -! if (my_task == 0) write(nu_diag,*) subname,' Entering kevp_kernel version ',kevp_kernel + if (first_time .and. my_task == 0) then + write(nu_diag,'(2a,i6)') subname,' Entering kevp_kernel version ',kevp_kernel + first_time = .false. + endif if (trim(grid_type) == 'tripole') then call abort_ice(trim(subname)//' & & Kernel not tested on tripole grid. Set kevp_kernel=0') diff --git a/cicecore/cicedynB/dynamics/ice_transport_driver.F90 b/cicecore/cicedynB/dynamics/ice_transport_driver.F90 index 988640332..037e40e04 100644 --- a/cicecore/cicedynB/dynamics/ice_transport_driver.F90 +++ b/cicecore/cicedynB/dynamics/ice_transport_driver.F90 @@ -51,6 +51,9 @@ module ice_transport_driver logical (kind=log_kind), dimension (:), allocatable, public :: & has_dependents ! true if a tracer has dependent tracers + logical (kind=log_kind), public :: & + conserv_check ! if true, check conservation + integer (kind=int_kind), parameter :: & integral_order = 3 ! polynomial order of quadrature integrals ! linear=1, quadratic=2, cubic=3 @@ -290,7 +293,6 @@ subroutine transport_remap (dt) ! variables related to optional bug checks logical (kind=log_kind), parameter :: & - l_conservation_check = .false. ,&! if true, check conservation l_monotonicity_check = .false. ! if true, check monotonicity real (kind=dbl_kind), dimension(0:ncat) :: & @@ -310,6 +312,8 @@ subroutine transport_remap (dt) real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks) :: & work1 + character(len=char_len_long) :: fieldid + character(len=*), parameter :: subname = '(transport_remap)' call ice_timer_start(timer_advect) ! advection @@ -398,7 +402,7 @@ subroutine transport_remap (dt) !---! Optional conservation and monotonicity checks. !---!------------------------------------------------------------------- - if (l_conservation_check) then + if (conserv_check) then !------------------------------------------------------------------- ! Compute initial values of globally conserved quantities. @@ -436,7 +440,7 @@ subroutine transport_remap (dt) enddo ! nt enddo ! n - endif ! l_conservation_check + endif ! conserv_check if (l_monotonicity_check) then @@ -565,7 +569,7 @@ subroutine transport_remap (dt) ! Check global conservation of area and area*tracers. (Optional) !------------------------------------------------------------------- - if (l_conservation_check) then + if (conserv_check) then do n = 0, ncat asum_final(n) = global_sum(aim(:,:,n,:), distrb_info, & @@ -600,7 +604,8 @@ subroutine transport_remap (dt) enddo ! n if (my_task == master_task) then - call global_conservation (l_stop, & + fieldid = subname//':000' + call global_conservation (l_stop, fieldid, & asum_init(0), asum_final(0)) if (l_stop) then @@ -610,9 +615,10 @@ subroutine transport_remap (dt) call abort_ice(subname//'ERROR: conservation error1') endif - do n = 1, ncat + do n = 1, ncat + write(fieldid,'(a,i3.3)') subname,n call global_conservation & - (l_stop, & + (l_stop, fieldid, & asum_init(n), asum_final(n), & atsum_init(:,n), atsum_final(:,n)) @@ -626,7 +632,7 @@ subroutine transport_remap (dt) endif ! my_task = master_task - endif ! l_conservation_check + endif ! conserv_check !------------------------------------------------------------------- ! Check tracer monotonicity. (Optional) @@ -1077,10 +1083,13 @@ end subroutine tracers_to_state ! ! author William H. Lipscomb, LANL - subroutine global_conservation (l_stop, & + subroutine global_conservation (l_stop, fieldid, & asum_init, asum_final, & atsum_init, atsum_final) + character(len=*), intent(in) :: & + fieldid ! field information string + real (kind=dbl_kind), intent(in) :: & asum_init ,&! initial global ice area asum_final ! final global ice area @@ -1113,11 +1122,11 @@ subroutine global_conservation (l_stop, & if (abs(diff/asum_init) > puny) then l_stop = .true. write (nu_diag,*) - write (nu_diag,*) 'Ice area conserv error' - write (nu_diag,*) 'Initial global area =', asum_init - write (nu_diag,*) 'Final global area =', asum_final - write (nu_diag,*) 'Fractional error =', abs(diff)/asum_init - write (nu_diag,*) 'asum_final-asum_init =', diff + write (nu_diag,*) subname,'Ice area conserv error ', trim(fieldid) + write (nu_diag,*) subname,' Initial global area =', asum_init + write (nu_diag,*) subname,' Final global area =', asum_final + write (nu_diag,*) subname,' Fractional error =', abs(diff)/asum_init + write (nu_diag,*) subname,' asum_final-asum_init =', diff endif endif @@ -1128,15 +1137,12 @@ subroutine global_conservation (l_stop, & if (abs(diff/atsum_init(nt)) > puny) then l_stop = .true. write (nu_diag,*) - write (nu_diag,*) 'area*tracer conserv error' - write (nu_diag,*) 'tracer index =', nt - write (nu_diag,*) 'Initial global area*tracer =', & - atsum_init(nt) - write (nu_diag,*) 'Final global area*tracer =', & - atsum_final(nt) - write (nu_diag,*) 'Fractional error =', & - abs(diff)/atsum_init(nt) - write (nu_diag,*) 'atsum_final-atsum_init =', diff + write (nu_diag,*) subname,'Ice area*tracer conserv error ', trim(fieldid),nt + write (nu_diag,*) subname,' Tracer index =', nt + write (nu_diag,*) subname,' Initial global area*tracer =', atsum_init(nt) + write (nu_diag,*) subname,' Final global area*tracer =', atsum_final(nt) + write (nu_diag,*) subname,' Fractional error =', abs(diff)/atsum_init(nt) + write (nu_diag,*) subname,' atsum_final-atsum_init =', diff endif endif enddo diff --git a/cicecore/cicedynB/general/ice_init.F90 b/cicecore/cicedynB/general/ice_init.F90 index 3cd7e4746..fac0b517b 100644 --- a/cicecore/cicedynB/general/ice_init.F90 +++ b/cicecore/cicedynB/general/ice_init.F90 @@ -99,7 +99,7 @@ subroutine input_data basalstress, k1, k2, alphab, threshold_hw, & Ktens, e_ratio, coriolis, & kridge, ktransport, brlx, arlx - use ice_transport_driver, only: advection + use ice_transport_driver, only: advection, conserv_check use ice_restoring, only: restore_ice #ifdef CESMCOUPLED use shr_file_mod, only: shr_file_setIO @@ -154,6 +154,7 @@ subroutine input_data print_global, print_points, latpnt, lonpnt, & dbug, histfreq, histfreq_n, hist_avg, & history_dir, history_file, history_precision, cpl_bgc, & + conserv_check, & write_ic, incond_dir, incond_file, version_name namelist /grid_nml/ & @@ -309,6 +310,7 @@ subroutine input_data 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 + conserv_check = .false.! tracer conservation check 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 @@ -591,6 +593,7 @@ subroutine input_data call broadcast_scalar(Ktens, master_task) call broadcast_scalar(e_ratio, master_task) call broadcast_scalar(advection, master_task) + call broadcast_scalar(conserv_check, master_task) call broadcast_scalar(shortwave, master_task) call broadcast_scalar(albedo_type, master_task) call broadcast_scalar(ktherm, master_task) @@ -1098,6 +1101,7 @@ subroutine input_data write(nu_diag,1030) ' shortwave = ', & trim(shortwave) write(nu_diag,1000) ' ksno = ', ksno + write(nu_diag,1010) ' conserv_check = ', conserv_check if (cpl_bgc) then write(nu_diag,1000) ' BGC coupling is switched ON' else @@ -1311,7 +1315,7 @@ subroutine input_data 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, & + phi_c_slow_mode_in=phi_c_slow_mode, phi_i_mushy_in=phi_i_mushy, conserv_check_in=conserv_check, & wave_spec_type_in = wave_spec_type, & wave_spec_in=wave_spec, nfreq_in=nfreq, & tfrz_option_in=tfrz_option, kalg_in=kalg, fbot_xfer_type_in=fbot_xfer_type) diff --git a/cicecore/cicedynB/infrastructure/ice_domain.F90 b/cicecore/cicedynB/infrastructure/ice_domain.F90 index 3be2449f7..3916039b5 100644 --- a/cicecore/cicedynB/infrastructure/ice_domain.F90 +++ b/cicecore/cicedynB/infrastructure/ice_domain.F90 @@ -342,6 +342,7 @@ subroutine init_domain_distribution(KMTG,ULATG) file=__FILE__, line=__LINE__) if (trim(ns_boundary_type) == 'closed') then + call abort_ice(subname//'ERROR: ns_boundary_type = closed not supported') allocate(nocn(nblocks_tot)) nocn = 0 do n=1,nblocks_tot @@ -373,13 +374,14 @@ subroutine init_domain_distribution(KMTG,ULATG) enddo endif if (nocn(n) > 0) then - print*, 'ice: Not enough land cells along ns edge' - call abort_ice(subname//'ERROR: Not enough land cells along ns edge') + write(nu_diag,*) subname,'ns closed, Not enough land cells along ns edge' + call abort_ice(subname//'ERROR: Not enough land cells along ns edge for ns closed') endif enddo deallocate(nocn) endif if (trim(ew_boundary_type) == 'closed') then + call abort_ice(subname//'ERROR: ew_boundary_type = closed not supported') allocate(nocn(nblocks_tot)) nocn = 0 do n=1,nblocks_tot @@ -411,8 +413,8 @@ subroutine init_domain_distribution(KMTG,ULATG) enddo endif if (nocn(n) > 0) then - print*, 'ice: Not enough land cells along ew edge' - call abort_ice(subname//'ERROR: Not enough land cells along ew edge') + write(nu_diag,*) subname,'ew closed, Not enough land cells along ew edge' + call abort_ice(subname//'ERROR: Not enough land cells along ew edge for ew closed') endif enddo deallocate(nocn) diff --git a/cicecore/drivers/mct/cesm1/ice_import_export.F90 b/cicecore/drivers/mct/cesm1/ice_import_export.F90 index 82780ccd3..d42d3f8a1 100644 --- a/cicecore/drivers/mct/cesm1/ice_import_export.F90 +++ b/cicecore/drivers/mct/cesm1/ice_import_export.F90 @@ -72,7 +72,6 @@ subroutine ice_import( x2i ) logical (kind=log_kind) :: tr_aero, tr_iage, tr_FY, tr_pond logical (kind=log_kind) :: tr_lvl, tr_zaero, tr_bgc_Nit real (kind=dbl_kind) :: tffresh - logical (kind=log_kind) :: first_call = .true. character(len=*), parameter :: subname = '(ice_import)' !----------------------------------------------------- diff --git a/configuration/scripts/cice.run.setup.csh b/configuration/scripts/cice.run.setup.csh index 5611ed618..2134d345c 100755 --- a/configuration/scripts/cice.run.setup.csh +++ b/configuration/scripts/cice.run.setup.csh @@ -46,6 +46,8 @@ cd \${ICE_RUNDIR} setenv OMP_NUM_THREADS ${nthrds} cp -f \${ICE_CASEDIR}/ice_in \${ICE_RUNDIR} +cp -f \${ICE_CASEDIR}/env.${ICE_MACHCOMP} \${ICE_RUNDIR} +cp -f \${ICE_CASEDIR}/cice.settings \${ICE_RUNDIR} set diagtype = \`grep -i diag_type \${ICE_CASEDIR}/ice_in | grep -i stdout | wc -l\` set diagfile = \`grep -i diag_file \${ICE_CASEDIR}/ice_in | sed -e "s/.* = '\(.*\)'/\1/"\` diff --git a/configuration/scripts/ice_in b/configuration/scripts/ice_in index 6c8fe2f36..ec984397a 100644 --- a/configuration/scripts/ice_in +++ b/configuration/scripts/ice_in @@ -27,6 +27,7 @@ diag_file = 'ice_diag.d' print_global = .true. print_points = .true. + conserv_check = .false. latpnt(1) = 90. lonpnt(1) = 0. latpnt(2) = -65. diff --git a/configuration/scripts/options/set_nml.alt03 b/configuration/scripts/options/set_nml.alt03 index 6336388b1..43681ab9d 100644 --- a/configuration/scripts/options/set_nml.alt03 +++ b/configuration/scripts/options/set_nml.alt03 @@ -1,15 +1,20 @@ +ncat = 6 kcatbound = 2 ice_ic = 'default' restart = .false. distribution_type = 'sectcart' +conserv_check = .true. tr_iage = .false. tr_FY = .false. tr_lvl = .false. tr_pond_cesm = .false. tr_pond_topo = .true. tr_pond_lvl = .false. -tr_aero = .false. +tr_aero = .true. +calc_Tsfc = .false. kdyn = 2 +ktherm = 1 +tfrz_option = 'linear_salt' revised_evp = .false. Ktens = 0. e_ratio = 2. diff --git a/configuration/scripts/options/set_nml.alt04 b/configuration/scripts/options/set_nml.alt04 index 67045b16c..786decae6 100644 --- a/configuration/scripts/options/set_nml.alt04 +++ b/configuration/scripts/options/set_nml.alt04 @@ -10,11 +10,12 @@ tr_lvl = .true. tr_pond_cesm = .false. tr_pond_topo = .false. tr_pond_lvl = .true. -tr_aero = .false. +tr_aero = .true. kitd = 0 ktherm = 1 conduct = 'MU71' kdyn = 1 +kevp_kernel = 102 fbot_xfer_type = 'Cdn_ocn' shortwave = 'dEdd' formdrag = .true. diff --git a/doc/source/cice_index.rst b/doc/source/cice_index.rst index dd4926e16..b78ac356d 100644 --- a/doc/source/cice_index.rst +++ b/doc/source/cice_index.rst @@ -106,6 +106,7 @@ either Celsius or Kelvin units). "coldsnow", "value for constant albedo parameterization", "0.81" "conduct", ":math:`\bullet` conductivity parameterization", "" "congel", "basal ice growth", "m" + "conserv_check", "if true, check conservation", "" "cosw", "cosine of the turning angle in water", "1." "coszen", "cosine of the zenith angle", "" "Cp", "proportionality constant for potential energy", "kg/m\ :math:`^2`/s\ :math:`^2`" @@ -342,7 +343,6 @@ either Celsius or Kelvin units). "ktherm", ":math:`\bullet` thermodynamic formulation (0 = zero-layer, 1 = :cite:`Bitz99`, 2 = mushy)", "" "**L**", "", "" "l_brine", "flag for brine pocket effects", "" - "l_conservation_check", "if true, check conservation when ridging", "" "l_fixed_area", "flag for prescribing remapping fluxes", "" "l_mpond_fresh", ":math:`\bullet` if true, retain (topo) pond water until ponds drain", "" "latpnt", ":math:`\bullet` desired latitude of diagnostic points", "degrees N" diff --git a/doc/source/user_guide/ug_case_settings.rst b/doc/source/user_guide/ug_case_settings.rst index 8e5ff5b6f..fe93cca4c 100644 --- a/doc/source/user_guide/ug_case_settings.rst +++ b/doc/source/user_guide/ug_case_settings.rst @@ -69,7 +69,7 @@ to support the CICE model. "ICE_QUEUE", "string", "batch queue name", "set by cice.setup or by default" "ICE_THREADED", "true, false", "force threading in compile, will always compile threaded if ICE_NTHRDS :math:`> 1`", "false" "ICE_BLDDEBUG", "true, false", "turn on compile debug flags", "false" - + "ICE_CODECOV", "true,false", "turn on code coverage flags", "false" .. _tabnamelist: @@ -124,6 +124,7 @@ Table of namelist options "\*","``diag_type``", "``stdout``", "write diagnostic output to stdout", "" "","", "``file``", "write diagnostic output to file", "" "","``diag_file``", "filename", "diagnostic output file (script may reset)", "" + "","``conserv_check``", "true/false", "check conservation", "``.false.``" "","``print_global``", "true/false", "print diagnostic data, global sums", "``.false.``" "","``print_points``", "true/false", "print diagnostic data for two grid points", "``.false.``" "","``latpnt``", "real", "latitude of (2) diagnostic points", "" diff --git a/doc/source/user_guide/ug_running.rst b/doc/source/user_guide/ug_running.rst index 7cb094b97..b4fa7bcd7 100644 --- a/doc/source/user_guide/ug_running.rst +++ b/doc/source/user_guide/ug_running.rst @@ -142,9 +142,13 @@ You can also submit the **cice.run** script on the command line. Some hints: -- To change the block sizes required at build time, edit the **cice.settings** file. - To change namelist, manually edit the **ice_in** file - To change batch settings, manually edit the top of the **cice.run** or **cice.test** (if running a test) file +- When the run scripts are submitted, the current **ice_in**, **cice.settings**, and **env.[machine]** files are copied from the case directory into the run directory. Users should generally not edit files in the run directory as these are overwritten when following the standard workflow. **cice.settings** can be sourced to establish the case values in the login shell. An alias like the following can be established to quickly switch between case and run directories:: + + alias cdrun 'cd `\grep "setenv ICE_RUNDIR" cice.settings | awk "{print "\$"NF}"`' + alias cdcase 'cd `\grep "setenv ICE_CASEDIR" cice.settings | awk "{print "\$"NF}"`' + - To turn on the debug compiler flags, set ``ICE_BLDDEBUG`` in **cice.setttings** to true. It is also possible to use the ``debug`` option (``-s debug``) when creating the case with **cice.setup** to set this option automatically. - To change compiler options, manually edit the Macros file. To add user defined preprocessor macros, modify ``ICE_CPPDEFS`` in **cice.settings** using the syntax ``-DCICE_MACRO``. - To clean the build before each compile, set ``ICE_CLEANBUILD`` in **cice.settings** to true (this is the default value), or use the ``buildclean`` option (``-s buildclean``) when creating the case with **cice.setup**. To not clean before the build, set ``ICE_CLEANBUILD`` in **cice.settings** to false, or use the ``buildincremental`` option (``-s buildincremental``) when creating the case with **cice.setup**. It is recommended that the ``ICE_CLEANBUILD`` be set to true if there are any questions about whether the build is proceeding properly. @@ -268,7 +272,8 @@ To add some optional settings, one might do:: cice.setup --case mycase2 --mach spirit --env intel --set debug,diag1,run1year -Once the cases are created, users are free to modify the cice.settings and ice_in namelist to further modify their setup. +Once the cases are created, users are free to modify the **cice.settings** and +**ice_in** namelist to further modify their setup. .. _cicebuild: @@ -779,7 +784,11 @@ Run Directories The **cice.setup** script creates a case directory. However, the model is actually built and run under the ``ICE_OBJDIR`` and ``ICE_RUNDIR`` directories -as defined in the **cice.settings** file. +as defined in the **cice.settings** file. It's important to note that when the +run scripts are submitted, the current **ice_in**, **cice.settings**, and **env.[machine]** +files are copied from the case directory into the run directory. Users should +generally not edit files in the run directory as these are overwritten when following +the standard workflow. Build and run logs will be copied from the run directory into the case **logs/** directory when complete. diff --git a/doc/source/user_guide/ug_troubleshooting.rst b/doc/source/user_guide/ug_troubleshooting.rst index e34d1261b..9e6f39941 100644 --- a/doc/source/user_guide/ug_troubleshooting.rst +++ b/doc/source/user_guide/ug_troubleshooting.rst @@ -145,6 +145,9 @@ conflicts in module dependencies. are set in **ice\_diagnostics.F90**. This option can be fairly slow, due to gathering data from processors. +`conserv\_check` = true (**ice\_in**) + Diagnoses conservation in various algorithms. + *global\_minval, global\_maxval, global\_sum* (**ice\_global\_reductions.F90**) Compute and print the minimum and maximum values for an individual real array, or its global sum. diff --git a/icepack b/icepack index 1ae044604..09a5e19f0 160000 --- a/icepack +++ b/icepack @@ -1 +1 @@ -Subproject commit 1ae044604498b8d268df6c577556d22d2baa7758 +Subproject commit 09a5e19f006f62f60f6b940a4385feb47451368e