Skip to content

Commit

Permalink
Merge pull request #361 from grantfirl/ufs-dev-PR22
Browse files Browse the repository at this point in the history
UFS-dev PR#22 update
  • Loading branch information
grantfirl authored Jan 17, 2023
2 parents 2faa0bc + f3176fc commit c1afc73
Show file tree
Hide file tree
Showing 7 changed files with 473 additions and 100 deletions.
183 changes: 183 additions & 0 deletions .github/workflows/ci_build_scm_ubuntu_22.04.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
name: CI test to build the CCPP-SCM on ubuntu v22.04

on: [pull_request,workflow_dispatch]

jobs:
build_scm:

# The type of runner that the job will run on
runs-on: ubuntu-22.04
strategy:
matrix:
fortran-compiler: [gfortran-10, gfortran-11, gfortran-12]
build-type: [Release, Debug]
py-version: [3.7.13, 3.9.12]

# Environmental variables
env:
NFHOME: /home/runner/netcdf-fortran
NFVERSION: v4.5.3
bacio_ROOT: /home/runner/bacio
sp_ROOT: /home/runner/NCEPLIBS-sp
w3emc_ROOT: /home/runner/myw3emc
SCM_ROOT: /home/runner/work/ccpp-scm/ccpp-scm
intel_ROOT: /home/runner/intel
suites: SCM_GFS_v15p2,SCM_GFS_v16,SCM_GFS_v17_p8,SCM_HRRR,SCM_RRFS_v1beta,SCM_RAP,SCM_WoFS_v0,SCM_GFS_v15p2_ps,SCM_GFS_v16_ps,SCM_GFS_v17_p8_ps,SCM_HRRR_ps,SCM_RRFS_v1beta_ps,SCM_RAP_ps,SCM_WoFS_v0_ps

# Workflow steps
steps:
#######################################################################################
# Initial
#######################################################################################
- name: Checkout SCM code (into /home/runner/work/ccpp-scm/)
uses: actions/checkout@v3

- name: Initialize submodules
run: git submodule update --init --recursive

#######################################################################################
# Python setup
#######################################################################################
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: ${{matrix.py-version}}

- name: Add conda to system path
run: |
echo $CONDA/bin >> $GITHUB_PATH
- name: Install python libraries
run: |
conda install --yes -c conda-forge f90nml
conda install --yes -c conda-forge netCDF4
- name: Update system packages
run: sudo apt-get update

#######################################################################################
# Install FORTRAN dependencies
#######################################################################################
- name: Environment for ifort compiler
if: contains(matrix.fortran-compiler, 'ifort')
run: |
echo "CC=icx" >> $GITHUB_ENV
echo "FC=ifort" >> $GITHUB_ENV
echo "NFVERSION=v4.4.4" >> $GITHUB_ENV
- name: Cache Intel compilers
id: cache-intel-compilers
if: contains(matrix.fortran-compiler, 'ifort')
uses: actions/cache@v2
with:
path: /home/runner/intel
key: intel-${{ runner.os }}-compilers-b

# https://software.intel.com/content/www/us/en/develop/articles/installing-intel-oneapi-toolkits-via-apt.html
# List of packages from Docker file at
# https://github.com/intel/oneapi-containers/blob/master/images/docker/hpckit-devel-ubuntu18.04/Dockerfile
- name: Install Intel compilers and libraries
if: contains(matrix.fortran-compiler, 'ifort') && steps.cache-intel-compilers.outputs.cache-hit != 'true'
run: |
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
sudo apt-get update
sudo apt-get install intel-hpckit-getting-started intel-oneapi-clck intel-oneapi-common-licensing intel-oneapi-common-vars
sudo apt-get install intel-oneapi-dev-utilities intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic intel-oneapi-compiler-fortran intel-oneapi-itac
- name: Cache bacio library v2.4.1
id: cache-bacio-fortran
uses: actions/cache@v3
with:
path: /home/runner/bacio
key: cache-bacio-fortran-${{matrix.fortran-compiler}}-key

- name: Install bacio library v2.4.1
if: steps.cache-bacio-fortran.outputs.cache-hit != 'true'
run: |
git clone --branch v2.4.1 https://github.com/NOAA-EMC/NCEPLIBS-bacio.git bacio
cd bacio && mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=${bacio_ROOT} ../
make -j2
make install
echo "bacio_DIR=/home/runner/bacio/lib/cmake/bacio" >> $GITHUB_ENV
- name: Cache SP-library v2.3.3
id: cache-sp-fortran
uses: actions/cache@v3
with:
path: /home/runner/NCEPLIBS-sp
key: cache-sp-fortran-${{matrix.fortran-compiler}}-key

- name: Install SP-library v2.3.3
if: steps.cache-sp-fortran.outputs.cache-hit != 'true'
run: |
git clone --branch v2.3.3 https://github.com/NOAA-EMC/NCEPLIBS-sp.git NCEPLIBS-sp
cd NCEPLIBS-sp && mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=${sp_ROOT} ../
make -j2
make install
echo "sp_DIR=/home/runner/NCEPLIBS-sp/lib/cmake/sp" >> $GITHUB_ENV
- name: Cache w3emc library v2.9.2
id: cache-w3emc-fortran
uses: actions/cache@v3
with:
path: /home/runner/myw3emc
key: cache-w3emc-fortran-${{matrix.fortran-compiler}}-key

- name: Install w3emc library v2.9.2
if: steps.cache-w3emc-fortran.outputs.cache-hit != 'true'
run: |
git clone --branch v2.9.2 https://github.com/NOAA-EMC/NCEPLIBS-w3emc.git NCEPLIBS-w3emc
cd NCEPLIBS-w3emc && mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=${w3emc_ROOT} ../
make -j2
make install
echo "w3emc_DIR=/home/runner/myw3emc/lib/cmake/w3emc" >> $GITHUB_ENV
- name: Install NetCDF C library
run: |
sudo apt-get update
sudo apt-get install libnetcdf-dev
- name: Cache NetCDF Fortran library
id: cache-netcdf-fortran
uses: actions/cache@v3
with:
path: /home/runner/netcdf-fortran
key: cache-netcdf-fortran-${{matrix.fortran-compiler}}-key

- name: Install NetCDF Fortran library
if: steps.cache-netcdf-fortran.outputs.cache-hit != 'true'
run: |
git clone --branch ${NFVERSION} https://github.com/Unidata/netcdf-fortran.git
cd netcdf-fortran
./configure
make -j
sudo make install
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${NFHOME}/lib
#######################################################################################
# Build SCM.
#######################################################################################

- name: Configure build with CMake (Release)
if: contains(matrix.build-type, 'Release')
run: |
cd ${SCM_ROOT}/scm
mkdir bin && cd bin
cmake -DCCPP_SUITES=${suites} ../src
- name: Configure build with CMake (Debug)
if: contains(matrix.build-type, 'Debug')
run: |
cd ${SCM_ROOT}/scm
mkdir bin && cd bin
cmake -DCCPP_SUITES=${suites} -DCMAKE_BUILD_TYPE=Debug ../src
- name: Build SCM
run: |
cd ${SCM_ROOT}/scm/bin
make -j4
22 changes: 12 additions & 10 deletions .github/workflows/ci_run_scm_rts.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
name: CI test to build and run SCM regression tests

on: [pull_request,workflow_dispatch]
on: [pull_request, workflow_dispatch]

jobs:
run_scm_rts:

# The type of runner that the job will run on
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
matrix:
fortran-compiler: [gnu]
fortran-compiler: [gfortran-11]
build-type: [Release, Debug]
py-version: [3.9.12]

# Environmental variables
env:
NFHOME: /home/runner/netcdf-fortran
NFVERSION: v4.5.3
bacio_ROOT: /home/runner/bacio
sp_ROOT: /home/runner/NCEPLIBS-sp
w3emc_ROOT: /home/runner/myw3emc
Expand All @@ -38,10 +40,10 @@ jobs:
#######################################################################################
# Python setup
#######################################################################################
- name: Set up Python 3.8.5
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: 3.8.5
python-version: ${{matrix.py-version}}

- name: Add conda to system path
run: |
Expand All @@ -61,8 +63,8 @@ jobs:
- name: Environment for gfortran compiler
if: contains(matrix.fortran-compiler, 'gnu')
run: |
echo "FC=gfortran-9" >> $GITHUB_ENV
echo "CC=gcc-9" >> $GITHUB_ENV
echo "FC=gfortran-11" >> $GITHUB_ENV
echo "CC=gcc-11" >> $GITHUB_ENV
- name: Environment for ifort compiler
if: contains(matrix.fortran-compiler, 'intel')
Expand Down Expand Up @@ -124,17 +126,17 @@ jobs:
- name: Install NetCDF C library
run: sudo apt-get install libnetcdf-dev

- name: Cache NetCDF Fortran library v4.4.4
- name: Cache NetCDF Fortran library
id: cache-netcdf-fortran
uses: actions/cache@v3
with:
path: /home/runner/netcdf-fortran
key: cache-netcdf-fortran-${{matrix.fortran-compiler}}-key

- name: Install NetCDF Fortran library v4.4.4
- name: Install NetCDF Fortran library
if: steps.cache-netcdf-fortran.outputs.cache-hit != 'true'
run: |
git clone --branch v4.4.4 https://github.com/Unidata/netcdf-fortran.git
git clone --branch ${NFVERSION} https://github.com/Unidata/netcdf-fortran.git
cd netcdf-fortran
./configure
make -j
Expand Down
6 changes: 4 additions & 2 deletions scm/src/CCPP_typedefs.F90
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,8 @@ subroutine gfs_interstitial_create (Interstitial, IM, Model)
allocate (Interstitial%zngw (IM) )

! CIRES UGWP v1
if (Model%do_ugwp_v1) then
if (Model%ldiag_ugwp .or. Model%do_ugwp_v0 .or. Model%do_ugwp_v0_nst_only &
.or. Model%do_ugwp_v1) then
allocate (Interstitial%dudt_ngw (IM,Model%levs))
allocate (Interstitial%dvdt_ngw (IM,Model%levs))
allocate (Interstitial%dtdt_ngw (IM,Model%levs))
Expand Down Expand Up @@ -1477,7 +1478,8 @@ subroutine gfs_interstitial_phys_reset (Interstitial, Model)
Interstitial%zngw = clear_val

! CIRES UGWP v1
if (Model%do_ugwp_v1) then
if (Model%ldiag_ugwp .or. Model%do_ugwp_v0 .or. Model%do_ugwp_v0_nst_only &
.or. Model%do_ugwp_v1) then
Interstitial%dudt_ngw = clear_val
Interstitial%dvdt_ngw = clear_val
Interstitial%dtdt_ngw = clear_val
Expand Down
8 changes: 4 additions & 4 deletions scm/src/CCPP_typedefs.meta
Original file line number Diff line number Diff line change
Expand Up @@ -2324,31 +2324,31 @@
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
active = (flag_for_ugwp_version_1 .or. control_for_drag_suite_gravity_wave_drag==33 .or. control_for_drag_suite_gravity_wave_drag==22 .or. control_for_drag_suite_gravity_wave_drag==3 .or. control_for_drag_suite_gravity_wave_drag==2)
active = (flag_for_unified_gravity_wave_physics_diagnostics .or. flag_for_ugwp_version_0 .or. flag_for_ugwp_version_0_nonorographic_gwd .or. flag_for_ugwp_version_1)
[dvdt_ngw]
standard_name = tendency_of_y_wind_due_to_nonorographic_gravity_wave_drag
long_name = meridional wind tendency due to non-stationary GWs
units = m s-2
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
active = (flag_for_ugwp_version_1 .or. control_for_drag_suite_gravity_wave_drag==33 .or. control_for_drag_suite_gravity_wave_drag==22 .or. control_for_drag_suite_gravity_wave_drag==3 .or. control_for_drag_suite_gravity_wave_drag==2)
active = (flag_for_unified_gravity_wave_physics_diagnostics .or. flag_for_ugwp_version_0 .or. flag_for_ugwp_version_0_nonorographic_gwd .or. flag_for_ugwp_version_1)
[dtdt_ngw]
standard_name = tendency_of_air_temperature_due_to_nonorographic_gravity_wave_drag
long_name = air temperature tendency due to non-stationary GWs
units = K s-1
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
active = (flag_for_ugwp_version_1 .or. control_for_drag_suite_gravity_wave_drag==33 .or. control_for_drag_suite_gravity_wave_drag==22 .or. control_for_drag_suite_gravity_wave_drag==3 .or. control_for_drag_suite_gravity_wave_drag==2)
active = (flag_for_unified_gravity_wave_physics_diagnostics .or. flag_for_ugwp_version_0 .or. flag_for_ugwp_version_0_nonorographic_gwd .or. flag_for_ugwp_version_1)
[kdis_ngw]
standard_name = atmosphere_momentum_diffusivity_due_to_nonorographic_gravity_wave_drag
long_name = eddy mixing due to non-stationary GWs
units = m2 s-1
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
active = (flag_for_ugwp_version_1 .or. control_for_drag_suite_gravity_wave_drag==33 .or. control_for_drag_suite_gravity_wave_drag==22 .or. control_for_drag_suite_gravity_wave_drag==3 .or. control_for_drag_suite_gravity_wave_drag==2)
active = (flag_for_unified_gravity_wave_physics_diagnostics .or. flag_for_ugwp_version_0 .or. flag_for_ugwp_version_0_nonorographic_gwd .or. flag_for_ugwp_version_1)
[zlwb]
standard_name = height_of_low_level_wave_breaking
long_name = height of low level wave breaking
Expand Down
Loading

0 comments on commit c1afc73

Please sign in to comment.