Skip to content

Instantly share code, notes, and snippets.

@meteorologytoday
Created January 5, 2024 22:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meteorologytoday/6f4b6b31724e80de4ddbf8d0b7ea426d to your computer and use it in GitHub Desktop.
Save meteorologytoday/6f4b6b31724e80de4ddbf8d0b7ea426d to your computer and use it in GitHub Desktop.
Compile WRF on CW3E expanse
#!/bin/bash
# This file is intented to be descriptive
# rather than getting run
# ===== This is the used environment setup. I name it as .bashrc_WRF4.3 =====
ml purge
ml load gcc/9.2.0
export WRF_DEP_ROOT=/home/t2hsu/models/WRF/dep
export PATH="$WRF_DEP_ROOT/bin:$PATH"
export WRF_DEP_LIB=$WRF_DEP_ROOT/lib
export WRF_DEP_INC=$WRF_DEP_ROOT/include
export NETCDF=$WRF_DEP_ROOT
# ===== I create a conda environment, in case we need extra package in the future =====
conda create --name WRF-test
# ===== I use this alias, loaded in .bashrc file to help loading environment =====
alias loadWRF="conda activate WRF-test; source $HOME/.bashrc_WRF4.3"
# Before compiling any WRF stuff, I can load WRF environment like this :
loadWRF # It activates conda environment and load environment variables defined in .bashrc_WRF-4.3
# ================================================================================
# Next, I am describing how I compile each component mentioned in
# https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compilation_tutorial.php
# MPICH
./configure --prefix=$WRF_DEP_ROOT
# Netcdf C, Netcdf Fortran, zlib, libpng, jasper
LDFLAGS="-L/$WRF_DEP_LIB" CFLAGS="-I/$WRF_DEP_INC" ./configure --prefix=$WRF_DEP_ROOT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment