build_wrf - UK-FVCOM-Usergroup/uk-fvcom GitHub Wiki

#!/usr/bin/env bash

set -eu

# Set up the build environment
module load mpi/mpich-x86_64                          # for parallel runs

# Where are we?
cwd=$(readlink -f $(pwd))

# Parallel build processes
nproc=16

# Prerequisite is to build a local copy of the WRF libraries. This is less
# painful than trying to use the system versions, I've found. See build.sh in
# ../LIBRARIES.

# Environment variables
export CC=gcc
export CXX=g++
export FC=gfortran
export FCFLAGS=-m64
export F77=gfortran
export FFLAGS=-m64

# Where to find things
export LDFLAGS=-L$cwd/../LIBRARIES/grib2/lib          # for GRIB support.
export CPPFLAGS=-I$cwd/../LIBRARIES/grib2/include     # for GRIB support.
export JASPERINC=$cwd/../LIBRARIES/grib2/include      # for GRIB support.
export JASPERLIB=$cwd/../LIBRARIES/grib2/lib          # you may need to yum install these two (JASPER???).
export NETCDF=$cwd/../LIBRARIES/netcdf                # for linking with netCDF libraries.
export WRFIO_NCD_LARGE_FILE_SUPPORT=1                 # enable large file support in netCDF.

$cwd/clean                                            # start from a clean slate.

if [ ! -f $cwd/configure.wrf ]; then
    $cwd/configure                                    # pick option 34 (dmpar - distributed memory i.e. cluster).
fi

# GO GO GO!
$cwd/compile -j $nproc em_real 2>&1 | tee make.log    # the 3D real case.