Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CPPs and Documentation #329

Merged
merged 9 commits into from
Jul 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions columnphysics/icepack_isotope.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment on lines -485 to -487
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only instance of "NOFRAC"... was this added for compiling CICE as part of another model ? (@eclare108213 you added that in 1ae0446 (Isotopes for Icepack (#307), 2020-04-06))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to @dabail10, this was added for debugging the isotopes and is not needed at this time.

!
return
end function wiso_alpi

Expand Down
9 changes: 9 additions & 0 deletions columnphysics/icepack_kinds.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor point, but why #if defined and not #ifdef ? I think they do the same thing but maybe we should stick to one or the other?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In CICE, there is a mixture of #ifdef and #if defined. The NO_I8 in CICE has #if defined, so I made the icepack format match that. I could change it here, but then would probably want to change it in CICE as well. If we want to take this step, I'm happy to do it. I'm personally not that concerned about mixing the styles, although agree a single approach is nicer (but then requires diligence to maintain it).

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me, but I have a dumb question. I'm not familiar with how selected_real_kind works, but it seems to me there might be a machine and compiler dependence here? Do we have to update this every couple of years? Sorry if I missed this in an earlier discussion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The NO_I8 and NO_R16 are definitely compiler dependent which means they may be required on certain machines. And this could certainly change. For instance, NO_R16 is defined for a few machine/compilers now. It's possible those are incorrect. To be honest, I'm not sure how those settings were decided. I suspect it's partly historical and they have not been reviewed for a while. The main point of these CPPs is that they provide users with a flag to turn off these features if their compiler doesn't support them. As a general rule, they should only be used when needed. And we probably should review the current settings in the current machines to check whether we really do need them where they are currently set.


!=======================================================================

Expand Down
4 changes: 2 additions & 2 deletions configuration/scripts/icepack_decomp.csh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
29 changes: 28 additions & 1 deletion doc/source/user_guide/ug_case_settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
25 changes: 22 additions & 3 deletions doc/source/user_guide/ug_running.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
For standalone Icepack, The CPPs are defined by the `CPPDEFS` variable in the 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of 'ie.' please use 'e.g.'
I don't know the Latin, but I think i.e. means "that is," and e.g. means "for example,"

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
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion icepack.setup
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down