From 5a7d1fdc22ac377b95095d942988824965f4ab7f Mon Sep 17 00:00:00 2001 From: Joseph D Hughes Date: Mon, 31 Jan 2022 14:28:04 -0600 Subject: [PATCH 01/19] changes to build 5.3 with gfortran 11 --- prms/obs.f90 | 3 ++- prms/snowcomp.f90 | 2 +- prms/soilzone.f90 | 6 ++++-- prms/stream_temp.f90 | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/prms/obs.f90 b/prms/obs.f90 index 50db153f..37ae3315 100644 --- a/prms/obs.f90 +++ b/prms/obs.f90 @@ -59,7 +59,8 @@ INTEGER FUNCTION obssetdims() & 'Maximum number of lake elevations for any rating table data set')/=0 ) CALL read_error(7, 'nlakeelev') IF ( decldim('nwind', 0, MAXDIM, 'Number of wind-speed measurement stations')/=0 ) CALL read_error(7, 'nwind') IF ( decldim('nhumid', 0, MAXDIM, 'Number of relative humidity measurement stations')/=0 ) CALL read_error(7, 'nhumid') - IF ( decldim('nstream_temp', 0, MAXDIM, 'Number of stream temperature replacement segments')/=0 ) CALL read_error(7, 'nstream_temp') + IF ( decldim('nstream_temp', 0, MAXDIM, 'Number of stream temperature replacement segments')/=0 ) & + CALL read_error(7, 'nstream_temp') END FUNCTION obssetdims diff --git a/prms/snowcomp.f90 b/prms/snowcomp.f90 index 5a3983a1..b908abef 100644 --- a/prms/snowcomp.f90 +++ b/prms/snowcomp.f90 @@ -1865,7 +1865,7 @@ SUBROUTINE calin(Cal, Pkwater_equiv, Pk_def, Pk_temp, & IF ( Active_glacier>OFF ) THEN IF ( pmlt>apk_ice ) THEN !fractionate density with snow/active layer melting vs extra ice underneath melting - Pk_den = Pk_den*SNGL(apk_ice/pmlt) + 0.917*SNGL((pmlt-apk_ice)/pmlt) + Pk_den = Pk_den*(apk_ice/pmlt) + 0.917*((pmlt-apk_ice)/pmlt) apk_ice = pmlt Pk_ice = apmlt Pkwater_equiv = apmlt diff --git a/prms/soilzone.f90 b/prms/soilzone.f90 index 6e94c478..792ee410 100644 --- a/prms/soilzone.f90 +++ b/prms/soilzone.f90 @@ -580,7 +580,8 @@ INTEGER FUNCTION szinit() IF ( Soil_lower_stor_max(i)>0.0 ) Soil_lower_ratio(i) = Soil_lower(i)/Soil_lower_stor_max(i) IF ( Soil_zone_max(i) > 0.0 ) Basin_sz_stor_frac = Basin_sz_stor_frac + DBLE( Soil_moist_tot(i)/Soil_zone_max(i)*hruarea ) !RGN added to avoid divide by zero 1/20/2022 Basin_soil_lower_stor_frac = Basin_soil_lower_stor_frac + DBLE( Soil_lower_ratio(i)*perv_area ) - IF ( Soil_rechr_max(i)>0.0 ) Basin_soil_rechr_stor_frac = Basin_soil_rechr_stor_frac + DBLE( Soil_rechr(i)/Soil_rechr_max(i)*perv_area ) + IF ( Soil_rechr_max(i)>0.0 ) Basin_soil_rechr_stor_frac = Basin_soil_rechr_stor_frac + & + DBLE( Soil_rechr(i)/Soil_rechr_max(i)*perv_area ) Basin_soil_moist = Basin_soil_moist + DBLE( Soil_moist(i)*perv_area ) Basin_soil_moist_tot = Basin_soil_moist_tot + DBLE( Soil_moist_tot(i)*hruarea ) Basin_soil_rechr = Basin_soil_rechr + DBLE( Soil_rechr(i)*perv_area ) @@ -1007,7 +1008,8 @@ INTEGER FUNCTION szrun() IF ( Soil_zone_max(i) > 0.0 ) Basin_sz_stor_frac = Basin_sz_stor_frac + DBLE( Soil_moist_tot(i)/Soil_zone_max(i)*harea ) !RGN added to avoid divide by zero. 1/20/2022 Basin_sz_stor_frac = Basin_sz_stor_frac + DBLE( Soil_moist_tot(i)/Soil_zone_max(i)*harea ) Basin_soil_lower_stor_frac = Basin_soil_lower_stor_frac + DBLE( Soil_lower_ratio(i)*perv_area ) - IF ( Soil_rechr_max(i)>0.0 ) Basin_soil_rechr_stor_frac = Basin_soil_rechr_stor_frac + DBLE( Soil_rechr(i)/Soil_rechr_max(i)*perv_area ) + IF ( Soil_rechr_max(i)>0.0 ) Basin_soil_rechr_stor_frac = Basin_soil_rechr_stor_frac + & + DBLE( Soil_rechr(i)/Soil_rechr_max(i)*perv_area ) Recharge(i) = Soil_to_gw(i) + Ssr_to_gw(i) IF ( Dprst_flag==1 ) Recharge(i) = Recharge(i) + SNGL( Dprst_seep_hru(i) ) Basin_recharge = Basin_recharge + DBLE( Recharge(i)*harea ) diff --git a/prms/stream_temp.f90 b/prms/stream_temp.f90 index 26557db9..5da92b97 100644 --- a/prms/stream_temp.f90 +++ b/prms/stream_temp.f90 @@ -784,7 +784,7 @@ INTEGER FUNCTION stream_temp_run() ! On restart, sometimes soltab_potsw comes in as zero. It should never be zero as ! this results in divide by 0.0 if (Soltab_potsw(jday, j) <= 10.0) then - ccov = 1.0 - (Swrad(j) / sngl(10.0) * sngl(Hru_cossl(j))) + ccov = 1.0 - (Swrad(j) / 10.0 * sngl(Hru_cossl(j))) else ccov = 1.0 - (Swrad(j) / sngl(Soltab_potsw(jday, j)) * sngl(Hru_cossl(j))) endif From 89f276d35e14834a747f0044d0b140e6e996fd04 Mon Sep 17 00:00:00 2001 From: Joseph D Hughes Date: Tue, 1 Feb 2022 12:43:01 -0600 Subject: [PATCH 02/19] Add allocated(Irr_type) check before setting --- prms/intcp.f90 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/prms/intcp.f90 b/prms/intcp.f90 index 8757bcf0..53a38a87 100644 --- a/prms/intcp.f90 +++ b/prms/intcp.f90 @@ -237,7 +237,9 @@ INTEGER FUNCTION intinit() Gain_inches = 0.0 Gain_inches_hru = 0.0 ELSE - Irr_type = 0 + IF (ALLOCATED(Irr_type)) then + Irr_type = 0 + END IF ENDIF Net_apply = 0.0 From 45621d9297a8f01004a9cca42b3d83dee1940f6b Mon Sep 17 00:00:00 2001 From: Joseph D Hughes Date: Tue, 1 Feb 2022 16:04:04 -0600 Subject: [PATCH 03/19] ci: add gfortran and intel build GitHub Actions workflows --- .github/common/git-branch-export.sh | 10 ++ .github/common/install-python-std.sh | 4 + .github/common/prms_build_check.py | 10 ++ .github/intel-scripts/README.md | 17 +++ .github/intel-scripts/cache_exclude_linux.sh | 13 ++ .../intel-scripts/cache_exclude_windows.sh | 15 ++ .github/intel-scripts/ifortvars_windows.bat | 16 +++ .github/intel-scripts/install_linux.sh | 23 ++++ .github/intel-scripts/install_macos.sh | 20 +++ .github/intel-scripts/install_windows.bat | 15 ++ .../workflows/ci-tests-gfortran-latest.yml | 80 +++++++++++ .github/workflows/ci-tests-ifort.yml | 128 ++++++++++++++++++ .gitignore | 10 ++ bin/readme.txt | 2 + meson.build | 85 ++++++++++++ prms/meson.build | 74 ++++++++++ 16 files changed, 522 insertions(+) create mode 100755 .github/common/git-branch-export.sh create mode 100755 .github/common/install-python-std.sh create mode 100644 .github/common/prms_build_check.py create mode 100644 .github/intel-scripts/README.md create mode 100755 .github/intel-scripts/cache_exclude_linux.sh create mode 100644 .github/intel-scripts/cache_exclude_windows.sh create mode 100644 .github/intel-scripts/ifortvars_windows.bat create mode 100755 .github/intel-scripts/install_linux.sh create mode 100755 .github/intel-scripts/install_macos.sh create mode 100644 .github/intel-scripts/install_windows.bat create mode 100644 .github/workflows/ci-tests-gfortran-latest.yml create mode 100644 .github/workflows/ci-tests-ifort.yml create mode 100644 bin/readme.txt create mode 100644 meson.build create mode 100644 prms/meson.build diff --git a/.github/common/git-branch-export.sh b/.github/common/git-branch-export.sh new file mode 100755 index 00000000..416c0532 --- /dev/null +++ b/.github/common/git-branch-export.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +echo GITHUB_REF branch name ${GITHUB_REF##*/} +echo GITHUB_REF=${GITHUB_REF} +echo GITHUB_HEAD_REF=${GITHUB_HEAD_REF} +echo GITHUB_BASE_REF=${GITHUB_BASE_REF} +if [ -z ${GITHUB_BASE_REF+x} ]; then + export BRANCH=${GITHUB_REF##*/}; +else export BRANCH=${GITHUB_HEAD_REF}; fi +echo BRANCH=${BRANCH} diff --git a/.github/common/install-python-std.sh b/.github/common/install-python-std.sh new file mode 100755 index 00000000..ca916ab3 --- /dev/null +++ b/.github/common/install-python-std.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +pip install wheel +pip install meson ninja diff --git a/.github/common/prms_build_check.py b/.github/common/prms_build_check.py new file mode 100644 index 00000000..56fa183c --- /dev/null +++ b/.github/common/prms_build_check.py @@ -0,0 +1,10 @@ +import os +import sys + +exe_name = "prms" +if sys.platform == "win32": + exe_name += ".exe" +fpth = os.path.join("..", "..", "bin", exe_name) + +assert os.path.isfile(fpth), f"{fpth} does not exist" +assert os.access(fpth, os.X_OK), f"{fpth} is not executable" diff --git a/.github/intel-scripts/README.md b/.github/intel-scripts/README.md new file mode 100644 index 00000000..e78bd4be --- /dev/null +++ b/.github/intel-scripts/README.md @@ -0,0 +1,17 @@ +These scripts install the ifort compiler on the CI machines. + +The content has been directly copied from the Intel OneAPI-CI examples, found +here: + +https://github.com/oneapi-src/oneapi-ci + +Note that on Linux and macOS, shell scripts must be marked as executable: not +doing so for these scripts will result in a permission error during the GitHub +Action. Windows does not have such a permission system, but you can mark a +script nonetheless with git: + +``` +git update-index --chmod=+x {name_of_script} +``` + +Then commit and push. diff --git a/.github/intel-scripts/cache_exclude_linux.sh b/.github/intel-scripts/cache_exclude_linux.sh new file mode 100755 index 00000000..0e835d28 --- /dev/null +++ b/.github/intel-scripts/cache_exclude_linux.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# SPDX-FileCopyrightText: 2020 Intel Corporation +# +# SPDX-License-Identifier: MIT + +#shellcheck disable=SC2010 +LATEST_VERSION=$(ls -1 /opt/intel/oneapi/compiler/ | grep -v latest | sort | tail -1) + +sudo rm -rf /opt/intel/oneapi/compiler/"$LATEST_VERSION"/linux/compiler/lib/ia32_lin +sudo rm -rf /opt/intel/oneapi/compiler/"$LATEST_VERSION"/linux/bin/ia32 +sudo rm -rf /opt/intel/oneapi/compiler/"$LATEST_VERSION"/linux/lib/emu +sudo rm -rf /opt/intel/oneapi/compiler/"$LATEST_VERSION"/linux/lib/oclfpga \ No newline at end of file diff --git a/.github/intel-scripts/cache_exclude_windows.sh b/.github/intel-scripts/cache_exclude_windows.sh new file mode 100644 index 00000000..f396a94a --- /dev/null +++ b/.github/intel-scripts/cache_exclude_windows.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# SPDX-FileCopyrightText: 2020 Intel Corporation +# +# SPDX-License-Identifier: MIT + +#shellcheck disable=SC2010 +LATEST_VERSION=$(ls -1 "C:\Program Files (x86)\Intel\oneAPI\compiler" | grep -v latest | sort | tail -1) + +rm -rf "C:\Program Files (x86)\Intel\oneAPI\compiler\'$LATEST_VERSION'\windows\compiler\lib\ia32_win" +rm -rf "C:\Program Files (x86)\Intel\oneAPI\compiler\'$LATEST_VERSION'\windows\bin\intel64_ia32" +rm -rf "C:\Program Files (x86)\Intel\oneAPI\compiler\'$LATEST_VERSION'\windows\lib\emu" +rm -rf "C:\Program Files (x86)\Intel\oneAPI\compiler\'$LATEST_VERSION'\windows\lib\oclfpga" +rm -rf "C:\Program Files (x86)\Intel\oneAPI\compiler\'$LATEST_VERSION'\windows\lib\ocloc" +rm -rf "C:\Program Files (x86)\Intel\oneAPI\compiler\'$LATEST_VERSION'\windows\lib\x86" \ No newline at end of file diff --git a/.github/intel-scripts/ifortvars_windows.bat b/.github/intel-scripts/ifortvars_windows.bat new file mode 100644 index 00000000..d3d11677 --- /dev/null +++ b/.github/intel-scripts/ifortvars_windows.bat @@ -0,0 +1,16 @@ +REM SPDX-FileCopyrightText: 2020 Intel Corporation +REM +REM SPDX-License-Identifier: MIT + +set LANGUAGE=%1 +set VS_VER=%2 + +IF "%VS_VER%"=="2017_build_tools" ( +@call "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvars64.bat" +) + +IF "%VS_VER%"=="2019_build_tools" ( +@call "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat" +) +for /f "tokens=* usebackq" %%f in (`dir /b "C:\Program Files (x86)\Intel\oneAPI\compiler\" ^| findstr /V latest ^| sort`) do @set "LATEST_VERSION=%%f" +@call "C:\Program Files (x86)\Intel\oneAPI\compiler\%LATEST_VERSION%\env\vars.bat" diff --git a/.github/intel-scripts/install_linux.sh b/.github/intel-scripts/install_linux.sh new file mode 100755 index 00000000..52794472 --- /dev/null +++ b/.github/intel-scripts/install_linux.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# SPDX-FileCopyrightText: 2020 Intel Corporation +# +# SPDX-License-Identifier: MIT + +URL=$1 +COMPONENTS=$2 + +curl --output webimage.sh --url "$URL" --retry 5 --retry-delay 5 +chmod +x webimage.sh +./webimage.sh -x -f webimage_extracted --log extract.log +rm -rf webimage.sh +WEBIMAGE_NAME=$(ls -1 webimage_extracted/) +if [ -z "$COMPONENTS" ]; then + sudo webimage_extracted/"$WEBIMAGE_NAME"/bootstrapper -s --action install --eula=accept --log-dir=. + installer_exit_code=$? +else + sudo webimage_extracted/"$WEBIMAGE_NAME"/bootstrapper -s --action install --components="$COMPONENTS" --eula=accept --log-dir=. + installer_exit_code=$? +fi +rm -rf webimage_extracted +exit $installer_exit_code \ No newline at end of file diff --git a/.github/intel-scripts/install_macos.sh b/.github/intel-scripts/install_macos.sh new file mode 100755 index 00000000..729080ef --- /dev/null +++ b/.github/intel-scripts/install_macos.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# SPDX-FileCopyrightText: 2020 Intel Corporation +# +# SPDX-License-Identifier: MIT + +URL=$1 +COMPONENTS=$2 + +curl --output webimage.dmg --url "$URL" --retry 5 --retry-delay 5 +hdiutil attach webimage.dmg +if [ -z "$COMPONENTS" ]; then + sudo /Volumes/"$(basename "$URL" .dmg)"/bootstrapper.app/Contents/MacOS/bootstrapper -s --action install --eula=accept --continue-with-optional-error=yes --log-dir=. + installer_exit_code=$? +else + sudo /Volumes/"$(basename "$URL" .dmg)"/bootstrapper.app/Contents/MacOS/bootstrapper -s --action install --components="$COMPONENTS" --eula=accept --log-dir=. + installer_exit_code=$? +fi +hdiutil detach /Volumes/"$(basename "$URL" .dmg)" -quiet +exit $installer_exit_code \ No newline at end of file diff --git a/.github/intel-scripts/install_windows.bat b/.github/intel-scripts/install_windows.bat new file mode 100644 index 00000000..d3e0a1d8 --- /dev/null +++ b/.github/intel-scripts/install_windows.bat @@ -0,0 +1,15 @@ +REM SPDX-FileCopyrightText: 2020 Intel Corporation +REM +REM SPDX-License-Identifier: MIT + +set URL=%1 +set COMPONENTS=%2 + +curl.exe --output webimage.exe --url %URL% --retry 5 --retry-delay 5 +start /b /wait webimage.exe -s -x -f webimage_extracted --log extract.log +del webimage.exe +if "%COMPONENTS%"=="" ( + webimage_extracted\bootstrapper.exe -s --action install --eula=accept -p=NEED_VS2017_INTEGRATION=0 -p=NEED_VS2019_INTEGRATION=0 --log-dir=. +) else ( + webimage_extracted\bootstrapper.exe -s --action install --components=%COMPONENTS% --eula=accept -p=NEED_VS2017_INTEGRATION=0 -p=NEED_VS2019_INTEGRATION=0 --log-dir=. +) \ No newline at end of file diff --git a/.github/workflows/ci-tests-gfortran-latest.yml b/.github/workflows/ci-tests-gfortran-latest.yml new file mode 100644 index 00000000..9a774feb --- /dev/null +++ b/.github/workflows/ci-tests-gfortran-latest.yml @@ -0,0 +1,80 @@ +name: ci - gfortran - latest version + +on: + push: + branches: + - '5.3*' + pull_request: + branches: + - '5.3*' + +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + defaults: + run: + shell: bash + + steps: + - name: Checkout repo + uses: actions/checkout@v2.3.4 + + - name: Setup Python + uses: actions/setup-python@v2.3.1 + with: + python-version: 3.9 + + - name: Setup symbolic links on Linux + if: runner.os == 'Linux' + run: | + sudo ln -fs /usr/bin/gfortran-10 /usr/local/bin/gfortran + sudo ln -fs /usr/bin/gcc-10 /usr/local/bin/gcc + sudo ln -fs /usr/bin/g++-10 /usr/local/bin/g++ + + - name: Setup symbolic link to gfortran on macOS + if: runner.os == 'macOS' + shell: bash + run: | + sudo ln -fs /usr/local/bin/gfortran-10 /usr/local/bin/gfortran + sudo ln -fs /usr/local/bin/gcc-10 /usr/local/bin/gcc + sudo ln -fs /usr/local/bin/g++-10 /usr/local/bin/g++ + + - name: Print GNU compiler versions + run: | + gfortran --version + gcc --version + g++ --version + + - name: Install python packages + run: | + .github/common/install-python-std.sh + + - name: Set and print branch name + run: | + .github/common/git-branch-export.sh + + - name: Setup prms + run: | + meson setup builddir -Ddebug=false --prefix=$(pwd) --libdir=bin + + - name: Meson Build + uses: BSFishy/meson-build@v1.0.3 + with: + directory: builddir + action: build + setup-options: builddir -Ddebug=false --prefix=$(pwd) --libdir=bin + + - name: Meson Install + uses: BSFishy/meson-build@v1.0.3 + with: + directory: builddir + action: install + + - name: Test for build success + working-directory: ./,github/common + run: | + python prms_build_check.py diff --git a/.github/workflows/ci-tests-ifort.yml b/.github/workflows/ci-tests-ifort.yml new file mode 100644 index 00000000..13219fbb --- /dev/null +++ b/.github/workflows/ci-tests-ifort.yml @@ -0,0 +1,128 @@ +# Parts of configuration file are based on the examples in this repository: +# https://github.com/oneapi-src/oneapi-ci +# +# Which have the following copyright: +# SPDX-FileCopyrightText: 2020 Intel Corporation +# +# SPDX-License-Identifier: MIT + +name: ci - ifort + +on: + push: + branches: + - '5.3*' + pull_request: + branches: + - '5.3*' + +env: + WINDOWS_HPCKIT_URL: https://registrationcenter-download.intel.com/akdlm/irc_nas/18417/w_HPCKit_p_2022.1.0.93_offline.exe + LINUX_HPCKIT_URL: https://registrationcenter-download.intel.com/akdlm/irc_nas/18438/l_HPCKit_p_2022.1.1.97_offline.sh + MACOS_HPCKIT_URL: https://registrationcenter-download.intel.com/akdlm/irc_nas/18341/m_HPCKit_p_2022.1.0.86_offline.dmg + WINDOWS_FORTRAN_COMPONENTS: intel.oneapi.win.ifort-compiler + LINUX_FORTRAN_COMPONENTS_WEB: intel.oneapi.lin.ifort-compiler + MACOS_FORTRAN_COMPONENTS: intel.oneapi.mac.ifort-compiler + FC: ifort + +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-latest + - os: macos-latest + - os: windows-latest + defaults: + run: + shell: bash + + steps: + - name: Checkout repo + uses: actions/checkout@v2.3.4 + + - name: Setup Python + uses: actions/setup-python@v2.3.1 + with: + python-version: 3.9 + + - name: cache install ifort on linux + if: runner.os == 'Linux' + id: cache-install-linux + uses: actions/cache@v2 + with: + path: | + /opt/intel/oneapi + key: install-${{ env.LINUX_HPCKIT_URL }}-${{ env.LINUX_FORTRAN_COMPONENTS_WEB }}-compiler-${{ hashFiles('**/.github/intel-scripts/cache_exclude_linux.sh') }} + + - name: install ifort on linux + if: runner.os == 'Linux' && steps.cache-install-linux.outputs.cache-hit != 'true' + run: | + .github/intel-scripts/install_linux.sh $LINUX_HPCKIT_URL $LINUX_FORTRAN_COMPONENTS_WEB + + - name: cache install ifort on macos + if: runner.os == 'macOS' + id: cache-install-macos + uses: actions/cache@v2 + with: + path: /opt/intel/oneapi + key: install-${{ env.MACOS_HPCKIT_URL }}-${{ env.MACOS_FORTRAN_COMPONENTS }} + + - name: install ifort on macos + if: runner.os == 'macOS' && steps.cache-install-macos.outputs.cache-hit != 'true' + run: | + .github/intel-scripts/install_macos.sh $MACOS_HPCKIT_URL $MACOS_FORTRAN_COMPONENTS + + - name: cache install ifort on windows + if: runner.os == 'Windows' + id: cache-install-windows + uses: actions/cache@v2 + with: + path: C:\Program Files (x86)\Intel\oneAPI + key: install-${{ env.WINDOWS_HPCKIT_URL }}-${{ env.WINDOWS_FORTRAN_COMPONENTS }}-compiler-${{ hashFiles('**/.github/intel-scripts/cache_exclude_windows.sh') }} + + - name: install ifort on windows + if: runner.os == 'Windows' && steps.cache-install-windows.outputs.cache-hit != 'true' + run: | + .github/intel-scripts/install_windows.bat $WINDOWS_HPCKIT_URL $WINDOWS_FORTRAN_COMPONENTS + + - name: Install python packages + run: | + .github/common/install-python-std.sh + + - name: Set and print branch name + run: | + .github/common/git-branch-export.sh + + - name: Build MODFLOW 6 (Linux or macOS) + if: runner.os == 'Linux' || runner.os == 'macOS' + run: | + source /opt/intel/oneapi/setvars.sh + meson setup builddir -Ddebug=false --prefix=$(pwd) --libdir=bin + meson install -C builddir + + - name: Build MODFLOW 6 (Windows) + if: runner.os == 'Windows' + shell: cmd + run: | + call ".github/intel-scripts/ifortvars_windows.bat" + meson setup builddir -Ddebug=false --prefix=%CD% --libdir=bin + meson install -C builddir + + - name: Test for build success + working-directory: ./,github/common + run: | + python prms_build_check.py + + - name: exclude unused files from cache on linux + if: runner.os == 'Linux' && steps.cache-install-linux.outputs.cache-hit != 'true' + run: | + .github/intel-scripts/cache_exclude_linux.sh + + - name: exclude unused files from cache on windows + if: runner.os == 'Windows' && steps.cache-install-windows.outputs.cache-hit != 'true' + shell: bash + run: | + .github/intel-scripts/cache_exclude_windows.sh diff --git a/.gitignore b/.gitignore index 2fa838c3..252ab1f5 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,13 @@ *.mod *.a prms/prms + +# meson temporary files +builddir/ + +# built executables +bin/prms +bin/prms.exe + +# pycharm +.idea/ diff --git a/bin/readme.txt b/bin/readme.txt new file mode 100644 index 00000000..667e1860 --- /dev/null +++ b/bin/readme.txt @@ -0,0 +1,2 @@ +bin directory for built prms executable + diff --git a/meson.build b/meson.build new file mode 100644 index 00000000..89cbe5b2 --- /dev/null +++ b/meson.build @@ -0,0 +1,85 @@ +project( + 'PRMS 5', + 'fortran', + meson_version: '>= 0.59.0', + default_options : [ + 'b_vscrt=static_from_buildtype', # Link runtime libraries statically on Windows + 'optimization=2', + 'fortran_std=f2008', +]) + +if get_option('optimization') == '3' + error('Only optimization levels <= 2 are supported') +endif + +if get_option('optimization') == '2' + profile = 'release' +else + profile = 'develop' +endif + +message('The used profile is:', profile) + + +fc = meson.get_compiler('fortran') +fc_id = fc.get_id() +compile_args = [] +link_args = [] + +# Command line options for gfortran +if fc_id == 'gcc' + # General options + compile_args += ['-pedantic', + '-fall-intrinsics', + '-Wcharacter-truncation', + '-Wno-unused-dummy-argument', # This makes problems with OOP + '-Wno-intrinsic-shadow', # We shadow intrinsics with methods, which should be fine + '-Wno-maybe-uninitialized', # "Uninitialized" flags produce false positives with allocatables + '-Wno-uninitialized', + ] + + # Options specific to profile + if profile == 'release' + compile_args += ['-ffpe-summary=overflow', '-ffpe-trap=overflow,zero,invalid'] + elif profile == 'develop' + compile_args += ['-fcheck=all', '-ffpe-trap=overflow,zero,invalid,denormal'] + endif + + # Define OS with gfortran for OS specific code + # These are identical to pre-defined macros available with ifort + system = build_machine.system() + if system == 'linux' + compile_args += '-D__linux__' + elif system == 'darwin' + compile_args += '-D__APPLE__' + elif system == 'windows' + compile_args += '-D_WIN32' + endif +endif + +# Command line options for ifort +if fc_id == 'intel-cl' + # windows + compile_args += ['/fpe:0', # Activate all floating point exceptions + '/fpp', # Activate preprocessing + '/Qdiag-disable:7416', # f2008 warning + '/Qdiag-disable:7025', # f2008 warning + '/Qdiag-disable:5268', # Line too long + ] + link_args += ['/ignore:4217', # access through ddlimport might be inefficient + '/ignore:4286' # same as 4217, but more general + ] +elif fc_id == 'intel' + # linux and macOS + compile_args += ['-fpe0', # Activate all floating point exceptions + '-diag-disable:7416', # f2008 warning + '-diag-disable:7025', # f2008 warning + '-diag-disable:5268', # Line too long + ] + link_args += '-static-intel' +endif + +add_project_arguments(fc.get_supported_arguments(compile_args), language: 'fortran') +add_project_link_arguments(fc.get_supported_arguments(link_args), language: 'fortran') + +subdir('prms') diff --git a/prms/meson.build b/prms/meson.build new file mode 100644 index 00000000..324abf2b --- /dev/null +++ b/prms/meson.build @@ -0,0 +1,74 @@ +prms_sources = files( + 'c_utils_prms.f90', + 'prms_constants.f90', + 'c_read_parameter_file.f90', + 'prms_module.f90', + 'setup_param.f90', + 'c_prms_time.f90', + 'sm_mmf_utils.f90', + 'convert_params.f90', + 'c_mmf_utils.f90', + 'c_read_control_file.f90', + 'c_read_data_file.f90', + 'call_modules.f90', + 'sm_read_parameter_file.f90', + 'obs.f90', + 'basin.f90', + 'water_use_read.f90', + 'nhru_summary.f90', + 'basin_summary.f90', + 'sm_prms_time.f90', + 'nsegment_summary.f90', + 'cascade.f90', + 'nsub_summary.f90', + 'map_results.f90', + 'soltab.f90', + 'sm_utils_prms.f90', + 'climateflow.f90', + 'potet_hamon.f90', + 'temp_1sta_laps.f90', + 'ide_dist.f', + 'potet_hs.f90', + 'temp_dist2.f90', + 'intcp.f90', + 'potet_jh.f90', + 'temp_map.f90', + 'xyz_dist.f', + 'potet_pan.f90', + 'transp_frost.f90', + 'transp_tindex.f90', + 'climate_hru.f90', + 'srunoff.f90', + 'potet_pm_sta.f90', + 'statvar_out.f90', + 'potet_pt.f90', + 'write_climate_hru.f90', + 'precip_1sta_laps.f90', + 'ddsolrad.f90', + 'precip_dist2.f90', + 'frost_date.f90', + 'sm_read_data_file.f90', + 'precip_map.f90', + 'gwflow.f90', + 'strmflow.f90', + 'ccsolrad.f90', + 'snowcomp.f90', + 'soilzone.f90', + 'prms_summary.f90', + 'soilzone_ag.f90', + 'potet_pm.f90', + 'glacr_melt.f90', + 'dynamic_param_read.f90', + 'routing.f90', + 'muskingum.f90', + 'stream_temp.f90', + 'muskingum_lake.f90', + 'sm_read_control_file.f90', + 'subbasin.f90', + 'basin_sum.f90', + 'water_balance.f90', + 'strmflow_in_out.f90', + 'prms_fortran.f90' +) + +executable('prms', [prms_sources], install: true) From bd461085e38d2934919615ff2c10a1e8e3915427 Mon Sep 17 00:00:00 2001 From: Joseph D Hughes Date: Tue, 1 Feb 2022 16:16:47 -0600 Subject: [PATCH 04/19] ci: add gfortran and intel build GitHub Actions workflows --- .github/workflows/ci-tests-gfortran-latest.yml | 2 +- .github/workflows/ci-tests-ifort.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-tests-gfortran-latest.yml b/.github/workflows/ci-tests-gfortran-latest.yml index 9a774feb..42bd405c 100644 --- a/.github/workflows/ci-tests-gfortran-latest.yml +++ b/.github/workflows/ci-tests-gfortran-latest.yml @@ -75,6 +75,6 @@ jobs: action: install - name: Test for build success - working-directory: ./,github/common + working-directory: ./.github/common run: | python prms_build_check.py diff --git a/.github/workflows/ci-tests-ifort.yml b/.github/workflows/ci-tests-ifort.yml index 13219fbb..3d2b70f6 100644 --- a/.github/workflows/ci-tests-ifort.yml +++ b/.github/workflows/ci-tests-ifort.yml @@ -112,7 +112,7 @@ jobs: meson install -C builddir - name: Test for build success - working-directory: ./,github/common + working-directory: ./.github/common run: | python prms_build_check.py From 2aafa140147aeb0e645972fe1f9bdb1798a76ac5 Mon Sep 17 00:00:00 2001 From: Joseph D Hughes Date: Tue, 1 Feb 2022 16:26:57 -0600 Subject: [PATCH 05/19] ci: add gfortran and intel build GitHub Actions workflows --- .github/common/git-branch-export.sh | 10 --------- .../workflows/ci-tests-gfortran-latest.yml | 22 ++++++++++++++----- .github/workflows/ci-tests-ifort.yml | 10 +++------ 3 files changed, 20 insertions(+), 22 deletions(-) delete mode 100755 .github/common/git-branch-export.sh diff --git a/.github/common/git-branch-export.sh b/.github/common/git-branch-export.sh deleted file mode 100755 index 416c0532..00000000 --- a/.github/common/git-branch-export.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -echo GITHUB_REF branch name ${GITHUB_REF##*/} -echo GITHUB_REF=${GITHUB_REF} -echo GITHUB_HEAD_REF=${GITHUB_HEAD_REF} -echo GITHUB_BASE_REF=${GITHUB_BASE_REF} -if [ -z ${GITHUB_BASE_REF+x} ]; then - export BRANCH=${GITHUB_REF##*/}; -else export BRANCH=${GITHUB_HEAD_REF}; fi -echo BRANCH=${BRANCH} diff --git a/.github/workflows/ci-tests-gfortran-latest.yml b/.github/workflows/ci-tests-gfortran-latest.yml index 42bd405c..8c0d2804 100644 --- a/.github/workflows/ci-tests-gfortran-latest.yml +++ b/.github/workflows/ci-tests-gfortran-latest.yml @@ -53,27 +53,39 @@ jobs: run: | .github/common/install-python-std.sh - - name: Set and print branch name - run: | - .github/common/git-branch-export.sh - - name: Setup prms run: | meson setup builddir -Ddebug=false --prefix=$(pwd) --libdir=bin - - name: Meson Build + - name: Meson Build (Linux or macOS) + if: runner.os == 'Linux' || runner.os == 'macOS' uses: BSFishy/meson-build@v1.0.3 with: directory: builddir action: build setup-options: builddir -Ddebug=false --prefix=$(pwd) --libdir=bin + - name: Meson Build (Windows) + if: runner.os == 'Windows' + uses: BSFishy/meson-build@v1.0.3 + with: + directory: builddir + action: build + setup-options: builddir -Ddebug=false --prefix=%CD% --libdir=bin + - name: Meson Install uses: BSFishy/meson-build@v1.0.3 with: directory: builddir action: install +# - name: Build prms (Windows) +# if: runner.os == 'Windows' +# shell: cmd +# run: | +# meson setup builddir -Ddebug=false --prefix=%CD% --libdir=bin +# meson install -C builddir + - name: Test for build success working-directory: ./.github/common run: | diff --git a/.github/workflows/ci-tests-ifort.yml b/.github/workflows/ci-tests-ifort.yml index 3d2b70f6..ec275ce0 100644 --- a/.github/workflows/ci-tests-ifort.yml +++ b/.github/workflows/ci-tests-ifort.yml @@ -92,20 +92,16 @@ jobs: run: | .github/common/install-python-std.sh - - name: Set and print branch name - run: | - .github/common/git-branch-export.sh - - - name: Build MODFLOW 6 (Linux or macOS) + - name: Build prms (Linux or macOS) if: runner.os == 'Linux' || runner.os == 'macOS' run: | source /opt/intel/oneapi/setvars.sh meson setup builddir -Ddebug=false --prefix=$(pwd) --libdir=bin meson install -C builddir - - name: Build MODFLOW 6 (Windows) + - name: Build prms (Windows) if: runner.os == 'Windows' - shell: cmd + shell: pwsh run: | call ".github/intel-scripts/ifortvars_windows.bat" meson setup builddir -Ddebug=false --prefix=%CD% --libdir=bin From 93696dca46b06ef36776b2abbe7a69af9bdad7d9 Mon Sep 17 00:00:00 2001 From: Joseph D Hughes Date: Tue, 1 Feb 2022 16:31:08 -0600 Subject: [PATCH 06/19] ci: add gfortran and intel build GitHub Actions workflows --- .../workflows/ci-tests-gfortran-latest.yml | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci-tests-gfortran-latest.yml b/.github/workflows/ci-tests-gfortran-latest.yml index 8c0d2804..f15884cb 100644 --- a/.github/workflows/ci-tests-gfortran-latest.yml +++ b/.github/workflows/ci-tests-gfortran-latest.yml @@ -65,26 +65,19 @@ jobs: action: build setup-options: builddir -Ddebug=false --prefix=$(pwd) --libdir=bin - - name: Meson Build (Windows) - if: runner.os == 'Windows' - uses: BSFishy/meson-build@v1.0.3 - with: - directory: builddir - action: build - setup-options: builddir -Ddebug=false --prefix=%CD% --libdir=bin - - - name: Meson Install + - name: Meson Install (Linux or macOS) + if: runner.os == 'Linux' || runner.os == 'macOS' uses: BSFishy/meson-build@v1.0.3 with: directory: builddir action: install -# - name: Build prms (Windows) -# if: runner.os == 'Windows' -# shell: cmd -# run: | -# meson setup builddir -Ddebug=false --prefix=%CD% --libdir=bin -# meson install -C builddir + - name: Build and Install (Windows) + if: runner.os == 'Windows' + shell: pwsh + run: | + meson setup builddir -Ddebug=false --prefix=%CD% --libdir=bin + meson install -C builddir - name: Test for build success working-directory: ./.github/common From 6714788fda16e888f24f78cf9ca9e5e2ab7c7497 Mon Sep 17 00:00:00 2001 From: Joseph D Hughes Date: Tue, 1 Feb 2022 16:35:24 -0600 Subject: [PATCH 07/19] ci: add gfortran and intel build GitHub Actions workflows --- .github/workflows/ci-tests-gfortran-latest.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/ci-tests-gfortran-latest.yml b/.github/workflows/ci-tests-gfortran-latest.yml index f15884cb..ea86a2a7 100644 --- a/.github/workflows/ci-tests-gfortran-latest.yml +++ b/.github/workflows/ci-tests-gfortran-latest.yml @@ -53,10 +53,6 @@ jobs: run: | .github/common/install-python-std.sh - - name: Setup prms - run: | - meson setup builddir -Ddebug=false --prefix=$(pwd) --libdir=bin - - name: Meson Build (Linux or macOS) if: runner.os == 'Linux' || runner.os == 'macOS' uses: BSFishy/meson-build@v1.0.3 From 88c30d3d003caa5942f869075ac4011e126d7803 Mon Sep 17 00:00:00 2001 From: Joseph D Hughes Date: Tue, 1 Feb 2022 16:39:43 -0600 Subject: [PATCH 08/19] ci: add gfortran and intel build GitHub Actions workflows --- .github/workflows/ci-tests-gfortran-latest.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-tests-gfortran-latest.yml b/.github/workflows/ci-tests-gfortran-latest.yml index ea86a2a7..e617415a 100644 --- a/.github/workflows/ci-tests-gfortran-latest.yml +++ b/.github/workflows/ci-tests-gfortran-latest.yml @@ -59,7 +59,7 @@ jobs: with: directory: builddir action: build - setup-options: builddir -Ddebug=false --prefix=$(pwd) --libdir=bin + setup-options: -Ddebug=false --prefix=$(pwd) --libdir=bin - name: Meson Install (Linux or macOS) if: runner.os == 'Linux' || runner.os == 'macOS' @@ -70,7 +70,7 @@ jobs: - name: Build and Install (Windows) if: runner.os == 'Windows' - shell: pwsh + shell: cmd run: | meson setup builddir -Ddebug=false --prefix=%CD% --libdir=bin meson install -C builddir From c18e752c4496af45f9fb34ca4a0090f44658d306 Mon Sep 17 00:00:00 2001 From: Joseph D Hughes Date: Tue, 1 Feb 2022 16:42:54 -0600 Subject: [PATCH 09/19] ci: add gfortran and intel build GitHub Actions workflows --- .github/workflows/ci-tests-gfortran-latest.yml | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci-tests-gfortran-latest.yml b/.github/workflows/ci-tests-gfortran-latest.yml index e617415a..40a31ae5 100644 --- a/.github/workflows/ci-tests-gfortran-latest.yml +++ b/.github/workflows/ci-tests-gfortran-latest.yml @@ -53,20 +53,12 @@ jobs: run: | .github/common/install-python-std.sh - - name: Meson Build (Linux or macOS) + - name: Build and Install (Linux or macOS) if: runner.os == 'Linux' || runner.os == 'macOS' - uses: BSFishy/meson-build@v1.0.3 - with: - directory: builddir - action: build - setup-options: -Ddebug=false --prefix=$(pwd) --libdir=bin - - - name: Meson Install (Linux or macOS) - if: runner.os == 'Linux' || runner.os == 'macOS' - uses: BSFishy/meson-build@v1.0.3 - with: - directory: builddir - action: install + shell: cmd + run: | + meson setup builddir -Ddebug=false --prefix=$(pwd) --libdir=bin + meson install -C builddir - name: Build and Install (Windows) if: runner.os == 'Windows' From ad68bdb7c7286fc0393ace6f85250e4a37800e38 Mon Sep 17 00:00:00 2001 From: Joseph D Hughes Date: Tue, 1 Feb 2022 16:47:02 -0600 Subject: [PATCH 10/19] ci: add gfortran and intel build GitHub Actions workflows --- .github/workflows/ci-tests-gfortran-latest.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci-tests-gfortran-latest.yml b/.github/workflows/ci-tests-gfortran-latest.yml index 40a31ae5..dbbb3722 100644 --- a/.github/workflows/ci-tests-gfortran-latest.yml +++ b/.github/workflows/ci-tests-gfortran-latest.yml @@ -55,7 +55,6 @@ jobs: - name: Build and Install (Linux or macOS) if: runner.os == 'Linux' || runner.os == 'macOS' - shell: cmd run: | meson setup builddir -Ddebug=false --prefix=$(pwd) --libdir=bin meson install -C builddir From fed1ede787b5431ef3ca312e35114d6e0f82c5c3 Mon Sep 17 00:00:00 2001 From: Joseph D Hughes Date: Tue, 1 Feb 2022 16:54:52 -0600 Subject: [PATCH 11/19] ci: add gfortran and intel build GitHub Actions workflows --- .github/common/prms_build_check.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/common/prms_build_check.py b/.github/common/prms_build_check.py index 56fa183c..2fdb1337 100644 --- a/.github/common/prms_build_check.py +++ b/.github/common/prms_build_check.py @@ -8,3 +8,5 @@ assert os.path.isfile(fpth), f"{fpth} does not exist" assert os.access(fpth, os.X_OK), f"{fpth} is not executable" + +print(f"\nprms executable has been build.\n\tand is located at...'{fpth}'\n") From 4e3fdb70da0c6a89b8e7026d1d7fc62cbc920334 Mon Sep 17 00:00:00 2001 From: Joseph D Hughes Date: Tue, 1 Feb 2022 17:05:45 -0600 Subject: [PATCH 12/19] ci: add gfortran and intel build GitHub Actions workflows --- .github/workflows/ci-tests-ifort.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-tests-ifort.yml b/.github/workflows/ci-tests-ifort.yml index ec275ce0..05ed7880 100644 --- a/.github/workflows/ci-tests-ifort.yml +++ b/.github/workflows/ci-tests-ifort.yml @@ -34,7 +34,7 @@ jobs: include: - os: ubuntu-latest - os: macos-latest - - os: windows-latest + - os: windows-2019 defaults: run: shell: bash From 4017fff1bf8533f84afebcfc2dbc49815e02c165 Mon Sep 17 00:00:00 2001 From: Joseph D Hughes Date: Tue, 1 Feb 2022 17:15:36 -0600 Subject: [PATCH 13/19] ci: add gfortran and intel build GitHub Actions workflows --- .github/workflows/ci-tests-ifort.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-tests-ifort.yml b/.github/workflows/ci-tests-ifort.yml index 05ed7880..993529e5 100644 --- a/.github/workflows/ci-tests-ifort.yml +++ b/.github/workflows/ci-tests-ifort.yml @@ -101,7 +101,7 @@ jobs: - name: Build prms (Windows) if: runner.os == 'Windows' - shell: pwsh + shell: cmd run: | call ".github/intel-scripts/ifortvars_windows.bat" meson setup builddir -Ddebug=false --prefix=%CD% --libdir=bin From de8cd841302a9c2f0b47776b092cbaa79aee243e Mon Sep 17 00:00:00 2001 From: Joseph D Hughes Date: Wed, 2 Feb 2022 11:16:09 -0600 Subject: [PATCH 14/19] ci: add gfortran and intel build GitHub Actions workflows --- .github/workflows/ci-tests-gfortran-latest.yml | 2 +- prms/soltab.f90 | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci-tests-gfortran-latest.yml b/.github/workflows/ci-tests-gfortran-latest.yml index dbbb3722..7a839e1d 100644 --- a/.github/workflows/ci-tests-gfortran-latest.yml +++ b/.github/workflows/ci-tests-gfortran-latest.yml @@ -14,7 +14,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, windows-latest, macos-latest] + os: [ubuntu-latest, windows-2019, macos-latest] defaults: run: shell: bash diff --git a/prms/soltab.f90 b/prms/soltab.f90 index dc97768b..19c281a0 100644 --- a/prms/soltab.f90 +++ b/prms/soltab.f90 @@ -1,4 +1,4 @@ -!*********************************************************************** +!************************************************************************ ! Compute potential solar radiation and sunlight hours for each HRU for ! each day of year; modification of soltab_prms ! @@ -6,9 +6,9 @@ ! Swift, L.W., Jr., 1976, Algorithm for solar radiation on mountain ! slopes: Water Resources Research, v. 12, no. 1, p. 108-112. ! -! Lee, R., 1963, Evaluation of solar beam irradiation as a climatic parameter -! of mountain watersheds, Colorado State University Hydrology Papers, 2, -! 50 pp. +! Lee, R., 1963, Evaluation of solar beam irradiation as a climatic +! parameter of mountain watersheds, Colorado State University +! Hydrology Papers, 2, 50 pp. !*********************************************************************** MODULE PRMS_SOLTAB USE PRMS_CONSTANTS, ONLY: DAYS_IN_YEAR, MAX_DAYS_PER_YEAR From 9080dc7fc766b777c336a23bcf4dc87fe75aa318 Mon Sep 17 00:00:00 2001 From: Joseph D Hughes Date: Wed, 2 Feb 2022 11:19:51 -0600 Subject: [PATCH 15/19] ci: add gfortran and intel build GitHub Actions workflows --- prms/soltab.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prms/soltab.f90 b/prms/soltab.f90 index 19c281a0..ac74ed01 100644 --- a/prms/soltab.f90 +++ b/prms/soltab.f90 @@ -1,4 +1,4 @@ -!************************************************************************ +!*********************************************************************** ! Compute potential solar radiation and sunlight hours for each HRU for ! each day of year; modification of soltab_prms ! From d5ea48b3a1bc07b944ec211f5949ec3d33b20f9f Mon Sep 17 00:00:00 2001 From: Joseph D Hughes Date: Wed, 2 Feb 2022 12:14:08 -0600 Subject: [PATCH 16/19] Modify encoding of snowcomp.f90 and soltab.f90 to ansi to fix OneAPI build issue on Windows. --- prms/snowcomp.f90 | 4 ++-- prms/soltab.f90 | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/prms/snowcomp.f90 b/prms/snowcomp.f90 index b908abef..13cc0b73 100644 --- a/prms/snowcomp.f90 +++ b/prms/snowcomp.f90 @@ -1,4 +1,4 @@ -!*********************************************************************** +!*********************************************************************** ! Initiates development of a snowpack and simulates snow accumulation ! and depletion processes using an energy-budget approach ! @@ -1112,7 +1112,7 @@ INTEGER FUNCTION snorun() ! Could use equation from Swinbank 63 using Temp, a is -13.638, b is 6.148 ! temparature is halfway between the minimum and average temperature for the day !temp = (Tminc(i)+Tavgc(i))*0.5 - !emis = ((temp+273.16)**(Emis_coefb-4.0))*(10.0**(Emis_coefa+1.0))/5.670373E−8 ! /by Stefan Boltzmann in SI units + !emis = ((temp+273.16)**(Emis_coefb-4.0))*(10.0**(Emis_coefa+1.0))/5.670373E-8 ! /by Stefan Boltzmann in SI units ! If there is any precipitation in the HRU, reset the ! emissivity to 1 IF ( Hru_ppt(i)>0.0 ) emis = 1.0 ! [fraction of radiation] diff --git a/prms/soltab.f90 b/prms/soltab.f90 index ac74ed01..f5251055 100644 --- a/prms/soltab.f90 +++ b/prms/soltab.f90 @@ -1,4 +1,4 @@ -!*********************************************************************** +!*********************************************************************** ! Compute potential solar radiation and sunlight hours for each HRU for ! each day of year; modification of soltab_prms ! From 0f39860afa5c90f8a771ea0fe6cf87ae54a771a7 Mon Sep 17 00:00:00 2001 From: Joseph D Hughes Date: Wed, 2 Feb 2022 12:27:17 -0600 Subject: [PATCH 17/19] Update windows-2019 to windows-2022 VM --- .github/intel-scripts/ifortvars_windows.bat | 5 +++++ .github/workflows/ci-tests-gfortran-latest.yml | 2 +- .github/workflows/ci-tests-ifort.yml | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/intel-scripts/ifortvars_windows.bat b/.github/intel-scripts/ifortvars_windows.bat index d3d11677..8d762a59 100644 --- a/.github/intel-scripts/ifortvars_windows.bat +++ b/.github/intel-scripts/ifortvars_windows.bat @@ -12,5 +12,10 @@ IF "%VS_VER%"=="2017_build_tools" ( IF "%VS_VER%"=="2019_build_tools" ( @call "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat" ) + +IF "%VS_VER%"=="2022_build_tools" ( +@call "C:\Program Files\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat" +) + for /f "tokens=* usebackq" %%f in (`dir /b "C:\Program Files (x86)\Intel\oneAPI\compiler\" ^| findstr /V latest ^| sort`) do @set "LATEST_VERSION=%%f" @call "C:\Program Files (x86)\Intel\oneAPI\compiler\%LATEST_VERSION%\env\vars.bat" diff --git a/.github/workflows/ci-tests-gfortran-latest.yml b/.github/workflows/ci-tests-gfortran-latest.yml index 7a839e1d..d9dc6064 100644 --- a/.github/workflows/ci-tests-gfortran-latest.yml +++ b/.github/workflows/ci-tests-gfortran-latest.yml @@ -14,7 +14,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, windows-2019, macos-latest] + os: [ubuntu-latest, windows-2022, macos-latest] defaults: run: shell: bash diff --git a/.github/workflows/ci-tests-ifort.yml b/.github/workflows/ci-tests-ifort.yml index 993529e5..19926e3a 100644 --- a/.github/workflows/ci-tests-ifort.yml +++ b/.github/workflows/ci-tests-ifort.yml @@ -34,7 +34,7 @@ jobs: include: - os: ubuntu-latest - os: macos-latest - - os: windows-2019 + - os: windows-2022 defaults: run: shell: bash From 27240fbe4c8fcbddfb7bf698cf1c26d41426703d Mon Sep 17 00:00:00 2001 From: Joseph D Hughes Date: Wed, 2 Feb 2022 12:38:23 -0600 Subject: [PATCH 18/19] OneAPI for Windows does not support Visual Studio 2022 yet --- .github/intel-scripts/ifortvars_windows.bat | 4 ---- .github/workflows/ci-tests-gfortran-latest.yml | 2 +- .github/workflows/ci-tests-ifort.yml | 2 +- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/intel-scripts/ifortvars_windows.bat b/.github/intel-scripts/ifortvars_windows.bat index 8d762a59..93618bbe 100644 --- a/.github/intel-scripts/ifortvars_windows.bat +++ b/.github/intel-scripts/ifortvars_windows.bat @@ -13,9 +13,5 @@ IF "%VS_VER%"=="2019_build_tools" ( @call "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat" ) -IF "%VS_VER%"=="2022_build_tools" ( -@call "C:\Program Files\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat" -) - for /f "tokens=* usebackq" %%f in (`dir /b "C:\Program Files (x86)\Intel\oneAPI\compiler\" ^| findstr /V latest ^| sort`) do @set "LATEST_VERSION=%%f" @call "C:\Program Files (x86)\Intel\oneAPI\compiler\%LATEST_VERSION%\env\vars.bat" diff --git a/.github/workflows/ci-tests-gfortran-latest.yml b/.github/workflows/ci-tests-gfortran-latest.yml index d9dc6064..dbbb3722 100644 --- a/.github/workflows/ci-tests-gfortran-latest.yml +++ b/.github/workflows/ci-tests-gfortran-latest.yml @@ -14,7 +14,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, windows-2022, macos-latest] + os: [ubuntu-latest, windows-latest, macos-latest] defaults: run: shell: bash diff --git a/.github/workflows/ci-tests-ifort.yml b/.github/workflows/ci-tests-ifort.yml index 19926e3a..993529e5 100644 --- a/.github/workflows/ci-tests-ifort.yml +++ b/.github/workflows/ci-tests-ifort.yml @@ -34,7 +34,7 @@ jobs: include: - os: ubuntu-latest - os: macos-latest - - os: windows-2022 + - os: windows-2019 defaults: run: shell: bash From 4870bd59187603ab67bca6ea97f1c657d4c72da9 Mon Sep 17 00:00:00 2001 From: Joseph D Hughes Date: Wed, 2 Feb 2022 12:58:06 -0600 Subject: [PATCH 19/19] Update meson.build with version number --- meson.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 89cbe5b2..d159dbf4 100644 --- a/meson.build +++ b/meson.build @@ -1,6 +1,7 @@ project( - 'PRMS 5', + 'PRMS', 'fortran', + version: '5.3.0', meson_version: '>= 0.59.0', default_options : [ 'b_vscrt=static_from_buildtype', # Link runtime libraries statically on Windows