Skip to content

Commit

Permalink
Update README and install docs (#6) [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
dmey committed Jan 16, 2022
1 parent 234d023 commit 60882e6
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 80 deletions.
14 changes: 10 additions & 4 deletions .zenodo.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"title": "The WRF-TEB software repository",
"description": "<p><p>WRF-TEB (<a href=\"https://doi.org/10.1029/2019MS001961\">Meyer et al., 2020a</a>) couples the single layer Town Energy Balance (TEB) model (<a href=\"https://doi.org/10.1023/A:1002463829265\">Masson, 2000</a>, and subsequent papers) model, software (<a href=\"https://doi.org/10.21105/joss.02008\">Meyer et al., 2020b</a>), to the Weather Research and Forecasting (WRF; <a href=\"https://doi.org/10.5065/1dfh-6p97\">Skamarock et al., 2019</a>). The WRF-TEB software is available for download from version 4.1.5 at <a href=\"https://github.com/teb-model/wrf-teb\">https://github.com/teb-model/wrf-teb</a>.</p>",
"description": "<p>The coupled WRF-TEB (<a href=\"https://doi.org/10.1029/2019MS001961\">Meyer et al., 2020a</a>) couples the single layer Town Energy Balance (TEB; <a href=\"https://doi.org/10.1023/A:1002463829265\">Masson, 2000</a>) software (<a href=\"https://doi.org/10.21105/joss.02008\">Meyer et al., 2020b</a>) to the Weather Research and Forecasting (WRF; <a href=\"https://doi.org/10.5065/1dfh-6p97\">Skamarock et al., 2019</a>) software with CMake support (<a href=\"https://doi.org/10.21105/joss.01468\">Riechert &amp; Meyer, 2021</a>). For more information, please see&nbsp;<a href=\"https://github.com/TEB-model/wrf-teb\">https://github.com/TEB-model/wrf-teb</a>.</p>",
"keywords": [
"energy-balance-model",
"fortran",
Expand All @@ -22,9 +22,15 @@
},
"related_identifiers": [
{
"scheme": "doi",
"identifier": "10.1029/2019MS001961",
"relation": "isSupplementTo",
"scheme": "doi",
"identifier": "10.1029/2019MS001961",
"relation": "isSupplementTo",
"resource_type": "publication-article"
},
{
"scheme": "doi",
"identifier": "10.21105/joss.02008",
"relation": "isSupplementTo",
"resource_type": "publication-article"
}
]
Expand Down
67 changes: 30 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,71 +1,64 @@
<!-- omit in toc -->
# WRF-TEB software
[![Build status Azure Pipelines](https://dev.azure.com/WRF-CMake/wrf/_apis/build/status/WRF%20(full)?branchName=wrf-cmake)](https://dev.azure.com/WRF-CMake/wrf/_build/latest?definitionId=5&branchName=wrf-cmake) [![DOI](https://joss.theoj.org/papers/10.21105/joss.01468/status.svg)](https://doi.org/10.21105/joss.01468) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3403342.svg)](https://doi.org/10.5281/zenodo.3403342)

WRF-TEB ([Meyer et al., 2020a](https://doi.org/10.1029/2019MS001961)) couples the single layer Town Energy Balance (TEB) model ([Masson, 2000](https://doi.org/10.1023/A:1002463829265), and subsequent papers) model, software ([Meyer et al., 2020b](https://doi.org/10.21105/joss.02008)), to the Weather Research and Forecasting (WRF; [Skamarock et al., 2019](https://doi.org/10.5065/1dfh-6p97)). The WRF-TEB software is available for download from version 4.1.5 at https://github.com/teb-model/wrf-teb.
# The WRF-TEB software repository

The coupled WRF-TEB ([Meyer et al., 2020a](https://doi.org/10.1029/2019MS001961)) couples the single layer Town Energy Balance (TEB; [Masson, 2000](https://doi.org/10.1023/A:1002463829265)) software ([Meyer et al., 2020b](https://doi.org/10.21105/joss.02008)) to the Weather Research and Forecasting (WRF; [Skamarock et al., 2019](https://doi.org/10.5065/1dfh-6p97)) software with CMake support ([Riechert & Meyer, 2021](https://doi.org/10.21105/joss.01468)).

<!-- omit in toc -->
## Contents
- [Installation](#installation)
- [WRF-CMake](#wrf-cmake)
- [WRF](#wrf)
- [Usage](#usage)
- [How to cite](#how-to-cite)
- [Copyright and license](#copyright-and-license)
- [References](#references)


## Installation

The WRF-TEB software depends on the [TEB model software library](https://github.com/teb-model/teb) ([Meyer et al., 2020b](https://doi.org/10.21105/joss.02008)). Depending on the 'flavour' of WRF (software) you want to use (i.e. [WRF](https://github.com/wrf-model) or [WRF-CMake](https://github.com/WRF-CMake/wrf)), you may need to manually build the TEB model software library before attempting to build WRF on your system.

WRF-TEB is built with [WRF-CMake](https://github.com/WRF-CMake/wrf) and [TEB](https://github.com/teb-model/teb). Software releases are available from the [WRF-TEB release page](https://github.com/TEB-model/wrf-teb/releases). For standard installation on Linux use:

### WRF-CMake
```sh
cd wrf-teb
mkdir build && cd build

No additional steps are required to build WRF-TEB using [WRF-CMake](https://github.com/WRF-CMake/wrf) ([Riechert and Meyer, 2010](https://doi.org/10.21105/joss.01468)) as the [TEB model software library](https://github.com/teb-model/teb) is automatically downloaded and installed on your system at build time. To install, download (and extract) WRF-TEB from the [WRF-TEB release page](https://github.com/TEB-model/wrf-teb/releases), then follow the [standard installation instructions to build WRF-CMake from source](https://github.com/TEB-model/wrf-teb/blob/wrf-cmake-teb/doc/cmake/INSTALL.md).
cmake -GNinja -DCMAKE_BUILD_TYPE=Release \
-DMODE=dmpar \
-DCMAKE_INSTALL_PREFIX=install ..

### WRF

To build WRF-TEB using the [official WRF model](https://github.com/wrf-model) (i.e. with Makefiles), first follow the standard [TEB installation instructions](https://github.com/teb-model/teb) to build the TEB model software library on your system.
# https://ninja-build.org/
ninja install # -j <nproc>
```

Then, download (and extract) WRF-TEB from the [WRF-TEB release page](https://github.com/TEB-model/wrf-teb/releases), set `WRF_TEB=1` and `TEB_PATH=/path/to/teb/build` as environment variables before running `./configure`. From here, configure and build WRF as per [standard WRF build instructions](https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compilation_tutorial.php). Please ensure that both TEB and WRF are compiled using the same compiler vendor and version (e.g. `GNU 7.4.0`), and compiler options (e.g. `Release`, `REAL8` ) to avoid issues at compile/run-time. If you are using the standard WRF configure options, use `-DUSE_REAL8=OFF` when building the TEB model software library (i.e. `cmake -DUSE_REAL8=OFF ..`) as WRF defaults to 4 byte wide real.
**Notes**: the TEB software version is defined using the `GIT_TAG` variable in `external/teb/CMakeLists.txt`. To specify the location to TEB use the `TEB_DIR` flag (e.g. `-DTEB_DIR=path/to/teb/dir`). For a list of required software dependencies see [doc/cmake/INSTALL.md#install-dependencies](doc/cmake/INSTALL.md#install-dependencies). For advanced build and install information see [doc/cmake/INSTALL.md#build-and-install-wrf-cmake](doc/cmake/INSTALL.md#build-and-install-wrf-cmake).


## Usage

Standard/general [WRF documentation](https://www2.mmm.ucar.edu/wrf/users/docs/user_guide_v4/contents.html) applies. To run a case using WRF-TEB, first enable TEB from the `namelist.input` file (i.e. `sf_urban_physics = 4`), then rename the `URBPARM_TEB.TBL` file to `URBPARM.TBL`. Make sure to change options and paramter values to match your case study. More information about the options avalable in TEB/WRF-TEB are documented in [TEB model software library repository](https://github.com/teb-model/teb).
Standard [WRF documentation](https://www2.mmm.ucar.edu/wrf/users/docs/user_guide_v4/contents.html) applies. To run a case using WRF-TEB, enable TEB from the `namelist.input` with `sf_urban_physics = 4` and rename `URBPARM_TEB.TBL` to `URBPARM.TBL`. Make sure to change options and parameter values to match those for case study. See the [namelist option page in TEB](https://github.com/TEB-model/teb/blob/master/docs/namelist-options.md) for more information.


## How to cite

When using WRF-TEB, please cite the paper and software (with version) as follow:
Please cite WRF-TEB and WRF-CMake with the following DOIs:

| Model | Software and Version* |
| ----------------------------------------------------------- | ---------------------------------------------------- |
| [Meyer et al., 2020a](https://doi.org/10.1029/2019MS001961) | [see Zenodo](https://doi.org/10.5281/zenodo.3898327) |
- WRF-TEB: https://doi.org/10.1029/2019MS001961
- WRF-CMake: https://doi.org/10.21105/joss.01468

The corresponding reference list should be as follows:
Additional, version-specific DOIs are available on Zendo at https://doi.org/10.5281/zenodo.3898327 and https://doi.org/10.5281/zenodo.3403342 for WRF-TEB and WRF-CMake, respectively.

> Meyer, D., Schoetter, R., Riechert, M., Verrelle, A., Tewari, M., Dudhia, J., Masson, V., Reeuwijk, M., & Grimmond, S. (2020). WRF‐TEB: implementation and evaluation of the coupled Weather Research and Forecasting (WRF) and Town Energy Balance (TEB) model. Journal of Advances in Modeling Earth Systems. https://doi.org/10.1029/2019ms001961
*please make sure to cite the same version you are using with the correct DOI. For a list of all available versions see the list of versions on Zenodo.

## Copyright and license

Additional files provided in WRF-TEB are licensed under the MIT licence and indicated in the header of each source file with:
General WRF copyright and license applies for any files part of the original WRF distribution -- see the [README](README) file for more details.

WRF-CMake source files are licensed under the MIT license and marked as:

```
WRF-TEB (https://github.com/teb-model/wrf-teb).
Copyright <year> D. Meyer. Licensed under the MIT License.
WRF-CMake (https://github.com/WRF-CMake/wrf).
Copyright <year> M. Riechert and D. Meyer. Licensed under the MIT License.
```

## References
WRF-TEB source files are licensed under the MIT license and marked as:

> Masson, V. (2000). A Physically-Based Scheme For The Urban Energy Budget In Atmospheric Models. Boundary-Layer Meteorology, 94(3), 357–397. https://doi.org/10.1023/a:1002463829265
> Meyer, D., Schoetter, R., Riechert, M., Verrelle, A., Tewari, M., Dudhia, J., Masson, V., Reeuwijk, M., & Grimmond, S. (2020a). WRF‐TEB: implementation and evaluation of the coupled Weather Research and Forecasting (WRF) and Town Energy Balance (TEB) model. Journal of Advances in Modeling Earth Systems. https://doi.org/10.1029/2019ms001961
> Meyer, D., Schoetter, R., Masson, V., & Grimmond, S. (2020b). Enhanced software and platform for the Town Energy Balance (TEB) model. Journal of Open Source Software, 5(50), 2008. https://doi.org/10.21105/joss.02008
> Riechert, M., & Meyer, D. (2019). WRF-CMake: integrating CMake support into the Advanced Research WRF (ARW) modelling system. Journal of Open Source Software, 4(41), 1468. https://doi.org/10.21105/joss.01468
> Skamarock, W. C., Klemp, J. B., Dudhia, J., Gill, D. O., Liu, Z., Berner, J., … Huang, X.-Y. (2019). A Description of the Advanced Research WRF Model Version 4. https://doi.org/10.5065/1DFH-6P97
```
WRF-TEB (https://github.com/teb-model/wrf-teb).
Copyright <year> D. Meyer. Licensed under the MIT License.
```
41 changes: 21 additions & 20 deletions doc/cmake/INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,22 @@ brew install wrf-cmake -v
For more flexibility, e.g. when changing the registry, see the manual build instructions below.

## Install dependencies
The following libraries are required on your system to install WRF-CMake from source: [Git](https://git-scm.com/), [JasPer](https://www.ece.uvic.ca/~frodo/jasper/), [libpng](http://www.libpng.org/pub/png/libpng.html), [libjpeg](http://libjpeg.sourceforge.net/), [zlib](https://zlib.net/), [HDF5](https://support.hdfgroup.org/HDF5/), [NetCDF-C](https://www.unidata.ucar.edu/downloads/netcdf/index.jsp), [NetCDF-Fortran](https://www.unidata.ucar.edu/downloads/netcdf/index.jsp), and MPI (required if building in `dmpar` or `dm_sm` mode). The above libraries are most likely available from your system's package manager (e.g. APT, yum, Homebrew, etc.). If you do not have the latest version of these libraries installed on your system, please see [this page](LIBS.md).
The following libraries are required on your system to install WRF-CMake from source: [CMake](https://cmake.org/), [Ninja](https://ninja-build.org/), [Git](https://git-scm.com/), [JasPer](https://www.ece.uvic.ca/~frodo/jasper/), [libpng](http://www.libpng.org/pub/png/libpng.html), [libjpeg](http://libjpeg.sourceforge.net/), [zlib](https://zlib.net/), [HDF5](https://support.hdfgroup.org/HDF5/), [NetCDF-C](https://www.unidata.ucar.edu/downloads/netcdf/index.jsp), [NetCDF-Fortran](https://www.unidata.ucar.edu/downloads/netcdf/index.jsp), and MPI (required if building in `dmpar` or `dm_sm` mode). The above libraries are most likely available from your system's package manager (e.g. APT, yum, Homebrew, etc.). If you do not have the latest version of these libraries installed on your system, please see [this page](LIBS.md).

## Build and Install WRF-CMake

### Transition from original build system

| Original | CMake |
| ------------- | -------------- |
| `./configure` | `cmake ...` |
| `./compile` | `make install` |
| Original | CMake |
| ------------- | ------------------- |
| `./configure` | `cmake ...` |
| `./compile` | `cmake --install .` |

Further notes:
- `cmake --install` is available from CMake version 3.15. For older CMake versions use `cmake --build . --target install` instead.
- The [Ninja](https://ninja-build.org/) generator needs to be specified at configure time with the `-G` option, i.e. `-GNinja`.
- The original build system uses a series of terminal prompts when running `./configure` whereas for CMake any non-default options need to be specified as command-line arguments.
- If you change any registry files, then just re-run `make install`.
- If you change any registry files, then just re-run `cmake --install .`.

### On Linux and macOS
The general commands to download, configure and install WRF-CMake on Linux and macOS are:
Expand All @@ -35,10 +37,10 @@ The general commands to download, configure and install WRF-CMake on Linux and m
git clone https://github.com/WRF-CMake/wrf.git
cd wrf
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=<install_directory> ..
make install
cmake -GNinja -DCMAKE_INSTALL_PREFIX=<install_directory> ..
cmake --install .
```
where `<install_directory>` is the directory where to install WRF. Depending on your system's configuration, you may need to specify [WRF-CMake options](#wrf-cmake-options). If multiple compilers are available on the system, use the `CC` (C compiler) and/or `FC` (Fortran compiler) environment variables to specify them. For example, to use Intel C and Fortran compilers run `CC=icc FC=ifort cmake -DCMAKE_INSTALL_PREFIX=<install_directory> ..`. On macOS, use `CC=gcc-8 FC=gfortran-8` to use the GNU compilers installed with Homebrew. If your system has enough memory you can enable parallel compilation with `make install -j <n>` where `<n>` is the maximum number of jobs you like to run in parallel.
where `<install_directory>` is the directory where to install WRF. Depending on your system's configuration, you may need to specify [WRF-CMake options](#wrf-cmake-options). If multiple compilers are available on the system, use the `CC` (C compiler) and/or `FC` (Fortran compiler) environment variables to specify them. For example, to use Intel C and Fortran compilers run `CC=icc FC=ifort cmake -GNinja -DCMAKE_INSTALL_PREFIX=<install_directory> ..`. On macOS, use `CC=gcc-8 FC=gfortran-8` to use the GNU compilers installed with Homebrew. By default Ninja runs in parallel. If your system does not have enough memory you can restrict the number of parallel processes with the `-j` flag. For example, to compile with 2 parallel processes run `cmake --install . -j 2`.

#### Note for HPC users relying on the Modules package
If you are using `modules` for the dynamic modification of the user's environment via modulefiles, you will need to specify the path to the NetCDF manually _after_ loading all the libraries required to compile WRF/WPS. For example:
Expand All @@ -62,33 +64,33 @@ cmake -DNETCDF_DIR=<path_to_netcdf-c-dir> -DNETCDF_FORTRAN_DIR=<path_to_netcdf-f
where `<path_to_netcdf-c-dir>` and `<path_to_netcdf-fortran-dir>` are the absolute path to your NetCDF-C and NetCDF-Fortran installation directories.

### On Windows (with MinGW-w64 and gcc/gfortran)
Make sure you [installed all the required dependencies](README_CMAKE_LIBS.md) before continuing.
Make sure you [installed all the required dependencies](LIBS.md) before continuing.

#### Build WRF-CMake in serial mode
Open an MSYS2 **MinGW 64-bit** shell and run:
```sh
git clone https://github.com/WRF-CMake/wrf.git
cd WRF
mkdir build && cd build
cmake -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX=<install_directory> ..
make install
cmake -GNinja -DCMAKE_INSTALL_PREFIX=<install_directory> ..
cmake --install .
```
The folder `<install_directory>` now contains the WRF installation and is ready to use.
If your system has enough memory you can enable parallel compilation with `make install -j <n>` where `<n>` is the maximum number of jobs you like to run in parallel.
By default Ninja runs in parallel. If your system does not have enough memory you can restrict the number of parallel processes with the `-j` flag. For example, to compile with 2 parallel processes run `cmake --install . -j 2`.

#### Build WRF-CMake with MPI support
Open an MSYS2 **MinGW 64-bit** shell and run:
```sh
git clone https://github.com/WRF-CMake/wrf.git
cd WRF
mkdir build && cd build
cmake -G "MSYS Makefiles" -DMODE=dmpar -DCMAKE_INSTALL_PREFIX=<install_directory> \
cmake -GNinja -DMODE=dmpar -DCMAKE_INSTALL_PREFIX=<install_directory> \
-DMPI_INCLUDE_PATH=$MINGW_PREFIX/include -DMPI_C_LIBRARY="$MSMPI_LIB64/msmpi.lib" \
-DMPI_Fortran_LIBRARY="$MSMPI_LIB64/msmpifec.lib" ..
make install
cmake --install .
```
The folder `<install_directory>` now contains the WRF installation and is ready to use.
If your system has enough memory you can enable parallel compilation with `make install -j <n>` where `<n>` is the maximum number of jobs you like to run in parallel.
By default Ninja runs in parallel. If your system does not have enough memory you can restrict the number of parallel processes with the `-j` flag. For example, to compile with 2 parallel processes run `cmake --install . -j 2`.

### WRF-CMake options
By default WRF-CMake will compile in `serial` mode with `basic` nesting option. You can change this by specifying the option (or flag) at configure time. The general syntax for specifying an option in CMake is `-D<flag_name>=<flag_value>` where `<flag_name>` is the option/flag name and `<flag_value>` is the option/flag value. The following options can be specified when configuring WRF-CMake:
Expand All @@ -109,10 +111,10 @@ By default WRF-CMake will compile in `serial` mode with `basic` nesting option.
For example, to build and install WRF-CMake on Linux/macOS by setting all the available options and installing in `~/apps/WRF` with gcc and gfortran:
``` sh
# Assumes you are in the WRF directory
CC=gcc FC=gfortran cmake -DCMAKE_INSTALL_PREFIX=~/apps/WRF \
CC=gcc FC=gfortran cmake -GNinja -DCMAKE_INSTALL_PREFIX=~/apps/WRF \
-DCMAKE_BUILD_TYPE=Release -DMODE=dmpar -DNESTING=basic \
-DENABLE_GRIB1=ON -DENABLE_GRIB2=ON ..
make install
cmake --install .
```

## Build and Install WPS-CMake
Expand All @@ -123,11 +125,10 @@ If you intend to run real cases in WRF-CMake, you will also need to compile WPS-
git clone https://github.com/WPS-CMake/WPS.git
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=<install_directory> -DWRF_DIR=<wrf_cmake_build_directory> ..
make install
cmake --install .
```

where `<install_directory>` is the directory where to install WPS and `<wrf_cmake_build_directory>` is the path to the `build` folder of WRF (relative or absolute). To specify more options, please see the [WPS-CMake options](#wps-cmake-options).
You can enable parallel compilation with `make install -j <n>` where `<n>` is the maximum number of jobs you like to run in parallel.

### WPS-CMake options

Expand Down
Loading

0 comments on commit 60882e6

Please sign in to comment.