From 4c42a82e3d92f191a9c52bca3831e8d242e2e4c0 Mon Sep 17 00:00:00 2001 From: Tony Craig Date: Fri, 31 Jul 2020 09:23:54 -0700 Subject: [PATCH] Update CPPs and Documentation (#329) * update CPPs and documentation * update documentation and script output * remove NOFRAC cpp * update doc precedence * update documentation, change cpp directive to cpp macro Co-authored-by: Philippe Blain --- columnphysics/icepack_isotope.F90 | 4 --- columnphysics/icepack_kinds.F90 | 9 +++++++ configuration/scripts/icepack_decomp.csh | 4 +-- doc/source/user_guide/ug_case_settings.rst | 29 +++++++++++++++++++++- doc/source/user_guide/ug_running.rst | 25 ++++++++++++++++--- icepack.setup | 2 +- 6 files changed, 62 insertions(+), 11 deletions(-) diff --git a/columnphysics/icepack_isotope.F90 b/columnphysics/icepack_isotope.F90 index d230eae89..26f81fb5e 100644 --- a/columnphysics/icepack_isotope.F90 +++ b/columnphysics/icepack_isotope.F90 @@ -482,10 +482,6 @@ function wiso_alpi(isp,tk) wiso_alpi = exp(alpai(isp)/tk**2 + alpbi(isp)/tk + alpci(isp)) -#ifdef NOFRAC - wiso_alpi = c1 -#endif -! return end function wiso_alpi diff --git a/columnphysics/icepack_kinds.F90 b/columnphysics/icepack_kinds.F90 index f436aaa61..664643fa3 100644 --- a/columnphysics/icepack_kinds.F90 +++ b/columnphysics/icepack_kinds.F90 @@ -5,6 +5,7 @@ ! ! author: Elizabeth C. Hunke and William H. Lipscomb, LANL ! 2006: ECH converted to free source form (F90) +! 2020: TC added support for NO_I8 and NO_R16 module icepack_kinds @@ -17,10 +18,18 @@ module icepack_kinds char_len_long = 256, & log_kind = kind(.true.), & int_kind = selected_int_kind(6), & +#if defined (NO_I8) + int8_kind = selected_int_kind(6), & +#else int8_kind = selected_int_kind(13), & +#endif real_kind = selected_real_kind(6), & dbl_kind = selected_real_kind(13), & +#if defined (NO_R16) + r16_kind = selected_real_kind(13) +#else r16_kind = selected_real_kind(33,4931) +#endif !======================================================================= diff --git a/configuration/scripts/icepack_decomp.csh b/configuration/scripts/icepack_decomp.csh index 3392993c9..ad261ee6a 100755 --- a/configuration/scripts/icepack_decomp.csh +++ b/configuration/scripts/icepack_decomp.csh @@ -2,7 +2,7 @@ #--- inputs --- -echo "${0:t} input ICE_DECOMP_GRID = $ICE_DECOMP_GRID" +#echo "${0:t} input ICE_DECOMP_GRID = $ICE_DECOMP_GRID" set grid = $ICE_DECOMP_GRID @@ -19,6 +19,6 @@ endif setenv ICE_DECOMP_NXGLOB $nxglob -echo "${0:t} output ICE_DECOMP_NXGLOB = $ICE_DECOMP_NXGLOB" +#echo "${0:t} output ICE_DECOMP_NXGLOB = $ICE_DECOMP_NXGLOB" exit 0 diff --git a/doc/source/user_guide/ug_case_settings.rst b/doc/source/user_guide/ug_case_settings.rst index 95fab3f47..f30728623 100755 --- a/doc/source/user_guide/ug_case_settings.rst +++ b/doc/source/user_guide/ug_case_settings.rst @@ -8,7 +8,34 @@ Case Settings There are two important files that define the case, **icepack.settings** and **icepack_in**. **icepack.settings** is a list of env variables that define many values used to setup, build and run the case. **icepack_in** is the input namelist file -for the icepack driver. Variables in both files are described below. +for the icepack driver. Variables in both files are described below. In addition, +the first table documents available C Preprocessor Macros. + +.. _tabcpps: + +Table of C Preprocessor (CPP) Macros +--------------------------------------------------- + +The Icepack model supports a few C Preprocessor (CPP) Macros. These +can be turned on during compilation to activate different pieces of source +code. The main purpose is to introduce build-time code modifications to +include or exclude certain libraries or Fortran language features, in part to +support CICE or other applications. More information +can be found in :ref:`cicecpps`. The following CPPs are available. + +.. csv-table:: **CPP Macros** + :header: "CPP name", "description" + :widths: 15, 60 + + "","" + "**General Macros**", "" + "NO_I8", "Converts ``integer*8`` to ``integer*4``." + "NO_R16", "Converts ``real*16`` to ``real*8``." + "","" + "**Application Macros**", "" + "CESMCOUPLED", "Turns on code changes for the CESM coupled application " + "CICE_IN_NEMO", "Turns on code changes for coupling in the NEMO ocean model" + .. _tabsettings: diff --git a/doc/source/user_guide/ug_running.rst b/doc/source/user_guide/ug_running.rst index 27028d4e2..94b66c405 100755 --- a/doc/source/user_guide/ug_running.rst +++ b/doc/source/user_guide/ug_running.rst @@ -163,7 +163,7 @@ preset setting (option), the set_env.setting and set_nml.setting will be used to change the defaults. This is done as part of the ``icepack.setup`` and the modifications are resolved in the **icepack.settings** and **icepack_in** file placed in 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. +option chosen takes precedence. Not all options are compatible with each other. Some of the options are @@ -201,6 +201,25 @@ To add some optional settings, one might do:: Once the cases are created, users are free to modify the **icepack.settings** and **icepack_in** namelist to further modify their setup. + +.. _cicecpps: + +C Preprocessor (CPP) Macros +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +There are a few C Preprocessor Macros supported in the Icepack model. These +support certain coding features to be excluded or included during the compile. They +exist in part to support the CICE model and other applications that use Icepack. + +For standalone Icepack, The CPPs are defined by the `CPPDEFS` variable in the Icepack +Makefile. They are defined +by passing the -D[CPP] to the C and Fortran compilers (ie. -DNO_I8) and this +is what needs to be set in the ``CPPDEFS`` variable. The value of ``ICE_CPPDEFS`` in +**icepack.settings** is copied into the Makefile ``CPPDEFS`` variable as are settings +hardwired into the **Macros.[machine]_[environment]** file. + +A list of available CPPs can be found in :ref:`tabcpps`. + .. _version: Model Version Control @@ -330,7 +349,7 @@ the **env.[machine]** file. The easiest way to change a user's default is to create a file in your home directory called **.cice\_proj** and add your preferred account name to the first line. There is also an option (``--acct``) in **icepack.setup** to define the account number. -The order of precedent is **icepack.setup** command line option, +The order of precedence is **icepack.setup** command line option, **.cice\_proj** setting, and then value in the **env.[machine]** file. .. _queue: @@ -343,7 +362,7 @@ the **env.[machine]** file. The easiest way to change a user's default is to create a file in your home directory called **.cice\_queue** and add your preferred account name to the first line. There is also an option (``--queue``) in **icepack.setup** to define the queue name on a case basis. -The order of precedent is **icepack.setup** command line option, +The order of precedence is **icepack.setup** command line option, **.cice\_queue** setting, and then value in the **env.[machine]** file. .. _laptops: diff --git a/icepack.setup b/icepack.setup index e7c36184c..4fee72006 100755 --- a/icepack.setup +++ b/icepack.setup @@ -838,7 +838,7 @@ EOF2 endif if (${found} == 0) then if (${name} == ${test}) then - echo "${ICE_SCRIPTS}/options/set_[nml,env].${name} not found" + #echo "${ICE_SCRIPTS}/options/set_[nml,env].${name} not found" echo "`date`${0} ${ICE_SCRIPTS}/options/set_[nml,env].${name} not found" >> ${casedir}/README.case else echo "${0}: ERROR, ${ICE_SCRIPTS}/options/set_[nml,env].${name} not found"