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

Add CodeOverview to Users Guide Chapter 2 #30

Merged
merged 3 commits into from
Jan 16, 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
104 changes: 102 additions & 2 deletions doc/UsersGuide/source/CodeOverview.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,107 @@
.. _CodeOverview:

*************************
Code Overview
*************************

Description of directories and files from repository
===================================================
UFS Weather Model Hierarchical Repository Structure
===================================================

The ufs-weather-model repository supports the short- and medium-range UFS applications. It contains atmosphere and wave components and some infrastructure components. Each of these components has its own repository. All the repositories are currently located in GitHub with public access to the broad community. :numref:`Table %s <Repo_Structure>` describes the list of repositories that comprises the ufs-weather-model.

.. _Repo_Structure:

.. list-table:: *List of Repositories that comprise the ufs-weather-model*
:widths: 50 50
:header-rows: 1

* - Repository Description
- Authoritative repository URL
* - Umbrella repository for the UFS Weather Model
- https://github.com/ufs-community/ufs-weather-model
* - Infrastructure: Flexible Modeling System
- https://github.com/NOAA-EMC/FMS
* - Infrastructure: NOAA Environmental Modeling System
- https://github.com/NOAA-EMC/NEMS
* - Infrastructure: add description
- https://github.com/NOAA-EMC/NCEPLIBS-pyprodutil
* - Framework to connect the CCPP library to a host model
- https://github.com/NCAR/ccpp-framework
* - CCPP library of physical parameterizations
- https://github.com/NCAR/ccpp-physics
* - Umbrella repository for the physics and dynamics of the atmospheric model
- https://github.com/NOAA-EMC/fv3atm
* - FV3 dynamical core
- https://github.com/NOAA-EMC/GFDL_atmos_cubed_sphere
* - Stochastic physics pattern generator
- https://github.com/noaa-psd/stochastic_physics
* - WAVEWATCH 3 wave model
- https://github.com/NOAA-EMC/WW3

In the table, the left column contains a description of each repository, and the right column shows the component repositories which are pointing to (or will point to) the authoritative repositories. The ufs-weather-model currently uses git submodule to manage the sub-components.

The umbrella repository for the UFS Weather Model is named ufs-weather-model. Under this repository reside a number of submodules that are nested in specific directories under the parent repository’s working directory. When the ufs-weather-model repository is cloned, the *.gitmodules* file creates the following directories:

.. code-block:: console

ufs-weather-model/
├── FMS https://github.com/NOAA-GFDL/FMS
├── FV3 https://github.com/NCAR/fv3atm
│ ├── atmos_cubed_sphere https://github.com/NCAR/GFDL_atmos_cubed_sphere
│ ├── ccpp
│ │ ├── framework https://github.com/NCAR/ccpp-framework
│ │ ├── physics https://github.com/NCAR/ccpp-physics
├── NEMS https://github.com/NCAR/NEMS
│ └── tests/produtil/NCEPLIBS-pyprodutil https://github.com/NOAA-EMC/NCEPLIBS-pyprodutil
├── stochastic_physics https://github.com/noaa-psd/stochastic_physics
└── WW3 https://github.com/NOAA-EMC/WW3

===================
Directory Structure
===================

When the ufs-weather-model is cloned, the basic directory structure will be similar to the example below. Files and some directories have been removed for brevity.

.. code-block:: console

ufs-weather-model/
├── cmake --------- cmake configuration files
├── compsets --------- configurations used by some regression tests
├── conf --------- unused
├── doc --------- READMEs with build, reg-test hints
├── FMS --------- The Flexible Modeling System (FMS),a software framework
├── FV3 --------- FV3 atmosphere model
│ ├── atmos_cubed_sphere ---- FV3 dynamic core
│ │ ├── docs
│ │ ├── driver
│ │ ├── model
│ │ └── tools
│ ├── ccpp -------- Common Community Physics Package
│ │ ├── config
│ │ ├── driver
│ │ ├── framework -------- CCPP framework
│ │ ├── physics -------- CCPP compliant physics schemes
│ │ └── suites -------- CCPP physics suite definition files (SDFs)
│ ├── cpl -------- Coupling field data structures
│ ├── gfsphysics -------- unused - IPD version of physics codes
│ │ ├── CCPP_layer
│ │ ├── GFS_layer
│ │ └── physics
│ ├── io --------- nemsio code
│ ├── ipd --------- unused - IPD driver/interfaces
│ ├── test --------- unused
├── log --------- log files from NEMS compset regression tests
├── modulefile --------- system module files for supported HPC systems
├── NEMS --------- NOAA Earth Modeling System framework
│ ├── exe
│ ├── src
│ └── test
├── parm --------- regression test configurations
├── release --------- unused
├── stochastic_physics -------- stochastic physics pattern generator
├── tests --------- regression test scripts
└── WW3 --------- WAVEWATCH III (wave component)

The physics subdirectory in the *gfsphysics* directory is not used or supported as part of this release (all physics is available through the :term:`CCPP`).

93 changes: 89 additions & 4 deletions doc/UsersGuide/source/CompilingCodeWithoutApp.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,92 @@
.. _CompilingCodeWithoutApp:

*********************************
Compiling the Code without an App
*********************************
*****************************************
Compiling the Code without an Application
*****************************************

UFS weather model uses the cmake build system. Since UFS weather model requires several external libraries to be available and appropriate environment variables pointing to those libraries to be set, a build script named ``build.sh`` is provided In the top-level directory of the repository to ensure all necessary variables are actually set.

The required libraries and environment variables can be set as shown in :numref:`Table %s <ReqLibEnvVar>` and :numref:`Table %s <ReqLibEnvVar2>` for the bash shell.

1. NCEP libraries:

.. _ReqLibEnvVar:

.. list-table:: *List of NCEP libraries that comprise the ufs-weather-model*
:widths: 20 80
:header-rows: 1

* - NCEP Library
- Environment Variables
* - nemsio
- export NEMSIO_INC=<path_to_nemsio_include_dir>
* -
- export NEMSIO_LIB=<path_to_nemsio_lib_dir>/libnemsio.a
* - bacio
- export BACIO_LIB4=<path_to_bacio_lib_dir>/libbacio.a
* - splib
- export SP_LIBd=<path_to_sp_lib_dir>/libsp_d.a
* - w3emc
- export W3EMC_LIBd=<path_to_w3emc_lib_dir>/libw3emc_d.a
* - w3nco
- export W3NCO_LIBd=<path_to_w3nco_lib_dir>/libw3nco_d.a

2. Third party libraries:

.. _ReqLibEnvVar2:

.. list-table:: *List of External libraries that comprise the ufs-weather-model*
:widths: 20 80
:header-rows: 1

* - Third Party Library
- Environment Variables
* - NetCDF
- export NETCDF=<path_to_netcdf_install_dir>
* - ESMF
- export ESMFMKFILE=<path_to_esmfmk_file>/esmf.mk

You can either manually set those environment variables in your shell, or if you are on one of the supported platforms (Tier 1) the easiest way of setting those variables is by using environment module and load all required modules. Modulefiles for all supported platforms are located in ``modulefiles/<platform>/fv3``. To load those modules, for example on hera, run:

.. code-block:: console

$ cd modulefiles/hera.intel
$ module use $(pwd)
$ module load fv3
$ cd ../..

Currently the build system supports two compiler families: GNU and Intel. The COMPILE environment variable must be set to either ‘gnu’ or ‘intel’ before running build script. For example, to use Intel compilers when using the bash shell, run:

.. code-block:: console

$ export COMPILER=intel

You can further customize compiler MPI wrappers by setting these four environment variables:

.. code-block:: console

CMAKE_Platform : if not set the default is linux.${COMPILER}
CMAKE_C_COMPILER : if not set the default is mpicc
CMAKE_CXX_COMPILER : if not set the default is mpicxx
CMAKE_Fortran_COMPILER : if not set the default is mpif90

In order to have one or more CCPP physics suites available at runtime, you need to select those suites at build time by setting the ``CCPP_SUITES`` environment variable. Multiple suites can be set, as shown below in an example for the bash shell

.. code-block:: console

$ export CCPP_SUITES=’FV3_GFS_2017_gfdlmp,FV3_GFS_v15’

If ``CCPP_SUITES`` is not set, the default is ``‘FV3_GFS_2017_gfdlmp’``.

After setting all the environment variables, you can build the model using

.. code-block:: console

$ ./build.sh

Once ``build.sh`` is finished, you should see the executable, named ufs_weather_model, in the top-level directory.





How to build the code using compile.sh and not CIME