.. _`chapter: ccpp_interface`:
CCPP Interface
==============
Chapter 6 of the CCPP v6 Technical Documentation
(https://ccpp-techdoc.readthedocs.io/en/v6.0.0/) provides a wealth of
information on the overall process of connecting a host model to the
CCPP framework for calling physics. This chapter describes the
particular implementation within this SCM, including how to set up,
initialize, call, and change a physics suite using the CCPP framework.
Setting up a suite
------------------
Setting up a physics suite for use in the CCPP SCM with the CCPP
framework involves three steps: preparing data to be made available to
physics through the CCPP, running the ``ccpp_prebuild.py`` script to reconcile SCM-provided
variables with physics-required variables, and preparing a suite
definition file.
Preparing data from the SCM
~~~~~~~~~~~~~~~~~~~~~~~~~~~
As described in sections 6.1 and 6.2 of the `CCPP Technical
Documentation `__ a host
model must allocate memory and provide metadata for variables that are
passed into and out of the schemes within the physics suite. As of this
release, in practice this means that a host model must do this for all
variables needed by all physics schemes that are expected to be used
with the host model. For this SCM, all variables needed by the physics
schemes are allocated and documented in the file ``ccpp-scm/scm/src/scm_type_defs.f90`` and are contained
within the ``physics`` derived data type. This derived data type initializes its
component variables in a ``create`` type-bound procedure. As mentioned in section
6.2 of the `CCPP Technical
Documentation `__, files
containing all required metadata was constructed for describing all
variables in the derived data type. These files are ``scm/src/GFS_typedefs.meta,``, ``scm/src/CCPP_typedefs.meta``, and ``scm_physical_constants.meta``. Further, ``scm_type_defs.meta``
exists to provide metadata for derived data type definitions and their
instances, which is needed by the ccpp-framework to properly reference
the data. The standard names of all variables in this table must match
with a corresponding variable within one or more of the physics schemes.
A list of all standard names used can be found in ``ccpp/framework/doc/DevelopersGuide/CCPP_VARIABLES_SCM.pdf``.
Editing and running ``ccpp_prebuild.py``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
General instructions for configuring and running the ``ccpp_prebuild.py`` script can be found
in chapter 8 of the `CCPP Technical
Documentation `__. The
script expects to be run with a host-model-dependent configuration file,
passed as argument ``–config=path_to_config_file``. Within this configuration file are variables that
hold paths to the variable definition files (where metadata tables can
be found on the host model side), the scheme files (a list of paths to
all source files containing scheme entry points), the auto-generated
physics schemes makefile snippet, the auto-generated physics scheme caps
makefile snippet, and the directory where the auto-generated physics
caps should be written out to. As mentioned in :numref:`Section %s `, this script must be run
to reconcile data provided by the SCM with data required by the physics
schemes before compilation – this is done automatically by ``cmake``.
Preparing a suite definition file
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The suite definition file is a text file read by the model at compile
time. It is used to specify the physical parameterization suite, and
includes information about the number of parameterization groupings,
which parameterizations that are part of each of the groups, the order
in which the parameterizations should be run, and whether subcycling
will be used to run any of the parameterizations with shorter timesteps.
In addition to the six or so major parameterization categories (such as
radiation, boundary layer, deep convection, resolved moist physics,
etc.), the suite definition file can also have an arbitrary number of
additional interstitial schemes in between the parameterizations to
prepare or postprocess data. In many models, this interstitial code is
not known to the model user but with the suite definition file, both the
physical parameterizations and the interstitial processing are listed
explicitly.
For this release, supported suite definition files used with this SCM
are found in ``ccpp-scm/ccpp/suites`` and have default namelist, tracer configuration, and
timesteps attached in ``ccpp-scm/scm/src/suite_info.py``. For all of these suites, the physics schemes
have been organized into 3 groupings following how the physics are
called in the UFS Atmosphere model, although no code is executed in the
SCM time loop between execution of the grouped schemes. Several
“interstitial” schemes are included in the suite definition file to
execute code that previously was part of a hard-coded physics driver.
Some of these schemes may eventually be rolled into the schemes
themselves, improving portability.
Initializing/running a suite
----------------------------
The process for initializing and running a suite in this SCM is
described in sections
:numref:`%s ` and :numref:`%s