Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
40567df
Remove Steve Goldhaber from CODEOWNERS for gmtb/develop branch
climbfuji Jul 11, 2019
e0dff34
Update CODEOWNERS to GSD team
climbfuji Jul 16, 2019
da96d72
Update CODEOWNERS to enable branch protection
climbfuji Jul 18, 2019
d7824f9
scripts/convert_metadata.py: don't convert standard names to lower ca…
climbfuji Jul 25, 2019
9bf55e6
scripts/metadata_parser.py: add functionality to parse new metadata f…
climbfuji Jul 25, 2019
3b531f0
scripts/metavar.py: bugfix in routine valid_value to return the corre…
climbfuji Jul 25, 2019
c8423d2
scripts/mkcap.py: bugfix, perform type_kind_test correctly for both t…
climbfuji Jul 25, 2019
3216854
scripts/parse_tools/parse_checkers.py: allow uppercase characters in …
climbfuji Jul 25, 2019
3157123
scripts/metadata_table.py: make script executable
climbfuji Jul 25, 2019
dc1cbca
scripts/metadata_table.py: adjust indents, allow literals in local va…
climbfuji Jul 29, 2019
0dd8c35
scripts/metavar.py: use __true_vals and __false_vals
climbfuji Jul 29, 2019
8c8ac84
scripts/parse_tools/__init__.py, scripts/parse_tools/parse_checkers.p…
climbfuji Jul 29, 2019
9bd830f
scripts/ccpp_prebuild.py, scripts/common.py, scripts/metadata_parser.…
climbfuji Jul 31, 2019
9eac6a1
scripts/mkcap.py: remove unnecessary type_kind_var logic and legacy g…
climbfuji Jul 31, 2019
a640f0a
scripts/mkstatic.py: remove unnecessary import statement
climbfuji Jul 31, 2019
2bda79b
scripts/metavar.py: do not check for derived data types being registe…
climbfuji Jul 31, 2019
3ad6131
scripts/convert_metadata.py: add logic and host-model dependent adjus…
climbfuji Jul 31, 2019
4d72408
Allow comments in type definition lines
Jul 31, 2019
4b61112
scripts/convert_metadata_schemes_using_typedef_dims.py: convert schem…
climbfuji Jul 31, 2019
3b1f982
Allow comments in type definition initial lines
Jul 31, 2019
39fe3bf
scripts/mkcap.py: bugfix, remove remainder of previous type_kind_var …
climbfuji Jul 31, 2019
4476a8b
Revert accidental import of new parse_checkers
Jul 31, 2019
1e4240a
Merge branch 'fix_ftype' of https://github.com/gold2718/ccpp-framewor…
climbfuji Jul 31, 2019
aad2925
Revert unintended whitespaces at the beginning of file metadata_table.py
climbfuji Jul 31, 2019
8734529
Merge pull request #205 from climbfuji/new_metadata_format_step1_2019…
climbfuji Aug 1, 2019
9830424
scripts/metavar.py: intent and optional are only for scheme variables…
climbfuji Aug 13, 2019
6c26eae
scripts/metadata_table.py, scripts/metadata2html.py: recording develo…
climbfuji Aug 13, 2019
b3c96ec
scripts/metadata_table.py, scripts/metadata2html.py: initial working …
climbfuji Aug 15, 2019
eec1321
scripts/metadata_table.py, scripts/metadata2html.py: write html files…
climbfuji Aug 15, 2019
577ffaf
scripts/convert_metadata*.py: don't add htmlinclude statement for bla…
climbfuji Aug 15, 2019
844fed0
scripts/metadata_table.py: replace dummy title with name of argument …
climbfuji Aug 16, 2019
6d7d43e
Merge pull request #208 from climbfuji/metadata2html
climbfuji Aug 17, 2019
c30d902
Changes to the Technical Documentation to reflect the new metadata fo…
ligiabernardet Aug 21, 2019
63fe681
add the variable standard name and container to the exception message…
grantfirl Aug 21, 2019
f8a69b1
Merge pull request #216 from grantfirl/unit_conversion_error_verbosity
climbfuji Aug 22, 2019
8d54a4c
doc/CCPPtechnical/source/ConstructingSuite.rst: update name of scheme…
climbfuji Aug 22, 2019
f0a5199
Merge branch 'gmtb/develop' of https://github.com/NCAR/ccpp-framework…
climbfuji Aug 22, 2019
1c282ee
Addressed reviewers comments in TechDoc for clarity and bugs.
ligiabernardet Aug 23, 2019
27f5add
src/ccpp_fields_idx.h: increase default size for CCPP dynamic variabl…
climbfuji Aug 23, 2019
c8fea55
Updated configuration file for the Technical Documentation so PDF pro…
ligiabernardet Aug 23, 2019
d61066a
Modified TechDoc figures to be compatible with new metadata format.
ligiabernardet Aug 23, 2019
bb85643
Modifications to TechDoc to reflect new metadata format.
ligiabernardet Aug 26, 2019
cfe7cb9
Merge pull request #217 from climbfuji/doc_updates_ugwd_cires
climbfuji Aug 27, 2019
d1eced2
Fixed typo in TechDoc per reviewer comment.
ligiabernardet Aug 28, 2019
5664c58
Changes in two Python scripts needed to improve the appearance of the…
ligiabernardet Aug 29, 2019
9a3c688
add Julie as codeowner
grantfirl Aug 29, 2019
a3eab43
Merge pull request #219 from grantfirl/gmtb/develop
climbfuji Aug 29, 2019
28e007b
Addressed comments by reviewers.
ligiabernardet Sep 1, 2019
7c65ae8
Convert src/ccpp_types.F90 to new metadata format
climbfuji Sep 3, 2019
a256182
scripts/conversion_tools/unit_conversion.py: register unit conversion…
climbfuji Sep 3, 2019
5daaca0
scripts/convert_metadata_schemes_using_typedef_dims.py: add missing v…
climbfuji Sep 3, 2019
7c784f1
scripts/common.py: register missing CCPP internal variables
climbfuji Sep 3, 2019
13e13d1
Merge branch 'gsd/develop' of https://github.com/NCAR/ccpp-framework …
climbfuji Sep 4, 2019
ca4991e
scripts/metadata_parser.py: warn or raise exception (currently warn) …
climbfuji Sep 4, 2019
dfa7c0b
Merge pull request #214 from ligiabernardet/TechDoc_updates_metadata
climbfuji Sep 5, 2019
c1cf90f
scripts/metadata_parser.py: remove legacy debug output to xml, no lon…
climbfuji Sep 6, 2019
2d95f96
Merge pull request #221 from climbfuji/gmtb_develop_monster_merge_201…
climbfuji Sep 9, 2019
6d1a383
Merge branch 'gmtb/develop' of https://github.com/NCAR/ccpp-framework…
climbfuji Sep 9, 2019
7b0ed0b
Update of scripts and documentation to address reviewer comments
climbfuji Sep 13, 2019
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
2 changes: 1 addition & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
#*.js @octocat @github/js

# You can also use email addresses if you prefer.
#docs/* docs@example.com
#docs/* docs@example.com
8 changes: 5 additions & 3 deletions doc/CCPPtechnical/source/AddingNewSchemes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ Tips for Adding a New Scheme

This chapter contains a brief description on how to add a new scheme to the *CCPP-Physics* pool.

* Identify the variables required for the new scheme and check if they are already available for use in the CCPP by checking the metadata tables in ``GFS_typedefs.F90`` or by perusing file ``ccpp-framework/doc/DevelopersGuide/CCPP_VARIABLES_{FV3,SCM}.pdf`` generated by ``ccpp_prebuild.py``.
* Identify the variables required for the new scheme and check if they are already available for use in the CCPP by checking the metadata information in ``GFS_typedefs.meta`` or by perusing file ``ccpp-framework/doc/DevelopersGuide/CCPP_VARIABLES_{FV3,SCM}.pdf`` generated by ``ccpp_prebuild.py``.

* If the variables are already available, they can be invoked in the scheme’s metadata table and one can skip the rest of this subsection. If the variable required is not available, consider if it can be calculated from the existing variables in the CCPP. If so, an interstitial scheme (such as ``scheme_pre``; see more in :numref:`Chapter %s <CompliantPhysParams>`) can be created to calculate the variable. However, the variable must be defined but not initialized in the host model as the memory for this variable must be allocated on the host model side. Instructions for how to add variables to the host model side is described in :numref:`Chapter %s <Host-side Coding>`.
* If the variables are already available, they can be invoked in the scheme’s metadata file and one can skip the rest of this subsection. If the variable required is not available, consider if it can be calculated from the existing variables in the CCPP. If so, an interstitial scheme (such as ``scheme_pre``; see more in :numref:`Chapter %s <CompliantPhysParams>`) can be created to calculate the variable. However, the variable must be defined but not initialized in the host model as the memory for this variable must be allocated on the host model side. Instructions for how to add variables to the host model side is described in :numref:`Chapter %s <Host-side Coding>`.

* If new namelist variables need to be added, the ``GFS_control_type`` DDT should be used. In this case, it is also important to modify the namelist file ``input.nml`` to include the new variable.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This seems rather GFS specific. Is this really a framework item?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

We were discussing to move the technical documentation outside of ccpp-framework, or at least parts of it. Let's keep those changes for the moment and clean the documentation up when the move is made. Ok?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Sure, let's keep an eye on this issue moving forwards.


* It is important to note that not all data types are persistent in memory. Most variables in the interstitial data type are reset (to zero or other initial values) at the beginning of a physics group and do not persist from one set to another or from one group to another. The diagnostic data type is periodically reset because it is used to accumulate variables for given time intervals. However, there is a small subset of interstitial variables that are set at creation time and are not reset; these are typically dimensions used in other interstitial variables.

Expand Down Expand Up @@ -65,7 +67,7 @@ This chapter contains a brief description on how to add a new scheme to the *CCP
* Check *prebuild* script for success/failure and associated messages.
* Compile code in DEBUG mode, run through debugger if necessary (gdb, Allinea DDT, totalview, ...). See :numref:`Chapter %s <BuildingRunningHostModels>` for information on debugging.
* Use memory check utilities such as valgrind.
* Double-check the metadata table in your scheme to make sure that the standard names correspond to the correct local variables.
* Double-check the metadata file associated with your scheme to make sure that all information, including standard names and units, correspond to the correct local variables.

* Done. Note that no further modifications of the build system are required, since the *CCPP-Framework* will autogenerate the necessary makefiles that allow the host model to compile the scheme.

Expand Down
22 changes: 12 additions & 10 deletions doc/CCPPtechnical/source/AutoGenPhysCaps.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ Dynamic Build *Caps*
====================

With the dynamic build, the CCPP-Framework and physics are dynamically linked to the executable
to allow maximum runtime flexibility. A *cap* is generated using the metadata requested in
each scheme argument table and the variables provided in the host model metadata tables (see
left side of :numref:`Figure %s <ccpp_dynamic_build>`). The CCPP *prebuild* step for the dynamic
build performs the following tasks:
to allow maximum runtime flexibility. A *cap* is generated using the metadata associated with
the arguments of each scheme and the metadata associated with the variables provided by the
host model (see left side of :numref:`Figure %s <ccpp_dynamic_build>`). These metadata variables
are described in the ``.meta`` files associated with the host model and the schemes.
The CCPP *prebuild* step for the dynamic build performs the following tasks:

* Checks requested vs provided variables by ``standard_name``.
* Checks units, rank, type.
Expand Down Expand Up @@ -88,12 +89,12 @@ The variables added to ``*_fast_physics.inc`` do not use ``GFS_typedefs.F90`` or

For each *cap*, ``ccpp_prebuild.py`` generates “use” statements based on the host model template.
Only the public *caps* (``init``, ``run`` and ``finalize``) are exposed (see code example below).
Each *cap* consists of a module containing three functions. For example, ``scheme_pre_cap.F90``
Each *cap* consists of a module containing three functions. For example, ``scheme_pre_cap.F90``
would contain the functions ``scheme_pre_init_cap``, ``scheme_pre_run_cap`` and ``scheme_pre_finalize_cap``, which perform the functions below.

* Declare data types ``cptr``, ``cdims`` and ``ckind``.
* Create a pointer to the Fortran data type ``cdata``.
* Call ``ccpp_field_get`` for each variable in metadata table and pulls data from the ``cdata`` structure.
* Call ``ccpp_field_get`` for each variable in the metadata file for the scheme and pull data from the ``cdata`` structure.

The index defined in each call speeds up memory access by avoiding a binary search,
since variables are no longer searched by name; the order of the data in ``cdata`` are known.
Expand Down Expand Up @@ -193,12 +194,13 @@ For example, the autogenerated scheme *cap* for ``rrtmg_lw_pre_cap.F90`` is show
end function rrtmg_lw_pre_finalize_cap
end module rrtmg_lw_pre_cap

*Listing 5.1: Condensed version of the autogenerated scheme cap* ``rrtmg_lw_pre_cap.F90`` *for the dynamic build. Note the calls to* ``ccpp_field_get`` *for each variable.*
*Listing 5.1: Condensed version of the autogenerated scheme cap* ``rrtmg_lw_pre_cap.F90`` *for the dynamic build. Note the calls to* ``ccpp_field_get`` *for each variable.*

The fields accessed from ``cdata`` are determined by the metadata in the scheme argument table(s). In this example,
The fields accessed from ``cdata`` are determined by the metadata for the arguments of the scheme. In this example,
``rrtmg_lw_pre_init`` and ``rrtmg_lw_pre_finalize`` are empty subroutines, i.e. they have no arguments passed in or out,
no metadata table, and no calls to ``ccpp_field_get``. However, ``rrtmg_lw_pre_run`` has a metadata table, so ``ccpp_field_get``
is called for each variable in the table and the value put into the call to ``rrtmg_lw_pre_run``.
no metadata section in the ``.meta`` file, and no calls to ``ccpp_field_get``. However, ``rrtmg_lw_pre_run``
has a metadata section in file ``rrtmg_lw_pre.meta``, so ``ccpp_field_get``
is called for each variable described in the metadata section and the value put into the call to ``rrtmg_lw_pre_run``.

Static Build Caps
=================
Expand Down
20 changes: 9 additions & 11 deletions doc/CCPPtechnical/source/CCPPPreBuild.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ incorporated in that model’s build system. In the case of NEMSfv3gfs, ``ccpp_p
or automatically as a step in the build system.

The :term:`CCPP` *prebuild* script automates several tasks based on the information collected from the metadata
tables on the host model side and from the individual physics schemes (see :numref:`Figure %s <ccpp_prebuild>`):
on the host model side and from the individual physics schemes (``.meta`` files; see :numref:`Figure %s <ccpp_prebuild>`):

* Compiles a list of variables required to run all schemes in the :term:`CCPP-Physics` pool.

Expand Down Expand Up @@ -123,7 +123,7 @@ Running ccpp_prebuild.py

Once the configuration in ``ccpp_prebuild_config.py`` is complete, the ``ccpp_prebuild.py`` script can be run from the top level directory. For the SCM, this script must be run (in dynamic build mode only) to reconcile data provided by the SCM with data required by the physics schemes before compilation and to generate physics caps and makefile segments. For the :term:`UFS` Atmosphere host model, the ``ccpp_prebuild.py`` script is called automatically by the NEMSfv3gfs build system when the :term:`CCPP` build is requested (by running the :term:`CCPP` regression tests or by passing the option CCPP=Y and others to the ``compile.sh`` script; see the compile commands defined in the :term:`CCPP` regression test configurations for further details).

For developers adding a CCPP-compliant physics scheme, running ``ccpp_prebuild.py`` periodically is recommended to check that the metadata in the argument tables match between the host model and the physics scheme. For the :term:`UFS` Atmosphere, running ``ccpp_prebuild.py`` manually is identical to running it for the SCM (since the relative paths to their respective ``ccpp_prebuild_config.py`` files are identical), except it may be necessary to add the ``--static`` and ``--suites`` command-line arguments for the static option.
For developers adding a CCPP-compliant physics scheme, running ``ccpp_prebuild.py`` periodically is recommended to check that the metadata provided with the physics schemes matches what the host model provided. For the :term:`UFS` Atmosphere, running ``ccpp_prebuild.py`` manually is identical to running it for the SCM (since the relative paths to their respective ``ccpp_prebuild_config.py`` files are identical), except it may be necessary to add the ``--static`` and ``--suites`` command-line arguments for the static option.

As alluded to above, the ``ccpp_prebuild.py`` script has six command line options, with the path to a host-model specific configuration file (``--config``) being the only necessary input option:

Expand Down Expand Up @@ -164,7 +164,7 @@ To remove all files created by ``ccpp_prebuild.py``, for example as part of a ho
Troubleshooting
=============================

If invoking the ``ccpp_prebuild.py`` script fails, some message other than the success message will be written to the terminal output. Specifically, the terminal output will include informational logging messages generated from the script, any error messages written to the python logging utility, and a Python traceback that pinpoints the line within the script where the error caused failure. Some common errors (minus the typical logging output and traceback output) and solutions are described below, with non-bold font used to denote aspects of the message that will differ depending on the problem encountered. This is not an exhaustive list of possible errors, however. For example, in this version of the code, there is no cross-checking that the information provided in the metadata tables corresponds to the actual Fortran code, so even though ``ccpp_prebuild.py`` may complete successfully, there may be related compilation errors later in the build process. For further help with an undescribed error, please contact gmtb-help@ucar.edu.
If invoking the ``ccpp_prebuild.py`` script fails, some message other than the success message will be written to the terminal output. Specifically, the terminal output will include informational logging messages generated from the script and any error messages written to the Python logging utility. Some common errors (minus the typical logging output and traceback output) and solutions are described below, with non-bold font used to denote aspects of the message that will differ depending on the problem encountered. This is not an exhaustive list of possible errors, however. For example, in this version of the code, there is no cross-checking that the metadata information provided corresponds to the actual Fortran code, so even though ``ccpp_prebuild.py`` may complete successfully, there may be related compilation errors later in the build process. For further help with an undescribed error, please contact gmtb-help@ucar.edu.


#. ``ERROR: Configuration file`` erroneous/path/to/config/file ``not found``
Expand All @@ -186,11 +186,9 @@ If invoking the ``ccpp_prebuild.py`` script fails, some message other than the s
#. ``INFO: Parsing metadata tables for variables provided by host model`` …

``IOError: [Errno 2] No such file or directory``: 'erroneous_file.f90'
* Check that the paths specified in the ``VARIABLE_DEFINITION_FILES`` of the supplied configuration file are valid and contain CCPP-compliant host model variable metadata tables.
#. ``Exception: Encountered invalid line`` "some fortran" ``in argument table`` variable_metadata_table_name
* This is likely the result of not ending a variable metadata table with a line containing only ‘!!’. Check that the formatting of the offending variable metadata table is correct.
* Check that the paths specified in the ``VARIABLE_DEFINITION_FILES`` of the supplied configuration file are valid and contain CCPP-compliant host model snippets for insertion of metadata information. (see :ref:`example <SnippetMetadata>`)
#. ``Exception: Error parsing variable entry`` "erroneous variable metadata table entry data" ``in argument table`` variable_metadata_table_name
* Check that the formatting of the metadata entry described in the error message is OK. The number of metadata columns must match the table header and each entry’s columns must be separated by a ‘|’ character (be sure that the ‘!’ character was not used accidentally).
* Check that the formatting of the metadata entry described in the error message is OK.
#. ``Exception: New entry for variable`` var_name ``in argument table`` variable_metadata_table_name ``is incompatible with existing entry``:
| ``Existing: Contents of <mkcap.Var object at 0x10299a290> (* = mandatory for compatibility)``:
| ``standard_name`` = var_name *
Expand Down Expand Up @@ -248,17 +246,17 @@ If invoking the ``ccpp_prebuild.py`` script fails, some message other than the s
| ``target`` = None
| ``container`` = MODULE_X TYPE_Y

* This error is associated with physics scheme variable metadata entries that have the same standard name with different mandatory properties (either units, type, rank, or kind currently -- those attributes denoted with a ``*``). This error is distinguished from the error described in 9 above, because the error message mentions “in argument table of subroutine” instead of just “in argument table”.
* This error is associated with physics scheme variable metadata entries that have the same standard name with different mandatory properties (either units, type, rank, or kind currently -- those attributes denoted with a ``*``). This error is distinguished from the error described in 8 above, because the error message mentions “in argument table of subroutine” instead of just “in argument table”.
#. ``ERROR: Check that all subroutines in module`` module_name ``have the same root name``:
``i.e. scheme_A_init, scheme_A_run, scheme_A_finalize``
``Here is a list of the subroutine names for scheme`` scheme_name: scheme_name_finalize, scheme_name_run
* All schemes must have ``*_init``, ``*_run``, ``*_finalize`` subroutines contained within its entry/exit point module.
#. ``ERROR: Variable`` X ``requested by MODULE_``\Y ``SCHEME_``\Z ``SUBROUTINE_``\A ``not provided by the model``
``Exception: Call to compare_metadata failed.``

* A variable requested by one or more physics schemes is not being provided by the host model. If the variable exists in the host model but is not being made available for the :term:`CCPP`, an entry must be added to one of the host model variable metadata tables.
* A variable requested by one or more physics schemes is not being provided by the host model. If the variable exists in the host model but is not being made available for the :term:`CCPP`, an entry must be added to one of the host model variable metadata sections.
#. ``ERROR: error, variable`` X ``requested by MODULE_``\Y ``SCHEME_``\Z ``SUBROUTINE_``\A ``cannot be identified unambiguously. Multiple definitions in MODULE_``\Y ``TYPE_``\B
* A variable is defined in the host model variable metadata tables more than once (with the same standard name). Remove the offending entry or provide a different standard name for one of the duplicates.
* A variable is defined in the host model variable metadata more than once (with the same standard name). Remove the offending entry or provide a different standard name for one of the duplicates.
#. ``ERROR: incompatible entries in metadata for variable`` var_name:
| ``provided: Contents of <mkcap.Var object at 0x104883210> (* = mandatory for compatibility)``:
| ``standard_name`` = var_name *
Expand Down Expand Up @@ -287,6 +285,6 @@ If invoking the ``ccpp_prebuild.py`` script fails, some message other than the s
#. ``Exception: Call to compare_metadata failed``.
* This error indicates a mismatch between the attributes of a variable provided by the host model and what is requested by the physics. Specifically, the units, type, rank, or kind don’t match for a given variable standard name. Double-check that the attributes for the provided and requested mismatched variable are accurate. If after checking the attributes are indeed mismatched, reconcile as appropriate (by adopting the correct variable attributes either on the host or physics side).

Note: One error that the ``ccpp_prebuild.py`` script will not catch is if a physics scheme lists a variable in its actual (Fortran) argument list without a corresponding entry in the subroutine’s variable metadata table. This will lead to a compilation error when the autogenerated scheme cap is compiled:
Note: One error that the ``ccpp_prebuild.py`` script will not catch is if a physics scheme lists a variable in its actual (Fortran) argument list without a corresponding entry in the subroutine’s variable metadata. This will lead to a compilation error when the autogenerated scheme cap is compiled:

``Error: Missing actual argument for argument 'X' at (1)``
Loading