Skip to content

Commit

Permalink
Merge pull request #30 from fentoad72/ufs-arbetter
Browse files Browse the repository at this point in the history
Add CodeOverview to Users Guide Chapter 2
  • Loading branch information
ligiabernardet authored Jan 16, 2020
2 parents 5e620d1 + c09fff3 commit 0a98fe9
Show file tree
Hide file tree
Showing 2 changed files with 191 additions and 6 deletions.
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

0 comments on commit 0a98fe9

Please sign in to comment.