From c9cfebd7d009d58d081d4d8dead68b27ecdfa8e4 Mon Sep 17 00:00:00 2001 From: Philippe Blain Date: Fri, 26 Jun 2020 20:51:22 -0400 Subject: [PATCH 1/4] add Pstar and Cstar to namelist (#475) Also, add a new format to ice_init for numbers in exponential notation. See CICE-Consortium/CICE#472 --- cicecore/cicedynB/general/ice_init.F90 | 17 ++++++++++++----- configuration/scripts/ice_in | 2 ++ doc/source/user_guide/ug_case_settings.rst | 2 ++ 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/cicecore/cicedynB/general/ice_init.F90 b/cicecore/cicedynB/general/ice_init.F90 index 35392bc60..5f0b97969 100644 --- a/cicecore/cicedynB/general/ice_init.F90 +++ b/cicecore/cicedynB/general/ice_init.F90 @@ -117,7 +117,7 @@ subroutine input_data 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, atmiter_conv + phi_c_slow_mode, phi_i_mushy, kalg, atmiter_conv, Pstar, Cstar integer (kind=int_kind) :: ktherm, kstrength, krdg_partic, krdg_redist, natmiter, & kitd, kcatbound @@ -190,7 +190,8 @@ subroutine input_data advection, coriolis, kridge, ktransport, & kstrength, krdg_partic, krdg_redist, mu_rdg, & e_ratio, Ktens, Cf, basalstress, & - k1, k2, alphab, threshold_hw + k1, k2, alphab, threshold_hw, & + Pstar, Cstar namelist /shortwave_nml/ & shortwave, albedo_type, & @@ -298,6 +299,8 @@ subroutine input_data revised_evp = .false. ! if true, use revised procedure for evp dynamics yield_curve = 'ellipse' kstrength = 1 ! 1 = Rothrock 75 strength, 0 = Hibler 79 + Pstar = 2.75e4_dbl_kind ! constant in Hibler strength formula (kstrength = 0) + Cstar = 20._dbl_kind ! constant in Hibler strength formula (kstrength = 0) 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) @@ -586,6 +589,8 @@ subroutine input_data call broadcast_scalar(revised_evp, master_task) call broadcast_scalar(yield_curve, master_task) call broadcast_scalar(kstrength, master_task) + call broadcast_scalar(Pstar, master_task) + call broadcast_scalar(Cstar, master_task) call broadcast_scalar(krdg_partic, master_task) call broadcast_scalar(krdg_redist, master_task) call broadcast_scalar(mu_rdg, master_task) @@ -1207,8 +1212,8 @@ subroutine input_data endif write(nu_diag,1022) ' kstrength = ', kstrength,trim(tmpstr2) if (kstrength == 0) then - ! write(nu_diag,1007) ' Pstar = ', Pstar, ' P* strength factor' - ! write(nu_diag,1007) ' Cstar = ', Cstar, ' C* strength exponent factor' + write(nu_diag,1009) ' Pstar = ', Pstar, ' P* strength factor' + write(nu_diag,1007) ' Cstar = ', Cstar, ' C* strength exponent factor' elseif (kstrength == 1) then write(nu_diag,1007) ' Cf = ', Cf, ' ratio of ridging work to PE change' endif @@ -1620,7 +1625,8 @@ subroutine input_data 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) + tfrz_option_in=tfrz_option, kalg_in=kalg, fbot_xfer_type_in=fbot_xfer_type, & + Pstar_in=Pstar, Cstar_in=Cstar) call icepack_init_tracer_flags(tr_iage_in=tr_iage, tr_FY_in=tr_FY, & tr_lvl_in=tr_lvl, tr_iso_in=tr_iso, tr_aero_in=tr_aero, & tr_fsd_in=tr_fsd, tr_pond_in=tr_pond, & @@ -1638,6 +1644,7 @@ subroutine input_data 1005 format (a30,2x,f12.6) ! float 1006 format (a20,2x,f10.6,a) 1007 format (a20,2x,f6.2,a) + 1009 format (a20,2x,d13.6,a) ! float, exponential notation 1010 format (a30,2x,l6) ! logical 1012 format (a20,2x,l3,1x,a) ! logical 1020 format (a30,2x,i6) ! integer diff --git a/configuration/scripts/ice_in b/configuration/scripts/ice_in index 0618bc8c5..9d35b4366 100644 --- a/configuration/scripts/ice_in +++ b/configuration/scripts/ice_in @@ -120,6 +120,8 @@ krdg_partic = 1 krdg_redist = 1 mu_rdg = 3 + Pstar = 2.75e4 + Cstar = 20 Cf = 17. Ktens = 0. e_ratio = 2. diff --git a/doc/source/user_guide/ug_case_settings.rst b/doc/source/user_guide/ug_case_settings.rst index 25291c4cb..d4f66f797 100644 --- a/doc/source/user_guide/ug_case_settings.rst +++ b/doc/source/user_guide/ug_case_settings.rst @@ -314,6 +314,7 @@ dynamics_nml "``basalstress``", "logical", "use basal stress parameterization for landfast ice", "``.false.``" "``Cf``", "real", "ratio of ridging work to PE change in ridging", "17.0" "``coriolis``", "``constant``", "constant coriolis value = 1.46e-4", "``latitude``" + "``Cstar``", "real", "constant in Hibler strength formula", "20" "", "``latitude``", "coriolis variable by latitude", "" "", "``zero``", "zero coriolis", "" "``e_ratio``", "real", "EVP ellipse aspect ratio", "2.0" @@ -338,6 +339,7 @@ dynamics_nml "``k2``", "real", "2nd free parameter (N/m^3) for landfast parameterization", "15.0" "``mu_rdg``", "real", "e-folding scale of ridged ice for ``krdg_partic`` = 1 in m^0.5", "3.0" "``ndte``", "integer", "number of EVP subcycles", "120" + "``Pstar``", "real", "constant in Hibler strength formula (N/m)", "2.75e4" "``revised_evp``", "logical", "use revised EVP formulation", "``.false.``" "``threshold_hw``", "real", "Max water depth for grounding (see :cite:`Amundrud04`)", "30." "``yield_curve``", "``ellipse``", "elliptical yield curve", "``ellipse``" From c6c20bf86f6fba8038a1dab9ef6c892c2a05db13 Mon Sep 17 00:00:00 2001 From: Tony Craig Date: Mon, 29 Jun 2020 10:55:39 -0700 Subject: [PATCH 2/4] Update lcov and env documentation (#476) * update lcov and env documentation * update documentation --- cice.setup | 16 ++++++++--- .../scripts/machines/env.cheyenne_gnu | 20 +++++++++++++ configuration/scripts/machines/env.conrad_gnu | 20 +++++++++++++ .../scripts/{ => tests}/cice.codecov.csh | 0 .../scripts/{ => tests}/cice.lcov.csh | 3 +- .../scripts/{ => tests}/cice.results.csh | 0 doc/source/user_guide/ug_running.rst | 28 ++++++++++--------- 7 files changed, 69 insertions(+), 18 deletions(-) rename configuration/scripts/{ => tests}/cice.codecov.csh (100%) rename configuration/scripts/{ => tests}/cice.lcov.csh (89%) rename configuration/scripts/{ => tests}/cice.results.csh (100%) diff --git a/cice.setup b/cice.setup index 86fc782bb..43fdd836c 100755 --- a/cice.setup +++ b/cice.setup @@ -93,7 +93,7 @@ DESCRIPTION --setvers : updates cice version number in sandbox --case, -c : case, case directory/name (not with --test or --suite) --mach, -m : machine, machine name (required) - --env, -e : envname(s), comma separated (default = $envnames) + --env, -e : compilation environment name(s), comma separated (default = $envnames) --pes, -p : tasks x threads [x blocksize_x x blocksize_y [x maxblocks]] (default is ${pesx}) --acct : account number for the batch submission --grid, -g : grid, grid (default = ${grid}) @@ -112,7 +112,7 @@ DESCRIPTION --diff : generate comparison against another case --report : automatically post results when tests are complete --coverage : generate and report test coverage metrics when tests are complete, - requires GNU env (--env gnu*) + requires GNU compiler (ie. normally ``--env gnu``) --setup-only : for suite, setup testcases, no build, no submission --setup-build : for suite, setup and build testcases, no submission --setup-build-run : for suite, setup, build, and run interactively @@ -529,7 +529,6 @@ if !(\$?CODECOV_TOKEN) then endif #for lcov -setenv PERL5LIB ~/usr/lib/perl5/site_perl/5.18.2/x86_64-linux-thread-multi/ set lcovalist = "" EOF0 @@ -791,7 +790,7 @@ EOF end # from basic script dir to casescr - foreach file (parse_namelist.sh parse_settings.sh parse_namelist_from_env.sh cice_decomp.csh cice.run.setup.csh cice.test.setup.csh cice.results.csh cice.codecov.csh cice.lcov.csh) + foreach file (parse_namelist.sh parse_settings.sh parse_namelist_from_env.sh cice_decomp.csh cice.run.setup.csh cice.test.setup.csh) if !(-e ${ICE_SCRIPTS}/$file) then echo "${0}: ERROR, ${ICE_SCRIPTS}/$file not found" exit -1 @@ -799,6 +798,15 @@ EOF cp -f -p ${ICE_SCRIPTS}/$file ${casescr}/ end + # from tests dir to casescr + foreach file (cice.results.csh cice.codecov.csh cice.lcov.csh) + if !(-e ${ICE_SCRIPTS}/tests/$file) then + echo "${0}: ERROR, ${ICE_SCRIPTS}/$file not found" + exit -1 + endif + cp -f -p ${ICE_SCRIPTS}/tests/$file ${casescr}/ + end + cd ${casedir} set quietmode = false diff --git a/configuration/scripts/machines/env.cheyenne_gnu b/configuration/scripts/machines/env.cheyenne_gnu index 804ba743f..b17a15917 100755 --- a/configuration/scripts/machines/env.cheyenne_gnu +++ b/configuration/scripts/machines/env.cheyenne_gnu @@ -45,3 +45,23 @@ setenv ICE_MACHINE_QUEUE "regular" setenv ICE_MACHINE_TPNODE 36 setenv ICE_MACHINE_BLDTHRDS 1 setenv ICE_MACHINE_QSTAT "qstat " + +# For lcov +set lcovpath = "/glade/u/home/tcraig/bin" +set lcovp5l = "/glade/u/home/tcraig/usr/lib/perl5/site_perl/5.18.2/x86_64-linux-thread-multi" + +if ($?PATH) then + if ("$PATH" !~ "*${lcovpath}*") then + setenv PATH ${PATH}:$lcovpath + endif +else + setenv PATH $lcovpath +endif + +if ($?PERL5LIB) then + if ("$PERL5LIB" !~ "*${lcovp5l}*") then + setenv PERL5LIB ${PERL5LIB}:$lcovp5l + endif +else + setenv PERL5LIB $lcovp5l +endif diff --git a/configuration/scripts/machines/env.conrad_gnu b/configuration/scripts/machines/env.conrad_gnu index dd7f36a76..f14ee33a5 100755 --- a/configuration/scripts/machines/env.conrad_gnu +++ b/configuration/scripts/machines/env.conrad_gnu @@ -55,3 +55,23 @@ setenv ICE_MACHINE_QUEUE "debug" setenv ICE_MACHINE_TPNODE 32 # tasks per node setenv ICE_MACHINE_BLDTHRDS 4 setenv ICE_MACHINE_QSTAT "qstat " + +# For lcov +set lcovpath = "/p/home/apcraig/bin" +set lcovp5l = "/p/home/apcraig/usr/lib/perl5/site_perl/5.10.0/x86_64-linux-thread-multi" + +if ($?PATH) then + if ("$PATH" !~ "*${lcovpath}*") then + setenv PATH ${PATH}:$lcovpath + endif +else + setenv PATH $lcovpath +endif + +if ($?PERL5LIB) then + if ("$PERL5LIB" !~ "*${lcovp5l}*") then + setenv PERL5LIB ${PERL5LIB}:$lcovp5l + endif +else + setenv PERL5LIB $lcovp5l +endif diff --git a/configuration/scripts/cice.codecov.csh b/configuration/scripts/tests/cice.codecov.csh similarity index 100% rename from configuration/scripts/cice.codecov.csh rename to configuration/scripts/tests/cice.codecov.csh diff --git a/configuration/scripts/cice.lcov.csh b/configuration/scripts/tests/cice.lcov.csh similarity index 89% rename from configuration/scripts/cice.lcov.csh rename to configuration/scripts/tests/cice.lcov.csh index 0274e0eac..8107778d9 100644 --- a/configuration/scripts/cice.lcov.csh +++ b/configuration/scripts/tests/cice.lcov.csh @@ -8,12 +8,13 @@ set lcovrepo = apcraig.github.io set lcovhtmldir = lcov_cice_${report_name} genhtml -o ./${lcovhtmldir} --precision 2 -t "${report_name}" total.info +rm -r -f ${lcovrepo} git clone https://github.com/apcraig/${lcovrepo} cp -p -r ${lcovhtmldir} ${lcovrepo}/ cd ${lcovrepo} set covp0 = `grep message coverage.json | cut -d : -f 2 | cut -d \" -f 2 | cut -d % -f 1` -set covp = `grep -i headerCovTableEntryLo ${lcovhtmldir}/index.html | head -1 | cut -d \> -f 2 | cut -d % -f 1` +set covp = `grep -i headerCovTableEntry ${lcovhtmldir}/index.html | grep % | head -1 | cut -d \> -f 2 | cut -d % -f 1` set covpi = `echo $covp | cut -d . -f 1` set lcovhtmlname = "${covpi}%:${report_name}" diff --git a/configuration/scripts/cice.results.csh b/configuration/scripts/tests/cice.results.csh similarity index 100% rename from configuration/scripts/cice.results.csh rename to configuration/scripts/tests/cice.results.csh diff --git a/doc/source/user_guide/ug_running.rst b/doc/source/user_guide/ug_running.rst index 4d9133cc0..8befee9cb 100644 --- a/doc/source/user_guide/ug_running.rst +++ b/doc/source/user_guide/ug_running.rst @@ -101,9 +101,7 @@ There are three usage modes, * ``--test`` creates individual tests. Tests are just cases that have some extra automation in order to carry out particular tests such as exact restart. * ``--suite`` creates a test suite. Test suites are predefined sets of tests and ``--suite`` provides the ability to quickly setup, build, and run a full suite of tests. -All modes will require use of ``--mach`` or ``-m`` to specify the machine and case and test modes -can use ``--set`` or ``-s`` to define specific options. ``--test`` and ``--suite`` will require ``--testid`` to be set -and both of the test modes can use ``--bdir``, ``--bgen``, ``--bcmp``, and ``--diff`` to generate (save) results and compare results with prior results as well as ``--tdir`` to specify the location of the test directory. +All modes will require use of ``--mach`` or ``-m`` to specify the machine. Use of ``--env`` is also recommended to specify the compilation environment. ``--case`` and ``--test`` modes can use ``--set`` or ``-s`` which will turn on various model options. ``--test`` and ``--suite`` will require ``--testid`` to be set and can use ``--bdir``, ``--bgen``, ``--bcmp``, and ``--diff`` to generate (save) results for regression testing (comparison with prior results). ``--tdir`` will specify the location of the test directory. Testing will be described in greater detail in the :ref:`testing` section. Again, ``cice.setup --help`` will show the latest usage information including @@ -111,15 +109,15 @@ the available ``--set`` options, the current ported machines, and the test choic To create a case, run **cice.setup**:: - cice.setup -c mycase -m machine + cice.setup -c mycase -m machine -e intel cd mycase Once a case/test is created, several files are placed in the case directory -- **env.[machine]** defines the environment +- **env.[machine]_[env]** defines the environment - **cice.settings** defines many variables associated with building and running the model - **makdep.c** is a tool that will automatically generate the make dependencies -- **Macros.[machine]** defines the Makefile macros +- **Macros.[machine]_[env]** defines the Makefile macros - **Makefile** is the makefile used to build the model - **cice.build** is a script that calls the Makefile and compiles the model - **ice\_in** is the namelist input file @@ -137,8 +135,8 @@ The **casescripts/** directory holds scripts used to create the case and can largely be ignored. Once a case is created, the **cice.build** script should be run interactively and then the case should be submitted by executing the **cice.submit** script interactively. The **cice.submit** script -simply submits the **cice.run script**. -You can also submit the **cice.run** script on the command line. +submits the **cice.run script** or **cice.test** script. These scripts can +also be run interactively or submitted manually without the **cice.submit** script. Some hints: @@ -158,7 +156,7 @@ To build and run:: ./cice.build ./cice.submit -The build and run log files will be copied into the logs directory in the case directory. +The build and run log files will be copied into the logs subdirectory in the case directory. Other model output will be in the run directory. The run directory is set in **cice.settings** via the ``ICE_RUNDIR`` variable. To modify the case setup, changes should be made in the case directory, NOT the run directory. @@ -186,10 +184,10 @@ Testing will be described in greater detail in the :ref:`testing` section. specifies the case name. This can be either a relative path of an absolute path. This cannot be used with --test or --suite. Either ``--case``, ``--test``, or ``--suite`` is required. ``--mach``, ``-m`` MACHINE - specifies the machine name. This should be consistent with the name defined in the Macros and env files in **configurations/scripts/machines**. This is required in all modes. + specifies the machine name. This should be consistent with the name defined in the Macros and env files in **configurations/scripts/machines**. This is required in all modes and is paired with ``--env`` to define the compilation environment. ``--env``, ``-e`` ENVIRONMENT1,ENVIRONMENT2,ENVIRONMENT3 - specifies the environment or compiler associated with the machine. This should be consistent with the name defined in the Macros and env files in **configurations/scripts/machines**. Each machine can have multiple supported environments including support for different compilers or other system setups. When used with ``--suite`` or ``--test``, the ENVIRONMENT can be a set of comma deliminated values with no spaces and the tests will then be run for all of those environments. With ``--case``, only one ENVIRONMENT should be specified. (default is intel) +specifies the compilation environment associated with the machine. This should be consistent with the name defined in the Macros and env files in **configurations/scripts/machines**. Each machine can have multiple supported environments including support for different compilers, different compiler versions, different mpi libraries, or other system settigs. When used with ``--suite`` or ``--test``, the ENVIRONMENT can be a set of comma deliminated values with no spaces and the tests will then be run for all of those environments. With ``--case``, only one ENVIRONMENT should be specified. (default is intel) ``--pes``, ``-p`` MxN[[xBXxBY[xMB] specifies the number of tasks and threads the case should be run on. This only works with ``--case``. The format is tasks x threads or "M"x"N" where M is tasks and N is threads and both are integers. BX, BY, and MB can also be set via this option where BX is the x-direction blocksize, BY is the y-direction blocksize, and MB is the max-blocks setting. If BX, BY, and MB are not set, they will be computed automatically based on the grid size and the task/thread count. More specifically, this option has three modes, --pes MxN, --pes MxNxBXxBY, and --pes MxNxBXxBYxMB. (default is 4x1) @@ -229,7 +227,7 @@ files **configuration/scripts/ice_in** and settings (options), the set_env.setting and set_nml.setting will be used to change the defaults. This is done as part of the ``cice.setup`` and the modifications are resolved in the **cice.settings** and **ice_in** file placed in -the case directory. If multiple options are chosen and then conflict, then the last +the case directory. If multiple options are chosen that conflict, then the last option chosen takes precedent. Not all options are compatible with each other. Some of the options are @@ -372,7 +370,10 @@ To port, an **env.[machine]_[environment]** and **Macros.[machine]_[environment] **configuration/scripts/machines/** directory and the **configuration/scripts/cice.batch.csh** and **configuration/scripts/cice.launch.csh** files need to be modified. In general, the machine is specified in ``cice.setup`` with ``--mach`` -and the environment (compiler) is specified with ``--env``. +and the environment (compiler) is specified with ``--env``. mach and env +in combination define the compiler, compiler version, supporting libaries, +and batch information. Multiple compilation environments can be created for +a single machine by choosing unique env names. - cd to **configuration/scripts/machines/** @@ -435,6 +436,7 @@ system. Some variables are optional. Cross-compiling ~~~~~~~~~~~~~~~ + It can happen that the model must be built on a platform and run on another, for example when the run environment is only available in a batch queue. The program **makdep** (see :ref:`overview`), however, is both compiled and run as part of the build process. In order to support this, the Makefile uses a variable ``CFLAGS_HOST`` that can hold compiler flags specfic to the build machine for the compilation of makdep. If this feature is needed, add the variable ``CFLAGS_HOST`` to the **Macros.[machine]_[environment]** file. For example : :: From c2573bcea37783022bb0d19335c13f0bc05c4524 Mon Sep 17 00:00:00 2001 From: Tony Craig Date: Mon, 29 Jun 2020 16:01:01 -0700 Subject: [PATCH 3/4] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 47c3bc2fd..8f6aab86c 100644 --- a/README.md +++ b/README.md @@ -47,4 +47,4 @@ Head over to our [Contribution guide][contributing] to learn more about how you List of resources for information about the Consortium and its repositories as well as model documentation, testing, and development. ## License -See our [License](License.pdf) and [Distribution Policy](DistributionPolicy.pdf). +See our [License](LICENSE.pdf) and [Distribution Policy](DistributionPolicy.pdf). From 55ca18b596a9722c0c0b0670ccc2acdc1fb287b8 Mon Sep 17 00:00:00 2001 From: Tony Craig Date: Mon, 29 Jun 2020 16:05:58 -0700 Subject: [PATCH 4/4] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8f6aab86c..0c5940a7a 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ CICE consists of a top level driver and dynamical core plus the [Icepack column [icepack]: https://github.com/CICE-Consortium/Icepack -If you need help getting started using the model afer reviewing the [model documentation][doc-resources], the first point of contact with the CICE Consortium is the [Consortium Community Forum][forum]. +The first point of contact with the CICE Consortium is the [Consortium Community Forum][forum]. This forum is monitored by Consortium members and also opened to the whole community. Please do not use our issue tracker for general support questions.