diff --git a/.github/workflows/Intel1.yml b/.github/workflows/Intel1.yml deleted file mode 100644 index 0cf71f245..000000000 --- a/.github/workflows/Intel1.yml +++ /dev/null @@ -1,202 +0,0 @@ -# UFS_UTILS test workflow. -# -# This workflow tests UFS_UTILS with the Intel compiler. -# -# Ed Hartnett 12/14/22 -name: Intel1 -on: - push: - branches: - - develop - paths-ignore: - - README.md - pull_request: - branches: - - develop - paths-ignore: - - README.md - -# Use custom shell with -l so .bash_profile is sourced which loads intel/oneapi/setvars.sh -# without having to do it in manually every step. -defaults: - run: - shell: bash -leo pipefail {0} - -jobs: - Intel: - runs-on: ubuntu-latest - env: - CC: icc - FC: ifort - - steps: - - # See https://software.intel.com/content/www/us/en/develop/articles/oneapi-repo-instructions.html - - name: install-intel - run: | - cd /tmp - wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB - sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB - rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB - echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list - sudo apt-get update - sudo apt-get install intel-oneapi-dev-utilities intel-oneapi-mpi-devel intel-oneapi-openmp intel-oneapi-compiler-fortran intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic - echo "source /opt/intel/oneapi/setvars.sh" >> ~/.bash_profile - - - name: cache-netcdf - id: cache-netcdf - uses: actions/cache@v2 - with: - path: ~/netcdf - key: Intel-netcdf-c-$4.7.4-{{ runner.os }}-intel3 - - - name: build-hdf5 - if: steps.cache-netcdf.outputs.cache-hit != 'true' - run: | - export CC=mpiicc - wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.7/src/hdf5-1.10.7.tar.gz &> /dev/null - tar -xzf hdf5-1.10.7.tar.gz - pushd hdf5-1.10.7 - ./configure --prefix=${HOME}/netcdf --enable-parallel --disable-tools --disable-fortran --disable-cxx --enable-parallel-tests --disable-shared --disable-shared --enable-static - make -j2 - make install - - - name: build-netcdf-c - if: steps.cache-netcdf.outputs.cache-hit != 'true' - run: | - export CC=mpiicc - export CPPFLAGS=-I${HOME}/netcdf/include - export LDFLAGS=-L${HOME}/netcdf/lib - wget https://github.com/Unidata/netcdf-c/archive/refs/tags/v4.7.4.tar.gz &> /dev/null - tar -xzf v4.7.4.tar.gz - pushd netcdf-c-4.7.4 - ./configure --prefix=${HOME}/netcdf --disable-dap --disable-utilities --disable-shared - make -j2 - make install - - - name: build-netcdf-fortran - if: steps.cache-netcdf.outputs.cache-hit != 'true' - run: | - export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${HOME}/netcdf/lib" - export PATH="${HOME}/netcdf/bin:$PATH" - export CC=mpiicc - export FC=mpiifort - export CPPFLAGS=-I${HOME}/netcdf/include - export LDFLAGS=-L${HOME}/netcdf/lib - export LIBS=`nc-config --libs` - wget https://github.com/Unidata/netcdf-fortran/archive/v4.5.3.tar.gz &> /dev/null - tar -xzf v4.5.3.tar.gz - pushd netcdf-fortran-4.5.3 - ./configure --prefix=${HOME}/netcdf --disable-shared - make -j2 - make install - - - name: cache-esmf - id: cache-esmf - uses: actions/cache@v2 - with: - path: ~/esmf - key: Intel-esmf-8.2.0-${{ runner.os }}-intel3 - - - name: build-esmf - if: steps.cache-esmf.outputs.cache-hit != 'true' - run: | - pushd ~ - export ESMF_DIR=~/esmf-ESMF_8_2_0 - wget https://github.com/esmf-org/esmf/archive/ESMF_8_2_0.tar.gz &> /dev/null - tar zxf ESMF_8_2_0.tar.gz - cd esmf-ESMF_8_2_0 - export ESMF_COMM=intelmpi - export ESMF_INSTALL_BINDIR=bin - export ESMF_INSTALL_LIBDIR=lib - export ESMF_INSTALL_MODDIR=mod - export ESMF_COMPILER=intel - export ESMF_INSTALL_PREFIX=~/esmf - export ESMF_NETCDF=split - export ESMF_NETCDF_INCLUDE=${HOME}/netcdf/include - export ESMF_NETCDF_LIBPATH=${HOME}/netcdf/lib - export ESMF_NETCDF_LIBS="-lnetcdff -lnetcdf -lhdf5_hl -lhdf5 -lz" - make -j2 - make install - - - name: cache-jasper - id: cache-jasper - uses: actions/cache@v2 - with: - path: ~/jasper - key: Intel-jasper-2.0.25-${{ runner.os }}-intel3 - - - name: build-jasper - if: steps.cache-jasper.outputs.cache-hit != 'true' - run: | - wget https://github.com/jasper-software/jasper/archive/version-2.0.25.tar.gz &> /dev/null - tar zxf version-2.0.25.tar.gz - cd jasper-version-2.0.25 - mkdir build-jasper && cd build-jasper - cmake .. -DCMAKE_INSTALL_PREFIX=~/jasper -DJAS_ENABLE_SHARED=OFF - make -j2 - make install - - - name: checkout-nceplibs - uses: actions/checkout@v2 - with: - repository: NOAA-EMC/NCEPLIBS - path: nceplibs - - - name: cache-nceplibs - id: cache-nceplibs - uses: actions/cache@v2 - with: - path: ~/nceplibs - key: Intel-nceplibs-1.4.0-${{ runner.os }}-intel3 - - - name: build-nceplibs - if: steps.cache-nceplibs.outputs.cache-hit != 'true' - run: | - export ESMFMKFILE=~/esmf/lib/esmf.mk - wget https://github.com/NOAA-EMC/NCEPLIBS/archive/v1.4.0.tar.gz &> /dev/null - tar zxf v1.4.0.tar.gz - cd NCEPLIBS-1.4.0 - mkdir build && cd build - cmake .. -DCMAKE_PREFIX_PATH='~;~/jasper;~/netcdf' -DCMAKE_INSTALL_PREFIX='~/nceplibs' -DFLAT=ON - make -j2 - - - name: checkout-ufs-utils - uses: actions/checkout@v2 - with: - path: ufs_utils - submodules: recursive - - - name: cache-data - id: cache-data - uses: actions/cache@v2 - with: - path: ~/data - key: data-1 - - - name: build - run: | - export ESMFMKFILE=~/esmf/lib/esmf.mk - cd ufs_utils - mkdir build && cd build - export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:~/jasper/lib;~/jasper/lib64" - cmake -DTEST_FILE_DIR=/home/runner/data -DCMAKE_PREFIX_PATH='~;~/jasper;~/nceplibs;~/netcdf' .. - make -j2 - - - name: test - run: | - cd ufs_utils/build - ctest --rerun-failed --output-on-failure - - - name: cache-data - if: steps.cache-data.outputs.cache-hit != 'true' - run: | - mkdir ~/data - cp ufs_utils/build/tests/chgres_cube/data/* ~/data - cp ufs_utils/build/tests/sfc_climo_gen/data/* ~/data - cp ufs_utils/build/tests/cpld_gridgen/data/* ~/data - cp ufs_utils/tests/filter_topo/data/* ~/data - cp ufs_utils/tests/emcsfc_snow2mdl/data/* ~/data - cp ufs_utils/tests/chgres_cube/data/* ~/data - ls -l ~/data - diff --git a/.github/workflows/Intel_nceplibs.yml b/.github/workflows/Intel_nceplibs.yml deleted file mode 100644 index e15059809..000000000 --- a/.github/workflows/Intel_nceplibs.yml +++ /dev/null @@ -1,197 +0,0 @@ -name: Intel_nceplibs -on: - push: - branches: - - develop - paths-ignore: - - README.md - pull_request: - branches: - - develop - paths-ignore: - - README.md - -# Use custom shell with -l so .bash_profile is sourced which loads intel/oneapi/setvars.sh -# without having to do it in manually every step. -defaults: - run: - shell: bash -leo pipefail {0} - -jobs: - Intel_nceplibs: - runs-on: ubuntu-latest - env: - CC: icc - FC: ifort - - steps: - - # See https://software.intel.com/content/www/us/en/develop/articles/oneapi-repo-instructions.html - - name: install-intel - run: | - cd /tmp - wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB - sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB - rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB - echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list - sudo apt-get update - sudo apt-get install intel-oneapi-dev-utilities intel-oneapi-mpi-devel intel-oneapi-openmp intel-oneapi-compiler-fortran intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic - echo "source /opt/intel/oneapi/setvars.sh" >> ~/.bash_profile - - - name: cache-netcdf - id: cache-netcdf - uses: actions/cache@v2 - with: - path: ~/netcdf - key: netcdf-c-$4.7.4-{{ runner.os }}-intel3 - - - name: build-hdf5 - if: steps.cache-netcdf.outputs.cache-hit != 'true' - run: | - export CC=mpiicc - wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.7/src/hdf5-1.10.7.tar.gz &> /dev/null - tar -xzf hdf5-1.10.7.tar.gz - pushd hdf5-1.10.7 - ./configure --prefix=${HOME}/netcdf --enable-parallel --disable-tools --disable-fortran --disable-cxx --enable-parallel-tests --disable-shared --disable-shared --enable-static - make -j2 - make install - - - name: build-netcdf-c - if: steps.cache-netcdf.outputs.cache-hit != 'true' - run: | - export CC=mpiicc - export CPPFLAGS=-I${HOME}/netcdf/include - export LDFLAGS=-L${HOME}/netcdf/lib - wget https://github.com/Unidata/netcdf-c/archive/refs/tags/v4.7.4.tar.gz &> /dev/null - tar -xzf v4.7.4.tar.gz - pushd netcdf-c-4.7.4 - ./configure --prefix=${HOME}/netcdf --disable-dap --disable-utilities --disable-shared - make -j2 - make install - - - name: build-netcdf-fortran - if: steps.cache-netcdf.outputs.cache-hit != 'true' - run: | - export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${HOME}/netcdf/lib" - export PATH="${HOME}/netcdf/bin:$PATH" - export CC=mpiicc - export FC=mpiifort - export CPPFLAGS=-I${HOME}/netcdf/include - export LDFLAGS=-L${HOME}/netcdf/lib - export LIBS=`nc-config --libs` - wget https://github.com/Unidata/netcdf-fortran/archive/v4.5.3.tar.gz &> /dev/null - tar -xzf v4.5.3.tar.gz - pushd netcdf-fortran-4.5.3 - ./configure --prefix=${HOME}/netcdf --disable-shared - make -j2 - make install - - - name: cache-esmf - id: cache-esmf - uses: actions/cache@v2 - with: - path: ~/esmf - key: esmf-8.2.0-${{ runner.os }}-intel3 - - - name: build-esmf - if: steps.cache-esmf.outputs.cache-hit != 'true' - run: | - pushd ~ - export ESMF_DIR=~/esmf-ESMF_8_2_0 - wget https://github.com/esmf-org/esmf/archive/ESMF_8_2_0.tar.gz &> /dev/null - tar zxf ESMF_8_2_0.tar.gz - cd esmf-ESMF_8_2_0 - export ESMF_COMM=intelmpi - export ESMF_INSTALL_BINDIR=bin - export ESMF_INSTALL_LIBDIR=lib - export ESMF_INSTALL_MODDIR=mod - export ESMF_COMPILER=intel - export ESMF_INSTALL_PREFIX=~/esmf - export ESMF_NETCDF=split - export ESMF_NETCDF_INCLUDE=${HOME}/netcdf/include - export ESMF_NETCDF_LIBPATH=${HOME}/netcdf/lib - export ESMF_NETCDF_LIBS="-lnetcdff -lnetcdf -lhdf5_hl -lhdf5 -lz" - make -j2 - make install - - - name: cache-jasper - id: cache-jasper - uses: actions/cache@v2 - with: - path: ~/jasper - key: jasper-2.0.25-${{ runner.os }}-intel3 - - - name: build-jasper - if: steps.cache-jasper.outputs.cache-hit != 'true' - run: | - wget https://github.com/jasper-software/jasper/archive/version-2.0.25.tar.gz &> /dev/null - tar zxf version-2.0.25.tar.gz - cd jasper-version-2.0.25 - mkdir build-jasper && cd build-jasper - cmake .. -DCMAKE_INSTALL_PREFIX=~/jasper -DJAS_ENABLE_SHARED=OFF - make -j2 - make install - - - name: checkout-nceplibs - uses: actions/checkout@v2 - with: - repository: NOAA-EMC/NCEPLIBS - path: nceplibs - - - name: cache-nceplibs - id: cache-nceplibs - uses: actions/cache@v2 - with: - path: ~/nceplibs - key: nceplibs-1.4.0-${{ runner.os }}-intel3 - - - name: build-nceplibs - if: steps.cache-nceplibs.outputs.cache-hit != 'true' - run: | - export ESMFMKFILE=~/esmf/lib/esmf.mk - wget https://github.com/NOAA-EMC/NCEPLIBS/archive/v1.4.0.tar.gz &> /dev/null - tar zxf v1.4.0.tar.gz - cd NCEPLIBS-1.4.0 - mkdir build && cd build - cmake .. -DCMAKE_PREFIX_PATH='~;~/jasper;~/netcdf' -DCMAKE_INSTALL_PREFIX='~/nceplibs' -DFLAT=ON - make -j2 - - - name: checkout-ufs-utils - uses: actions/checkout@v2 - with: - path: ufs_utils - submodules: recursive - - - name: cache-data - id: cache-data - uses: actions/cache@v2 - with: - path: ~/data - key: data-1 - - - name: build - run: | - export ESMFMKFILE=~/esmf/lib/esmf.mk - cd ufs_utils - mkdir build && cd build - export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:~/jasper/lib;~/jasper/lib64" - cmake -DTEST_FILE_DIR=/home/runner/data -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH='~;~/jasper;~/nceplibs;~/netcdf' .. - make -j2 - - - name: test - run: | - cd ufs_utils/build - ctest --rerun-failed --output-on-failure - - - name: cache-data - if: steps.cache-data.outputs.cache-hit != 'true' - run: | - mkdir ~/data - cp ufs_utils/build/tests/chgres_cube/data/* ~/data - cp ufs_utils/build/tests/sfc_climo_gen/data/* ~/data - cp ufs_utils/build/tests/cpld_gridgen/data/* ~/data - cp ufs_utils/tests/filter_topo/data/* ~/data - cp ufs_utils/tests/emcsfc_snow2mdl/data/* ~/data - cp ufs_utils/tests/chgres_cube/data/* ~/data - ls -l ~/data - diff --git a/.github/workflows/Linux_nceplibs.yml b/.github/workflows/Linux_nceplibs.yml deleted file mode 100644 index e1e33af51..000000000 --- a/.github/workflows/Linux_nceplibs.yml +++ /dev/null @@ -1,125 +0,0 @@ -# UFS_UTILS test workflow. -# -# Check UFS_UTILS build based on the NCEPLIBS project (deprecated, but still works). -# -# Ed Hartnett 12/13/22 -name: Linux_nceplibs -on: - push: - branches: - - develop - paths-ignore: - - README.md - pull_request: - branches: - - develop - paths-ignore: - - README.md - -defaults: - run: - shell: bash -exo pipefail {0} - -jobs: - Linux_nceplibs: - runs-on: ubuntu-latest - - steps: - - - name: install-dependencies - run: | - sudo apt-get update - sudo apt-get install libmpich-dev libpng-dev libjpeg-dev - sudo apt-get install libnetcdf-dev libnetcdff-dev netcdf-bin pkg-config - - - name: cache-esmf - id: cache-esmf - uses: actions/cache@v2 - with: - path: ~/esmf - key: esmf-8.2.0-${{ runner.os }}3 - - - name: build-esmf - if: steps.cache-esmf.outputs.cache-hit != 'true' - run: | - pushd ~ - export ESMF_DIR=~/esmf-ESMF_8_2_0 - wget https://github.com/esmf-org/esmf/archive/ESMF_8_2_0.tar.gz &> /dev/null - tar zxf ESMF_8_2_0.tar.gz - cd esmf-ESMF_8_2_0 - export ESMF_COMM=mpich3 - export ESMF_INSTALL_BINDIR=bin - export ESMF_INSTALL_LIBDIR=lib - export ESMF_INSTALL_MODDIR=mod - export ESMF_COMPILER=gfortran - export ESMF_INSTALL_PREFIX=~/esmf - export ESMF_NETCDF=split - export ESMF_NETCDF_INCLUDE=/usr/include - export ESMF_NETCDF_LIBPATH=/usr/x86_64-linux-gnu - make -j2 - make install - - - name: cache-jasper - id: cache-jasper - uses: actions/cache@v2 - with: - path: ~/jasper - key: jasper-2.0.25-${{ runner.os }}3 - - - name: build-jasper - if: steps.cache-jasper.outputs.cache-hit != 'true' - run: | - wget https://github.com/jasper-software/jasper/archive/version-2.0.25.tar.gz &> /dev/null - tar zxf version-2.0.25.tar.gz - cd jasper-version-2.0.25 - mkdir build-jasper && cd build-jasper - cmake .. -DCMAKE_INSTALL_PREFIX=~/jasper -DJAS_ENABLE_SHARED=OFF - make -j2 - make install - - - name: cache-nceplibs - id: cache-nceplibs - uses: actions/cache@v2 - with: - path: ~/nceplibs - key: nceplibs-1.4.0-${{ runner.os }}3 - - - name: build-nceplibs - if: steps.cache-nceplibs.outputs.cache-hit != 'true' - run: | - wget https://github.com/NOAA-EMC/NCEPLIBS/archive/v1.4.0.tar.gz &> /dev/null - tar zxf v1.4.0.tar.gz - cd NCEPLIBS-1.4.0 - export ESMFMKFILE=~/esmf/lib/esmf.mk - mkdir build && cd build - cmake .. -DCMAKE_PREFIX_PATH='~;~/jasper' -DCMAKE_INSTALL_PREFIX='~/nceplibs' -DFLAT=ON - make -j2 - - - name: checkout-ufs-utils - uses: actions/checkout@v2 - with: - path: ufs_utils - submodules: recursive - - - name: cache-data - id: cache-data - uses: actions/cache@v2 - with: - path: ~/data - key: data-1 - - - name: build - run: | - export ESMFMKFILE=~/esmf/lib/esmf.mk - cd ufs_utils - mkdir build && cd build - export CC=mpicc - export CXX=mpicxx - export FC=mpifort - export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:~/jasper/lib;~/jasper/lib64" - cmake -DTEST_FILE_DIR=/home/runner/data -DCMAKE_PREFIX_PATH='~/jasper;~/nceplibs' .. - make -j2 - - name: test - run: | - cd ufs_utils/build - ctest --rerun-failed --output-on-failure diff --git a/.github/workflows/Linux_versions.yml b/.github/workflows/Linux_versions.yml deleted file mode 100644 index 03baff39d..000000000 --- a/.github/workflows/Linux_versions.yml +++ /dev/null @@ -1,383 +0,0 @@ -# UFS_UTILS test workflow. -# -# Check different versions of the NCEPLIBS libraries that are used by UFS_UTILS. -# -# Ed Hartnett 12/13/22 -name: Linux_versions -on: - push: - branches: - - develop - paths-ignore: - - README.md - pull_request: - branches: - - develop - paths-ignore: - - README.md - -defaults: - run: - shell: bash -exo pipefail {0} - -jobs: - Linux_versions: - runs-on: ubuntu-latest - env: - FC: mpifort - CC: mpicc - FCFLAGS: -fallow-argument-mismatch - strategy: - fail-fast: true - matrix: - esmf_version: [8_2_0, 8.3.0, 8.4.0] - bacio_version: [2.4.1] - g2_version: [3.4.3] - sp_version: [2.3.3] - ip_version: [3.3.3] - w3emc_version: [2.9.3] - nemsio_version: [2.5.0] - sfcio_version: [1.4.0] - sigio_version: [2.3.0] - - steps: - - - name: install-dependencies - run: | - sudo apt-get update - sudo apt-get install libpng-dev zlib1g-dev libjpeg-dev libmpich-dev - sudo apt-get install libnetcdf-dev libnetcdff-dev netcdf-bin pkg-config - sudo apt-get install autoconf automake libtool - - - name: checkout-esmf - id: cache-esmf - uses: actions/cache@v2 - with: - path: ~/esmf - key: Linux_versions-esmf-${{ matrix.esmf_version }}-${{ runner.os }} - - - name: build-esmf - if: steps.cache-esmf.outputs.cache-hit != 'true' - run: | - pushd ~ - if [[ ${{ matrix.esmf_version }} == "8_2_0" ]]; then - wget https://github.com/esmf-org/esmf/archive/ESMF_${{ matrix.esmf_version }}.tar.gz &> /dev/null - tar zxf ESMF_${{ matrix.esmf_version }}.tar.gz - cd esmf-ESMF_${{ matrix.esmf_version }} - export ESMF_DIR=~/esmf-ESMF_${{ matrix.esmf_version }} - else - wget https://github.com/esmf-org/esmf/archive/refs/tags/v${{ matrix.esmf_version }}.tar.gz &> /dev/null - ls -l - tar zxf v${{ matrix.esmf_version }}.tar.gz - cd esmf-${{ matrix.esmf_version }} - export ESMF_DIR=~/esmf-${{ matrix.esmf_version }} - fi - export ESMF_COMM=mpich3 - export ESMF_INSTALL_BINDIR=bin - export ESMF_INSTALL_LIBDIR=lib - export ESMF_INSTALL_MODDIR=mod - export ESMF_COMPILER=gfortran - export ESMF_INSTALL_PREFIX=~/esmf - export ESMF_NETCDF=split - export ESMF_NETCDF_INCLUDE=/usr/include - export ESMF_NETCDF_LIBPATH=/usr/x86_64-linux-gnu - export ESMF_PIO=OFF - export ESMF_MOAB=OFF - export ESMF_ARRAY_LITE=TRUE - make -j2 - make install - - - name: cache-jasper - id: cache-jasper - uses: actions/cache@v2 - with: - path: ~/jasper - key: Linux_versions-jasper-${{ runner.os }}-2.0.33-1 - - - name: checkout-jasper - if: steps.cache-jasper.outputs.cache-hit != 'true' - uses: actions/checkout@v2 - with: - repository: jasper-software/jasper - path: jasper - ref: version-2.0.33 - - - name: build-jasper - if: steps.cache-jasper.outputs.cache-hit != 'true' - run: | - cd jasper - mkdir build-jasper && cd build-jasper - cmake .. -DCMAKE_INSTALL_PREFIX=~/jasper - make -j2 - make install - - - name: cache-bacio - id: cache-bacio - uses: actions/cache@v2 - with: - path: ~/bacio - key: Linux_versions-bacio-${{ runner.os }}-${{ matrix.bacio_version }} - - - name: checkout-bacio - if: steps.cache-bacio.outputs.cache-hit != 'true' - uses: actions/checkout@v2 - with: - repository: NOAA-EMC/NCEPLIBS-bacio - path: bacio - ref: v${{ matrix.bacio_version }} - - - name: build-bacio - if: steps.cache-bacio.outputs.cache-hit != 'true' - run: | - cd bacio - mkdir build && cd build - cmake .. -DCMAKE_INSTALL_PREFIX=~/bacio - make -j2 - make install - - - name: cache-g2 - id: cache-g2 - uses: actions/cache@v2 - with: - path: ~/g2 - key: Linux_versions-g2-${{ runner.os }}-${{ matrix.g2_version }} - - - name: checkout-g2 - if: steps.cache-g2.outputs.cache-hit != 'true' - uses: actions/checkout@v2 - with: - repository: NOAA-EMC/NCEPLIBS-g2 - path: g2 - ref: v${{ matrix.g2_version }} - - - name: build-g2 - if: steps.cache-g2.outputs.cache-hit != 'true' - run: | - cd g2 - mkdir build - cd build - cmake -DCMAKE_INSTALL_PREFIX=~/g2 -DCMAKE_PREFIX_PATH="~/bacio;~/jasper" .. - make -j2 - make install - - - name: cache-sp - id: cache-sp - uses: actions/cache@v2 - with: - path: ~/sp - key: Linux_versions-sp-${{ runner.os }}-${{ matrix.sp_version }} - - - name: checkout-sp - if: steps.cache-sp.outputs.cache-hit != 'true' - uses: actions/checkout@v2 - with: - repository: NOAA-EMC/NCEPLIBS-sp - path: sp - ref: v${{ matrix.sp_version }} - - - name: build-sp - if: steps.cache-sp.outputs.cache-hit != 'true' - run: | - cd sp - mkdir build - cd build - cmake .. -DCMAKE_INSTALL_PREFIX=~/sp - make -j2 - make install - - - name: cache-ip - id: cache-ip - uses: actions/cache@v2 - with: - path: ~/ip - key: Linux_versions-ip-${{ runner.os }}-${{ matrix.ip_version }} - - - name: checkout-ip - if: steps.cache-ip.outputs.cache-hit != 'true' - uses: actions/checkout@v2 - with: - repository: NOAA-EMC/NCEPLIBS-ip - path: ip - ref: v${{ matrix.ip_version }} - - - name: build-ip - if: steps.cache-ip.outputs.cache-hit != 'true' - run: | - cd ip - mkdir build - cd build - cmake -DCMAKE_INSTALL_PREFIX=~/ip -DCMAKE_PREFIX_PATH=~/sp .. - make -j2 - make install - - # - name: checkout-w3emc - # uses: actions/checkout@v2 - # with: - # repository: NOAA-EMC/NCEPLIBS-w3emc - # path: w3emc - # ref: develop - - # - name: build-w3emc - # run: | - # cd w3emc - # mkdir build - # cd build - # cmake -DCMAKE_PREFIX_PATH=~/bacio -DCMAKE_INSTALL_PREFIX=~/w3emc .. - # make -j2 - # make install - - # - name: checkout-g2c - # uses: actions/checkout@v2 - # with: - # repository: NOAA-EMC/NCEPLIBS-g2c - # path: g2c - # ref: develop - - # - name: build-g2c - # run: | - # cd g2c - # mkdir build - # cd build - # cmake .. -DCMAKE_INSTALL_PREFIX=~/g2c -DJasper_ROOT=~/jasper - # make -j2 - # make install - - - name: cache-sfcio - id: cache-sfcio - uses: actions/cache@v2 - with: - path: ~/sfcio - key: Linux_versions-sfcio-${{ runner.os }}-${{ matrix.sfcio_version }} - - - name: checkout-sfcio - if: steps.cache-sfcio.outputs.cache-hit != 'true' - uses: actions/checkout@v2 - with: - repository: NOAA-EMC/NCEPLIBS-sfcio - path: sfcio - ref: v${{ matrix.sfcio_version }} - - - name: build-sfcio - if: steps.cache-sfcio.outputs.cache-hit != 'true' - run: | - cd sfcio - mkdir build - cd build - cmake .. -DCMAKE_INSTALL_PREFIX=~/sfcio - make -j2 - make install - - - name: cache-w3emc - id: cache-w3emc - uses: actions/cache@v2 - with: - path: ~/w3emc - key: Linux_versions-w3emc-${{ runner.os }}-${{ matrix.w3emc_version }} - - - name: checkout-w3emc - if: steps.cache-w3emc.outputs.cache-hit != 'true' - uses: actions/checkout@v2 - with: - repository: NOAA-EMC/NCEPLIBS-w3emc - path: w3emc - ref: v${{ matrix.w3emc_version }} - - - name: build-w3emc - if: steps.cache-w3emc.outputs.cache-hit != 'true' - run: | - cd w3emc - mkdir build - cd build - cmake .. -DCMAKE_INSTALL_PREFIX=~/w3emc -DCMAKE_PREFIX_PATH=~/bacio - make -j2 - make install - - - name: cache-nemsio - id: cache-nemsio - uses: actions/cache@v2 - with: - path: ~/nemsio - key: Linux_versions-nemsio-${{ runner.os }}-${{ matrix.nemsio_version }} - - - name: checkout-nemsio - if: steps.cache-nemsio.outputs.cache-hit != 'true' - uses: actions/checkout@v2 - with: - repository: NOAA-EMC/NCEPLIBS-nemsio - path: nemsio - ref: v${{ matrix.nemsio_version }} - - - name: build-nemsio - if: steps.cache-nemsio.outputs.cache-hit != 'true' - run: | - cd nemsio - mkdir build - cd build - cmake -DCMAKE_INSTALL_PREFIX=~/nemsio -DCMAKE_PREFIX_PATH="~/bacio;~/w3emc" .. - make -j2 - make install - - - name: cache-sigio - id: cache-sigio - uses: actions/cache@v2 - with: - path: ~/sigio - key: Linux_versions-sigio-${{ runner.os }}-${{ matrix.sigio_version }} - - - name: checkout-sigio - if: steps.cache-sigio.outputs.cache-hit != 'true' - uses: actions/checkout@v2 - with: - repository: NOAA-EMC/NCEPLIBS-sigio - path: sigio - ref: v${{ matrix.sigio_version }} - - - name: build-sigio - if: steps.cache-sigio.outputs.cache-hit != 'true' - run: | - cd sigio - mkdir build - cd build - cmake .. -DCMAKE_INSTALL_PREFIX=~/sigio - make -j2 - make install - - - name: checkout - uses: actions/checkout@v2 - with: - path: ufs_utils - submodules: true - - - name: cache-data - id: cache-data - uses: actions/cache@v2 - with: - path: ~/data - key: data-1 - - - name: build - run: | - set -x - cd ufs_utils - mkdir build - cd build - export ESMFMKFILE=~/esmf/lib/esmf.mk - cmake -DTEST_FILE_DIR=/home/runner/data -DCMAKE_PREFIX_PATH="~/jasper;~/g2c;~/bacio;~/g2;~/w3emc;~/sfcio;~/sigio;~/nemsio;~/sp;~/ip" .. - make -j2 VERBOSE=1 - - - name: test - run: | - cd ufs_utils/build - ctest --verbose --rerun-failed --output-on-failure - - - name: cache-data - if: steps.cache-data.outputs.cache-hit != 'true' - run: | - mkdir ~/data - cp ufs_utils/build/tests/chgres_cube/data/* ~/data - cp ufs_utils/build/tests/sfc_climo_gen/data/* ~/data - cp ufs_utils/build/tests/cpld_gridgen/data/* ~/data - cp ufs_utils/tests/filter_topo/data/* ~/data - cp ufs_utils/tests/emcsfc_snow2mdl/data/* ~/data - cp ufs_utils/tests/chgres_cube/data/* ~/data - ls -l ~/data diff --git a/.github/workflows/Linux_versions_ext.yml b/.github/workflows/Linux_versions_ext.yml deleted file mode 100644 index 954458e2a..000000000 --- a/.github/workflows/Linux_versions_ext.yml +++ /dev/null @@ -1,367 +0,0 @@ -# UFS_UTILS test workflow. -# -# Check different versions of the external libraries that are used by UFS_UTILS. -# -# Ed Hartnett 12/16/22 -name: Linux_versions_ext -on: - push: - branches: - - develop - paths-ignore: - - README.md - pull_request: - branches: - - develop - paths-ignore: - - README.md - -defaults: - run: - shell: bash -exo pipefail {0} - -jobs: - Linux_versions_ext: - runs-on: ubuntu-latest - env: - FC: mpifort - CC: mpicc - FCFLAGS: -fallow-argument-mismatch - strategy: - fail-fast: true - matrix: - esmf_version: [8_2_0, 8.3.1, 8.4.0] - bacio_version: [2.4.1] - g2_version: [3.4.3] - sp_version: [2.3.3] - ip_version: [3.3.3] - w3emc_version: [2.9.3] - nemsio_version: [2.5.0] - sfcio_version: [1.4.0] - sigio_version: [2.3.0] - - steps: - - - name: install-dependencies - run: | - sudo apt-get update - sudo apt-get install libpng-dev zlib1g-dev libjpeg-dev libmpich-dev - sudo apt-get install libnetcdf-dev libnetcdff-dev netcdf-bin pkg-config - sudo apt-get install autoconf automake libtool - - - name: checkout-esmf - id: cache-esmf - uses: actions/cache@v2 - with: - path: ~/esmf - key: Linux_versions-esmf-${{ matrix.esmf_version }}-${{ runner.os }} - - - name: build-esmf - if: steps.cache-esmf.outputs.cache-hit != 'true' - run: | - pushd ~ - if [[ ${{ matrix.esmf_version }} == "8_2_0" ]]; then - wget https://github.com/esmf-org/esmf/archive/ESMF_${{ matrix.esmf_version }}.tar.gz &> /dev/null - tar zxf ESMF_${{ matrix.esmf_version }}.tar.gz - cd esmf-ESMF_${{ matrix.esmf_version }} - export ESMF_DIR=~/esmf-ESMF_${{ matrix.esmf_version }} - else - wget https://github.com/esmf-org/esmf/archive/refs/tags/v${{ matrix.esmf_version }}.tar.gz &> /dev/null - ls -l - tar zxf v${{ matrix.esmf_version }}.tar.gz - cd esmf-${{ matrix.esmf_version }} - export ESMF_DIR=~/esmf-${{ matrix.esmf_version }} - fi - export ESMF_COMM=mpich3 - export ESMF_INSTALL_BINDIR=bin - export ESMF_INSTALL_LIBDIR=lib - export ESMF_INSTALL_MODDIR=mod - export ESMF_COMPILER=gfortran - export ESMF_INSTALL_PREFIX=~/esmf - export ESMF_NETCDF=split - export ESMF_NETCDF_INCLUDE=/usr/include - export ESMF_NETCDF_LIBPATH=/usr/x86_64-linux-gnu - export ESMF_PIO=OFF - export ESMF_MOAB=OFF - export ESMF_ARRAY_LITE=TRUE - make -j2 - make install - - - name: cache-jasper - id: cache-jasper - uses: actions/cache@v2 - with: - path: ~/jasper - key: Linux_versions-jasper-${{ runner.os }}-2.0.33-1 - - - name: checkout-jasper - if: steps.cache-jasper.outputs.cache-hit != 'true' - uses: actions/checkout@v2 - with: - repository: jasper-software/jasper - path: jasper - ref: version-2.0.33 - - - name: build-jasper - if: steps.cache-jasper.outputs.cache-hit != 'true' - run: | - cd jasper - mkdir build-jasper && cd build-jasper - cmake .. -DCMAKE_INSTALL_PREFIX=~/jasper - make -j2 - make install - - - name: cache-bacio - id: cache-bacio - uses: actions/cache@v2 - with: - path: ~/bacio - key: Linux_versions-bacio-${{ runner.os }}-${{ matrix.bacio_version }} - - - name: checkout-bacio - if: steps.cache-bacio.outputs.cache-hit != 'true' - uses: actions/checkout@v2 - with: - repository: NOAA-EMC/NCEPLIBS-bacio - path: bacio - ref: v${{ matrix.bacio_version }} - - - name: build-bacio - if: steps.cache-bacio.outputs.cache-hit != 'true' - run: | - cd bacio - mkdir build && cd build - cmake .. -DCMAKE_INSTALL_PREFIX=~/bacio - make -j2 - make install - - - name: cache-g2 - id: cache-g2 - uses: actions/cache@v2 - with: - path: ~/g2 - key: Linux_versions-g2-${{ runner.os }}-${{ matrix.g2_version }} - - - name: checkout-g2 - if: steps.cache-g2.outputs.cache-hit != 'true' - uses: actions/checkout@v2 - with: - repository: NOAA-EMC/NCEPLIBS-g2 - path: g2 - ref: v${{ matrix.g2_version }} - - - name: build-g2 - if: steps.cache-g2.outputs.cache-hit != 'true' - run: | - cd g2 - mkdir build - cd build - cmake -DCMAKE_INSTALL_PREFIX=~/g2 -DCMAKE_PREFIX_PATH="~/bacio;~/jasper" .. - make -j2 - make install - - - name: cache-sp - id: cache-sp - uses: actions/cache@v2 - with: - path: ~/sp - key: Linux_versions-sp-${{ runner.os }}-${{ matrix.sp_version }} - - - name: checkout-sp - if: steps.cache-sp.outputs.cache-hit != 'true' - uses: actions/checkout@v2 - with: - repository: NOAA-EMC/NCEPLIBS-sp - path: sp - ref: v${{ matrix.sp_version }} - - - name: build-sp - if: steps.cache-sp.outputs.cache-hit != 'true' - run: | - cd sp - mkdir build - cd build - cmake .. -DCMAKE_INSTALL_PREFIX=~/sp - make -j2 - make install - - - name: cache-ip - id: cache-ip - uses: actions/cache@v2 - with: - path: ~/ip - key: Linux_versions-ip-${{ runner.os }}-${{ matrix.ip_version }} - - - name: checkout-ip - if: steps.cache-ip.outputs.cache-hit != 'true' - uses: actions/checkout@v2 - with: - repository: NOAA-EMC/NCEPLIBS-ip - path: ip - ref: v${{ matrix.ip_version }} - - - name: build-ip - if: steps.cache-ip.outputs.cache-hit != 'true' - run: | - cd ip - mkdir build - cd build - cmake -DCMAKE_INSTALL_PREFIX=~/ip -DCMAKE_PREFIX_PATH=~/sp .. - make -j2 - make install - - # - name: checkout-g2c - # uses: actions/checkout@v2 - # with: - # repository: NOAA-EMC/NCEPLIBS-g2c - # path: g2c - # ref: develop - - # - name: build-g2c - # run: | - # cd g2c - # mkdir build - # cd build - # cmake .. -DCMAKE_INSTALL_PREFIX=~/g2c -DJasper_ROOT=~/jasper - # make -j2 - # make install - - - name: cache-sfcio - id: cache-sfcio - uses: actions/cache@v2 - with: - path: ~/sfcio - key: Linux_versions-sfcio-${{ runner.os }}-${{ matrix.sfcio_version }} - - - name: checkout-sfcio - if: steps.cache-sfcio.outputs.cache-hit != 'true' - uses: actions/checkout@v2 - with: - repository: NOAA-EMC/NCEPLIBS-sfcio - path: sfcio - ref: v${{ matrix.sfcio_version }} - - - name: build-sfcio - if: steps.cache-sfcio.outputs.cache-hit != 'true' - run: | - cd sfcio - mkdir build - cd build - cmake .. -DCMAKE_INSTALL_PREFIX=~/sfcio - make -j2 - make install - - - name: cache-w3emc - id: cache-w3emc - uses: actions/cache@v2 - with: - path: ~/w3emc - key: Linux_versions-w3emc-${{ runner.os }}-${{ matrix.w3emc_version }} - - - name: checkout-w3emc - if: steps.cache-w3emc.outputs.cache-hit != 'true' - uses: actions/checkout@v2 - with: - repository: NOAA-EMC/NCEPLIBS-w3emc - path: w3emc - ref: v${{ matrix.w3emc_version }} - - - name: build-w3emc - if: steps.cache-w3emc.outputs.cache-hit != 'true' - run: | - cd w3emc - mkdir build - cd build - cmake .. -DCMAKE_INSTALL_PREFIX=~/w3emc -DCMAKE_PREFIX_PATH=~/bacio - make -j2 - make install - - - name: cache-nemsio - id: cache-nemsio - uses: actions/cache@v2 - with: - path: ~/nemsio - key: Linux_versions-nemsio-${{ runner.os }}-${{ matrix.nemsio_version }} - - - name: checkout-nemsio - if: steps.cache-nemsio.outputs.cache-hit != 'true' - uses: actions/checkout@v2 - with: - repository: NOAA-EMC/NCEPLIBS-nemsio - path: nemsio - ref: v${{ matrix.nemsio_version }} - - - name: build-nemsio - if: steps.cache-nemsio.outputs.cache-hit != 'true' - run: | - cd nemsio - mkdir build - cd build - cmake -DCMAKE_INSTALL_PREFIX=~/nemsio -DCMAKE_PREFIX_PATH="~/bacio;~/w3emc" .. - make -j2 - make install - - - name: cache-sigio - id: cache-sigio - uses: actions/cache@v2 - with: - path: ~/sigio - key: Linux_versions-sigio-${{ runner.os }}-${{ matrix.sigio_version }} - - - name: checkout-sigio - if: steps.cache-sigio.outputs.cache-hit != 'true' - uses: actions/checkout@v2 - with: - repository: NOAA-EMC/NCEPLIBS-sigio - path: sigio - ref: v${{ matrix.sigio_version }} - - - name: build-sigio - if: steps.cache-sigio.outputs.cache-hit != 'true' - run: | - cd sigio - mkdir build - cd build - cmake .. -DCMAKE_INSTALL_PREFIX=~/sigio - make -j2 - make install - - - name: checkout - uses: actions/checkout@v2 - with: - path: ufs_utils - submodules: true - - - name: cache-data - id: cache-data - uses: actions/cache@v2 - with: - path: ~/data - key: data-1 - - - name: build - run: | - set -x - cd ufs_utils - mkdir build - cd build - export ESMFMKFILE=~/esmf/lib/esmf.mk - cmake -DTEST_FILE_DIR=/home/runner/data -DCMAKE_PREFIX_PATH="~/jasper;~/g2c;~/bacio;~/g2;~/w3emc;~/sfcio;~/sigio;~/nemsio;~/sp;~/ip" .. - make -j2 VERBOSE=1 - - - name: test - run: | - cd ufs_utils/build - ctest --verbose --rerun-failed --output-on-failure - - - name: cache-data - if: steps.cache-data.outputs.cache-hit != 'true' - run: | - mkdir ~/data - cp ufs_utils/build/tests/chgres_cube/data/* ~/data - cp ufs_utils/build/tests/sfc_climo_gen/data/* ~/data - cp ufs_utils/build/tests/cpld_gridgen/data/* ~/data - cp ufs_utils/tests/filter_topo/data/* ~/data - cp ufs_utils/tests/emcsfc_snow2mdl/data/* ~/data - cp ufs_utils/tests/chgres_cube/data/* ~/data - ls -l ~/data diff --git a/.github/workflows/developer.yml b/.github/workflows/developer.yml deleted file mode 100644 index 14544b08c..000000000 --- a/.github/workflows/developer.yml +++ /dev/null @@ -1,350 +0,0 @@ -# UFS_UTILS test workflow. -# -# This workflow tests all developer options including -# documentation check, and test code coverage. -# -# -# Ed Hartnett 12/11/22 -name: developer -on: - push: - branches: - - develop - paths-ignore: - - README.md - pull_request: - branches: - - develop - paths-ignore: - - README.md - -defaults: - run: - shell: bash -exo pipefail {0} - -jobs: - developer: - runs-on: ubuntu-latest - env: - FC: mpifort - CC: mpicc - FCFLAGS: -fallow-argument-mismatch - - steps: - - - name: install-dependencies - run: | - sudo apt-get update - sudo apt-get install libpng-dev zlib1g-dev libjpeg-dev doxygen libmpich-dev - sudo apt-get install libnetcdf-dev libnetcdff-dev netcdf-bin pkg-config - # python3 -m pip install gcovr - - - name: cache-esmf - id: cache-esmf - uses: actions/cache@v2 - with: - path: ~/esmf - key: developer-esmf-8.2.0-${{ runner.os }}3 - - - name: build-esmf - if: steps.cache-esmf.outputs.cache-hit != 'true' - run: | - pushd ~ - export ESMF_DIR=~/esmf-ESMF_8_2_0 - wget https://github.com/esmf-org/esmf/archive/ESMF_8_2_0.tar.gz &> /dev/null - tar zxf ESMF_8_2_0.tar.gz - cd esmf-ESMF_8_2_0 - export ESMF_COMM=mpich3 - export ESMF_INSTALL_BINDIR=bin - export ESMF_INSTALL_LIBDIR=lib - export ESMF_INSTALL_MODDIR=mod - export ESMF_COMPILER=gfortran - export ESMF_INSTALL_PREFIX=~/esmf - export ESMF_NETCDF=split - export ESMF_NETCDF_INCLUDE=/usr/include - export ESMF_NETCDF_LIBPATH=/usr/x86_64-linux-gnu - make -j2 - make install - - - name: cache-jasper - id: cache-jasper - uses: actions/cache@v2 - with: - path: ~/jasper - key: developer-jasper-${{ runner.os }}-2.0.33-1 - - - name: checkout-jasper - if: steps.cache-jasper.outputs.cache-hit != 'true' - uses: actions/checkout@v2 - with: - repository: jasper-software/jasper - path: jasper - ref: version-2.0.33 - - - name: build-jasper - if: steps.cache-jasper.outputs.cache-hit != 'true' - run: | - cd jasper - mkdir build-jasper && cd build-jasper - cmake .. -DCMAKE_INSTALL_PREFIX=~/jasper - make -j2 - make install - - - name: cache-bacio - id: cache-bacio - uses: actions/cache@v2 - with: - path: ~/bacio - key: developer-bacio-${{ runner.os }}-v2.4.1 - - - name: checkout-bacio - if: steps.cache-bacio.outputs.cache-hit != 'true' - uses: actions/checkout@v2 - with: - repository: NOAA-EMC/NCEPLIBS-bacio - path: bacio - ref: v2.4.1 - - - name: build-bacio - if: steps.cache-bacio.outputs.cache-hit != 'true' - run: | - cd bacio - mkdir build && cd build - cmake .. -DCMAKE_INSTALL_PREFIX=~/bacio - make -j2 - make install - - - name: cache-g2 - id: cache-g2 - uses: actions/cache@v2 - with: - path: ~/g2 - key: developer-g2-${{ runner.os }}-3.4.5 - - - name: checkout-g2 - if: steps.cache-g2.outputs.cache-hit != 'true' - uses: actions/checkout@v2 - with: - repository: NOAA-EMC/NCEPLIBS-g2 - path: g2 - ref: v3.4.5 - - - name: build-g2 - if: steps.cache-g2.outputs.cache-hit != 'true' - run: | - cd g2 - mkdir build - cd build - cmake -DCMAKE_INSTALL_PREFIX=~/g2 -DCMAKE_PREFIX_PATH="~/bacio;~/jasper" .. - make -j2 - make install - - - name: cache-sp - id: cache-sp - uses: actions/cache@v2 - with: - path: ~/sp - key: developer-sp-${{ runner.os }}-2.3.3-1 - - - name: checkout-sp - if: steps.cache-sp.outputs.cache-hit != 'true' - uses: actions/checkout@v2 - with: - repository: NOAA-EMC/NCEPLIBS-sp - path: sp - ref: v2.3.3 - - - name: build-sp - if: steps.cache-sp.outputs.cache-hit != 'true' - run: | - cd sp - mkdir build - cd build - cmake .. -DCMAKE_INSTALL_PREFIX=~/sp - make -j2 - make install - - - name: cache-ip - id: cache-ip - uses: actions/cache@v2 - with: - path: ~/ip - key: developer-ip-${{ runner.os }}-3.3.3 - - - name: checkout-ip - if: steps.cache-ip.outputs.cache-hit != 'true' - uses: actions/checkout@v2 - with: - repository: NOAA-EMC/NCEPLIBS-ip - path: ip - ref: v3.3.3 - - - name: build-ip - if: steps.cache-ip.outputs.cache-hit != 'true' - run: | - cd ip - mkdir build - cd build - cmake -DCMAKE_INSTALL_PREFIX=~/ip -DCMAKE_PREFIX_PATH=~~/sp .. - make -j2 - make install - - - name: checkout-w3emc - uses: actions/checkout@v2 - with: - repository: NOAA-EMC/NCEPLIBS-w3emc - path: w3emc - ref: v2.9.3 - - - name: build-w3emc - run: | - cd w3emc - mkdir build - cd build - cmake -DCMAKE_PREFIX_PATH=~/bacio -DCMAKE_INSTALL_PREFIX=~/w3emc .. - make -j2 - make install - - # - name: checkout-g2c - # uses: actions/checkout@v2 - # with: - # repository: NOAA-EMC/NCEPLIBS-g2c - # path: g2c - # ref: develop - - # - name: build-g2c - # run: | - # cd g2c - # mkdir build - # cd build - # cmake .. -DCMAKE_INSTALL_PREFIX=~/g2c -DJasper_ROOT=~/jasper - # make -j2 - # make install - - - name: cache-sfcio - id: cache-sfcio - uses: actions/cache@v2 - with: - path: ~/sfcio - key: developer-sfcio-${{ runner.os }}-1.4.1 - - - name: checkout-sfcio - if: steps.cache-sfcio.outputs.cache-hit != 'true' - uses: actions/checkout@v2 - with: - repository: NOAA-EMC/NCEPLIBS-sfcio - path: sfcio - ref: v1.4.1 - - - name: build-sfcio - if: steps.cache-sfcio.outputs.cache-hit != 'true' - run: | - cd sfcio - mkdir build - cd build - cmake .. -DCMAKE_INSTALL_PREFIX=~/sfcio - make -j2 - make install - - - name: cache-nemsio - id: cache-nemsio - uses: actions/cache@v2 - with: - path: ~/nemsio - key: developer-nemsio-${{ runner.os }}-2.5.4 - - - name: checkout-nemsio - if: steps.cache-nemsio.outputs.cache-hit != 'true' - uses: actions/checkout@v2 - with: - repository: NOAA-EMC/NCEPLIBS-nemsio - path: nemsio - ref: v2.5.4 - - - name: build-nemsio - if: steps.cache-nemsio.outputs.cache-hit != 'true' - run: | - cd nemsio - mkdir build - cd build - cmake -DCMAKE_INSTALL_PREFIX=~/nemsio -DCMAKE_PREFIX_PATH="~/bacio;~/w3emc" .. - make -j2 - make install - - - name: cache-sigio - id: cache-sigio - uses: actions/cache@v2 - with: - path: ~/sigio - key: developer-sigio-${{ runner.os }}-2.3.2 - - - name: checkout-sigio - if: steps.cache-sigio.outputs.cache-hit != 'true' - uses: actions/checkout@v2 - with: - repository: NOAA-EMC/NCEPLIBS-sigio - path: sigio - ref: v2.3.2 - - - name: build-sigio - if: steps.cache-sigio.outputs.cache-hit != 'true' - run: | - cd sigio - mkdir build - cd build - cmake .. -DCMAKE_INSTALL_PREFIX=~/sigio - make -j2 - make install - - - name: checkout - uses: actions/checkout@v2 - with: - path: ufs_utils - submodules: true - - - name: cache-data - id: cache-data - uses: actions/cache@v2 - with: - path: ~/data - key: data-1 - - - name: build - run: | - cd ufs_utils - mkdir build - doxygen --version - export ESMFMKFILE=~/esmf/lib/esmf.mk - cd build - cmake -DTEST_FILE_DIR=/home/runner/data -DENABLE_DOCS=On -DCMAKE_PREFIX_PATH="~/jasper;~/g2c;~/bacio;~/g2;~/w3emc;~/sfcio;~/sigio;~/nemsio;~/sp;~/ip" -DCMAKE_Fortran_FLAGS="-g -fprofile-arcs -ftest-coverage -O0" -DCMAKE_C_FLAGS="-g -fprofile-arcs -ftest-coverage -O0" -DCMAKE_BUILD_TYPE=Debug .. - make -j2 VERBOSE=1 - - - name: test - run: | - cd ufs_utils/build - ctest --verbose --rerun-failed --output-on-failure - # gcovr --root .. -v --html-details --exclude ../tests --exclude CMakeFiles --print-summary -o test-coverage.html &> /dev/null - - - name: cache-data - if: steps.cache-data.outputs.cache-hit != 'true' - run: | - mkdir ~/data - cp ufs_utils/build/tests/chgres_cube/data/* ~/data - cp ufs_utils/build/tests/sfc_climo_gen/data/* ~/data - cp ufs_utils/build/tests/cpld_gridgen/data/* ~/data - cp ufs_utils/tests/filter_topo/data/* ~/data - cp ufs_utils/tests/emcsfc_snow2mdl/data/* ~/data - cp ufs_utils/tests/chgres_cube/data/* ~/data - ls -l ~/data - - - name: upload-test-coverage - uses: actions/upload-artifact@v2 - with: - name: ufs_utils-test-coverage - path: | - ufs_utils/build/*.html - ufs_utils/build/*.css - - - - diff --git a/.github/workflows/linux-mac-nceplibs-mpi.yml b/.github/workflows/linux-mac-nceplibs-mpi.yml deleted file mode 100644 index 43d611949..000000000 --- a/.github/workflows/linux-mac-nceplibs-mpi.yml +++ /dev/null @@ -1,259 +0,0 @@ -name: linux-mac-mpi-nceplibs -on: - push: - branches: - - develop - paths-ignore: - - README.md - pull_request: - branches: - - develop - paths-ignore: - - README.md - -defaults: - run: - shell: bash -exo pipefail {0} - -jobs: - matrix-build-and-test: - runs-on: ${{ matrix.os }} - env: - CC: gcc-9 - FC: gfortran-9 - CXX: g++-9 - strategy: - fail-fast: true - matrix: - os: [macos-11, ubuntu-latest] - compiler: [gcc-9] - nceplibs_version: [develop, 1.4.0] - mpi_type: [mpich, openmpi] - netcdf_version: [4.7.4] - - steps: - - - name: install-dependencies - run: | - echo "$HOME/mpi/bin" >> $GITHUB_PATH - if [[ ${{ matrix.os }} == "ubuntu-latest" ]]; then - sudo apt-get update - sudo apt-get install libpng-dev - sudo apt-get install libjpeg-dev - elif [[ ${{ matrix.os }} == "macos-11" ]]; then - brew update - brew install wget - brew install jpeg-turbo - if [[ ${{ matrix.compiler }} == "gcc-9" ]]; then - sudo ln -sf /usr/local/bin/gfortran-9 /usr/local/bin/gfortran - elif [[ ${{ matrix.compiler }} == "gcc-10" ]]; then - sudo ln -sf /usr/local/bin/gfortran-10 /usr/local/bin/gfortran - fi - fi - - - name: cache-mpi - id: cache-mpi - uses: actions/cache@v2 - with: - path: ~/mpi - key: mpi-${{ matrix.mpi_type }}-${{ runner.os }} - - - name: build-mpi - if: steps.cache-mpi.outputs.cache-hit != 'true' - run: | - if [[ ${{ matrix.mpi_type}} == "mpich" ]]; then - wget http://www.mpich.org/static/downloads/3.3.2/mpich-3.3.2.tar.gz &> /dev/null - tar -xzf mpich-3.3.2.tar.gz - cd mpich-3.3.2 - ./configure --prefix=$HOME/mpi --enable-fortran --enable-cxx - make -j2 - make install - elif [[ ${{ matrix.mpi_type }} == "openmpi" ]]; then - wget https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-4.1.1.tar.gz &> /dev/null - tar -xzf openmpi-4.1.1.tar.gz - cd openmpi-4.1.1 - if [[ ${{ matrix.os }} == "ubuntu-latest" ]]; then - ./configure --prefix=$HOME/mpi --enable-mpi-fortran --enable-mpi-cxx - elif [[ ${{ matrix.os }} == "macos-11" ]]; then - ./configure --prefix=$HOME/mpi --enable-mpi-fortran --enable-mpi-cxx --enable-two-level-namespace - fi - make -j2 - make install - fi - - - name: cache-netcdf - id: cache-netcdf - uses: actions/cache@v2 - with: - path: ~/netcdf - key: netcdf-c-${{ matrix.netcdf_version }}-${{ runner.os }}-${{ matrix.mpi_type }}3 - - - name: build-hdf5 - if: steps.cache-netcdf.outputs.cache-hit != 'true' - run: | - export CC=mpicc - wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.7/src/hdf5-1.10.7.tar.gz &> /dev/null - tar -xzf hdf5-1.10.7.tar.gz - pushd hdf5-1.10.7 - ./configure --prefix=${HOME}/netcdf --enable-parallel --disable-tools --disable-fortran --disable-cxx --enable-parallel-tests --disable-shared --enable-static - make -j2 - make install - - - name: build-netcdf-c - if: steps.cache-netcdf.outputs.cache-hit != 'true' - run: | - export CC=mpicc - export CPPFLAGS=-I${HOME}/netcdf/include - export LDFLAGS=-L${HOME}/netcdf/lib - wget https://github.com/Unidata/netcdf-c/archive/refs/tags/v${{ matrix.netcdf_version }}.tar.gz &> /dev/null - tar -xzf v${{ matrix.netcdf_version }}.tar.gz - cd netcdf-c-${{ matrix.netcdf_version }} - ./configure --prefix=${HOME}/netcdf --disable-dap --disable-utilities --disable-shared - make -j2 - make install - - - name: build-netcdf-fortran - if: steps.cache-netcdf.outputs.cache-hit != 'true' - run: | - set -x - export PATH="${HOME}/netcdf/bin:$PATH" - export CC=mpicc - export FC=mpifort - export CPPFLAGS=-I${HOME}/netcdf/include - export LDFLAGS=-L${HOME}/netcdf/lib - export LIBS=`nc-config --libs` - wget https://github.com/Unidata/netcdf-fortran/archive/v4.5.3.tar.gz &> /dev/null - tar -xzf v4.5.3.tar.gz - pushd netcdf-fortran-4.5.3 - ./configure --prefix=${HOME}/netcdf --disable-shared - make -j2 - make install - - - name: cache-esmf - id: cache-esmf - uses: actions/cache@v2 - with: - path: ~/esmf - key: esmf--8.2.0-${{ runner.os }}-${{ matrix.mpi_type }}-netcdf-${{ matrix.netcdf_version }}3 - - - name: build-esmf - if: steps.cache-esmf.outputs.cache-hit != 'true' - run: | - set -x - pushd ~ - export ESMF_DIR=~/esmf-ESMF_8_2_0 - wget https://github.com/esmf-org/esmf/archive/ESMF_8_2_0.tar.gz &> /dev/null - tar zxf ESMF_8_2_0.tar.gz - cd esmf-ESMF_8_2_0 - if [[ ${{ matrix.mpi_type}} == "mpich" ]]; then - export ESMF_COMM=mpich3 - elif [[ ${{ matrix.mpi_type}} == "openmpi" ]]; then - export ESMF_COMM=openmpi - fi - export ESMF_INSTALL_BINDIR=bin - export ESMF_INSTALL_LIBDIR=lib - export ESMF_INSTALL_MODDIR=mod - export ESMF_COMPILER=gfortran - export ESMF_INSTALL_PREFIX=~/esmf - export ESMF_NETCDF=split - export ESMF_NETCDF_INCLUDE=${HOME}/netcdf/include - export ESMF_NETCDF_LIBPATH=${HOME}/netcdf/lib - export ESMF_NETCDF_LIBS="-lnetcdff -lnetcdf -lhdf5_hl -lhdf5 -lz" - make -j2 - make install - - - name: cache-jasper - id: cache-jasper - uses: actions/cache@v2 - with: - path: ~/jasper - key: jasper-2.0.25-${{ runner.os }}3 - - - name: build-jasper - if: steps.cache-jasper.outputs.cache-hit != 'true' - run: | - set -x - pwd - wget https://github.com/jasper-software/jasper/archive/version-2.0.25.tar.gz &> /dev/null - tar zxf version-2.0.25.tar.gz - cd jasper-version-2.0.25 - mkdir build-jasper && cd build-jasper - cmake .. -DCMAKE_INSTALL_PREFIX=~/jasper -DJAS_ENABLE_SHARED=OFF - make -j2 - make install - - - name: checkout-nceplibs - run: | - git clone https://github.com/NOAA-EMC/NCEPLIBS.git nceplibs - cd nceplibs - if [[ ${{ matrix.nceplibs_version }} == "1.4.0" ]]; then - git checkout v1.4.0 - fi - - - name: get-git-hash - run: | - cd nceplibs - git rev-parse HEAD > hash.txt - - - name: cache-nceplibs - id: cache-nceplibs - uses: actions/cache@v2 - with: - path: ~/nceplibs - key: nceplibs-${{ matrix.nceplibs_version }}-${{ runner.os }}-${{ matrix.mpi_type }}-${{ hashFiles('nceplibs/hash.txt') }}3 - - - name: build-nceplibs - if: steps.cache-nceplibs.outputs.cache-hit != 'true' - run: | - set -x - export ESMFMKFILE=~/esmf/lib/esmf.mk - cd nceplibs - mkdir build && cd build - cmake .. -DCMAKE_PREFIX_PATH='~;~/jasper;~/netcdf' -DCMAKE_INSTALL_PREFIX='~/nceplibs' -DFLAT=ON - make -j2 - - - name: checkout-ufs-utils - uses: actions/checkout@v2 - with: - path: ufs_utils - submodules: recursive - - - name: cache-data - id: cache-data - uses: actions/cache@v2 - with: - path: ~/data - key: data-2 - - - name: build - run: | - export ESMFMKFILE=~/esmf/lib/esmf.mk - cd ufs_utils - mkdir build && cd build - export CC=mpicc - export CXX=mpicxx - export FC=mpifort - export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:~/jasper/lib;~/jasper/lib64" - export DYLD_LIBRARY_PATH="${LD_LIBRARY_PATH}:~/jasper/lib;~/jasper/lib64" - cmake -DTEST_FILE_DIR=/home/runner/data -DCMAKE_PREFIX_PATH='~/jasper;~/nceplibs;~/netcdf' .. - make -j2 - - - name: test - run: | - cd ufs_utils/build - # Oversubscribe for OpenMPI to run more processes than CPUs - export OMPI_MCA_rmaps_base_oversubscribe=1 - ctest --rerun-failed --output-on-failure - - - name: cache-data - if: steps.cache-data.outputs.cache-hit != 'true' - run: | - mkdir ~/data - cp ufs_utils/build/tests/chgres_cube/data/* ~/data - cp ufs_utils/build/tests/sfc_climo_gen/data/* ~/data - cp ufs_utils/build/tests/cpld_gridgen/data/* ~/data - cp ufs_utils/tests/filter_topo/data/* ~/data - cp ufs_utils/tests/emcsfc_snow2mdl/data/* ~/data - cp ufs_utils/tests/chgres_cube/data/* ~/data - ls -l ~/data - diff --git a/.github/workflows/macos_clang.yaml b/.github/workflows/macos_clang.yaml new file mode 100644 index 000000000..25f6bc693 --- /dev/null +++ b/.github/workflows/macos_clang.yaml @@ -0,0 +1,97 @@ +name: Clang macOS Build and Test +on: [push, pull_request, workflow_dispatch] + + +# Use custom shell with -l so .bash_profile is sourced +# without having to do it in manually every step +defaults: + run: + shell: bash -leo pipefail {0} + +env: + cache_key: clang + CC: clang + FC: gfortran-11 + CXX: clang + +# The jobs are split into: +# 1. a dependency build step (setup), and +# 2. a UFS-utils build and test step (ufs_utils) +# The setup is run once and the environment is cached, +# so each subsequent build and test of UFS-utils can reuse the cached +# dependencies to save time (and compute). + +jobs: + setup: + runs-on: macos-12 + + steps: + - name: checkout # this is to get the ci/spack.yaml file + uses: actions/checkout@v3 + with: + path: ufs_utils + + # Cache spack, compiler and dependencies + - name: cache-env + id: cache-env + uses: actions/cache@v3 + with: + path: | + spack + ~/.spack + key: spack-${{ runner.os }}-${{ env.cache_key }}-${{ hashFiles('ufs_utils/ci/spack.yaml') }} + + # Install dependencies using Spack + - name: install-dependencies-with-spack + if: steps.cache-env.outputs.cache-hit != 'true' + run: | + git clone -c feature.manyFiles=true https://github.com/JCSDA/spack.git + source spack/share/spack/setup-env.sh + sed "s/\[intel, gcc@10:10, apple-clang@14\]/\[apple-clang@14\]/g" ufs_utils/ci/spack.yaml > spack_ci.yaml + spack env create ufs_utils-env spack_ci.yaml + spack env activate ufs_utils-env + spack external find + spack add openmpi@4.1.5 + spack concretize + spack install -v --fail-fast --dirty + spack clean --all + + ufs_utils: + needs: setup + runs-on: macos-12 + + steps: + - name: checkout + uses: actions/checkout@v3 + with: + path: ufs_utils + submodules: recursive + + - name: cache-env + id: cache-env + uses: actions/cache@v3 + with: + path: | + spack + ~/.spack + key: spack-${{ runner.os }}-${{ env.cache_key }}-${{ hashFiles('ufs_utils/ci/spack.yaml') }} + + - name: build + run: | + source spack/share/spack/setup-env.sh + spack env activate ufs_utils-env + export CC=mpicc + export FC=mpif90 + cd ufs_utils + mkdir -p build && cd build + cmake -DCMAKE_INSTALL_PREFIX=../install .. + make -j2 VERBOSE=1 + make install + + - name: ctest + run: | + source spack/share/spack/setup-env.sh + spack env activate ufs_utils-env + cd ufs_utils + cd build + ctest --verbose --rerun-failed --output-on-failure diff --git a/.github/workflows/netcdf-versions.yml b/.github/workflows/netcdf-versions.yml deleted file mode 100644 index c9a0a6f9c..000000000 --- a/.github/workflows/netcdf-versions.yml +++ /dev/null @@ -1,186 +0,0 @@ -name: netcdf-versions -on: - push: - branches: - - develop - paths-ignore: - - README.md - pull_request: - branches: - - develop - paths-ignore: - - README.md - -defaults: - run: - shell: bash -exo pipefail {0} - -jobs: - netcdf-build-and-test: - runs-on: ubuntu-latest - - strategy: - matrix: - os: [ubuntu-latest] - netcdf_version: [4.8.0] - - steps: - - name: install-dependencies - run: | - sudo apt-get update - sudo apt-get install libmpich-dev libpng-dev libjpeg-dev - - - name: cache-netcdf - id: cache-netcdf - uses: actions/cache@v2 - with: - path: ~/netcdf - key: netcdf-c-${{ matrix.netcdf_version }}-${{ runner.os }}4 - - - name: build-hdf5 - if: steps.cache-netcdf.outputs.cache-hit != 'true' - run: | - export CC=mpicc - wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.7/src/hdf5-1.10.7.tar.gz &> /dev/null - tar -xzf hdf5-1.10.7.tar.gz - pushd hdf5-1.10.7 - ./configure --prefix=${HOME}/netcdf --enable-parallel --disable-tools --disable-fortran --disable-cxx --disable-shared - make -j2 - make install - - - name: build-netcdf-c - if: steps.cache-netcdf.outputs.cache-hit != 'true' - run: | - export CC=mpicc - export CPPFLAGS=-I${HOME}/netcdf/include - export LDFLAGS=-L${HOME}/netcdf/lib - wget https://github.com/Unidata/netcdf-c/archive/refs/tags/v${{ matrix.netcdf_version }}.tar.gz &> /dev/null - tar -xzf v${{ matrix.netcdf_version }}.tar.gz - cd netcdf-c-${{ matrix.netcdf_version }} - ./configure --prefix=${HOME}/netcdf --disable-dap --disable-utilities --disable-shared - make -j2 - make install - - - name: build-netcdf-fortran - if: steps.cache-netcdf.outputs.cache-hit != 'true' - run: | - set -x - export PATH="${HOME}/netcdf/bin:$PATH" - export CC=mpicc - export FC=mpifort - export CPPFLAGS=-I${HOME}/netcdf/include - export LDFLAGS=-L${HOME}/netcdf/lib - export LIBS=`nc-config --libs` - wget https://github.com/Unidata/netcdf-fortran/archive/v4.5.3.tar.gz &> /dev/null - tar -xzf v4.5.3.tar.gz - pushd netcdf-fortran-4.5.3 - ./configure --prefix=${HOME}/netcdf --disable-shared - make -j2 - make install - - - name: cache-esmf - id: cache-esmf - uses: actions/cache@v2 - with: - path: ~/esmf - key: esmf-8.2.0-${{ runner.os }}-netcdf-${{ matrix.netcdf_version }}3 - - - name: build-esmf - if: steps.cache-esmf.outputs.cache-hit != 'true' - run: | - pushd ~ - export ESMF_DIR=~/esmf-ESMF_8_2_0 - wget https://github.com/esmf-org/esmf/archive/ESMF_8_2_0.tar.gz &> /dev/null - tar zxf ESMF_8_2_0.tar.gz - cd esmf-ESMF_8_2_0 - export ESMF_COMM=mpich3 - export ESMF_INSTALL_BINDIR=bin - export ESMF_INSTALL_LIBDIR=lib - export ESMF_INSTALL_MODDIR=mod - export ESMF_COMPILER=gfortran - export ESMF_INSTALL_PREFIX=~/esmf - export ESMF_NETCDF=split - export ESMF_NETCDF_INCLUDE=${HOME}/netcdf/include - export ESMF_NETCDF_LIBPATH=${HOME}/netcdf/lib - export ESMF_NETCDF_LIBS="-lnetcdff -lnetcdf -lhdf5_hl -lhdf5 -lz" - make -j2 - make install - - - name: cache-jasper - id: cache-jasper - uses: actions/cache@v2 - with: - path: ~/jasper - key: jasper-2.0.25-${{ runner.os }}3 - - - name: build-jasper - if: steps.cache-jasper.outputs.cache-hit != 'true' - run: | - wget https://github.com/jasper-software/jasper/archive/version-2.0.25.tar.gz &> /dev/null - tar zxf version-2.0.25.tar.gz - cd jasper-version-2.0.25 - mkdir build-jasper && cd build-jasper - cmake .. -DCMAKE_INSTALL_PREFIX=~/jasper -DJAS_ENABLE_SHARED=OFF - make -j2 - make install - - - name: cache-nceplibs - id: cache-nceplibs - uses: actions/cache@v2 - with: - path: ~/nceplibs - key: nceplibs-1.4.0-${{ runner.os }}-netcdf-${{ matrix.netcdf_version }}3 - - - name: build-nceplibs - if: steps.cache-nceplibs.outputs.cache-hit != 'true' - run: | - wget https://github.com/NOAA-EMC/NCEPLIBS/archive/v1.4.0.tar.gz &> /dev/null - tar zxf v1.4.0.tar.gz - cd NCEPLIBS-1.4.0 - export ESMFMKFILE=~/esmf/lib/esmf.mk - mkdir build && cd build - cmake .. -DCMAKE_PREFIX_PATH='~;~/jasper;~/netcdf' -DCMAKE_INSTALL_PREFIX='~/nceplibs' -DFLAT=ON - make -j2 - - - name: checkout-ufs-utils - uses: actions/checkout@v2 - with: - path: ufs_utils - submodules: recursive - - - name: cache-data - id: cache-data - uses: actions/cache@v2 - with: - path: ~/data - key: data-1 - - - name: build - run: | - export ESMFMKFILE=~/esmf/lib/esmf.mk - cd ufs_utils - mkdir build && cd build - export CC=mpicc - export CXX=mpicxx - export FC=mpifort - export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:~/jasper/lib;~/jasper/lib64" - cmake -DTEST_FILE_DIR=/home/runner/work/UFS_UTILS/UFS_UTILS/data -DCMAKE_PREFIX_PATH='~/jasper;~/nceplibs;~/netcdf' .. - make -j2 - - name: test - run: | - cd ufs_utils/build - ctest --rerun-failed --output-on-failure - - - name: cache-data - if: steps.cache-data.outputs.cache-hit != 'true' - run: | - mkdir ~/data - cp ufs_utils/build/tests/chgres_cube/data/* ~/data - cp ufs_utils/build/tests/sfc_climo_gen/data/* ~/data - cp ufs_utils/build/tests/cpld_gridgen/data/* ~/data - cp ufs_utils/tests/filter_topo/data/* ~/data - cp ufs_utils/tests/emcsfc_snow2mdl/data/* ~/data - cp ufs_utils/tests/chgres_cube/data/* ~/data - ls -l ~/data - - diff --git a/.github/workflows/ubuntu_gcc.yaml b/.github/workflows/ubuntu_gcc.yaml new file mode 100644 index 000000000..b501ef5ef --- /dev/null +++ b/.github/workflows/ubuntu_gcc.yaml @@ -0,0 +1,98 @@ +name: GCC Linux Build and Test +on: [push, pull_request, workflow_dispatch] + + +# Use custom shell with -l so .bash_profile is sourced +# without having to do it in manually every step +defaults: + run: + shell: bash -leo pipefail {0} + +env: + cache_key: gcc + CC: gcc-10 + FC: gfortran-10 + CXX: g++-10 + +# The jobs are split into: +# 1. a dependency build step (setup), and +# 2. a UFS-utils build and test step (ufs_utils) +# The setup is run once and the environment is cached, +# so each subsequent build and test of UFS-utils can reuse the cached +# dependencies to save time (and compute). + +jobs: + setup: + runs-on: ubuntu-latest + + steps: + - name: checkout # this is to get the ci/spack.yaml file + uses: actions/checkout@v3 + with: + path: ufs_utils + + # Cache spack, compiler and dependencies + - name: cache-env + id: cache-env + uses: actions/cache@v3 + with: + path: | + spack + ~/.spack + key: spack-${{ runner.os }}-${{ env.cache_key }}-${{ hashFiles('ufs_utils/ci/spack.yaml') }} + + # Install dependencies using Spack + - name: install-dependencies-with-spack + if: steps.cache-env.outputs.cache-hit != 'true' + run: | + git clone -c feature.manyFiles=true https://github.com/JCSDA/spack.git + source spack/share/spack/setup-env.sh + sed "s/\[intel, gcc@10:10, apple-clang@14\]/\[gcc@10:10\]/g" ufs_utils/ci/spack.yaml > spack_ci.yaml + spack env create ufs_utils-env spack_ci.yaml + spack env activate ufs_utils-env + sudo apt install cmake + spack external find + spack add mpich@3.4.2 + spack concretize + spack install -v --fail-fast --dirty + spack clean --all + + ufs_utils: + needs: setup + runs-on: ubuntu-latest + + steps: + - name: checkout + uses: actions/checkout@v3 + with: + path: ufs_utils + submodules: recursive + + - name: cache-env + id: cache-env + uses: actions/cache@v3 + with: + path: | + spack + ~/.spack + key: spack-${{ runner.os }}-${{ env.cache_key }}-${{ hashFiles('ufs_utils/ci/spack.yaml') }} + + - name: build + run: | + source spack/share/spack/setup-env.sh + spack env activate ufs_utils-env + export CC=mpicc + export FC=mpif90 + cd ufs_utils + mkdir -p build && cd build + cmake -DCMAKE_INSTALL_PREFIX=../install .. + make -j2 VERBOSE=1 + make install + + - name: ctest + run: | + source spack/share/spack/setup-env.sh + spack env activate ufs_utils-env + cd ufs_utils + cd build + ctest --verbose --rerun-failed --output-on-failure diff --git a/.github/workflows/ubuntu_intel.yaml b/.github/workflows/ubuntu_intel.yaml new file mode 100644 index 000000000..f936c08f1 --- /dev/null +++ b/.github/workflows/ubuntu_intel.yaml @@ -0,0 +1,116 @@ +name: Intel Linux Build and Test +on: [push, pull_request, workflow_dispatch] + +# Use custom shell with -l so .bash_profile is sourced which loads intel/oneapi/setvars.sh +# without having to do it in manually every step +defaults: + run: + shell: bash -leo pipefail {0} + +# Set I_MPI_CC/F90 so Intel MPI wrapper uses icc/ifort instead of gcc/gfortran +env: + cache_key: intel + CC: icc + FC: ifort + CXX: icpc + I_MPI_CC: icc + I_MPI_F90: ifort + +# The jobs are split into: +# 1. a dependency build step (setup), and +# 2. a UFS-utils build and test step (ufs_utils) +# The setup is run once and the environment is cached, +# so each subsequent build and test of UFS-utils can reuse the cached +# dependencies to save time (and compute). + +jobs: + setup: + runs-on: ubuntu-20.04 + + steps: + - name: checkout # this is to get the ci/spack.yaml file + uses: actions/checkout@v3 + with: + path: ufs_utils + + # Cache spack, compiler and dependencies + - name: cache-env + id: cache-env + uses: actions/cache@v3 + with: + path: | + spack + ~/.spack + /opt/intel + key: spack-${{ runner.os }}-${{ env.cache_key }}-${{ hashFiles('ufs_utils/ci/spack.yaml') }} + + - name: install-intel-compilers + run: | + wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB + sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB + echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list + sudo apt-get update + sudo apt-get install intel-oneapi-dev-utilities intel-oneapi-mpi-devel intel-oneapi-openmp intel-oneapi-compiler-fortran intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic + echo "source /opt/intel/oneapi/setvars.sh" >> ~/.bash_profile + + # Install dependencies using Spack + - name: install-dependencies-with-spack + if: steps.cache-env.outputs.cache-hit != 'true' + run: | + git clone -c feature.manyFiles=true https://github.com/NOAA-EMC/spack.git + source spack/share/spack/setup-env.sh + sed "s/\[intel, gcc@10:10, apple-clang@14\]/\[intel\]/g" ufs_utils/ci/spack.yaml > spack_ci.yaml + spack env create ufs_utils-env spack_ci.yaml + spack env activate ufs_utils-env + spack compiler find + sudo apt install cmake + spack external find + spack add intel-oneapi-mpi + spack concretize + spack install --dirty -v --fail-fast + spack clean --all + + ufs_utils: + needs: setup + runs-on: ubuntu-20.04 + + steps: + - name: install-intel + run: | + echo "source /opt/intel/oneapi/setvars.sh" >> ~/.bash_profile + + - name: checkout + uses: actions/checkout@v3 + with: + path: ufs_utils + submodules: recursive + + - name: cache-env + id: cache-env + uses: actions/cache@v3 + with: + path: | + spack + ~/.spack + /opt/intel + key: spack-${{ runner.os }}-${{ env.cache_key }}-${{ hashFiles('ufs_utils/ci/spack.yaml') }} + + - name: build + run: | + source spack/share/spack/setup-env.sh + spack env activate ufs_utils-env + export CC=mpiicc + export FC=mpiifort + cd ufs_utils + mkdir -p build && cd build + cmake -DCMAKE_INSTALL_PREFIX=../install .. + make -j2 VERBOSE=1 + make install + + - name: ctest + run: | + source spack/share/spack/setup-env.sh + spack env activate ufs_utils-env + cd ufs_utils + cd build + ctest --verbose --rerun-failed --output-on-failure diff --git a/build_all.sh b/build_all.sh index 75f830326..3d4bb0805 100755 --- a/build_all.sh +++ b/build_all.sh @@ -8,49 +8,72 @@ set -eux +# Get the root of the cloned ufs-utils directory +if [[ $(uname -s) == Darwin ]]; then + readonly DIR_ROOT=$(cd "$(dirname "$(greadlink -f -n "${BASH_SOURCE[0]}" )" )" && pwd -P) +else + readonly DIR_ROOT=$(cd "$(dirname "$(readlink -f -n "${BASH_SOURCE[0]}" )" )" && pwd -P) +fi + +# User Options target=${target:-"NULL"} compiler=${compiler:-"intel"} -export MOD_PATH +PW_CSP=${PW_CSP:-} # TODO: This is an implementation from EPIC and consistent with the UFS WM build system. if [[ "$target" == "linux.*" || "$target" == "macosx.*" ]]; then - unset -f module - set +x - source ./modulefiles/build.$target > /dev/null - set -x + unset -f module + set +x + source "${DIR_ROOT}/modulefiles/build.${target}" > /dev/null + set -x else - set +x - source ./sorc/machine-setup.sh - module use ./modulefiles - module load build.$target.$compiler > /dev/null - module list + set +x + source "${DIR_ROOT}/sorc/machine-setup.sh" + if [[ "${target}" == "noaacloud" ]]; then + #TODO: This will need to be revisited once the EPIC supported-stacks come online. + #TODO: This is a hack due to how the spack-stack module files are generated; there may be a better way to do this. + source /contrib/global-workflow/spack-stack/envs/spack_2021.0.3.env + else + module use "${DIR_ROOT}/modulefiles" + fi + module load "build.$target.$compiler" > /dev/null + module list set -x fi # Ensure the submodules have been initialized. -if [[ ! -d ./ccpp-physics/physics ]]; then +if [[ ! -d "${DIR_ROOT}/ccpp-physics/physics" ]]; then + cd "${DIR_ROOT}" git submodule init git submodule update fi +# Collect BUILD Options +CMAKE_FLAGS+=" -DCMAKE_BUILD_TYPE=${BUILD_TYPE:-Release}" + +# Install options; destination for built executables, libraries, CMake Package config +CMAKE_FLAGS+=" -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX:-${DIR_ROOT}} -DCMAKE_INSTALL_BINDIR=${INSTALL_BINDIR:-exec}" + +# Testing options # The unit test data download is part of the build system. Not all machines can # access the EMC ftp site, so turn off the build (-DBUILD_TESTING=OFF) of the units tests accordingly. # Those with access to the EMC ftp site are: Orion and Hera. - -CMAKE_FLAGS="-DCMAKE_INSTALL_PREFIX=../ -DCMAKE_INSTALL_BINDIR=exec -DBUILD_TESTING=OFF" +CMAKE_FLAGS+=" -DBUILD_TESTING=${BUILD_TESTING:-OFF}" # Allow users of this script to provide CMake options e.g. -DGFS=ON|OFF to build GFS specific utilities only CMAKE_OPTS=${CMAKE_OPTS:-} -rm -fr ./build -mkdir ./build && cd ./build +# Re-use or create a new BUILD_DIR (Default: create new BUILD_DIR) +BUILD_DIR=${BUILD_DIR:-"${DIR_ROOT}/build"} +[[ ${BUILD_CLEAN:-"YES"} =~ [yYtT] ]] && rm -rf "$BUILD_DIR" +mkdir -p "${BUILD_DIR}" && cd "${BUILD_DIR}" -cmake .. ${CMAKE_FLAGS} ${CMAKE_OPTS} +cmake ${CMAKE_FLAGS} ${CMAKE_OPTS} "${DIR_ROOT}" -make -j ${BUILD_JOBS:-8} VERBOSE=${BUILD_VERBOSE:-} +make -j "${BUILD_JOBS:-8}" VERBOSE="${BUILD_VERBOSE:-}" make install #ctest #ctest -I 4,5 -exit +exit 0 diff --git a/ci/spack.yaml b/ci/spack.yaml new file mode 100644 index 000000000..0549a8345 --- /dev/null +++ b/ci/spack.yaml @@ -0,0 +1,22 @@ +# Spack environment file to build UFS utilities dependencies +spack: + packages: + all: + compiler: [intel, gcc@10:10, apple-clang@14] + specs: + - netcdf-c@4.7.4 + - netcdf-fortran@4.5.3 + - bacio@2.4.1 + - g2@3.4.5 + - ip@3.3.3 + - nemsio@2.5.4 + - sp@2.3.3 + - w3emc@2.9.2 + - sfcio@1.4.1 + - sigio@2.3.2 + - nccmp@1.9.0.1 + - parallelio@2.5.9+fortran~pnetcdf + - esmf@8.4.2~debug~xerces+external-parallelio + view: true + concretizer: + unify: true diff --git a/modulefiles/build.hera.gnu.lua b/modulefiles/build.hera.gnu.lua index 33b8e6875..d3bd08e3d 100644 --- a/modulefiles/build.hera.gnu.lua +++ b/modulefiles/build.hera.gnu.lua @@ -2,39 +2,42 @@ help([[ Load environment to compile UFS_UTILS on Hera using Gnu ]]) -cmake_ver=os.getenv("cmake_ver") or "3.16.1" +cmake_ver=os.getenv("cmake_ver") or "3.20.1" load(pathJoin("cmake", cmake_ver)) hpss_ver=os.getenv("hpss_ver") or "" load(pathJoin("hpss", hpss_ver)) -prepend_path("MODULEPATH", "/scratch2/NCEPDEV/nwprod/hpc-stack/libs/hpc-stack/modulefiles/stack") +prepend_path("MODULEPATH", "/scratch1/NCEPDEV/nems/role.epic/hpc-stack/libs/gnu-9.2/modulefiles/stack") -hpc_ver=os.getenv("hpc_ver") or "1.1.0" +gnu_ver=os.getenv("gnu_ver") or "9.2" +load(pathJoin("gnu", gnu_ver)) + +hpc_ver=os.getenv("hpc_ver") or "1.2.0" load(pathJoin("hpc", hpc_ver)) -hpc_gnu_ver=os.getenv("hpc_gnu_ver") or "9.2.0" +hpc_gnu_ver=os.getenv("hpc_gnu_ver") or "9.2" load(pathJoin("hpc-gnu", hpc_gnu_ver)) -mpich_ver=os.getenv("mpich_ver") or "3.3.2" -load(pathJoin("hpc-mpich", mpich_ver)) +hpc_mpich_ver=os.getenv("hpc_mpich_ver") or "3.3.2" +load(pathJoin("hpc-mpich", hpc_mpich_ver)) -netcdf_ver=os.getenv("netcdf_ver") or "4.7.4" +netcdf_ver=os.getenv("netcdf_ver") or "4.9.1" load(pathJoin("netcdf", netcdf_ver)) -esmf_ver=os.getenv("esmf_ver") or "8.4.0b08" +esmf_ver=os.getenv("esmf_ver") or "8.4.1b07" load(pathJoin("esmf", esmf_ver)) bacio_ver=os.getenv("bacio_ver") or "2.4.1" load(pathJoin("bacio", bacio_ver)) -g2_ver=os.getenv("g2_ver") or "3.4.3" +g2_ver=os.getenv("g2_ver") or "3.4.5" load(pathJoin("g2", g2_ver)) ip_ver=os.getenv("ip_ver") or "4.0.0" load(pathJoin("ip", ip_ver)) -nemsio_ver=os.getenv("nemsio_ver") or "2.5.2" +nemsio_ver=os.getenv("nemsio_ver") or "2.5.4" load(pathJoin("nemsio", nemsio_ver)) sp_ver=os.getenv("sp_ver") or "2.3.3" @@ -49,13 +52,13 @@ load(pathJoin("sfcio", sfcio_ver)) sigio_ver=os.getenv("sigio_ver") or "2.3.2" load(pathJoin("sigio", sigio_ver)) -nccmp_ver=os.getenv("nccmp_ver") or "1.8.7.0" +nccmp_ver=os.getenv("nccmp_ver") or "1.9.1.0" load(pathJoin("nccmp", nccmp_ver)) -zlib_ver=os.getenv("zlib_ver") or "1.2.11" +zlib_ver=os.getenv("zlib_ver") or "1.2.12" load(pathJoin("zlib", zlib_ver)) -png_ver=os.getenv("png_ver") or "1.6.35" -load(pathJoin("png", png_ver)) +png_ver=os.getenv("png_ver") or "1.6.37" +load(pathJoin("libpng", png_ver)) whatis("Description: UFS_UTILS build environment") diff --git a/modulefiles/build.hera.intel.lua b/modulefiles/build.hera.intel.lua index a3734b6ce..bf92b2634 100644 --- a/modulefiles/build.hera.intel.lua +++ b/modulefiles/build.hera.intel.lua @@ -2,13 +2,13 @@ help([[ Load environment to compile UFS_UTILS on Hera using Intel ]]) -cmake_ver=os.getenv("cmake_ver") or "3.16.1" +cmake_ver=os.getenv("cmake_ver") or "3.20.1" load(pathJoin("cmake", cmake_ver)) hpss_ver=os.getenv("hpss_ver") or "" load(pathJoin("hpss", hpss_ver)) -prepend_path("MODULEPATH", "/scratch2/NCEPDEV/nwprod/hpc-stack/libs/hpc-stack/modulefiles/stack") +prepend_path("MODULEPATH", "/scratch1/NCEPDEV/nems/role.epic/hpc-stack/libs/intel-2022.1.2/modulefiles/stack") hpc_ver=os.getenv("hpc_ver") or "1.2.0" load(pathJoin("hpc", hpc_ver)) @@ -16,8 +16,8 @@ load(pathJoin("hpc", hpc_ver)) hpc_intel_ver=os.getenv("hpc_intel_ver") or "2022.1.2" load(pathJoin("hpc-intel", hpc_intel_ver)) -impi_ver=os.getenv("impi_ver") or "2022.1.2" -load(pathJoin("hpc-impi", impi_ver)) +hpc_impi_ver=os.getenv("hpc_impi_ver") or "2022.1.2" +load(pathJoin("hpc-impi", hpc_impi_ver)) bacio_ver=os.getenv("bacio_ver") or "2.4.1" load(pathJoin("bacio", bacio_ver)) @@ -43,25 +43,25 @@ load(pathJoin("sfcio", sfcio_ver)) sigio_ver=os.getenv("sigio_ver") or "2.3.2" load(pathJoin("sigio", sigio_ver)) -zlib_ver=os.getenv("zlib_ver") or "1.2.11" +zlib_ver=os.getenv("zlib_ver") or "1.2.12" load(pathJoin("zlib", zlib_ver)) -png_ver=os.getenv("png_ver") or "1.6.35" +png_ver=os.getenv("png_ver") or "1.6.37" load(pathJoin("libpng", png_ver)) -hdf5_ver=os.getenv("hdf5_ver") or "1.10.6" +hdf5_ver=os.getenv("hdf5_ver") or "1.14.0" load(pathJoin("hdf5", hdf5_ver)) -netcdf_ver=os.getenv("netcdf_ver") or "4.7.4" +netcdf_ver=os.getenv("netcdf_ver") or "4.9.1" load(pathJoin("netcdf", netcdf_ver)) -nccmp_ver=os.getenv("nccmp_ver") or "1.8.9.0" +nccmp_ver=os.getenv("nccmp_ver") or "1.9.0.1" load(pathJoin("nccmp", nccmp_ver)) -esmf_ver=os.getenv("esmf_ver") or "8.4.0b08" +esmf_ver=os.getenv("esmf_ver") or "8.4.1" load(pathJoin("esmf", esmf_ver)) -nco_ver=os.getenv("nco_ver") or "4.9.1" +nco_ver=os.getenv("nco_ver") or "5.0.6" load(pathJoin("nco", nco_ver)) whatis("Description: UFS_UTILS build environment") diff --git a/modulefiles/build.noaacloud.intel.lua b/modulefiles/build.noaacloud.intel.lua new file mode 100644 index 000000000..2661256d5 --- /dev/null +++ b/modulefiles/build.noaacloud.intel.lua @@ -0,0 +1,59 @@ +help([[ +Load environment to compile UFS_UTILS on NOAA CSPs using Intel +]]) + +cmake_ver=os.getenv("cmake_ver") or "3.16.1" +load(pathJoin("cmake", cmake_ver)) + +hpc_intel_ver=os.getenv("hpc_intel_ver") or "2021.3.0" +load(pathJoin("intel", hpc_intel_ver)) + +impi_ver=os.getenv("impi_ver") or "2021.3.0" +load(pathJoin("impi", impi_ver)) + +bacio_ver=os.getenv("bacio_ver") or "2.4.1" +load(pathJoin("bacio", bacio_ver)) + +g2_ver=os.getenv("g2_ver") or "3.4.5" +load(pathJoin("g2", g2_ver)) + +ip_ver=os.getenv("ip_ver") or "4.0.0" +load(pathJoin("ip", ip_ver)) + +nemsio_ver=os.getenv("nemsio_ver") or "2.5.4" +load(pathJoin("nemsio", nemsio_ver)) + +sp_ver=os.getenv("sp_ver") or "2.3.3" +load(pathJoin("sp", sp_ver)) + +w3emc_ver=os.getenv("w3emc_ver") or "2.9.2" +load(pathJoin("w3emc", w3emc_ver)) + +sfcio_ver=os.getenv("sfcio_ver") or "1.4.1" +load(pathJoin("sfcio", sfcio_ver)) + +sigio_ver=os.getenv("sigio_ver") or "2.3.2" +load(pathJoin("sigio", sigio_ver)) + +zlib_ver=os.getenv("zlib_ver") or "1.2.11" +load(pathJoin("zlib", zlib_ver)) + +png_ver=os.getenv("png_ver") or "1.6.35" +load(pathJoin("libpng", png_ver)) + +hdf5_ver=os.getenv("hdf5_ver") or "1.10.6" +load(pathJoin("hdf5", hdf5_ver)) + +netcdf_ver=os.getenv("netcdf_ver") or "4.6.1" +load(pathJoin("netcdf", netcdf_ver)) + +nccmp_ver=os.getenv("nccmp_ver") or "1.8.9.0" +load(pathJoin("nccmp", nccmp_ver)) + +esmf_ver=os.getenv("esmf_ver") or "8.4.0b08" +load(pathJoin("esmf", esmf_ver)) + +nco_ver=os.getenv("nco_ver") or "4.9.1" +load(pathJoin("nco", nco_ver)) + +whatis("Description: UFS_UTILS build environment") diff --git a/modulefiles/build.orion.intel.lua b/modulefiles/build.orion.intel.lua index 10ca1a654..18fe99840 100644 --- a/modulefiles/build.orion.intel.lua +++ b/modulefiles/build.orion.intel.lua @@ -2,10 +2,10 @@ help([[ Load environment to compile UFS_UTILS on Orion ]]) -cmake_ver=os.getenv("cmake_ver") or "3.17.3" +cmake_ver=os.getenv("cmake_ver") or "3.22.1" load(pathJoin("cmake", cmake_ver)) -prepend_path("MODULEPATH", "/apps/contrib/NCEP/hpc-stack/libs/hpc-stack/modulefiles/stack") +prepend_path("MODULEPATH", "/work/noaa/epic-ps/role-epic-ps/hpc-stack/libs/intel-2022.1.2_ncdf492/modulefiles/stack") hpc_ver=os.getenv("hpc_ver") or "1.2.0" load(pathJoin("hpc", hpc_ver)) @@ -13,8 +13,8 @@ load(pathJoin("hpc", hpc_ver)) hpc_intel_ver=os.getenv("hpc_intel_ver") or "2022.1.2" load(pathJoin("hpc-intel", hpc_intel_ver)) -impi_ver=os.getenv("impi_ver") or "2022.1.2" -load(pathJoin("hpc-impi", impi_ver)) +hpc_impi_ver=os.getenv("hpc_impi_ver") or "2022.1.2" +load(pathJoin("hpc-impi", hpc_impi_ver)) bacio_ver=os.getenv("bacio_ver") or "2.4.1" load(pathJoin("bacio", bacio_ver)) @@ -43,22 +43,19 @@ load(pathJoin("sigio", sigio_ver)) zlib_ver=os.getenv("zlib_ver") or "1.2.11" load(pathJoin("zlib", zlib_ver)) -png_ver=os.getenv("png_ver") or "1.6.35" -load(pathJoin("libpng", png_ver)) - -hdf5_ver=os.getenv("hdf5_ver") or "1.10.6" +hdf5_ver=os.getenv("hdf5_ver") or "1.14.0" load(pathJoin("hdf5", hdf5_ver)) -netcdf_ver=os.getenv("netcdf_ver") or "4.7.4" +netcdf_ver=os.getenv("netcdf_ver") or "4.9.2" load(pathJoin("netcdf", netcdf_ver)) nccmp_ver=os.getenv("nccmp_ver") or "1.8.9.0" load(pathJoin("nccmp", nccmp_ver)) -esmf_ver=os.getenv("esmf_ver") or "8.4.0b08" +esmf_ver=os.getenv("esmf_ver") or "8.4.2" load(pathJoin("esmf", esmf_ver)) -nco_ver=os.getenv("nco_ver") or "4.9.3" +nco_ver=os.getenv("nco_ver") or "5.0.6" load(pathJoin("nco", nco_ver)) whatis("Description: UFS_UTILS build environment") diff --git a/reg_tests/global_cycle/C768.lndincsoil.sh b/reg_tests/global_cycle/C192.lndincsoilnoahmp.sh similarity index 65% rename from reg_tests/global_cycle/C768.lndincsoil.sh rename to reg_tests/global_cycle/C192.lndincsoilnoahmp.sh index a344785e6..0c34fa82f 100755 --- a/reg_tests/global_cycle/C768.lndincsoil.sh +++ b/reg_tests/global_cycle/C192.lndincsoilnoahmp.sh @@ -1,8 +1,9 @@ #!/bin/bash #------------------------------------------------------------------ -# Run global_cycle for a C768 case to test the ingest and -# application of soil temperature increments from the GSI. +# Run global_cycle for a C192 case to test the ingest and +# application of soil moisture and temperature increments +# from the GSI, into Noah-MP restarts. # Compare output to a baseline set of files using the 'nccmp' # utility. #------------------------------------------------------------------ @@ -22,13 +23,9 @@ export CDATE=2019073000 export FHOUR=00 export DELTSFC=6 -export CASE=C768 +export CASE=C192 -export COMIN=$HOMEreg/input_data -export FNTSFA=$COMIN/gdas.t00z.rtgssthr.grb -export FNSNOA=$COMIN/gdas.t00z.snogrb_t1534.3072.1536 -export FNACNA=$COMIN/gdas.t00z.seaice.5min.blend.grb -export NST_FILE=$COMIN/gdas.t00z.dtfanl.nc +export COMIN=$HOMEreg/input_data_noahmp export LND_SOI_FILE=$COMIN/sfcincr_gsi @@ -52,7 +49,7 @@ $BASE_GSM/ush/global_cycle_driver.sh iret=$? if [ $iret -ne 0 ]; then set +x - echo "<<< C768 LANDINC SOILT CYCLE TEST FAILED. >>>" + echo "<<< C192 LANDINC SOIL NOAHMP CYCLE TEST FAILED. >>>" exit $iret fi @@ -63,7 +60,7 @@ for files in *tile*.nc do if [ -f $files ]; then echo CHECK $files - $NCCMP -dmfqS $files $HOMEreg/baseline_data/c768.lndincsoil/$files + $NCCMP -dmfqS $files $HOMEreg/baseline_data/c192.lndincsoilnoahmp/$files iret=$? if [ $iret -ne 0 ]; then test_failed=1 @@ -75,15 +72,15 @@ set +x if [ $test_failed -ne 0 ]; then echo echo "*****************************************" - echo "<<< C768 LANDINC SOILT CYCLE TEST FAILED. >>>" + echo "<<< C192 LANDINC SOIL-NOAHP CYCLE TEST FAILED. >>>" echo "*****************************************" if [ "$UPDATE_BASELINE" = "TRUE" ]; then - $BASE_GSM/reg_tests/update_baseline.sh $HOMEreg "c768.lndincsoil" $commit_num + $BASE_GSM/reg_tests/update_baseline.sh $HOMEreg "c192.lndincsoilnoahmp" $commit_num fi else echo echo "*****************************************" - echo "<<< C768 LANDINC SOILT CYCLE TEST PASSED. >>>" + echo "<<< C192 LANDINC SOIL-NOAHMP CYCLE TEST PASSED. >>>" echo "*****************************************" fi diff --git a/reg_tests/global_cycle/driver.hera.sh b/reg_tests/global_cycle/driver.hera.sh index c049f51fd..9ea901726 100755 --- a/reg_tests/global_cycle/driver.hera.sh +++ b/reg_tests/global_cycle/driver.hera.sh @@ -64,8 +64,8 @@ TEST1=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_C LOG_FILE=consistency.log02 export DATA="${DATA_DIR}/test2" export COMOUT=$DATA -TEST2=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J c768.lndincsoil \ - -o $LOG_FILE -e $LOG_FILE ./C768.lndincsoil.sh) +TEST2=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J c192.lndincsoilnoahmp \ + -o $LOG_FILE -e $LOG_FILE ./C192.lndincsoilnoahmp.sh) LOG_FILE=consistency.log03 export DATA="${DATA_DIR}/test3" diff --git a/reg_tests/global_cycle/driver.jet.sh b/reg_tests/global_cycle/driver.jet.sh index 0f0ab0c4d..75fc6b343 100755 --- a/reg_tests/global_cycle/driver.jet.sh +++ b/reg_tests/global_cycle/driver.jet.sh @@ -62,8 +62,8 @@ TEST1=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_C LOG_FILE=consistency.log02 export DATA="${DATA_DIR}/test2" export COMOUT=$DATA -TEST2=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J c768.lndincsoil \ - --partition=xjet -o $LOG_FILE -e $LOG_FILE ./C768.lndincsoil.sh) +TEST2=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J c192.lndincsoilnoahmp \ + --partition=xjet -o $LOG_FILE -e $LOG_FILE ./C192.lndincsoilnoahmp.sh) LOG_FILE=consistency.log03 export DATA="${DATA_DIR}/test3" diff --git a/reg_tests/global_cycle/driver.orion.sh b/reg_tests/global_cycle/driver.orion.sh index 3bd5d6dc0..6fbd15fd2 100755 --- a/reg_tests/global_cycle/driver.orion.sh +++ b/reg_tests/global_cycle/driver.orion.sh @@ -62,8 +62,8 @@ TEST1=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_C LOG_FILE=consistency.log02 export DATA="${DATA_DIR}/test2" export COMOUT=$DATA -TEST2=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J c768.lndincsoil \ - -o $LOG_FILE -e $LOG_FILE ./C768.lndincsoil.sh) +TEST2=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J c192.lndincsoilnoahmp \ + -o $LOG_FILE -e $LOG_FILE ./C192.lndincsoilnoahmp.sh) LOG_FILE=consistency.log03 export DATA="${DATA_DIR}/test3" diff --git a/reg_tests/global_cycle/driver.wcoss2.sh b/reg_tests/global_cycle/driver.wcoss2.sh index 7889e7a1e..1facda522 100755 --- a/reg_tests/global_cycle/driver.wcoss2.sh +++ b/reg_tests/global_cycle/driver.wcoss2.sh @@ -69,7 +69,7 @@ TEST1=$(qsub -V -o ${LOG_FILE}01 -e ${LOG_FILE}01 -q $QUEUE -A $PROJECT_CODE -l export DATA="${DATA_DIR}/test2" export COMOUT=$DATA TEST2=$(qsub -V -o ${LOG_FILE}02 -e ${LOG_FILE}02 -q $QUEUE -A $PROJECT_CODE -l walltime=00:05:00 \ - -N c768.lndincsoil -l select=1:ncpus=12:mem=8GB $PWD/C768.lndincsoil.sh) + -N c192.lndincsoilnoahmp -l select=1:ncpus=12:mem=8GB $PWD/C192.lndincsoilnoahmp.sh) export DATA="${DATA_DIR}/test3" export COMOUT=$DATA diff --git a/sorc/global_cycle.fd/cycle.f90 b/sorc/global_cycle.fd/cycle.f90 index 7f5252efb..4511416c9 100644 --- a/sorc/global_cycle.fd/cycle.f90 +++ b/sorc/global_cycle.fd/cycle.f90 @@ -58,11 +58,6 @@ !! - IDIM,JDIM i/j dimension of a cubed-sphere tile. !! - LUGB Unit number used in the sfccycle subprogram !! to read input datasets. -!! Next four should match the gfs_physics_nml -!! - LSM Integer code for LSM (as in GFS_TYPES) -!! 1 - Noah -!! (note: added for land_da_adjust layers, however -!! sfcsub routine (and likely others) assume the noah lsm !! - LSOIL Number of soil layers. !! - IY,IM,ID,IH Year, month, day, and hour of initial state. !! - FH Forecast hour @@ -110,18 +105,18 @@ PROGRAM SFC_DRV IMPLICIT NONE ! CHARACTER(LEN=3) :: DONST - INTEGER :: IDIM, JDIM, LSM, LSOIL, LUGB, IY, IM, ID, IH, IALB + INTEGER :: IDIM, JDIM, LSOIL, LUGB, IY, IM, ID, IH, IALB INTEGER :: ISOT, IVEGSRC, LENSFC, ZSEA1_MM, ZSEA2_MM, IERR INTEGER :: NPROCS, MYRANK, NUM_THREADS, NUM_PARTHDS, MAX_TASKS REAL :: FH, DELTSFC, ZSEA1, ZSEA2 LOGICAL :: USE_UFO, DO_NSST, DO_LNDINC, DO_SFCCYCLE ! - NAMELIST/NAMCYC/ IDIM,JDIM,LSM,LSOIL,LUGB,IY,IM,ID,IH,FH,& + NAMELIST/NAMCYC/ IDIM,JDIM,LSOIL,LUGB,IY,IM,ID,IH,FH,& DELTSFC,IALB,USE_UFO,DONST, & DO_SFCCYCLE,ISOT,IVEGSRC,ZSEA1_MM, & ZSEA2_MM, MAX_TASKS, DO_LNDINC ! - DATA IDIM,JDIM,LSM,LSOIL/96,96,1,4/ + DATA IDIM,JDIM,LSOIL/96,96,4/ DATA IY,IM,ID,IH,FH/1997,8,2,0,0./ DATA LUGB/51/, DELTSFC/0.0/, IALB/1/, MAX_TASKS/99999/ DATA ISOT/1/, IVEGSRC/2/, ZSEA1_MM/0/, ZSEA2_MM/0/ @@ -169,10 +164,10 @@ PROGRAM SFC_DRV ENDIF PRINT* - IF (MYRANK==0) PRINT*,"LUGB,IDIM,JDIM,LSM,ISOT,IVEGSRC,LSOIL,DELTSFC,IY,IM,ID,IH,FH: ", & - LUGB,IDIM,JDIM,LSM,ISOT,IVEGSRC,LSOIL,DELTSFC,IY,IM,ID,IH,FH + IF (MYRANK==0) PRINT*,"LUGB,IDIM,JDIM,ISOT,IVEGSRC,LSOIL,DELTSFC,IY,IM,ID,IH,FH: ", & + LUGB,IDIM,JDIM,ISOT,IVEGSRC,LSOIL,DELTSFC,IY,IM,ID,IH,FH - CALL SFCDRV(LUGB,IDIM,JDIM,LSM,LENSFC,LSOIL,DELTSFC, & + CALL SFCDRV(LUGB,IDIM,JDIM,LENSFC,LSOIL,DELTSFC, & IY,IM,ID,IH,FH,IALB, & USE_UFO,DO_NSST,DO_SFCCYCLE,DO_LNDINC, & ZSEA1,ZSEA2,ISOT,IVEGSRC,MYRANK) @@ -277,8 +272,6 @@ END PROGRAM SFC_DRV !! @param[in] IDIM 'i' dimension of the cubed-sphere tile !! @param[in] JDIM 'j' dimension of the cubed-sphere tile !! @param[in] LENSFC Total numberof points for the cubed-sphere tile - !! @param[in] LSM Integer code for the land surface model - !! 1 - Noah !! @param[in] LSOIL Number of soil layers !! @param[in] DELTSFC Cycling frequency in hours !! @param[in] IY Year of initial state @@ -301,7 +294,7 @@ END PROGRAM SFC_DRV !! @param[in] IVEGSRC Use IGBP vegetation type when '1'. Use SIB when '2'. !! @param[in] MYRANK MPI rank number !! @author Mark Iredell, George Gayno - SUBROUTINE SFCDRV(LUGB, IDIM,JDIM,LSM,LENSFC,LSOIL,DELTSFC, & + SUBROUTINE SFCDRV(LUGB, IDIM,JDIM,LENSFC,LSOIL,DELTSFC, & IY,IM,ID,IH,FH,IALB, & USE_UFO,DO_NSST,DO_SFCCYCLE,DO_LNDINC,& ZSEA1,ZSEA2,ISOT,IVEGSRC,MYRANK) @@ -312,12 +305,13 @@ SUBROUTINE SFCDRV(LUGB, IDIM,JDIM,LSM,LENSFC,LSOIL,DELTSFC, & USE LAND_INCREMENTS, ONLY: ADD_INCREMENT_SOIL, & ADD_INCREMENT_SNOW, & CALCULATE_LANDINC_MASK, & - APPLY_LAND_DA_ADJUSTMENTS_STC, & - APPLY_LAND_DA_ADJUSTMENTS_SND + APPLY_LAND_DA_ADJUSTMENTS_SOIL, & + APPLY_LAND_DA_ADJUSTMENTS_SND, & + LSM_NOAH, LSM_NOAHMP IMPLICIT NONE - INTEGER, INTENT(IN) :: IDIM, JDIM, LSM,LENSFC, LSOIL, IALB + INTEGER, INTENT(IN) :: IDIM, JDIM, LENSFC, LSOIL, IALB INTEGER, INTENT(IN) :: LUGB, IY, IM, ID, IH INTEGER, INTENT(IN) :: ISOT, IVEGSRC, MYRANK @@ -339,7 +333,8 @@ SUBROUTINE SFCDRV(LUGB, IDIM,JDIM,LSM,LENSFC,LSOIL,DELTSFC, & INTEGER :: IDUM(IDIM,JDIM) integer :: num_parthds, num_threads - LOGICAL :: IS_NOAHMP=.FALSE. + LOGICAL :: IS_NOAHMP + INTEGER :: LSM real(kind=kind_io8) :: min_ice(lensfc) @@ -377,8 +372,10 @@ SUBROUTINE SFCDRV(LUGB, IDIM,JDIM,LSM,LENSFC,LSOIL,DELTSFC, & real, dimension(idim,jdim) :: tf_clm,tf_trd,sal_clm real, dimension(lensfc) :: tf_clm_tile,tf_trd_tile,sal_clm_tile INTEGER :: veg_type_landice + INTEGER, DIMENSION(LENSFC) :: STC_UPDATED, SLC_UPDATED LOGICAL :: FILE_EXISTS, DO_SOI_INC, DO_SNO_INC + !-------------------------------------------------------------------------------- ! NST_FILE is the path/name of the gaussian GSI file which contains NSST ! increments. @@ -489,6 +486,12 @@ SUBROUTINE SFCDRV(LUGB, IDIM,JDIM,LSM,LENSFC,LSOIL,DELTSFC, & ABSFCS=ABSFCS,T2M=T2M ,Q2M=Q2M ,SLMASK=SLMASK, & ZSOIL=ZSOIL, NSST=NSST) + IF (IS_NOAHMP) THEN + LSM=LSM_NOAHMP + ELSE + LSM=LSM_NOAH + ENDIF + IF (USE_UFO) THEN PRINT* PRINT*,'USE UNFILTERED OROGRAPHY.' @@ -516,7 +519,7 @@ SUBROUTINE SFCDRV(LUGB, IDIM,JDIM,LSM,LENSFC,LSOIL,DELTSFC, & ! CALCULATE MASK FOR LAND INCREMENTS IF (DO_LNDINC) & - CALL CALCULATE_LANDINC_MASK(SLCFCS(:,1),SWEFCS, VETFCS, & + CALL CALCULATE_LANDINC_MASK(SMCFCS(:,1),SWEFCS, VETFCS, & LENSFC,VEG_TYPE_LANDICE, LANDINC_MASK) !-------------------------------------------------------------------------------- @@ -654,7 +657,7 @@ SUBROUTINE SFCDRV(LUGB, IDIM,JDIM,LSM,LENSFC,LSOIL,DELTSFC, & LANDINC_MASK_FG = LANDINC_MASK IF (DO_SFCCYCLE .OR. DO_SNO_INC) THEN - CALL CALCULATE_LANDINC_MASK(SLCFCS(:,1),SWEFCS, VETFCS, LENSFC, & + CALL CALCULATE_LANDINC_MASK(SMCFCS(:,1),SWEFCS, VETFCS, LENSFC, & VEG_TYPE_LANDICE, LANDINC_MASK ) ENDIF @@ -681,18 +684,21 @@ SUBROUTINE SFCDRV(LUGB, IDIM,JDIM,LSM,LENSFC,LSOIL,DELTSFC, & ! store background states STC_BCK = STCFCS - SMC_BCK = SMCFCS ! not used yet. - SLC_BCK = SLCFCS ! not used yet. + SMC_BCK = SMCFCS + SLC_BCK = SLCFCS - CALL ADD_INCREMENT_SOIL(RLA,RLO,STCFCS,LANDINC_MASK,LANDINC_MASK_FG, & - LENSFC,LSOIL,IDIM,JDIM, MYRANK) + ! below updates [STC/SMC/STC]FCS to hold the analysis + CALL ADD_INCREMENT_SOIL(RLA,RLO,STCFCS,SMCFCS,SLCFCS,STC_UPDATED, SLC_UPDATED, & + LANDINC_MASK,LANDINC_MASK_FG,LENSFC,LSOIL,IDIM,JDIM,LSM,MYRANK) !-------------------------------------------------------------------------------- ! make any necessary adjustments to dependent variables !-------------------------------------------------------------------------------- - CALL APPLY_LAND_DA_ADJUSTMENTS_STC(LSM, ISOT, IVEGSRC,LENSFC, LSOIL, & - SOTFCS, LANDINC_MASK_FG, STC_BCK, STCFCS, SMCFCS, SLCFCS) + + CALL APPLY_LAND_DA_ADJUSTMENTS_SOIL(LSM, ISOT, IVEGSRC,LENSFC, LSOIL, & + SOTFCS, LANDINC_MASK_FG, STC_BCK, STCFCS, SMCFCS, SLCFCS, STC_UPDATED, & + SLC_UPDATED,ZSOIL) ENDIF ! soil increments @@ -715,12 +721,12 @@ SUBROUTINE SFCDRV(LUGB, IDIM,JDIM,LSM,LENSFC,LSOIL,DELTSFC, & ! WRITE OUT UPDATED SURFACE DATA ON THE CUBED-SPHERE TILE. !-------------------------------------------------------------------------------- - IF (IS_NOAHMP) THEN + IF (LSM==LSM_NOAHMP) THEN CALL WRITE_DATA(LENSFC,IDIM,JDIM,LSOIL,DO_NSST,NSST,VEGFCS=VEGFCS, & - SLCFCS=SLCFCS,SMCFCS=SMCFCS) + SLCFCS=SLCFCS,SMCFCS=SMCFCS,STCFCS=STCFCS) - ELSE + ELSEIF (LSM==LSM_NOAH) THEN CALL WRITE_DATA(LENSFC,IDIM,JDIM,LSOIL, & DO_NSST,NSST,SLIFCS=SLIFCS,TSFFCS=TSFFCS,VEGFCS=VEGFCS, & diff --git a/sorc/global_cycle.fd/land_increments.f90 b/sorc/global_cycle.fd/land_increments.f90 index 688087002..b9738250c 100644 --- a/sorc/global_cycle.fd/land_increments.f90 +++ b/sorc/global_cycle.fd/land_increments.f90 @@ -9,11 +9,18 @@ module land_increments public add_increment_soil public add_increment_snow public calculate_landinc_mask - public apply_land_da_adjustments_stc + public apply_land_da_adjustments_soil public apply_land_da_adjustments_snd + public lsm_noah, lsm_noahmp integer, parameter :: lsm_noah=1 !< flag for NOAH land surface model + integer, parameter :: lsm_noahmp=2 !< flag for NOAHMP land surface model !! copied from GFS_typedefs.F90 + + ! control state for soil analysis: + integer, parameter :: lsoil_incr=3 !< number of layers to add incrments to + + real, parameter :: tfreez=273.16 !< con_t0c in physcons contains !> Read in gsi file with soil state increments (on the gaussian @@ -29,33 +36,41 @@ module land_increments !! !! @param[inout] RLA Latitude on the cubed-sphere tile !! @param[inout] RLO Longitude on the cubed-sphere tile - !! @param[inout] STC_STATE + !! @param[inout] STC_STATE Soil temperature state vector + !! @param[inout] SMC_STATE Soil moisture (liquid plus solid) state vector + !! @param[inout] SLC_STATE Liquid soil moisture state vector + !! @param[out] stc_updated Integer to record whether STC in each grid cell was updated + !! @param[out] slc_updated Integer to record whether SMC in each grid cell was updated !! @param[in] SOILSNOW_TILE Land mask for increments on the cubed-sphere tile !! @param[in] SOILSNOW_FG_TILE First guess land mask for increments on the cubed-sphere tile !! @param[in] LENSFC Number of land points on a tile !! @param[in] LSOIL Number of soil layers !! @param[in] IDIM 'I' dimension of a tile !! @param[in] JDIM 'J' dimension of a tile + !! @param[in] lsm Integer flag indicating which land model is used (1-Noah, 2-Noah-MP) !! @param[in] MYRANK MPI rank number !! !! @author Clara Draper. @date March 2021 -subroutine add_increment_soil(rla,rlo,stc_state,soilsnow_tile, soilsnow_fg_tile, & - lensfc,lsoil,idim,jdim, myrank) +subroutine add_increment_soil(rla,rlo,stc_state,smc_state,slc_state,stc_updated, slc_updated, & + soilsnow_tile,soilsnow_fg_tile,lensfc,lsoil,idim,jdim,lsm, myrank) use utils use gdswzd_mod use read_write_data, only : idim_gaus, jdim_gaus, & - stc_inc_gaus, soilsnow_gaus + stc_inc_gaus, soilsnow_gaus, slc_inc_gaus use mpi implicit none - integer, intent(in) :: lensfc, lsoil, idim, jdim, myrank + integer, intent(in) :: lensfc, lsoil, idim, jdim, myrank, lsm - integer, intent(in) :: soilsnow_tile(lensfc), soilsnow_fg_tile(lensfc) + integer, intent(in) :: soilsnow_tile(lensfc), soilsnow_fg_tile(lensfc) real, intent(inout) :: rla(lensfc), rlo(lensfc) real, intent(inout) :: stc_state(lensfc, lsoil) + real, intent(inout) :: slc_state(lensfc, lsoil) + real, intent(inout) :: smc_state(lensfc, lsoil) + integer, intent(out) :: stc_updated(lensfc), slc_updated(lensfc) integer :: iopt, nret, kgds_gaus(200) integer :: igaus, jgaus, ij @@ -63,21 +78,24 @@ subroutine add_increment_soil(rla,rlo,stc_state,soilsnow_tile, soilsnow_fg_tile, integer :: itile, jtile integer :: j, ierr integer :: igausp1, jgausp1 + logical :: upd_slc, upd_stc real :: fill integer, allocatable :: id1(:,:), id2(:,:), jdc(:,:) real :: wsum real :: stc_inc(lsoil) + real :: slc_inc(lsoil) real, allocatable :: xpts(:), ypts(:), lats(:), lons(:) real, allocatable :: dum2d(:,:), lats_rad(:), lons_rad(:) real, allocatable :: agrid(:,:,:), s2c(:,:,:) - integer :: k, nother, nsnowupd, nnosoilnear, nsoilupd, nsnowchange - logical :: gaus_has_soil - - integer, parameter :: lsoil_incr=3 ! number of layers to add incrments to - + integer :: k, nother, nsnowupd, nnosoilnear + integer :: nstcupd, nslcupd, nfrozen, nfrozen_upd + logical :: gaus_has_soil, soil_freeze, soil_ice + + stc_updated=0 + slc_updated=0 ! this produces the same lat/lon as can be read in from the file kgds_gaus = 0 @@ -95,8 +113,19 @@ subroutine add_increment_soil(rla,rlo,stc_state,soilsnow_tile, soilsnow_fg_tile, kgds_gaus(12) = 255 ! oct 29 - reserved kgds_gaus(20) = 255 ! oct 5 - not used, set to 255 + + if (lsm==lsm_noah) then + upd_stc=.true. + upd_slc=.false. ! not coded + elseif (lsm==lsm_noahmp) then + upd_stc=.true. + upd_slc=.true. + endif + print* - print*,'adjust soil temperature using gsi increments on gaussian grid' + print*,'adjust soil using gsi increments on gaussian grid' + print*,'updating soil temps', upd_stc + print*,'updating soil moisture', upd_slc print*,'adjusting first ', lsoil_incr, ' surface layers only' !---------------------------------------------------------------------- @@ -167,10 +196,12 @@ subroutine add_increment_soil(rla,rlo,stc_state,soilsnow_tile, soilsnow_fg_tile, ! nother = 0 ! grid cells not land nsnowupd = 0 ! grid cells with snow (temperature not yet updated) - nsnowchange = 0 ! grid cells where no temp upd made, because snow occurence changed nnosoilnear = 0 ! grid cells where model has soil, but 4 closest gaus grids don't ! (no update made here) - nsoilupd = 0 + nslcupd = 0 ! grid cells that are updated + nstcupd = 0 ! grid cells that are updated + nfrozen = 0 ! not update as frozen soil + nfrozen_upd = 0 ! not update as frozen soil ij_loop : do ij = 1, lensfc @@ -195,13 +226,11 @@ subroutine add_increment_soil(rla,rlo,stc_state,soilsnow_tile, soilsnow_fg_tile, if (itile==0) itile = idim !---------------------------------------------------------------------- - ! if the snow analysis has chnaged to occurence of snow, skip the - ! temperature analysis + ! if snow is present before or after snow update, skip soil analysis !---------------------------------------------------------------------- - if ((mask_fg_tile == 2 .and. mask_tile == 1) .or. & - (mask_fg_tile == 1 .and. mask_tile == 2) ) then - nsnowchange = nsnowchange + 1 + if (mask_fg_tile == 2 .or. mask_tile == 2) then + nsnowupd = nsnowupd + 1 cycle ij_loop endif @@ -228,73 +257,108 @@ subroutine add_increment_soil(rla,rlo,stc_state,soilsnow_tile, soilsnow_fg_tile, cycle ij_loop endif - ! calcualate weighted increment over nearby grid cells that have soil - - ! Draper: to-do, code adding increments to soil moisture. - ! will require converting to soil wetness index first - ! (need to add soil properties to the increment file) - - nsoilupd = nsoilupd + 1 - stc_inc = 0.0 + slc_inc = 0.0 wsum = 0.0 if (soilsnow_gaus(igaus,jgaus) == 1) then do k = 1, lsoil_incr - stc_inc(k) = stc_inc(k) + (s2c(itile,jtile,1) * stc_inc_gaus(k,igaus,jgaus)) + if (upd_stc) & + stc_inc(k) = stc_inc(k) + (s2c(itile,jtile,1) * stc_inc_gaus(k,igaus,jgaus)) + if (upd_slc) & + slc_inc(k) = slc_inc(k) + (s2c(itile,jtile,1) * slc_inc_gaus(k,igaus,jgaus)) enddo wsum = wsum + s2c(itile,jtile,1) endif if (soilsnow_gaus(igausp1,jgaus) == 1) then do k = 1, lsoil_incr - stc_inc(k) = stc_inc(k) + (s2c(itile,jtile,2) * stc_inc_gaus(k,igausp1,jgaus)) + if (upd_stc) & + stc_inc(k) = stc_inc(k) + (s2c(itile,jtile,2) * stc_inc_gaus(k,igausp1,jgaus)) + if (upd_slc) & + slc_inc(k) = slc_inc(k) + (s2c(itile,jtile,2) * slc_inc_gaus(k,igausp1,jgaus)) enddo wsum = wsum + s2c(itile,jtile,2) endif if (soilsnow_gaus(igausp1,jgausp1) == 1) then do k = 1, lsoil_incr - stc_inc(k) = stc_inc(k) + (s2c(itile,jtile,3) * stc_inc_gaus(k,igausp1,jgausp1)) + if (upd_stc) & + stc_inc(k) = stc_inc(k) + (s2c(itile,jtile,3) * stc_inc_gaus(k,igausp1,jgausp1)) + if (upd_slc) & + slc_inc(k) = slc_inc(k) + (s2c(itile,jtile,3) * slc_inc_gaus(k,igausp1,jgausp1)) enddo wsum = wsum + s2c(itile,jtile,3) endif if (soilsnow_gaus(igaus,jgausp1) == 1) then do k = 1, lsoil_incr - stc_inc(k) = stc_inc(k) + (s2c(itile,jtile,4) * stc_inc_gaus(k,igaus,jgausp1)) + if (upd_stc) & + stc_inc(k) = stc_inc(k) + (s2c(itile,jtile,4) * stc_inc_gaus(k,igaus,jgausp1)) + if (upd_slc) & + slc_inc(k) = slc_inc(k) + (s2c(itile,jtile,4) * slc_inc_gaus(k,igaus,jgausp1)) enddo wsum = wsum + s2c(itile,jtile,4) endif - ! add increment + ! normalize increments do k = 1, lsoil_incr stc_inc(k) = stc_inc(k) / wsum - stc_state(ij,k) = stc_state(ij,k) + stc_inc(k) - ! todo, apply some bounds? + slc_inc(k) = slc_inc(k) / wsum enddo + !---------------------------------------------------------------------- + ! add the interpolated increment to the background + !---------------------------------------------------------------------- - ! don't update soil states if snow present. - elseif(mask_tile==2) then - nsnowupd = nsnowupd + 1 + soil_freeze=.false. + soil_ice=.false. + do k = 1, lsoil_incr + + if ( stc_state(ij,k) < tfreez) soil_freeze=.true. + if ( smc_state(ij,k) - slc_state(ij,k) > 0.001 ) soil_ice=.true. + + if (upd_stc) then + stc_state(ij,k) = stc_state(ij,k) + stc_inc(k) + if (k==1) then + stc_updated(ij) = 1 + nstcupd = nstcupd + 1 + endif + endif + + if ( (stc_state(ij,k) < tfreez) .and. (.not. soil_freeze) .and. (k==1) ) & + nfrozen_upd = nfrozen_upd + 1 + + ! do not do updates if this layer or any above is frozen + if ( (.not. soil_freeze ) .and. (.not. soil_ice ) ) then + if (upd_slc) then + if (k==1) then + nslcupd = nslcupd + 1 + slc_updated(ij) = 1 + endif + ! apply zero limit here (higher, model-specific limits are later) + slc_state(ij,k) = max(slc_state(ij,k) + slc_inc(k), 0.0) + smc_state(ij,k) = max(smc_state(ij,k) + slc_inc(k), 0.0) + endif + else + if (k==1) nfrozen = nfrozen+1 + endif + + enddo endif ! if soil/snow point enddo ij_loop write(*,'(a,i2)') 'statistics of grids number processed for rank : ', myrank - write(*,'(a,i8)') ' soil grid cells updated = ',nsoilupd + write(*,'(a,i8)') ' soil grid total', lensfc + write(*,'(a,i8)') ' soil grid cells slc updated = ',nslcupd + write(*,'(a,i8)') ' soil grid cells stc updated = ',nstcupd + write(*,'(a,i8)') ' soil grid cells not updated, frozen = ',nfrozen + write(*,'(a,i8)') ' soil grid cells update, became frozen = ',nfrozen_upd write(*,'(a,i8)') ' (not updated) soil grid cells, no soil nearby on gsi grid = ',nnosoilnear - write(*,'(a,i8)') ' (not updated) soil grid cells, change in presence of snow = ', nsnowchange write(*,'(a,i8)') ' (not updated yet) snow grid cells = ', nsnowupd write(*,'(a,i8)') ' grid cells, without soil or snow = ', nother - nother = 0 ! grid cells not land - nsnowupd = 0 ! grid cells where no temp upd made, because snow occurence changed - nnosoilnear = 0 ! grid cells where model has soil, but 4 closest gaus grids don't - ! (no update made here) - nsoilupd = 0 - deallocate(id1, id2, jdc, s2c) end subroutine add_increment_soil @@ -356,7 +420,7 @@ subroutine calculate_landinc_mask(smc,swe,vtype,lensfc,veg_type_landice,mask) ! land (but not land-ice) do i=1,lensfc - if (smc(i) .LT. 1.0) then + if (smc(i) .LT. 0.99) then if (swe(i) .GT. 0.001) then ! snow covered land mask(i) = 2 else ! non-snow covered land @@ -372,13 +436,17 @@ end subroutine calculate_landinc_mask !> Make adjustments to dependent variables after applying land increments. !! These adjustments are model-dependent, and are currently only coded -!! for Noah LSM. +!! if full for Noah LSM. !! For Noah LSM, copy relevent code blocks from model code (same as has !! been done in sfc_sub). +!! For Noah-MP, have inserted place-holders to simply reset the model +!! variables back to the analysis if adjustments are needed. Later, will replace +!! this with appropriate adjustmenets (in summary, for now we do not +!! make STC updates if soils are frozen, and are also not applying the +!! appropriate max. values for SMC). !! Here: adjust (frozen) soil moisture to be consistent with changes in !! soil temperature from DA - -!> @param[in] lsm Integer code for the LSM +!! @param[in] lsm Integer code for the LSM !! @param[in] isot Integer code for the soil type data set !! @param[in] ivegsrc Integer code for the vegetation type data set !! @param[in] lensfc Number of land points for this tile @@ -386,13 +454,17 @@ end subroutine calculate_landinc_mask !! @param[in] rsoiltype Array of input soil types !! @param[in] mask Mask indicating surface type !! @param[in] stc_bck Background soil temperature states -!! @param[in] stc_anl Analysis soil temperature states -!! @param[inout] smc_adj Soil moisture state to be adjusted -!! @param[inout] slc_adj Liquid soil moisture states to be adjusted +!! @param[in] stc_adj Analysis soil temperature states +!! @param[inout] smc_adj Analysis soil moisture states +!! @param[inout] slc_adj Analysis liquid soil moisture states +!! @param[in] stc_updated Integer to record whether STC in each grid cell was updated +!! @param[in] slc_updated Integer to record whether SLC in each grid cell was updated +!! @param[in] zsoil Depth of bottom of each soil layer !! @author Clara Draper @date April 2021 -subroutine apply_land_da_adjustments_stc(lsm, isot, ivegsrc,lensfc, & - lsoil, rsoiltype, mask, stc_bck, stc_anl, smc_adj, slc_adj ) +subroutine apply_land_da_adjustments_soil(lsm, isot, ivegsrc,lensfc, & + lsoil, rsoiltype, mask, stc_bck, stc_adj, smc_adj, slc_adj, & + stc_updated, slc_updated, zsoil) use mpi use set_soilveg_snippet_mod, only: set_soilveg @@ -402,67 +474,139 @@ subroutine apply_land_da_adjustments_stc(lsm, isot, ivegsrc,lensfc, & integer, intent(in) :: lsm, lensfc, lsoil, isot, ivegsrc real, intent(in) :: rsoiltype(lensfc) ! soil types, as real - integer, intent(in) :: mask(lensfc) - real, intent(in) :: stc_bck(lensfc, lsoil) , stc_anl(lensfc, lsoil) - real, intent(inout) :: smc_adj(lensfc,lsoil), slc_adj(lensfc,lsoil) + integer, intent(in) :: mask(lensfc) + real, intent(in) :: stc_bck(lensfc, lsoil) + integer, intent(in) :: stc_updated(lensfc), slc_updated(lensfc) + real, intent(inout) :: smc_adj(lensfc,lsoil), slc_adj(lensfc,lsoil) + real, intent(inout) :: stc_adj(lensfc, lsoil) + real(kind=4), intent(in) :: zsoil(lsoil) logical :: frzn_bck, frzn_anl + logical :: soil_freeze, soil_ice - integer :: i, l, n_freeze, n_thaw, ierr - integer :: myrank, soiltype, iret + integer :: i, l, n_freeze, n_thaw, ierr, n_revert + integer :: myrank, soiltype, iret, n_stc, n_slc + logical :: upd_slc, upd_stc real :: slc_new real, parameter :: tfreez=273.16 !< con_t0c in physcons real, dimension(30) :: maxsmc, bb, satpsi + real, dimension(4) :: dz ! layer thickness call mpi_comm_rank(mpi_comm_world, myrank, ierr) - if (lsm .NE. lsm_noah) then - print *, 'FATAL ERROR: apply_land_da_adjustments not coded for models other than noah', lsm - call mpi_abort(mpi_comm_world, 10, ierr) - endif - - ! initialise soil properties - call set_soilveg(isot, ivegsrc, maxsmc, bb, satpsi, iret) - if (iret < 0) then - print *, 'FATAL ERROR: problem in set_soilveg' - call mpi_abort(mpi_comm_world, 10, ierr) + if (lsm==lsm_noah) then + upd_stc=.true. + upd_slc=.false. + elseif (lsm==lsm_noahmp) then + upd_stc=.true. + upd_slc=.true. endif - print *, 'Adjusting smc after stc DA update' + select case (lsm ) + case(lsm_noah) + ! initialise soil properties + call set_soilveg(isot, ivegsrc, maxsmc, bb, satpsi, iret) + if (iret < 0) then + print *, 'FATAL ERROR: problem in set_soilveg' + call mpi_abort(mpi_comm_world, 10, ierr) + endif - n_freeze = 0 - n_thaw = 0 - - do i=1,lensfc - if (mask(i) > 0) then ! if soil location - do l = 1, lsoil - frzn_bck = (stc_bck(i,l) .LT. tfreez ) - frzn_anl = (stc_anl(i,l) .LT. tfreez ) - - if (frzn_bck .eqv. frzn_anl) then - cycle - elseif (frzn_bck .and. .not. frzn_anl) then - n_thaw = n_thaw + 1 - else - n_freeze = n_freeze + 1 + print *, 'Adjusting noah model smc after stc DA update' + + n_freeze = 0 + n_thaw = 0 + + do i=1,lensfc + if (mask(i) > 0) then ! if soil location + do l = 1, lsoil + frzn_bck = (stc_bck(i,l) .LT. tfreez ) + frzn_anl = (stc_adj(i,l) .LT. tfreez ) + + if (frzn_bck .eqv. frzn_anl) then + cycle + elseif (frzn_bck .and. .not. frzn_anl) then + n_thaw = n_thaw + 1 + else + n_freeze = n_freeze + 1 + endif + + ! make adjustment (same routine for both) + soiltype = nint(rsoiltype(i)) + ! bb and maxsmc are in the namelist_soilveg, need soiltype index + call frh2o(stc_adj(i,l), smc_adj(i,l),slc_adj(i,l), maxsmc(soiltype), & + bb(soiltype), satpsi(soiltype),slc_new) + + slc_adj(i,l) = max( min( slc_new, smc_adj(i,l)), 0.0 ) + enddo + endif + enddo + print *, 'adjusted: ', n_thaw,' thawed,', n_freeze, ' frozen' + + case (lsm_noahmp) + + if (upd_stc) then + + print *, 'Reverting frozen noah-mp model stc back to background' + n_revert=0 + n_stc = 0 + n_slc = 0 + + do i=1,lensfc + if (stc_updated(i) == 1 ) then + n_stc = n_stc+1 + ! remove soil temperature increments if frozen + soil_freeze=.false. + soil_ice=.false. + do l = 1, lsoil_incr + if ( min(stc_bck(i,l),stc_adj(i,l)) < tfreez) soil_freeze=.true. + if ( smc_adj(i,l) - slc_adj(i,l) > 0.001 ) soil_ice=.true. + if ( soil_freeze .or. soil_ice ) then + ! for now, revert update. Later, adjust SMC/SLC for update. + if (l==1) n_revert = n_revert+1 + stc_adj(i,l)=stc_bck(i,l) + endif + enddo + endif + enddo + + endif + if (upd_slc) then + + dz(1) = -zsoil(1) + do l = 2,lsoil + dz(l) = -zsoil(l) + zsoil(l-1) + enddo + print *, 'Applying soil moisture mins ' + + do i=1,lensfc + if (slc_updated(i) == 1 ) then + n_slc = n_slc+1 + ! apply SM bounds (later: add upper SMC limit) + do l = 1, lsoil_incr + ! noah-mp minimum is 1 mm per layer (in SMC) + ! no need to maintain frozen amount, would be v. small. + slc_adj(i,l) = max( 0.001/dz(l), slc_adj(i,l) ) + smc_adj(i,l) = max( 0.001/dz(l), smc_adj(i,l) ) + enddo endif + enddo + endif - ! make adjustment (same routine for both) - soiltype = nint(rsoiltype(i)) - ! bb and maxsmc are in the namelist_soilveg, need soiltype index - call frh2o(stc_anl(i,l), smc_adj(i,l),slc_adj(i,l), maxsmc(soiltype), & - bb(soiltype), satpsi(soiltype),slc_new) + case default + print *, 'FATAL ERROR: unrecognised LSM,', lsm + call mpi_abort(mpi_comm_world, 10, ierr) + end select - slc_adj(i,l) = max( min( slc_new, smc_adj(i,l)), 0.0 ) - enddo - endif - enddo - print *, 'adjusted: ', n_thaw,' thawed,', n_freeze, ' frozen' + write(*,'(a,i2)') 'statistics of grids number processed for rank : ', myrank + write(*,'(a,i8)') ' soil grid total', lensfc + write(*,'(a,i8)') ' soil grid cells with slc update', n_slc + write(*,'(a,i8)') ' soil grid cells with stc update', n_stc + write(*,'(a,i8)') ' soil grid cells reverted', n_revert -end subroutine apply_land_da_adjustments_stc +end subroutine apply_land_da_adjustments_soil !> Make adjustments to dependent variables after applying land increments. !! These adjustments are model-dependent, and are currently only coded diff --git a/sorc/global_cycle.fd/read_write_data.f90 b/sorc/global_cycle.fd/read_write_data.f90 index e50ecd194..1cc9ad90f 100644 --- a/sorc/global_cycle.fd/read_write_data.f90 +++ b/sorc/global_cycle.fd/read_write_data.f90 @@ -49,8 +49,11 @@ MODULE READ_WRITE_DATA REAL, ALLOCATABLE, PUBLIC :: DTREF_GAUS(:,:) !< GSI foundation temperature !! increment on the gaussian grid. - REAL, ALLOCATABLE, PUBLIC :: STC_INC_GAUS(:,:,:) !< GSI soil temperature increments - !! on the gaussian grid. + REAL, ALLOCATABLE, PUBLIC :: STC_INC_GAUS(:,:,:) !< GSI soil temperature increments + !! on the gaussian grid. + + REAL, ALLOCATABLE, PUBLIC :: SLC_INC_GAUS(:,:,:) !< GSI soil moisture increments + !! on the gaussian grid. PUBLIC :: READ_DATA PUBLIC :: READ_GSI_DATA @@ -905,6 +908,7 @@ SUBROUTINE READ_GSI_DATA(GSI_FILE, FILE_TYPE, LSOIL) ALLOCATE(DUMMY(IDIM_GAUS,JDIM_GAUS+2)) ALLOCATE(STC_INC_GAUS(LSOIL,IDIM_GAUS,JDIM_GAUS)) + ALLOCATE(SLC_INC_GAUS(LSOIL,IDIM_GAUS,JDIM_GAUS)) ! read in soil temperature increments in each layer DO K = 1, LSOIL @@ -921,6 +925,19 @@ SUBROUTINE READ_GSI_DATA(GSI_FILE, FILE_TYPE, LSOIL) DO J = 1, JDIM_GAUS STC_INC_GAUS(K,:,J) = DUMMY(:,J+1) ENDDO + + INCVAR = "slc"//K_CH//"_inc" + ERROR=NF90_INQ_VARID(NCID, INCVAR, ID_VAR) + err_msg = "reading "//INCVAR//" ID" + CALL NETCDF_ERR(ERROR, trim(err_msg)) + ERROR=NF90_GET_VAR(NCID, ID_VAR, DUMMY) + err_msg = "reading "//INCVAR//" data" + CALL NETCDF_ERR(ERROR, err_msg) + + DO J = 1, JDIM_GAUS + SLC_INC_GAUS(K,:,J) = DUMMY(:,J+1) + ENDDO + ENDDO ALLOCATE(IDUMMY(IDIM_GAUS,JDIM_GAUS+2)) diff --git a/sorc/machine-setup.sh b/sorc/machine-setup.sh index a88b9ef8e..6e73630e7 100644 --- a/sorc/machine-setup.sh +++ b/sorc/machine-setup.sh @@ -98,7 +98,15 @@ elif [[ -d /data/prod ]] ; then fi target=s4 module purge +elif [[ "$(dnsdomainname)" =~ "pw" ]]; then + if [[ "${PW_CSP}" == "aws" ]]; then # TODO: Add other CSPs here. + target=noaacloud + module purge + else + echo WARNING: UNSUPPORTED CSP PLATFORM 1>&2; exit 99 + fi else + echo WARNING: UNKNOWN PLATFORM 1>&2 fi diff --git a/tests/global_cycle/ftst_land_increments.F90 b/tests/global_cycle/ftst_land_increments.F90 index dad0e7481..8519e178b 100644 --- a/tests/global_cycle/ftst_land_increments.F90 +++ b/tests/global_cycle/ftst_land_increments.F90 @@ -9,43 +9,51 @@ program ftst_land_increments implicit none - character(len=3) :: update_type - integer :: my_rank, ierr, lsm, isot, ivegsrc integer :: lensfc, lsoil, l real, parameter :: EPSILON=0.001 + real(kind=4), allocatable :: zsoil(:) real, allocatable :: rsoiltype(:) integer, allocatable :: mask(:) real, allocatable :: stc_bck(:,:) real, allocatable :: smc_anl(:,:) real, allocatable :: slc_anl(:,:) real, allocatable :: stc_anl(:,:) + integer, allocatable :: stc_updated(:), slc_updated(:) call mpi_init(ierr) call MPI_Comm_rank(MPI_COMM_WORLD, my_rank, ierr) - update_type='stc' ! Update soil temperature. - lsm=1 ! For noah land surface model. + lsm=2 ! For noah-mp land surface model. isot = 1 ! STATSGO soil type. ivegsrc = 1 ! IGBP vegetation type. lsoil = 4 ! Number of soil layers. lensfc= 3 ! Number of test points. + allocate(zsoil(lsoil)) allocate(rsoiltype(lensfc)) ! Soil type. allocate(mask(lensfc)) ! Land mask allocate(stc_bck(lensfc,lsoil)) ! Background soil temperature (K). allocate(smc_anl(lensfc,lsoil)) ! Analyzed total soil moisture. allocate(slc_anl(lensfc,lsoil)) ! Analyzed liquid soil moisture. allocate(stc_anl(lensfc,lsoil)) ! Analyzed soil temperature (K). + allocate(stc_updated(lensfc)) + allocate(slc_updated(lensfc)) + + zsoil(1) = -0.1 + zsoil(2) = -0.4 + zsoil(3) = -1.0 + zsoil(4) = -2.0 + slc_updated=1 + stc_updated=1 ! Point 1 is above freezing before the adjustment ! and above freezing after the adjustment. Therefore, -! the total and liquid portion of the soil moisture will -! be unchanged and equal. +! the increments to STC and SLC will be retained. rsoiltype(1) = 5. mask(1) = 1 @@ -53,24 +61,24 @@ program ftst_land_increments smc_anl(1,:) = .25 slc_anl(1,:) = .25 - stc_anl(1,:) = 281.0 + stc_anl(1,1:3) = 281.0 ! DA only updates 3 layers ! Point 2 is below freezing before the adjustment ! and above freezing after the adjustment. Therefore, -! the liquid portion of the soil moisture will -! be adjusted to equal the total soil moisture. +! the increment to STC will be removed, and SMC / SLC +! are unchanged. rsoiltype(2) = 5. mask(2) = 1 stc_bck(2,:) = 270.0 smc_anl(2,:) = .25 - slc_anl(2,:) = .25 - stc_anl(2,:) = 274.0 + slc_anl(2,:) = .20 + stc_anl(2,1:3) = 274.0 -! Point 3 freezes. Therefore, the liquid portion of the -! the soil moisture will be less than the total soil -! moisture. +! Point 3 freezes. Therefore, +! the increment to STC will be removed, and SMC / SLC +! are unchanged. rsoiltype(3) = 5. mask(3) = 1 @@ -78,24 +86,28 @@ program ftst_land_increments smc_anl(3,:) = .25 slc_anl(3,:) = .25 - stc_anl(3,:) = 271.0 + stc_anl(3,1:3) = 271.0 - call apply_land_da_adjustments_stc(lsm, isot, ivegsrc,lensfc, & - lsoil, rsoiltype, mask, stc_bck, stc_anl, smc_anl, slc_anl) + call apply_land_da_adjustments_soil(lsm, isot, ivegsrc,lensfc, & + lsoil, rsoiltype, mask, stc_bck, stc_anl, smc_anl, slc_anl, & + stc_updated, slc_updated,zsoil) - do l = 1, lsoil + do l = 1, 3 if (abs(smc_anl(1,l) - 0.25) > EPSILON) stop 2 if (abs(slc_anl(1,l) - 0.25) > EPSILON) stop 4 + if (abs(stc_anl(1,l) - 281.) > EPSILON) stop 3 enddo - do l = 1, lsoil + do l = 1, 3 if (abs(smc_anl(2,l) - 0.25) > EPSILON) stop 6 - if (abs(slc_anl(2,l) - 0.25) > EPSILON) stop 8 + if (abs(slc_anl(2,l) - 0.20) > EPSILON) stop 8 + if (abs(stc_anl(2,l) - 270.) > EPSILON) stop 5 enddo - do l = 1, lsoil + do l = 1, 3 if (abs(smc_anl(3,l) - 0.25) > EPSILON) stop 10 - if (abs(slc_anl(3,l) - 0.185) > EPSILON) stop 12 + if (abs(slc_anl(3,l) - 0.25) > EPSILON) stop 12 + if (abs(stc_anl(3,l) - 274.) > EPSILON) stop 11 enddo call mpi_finalize(ierr)