diff --git a/.editorconfig b/.editorconfig index 13e331f507..736b2ace6a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,21 +1,20 @@ #*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL FRE NetCDF tools package (FRE NCtools). -# -# FRE NCtools is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FRE NCtools is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . -#**********************************************************************/ +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. +#*********************************************************************** # This is the preferred settings for files in the FRE NetCDF package # Please visit https://editorconfig.org for information on how to diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index fbac179bef..3a221cb5cc 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # # Each line is a file pattern followed by one or more owners. The owner @@ -25,43 +24,4 @@ # These owners will be the default owners for all the files in the # repository. Unless a later match is found, these owners # will be requested for a review when a PR is opened. -* @uramirez8707 @bensonr @rem1776 @vithikashah001 - -# GNU autotools files -Makefile.am @uramirez8707 @rem1776 -/configure.ac @uramirez8707 @rem1776 -/m4/ @uramirez8707 @rem1776 -*.m4 @uramirez8707 @rem1776 - -# cmake files -CM* @mlee03 @rem1776 @vithikashah001 -cmake @mlee03 @rem1776 @vithikashah001 - -# Files specific to GitHub or GitLab -/.github/ @rem1776 @vithikashah001 - -# Testing files -/test_fms/ @uramirez8707 @mlee03 @bensonr @rem1776 @vithikashah001 - -# Specific component directories -/affinity/ @bensonr -/test_fms/affinity/ @bensonr @rem1776 - -/block_control/ @bensonr -/test_fms/block_control/ @bensonr @rem1776 - -#/data_override/ Currently no code owner -/test_fms/data_override/ @rem1776 - -/diag_manager @uramirez8707 -/test_fms/diag_manager/ @uramirez8707 - -/fms/ @uramirez8707 @rem1776 -/test_fms/fms/ @uramirez8707 @rem1776 -/fms2/ @uramirez8707 -/test_fms/fms2/ @uramirez8707 - -/libFMS/ @uramirez8707 @rem1776 - -/mpp/ @uramirez8707 @bensonr -/test_fms/mpp/ @uramirez8707 @bensonr @rem1776 +* @uramirez8707 @bensonr @rem1776 @vithikashah001 \ No newline at end of file diff --git a/.github/workflows/github_autotools_gnu.yml b/.github/workflows/github_autotools_gnu.yml index e2974877d7..a086ccfc20 100644 --- a/.github/workflows/github_autotools_gnu.yml +++ b/.github/workflows/github_autotools_gnu.yml @@ -24,7 +24,6 @@ jobs: env: TEST_VERBOSE: 1 DISTCHECK_CONFIGURE_FLAGS: "${{ matrix.conf-flag }} ${{ matrix.input-flag }} ${{ matrix.io-flag }}" - SKIP_TESTS: "test_horiz_interp2.[23-24]" # TODO (couldn't reproduce outside CI) DEBUG_FLAGS: "-O0 -g -fbounds-check -ffpe-trap=invalid,zero,overflow" # debug compiler flags taken from the mkmf template steps: - name: Checkout code diff --git a/.github/workflows/github_autotools_intel.yml b/.github/workflows/github_autotools_intel_classic.yml similarity index 89% rename from .github/workflows/github_autotools_intel.yml rename to .github/workflows/github_autotools_intel_classic.yml index 72c0655626..5dcf5b91f3 100644 --- a/.github/workflows/github_autotools_intel.yml +++ b/.github/workflows/github_autotools_intel_classic.yml @@ -1,4 +1,7 @@ -on: pull_request +on: + schedule: + - cron: '0 0 * * 0' # sundays @ midnight + # cancel running jobs if theres a newer push concurrency: @@ -18,15 +21,13 @@ jobs: LDFLAGS: "-L/libs/lib" TEST_VERBOSE: 1 I_MPI_FABRICS: "shm" # needed for mpi in image - # intel bug causes some failures with shm option(required in container) - SKIP_TESTS: "test_mpp_update_domains.1 test_update_domains_performance.1 test_diag_manager2.23" steps: - name: Cache dependencies id: cache uses: actions/cache@v4.2.0 with: path: /libs - key: ${{ runner.os }}-intel-libs + key: intel-libs - name: Install packages for building run: apt-get update && apt-get install -y autoconf libtool automake zlibc zlib1g-dev - if: steps.cache.outputs.cache-hit != 'true' diff --git a/.github/workflows/github_autotools_intel_oneapi.yml b/.github/workflows/github_autotools_intel_oneapi.yml new file mode 100644 index 0000000000..386f75f2d6 --- /dev/null +++ b/.github/workflows/github_autotools_intel_oneapi.yml @@ -0,0 +1,66 @@ +on: pull_request + +# cancel running jobs if theres a newer push +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + intel-oneapi-2025-3: + runs-on: ubuntu-latest + container: + image: intel/oneapi-hpckit:2025.3.0-0-devel-ubuntu22.04 + env: + CC: "mpiicx" + FC: "mpiifx" + CFLAGS: "-I/libs/include" + FCFLAGS: "-I/libs/include -g -traceback" + LDFLAGS: "-L/libs/lib" + TEST_VERBOSE: 1 + I_MPI_FABRICS: "shm" # needed for mpi in image + steps: + - name: Cache dependencies + id: cache + uses: actions/cache@v4.2.0 + with: + path: /libs + key: intel-libs + - name: Install packages for building + run: apt-get update && apt-get install -y autoconf libtool automake zlib1g zlib1g-dev libcurl4-openssl-dev + - if: steps.cache.outputs.cache-hit != 'true' + name: Build netcdf + run: | + # install everything to /libs + export LD_LIBRARY_PATH="/libs/lib:$LD_LIBRARY_PATH" + mkdir /libs + # hdf5 + wget https://support.hdfgroup.org/releases/hdf5/v1_14/v1_14_6/downloads/hdf5-1.14.6.tar.gz + tar xf hdf5-1.14.6.tar.gz && cd hdf5-1.14.6 + ./configure --prefix=/libs + make -j install && cd .. + # netcdf-c + wget https://github.com/Unidata/netcdf-c/archive/refs/tags/v4.9.3.tar.gz + tar xf v4.9.3.tar.gz && cd netcdf-c-4.9.3 + ./configure --prefix=/libs --disable-libxml2 --enable-netcdf-4 --enable-shared + make -j install && cd .. + # netcdf-fortran + wget https://github.com/Unidata/netcdf-fortran/archive/refs/tags/v4.6.2.tar.gz + tar xf v4.6.2.tar.gz && cd netcdf-fortran-4.6.2 + ./configure --prefix=/libs + make -j install && cd .. + # libyaml + wget https://github.com/yaml/libyaml/releases/download/0.2.5/yaml-0.2.5.tar.gz + tar xf yaml-0.2.5.tar.gz && cd yaml-0.2.5 + ./configure --prefix=/libs + make -j install && cd .. + - name: checkout + uses: actions/checkout@v4.2.2 + - name: Configure + run: | + autoreconf -if ./configure.ac + export LD_LIBRARY_PATH="/libs/lib:$LD_LIBRARY_PATH" + ./configure --with-yaml + - name: Compile + run: make -j || make + - name: Run test suite + run: make check LD_LIBRARY_PATH="/libs/lib:$LD_LIBRARY_PATH" TEST_VERBOSE=1 diff --git a/.github/workflows/github_cmake_gnu.yml b/.github/workflows/github_cmake_gnu.yml index 6390e9af95..9f8719f020 100644 --- a/.github/workflows/github_cmake_gnu.yml +++ b/.github/workflows/github_cmake_gnu.yml @@ -18,25 +18,18 @@ jobs: container: image: ghcr.io/noaa-gfdl/fms/fms-ci-rocky-gnu:13.2.0 env: - CMAKE_FLAGS: "${{ matrix.build-type }} ${{ matrix.omp-flags }} ${{ matrix.libyaml-flag }} -D64BIT=on" + CMAKE_FLAGS: "${{ matrix.build-type }} ${{ matrix.omp-flags }} ${{ matrix.libyaml-flag }}" + PKG_CONFIG_PATH: "/opt/views/view/lib64/pkgconfig:/opt/views/view/lib/pkgconfig:/opt/views/view/share/pkgconfig" steps: - name: Checkout code uses: actions/checkout@v4.2.2 - name: Generate makefiles with CMake - run: cmake $CMAKE_FLAGS -DNetCDF_ROOT=/opt/view -DLIBYAML_ROOT=/opt/view - - name: Build the library - run: make - - name: Link with basic executable run: | - echo "program test" > test.F90 - echo " use fms_mod" >> test.F90 - echo " call fms_init" >> test.F90 - echo " call fms_end" >> test.F90 - echo "end program" >> test.F90 - mpifort -L/opt/view/lib -fopenmp `nf-config --flibs` -Iinclude_r4 -Iinclude_r8 test.F90 libfms_r4.a libfms_r8.a -o test.x - touch input.nml - - name: Run executable - run: ./test.x + mkdir build + cd build + cmake $CMAKE_FLAGS -DNetCDF_ROOT=/opt/view .. + - name: Build the library + run: make -C build build_arm: runs-on: ubuntu-24.04-arm @@ -48,22 +41,15 @@ jobs: container: image: ghcr.io/noaa-gfdl/fms/fms-ci-rocky-gnu:13.2.0-arm env: - CMAKE_FLAGS: "${{ matrix.build-type }} ${{ matrix.omp-flags }} ${{ matrix.libyaml-flag }} -D64BIT=on" + CMAKE_FLAGS: "${{ matrix.build-type }} ${{ matrix.omp-flags }} ${{ matrix.libyaml-flag }}" + PKG_CONFIG_PATH: "/opt/views/view/lib64/pkgconfig:/opt/views/view/lib/pkgconfig:/opt/views/view/share/pkgconfig" steps: - name: Checkout code uses: actions/checkout@v4.2.2 - name: Generate makefiles with CMake - run: cmake $CMAKE_FLAGS -DNetCDF_ROOT=/opt/view -DLIBYAML_ROOT=/opt/view - - name: Build the library - run: make - - name: Link with basic executable run: | - echo "program test" > test.F90 - echo " use fms_mod" >> test.F90 - echo " call fms_init" >> test.F90 - echo " call fms_end" >> test.F90 - echo "end program" >> test.F90 - mpifort -L/opt/view/lib -fopenmp `nf-config --flibs` -Iinclude_r4 -Iinclude_r8 test.F90 libfms_r4.a libfms_r8.a -o test.x - touch input.nml - - name: Run executable - run: ./test.x \ No newline at end of file + mkdir build + cd build + cmake $CMAKE_FLAGS -DNetCDF_ROOT=/opt/view .. + - name: Build the library + run: make -C build diff --git a/.gitignore b/.gitignore index c011342970..e33d4100e6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # https://github.com/github/gitignore/blob/main/Fortran.gitignore # github uses C++ template, this only includes what fms generates diff --git a/CHANGELOG.md b/CHANGELOG.md index e8d26abce7..df1794e66a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,116 @@ and this project uses `yyyy.rr[.pp]`, where `yyyy` is the year a patch is releas `rr` is a sequential release number (starting from `01`), and an optional two-digit sequential patch number (starting from `01`). +## [2026.01] - 2026-01-26 + +### Known Issues +- - INTEL: Oneapi 2025.1 is currently unsupported due to an internal compiler error. The `-check uninit` flag for intel's LLVM compilers(ifx/icx) is also unsupported, see prior release for more information. +- Diag Manager Rewrite: See [below](#20240102---2024-06-14) for known output file differences regarding the new diag manager. The new diag_manager is disabled by default, so these differences will only be present if `use_modern_diag` is set to true in the `diag_manager_nml`. +- BUILD(HDF5): HDF5 version 1.14.3 generates floating point exceptions, and will cause errors if FMS is built with FPE traps enabled. FPE traps are turned on when using the debug target in mkmf. +- GCC: version 14.1.0 is unsupported due to a bug with strings that has come up previously in earlier versions. This will be caught by the configure script, but will cause compilation errors if using other build systems. + +### Added +- Modifed and added tests for future generalized indices updates (#1763) +- OFFLOAD: Added a prototype for offloading io to a smaller set of PE's `offloading_io_mod` (#1774) + +### Changed +- Legacy field_table and data_table ASCII formats are now deprecated and will output a warning if used (#1802) +- MPP: Replaced point-to-point communication with collective mode in `mpp_gather` routines (#1775) +- FMS2_IO: Refactored API for enabling MPI-IO support (#1789) +- DIAG_MANAGER: The updated diag manager will now add the experiment title as a global attribute (#1817) + +### Fixed +- Fixed multiple compiler warnings raised from GCC 15 (#1765) +- Fixed GNU warnings with the -DPORTABLE_KINDS flag (#1792) +- DIAG_MANAGER: Fixed issue with not getting correct output name when adding the cell_measure attribute (#1815) +- DIAG_MANAGER: Fixed error when setting zbounds for more than one variable (#1813) +- CMAKE: Fixed handling of libyaml dependency when using a r4/r8 option (#1822) + +### Removed +- EXCHANGE: Removed cray pointer usage from `xgrid.F90` (#1778) + +## [2025.04] - 2025-09-29 + +### Known Issues +- - INTEL: Oneapi 2025.1 is currently unsupported due to an internal compiler error. The `-check uninit` flag for intel's LLVM compilers(ifx/icx) is also unsupported, see prior release for more information. +- Diag Manager Rewrite: See [below](#20240102---2024-06-14) for known output file differences regarding the new diag manager. The new diag_manager is disabled by default, so these differences will only be present if `use_modern_diag` is set to true in the `diag_manager_nml`. +- BUILD(HDF5): HDF5 version 1.14.3 generates floating point exceptions, and will cause errors if FMS is built with FPE traps enabled. FPE traps are turned on when using the debug target in mkmf. +- GCC: version 14.1.0 is unsupported due to a bug with strings that has come up previously in earlier versions. This will be caught by the configure script, but will cause compilation errors if using other build systems. + +### Added +- TIME_INTERP: Add conservative support in time_interp_external (#1773) +- CMAKE: add unit testing information for cmake (#1772) +- TIME_INTERP: 1D time_interp_external and time_interp_external_bridge (#1758) +- FMS2_IO: Feature/mpp-gather-io-write-2d-3d (#1750) +- DIAG_INTEGRAL: set the init time to a value in diag_integral test (#1730) +- TEST_FMS: add fms_end call to test_grid2 (#1728) +- FMS2_IO: add fms2_io generalized indices test (#1734) +- ONEAPI: add checks for oneapi bug (#1712) +- FMS2_IO: Add collective writes (#1733) +- DATA_OVERRIDE: add a test to test the multi-file capability in data_override (#1745) + +### Changed +- CMAKE: update cmake build for testing, build types and mixed precision (#1694) +- LICENSE: update (#1721) +- DIAG_MANAGER: Collective IO in modern diag manager (#1756) +- MODERN_DIAG_MANAGER: Improvements to the diag_table.yaml format (#1731) +- DOCS: update FMS codeowners to be default owners only (#1722) +- DOCS: append dev to version number post-release (#1726) +- DOCS: updates README for license update. (#1744) +- FIELD_MANAGER: move the parse.inc in field_manager to include directory (#1740) + +### Fixed +- CMAKE: builds for some stuff that broke with the cmake updates on Alpha tag(#1759) +- HORIZ_INTERP: fixes the r4 tests to build properly(#1736) +- DIAG_MANAGER: modern diag manager errors when looping through number of variables (#1761) + +### Removed +- TIME_MANAGER: tests with set/get_date_gregorian_old (#1748) +- FIELD_MANAGER: removed the path length variable (#1702) +- INTERPOLATOR: remove fms2io_interpolator init (#1723) +- DIAG_MANAGER: array bounds error in the old diag manager (#1751) +- MOSAIC2: Grid2 mod Initialization Fix (#1742) + +### Tag Commit Hashes +-2025.04-beta2 0ba4c6cbaefd1363aab557a9c788d2bb4c6d6aa4 +- 2025.04-beta1 3a7ebccd33561ba076a22fbb4cb4fa6eefb0c1f5 +- 2025.04-alpha1 4f182dc459c6a60d3b3f4257cf379c8bd71e797 + +## [2025.03] - 2025-06-24 + +### Known Issues +- INTEL: Oneapi 2025.1 is currently unsupported due to an internal compiler error. The `-check uninit` flag for intel's LLVM compilers(ifx/icx) is also unsupported, see prior release for more information. +- Diag Manager Rewrite: See [below](#20240102---2024-06-14) for known output file differences regarding the new diag manager. The new diag_manager is disabled by default, so these differences will only be present if `use_modern_diag` is set to true in the `diag_manager_nml`. +- BUILD(HDF5): HDF5 version 1.14.3 generates floating point exceptions, and will cause errors if FMS is built with FPE traps enabled. FPE traps are turned on when using the debug target in mkmf. +- GCC: version 14.1.0 is unsupported due to a bug with strings that has come up previously in earlier versions. This will be caught by the configure script, but will cause compilation errors if using other build systems. + +### Added +- LICENSE: added notice about the change to Apache license. (#1685) +- DIAG_MANAGER: added standard name to diag manifest yaml (#1692) +- FMS2_IO: added netcdf chunksizes argument to register_field routines (#1696) +- DIAG_MANAGER: added more robust diag manager tests for when outputting data at every time step (#1688) +- FM2_IO: added a test for collective netcdf mpi io (#1647) + +### Changed +- DOCS: style guide update (#1642) +- DOCS: updates to contributing guide to reflect modern FMS practices (#1708) +- DOCS: fixed typos throughout the code (#1703) +- DATA_OVERRIDE: simplify argument lists of subroutines in get_grid_version_mod (#1514) + +### Fixed +- DIAG_MANAGER: fixed the time variable in instantaneous outputs from diag_manager in both openmp and non-openmp cases (#1690) +- DIAG_MANAGER: fixed number of time levels in diag manifest yaml for subregional files. (#1698) +- LIBFMS: fixed missed aliases in libFMS file (#1303) +- DIAG_MANAGER: fixed new file and file duration in MODERN_DIAG_MANAGER (#1705) + +### Removed +- FMS_IO/MPP_IO: removed fms_io/mpp_io modules (#1669) +- AMIP_INTERP: removed the sst_anom and sst_ncep varaibles (#1695) + +### Tag Commit Hashes +- 2025.03-beta1 96e97c0e271167dd42700b5ed28fb1fe85d7ecce +- 2025.03-alpha1 44f182dc459c6a60d3b3f4257cf379c8bd71e797 + ## [2025.02] - 2025-04-28 ### Known Issues diff --git a/CMAKE_INSTRUCTIONS.md b/CMAKE_INSTRUCTIONS.md index 6eb014012e..d715a58547 100644 --- a/CMAKE_INSTRUCTIONS.md +++ b/CMAKE_INSTRUCTIONS.md @@ -1,42 +1,50 @@ \page cmake Building with CMake # Instructions for building FMS with cmake -## 1. Environment Variables +## 1. Configuring the build -### For GNU compilers on Linux with the bash shell: +### Environment Variables +#### For GNU compilers on Linux with the bash shell: ``` export FC=mpifort export CC=mpicc ``` - -### For Intel Compilers on Linux with the bash shell: - +#### For Intel Compilers on Linux with the bash shell: ``` export FC=mpiifort export CC=mpiicc ``` +MPI compiler wrappers may be named different on your system, so its best to ensure the compiler commands work prior to being set. -### NetCDF is provided via the `nc-config` command: +#### NetCDF is provided via the `nc-config` command: ``` export NetCDF_ROOT=`nc-config --prefix` ``` -### If building with yaml parser (-DWITH_YAML) +### Running CMake +It's best to create a build directory inside of the FMS folder to avoid building on top of the source code. +Once that is done, CMake can be ran to generate the necessary build files: ``` -export LIBYAML_ROOT= +mkdir build && cd build +cmake [-DWITH_YAML=on] .. ``` -### Setting custom flags with the bash shell -To override the default compiler flags: -``` -export FCFLAGS="" -export CFLAGS="" -``` -In addition, the flag below must be included with the cmake command: +### Setting a Build Type +CMake uses "build types" to set compiler flags. By default (.ie no -DCMAKE_BUILD_TYPE="Type" argument when cmake is run), it will use the "Release" build type which corresponds the the prod/opt flags used by the GFDL mkmf templates. + +Similarly "Repro" and "Debug" also correspond to whatever options would be set by theircorresponding mkmf template files. + +To reproduce the old behavior for the cmake build (2025.03 and prior), the "ReleaseUFS" and "DebugUFS" will use the same flags as before. + +Please open an issue in the FMS repository if you have any issues or would like to request any changes to the current build type options. + +### Setting custom flags +To override the default compiler flags, you can set them via CMake arguments: ``` -cmake -DCMAKE_BUILD_TYPE=Debug .. +cmake -DCMAKE_BUILD_TYPE="NoFlags" -DCMAKE_C_FLAGS="" -DCMAKE_Fortran_FLAGS="" ``` +By using the "NoFlags" build type, only necessary compilation flags will be added besides what is set via the cmake arguments. ## 2. Build and install FMS with CMake `` is the full install directory for FMS provided by user @@ -45,20 +53,25 @@ cmake -DCMAKE_BUILD_TYPE=Debug .. cd FMS mkdir -p build && cd build cmake -DCMAKE_INSTALL_PREFIX= .. -make -j4 +make -j make install ``` ### User configurable options: -By default, FMS is built without `OpenMP`, in `single precision (r4)` and delivered in static library files. +By default, FMS is built with `OpenMP` enabled and delivered in static library files. + +FMS has mixed precision real support for most interfaces. By default, one library will be created, +`libfms`, that is compiled with r8 defaults but also contains overloaded r4 routines. The 64BIT and 32BIT precision options will build distinct libraries when enabled with the given default -real size, libfms_r4 or libfms_r8. +real size, libfms_r4 or libfms_r8. These option are provided for backwards compatibility, but are no longer +supported by our development team, since mixed precision can now be used with a single library. +Unit tests currently only work when no precision option is specified. The following build options are available: ``` --DOPENMP "Build FMS with OpenMP support" DEFAULT: OFF --D32BIT "Build 32-bit (r4) FMS library" DEFAULT: ON +-DOPENMP "Build FMS with OpenMP support" DEFAULT: ON +-D32BIT "Build 32-bit (r4) FMS library" DEFAULT: OFF -D64BIT "Build 64-bit (r8) FMS library" DEFAULT: OFF -DFPIC "Build with position independent code" DEFAULT: OFF -DSHARED_LIBS "Build shared/dynamic libraries" DEFAULT: OFF @@ -74,10 +87,10 @@ The following build options are available: ## 3. Installation structure -When the above command finishes, the `` will have an `include_r4` and a `lib` directory. The `lib ` directory will have these files: +When the above command finishes, the `` will have an `include` and a `lib` directory. The `lib ` directory will have these files: ``` -libfms_r4.a +libfms.a cmake/fms/fms-targets.cmake cmake/fms/fms-targets-release.cmake cmake/fms/fms-config.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 829a04e9fc..15b822b659 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # Copyright (c) GFDL, @underwoo @@ -23,19 +22,19 @@ cmake_minimum_required(VERSION 3.12 FATAL_ERROR) # Define the CMake project project(FMS - VERSION 2025.02.0 + VERSION 2026.01.0 DESCRIPTION "GFDL FMS Library" HOMEPAGE_URL "https://www.gfdl.noaa.gov/fms" LANGUAGES C Fortran) include(GNUInstallDirs) -if(NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|Release|RelWithDebInfo|MinSizeRel)$") +if(NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|Release|RelWithDebInfo|MinSizeRel|DebugUFS|ReleaseUFS)$") message(STATUS "Setting build type to 'Release' as none was specified.") set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build." FORCE) - set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo" "DebugUFS" "ReleaseUFS") endif() if(NOT CMAKE_C_COMPILER_ID MATCHES "^(Intel|GNU|Clang|IntelLLVM)$") @@ -52,8 +51,8 @@ endif() list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) # Build options -option(OPENMP "Build FMS with OpenMP support" OFF) -option(32BIT "Build 32-bit (r4) FMS library" ON) +option(OPENMP "Build FMS with OpenMP support" ON) +option(32BIT "Build 32-bit (r4) FMS library" OFF) option(64BIT "Build 64-bit (r8) FMS library" OFF) option(FPIC "Build with position independent code" OFF) option(SHARED_LIBS "Build shared/dynamic libraries" OFF) @@ -76,7 +75,7 @@ endif() if(NOT kinds) message(STATUS "Single Precision 32BIT: ${32BIT}") message(STATUS "Double Precision 64BIT: ${64BIT}") - message(FATAL_ERROR "Either 32BIT or 64BIT should be ON") + message(STATUS "No kind specified, building default double precision (with mixed precision support). Real size will not be included in built library name.") endif() # Find dependencies @@ -89,8 +88,8 @@ if (OPENMP) endif() if (WITH_YAML) - find_package(libyaml REQUIRED) - include_directories(${LIBYAML_INCLUDE_DIR}) + find_package(PkgConfig REQUIRED) + pkg_check_modules(YAML REQUIRED IMPORTED_TARGET "yaml-0.1") endif () # Enables position independent code (i.e., -fPIC) @@ -208,6 +207,7 @@ list(APPEND fms_c_src_files parser/yaml_parser_binding.c parser/yaml_output_functions.c string_utils/fms_string_utils_binding.c + test_fms/fms/test_fmsC.c # TODO just easier to lump this with the rest of the C src ) # Collect FMS header files @@ -290,6 +290,7 @@ IF(NOT NetCDF_PARALLEL) list(APPEND fms_defs NO_NC_PARALLEL4) ENDIF() +# TODO remove this section eventually, separate builds are no longer required foreach(kind ${kinds}) set(libTgt fms_${kind}) @@ -302,7 +303,6 @@ foreach(kind ${kinds}) target_include_directories(${libTgt}_c PRIVATE include grid_utils) target_compile_definitions(${libTgt}_c PRIVATE "${fms_defs}") - target_link_libraries(${libTgt}_c PRIVATE NetCDF::NetCDF_C MPI::MPI_C) @@ -340,22 +340,18 @@ foreach(kind ${kinds}) coupler/include data_override/include amip_interp/include) - target_compile_definitions(${libTgt}_f PRIVATE "${fms_defs}") target_compile_definitions(${libTgt}_f PRIVATE "${${kind}_defs}") - - set_target_properties(${libTgt}_f PROPERTIES COMPILE_FLAGS "${${kind}_flags}") - + set_target_properties(${libTgt}_f PROPERTIES COMPILE_FLAGS ${${kind}_flags}) set_target_properties(${libTgt}_f PROPERTIES Fortran_MODULE_DIRECTORY ${moduleDir}) - target_link_libraries(${libTgt}_f PRIVATE NetCDF::NetCDF_Fortran MPI::MPI_Fortran) - if(OpenMP_Fortran_FOUND) target_link_libraries(${libTgt}_f PRIVATE OpenMP::OpenMP_Fortran) endif() + # Check if gnu 10 or higher # this should only be needed with mpich, but wasn't able to find a good way to find the MPI flavor consistently if ( CMAKE_Fortran_COMPILER_VERSION MATCHES "1[0-9]\.[0-9]*\.[0-9]*" AND CMAKE_Fortran_COMPILER_ID MATCHES "GNU") @@ -367,6 +363,10 @@ foreach(kind ${kinds}) endif() endif() + if ( CMAKE_Fortran_COMPILER_VERSION MATCHES "2025\.1\..*" AND CMAKE_Fortran_COMPILER_ID MATCHES "IntelLLVM") + message(FATAL_ERROR "Intel LLVM Fortran compiler version 2025.1 is not supported due to internal compiler error") + endif() + # FMS (C + Fortran) if (SHARED_LIBS) message(STATUS "Shared library target: ${libTgt}") @@ -405,7 +405,7 @@ foreach(kind ${kinds}) $ $ $) - + set(moduleDir "${CMAKE_CURRENT_BINARY_DIR}/${includeDir}") target_include_directories(${libTgt} INTERFACE $ $) @@ -417,6 +417,10 @@ foreach(kind ${kinds}) NetCDF::NetCDF_Fortran MPI::MPI_Fortran) + if(YAML_FOUND) + target_link_libraries(${libTgt} PRIVATE PkgConfig::YAML) + endif() + if(OpenMP_Fortran_FOUND) target_link_libraries(${libTgt} PRIVATE OpenMP::OpenMP_C OpenMP::OpenMP_Fortran) endif() @@ -429,6 +433,148 @@ foreach(kind ${kinds}) endforeach() +# default build, same as an r8 build just different name +if(NOT kinds) + message(STATUS "building default kind") + set(libTgt "fms") + set(includeDir "include") + set(moduleDir "${CMAKE_CURRENT_BINARY_DIR}/${includeDir}") + set(kind "r8") + + # C + add_library(${libTgt}_c OBJECT ${fms_c_src_files}) + + target_include_directories(${libTgt}_c PRIVATE include + grid_utils) + target_compile_definitions(${libTgt}_c PRIVATE "${fms_defs}") + target_link_libraries(${libTgt}_c PRIVATE NetCDF::NetCDF_C + MPI::MPI_C) + + if(OpenMP_C_FOUND) + target_link_libraries(${libTgt}_c PRIVATE OpenMP::OpenMP_C) + endif() + + # Fortran + add_library(${libTgt}_f OBJECT ${fms_fortran_src_files}) + + target_include_directories(${libTgt}_f PRIVATE include + fms + fms/include + fms2_io/include + string_utils/include + mpp/include + column_diagnostics/include + monin_obukhov/include + sat_vapor_pres/include + horiz_interp/include + diag_integral/include + random_numbers/include + diag_manager/include + constants4 + topography/include + axis_utils/include + mosaic2/include + constants + astronomy/include + field_manager/include + time_interp/include + tracer_manager/include + tridiagonal/include + interpolator/include + coupler/include + data_override/include + amip_interp/include) + target_compile_definitions(${libTgt}_f PRIVATE "${fms_defs}") + target_compile_definitions(${libTgt}_f PRIVATE "${${kind}_defs}") + set_target_properties(${libTgt}_f PROPERTIES COMPILE_FLAGS ${${kind}_flags}) + set_target_properties(${libTgt}_f PROPERTIES Fortran_MODULE_DIRECTORY + ${moduleDir}) + target_link_libraries(${libTgt}_f PRIVATE NetCDF::NetCDF_Fortran + MPI::MPI_Fortran) + if(OpenMP_Fortran_FOUND) + target_link_libraries(${libTgt}_f PRIVATE OpenMP::OpenMP_Fortran) + endif() + + # Check if gnu 10 or higher + # this should only be needed with mpich, but wasn't able to find a good way to find the MPI flavor consistently + if ( CMAKE_Fortran_COMPILER_VERSION MATCHES "1[0-9]\.[0-9]*\.[0-9]*" AND CMAKE_Fortran_COMPILER_ID MATCHES "GNU") + include(CheckFortranCompilerFlag) + check_fortran_compiler_flag("-fallow-argument-mismatch" _arg_mismatch_flag) + if(_arg_mismatch_flag) + message(STATUS "Adding -fallow-argument-mismatch flag to compile with GCC >=10 and MPICH") + target_compile_options(${libTgt}_f PRIVATE "-fallow-argument-mismatch;-w") + endif() + endif() + + # FMS (C + Fortran) + if (SHARED_LIBS) + message(STATUS "Shared library target: ${libTgt}") + add_library(${libTgt} SHARED $ + $) + else () + message(STATUS "Static library target: ${libTgt}") + add_library(${libTgt} STATIC $ + $) + endif () + + target_include_directories(${libTgt} PUBLIC + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $) + + set(moduleDir "${CMAKE_CURRENT_BINARY_DIR}/${includeDir}") + target_include_directories(${libTgt} INTERFACE + $ + $) + + target_compile_definitions(${libTgt} PRIVATE "${fms_defs}") + target_compile_definitions(${libTgt} PRIVATE "${${kind}_defs}") + set_target_properties(${libTgt}_f PROPERTIES COMPILE_FLAGS ${${kind}_flags}) + + target_link_libraries(${libTgt} PUBLIC NetCDF::NetCDF_C + NetCDF::NetCDF_Fortran + MPI::MPI_Fortran) + + if(YAML_FOUND) + target_link_libraries(${libTgt} PRIVATE PkgConfig::YAML) + endif() + + if(OpenMP_Fortran_FOUND) + target_link_libraries(${libTgt} PRIVATE OpenMP::OpenMP_C OpenMP::OpenMP_Fortran) + endif() + + add_library(FMS::${libTgt} ALIAS ${libTgt}) + + list(APPEND LIB_TARGETS ${libTgt}) + install(DIRECTORY ${moduleDir} DESTINATION ${CMAKE_INSTALL_PREFIX}) + install(FILES ${fms_header_files} DESTINATION ${CMAKE_INSTALL_PREFIX}/${includeDir}) + + +endif() + install( TARGETS ${LIB_TARGETS} EXPORT FMSExports @@ -436,6 +582,407 @@ install( LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) +### Unit Testing +include(CTest) + +# TODO autotools also checks if srun is available +set(MPI_LAUNCHER "mpirun") +# used in the test-lib.sh.in to make it behave differently when parsed by cmake +set(USING_CMAKE "true") + +# parse and add build info to test script util file +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test_fms/test-lib.sh.in ${CMAKE_CURRENT_SOURCE_DIR}/test-lib.sh + @ONLY) + +# build any helper modules that are used by unit tests +list(APPEND TEST_MODS_SRC + test_fms/common/test_fms.F90 + test_fms/diag_manager/testing_utils.F90 + test_fms/fms/test_fms.F90 + test_fms/fms2_io/argparse.F90 + test_fms/fms2_io/setup.F90 + test_fms/mosaic2/write_files.F90 + test_fms/mpp/compare_data_checksums.F90 + test_fms/mpp/compare_data_checksums_int.F90 + test_fms/mpp/fill_halo.F90 + test_fms/mpp/test_domains_utility_mod.F90 + test_fms/mpp/test_mpp_update_domains_int.F90 + test_fms/mpp/test_mpp_update_domains_real.F90 + test_fms/mpp/test_mpp_update_domains_ad.F90 + test_fms/mpp/test_system_clock.F90) + +add_library(testLibs "${TEST_MODS_SRC}") +target_link_libraries(testLibs FMS::fms) +target_compile_definitions(testLibs PRIVATE TEST_MOS_KIND_=r8_kind) +target_include_directories(testLibs PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/common/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/fms/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/mpp/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/data_override/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/mosaic2 + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) +set_target_properties(testLibs PROPERTIES Fortran_MODULE_DIRECTORY + ${moduleDir}) + +# add all our test source code + +# this lists all source code that creates a single executable for unit testing (r8 default) +list(APPEND TEST_SRC_SINGLE_TARGET + test_fms/affinity/test_affinity.F90 + test_fms/block_control/test_block_control.F90 + test_fms/coupler/test_gex.F90 + test_fms/data_override/test_data_override_init.F90 + test_fms/data_override/test_data_override_ongrid.F90 + test_fms/diag_manager/test_output_every_freq.F90 + test_fms/diag_manager/test_dm_weights.F90 + test_fms/diag_manager/test_diag_manager.F90 + test_fms/diag_manager/test_diag_manager_time.F90 + test_fms/diag_manager/test_diag_update_buffer.F90 + test_fms/diag_manager/test_diag_yaml.F90 + test_fms/diag_manager/test_diag_ocean.F90 + test_fms/diag_manager/test_modern_diag.F90 + test_fms/diag_manager/test_diag_buffer.F90 + test_fms/diag_manager/test_flexible_time.F90 + test_fms/diag_manager/test_flush_nc_file.F90 + test_fms/diag_manager/test_diag_out_yaml.F90 + test_fms/diag_manager/test_reduction_methods.F90 + test_fms/diag_manager/testing_utils.F90 + test_fms/diag_manager/test_diag_diurnal.F90 + test_fms/diag_manager/check_time_none.F90 + test_fms/diag_manager/check_time_min.F90 + test_fms/diag_manager/check_time_max.F90 + test_fms/diag_manager/check_time_avg.F90 + test_fms/diag_manager/check_time_diurnal.F90 + test_fms/diag_manager/check_time_pow.F90 + test_fms/diag_manager/check_time_rms.F90 + test_fms/diag_manager/check_time_sum.F90 + test_fms/diag_manager/test_cell_measures.F90 + test_fms/diag_manager/check_subregional.F90 + test_fms/diag_manager/test_var_masks.F90 + test_fms/diag_manager/check_var_masks.F90 + test_fms/diag_manager/test_multiple_send_data.F90 + test_fms/diag_manager/test_prepend_date.F90 + test_fms/diag_manager/test_diag_multi_file.F90 + test_fms/diag_manager/test_ens_runs.F90 + test_fms/diag_manager/test_diag_attribute_add.F90 + test_fms/diag_manager/check_new_file_freq.F90 + test_fms/diag_manager/test_zbounds_limits.F90 + test_fms/diag_manager/test_multiple_zbounds.F90 + test_fms/drifters/test_cloud_interpolator.F90 + test_fms/drifters/test_drifters_io.F90 + test_fms/drifters/test_drifters_input.F90 + test_fms/drifters/test_drifters_comm.F90 + test_fms/drifters/test_drifters_core.F90 + test_fms/drifters/test_quicksort.F90 + test_fms/drifters/test_drifters.F90 + test_fms/exchange/test_xgrid.F90 + test_fms/field_manager/test_field_table_read.F90 + test_fms/fms2_io/test_get_is_valid.F90 + test_fms/fms2_io/test_fms2_io.F90 + test_fms/fms2_io/test_atmosphere_io.F90 + test_fms/fms2_io/test_io_simple.F90 + test_fms/fms2_io/setup.F90 + test_fms/fms2_io/argparse.F90 + test_fms/fms2_io/test_global_att.F90 + test_fms/fms2_io/test_io_with_mask.F90 + test_fms/fms2_io/test_bc_restart.F90 + test_fms/fms2_io/test_get_mosaic_tile_grid.F90 + test_fms/fms2_io/test_read_ascii_file.F90 + test_fms/fms2_io/test_file_appendix.F90 + test_fms/fms2_io/test_unlimit_compressed.F90 + test_fms/fms2_io/test_chunksizes.F90 + test_fms/fms2_io/test_packed_reads.F90 + test_fms/fms2_io/test_compressed_writes.F90 + test_fms/fms2_io/test_domain_io.F90 + test_fms/fms2_io/test_collective_io.F90 + test_fms/fms2_io/test_generalized_indices.F90 + test_fms/fms/test_fms.F90 + test_fms/interpolator/test_interpolator.F90 + test_fms/mpp/test_clock_init.F90 + test_fms/mpp/test_domains_simple.F90 + test_fms/mpp/test_domains_utility_mod.F90 + test_fms/mpp/test_global_arrays.F90 + test_fms/mpp/test_minmax.F90 + test_fms/mpp/test_mpp_alltoall.F90 + test_fms/mpp/test_mpp_broadcast.F90 + test_fms/mpp/test_mpp_chksum.F90 + test_fms/mpp/test_mpp_clock_begin_end_id.F90 + test_fms/mpp/test_mpp_domains.F90 + test_fms/mpp/test_mpp.F90 + test_fms/mpp/test_mpp_gatscat.F90 + test_fms/mpp/test_mpp_get_ascii_lines.F90 + test_fms/mpp/test_mpp_global_field_ug.F90 + test_fms/mpp/test_mpp_global_sum_ad.F90 + test_fms/mpp/test_mpp_init_logfile.F90 + test_fms/mpp/test_mpp_mem_dump.F90 + test_fms/mpp/test_mpp_memuse.F90 + test_fms/mpp/test_mpp_memutils_begin_2x.F90 + test_fms/mpp/test_mpp_memutils_begin_end.F90 + test_fms/mpp/test_mpp_memutils_end_before_begin.F90 + test_fms/mpp/test_mpp_nesting.F90 + test_fms/mpp/test_mpp_npes.F90 + test_fms/mpp/test_mpp_pe.F90 + test_fms/mpp/test_mpp_print_memuse_stats_file.F90 + test_fms/mpp/test_mpp_print_memuse_stats_stderr.F90 + test_fms/mpp/test_mpp_root_pe.F90 + test_fms/mpp/test_mpp_sendrecv.F90 + test_fms/mpp/test_mpp_sum.F90 + test_fms/mpp/test_mpp_transmit.F90 + test_fms/mpp/test_mpp_update_domains.F90 + test_fms/mpp/test_mpp_update_domains_ad.F90 + test_fms/mpp/test_peset.F90 + test_fms/mpp/test_mpp_read_ascii_file.F90 + test_fms/mpp/test_read_input_nml.F90 + test_fms/mpp/test_redistribute_int.F90 + test_fms/mpp/test_stderr.F90 + test_fms/mpp/test_stdin.F90 + test_fms/mpp/test_stdlog.F90 + test_fms/mpp/test_stdout.F90 + test_fms/mpp/test_super_grid.F90 + test_fms/mpp/test_system_clock.F90 + test_fms/mpp/test_update_domains_performance.F90 + test_fms/parser/test_yaml_parser.F90 + test_fms/parser/check_crashes.F90 + test_fms/parser/parser_demo.F90 + test_fms/parser/parser_demo2.F90 + test_fms/parser/test_output_yaml.F90 + test_fms/parser/generic_blocks.F90 + test_fms/string_utils/test_string_utils.F90 + test_fms/time_manager/test_time_manager.F90 + ) +# list any test sources that are used for two executables (r4 and r8) +list(APPEND TEST_SRC_TWO_TARGETS + test_fms/astronomy/test_astronomy.F90 + test_fms/axis_utils/test_axis_utils.F90 + test_fms/column_diagnostics/test_column_diagnostics.F90 + test_fms/coupler/test_coupler_2d.F90 + test_fms/coupler/test_coupler_3d.F90 + test_fms/coupler/test_coupler_types.F90 + test_fms/coupler/test_atmos_ocean_fluxes.F90 + test_fms/data_override/test_data_override.F90 + test_fms/data_override/test_get_grid_v1.F90 + test_fms/diag_integral/test_diag_integral.F90 + test_fms/field_manager/test_field_manager.F90 + test_fms/horiz_interp/test_horiz_interp.F90 + test_fms/horiz_interp/test_create_xgrid_order2.F90 + test_fms/interpolator/test_interpolator2.F90 + test_fms/monin_obukhov/test_monin_obukhov.F90 + test_fms/mosaic2/test_mosaic2.F90 + test_fms/mosaic2/test_grid2.F90 + test_fms/random_numbers/test_random_numbers.F90 + test_fms/sat_vapor_pres/test_sat_vapor_pres.F90 + test_fms/time_interp/test_time_interp.F90 + test_fms/time_interp/test_time_interp_external.F90 + test_fms/topography/test_topography.F90 + test_fms/tracer_manager/test_tracer_manager.F90 + test_fms/tridiagonal/test_tridiagonal.F90 + ) +# list any test sources that are used for four executables (r4, r8, i4, and i8) +list(APPEND TEST_SRC_FOUR_TARGETS + test_fms/mpp/test_mpp_global_field.F90 + ) + +# add all the test executables and set up linking + compile flags +foreach (testFile ${TEST_SRC_SINGLE_TARGET}) + get_filename_component (TName ${testFile} NAME_WE) + + add_executable(${TName} ${testFile}) + target_compile_definitions(${TName} PRIVATE "${r8_defs}") + set_target_properties(${TName} PROPERTIES COMPILE_FLAGS ${r8_flags}) + target_link_libraries(${TName} PUBLIC FMS::fms + PRIVATE testLibs + ) + + if(WITH_YAML) + target_link_libraries(${TName} PRIVATE PkgConfig::YAML) + endif() + + if(OPENMP) + target_link_libraries(${TName} PRIVATE OpenMP::OpenMP_Fortran) + endif() + + set_target_properties(${TName} PROPERTIES Fortran_MODULE_DIRECTORY + ${moduleDir}) + target_include_directories(${TName} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/fms/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/mpp/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/data_override/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/mosaic2 + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) +endforeach () + +foreach (testFile ${TEST_SRC_TWO_TARGETS}) + get_filename_component (TName ${testFile} NAME_WE) + + add_executable(${TName}_r8 ${testFile}) + target_compile_definitions(${TName}_r8 PRIVATE "${r8_defs}") + set_target_properties(${TName}_r8 PROPERTIES COMPILE_FLAGS ${r8_flags}) + target_link_libraries(${TName}_r8 PUBLIC FMS::fms + PRIVATE testLibs + ) + + add_executable(${TName}_r4 ${testFile}) + target_compile_definitions(${TName}_r4 PRIVATE "${r4_defs}") + # seems counterintuitive but r4 tests use r8 default + # they specify kind values explicitly with the preprocessor where needed (TEST_FMS_KIND_) + set_target_properties(${TName}_r4 PROPERTIES COMPILE_FLAGS ${r8_flags}) + target_link_libraries(${TName}_r4 PUBLIC FMS::fms + PRIVATE testLibs + ) + + if(WITH_YAML) + target_link_libraries(${TName}_r4 PRIVATE PkgConfig::YAML) + target_link_libraries(${TName}_r8 PRIVATE PkgConfig::YAML) + endif() + + if(OPENMP) + target_link_libraries(${TName}_r4 PRIVATE OpenMP::OpenMP_Fortran) + target_link_libraries(${TName}_r8 PRIVATE OpenMP::OpenMP_Fortran) + endif() + + set_target_properties(${TName}_r4 PROPERTIES Fortran_MODULE_DIRECTORY + ${moduleDir}) + set_target_properties(${TName}_r8 PROPERTIES Fortran_MODULE_DIRECTORY + ${moduleDir}) + target_include_directories(${TName}_r4 PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/fms/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/data_override/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/mosaic2 + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) + target_include_directories(${TName}_r8 PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/fms/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/data_override/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/mosaic2 + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) + #set macros used to test mixed precision + target_compile_definitions(${TName}_r8 PRIVATE TEST_FMS_KIND_=r8_kind) + target_compile_definitions(${TName}_r4 PRIVATE TEST_FMS_KIND_=r4_kind) + target_compile_definitions(${TName}_r8 PRIVATE FMS_TEST_BC_TYPE_=bc) + target_compile_definitions(${TName}_r4 PRIVATE FMS_TEST_BC_TYPE_=bc_r4) + target_compile_definitions(${TName}_r8 PRIVATE FMS_TEST_BC_TYPE_=bc) + target_compile_definitions(${TName}_r4 PRIVATE FMS_TEST_BC_TYPE_=bc_r4) + target_compile_definitions(${TName}_r8 PRIVATE WRITE_FILES_MOD_=write_files_r8) + target_compile_definitions(${TName}_r4 PRIVATE WRITE_FILES_MOD_=write_files_r4) +endforeach () + +foreach (testFile ${TEST_SRC_FOUR_TARGETS}) + get_filename_component (TName ${testFile} NAME_WE) + + add_executable(${TName}_r8 ${testFile}) + target_compile_definitions(${TName}_r8 PRIVATE "${r8_defs}") + set_target_properties(${TName}_r8 PROPERTIES COMPILE_FLAGS ${r8_flags}) + target_link_libraries(${TName}_r8 PUBLIC FMS::fms + PRIVATE testLibs + ) + + add_executable(${TName}_r4 ${testFile}) + target_compile_definitions(${TName}_r4 PRIVATE "${r4_defs}") + # seems counterintuitive but r4 tests use r8 default + # they specify kind values explicitly with the preprocessor where needed (TEST_FMS_KIND_) + set_target_properties(${TName}_r4 PROPERTIES COMPILE_FLAGS ${r8_flags}) + target_link_libraries(${TName}_r4 PUBLIC FMS::fms + PRIVATE testLibs + ) + + add_executable(${TName}_i8 ${testFile}) + target_compile_definitions(${TName}_i8 PRIVATE "${r8_defs}") + set_target_properties(${TName}_i8 PROPERTIES COMPILE_FLAGS ${r8_flags}) + target_link_libraries(${TName}_i8 PUBLIC FMS::fms + PRIVATE testLibs + ) + + add_executable(${TName}_i4 ${testFile}) + target_compile_definitions(${TName}_i4 PRIVATE "${r8_defs}") + set_target_properties(${TName}_i4 PROPERTIES COMPILE_FLAGS ${r8_flags}) + target_link_libraries(${TName}_i4 PUBLIC FMS::fms + PRIVATE testLibs + ) + + if(WITH_YAML) + target_link_libraries(${TName}_r4 PRIVATE yaml ${LIBYAML_LIBRARIES}) + target_link_libraries(${TName}_r8 PRIVATE yaml ${LIBYAML_LIBRARIES}) + target_link_libraries(${TName}_i4 PRIVATE yaml ${LIBYAML_LIBRARIES}) + target_link_libraries(${TName}_i8 PRIVATE yaml ${LIBYAML_LIBRARIES}) + endif() + + if(OPENMP) + target_link_libraries(${TName}_r4 PRIVATE OpenMP::OpenMP_Fortran) + target_link_libraries(${TName}_r8 PRIVATE OpenMP::OpenMP_Fortran) + target_link_libraries(${TName}_i4 PRIVATE OpenMP::OpenMP_Fortran) + target_link_libraries(${TName}_i8 PRIVATE OpenMP::OpenMP_Fortran) + endif() + + set_target_properties(${TName}_r4 PROPERTIES Fortran_MODULE_DIRECTORY + ${moduleDir}) + set_target_properties(${TName}_r8 PROPERTIES Fortran_MODULE_DIRECTORY + ${moduleDir}) + set_target_properties(${TName}_i4 PROPERTIES Fortran_MODULE_DIRECTORY + ${moduleDir}) + set_target_properties(${TName}_i8 PROPERTIES Fortran_MODULE_DIRECTORY + ${moduleDir}) + target_include_directories(${TName}_r4 PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/fms/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/mpp/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/data_override/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/mosaic2 + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) + target_include_directories(${TName}_r8 PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/fms/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/mpp/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/data_override/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/mosaic2 + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) + target_include_directories(${TName}_i4 PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/fms/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/mpp/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/data_override/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/mosaic2 + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) + target_include_directories(${TName}_i8 PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/fms/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/mpp/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/data_override/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/mosaic2 + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) + + target_compile_definitions(${TName}_r8 PRIVATE FMS_TEST_TYPE_=real) + target_compile_definitions(${TName}_r4 PRIVATE FMS_TEST_TYPE_=real) + target_compile_definitions(${TName}_i8 PRIVATE FMS_TEST_TYPE_=integer) + target_compile_definitions(${TName}_i4 PRIVATE FMS_TEST_TYPE_=integer) + + target_compile_definitions(${TName}_r8 PRIVATE FMS_TEST_KIND_=r8_kind) + target_compile_definitions(${TName}_r4 PRIVATE FMS_TEST_KIND_=r4_kind) + target_compile_definitions(${TName}_i8 PRIVATE FMS_TEST_KIND_=i8_kind) + target_compile_definitions(${TName}_i4 PRIVATE FMS_TEST_KIND_=i4_kind) +endforeach () + +# gather all test scripts +file(GLOB_RECURSE TEST_SCRIPTS ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/*/*.sh) +# leave out scripts that aren't tests +list(FILTER TEST_SCRIPTS EXCLUDE REGEX "check_crashes.*") +list(FILTER TEST_SCRIPTS EXCLUDE REGEX "test-lib*") +list(FILTER TEST_SCRIPTS EXCLUDE REGEX "tap-driver.*") + +# add scripts to ctest +foreach (testScript ${TEST_SCRIPTS}) + get_filename_component(testName ${testScript} NAME_WE) + get_filename_component(testDirNameFull ${testScript} DIRECTORY) + get_filename_component(testDirName ${testDirNameFull} NAME_WE) + add_test(NAME ${testName} + COMMAND ${testScript} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + # all tests are labeled with directory name + set_property(TEST ${testName} PROPERTY LABELS ${testDirName}) + # set an environment variable so the scripts know to skip tests that use libyaml + if(NOT WITH_YAML) + set_tests_properties(${testName} PROPERTIES + ENVIRONMENT "parser_skip=skip" + ) + endif() +endforeach() + +set(CMAKE_CTEST_ARGUMENTS "--output-on-failure") + ### Package config include(CMakePackageConfigHelpers) set(CONFIG_INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/fms) diff --git a/CODE_STYLE.md b/CODE_STYLE.md index 254b1db41c..4c172365ae 100644 --- a/CODE_STYLE.md +++ b/CODE_STYLE.md @@ -7,7 +7,7 @@ * No characters. * Supply a header for each file with a description of the file and the author(s) name or GitHub ID. -* A copy of the [Gnu Lesser General Public License](https://www.gnu.org/licenses/lgpl-3.0.en.html) +* A copy of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0) must be included at the top of each file. * Documentation should be written so that it can be parsed by [Doxygen](http://www.doxygen.nl/). * Files, modules, and public routines should be prefixed with `fms_subfolder_` where `subfolder` is @@ -97,22 +97,21 @@ ```Fortran ./fms_subfolder_example.F90 file !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file @@ -177,22 +176,21 @@ end module example_mod ``` ```Fortran ./include/example_r4.fh file !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file @@ -210,22 +208,21 @@ end module example_mod ``` ```Fortran ./include/example_r8.fh file !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file @@ -243,22 +240,21 @@ end module example_mod ``` ``` Fortran ./include/example.inc file !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !! @brief Example .inc file containing subroutine definitions/declarations diff --git a/FMS.pc.in b/FMS.pc.in index c9f2a96e5c..72bc9d9f44 100644 --- a/FMS.pc.in +++ b/FMS.pc.in @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** prefix=@prefix@ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000..dd5b3a58aa --- /dev/null +++ b/LICENSE @@ -0,0 +1,174 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. diff --git a/LICENSE.md b/LICENSE.md deleted file mode 100644 index 0927556b54..0000000000 --- a/LICENSE.md +++ /dev/null @@ -1,157 +0,0 @@ -### GNU LESSER GENERAL PUBLIC LICENSE - -Version 3, 29 June 2007 - -Copyright (C) 2007 Free Software Foundation, Inc. - - -Everyone is permitted to copy and distribute verbatim copies of this -license document, but changing it is not allowed. - -This version of the GNU Lesser General Public License incorporates the -terms and conditions of version 3 of the GNU General Public License, -supplemented by the additional permissions listed below. - -#### 0. Additional Definitions. - -As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the -GNU General Public License. - -"The Library" refers to a covered work governed by this License, other -than an Application or a Combined Work as defined below. - -An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - -A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - -The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - -The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - -#### 1. Exception to Section 3 of the GNU GPL. - -You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - -#### 2. Conveying Modified Versions. - -If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - -- a) under this License, provided that you make a good faith effort - to ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or -- b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - -#### 3. Object Code Incorporating Material from Library Header Files. - -The object code form of an Application may incorporate material from a -header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - -- a) Give prominent notice with each copy of the object code that - the Library is used in it and that the Library and its use are - covered by this License. -- b) Accompany the object code with a copy of the GNU GPL and this - license document. - -#### 4. Combined Works. - -You may convey a Combined Work under terms of your choice that, taken -together, effectively do not restrict modification of the portions of -the Library contained in the Combined Work and reverse engineering for -debugging such modifications, if you also do each of the following: - -- a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. -- b) Accompany the Combined Work with a copy of the GNU GPL and this - license document. -- c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. -- d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of - this License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with - the Library. A suitable mechanism is one that (a) uses at run - time a copy of the Library already present on the user's - computer system, and (b) will operate properly with a modified - version of the Library that is interface-compatible with the - Linked Version. -- e) Provide Installation Information, but only if you would - otherwise be required to provide such information under section 6 - of the GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the Application - with a modified version of the Linked Version. (If you use option - 4d0, the Installation Information must accompany the Minimal - Corresponding Source and Corresponding Application Code. If you - use option 4d1, you must provide the Installation Information in - the manner specified by section 6 of the GNU GPL for conveying - Corresponding Source.) - -#### 5. Combined Libraries. - -You may place library facilities that are a work based on the Library -side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - -- a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities, conveyed under the terms of this License. -- b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - -#### 6. Revised Versions of the GNU Lesser General Public License. - -The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -as you received it specifies that a certain numbered version of the -GNU Lesser General Public License "or any later version" applies to -it, you have the option of following the terms and conditions either -of that published version or of any later version published by the -Free Software Foundation. If the Library as you received it does not -specify a version number of the GNU Lesser General Public License, you -may choose any version of the GNU Lesser General Public License ever -published by the Free Software Foundation. - -If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. diff --git a/Makefile.am b/Makefile.am index d46b3b6559..7d57259316 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is the main automake file for FMS. @@ -44,6 +43,7 @@ SUBDIRS = \ fms2_io \ mosaic2 \ fms \ + offloading \ parser \ string_utils \ affinity \ diff --git a/README.md b/README.md index 00f9898caa..88af02074c 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ FMS will switch to the [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt) -with the 2025.04 or 2026.01 release. Please refer to +with the 2025.04 release scheduled for September 2025. Please refer to [issue 1683 on changing the license](https://github.com/NOAA-GFDL/FMS/issues/1683) to participate in or follow any discussion on the topic. @@ -75,7 +75,7 @@ essential facet of FMS. The following external libraries are required when building libFMS * NetCDF C and Fortran (77/90) headers and libraries -* Fortran 2003 standard compiler +* Fortran 2008 standard compiler * Fortran compiler that supports Cray Pointer * MPI C and Fortran headers and libraries (optional) * Libyaml header and libraries (optional) diff --git a/TESTING.md b/TESTING.md index a414904a72..93cc9a98c7 100644 --- a/TESTING.md +++ b/TESTING.md @@ -1,18 +1,24 @@ # Unit Testing -FMS includes a suite of MPI unit tests using the testing infrastructure included in the GNU autotools build system -in order to check the functionality of the library's modules. +FMS includes a suite of MPI unit tests for most subdirectories and modules that make up the library. It consists of programs in the test_fms/ directory, with shell scripts to handle directory set up and input files. test_lib.sh.in and tap-driver.sh provide additional helper functions used in the scripts and manage output. +The unit tests can be run either through the autotools build system, or through cmake via ctest. +The different build systems will run the exact same scripts and executables, but there are some differences in the commands used to start the testing. + +## Autotools Unit Testing + ### Running the Tests -1. Configure with autotools +1. Configure and build the code with autotools ``` mkdir build # create a build directory in FMS +cd build autoreconf -if ../configure.ac ../configure +make ``` 2. Build and run suite @@ -21,7 +27,14 @@ make check ``` This will compile any code not already compiled and then proceed to run the test scripts. -### Debugging Output and Test Options +If a test fails, `make check` will stop running the rest of the unit tests once it is done with the current subdirectory. + +To instead run all of the tests regardless of failures, the `-k` option can be given: +``` +make check -k +``` + +### Debugging Output and Test Options for Autotools Setting the environment variable TEST_VERBOSE will direct output to stdout as the test runs, while setting VERBOSE will only output on failure. Logs are created for each test as well, with the name \.log in its corresponding test_fms/ directory. @@ -44,3 +57,40 @@ for the build system: - `--enable-test-input=/path/to/input` turns on test scripts that require input netcdf files (interpolator, xgrid, data_override). This option is mainly used internally and in automated testing since we do not host the input data publicly. - `--with-yaml` compile with yaml input and enable its associated tests + +## CMake Unit Testing + +### Running the tests + +1. Configure and build the code and tests with cmake +``` +mkdir build +cd build +cmake .. +make +``` +2. Run the tests with ctest +``` +ctest +``` +Alternatively, the generated makefile can be used as well: +``` +make test +``` +### Debugging and Test Options for CMake + +To rerun failed tests with debug output from a previous failed ctest command: +``` +ctest --rerun-failed --verbose +``` +All tests are labeled with the subdirectory they are in in the `test_fms` directory. +To run tests for a specific area of the code, such as the mpp modules: +``` +ctest -L mpp +``` +To run specific tests matching the given regex: +``` +ctest -R +``` + +For more testing options with ctest, you can look to the [ctest documentation](https://cmake.org/cmake/help/latest/manual/ctest.1.html). diff --git a/affinity/Makefile.am b/affinity/Makefile.am index 559bcf41ab..73426598c6 100644 --- a/affinity/Makefile.am +++ b/affinity/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the memutils directory of the FMS diff --git a/affinity/affinity.c b/affinity/affinity.c index fff6622fb1..9abba169a6 100644 --- a/affinity/affinity.c +++ b/affinity/affinity.c @@ -1,23 +1,20 @@ -/** \cond - */ /*********************************************************************** - * GNU Lesser General Public License + * Apache License 2.0 * * This file is part of the GFDL Flexible Modeling System (FMS). * - * FMS is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or (at - * your option) any later version. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * FMS is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Lesser General Public - * License along with FMS. If not, see . - **********************************************************************/ + * FMS is distributed in the hope that it will be useful, but WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the License for the specific language + * governing permissions and limitations under the License. + ***********************************************************************/ #ifndef _GNU_SOURCE #define _GNU_SOURCE diff --git a/affinity/fms_affinity.F90 b/affinity/fms_affinity.F90 index 33a305ebb0..25b3c22532 100644 --- a/affinity/fms_affinity.F90 +++ b/affinity/fms_affinity.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup fms_affinity_mod fms_affinity_mod diff --git a/amip_interp/Makefile.am b/amip_interp/Makefile.am index 27f50fcbf8..e42a542aa2 100644 --- a/amip_interp/Makefile.am +++ b/amip_interp/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the amip_interp directory of the FMS diff --git a/amip_interp/amip_interp.F90 b/amip_interp/amip_interp.F90 index 876ee0f5c9..9bd1e97baa 100644 --- a/amip_interp/amip_interp.F90 +++ b/amip_interp/amip_interp.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** ! !> @defgroup amip_interp_mod amip_interp_mod diff --git a/amip_interp/include/amip_interp.inc b/amip_interp/include/amip_interp.inc index ccb261fffa..50be7cbcf0 100644 --- a/amip_interp/include/amip_interp.inc +++ b/amip_interp/include/amip_interp.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** ! modified by JHC diff --git a/astronomy/Makefile.am b/astronomy/Makefile.am index 50a1449412..9fe5a98033 100644 --- a/astronomy/Makefile.am +++ b/astronomy/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the astronomy directory of the FMS diff --git a/astronomy/astronomy.F90 b/astronomy/astronomy.F90 index 7bcce62d71..2c087aefd0 100644 --- a/astronomy/astronomy.F90 +++ b/astronomy/astronomy.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup astronomy_mod astronomy_mod !> @ingroup astronomy diff --git a/astronomy/include/astronomy.inc b/astronomy/include/astronomy.inc index d26f97a7de..5571942572 100644 --- a/astronomy/include/astronomy.inc +++ b/astronomy/include/astronomy.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup astronomy_mod astronomy_mod !> @ingroup astronomy diff --git a/astronomy/include/astronomy_r4.fh b/astronomy/include/astronomy_r4.fh index 949603749e..be24a96a5e 100644 --- a/astronomy/include/astronomy_r4.fh +++ b/astronomy/include/astronomy_r4.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup astronomy_mod astronomy_mod !> @ingroup astronomy diff --git a/astronomy/include/astronomy_r8.fh b/astronomy/include/astronomy_r8.fh index e63aa9a954..c4a2f443c6 100644 --- a/astronomy/include/astronomy_r8.fh +++ b/astronomy/include/astronomy_r8.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup astronomy_mod astronomy_mod !> @ingroup astronomy diff --git a/axis_utils/Makefile.am b/axis_utils/Makefile.am index 2007e28cf5..a2b99675b7 100644 --- a/axis_utils/Makefile.am +++ b/axis_utils/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the axis_utils directory of the FMS diff --git a/axis_utils/axis_utils2.F90 b/axis_utils/axis_utils2.F90 index bbc7611a77..f3b09e2a46 100644 --- a/axis_utils/axis_utils2.F90 +++ b/axis_utils/axis_utils2.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup axis_utils2_mod axis_utils2_mod !> @ingroup axis_utils diff --git a/axis_utils/include/axis_utils2.inc b/axis_utils/include/axis_utils2.inc index e9e612036f..0d1b5e8e76 100644 --- a/axis_utils/include/axis_utils2.inc +++ b/axis_utils/include/axis_utils2.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup axis_utils2_mod axis_utils2_mod !> @ingroup axis_utils diff --git a/axis_utils/include/axis_utils2_r4.fh b/axis_utils/include/axis_utils2_r4.fh index 82f14eaaf9..c2b5a5c666 100644 --- a/axis_utils/include/axis_utils2_r4.fh +++ b/axis_utils/include/axis_utils2_r4.fh @@ -1,22 +1,21 @@ ! -*-f90-*- !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief Imports checksum, gather, and scatter routines from other include files used diff --git a/axis_utils/include/axis_utils2_r8.fh b/axis_utils/include/axis_utils2_r8.fh index c58ce573ab..3edc8a446b 100644 --- a/axis_utils/include/axis_utils2_r8.fh +++ b/axis_utils/include/axis_utils2_r8.fh @@ -1,22 +1,21 @@ ! -*-f90-*- !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief Imports checksum, gather, and scatter routines from other include files used diff --git a/block_control/Makefile.am b/block_control/Makefile.am index 7006da13f5..3ad036ca1a 100644 --- a/block_control/Makefile.am +++ b/block_control/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the block_control directory of the FMS diff --git a/block_control/block_control.F90 b/block_control/block_control.F90 index f78e8659f3..85f0f7c103 100644 --- a/block_control/block_control.F90 +++ b/block_control/block_control.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup block_control_mod block_control_mod !> @ingroup block_control diff --git a/cmake/FMSConfig.cmake.in b/cmake/FMSConfig.cmake.in index 8d3c50a4da..b758eb123b 100644 --- a/cmake/FMSConfig.cmake.in +++ b/cmake/FMSConfig.cmake.in @@ -24,6 +24,10 @@ endif() list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) find_dependency(NetCDF COMPONENTS C Fortran) +if(@WITH_YAML@) + find_dependency(PkgConfig REQUIRED) + pkg_check_modules(YAML REQUIRED IMPORTED_TARGET "yaml-0.1") +endif() list(REMOVE_ITEM CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) diff --git a/cmake/Findlibyaml.cmake b/cmake/Findlibyaml.cmake deleted file mode 100644 index 029447c70d..0000000000 --- a/cmake/Findlibyaml.cmake +++ /dev/null @@ -1,11 +0,0 @@ -# Try to find libyaml includes and library. -# The following variables are set: -# LIBYAML_INCLUDE_DIR -# LIBYAML_LIBRARIES - -FIND_PATH(LIBYAML_INCLUDE_DIR NAMES yaml.h PATHS ${LIBYAML_ROOT}/include $ENV{LIBYAML_ROOT}/include ) -FIND_LIBRARY(LIBYAML_LIBRARIES NAMES yaml PATHS ${LIBYAML_ROOT}/lib $ENV{LIBYAML_ROOT}/lib ) -if(NOT LIBYAML_INCLUDE_DIR OR NOT LIBYAML_LIBRARIES) - message(SEND_ERROR "libyaml library/include file not found, set LIBYAML_ROOT") -endif() -MARK_AS_ADVANCED(LIBYAML_INCLUDE_DIR LIBYAML_LIBRARIES) diff --git a/cmake/compiler_flags_Clang_C.cmake b/cmake/compiler_flags_Clang_C.cmake index f8eaafb2fc..39a0751f9b 100644 --- a/cmake/compiler_flags_Clang_C.cmake +++ b/cmake/compiler_flags_Clang_C.cmake @@ -1,6 +1,6 @@ # Clang C set( CMAKE_C_FLAGS_RELEASE "-O3" ) -set( CMAKE_C_FLAGS_DEBUG "-O0 -g" ) +set( CMAKE_C_FLAGS_DEBUGUFS "-O0 -g" ) set( CMAKE_C_LINK_FLAGS "" ) diff --git a/cmake/compiler_flags_GNU_C.cmake b/cmake/compiler_flags_GNU_C.cmake index 1433f3efc3..8cd22e2188 100644 --- a/cmake/compiler_flags_GNU_C.cmake +++ b/cmake/compiler_flags_GNU_C.cmake @@ -1,6 +1,10 @@ # GNU C -set(CMAKE_C_FLAGS_RELEASE "-O3") - +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") +set(CMAKE_C_FLAGS_RELEASE "-O2") set(CMAKE_C_FLAGS_DEBUG "-O0 -g") set(CMAKE_C_LINK_FLAGS "") + +# ufs flags +set(CMAKE_C_FLAGS_RELEASEUFS "-O3") +set(CMAKE_C_FLAGS_DEBUGUFS "-O0 -g") diff --git a/cmake/compiler_flags_GNU_Fortran.cmake b/cmake/compiler_flags_GNU_Fortran.cmake index 79719f957d..cffa72cbf6 100644 --- a/cmake/compiler_flags_GNU_Fortran.cmake +++ b/cmake/compiler_flags_GNU_Fortran.cmake @@ -1,11 +1,15 @@ # Precision-based Fortran compiler flags set(r8_flags "-fdefault-real-8 -fdefault-double-8") # Fortran flags for 64BIT precision +set(r4_flags "-fdefault-real-4") # Fortran flags for 32BIT precision -# GNU Fortan -set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fcray-pointer -fconvert=big-endian -ffree-line-length-none -fno-range-check -fbacktrace") +# GNU Fortran +set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fcray-pointer -fallow-argument-mismatch -ffree-line-length-none") -set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -funroll-all-loops -finline-functions") - -set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -g -fcheck=bounds -ffpe-trap=invalid,zero,overflow,underflow" ) +set(CMAKE_Fortran_FLAGS_RELEASE "-O2") +set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -g") set(CMAKE_Fortran_LINK_FLAGS "" ) + +#ufs flags +set(CMAKE_Fortran_FLAGS_RELEASEUFS "-O3 -funroll-all-loops -finline-functions") +set(CMAKE_Fortran_FLAGS_DEBUGUFS "-O0 -g -fcheck=bounds -ffpe-trap=invalid,zero,overflow,underflow" ) diff --git a/cmake/compiler_flags_IntelLLVM_C.cmake b/cmake/compiler_flags_IntelLLVM_C.cmake index dbeb7c5973..c17e0c8130 100644 --- a/cmake/compiler_flags_IntelLLVM_C.cmake +++ b/cmake/compiler_flags_IntelLLVM_C.cmake @@ -1,9 +1,13 @@ # Intel LLVM based C -set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -traceback") +set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") -set( CMAKE_C_FLAGS_RELEASE "-qno-opt-dynamic-align -O2 -debug minimal") - -set( CMAKE_C_FLAGS_DEBUG "-O0 -g -ftrapuv") +set( CMAKE_C_FLAGS_RELEASE "-O2") +set( CMAKE_C_FLAGS_DEBUG "-O0 -g -traceback") set( CMAKE_C_LINK_FLAGS "") + +# sets of flags used by ufs +set( CMAKE_C_FLAGS_DEBUGUFS "-O0 -g -ftrapv -traceback") +set( CMAKE_C_FLAGS_RELEASEUFS "-qno-opt-dynamic-align -O2 -debug minimal") + diff --git a/cmake/compiler_flags_IntelLLVM_Fortran.cmake b/cmake/compiler_flags_IntelLLVM_Fortran.cmake index 88347aeeda..786cd1d3b3 100644 --- a/cmake/compiler_flags_IntelLLVM_Fortran.cmake +++ b/cmake/compiler_flags_IntelLLVM_Fortran.cmake @@ -2,10 +2,14 @@ set(r4_flags "-real-size 32") # Fortran flags for 32BIT precision set(r8_flags "-real-size 64") # Fortran flags for 64BIT precision -set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fpp -fno-alias -auto -safe-cray-ptr -ftz -assume byterecl -align array64byte -nowarn -traceback") +set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -safe-cray-ptr") -set(CMAKE_Fortran_FLAGS_RELEASE "-O2 -debug minimal -nowarn -qoverride-limits -qno-opt-dynamic-align") +set(CMAKE_Fortran_FLAGS_RELEASE "-O3") +set(CMAKE_Fortran_FLAGS_DEBUG "-g -O0 -traceback") -set(CMAKE_Fortran_FLAGS_DEBUG "-g -O0 -check -check noarg_temp_created -check nopointer -warn -warn noerrors -fpe0 -ftrapuv") +set(CMAKE_Fortran_LINK_FLAGS "-fuse-ld=lld") -set(CMAKE_Fortran_LINK_FLAGS "") +# ufs flags to repoduce old behavior +set(CMAKE_Fortran_SHARED_FLAGS "-fpp -fno-alias -auto -safe-cray-ptr -ftz -assume byterecl -align array64byte -nowarn -traceback") +set(CMAKE_Fortran_FLAGS_RELEASEUFS "-O2 -debug minimal -nowarn -qoverride-limits -qno-opt-dynamic-align ${CMAKE_Fortran_SHARED_FLAGS}") +set(CMAKE_Fortran_FLAGS_DEBUGUFS "-g -O0 -check -check noarg_temp_created -check nopointer -warn -warn noerrors -fpe0 -ftrapuv ${CMAKE_Fortran_SHARED_FLAGS}") diff --git a/cmake/compiler_flags_Intel_C.cmake b/cmake/compiler_flags_Intel_C.cmake index ae7bfaa452..c5ce9bae9d 100644 --- a/cmake/compiler_flags_Intel_C.cmake +++ b/cmake/compiler_flags_Intel_C.cmake @@ -1,8 +1,11 @@ # Intel C -set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -sox -traceback") +set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") -set( CMAKE_C_FLAGS_RELEASE "-qno-opt-dynamic-align -O2 -debug minimal -fp-model source") - -set( CMAKE_C_FLAGS_DEBUG "-O0 -g -ftrapuv") +set( CMAKE_C_FLAGS_RELEASE "-O2") +set( CMAKE_C_FLAGS_DEBUG "-O0 -g -traceback") set( CMAKE_C_LINK_FLAGS "") + +# ufs flags +set( CMAKE_C_FLAGS_RELEASEUFS "-qno-opt-dynamic-align -O2 -debug minimal -fp-model source") +set( CMAKE_C_FLAGS_DEBUGUFS "-O0 -g -ftrapuv") diff --git a/cmake/compiler_flags_Intel_Fortran.cmake b/cmake/compiler_flags_Intel_Fortran.cmake index 95503a0b7d..eb73f25600 100644 --- a/cmake/compiler_flags_Intel_Fortran.cmake +++ b/cmake/compiler_flags_Intel_Fortran.cmake @@ -1,12 +1,16 @@ # Precision-based Fortran compiler flags set(r4_flags "-real-size 32") # Fortran flags for 32BIT precision set(r8_flags "-real-size 64") # Fortran flags for 64BIT precision -set(r8_flags "${r8_flags} -no-prec-div -no-prec-sqrt") -set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fpp -fno-alias -auto -safe-cray-ptr -ftz -assume byterecl -align array64byte -nowarn -sox -traceback") +# Minimal set of flags for stand release and debug build types +set(CMAKE_Fortran_FLAGS "${RELEASE} -safe-cray-ptr") +set(CMAKE_Fortran_FLAGS_RELEASE "-O3") +set(CMAKE_Fortran_FLAGS_DEBUG "-g -O0") -set(CMAKE_Fortran_FLAGS_RELEASE "-O2 -debug minimal -fp-model source -nowarn -qoverride-limits -qno-opt-dynamic-align -qopt-prefetch=3") +# ufs flags to reproduce past behavior +set(ufs_flags_base "${CMAKE_Fortran_FLAGS} -fpp -fno-alias -auto -safe-cray-ptr -ftz -assume byterecl -align array64byte -nowarn -sox -traceback") -set(CMAKE_Fortran_FLAGS_DEBUG "-g -O0 -check -check noarg_temp_created -check nopointer -warn -warn noerrors -fpe0 -ftrapuv") +set(CMAKE_Fortran_FLAGS_RELEASE "${ufs_flags_base} -O2 -debug minimal -fp-model source -nowarn -qoverride-limits -qno-opt-dynamic-align -qopt-prefetch=3") +set(CMAKE_Fortran_FLAGS_DEBUGUFS "${ufs_flags_base} -g -O0 -check -check noarg_temp_created -check nopointer -warn -warn noerrors -fpe0 -ftrapuv") set(CMAKE_Fortran_LINK_FLAGS "") diff --git a/column_diagnostics/Makefile.am b/column_diagnostics/Makefile.am index c205abbb4d..7ef0c448f3 100644 --- a/column_diagnostics/Makefile.am +++ b/column_diagnostics/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the column_diagnostics directory of the FMS diff --git a/column_diagnostics/column_diagnostics.F90 b/column_diagnostics/column_diagnostics.F90 index 39bcc8bc69..69198c3e13 100644 --- a/column_diagnostics/column_diagnostics.F90 +++ b/column_diagnostics/column_diagnostics.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup column_diagnostics_mod column_diagnostics_mod !> @ingroup column_diagnostics diff --git a/column_diagnostics/include/column_diagnostics.inc b/column_diagnostics/include/column_diagnostics.inc index 8b79c72a6d..866c038da6 100644 --- a/column_diagnostics/include/column_diagnostics.inc +++ b/column_diagnostics/include/column_diagnostics.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file diff --git a/column_diagnostics/include/column_diagnostics_r4.fh b/column_diagnostics/include/column_diagnostics_r4.fh index f8cdb30d9f..6e5c73d662 100644 --- a/column_diagnostics/include/column_diagnostics_r4.fh +++ b/column_diagnostics/include/column_diagnostics_r4.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief include file for column_diagnostics_mod to generate subroutine/functions diff --git a/column_diagnostics/include/column_diagnostics_r8.fh b/column_diagnostics/include/column_diagnostics_r8.fh index df0b4e2cf0..b37058f3e4 100644 --- a/column_diagnostics/include/column_diagnostics_r8.fh +++ b/column_diagnostics/include/column_diagnostics_r8.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief include file for column_diagnostics_mod to generate subroutine/functions diff --git a/configure.ac b/configure.ac index 78becf4f39..7357a03b80 100644 --- a/configure.ac +++ b/configure.ac @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is the main configure file for the FMS package. @@ -25,7 +24,7 @@ AC_PREREQ([2.69]) # Initialize with name, version, and support email address. AC_INIT([GFDL FMS Library], - [2025.02-dev], + [2026.01-dev], [gfdl.climate.model.info@noaa.gov], [FMS], [https://www.github.com/NOAA-GFDL/FMS]) @@ -437,6 +436,16 @@ else AC_MSG_RESULT([no]) fi +# Check if intel is 2025.1 for ICE +AC_MSG_CHECKING([if using Intel 2025.1]) +if [ test -n "`$FC --version | grep ifx | grep 2025\.1\..*`" ]; then + AC_MSG_RESULT([yes]) + AC_MSG_ERROR([Compilation with Oneapi 2025.1 is unsupported \ +by this version of FMS due to a bug in the compiler. Please use a different version of oneapi.]) +else + AC_MSG_RESULT([no]) +fi + AC_MSG_CHECKING([if netCDF was built with HDF5 parallel I/O features]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[ #include @@ -472,6 +481,10 @@ AC_SUBST([NOUNDEFINED]) # Used in Makefiles. AC_SUBST([MODDIR],[\$\(top_builddir\)/.mods]) +# Define CMake variables used in test-lib.sh.in as empty strings +AC_SUBST([CMAKE_CURRENT_SOURCE_DIR], []) +AC_SUBST([USING_CMAKE],[]) + # These files will be created when the configure script is run. AC_CONFIG_FILES([ Makefile @@ -507,6 +520,7 @@ AC_CONFIG_FILES([ diag_integral/Makefile sat_vapor_pres/Makefile random_numbers/Makefile + offloading/Makefile libFMS/Makefile docs/Makefile parser/Makefile @@ -514,6 +528,7 @@ AC_CONFIG_FILES([ test_fms/test-lib.sh test_fms/intel_coverage.sh test_fms/Makefile + test_fms/common/Makefile test_fms/astronomy/Makefile test_fms/diag_manager/Makefile test_fms/data_override/Makefile @@ -541,6 +556,7 @@ AC_CONFIG_FILES([ test_fms/random_numbers/Makefile test_fms/topography/Makefile test_fms/column_diagnostics/Makefile + test_fms/offloading/Makefile test_fms/block_control/Makefile FMS.pc ]) diff --git a/constants/Makefile.am b/constants/Makefile.am index 429dd6c329..cfb49105d9 100644 --- a/constants/Makefile.am +++ b/constants/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the constants directory of the FMS diff --git a/constants/constants.F90 b/constants/constants.F90 index d3d8887a32..3f6ce08e7c 100644 --- a/constants/constants.F90 +++ b/constants/constants.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief File for @ref constants_mod diff --git a/constants/fmsconstants.F90 b/constants/fmsconstants.F90 index 6734f88166..6904931e2e 100644 --- a/constants/fmsconstants.F90 +++ b/constants/fmsconstants.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup fmsconstants FMSConstants !> @ingroup libfms diff --git a/constants/geos_constants.fh b/constants/geos_constants.fh index ce2939985e..3e71bb4538 100644 --- a/constants/geos_constants.fh +++ b/constants/geos_constants.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** character(len=18), public, parameter :: constants_version = 'FMSConstants: GEOS' diff --git a/constants/gfdl_constants.fh b/constants/gfdl_constants.fh index 333cf44051..3f080106a5 100644 --- a/constants/gfdl_constants.fh +++ b/constants/gfdl_constants.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** character(len=18), public, parameter :: constants_version = 'FMSConstants: GFDL' diff --git a/constants/gfs_constants.fh b/constants/gfs_constants.fh index d5eb711739..3152652313 100644 --- a/constants/gfs_constants.fh +++ b/constants/gfs_constants.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** character(len=18), public, parameter :: constants_version = 'FMSConstants: GFS ' diff --git a/constants4/Makefile.am b/constants4/Makefile.am index 9bba1fddf1..0a536255dc 100644 --- a/constants4/Makefile.am +++ b/constants4/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the constants4 directory of the FMS diff --git a/constants4/constantsr4.F90 b/constants4/constantsr4.F90 index 78c4da27a4..f65500722d 100644 --- a/constants4/constantsr4.F90 +++ b/constants4/constantsr4.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup constantsR4_mod constantsR4_mod !> @ingroup constantsR4 diff --git a/constants4/fmsconstantsr4.F90 b/constants4/fmsconstantsr4.F90 index fd80cc062e..1eb5b2c4f7 100644 --- a/constants4/fmsconstantsr4.F90 +++ b/constants4/fmsconstantsr4.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup fmsconstantsR4 FMSConstantsR4 !> @ingroup libfms diff --git a/constants4/geos_constantsR4.fh b/constants4/geos_constantsR4.fh index d2840e5a6b..64e0a1ae83 100644 --- a/constants4/geos_constantsR4.fh +++ b/constants4/geos_constantsR4.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** character(len=20), public, parameter :: constantsR4_version = 'FMSConstantsR4: GEOS' diff --git a/constants4/gfdl_constantsR4.fh b/constants4/gfdl_constantsR4.fh index 935445aa56..84bf88e0d9 100644 --- a/constants4/gfdl_constantsR4.fh +++ b/constants4/gfdl_constantsR4.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** character(len=20), public, parameter :: constantsR4_version = 'FMSConstantsR4: GFDL' diff --git a/constants4/gfs_constantsR4.fh b/constants4/gfs_constantsR4.fh index 0a7178b8e6..e9b746bb6c 100644 --- a/constants4/gfs_constantsR4.fh +++ b/constants4/gfs_constantsR4.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** character(len=20), public, parameter :: constantsR4_version = 'FMSConstantsR4: GFS ' diff --git a/coupler/Makefile.am b/coupler/Makefile.am index fc88610a56..f051db72e8 100644 --- a/coupler/Makefile.am +++ b/coupler/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the coupler directory of the FMS diff --git a/coupler/atmos_ocean_fluxes.F90 b/coupler/atmos_ocean_fluxes.F90 index 1f58fb591b..53c86fbcb5 100644 --- a/coupler/atmos_ocean_fluxes.F90 +++ b/coupler/atmos_ocean_fluxes.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup atmos_ocean_fluxes_mod atmos_ocean_fluxes_mod !> @ingroup coupler diff --git a/coupler/coupler_types.F90 b/coupler/coupler_types.F90 index 4c619a7c62..8fd264f28d 100644 --- a/coupler/coupler_types.F90 +++ b/coupler/coupler_types.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup coupler_types_mod coupler_types_mod !> @ingroup coupler diff --git a/coupler/ensemble_manager.F90 b/coupler/ensemble_manager.F90 index 8523e3fd22..e31105ddb8 100644 --- a/coupler/ensemble_manager.F90 +++ b/coupler/ensemble_manager.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup ensemble_manager_mod ensemble_manager_mod !> @ingroup coupler diff --git a/coupler/gex.F90 b/coupler/gex.F90 index e257ba06fa..06b568bac9 100644 --- a/coupler/gex.F90 +++ b/coupler/gex.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup gex_mod gex_mod @@ -105,11 +104,12 @@ module gex_mod use field_manager_mod, only: MODEL_LAND, MODEL_ATMOS, MODEL_OCEAN, NUM_MODELS use field_manager_mod, only: fm_list_iter_type, fm_dump_list, fm_field_name_len, & fm_type_name_len, fm_get_length,fm_loop_over_list, fm_init_loop, & - fm_string_len, fm_get_current_list, fm_path_name_len, fm_change_list, & + fm_string_len, fm_get_current_list, fm_change_list, & field_manager_init use fm_util_mod, only: fm_util_get_real, fm_util_get_logical, fm_util_get_string use mpp_mod, only: mpp_root_pe, mpp_pe use fms_string_utils_mod, only: string +use platform_mod, only: FMS_PATH_LEN implicit none ; private @@ -193,7 +193,7 @@ subroutine gex_read_field_table(listroot,MODEL_SRC,MODEL_REC) type(fm_list_iter_type) :: iter ! iterator over the list of tracers character(fm_field_name_len) :: name = '' ! name of the tracer character(fm_type_name_len) :: ftype ! type of the field table entry (not used) - character(fm_path_name_len) :: listname ! name of the field manager list for each tracer + character(FMS_PATH_LEN) :: listname ! name of the field manager list for each tracer integer :: n diff --git a/coupler/include/coupler_types.inc b/coupler/include/coupler_types.inc index 601eb28097..9bd905e466 100644 --- a/coupler/include/coupler_types.inc +++ b/coupler/include/coupler_types.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup coupler_types_mod coupler_types_mod !> @ingroup coupler diff --git a/coupler/include/coupler_types_r4.fh b/coupler/include/coupler_types_r4.fh index d0bf307e1b..41e8b97bae 100644 --- a/coupler/include/coupler_types_r4.fh +++ b/coupler/include/coupler_types_r4.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** #undef FMS_CP_KIND_ diff --git a/coupler/include/coupler_types_r8.fh b/coupler/include/coupler_types_r8.fh index d0d2e62eb6..2fdda7576c 100644 --- a/coupler/include/coupler_types_r8.fh +++ b/coupler/include/coupler_types_r8.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** #undef FMS_CP_KIND_ diff --git a/data_override/Makefile.am b/data_override/Makefile.am index 718b127ec4..d9f3852926 100644 --- a/data_override/Makefile.am +++ b/data_override/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the data_override directory of the FMS diff --git a/data_override/data_override.F90 b/data_override/data_override.F90 index 92a229b65c..a9893cd063 100644 --- a/data_override/data_override.F90 +++ b/data_override/data_override.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** ! data_override_r4 and data_override_r8 are not intended to be used directly - diff --git a/data_override/get_grid_version.F90 b/data_override/get_grid_version.F90 index 8e0fbbe234..2bb519eef5 100644 --- a/data_override/get_grid_version.F90 +++ b/data_override/get_grid_version.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup get_grid_version_mod get_grid_version_mod !> @ingroup data_override diff --git a/data_override/include/data_override.inc b/data_override/include/data_override.inc index c233b2b90e..b97c6d6332 100644 --- a/data_override/include/data_override.inc +++ b/data_override/include/data_override.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** ! This file contains the body of the data_override_r4 and data_override_r8 @@ -241,6 +240,10 @@ end if else if (file_exists("data_table.yaml"))& call mpp_error(FATAL, "You cannot have the yaml data_table if use_data_table_yaml=.false.") + call mpp_error(NOTE, & + &"data_override_init:: You are using the yaml version of the data_table. & +The legacy data_table format will be deprecated in a future release, & +please switch to the yaml format.") allocate(data_table(max_table)) do i = 1, max_table data_table(i) = default_table @@ -253,6 +256,10 @@ end if if (use_data_table_yaml) then call mpp_error(FATAL, "You cannot have use_data_table_yaml=.true. without compiling with -Duse_yaml") + call mpp_error(NOTE, & + &"data_override_init:: You are using the yaml version of the data_table. & +The legacy data_table format will be deprecated in a future release, & +please switch to the yaml format.") else allocate(data_table(max_table)) diff --git a/data_override/include/data_override_r4.fh b/data_override/include/data_override_r4.fh index c61fc3d853..89d0dc648c 100644 --- a/data_override/include/data_override_r4.fh +++ b/data_override/include/data_override_r4.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** #undef FMS_DATA_OVERRIDE_KIND_ diff --git a/data_override/include/data_override_r8.fh b/data_override/include/data_override_r8.fh index 1d7cfc9a97..f33f7d295b 100644 --- a/data_override/include/data_override_r8.fh +++ b/data_override/include/data_override_r8.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** #undef FMS_DATA_OVERRIDE_KIND_ diff --git a/data_override/include/get_grid_version.inc b/data_override/include/get_grid_version.inc index 4f19734063..35888a2866 100644 --- a/data_override/include/get_grid_version.inc +++ b/data_override/include/get_grid_version.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> Get global lon and lat of three model (target) grids, with a given file name diff --git a/data_override/include/get_grid_version_r4.fh b/data_override/include/get_grid_version_r4.fh index 03ad66a8b0..347e8a8f63 100644 --- a/data_override/include/get_grid_version_r4.fh +++ b/data_override/include/get_grid_version_r4.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** #undef FMS_GET_GRID_VERSION_KIND_ diff --git a/data_override/include/get_grid_version_r8.fh b/data_override/include/get_grid_version_r8.fh index 40a2c510b6..ef7d75a85f 100644 --- a/data_override/include/get_grid_version_r8.fh +++ b/data_override/include/get_grid_version_r8.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** #undef FMS_GET_GRID_VERSION_KIND_ diff --git a/diag_integral/Makefile.am b/diag_integral/Makefile.am index 6e5f904ee4..9337512991 100644 --- a/diag_integral/Makefile.am +++ b/diag_integral/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the diag_integral directory of the FMS diff --git a/diag_integral/diag_integral.F90 b/diag_integral/diag_integral.F90 index bb6c1a93e1..7b85fc79fc 100644 --- a/diag_integral/diag_integral.F90 +++ b/diag_integral/diag_integral.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup diag_integral_mod diag_integral_mod !> @ingroup diag_integral diff --git a/diag_integral/include/diag_integral.inc b/diag_integral/include/diag_integral.inc index 200819c171..0082834512 100644 --- a/diag_integral/include/diag_integral.inc +++ b/diag_integral/include/diag_integral.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup diag_integral_mod diag_integral_mod !> @ingroup diag_integral diff --git a/diag_integral/include/diag_integral_r4.fh b/diag_integral/include/diag_integral_r4.fh index 89f5d97ecc..2505f7040d 100644 --- a/diag_integral/include/diag_integral_r4.fh +++ b/diag_integral/include/diag_integral_r4.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup diag_integral_mod diag_integral_mod !> @ingroup diag_integral diff --git a/diag_integral/include/diag_integral_r8.fh b/diag_integral/include/diag_integral_r8.fh index c5d5981660..2f360c0d02 100644 --- a/diag_integral/include/diag_integral_r8.fh +++ b/diag_integral/include/diag_integral_r8.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup diag_integral_mod diag_integral_mod !> @ingroup diag_integral diff --git a/diag_manager/Makefile.am b/diag_manager/Makefile.am index 433901b48f..817a6ef01a 100644 --- a/diag_manager/Makefile.am +++ b/diag_manager/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the diag_manager directory of the FMS diff --git a/diag_manager/diag_axis.F90 b/diag_manager/diag_axis.F90 index 85bd119bf6..4c123db8d0 100644 --- a/diag_manager/diag_axis.F90 +++ b/diag_manager/diag_axis.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup diag_axis_mod diag_axis_mod !> @ingroup diag_manager diff --git a/diag_manager/diag_data.F90 b/diag_manager/diag_data.F90 index 3019e2b8ae..19a616da57 100644 --- a/diag_manager/diag_data.F90 +++ b/diag_manager/diag_data.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup diag_data_mod diag_data_mod !> @ingroup diag_manager @@ -102,6 +101,7 @@ MODULE diag_data_mod INTEGER, PARAMETER :: TWO_D_DOMAIN = 2 !< Use the FmsNetcdfDomainFile_t fileobj INTEGER, PARAMETER :: UG_DOMAIN = 3 !< Use the FmsNetcdfUnstructuredDomainFile_t fileobj INTEGER, PARAMETER :: SUB_REGIONAL = 4 !< This is a file with a sub_region use the FmsNetcdfFile_t fileobj + integer, parameter :: MAX_DIMENSIONS = 5 !< Max number of dimensions allowed (including unlimited dimension) INTEGER, PARAMETER :: DIRECTION_UP = 1 !< The axis points up if positive INTEGER, PARAMETER :: DIRECTION_DOWN = -1 !< The axis points down if positive INTEGER, PARAMETER :: GLO_REG_VAL = -999 !< Value used in the region specification of the diag_table @@ -206,7 +206,7 @@ MODULE diag_data_mod INTEGER :: num_attributes !< Number of defined attibutes !---------- !ug support - logical(I4_KIND) :: use_domainUG = .false. + logical(L4_KIND) :: use_domainUG = .false. logical(I4_KIND) :: use_domain2D = .false. !---------- !Check if time axis was already registered diff --git a/diag_manager/diag_grid.F90 b/diag_manager/diag_grid.F90 index 922211b5e2..cf3e8ae5f7 100644 --- a/diag_manager/diag_grid.F90 +++ b/diag_manager/diag_grid.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup diag_grid_mod diag_grid_mod !> @ingroup diag_manager diff --git a/diag_manager/diag_manager.F90 b/diag_manager/diag_manager.F90 index 4290ab01b5..40617ec19c 100644 --- a/diag_manager/diag_manager.F90 +++ b/diag_manager/diag_manager.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup diag_manager_mod diag_manager_mod !> @ingroup diag_manager @@ -2059,12 +2058,14 @@ LOGICAL FUNCTION diag_send_data(diag_field_id, field, time, is_in, js_in, ks_in, IF ( reduced_k_range ) THEN !---------- !ug support - if (output_fields(out_num)%reduced_k_unstruct) then - js = output_fields(out_num)%output_grid%l_start_indx(2) - je = output_fields(out_num)%output_grid%l_end_indx(2) - endif - l_start(3) = output_fields(out_num)%output_grid%l_start_indx(3) - l_end(3) = output_fields(out_num)%output_grid%l_end_indx(3) + if (output_fields(out_num)%reduced_k_unstruct) then + f3 = output_fields(out_num)%output_grid%l_start_indx(2) + f4 = output_fields(out_num)%output_grid%l_end_indx(2) + js = 1 + je = f4 - f3 + 1 + endif + l_start(3) = output_fields(out_num)%output_grid%l_start_indx(3) + l_end(3) = output_fields(out_num)%output_grid%l_end_indx(3) !---------- END IF ksr= l_start(3) diff --git a/diag_manager/diag_output.F90 b/diag_manager/diag_output.F90 index 20b263566e..0336f86048 100644 --- a/diag_manager/diag_output.F90 +++ b/diag_manager/diag_output.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup diag_output_mod diag_output_mod !> @ingroup diag_manager diff --git a/diag_manager/diag_table.F90 b/diag_manager/diag_table.F90 index f0e749d465..730102057f 100644 --- a/diag_manager/diag_table.F90 +++ b/diag_manager/diag_table.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup diag_table_mod diag_table_mod !> @ingroup diag_manager diff --git a/diag_manager/diag_util.F90 b/diag_manager/diag_util.F90 index c59bbbab9b..813db617f5 100644 --- a/diag_manager/diag_util.F90 +++ b/diag_manager/diag_util.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup diag_util_mod diag_util_mod !> @ingroup diag_manager diff --git a/diag_manager/diag_yaml_format.md b/diag_manager/diag_yaml_format.md index 333f87d0b0..4963757f04 100644 --- a/diag_manager/diag_yaml_format.md +++ b/diag_manager/diag_yaml_format.md @@ -16,6 +16,8 @@ The purpose of this document is to explain the diag_table yaml format. - [3. More examples](diag_yaml_format.md#3-more-examples) - [4. Schema](diag_yaml_format.md#4-schema) - [5. Ensemble and Nest Support](diag_yaml_format.md#5-ensemble-and-nest-support) +- [6. Reducing Diag Table Yaml Length](diag_yaml_format.md#6-reducing-diag-table-yaml-length) +- [7. Improving Performance at High Resolutions](diag_yaml_format.md#7-improving-performance-at-high-resolutions) ### 1. Converting from legacy ascii diag_table format @@ -352,4 +354,235 @@ found in the [gfdl_msd_schemas](https://github.com/NOAA-GFDL/gfdl_msd_schemas) repository on Github. ### 5. Ensemble and Nest Support -When using nests, it may be desired for a nest to have a different file frequency or number of variables from the parent grid. This may allow users to save disk space and reduce simulations time. In order to supports, FMS allows each nest to have a different diag_table.yaml from the parent grid. For example, if running with 1 test FMS will use diag_table.yaml for the parent grid and diag_table.nest_01.yaml for the first nest Similary, each ensemble member can have its own diag_table (diag_table_ens_XX.yaml, where XX is the ensemble number). However, for the ensemble case if both the diag_table.yaml and the diag_table_ens_* files are present, the code will crash as only 1 option is allowed. \ No newline at end of file +When using nests, it may be desired for a nest to have a different file frequency or number of variables from the parent grid. This may allow users to save disk space and reduce simulations time. In order to support this, FMS allows each nest to have a different diag_table.yaml from the parent grid. For example, if running with 1 nest FMS will use diag_table.yaml for the parent grid and diag_table.nest_01.yaml for the first nest. Similary, each ensemble member can have its own diag_table (diag_table_ens_XX.yaml, where XX is the ensemble number). However, for the ensemble case if both the diag_table.yaml and the diag_table_ens_* files are present, the code will crash as only 1 option is allowed. + +### 6. Reducing Diag Table Yaml Length +There may be scenarios where the diag_table.yaml becomes long and contains a lot of repeated content. + +For example, the keys `module`, `reduction`, and `kind` often have the same values across many variables. + +```yaml +title: test_none +base_date: 2 1 1 0 0 0 +diag_files: +- file_name: test_4xdaily + freq: 6 hours + time_units: hours + unlimdim: time + varlist: + - var_name: var0 + module: ocn_mod + reduction: none + kind: r4 + - var_name: var1 + module: ocn_mod + reduction: none + kind: r4 + - var_name: var2 + module: ocn_mod + reduction: none + kind: r4 +``` + +To reduce size and improve readability, you can **define these keys at the file level, and override them at the variable level if needed**: + +```yaml +title: test_none +base_date: 2 1 1 0 0 0 +diag_files: +- file_name: test_4xdaily + freq: 6 hours + time_units: hours + unlimdim: time + module: ocn_mod + reduction: none + kind: r4 + varlist: + - var_name: var0 + - var_name: var1 + - var_name: var2 +``` + +However, there may be cases where a file contains a large number of variables from different modules, requiring duplication of the module key across multiple lines. For example: + +```yaml +title: test_none +base_date: 2 1 1 0 0 0 +diag_files: +- file_name: test_4xdaily + freq: 6 hours + time_units: hours + unlimdim: time + module: radiation_mod + reduction: none + kind: r4 + varlist: + - var_name: var0 + - var_name: var1 + - var_name: var2 + - var_name: var3 + module: some_other_mod + - var_name: var4 + module: some_other_mod + - var_name: var5 + module: some_other_mod +``` + +To address this, you can group variables by module: +```yaml +title: test_none +base_date: 2 1 1 0 0 0 +diag_files: +- file_name: test_4xdaily + freq: 6 hours + time_units: hours + unlimdim: time + reduction: none + kind: r4 + modules: + - module: radiation_mod + varlist: + - var_name: var0 + - var_name: var1 + - var_name: var2 + - module: some_other_mod + varlist: + - var_name: var3 + - var_name: var4 + - var_name: var5 +``` + +Another option **to reduce its size and improve readability, is to use yaml anchors**. For example, instead of writing: +``` yaml +title: test_none +base_date: 2 1 1 0 0 0 +diag_files: +- file_name: test_4xdaily + freq: 6 hours + time_units: hours + unlimdim: time + module: ocn_mod + reduction: none + kind: r4 + varlist: + - var_name: var0 + - var_name: var1 + - var_name: var2 + - var_name: var3 + - var_name: var4 + - var_name: var3 + output_name: var3_Z + zbounds: 2. 3. +- file_name: test_daily + freq: 1 days + time_units: hours + unlimdim: time + module: ocn_mod + reduction: none + kind: r4 + varlist: + - var_name: var0 + - var_name: var1 + - var_name: var2 + - var_name: var3 + - var_name: var4 + - var_name: var3 + output_name: var3_Z + zbounds: 2. 3. +``` + +You can define an anchor and reuse it: +```yaml +name: &name + - var_name: var0 + - var_name: var1 + - var_name: var2 + - var_name: var3 + - var_name: var4 + - var_name: var3 + output_name: var3_Z + zbounds: 2. 3. + +title: test_none +base_date: 2 1 1 0 0 0 +diag_files: +- file_name: test_4xdaily + freq: 6 hours + time_units: hours + unlimdim: time + module: ocn_mod + reduction: none + kind: r4 + varlist: *name +- file_name: test_daily + freq: 1 days + time_units: hours + unlimdim: time + module: ocn_mod + reduction: none + kind: r4 + varlist: + - *name + - variable_name: var773 +``` +### 7. Improving Performance at High Resolutions +For very high resolutions (e.g., C3072L65), performance can be greatly improved by using NETCDF-4 with collective MPI writes. Tests have shown up to a 70% speedup when writing hourly diagnostic output. This approach also simplifies the workflow, as it does not use the IO domain and does not create distributed files. To enable this feature, set `use_collective_writes: True` for each file. For example: +```yaml +title: test_none +base_date: 2 1 1 0 0 0 +diag_files: +- file_name: test_none + freq: 6 hours + time_units: hours + unlimdim: time + module: ocn_mod + reduction: none + kind: r4 + use_collective_writes: True + chunksizes: 96, 8, 1, 1, 1 + varlist: + - var_name: var4 +``` +Chunking can also have a major impact on performance. You can set chunk sizes for all variables in a file using the `chunksizes` key at the file level. By default, the diag manager will choose chunk sizes equal to the compute domain for domain-decomposed dimensions (e.g., for C3072L65 and a layout of 32,64, the chunksizes would be 96,48,nz). For dimensions that are not domain-decomposed (e.g., the vertical z dimension), the chunk size defaults to the full length of the dimension. This effectively means the entire z-dimension is stored as a single chunk. For unlimited dimensions (time), the chunk size is always 1. For example: +```yaml +title: test_none +base_date: 2 1 1 0 0 0 +diag_files: +- file_name: test_none + freq: 6 hours + time_units: hours + unlimdim: time + module: ocn_mod + reduction: none + kind: r4 + use_collective_writes: True + chunksizes: 96, 8, 1, 1, 1 + varlist: + - var_name: var3 + - var_name: var4 +``` +You can override chunk sizes for individual variables by specifying `chunksizes` at the variable level. For example: +```yaml +title: test_none +base_date: 2 1 1 0 0 0 +diag_files: +- file_name: test_none + freq: 6 hours + time_units: hours + unlimdim: time + module: ocn_mod + reduction: none + kind: r4 + use_collective_writes: True + chunksizes: 96, 8, 1, 1, 1 + varlist: + - var_name: var3 + chunksizes: 96, 4, 1, 1, 1 + - var_name: var4 +``` + +**Things to consider:** +1. This option currently only works for files with variables that are domain-decomposed (i.e., multiple mpi-tasks each with their own section of data). Support for land's unstructured grid and icebergs will be added in the future; at present, using this option with those grids will result in a FATAL error. +2. The domain must be evenly decomposed, meaning each processor has the same amount of data. For example, a C3072L65 grid with a layout of (30, 32) will not work and will result in a FATAL error, since 3072 is not evenly divisible by 30. This limitation exists because NetCDF collective I/O requires each process to access the same pattern of chunks. With uneven decomposition, the chunk shapes per process vary, making it impossible to determine a consistent chunking strategy. Currently there are no plans to support this in the future. +3. The chunksizes must be a comma seperated list of five integers 1 for each dimension. +4. Chunking is supported even when not using collective writes as long as netcdf-4 file are being used (by setting fms2_io_nml::netcdf_default_format="netcdf4) \ No newline at end of file diff --git a/diag_manager/fms_diag_axis_object.F90 b/diag_manager/fms_diag_axis_object.F90 index 9061b8027f..e13ae7551a 100644 --- a/diag_manager/fms_diag_axis_object.F90 +++ b/diag_manager/fms_diag_axis_object.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup fms_diag_axis_object_mod fms_diag_axis_object_mod @@ -31,7 +30,7 @@ module fms_diag_axis_object_mod #ifdef use_yaml use mpp_domains_mod, only: domain1d, domain2d, domainUG, mpp_get_compute_domain, CENTER, & & mpp_get_global_domain, NORTH, EAST, mpp_get_tile_id, & - & mpp_get_ntile_count, mpp_get_io_domain + & mpp_get_ntile_count, mpp_get_io_domain, mpp_get_layout use platform_mod, only: r8_kind, r4_kind, i4_kind, i8_kind use diag_data_mod, only: diag_atttype, max_axes, NO_DOMAIN, TWO_D_DOMAIN, UG_DOMAIN, & direction_down, direction_up, fmsDiagAttribute_type, max_axis_attributes, & @@ -41,7 +40,7 @@ module fms_diag_axis_object_mod use mpp_mod, only: FATAL, mpp_error, uppercase, mpp_pe, mpp_root_pe, stdout use fms2_io_mod, only: FmsNetcdfFile_t, FmsNetcdfDomainFile_t, FmsNetcdfUnstructuredDomainFile_t, & & register_axis, register_field, register_variable_attribute, write_data - use fms_diag_yaml_mod, only: subRegion_type, diag_yaml, MAX_SUBAXES + use fms_diag_yaml_mod, only: subRegion_type, diag_yaml, MAX_SUBAXES, diagYamlFilesVar_type use diag_grid_mod, only: get_local_indices_cubesphere => get_local_indexes use axis_utils2_mod, only: nearest_index implicit none @@ -53,7 +52,7 @@ module fms_diag_axis_object_mod & DIAGDOMAIN2D_T, fmsDiagSubAxis_type, fmsDiagAxisContainer_type, fmsDiagFullAxis_type, DIAGDOMAINUG_T public :: define_new_axis, parse_compress_att, get_axis_id_from_name, define_diurnal_axis, & & fmsDiagDiurnalAxis_type, create_new_z_subaxis, is_parent_axis, define_new_subaxis_latlon, & - & define_new_subaxis_index + & define_new_subaxis_index, find_z_sub_axis_name !> @} @@ -125,6 +124,7 @@ module fms_diag_axis_object_mod procedure :: get_starting_index procedure :: get_ending_index procedure :: get_compute_indices + procedure :: is_same_zbounds END TYPE fmsDiagSubAxis_type !> @brief Type to hold the diurnal axis @@ -191,6 +191,7 @@ module fms_diag_axis_object_mod PROCEDURE :: get_set_name PROCEDURE :: has_set_name PROCEDURE :: is_x_or_y_axis + PROCEDURE :: get_dim_size_layout ! TO DO: ! Get/has/is subroutines as needed END TYPE fmsDiagFullAxis_type @@ -448,7 +449,7 @@ subroutine write_axis_data(this, fms2io_fileobj, parent_axis) integer :: global_io_index(2)!< Global io domain starting and ending index select type(this) type is (fmsDiagFullAxis_type) - call this%get_global_io_domain(global_io_index) + call this%get_global_io_domain(global_io_index, fms2io_fileobj%is_file_using_netcdf_mpi()) call write_data(fms2io_fileobj, this%axis_name, this%axis_data(global_io_index(1):global_io_index(2))) type is (fmsDiagSubAxis_type) i = this%starting_index @@ -580,9 +581,10 @@ pure integer function get_edges_id(this) end function !> @brief Get the starting and ending indices of the global io domain of the axis - subroutine get_global_io_domain(this, global_io_index) - class(fmsDiagFullAxis_type), intent(in) :: this !< diag_axis obj + subroutine get_global_io_domain(this, global_io_index, use_collective_writes) + class(fmsDiagFullAxis_type), target, intent(in) :: this !< diag_axis obj integer, intent(out) :: global_io_index(2) !< Global io domain starting and ending index + logical, intent(in) :: use_collective_writes !< .True. if using collective writes type(domain2d), pointer :: io_domain !< pointer to the io domain @@ -592,7 +594,12 @@ subroutine get_global_io_domain(this, global_io_index) if (allocated(this%axis_domain)) then select type(domain => this%axis_domain) type is (diagDomain2d_t) - io_domain => mpp_get_io_domain(domain%domain2) + if (use_collective_writes) then + io_domain => domain%domain2 + else + io_domain => mpp_get_io_domain(domain%domain2) + endif + if (this%cart_name .eq. "X") then call mpp_get_global_domain(io_domain, xbegin=global_io_index(1), xend=global_io_index(2), & position=this%domain_position) @@ -665,6 +672,32 @@ function is_x_or_y_axis(this, x_or_y) & end select end function is_x_or_y_axis + !< @brief Get the global size of the axis, and the layout + !! It is assumed that this function is only called on "X" and "Y" axes + !! using the `is_x_or_y_axis` function from above + subroutine get_dim_size_layout(this, dim_size, layout) + class(fmsDiagFullAxis_type), intent(in) :: this !< diag_axis obj + integer, intent(out) :: dim_size !< Size of the dimension + integer, intent(out) :: layout !< Layout of the dimension + + integer :: nx, ny + integer :: layout_xy(2) + + select type (domain => this%axis_domain) + type is (diagDomain2d_t) + call mpp_get_global_domain(domain%Domain2, xsize=nx, ysize=ny) + call mpp_get_layout(domain%Domain2, layout_xy) + + if (this%cart_name .eq. "X") then + dim_size = nx + layout = layout_xy(1) + else if (this%cart_name .eq. "Y") then + dim_size = ny + layout = layout_xy(2) + endif + end select + end subroutine get_dim_size_layout + !> @brief Get the set name of an axis object !! @return the set name of an axis object pure function get_set_name(this) & @@ -902,6 +935,16 @@ function get_compute_indices(this) result(indx) indx = this%compute_idx end function get_compute_indices + !> @brief Determines if the zbounds passed in are the same as those in the file + !! @return .True. if the zbounds are the same + function is_same_zbounds(this, zbounds) result(is_same) + class(fmsDiagSubAxis_type), intent(in) :: this !< diag_sub_axis object + real(kind=r4_kind), intent(in) :: zbounds(2) !< zbounds to compare with + logical :: is_same + + is_same = zbounds(1) .eq. this%zbounds(1) .and. zbounds(2) .eq. this%zbounds(2) + end function + !> @brief Get the ntiles in a domain !> @return the number of tiles in a domain function get_ntiles(this) & @@ -1402,7 +1445,8 @@ subroutine write_diurnal_metadata(this, fms2io_fileobj) end subroutine write_diurnal_metadata !> @brief Creates a new z subaxis to use - subroutine create_new_z_subaxis(zbounds, var_axis_ids, diag_axis, naxis, file_axis_id, nfile_axis, nz_subaxis) + subroutine create_new_z_subaxis(zbounds, var_axis_ids, diag_axis, naxis, file_axis_id, nfile_axis, nz_subaxis, & + error_mseg) real(kind=r4_kind), intent(in) :: zbounds(2) !< Bounds of the Z axis integer, intent(inout) :: var_axis_ids(:) !< The variable's axis_ids class(fmsDiagAxisContainer_type), target, intent(inout) :: diag_axis(:) !< Array of diag_axis objects @@ -1413,58 +1457,69 @@ subroutine create_new_z_subaxis(zbounds, var_axis_ids, diag_axis, naxis, file_ax !! defined in file integer, intent(inout) :: nz_subaxis !< The number of z subaxis currently !! defined in the file + character(len=*), intent(inout) :: error_mseg !! Message to include in error message + !! if there is an error class(*), pointer :: zaxis_data(:) !< The data of the full zaxis integer :: subaxis_indices(2) !< The starting and ending indices of the subaxis relative to the full !! axis integer :: i !< For do loops integer :: subaxis_id !< The id of the new z subaxis - logical :: axis_found !< Flag that indicated if the zsubaxis already exists + integer :: parent_axis_id !< Id of parent axis id + integer :: zaxis_index !< Index of the z axis (i.e 3 if the variable is x,y,z) + type(fmsDiagFullAxis_type), pointer :: parent_axis !< Pointer to the parent axis + + parent_axis_id = diag_null + zaxis_index = diag_null + + !< Determine which axis is the z axis: + do i = 1, size(var_axis_ids) + select type (parent_axis => diag_axis(var_axis_ids(i))%axis) + type is (fmsDiagFullAxis_type) + if (parent_axis%cart_name .eq. "Z") then + parent_axis_id = var_axis_ids(i) + zaxis_index = i + endif + end select + enddo + + if (parent_axis_id .eq. DIAG_NULL) then + call mpp_error(FATAL, "create_new_z_subaxis:: unable to find the zaxis for "//trim(error_mseg)) + endif !< Determine if the axis was already created - axis_found = .false. do i = 1, nfile_axis select type (axis => diag_axis(file_axis_id(i))%axis) type is (fmsDiagSubAxis_type) + if (axis%parent_axis_id .ne. parent_axis_id) cycle if (axis%zbounds(1) .eq. zbounds(1) .and. axis%zbounds(2) .eq. zbounds(2)) then - axis_found = .true. - subaxis_id = file_axis_id(i) - exit + var_axis_ids(zaxis_index) = file_axis_id(i) + return endif end select enddo - !< Determine which of the variable's axis is the zaxis! - do i = 1, size(var_axis_ids) - select type (parent_axis => diag_axis(var_axis_ids(i))%axis) - type is (fmsDiagFullAxis_type) - if (parent_axis%cart_name .eq. "Z") then - !< If the axis was previously defined set the var_axis_ids and leave - if (axis_found) then - var_axis_ids(i) = subaxis_id - return - endif - zaxis_data => parent_axis%axis_data - - select type(zaxis_data) - type is (real(kind=r4_kind)) - !TODO need to include the conversion to "real" because nearest_index doesn't take r4s and r8s - subaxis_indices(1) = nearest_index(real(zbounds(1)), real(zaxis_data)) - subaxis_indices(2) = nearest_index(real(zbounds(2)), real(zaxis_data)) - type is (real(kind=r8_kind)) - subaxis_indices(1) = nearest_index(real(zbounds(1)), real(zaxis_data)) - subaxis_indices(2) = nearest_index(real(zbounds(2)), real(zaxis_data)) - end select - - nz_subaxis = nz_subaxis + 1 - call define_new_axis(diag_axis, parent_axis, naxis, parent_axis%axis_id, & + select type (axis => diag_axis(parent_axis_id)%axis) + type is (fmsDiagFullAxis_type) + zaxis_data => axis%axis_data + parent_axis => axis + end select + + select type(zaxis_data) + type is (real(kind=r4_kind)) + !TODO need to include the conversion to "real" because nearest_index doesn't take r4s and r8s + subaxis_indices(1) = nearest_index(real(zbounds(1)), real(zaxis_data)) + subaxis_indices(2) = nearest_index(real(zbounds(2)), real(zaxis_data)) + type is (real(kind=r8_kind)) + subaxis_indices(1) = nearest_index(real(zbounds(1)), real(zaxis_data)) + subaxis_indices(2) = nearest_index(real(zbounds(2)), real(zaxis_data)) + end select + + nz_subaxis = nz_subaxis + 1 + call define_new_axis(diag_axis, parent_axis, naxis, parent_axis%axis_id, & &subaxis_indices(1), subaxis_indices(2), (/lbound(zaxis_data,1), ubound(zaxis_data,1)/), & &new_axis_id=subaxis_id, zbounds=zbounds, nz_subaxis=nz_subaxis) - var_axis_ids(i) = subaxis_id - return - endif - end select - enddo + var_axis_ids(zaxis_index) = subaxis_id end subroutine @@ -1485,6 +1540,34 @@ function is_parent_axis(axis_id, parent_axis_id, diag_axis) & end select end function is_parent_axis + !> @brief Determine the name of the z subaxis by matching the parent axis id and the zbounds + !! in the diag table yaml + subroutine find_z_sub_axis_name(dim_name, parent_axis_id, file_axis_id, field_yaml, diag_axis) + character(len=*), intent(inout) :: dim_name !< Name of z subaxis + integer, intent(in) :: parent_axis_id !< Axis id of the parent + integer, intent(in) :: file_axis_id(:) !< Axis ids of the file + type(diagYamlFilesVar_type), intent(in) :: field_yaml !< Field info from diag_table yaml + class(fmsDiagAxisContainer_type),intent(in) :: diag_axis(:) !< Array of axis objections + + integer :: id + integer :: i + + do i = 1, size(file_axis_id) + id = file_axis_id(i) + select type (axis_ptr => diag_axis(id)%axis) + type is (fmsDiagSubAxis_type) + if (axis_ptr%parent_axis_id .eq. parent_axis_id) then + if (axis_ptr%is_same_zbounds(field_yaml%get_var_zbounds())) then + dim_name = axis_ptr%subaxis_name + return + endif + endif + end select + enddo + call mpp_error(FATAL, "Unable to determine the z subaxis name for field "//& + trim(field_yaml%get_var_varname())//" in file: "//& + trim(field_yaml%get_var_fname())) + end subroutine #endif end module fms_diag_axis_object_mod !> @} diff --git a/diag_manager/fms_diag_bbox.F90 b/diag_manager/fms_diag_bbox.F90 index a6d52696eb..7f4e672b20 100644 --- a/diag_manager/fms_diag_bbox.F90 +++ b/diag_manager/fms_diag_bbox.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup fms_diag_bbox_mod fms_diag_bbox_mod diff --git a/diag_manager/fms_diag_elem_weight_procs.F90 b/diag_manager/fms_diag_elem_weight_procs.F90 index 0a07d47327..9906236da8 100644 --- a/diag_manager/fms_diag_elem_weight_procs.F90 +++ b/diag_manager/fms_diag_elem_weight_procs.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup fms_diag_elem_weight_procs_mod fms_diag_elem_weight_procs_mod diff --git a/diag_manager/fms_diag_field_object.F90 b/diag_manager/fms_diag_field_object.F90 index ca3512ec8f..32ca9cf867 100644 --- a/diag_manager/fms_diag_field_object.F90 +++ b/diag_manager/fms_diag_field_object.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** module fms_diag_field_object_mod !> \author Tom Robinson @@ -31,13 +30,13 @@ module fms_diag_field_object_mod use diag_data_mod, only: max_field_attributes, fmsDiagAttribute_type use diag_data_mod, only: diag_null, diag_not_found, diag_not_registered, diag_registered_id, & &DIAG_FIELD_NOT_FOUND, avg_name, time_average, time_min, time_max, & - &time_none, time_diurnal, time_power, time_rms, time_sum + &time_none, time_diurnal, time_power, time_rms, time_sum, MAX_DIMENSIONS use fms_string_utils_mod, only: int2str=>string use mpp_mod, only: fatal, note, warning, mpp_error, mpp_pe, mpp_root_pe use fms_diag_yaml_mod, only: diagYamlFilesVar_type, get_diag_fields_entries, get_diag_files_id, & & find_diag_field, get_num_unique_fields, diag_yaml use fms_diag_axis_object_mod, only: diagDomain_t, get_domain_and_domain_type, fmsDiagAxis_type, & - & fmsDiagAxisContainer_type, fmsDiagFullAxis_Type + & fmsDiagAxisContainer_type, fmsDiagFullAxis_Type, find_z_sub_axis_name use time_manager_mod, ONLY: time_type, get_date use fms2_io_mod, only: FmsNetcdfFile_t, FmsNetcdfDomainFile_t, FmsNetcdfUnstructuredDomainFile_t, register_field, & register_variable_attribute @@ -189,6 +188,7 @@ module fms_diag_field_object_mod procedure :: get_longname_to_write procedure :: get_multiple_send_data procedure :: write_field_metadata + procedure :: get_chunksizes procedure :: write_coordinate_attribute procedure :: get_math_needs_to_be_done procedure :: add_area_volume @@ -393,7 +393,7 @@ subroutine fms_register_diag_field_obj & allocate(integer(kind=i8_kind) :: this%data_RANGE(2)) this%data_RANGE = varRANGE type is (real(kind=r4_kind)) - allocate(integer(kind=r4_kind) :: this%data_RANGE(2)) + allocate(integer(kind=i4_kind) :: this%data_RANGE(2)) this%data_RANGE = varRANGE type is (real(kind=r8_kind)) allocate(integer(kind=r8_kind) :: this%data_RANGE(2)) @@ -806,18 +806,31 @@ end function get_vartype !> @brief Gets varname !! @return copy of the variable name -pure function get_varname (this, to_write) & +function get_varname (this, filename, to_write) & result(rslt) - class (fmsDiagField_type), intent(in) :: this !< diag object - logical, optional, intent(in) :: to_write !< .true. if getting the varname that will be writen to the file + class (fmsDiagField_type), intent(in) :: this !< diag object + character(len=*), optional, intent(in) :: filename !< Name of the diag_file we are writing to + logical, optional, intent(in) :: to_write !< .true. if getting the varname that will be writen to the file character(len=:), allocatable :: rslt + + integer :: i + rslt = this%varname !< If writing the varname can be the outname which is defined in the yaml if (present(to_write)) then if (to_write) then - !TODO this is wrong - rslt = this%diag_field(1)%get_var_outname() + if (.not. present(filename)) then + call mpp_error(FATAL, "get_varname was called using the to_write optional argument, "//& + "but a filename was not provided!") + endif + ! Loop through all of the file the variable is in and find the outputname of the variable + do i = 1, size(this%diag_field) + if (trim(filename) .eq. trim(this%diag_field(i)%get_var_fname())) then + rslt = this%diag_field(i)%get_var_outname() + return + endif + enddo endif endif @@ -1162,7 +1175,8 @@ pure function get_longname_to_write(this, field_yaml) & end function get_longname_to_write !> @brief Determine the dimension names to use when registering the field to fms2_io -subroutine get_dimnames(this, diag_axis, field_yaml, unlim_dimname, dimnames, is_regional) +subroutine get_dimnames(this, diag_axis, field_yaml, unlim_dimname, dimnames, is_regional, & + file_axis_ids) class (fmsDiagField_type), target, intent(inout) :: this !< diag field class(fmsDiagAxisContainer_type), target, intent(in) :: diag_axis(:) !< Diag_axis object type(diagYamlFilesVar_type), intent(in) :: field_yaml !< Field info from diag_table yaml @@ -1170,6 +1184,7 @@ subroutine get_dimnames(this, diag_axis, field_yaml, unlim_dimname, dimnames, is character(len=120), allocatable, intent(out) :: dimnames(:) !< Array of the dimension names !! for the field logical, intent(in) :: is_regional !< Flag indicating if the field is regional + integer, intent(in) :: file_axis_ids(:) !< Ids of the file axis integer :: i !< For do loops integer :: naxis !< Number of axis for the field @@ -1193,7 +1208,7 @@ subroutine get_dimnames(this, diag_axis, field_yaml, unlim_dimname, dimnames, is do i = 1, size(this%axis_ids) axis_ptr => diag_axis(this%axis_ids(i)) if (axis_ptr%axis%is_z_axis()) then - dimnames(i) = axis_ptr%axis%get_axis_name(is_regional)//"_sub01" + call find_z_sub_axis_name(dimnames(i), this%axis_ids(i), file_axis_ids, field_yaml, diag_axis) else dimnames(i) = axis_ptr%axis%get_axis_name(is_regional) endif @@ -1218,17 +1233,19 @@ end subroutine get_dimnames !> @brief Wrapper for the register_field call. The select types are needed so that the code can go !! in the correct interface -subroutine register_field_wrap(fms2io_fileobj, varname, vartype, dimensions) +subroutine register_field_wrap(fms2io_fileobj, varname, vartype, dimensions, chunksizes) class(FmsNetcdfFile_t), INTENT(INOUT) :: fms2io_fileobj!< Fms2_io fileobj to write to character(len=*), INTENT(IN) :: varname !< Name of the variable character(len=*), INTENT(IN) :: vartype !< The type of the variable character(len=*), optional, INTENT(IN) :: dimensions(:) !< The dimension names of the field + integer, optional, INTENT(IN) :: chunksizes(:) !< Chunksize to use, only relevant when using + !! NETCDF-4 and the variable is domain decomposed select type(fms2io_fileobj) type is (FmsNetcdfFile_t) call register_field(fms2io_fileobj, varname, vartype, dimensions) type is (FmsNetcdfDomainFile_t) - call register_field(fms2io_fileobj, varname, vartype, dimensions) + call register_field(fms2io_fileobj, varname, vartype, dimensions, chunksizes=chunksizes) type is (FmsNetcdfUnstructuredDomainFile_t) call register_field(fms2io_fileobj, varname, vartype, dimensions) end select @@ -1236,7 +1253,7 @@ end subroutine register_field_wrap !> @brief Write the field's metadata to the file subroutine write_field_metadata(this, fms2io_fileobj, file_id, yaml_id, diag_axis, unlim_dimname, is_regional, & - cell_measures) + cell_measures, use_collective_writes, file_axis_ids) class (fmsDiagField_type), target, intent(inout) :: this !< diag field class(FmsNetcdfFile_t), INTENT(INOUT) :: fms2io_fileobj!< Fms2_io fileobj to write to integer, intent(in) :: file_id !< File id of the file to write to @@ -1245,6 +1262,9 @@ subroutine write_field_metadata(this, fms2io_fileobj, file_id, yaml_id, diag_axi character(len=*), intent(in) :: unlim_dimname !< The name of the unlimited dimension logical, intent(in) :: is_regional !< Flag indicating if the field is regional character(len=*), intent(in) :: cell_measures !< The cell measures attribute to write + logical, intent(in) :: use_collective_writes !< True if using collective writes + !! for this variable + integer, intent(in) :: file_axis_ids(:) !< Ids of all of the axis in thje file type(diagYamlFilesVar_type), pointer :: field_yaml !< pointer to the yaml entry character(len=:), allocatable :: var_name !< Variable name @@ -1257,12 +1277,22 @@ subroutine write_field_metadata(this, fms2io_fileobj, file_id, yaml_id, diag_axi character(len=:), allocatable :: interp_method_tmp !< temp to hold the name of the interpolation method integer :: interp_method_len !< length of the above string + integer, allocatable :: chunksizes(:) !< Chunksizes to use for the variable + field_yaml => diag_yaml%get_diag_field_from_id(yaml_id) var_name = field_yaml%get_var_outname() if (allocated(this%axis_ids)) then - call this%get_dimnames(diag_axis, field_yaml, unlim_dimname, dimnames, is_regional) - call register_field_wrap(fms2io_fileobj, var_name, this%get_var_skind(field_yaml), dimnames) + call this%get_dimnames(diag_axis, field_yaml, unlim_dimname, dimnames, is_regional, file_axis_ids) + + !! Collective writes are only used for 2D+ variables + if ((use_collective_writes .and. size(this%axis_ids) >= 2) .or. field_yaml%has_chunksizes()) then + chunksizes = this%get_chunksizes(diag_axis, field_yaml) + call register_field_wrap(fms2io_fileobj, var_name, this%get_var_skind(field_yaml), dimnames, & + chunksizes = chunksizes) + else + call register_field_wrap(fms2io_fileobj, var_name, this%get_var_skind(field_yaml), dimnames) + endif else if (this%is_static()) then call register_field_wrap(fms2io_fileobj, var_name, this%get_var_skind(field_yaml)) @@ -1342,6 +1372,60 @@ subroutine write_field_metadata(this, fms2io_fileobj, file_id, yaml_id, diag_axi endif end subroutine write_field_metadata +!> @brief Determine the appropriate chunksizes for a diagnostic field based on its axes. +!! For "X" and "Y" axes, the function returns a chunksize equal to the axis size divided by the layout. +!! If the dimension is not evenly divisible by the layout, the function raises an error. +!! For the other axis (i.e z axis) it return a chunksize equal to the axis length +!! For sub-z axes (e.g., layer bounds), a chunksize of 1 is returned for now, as this case is not yet implemented. +!! @return An integer array of chunksizes, one per diagnostic axis, plus one for the unlimited dimension. +function get_chunksizes(this, diag_axis, field_yaml) & + result(chunksizes) + + class (fmsDiagField_type), target, intent(inout) :: this !< diag field + class(fmsDiagAxisContainer_type), target, intent(in) :: diag_axis(:) !< Diag_axis object + type(diagYamlFilesVar_type), intent(in) :: field_yaml !< Field info from diag_table yaml + + integer, allocatable :: chunksizes(:) + + integer :: i !< For do loops + integer :: ndim !< Number of spatial dimensions + integer :: dim_size !< Dimensions size for the variable + integer :: layout !< Layout to use for the variable + integer :: specified_chunksizes(MAX_DIMENSIONS) !< Chunksizes specified in the yaml + + ndim = size(this%axis_ids) + allocate(chunksizes(ndim + 1)) !! Adding 1 because of the unlimited dimension + chunksizes = 1 + if (field_yaml%has_chunksizes()) then + specified_chunksizes = field_yaml%get_chunksizes() + chunksizes = specified_chunksizes(1:ndim+1) + return + endif + + ! Determine some default chunksizes to use, based on the compute domain + do i = 1, ndim + select type (axis => diag_axis(this%axis_ids(i))%axis) + type is (fmsDiagFullAxis_type) + if (axis%is_x_or_y_axis()) then + call axis%get_dim_size_layout(dim_size, layout) + if (mod(dim_size, layout) == 0) then + chunksizes(i) = dim_size / layout + else + call mpp_error(FATAL, "The variable "//field_yaml%get_var_varname()//" has a layout that is not"//& + "evenly divisible by dimension size for axis "//axis%get_axis_name()//"."& + "This may lead to poor performance when using collective writes. "//& + "Consider using a different layout, disabling collective writes, "//& + "or specifying chunksizes manually via the diag table yaml") + endif + else if (axis%is_z_axis() .and. field_yaml%has_var_zbounds()) then + !TODO Handle edge case: chunking for z-axis with layer bounds (not yet implemented) + else + chunksizes(i) = axis%axis_length() + endif + end select + enddo +end function get_chunksizes + !> @brief Writes the coordinate attribute of a field if any of the field's axis has an !! auxiliary axis subroutine write_coordinate_attribute (this, fms2io_fileobj, var_name, diag_axis) @@ -1609,7 +1693,7 @@ function get_default_missing_value(var_type) & !> @brief Determines the diag_obj id corresponding to a module name and field_name !> @return diag_obj id -PURE FUNCTION diag_field_id_from_name(this, module_name, field_name) & +FUNCTION diag_field_id_from_name(this, module_name, field_name) & result(diag_field_id) CLASS(fmsDiagField_type), INTENT(in) :: this !< The field object CHARACTER(len=*), INTENT(in) :: module_name !< Module name that registered the variable @@ -1927,14 +2011,14 @@ subroutine generate_associated_files_att(this, att, start_time) character(len=128) :: start_date !< Start date to append to the begining of the filename integer :: year, month, day, hour, minute, second - field_name = this%get_varname(to_write = .true.) + + file_name = this%get_field_file_name() + field_name = this%get_varname(to_write = .true., filename=file_name) ! Check if the field is already in the associated files attribute (i.e the area can be associated with multiple ! fields in the file, but it only needs to be added once) if (index(att, field_name) .ne. 0) return - file_name = this%get_field_file_name() - if (prepend_date) then call get_date(start_time, year, month, day, hour, minute, second) write (start_date, '(1I20.4, 2I2.2)') year, month, day diff --git a/diag_manager/fms_diag_fieldbuff_update.F90 b/diag_manager/fms_diag_fieldbuff_update.F90 index 0e3783dcef..f25b8d8088 100644 --- a/diag_manager/fms_diag_fieldbuff_update.F90 +++ b/diag_manager/fms_diag_fieldbuff_update.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup fms_diag_fieldbuff_update_mod fms_diag_fieldbuff_update_mod diff --git a/diag_manager/fms_diag_file_object.F90 b/diag_manager/fms_diag_file_object.F90 index be90692c9e..d502dce77c 100644 --- a/diag_manager/fms_diag_file_object.F90 +++ b/diag_manager/fms_diag_file_object.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup fms_diag_output_yaml_mod fms_diag_output_yaml_mod !> @ingroup diag_manager @@ -146,6 +145,7 @@ module fms_diag_file_object_mod procedure, public :: get_file_duration_units procedure, public :: get_file_varlist procedure, public :: get_file_global_meta + procedure, public :: is_using_collective_writes procedure, public :: is_done_writing_data procedure, public :: has_file_fname procedure, public :: has_file_frequnit @@ -653,6 +653,16 @@ pure function get_file_global_meta (this) result(res) res = this%diag_yaml_file%get_file_global_meta() end function get_file_global_meta +!> \brief Determines whether or not the file is using netcdf collective writes +!! \return logical indicating whether or not the file is using netcdf collective writes +pure function is_using_collective_writes (this) result(res) + class(fmsDiagFile_type), intent(in) :: this !< The file object + logical :: res + + res = this%diag_yaml_file%is_using_collective_writes() +end function is_using_collective_writes + + !> \brief Determines if done writing data !! \return .True. if done writing data pure function is_done_writing_data (this) result(res) @@ -831,6 +841,8 @@ subroutine add_axes(this, axis_ids, diag_axis, naxis, yaml_id, buffer_id, output integer :: subregion_gridtype !< The type of the subregion (latlon or index) logical :: write_on_this_pe !< Flag indicating if the current pe is in the subregion + character(len=MAX_STR_LEN) :: error_mseg !< Message to append in case there is a FATAL error + is_cube_sphere = .false. subregion_gridtype = this%get_file_sub_region_grid_type() @@ -842,9 +854,12 @@ subroutine add_axes(this, axis_ids, diag_axis, naxis, yaml_id, buffer_id, output !! which is why the copy was needed) var_axis_ids = axis_ids + error_mseg = "Field: "//trim(field_yaml%get_var_varname())//" in file: "//& + trim(field_yaml%get_var_fname()) + if (field_yaml%has_var_zbounds()) then call create_new_z_subaxis(field_yaml%get_var_zbounds(), var_axis_ids, diag_axis, naxis, & - this%axis_ids, this%number_of_axis, this%nz_subaxis) + this%axis_ids, this%number_of_axis, this%nz_subaxis, error_mseg) endif select type(this) @@ -1233,6 +1248,22 @@ subroutine open_diag_file(this, time_step, file_is_opened) file_name = trim(file_name)//"."//trim(mype_string) endif + ! Crash if a diag_file is using collective writes, but it is not one of the supported + ! methods (i.e only for domain decomposed files) + select case (diag_file%type_of_domain) + case (NO_DOMAIN, UG_DOMAIN) + if (diag_file%is_using_collective_writes()) then + call mpp_error(FATAL, "Collective writes are only supported for domain-decomposed files. "// & + trim(file_name)//" is using collective writes with an unsupported domain type.") + end if + case (TWO_D_DOMAIN) + if (is_regional .and. diag_file%is_using_collective_writes()) then + call mpp_error(FATAL, "Collective writes are not supported for regional runs. "// & + "Disable collective writes in the diag_table yaml for file:"// & + trim(file_name)) + end if + end select + !< Open the file! select type (fms2io_fileobj => diag_file%fms2io_fileobj) type is (FmsNetcdfFile_t) @@ -1250,7 +1281,9 @@ subroutine open_diag_file(this, time_step, file_is_opened) type is (FmsNetcdfDomainFile_t) select type (domain) type is (diagDomain2d_t) - if (.not. open_file(fms2io_fileobj, file_name, "overwrite", domain%Domain2)) & + if (.not. open_file(fms2io_fileobj, file_name, "overwrite", domain%Domain2, & + use_netcdf_mpi = diag_file%is_using_collective_writes(), & + use_collective = diag_file%is_using_collective_writes())) & &call mpp_error(FATAL, "Error opening the file:"//file_name) end select type is (FmsNetcdfUnstructuredDomainFile_t) @@ -1276,10 +1309,12 @@ subroutine write_global_metadata(this) character (len=MAX_STR_LEN), allocatable :: yaml_file_attributes(:,:) !< Global attributes defined in the yaml type(diagYamlFiles_type), pointer :: diag_file_yaml !< The diag_file yaml + character(len=MAX_STR_LEN) :: title !< The title as read in from the diag table yaml diag_file_yaml => this%FMS_diag_file%diag_yaml_file fms2io_fileobj => this%FMS_diag_file%fms2io_fileobj + !! Write out the global attributes defined in the diag table yaml if (diag_file_yaml%has_file_global_meta()) then yaml_file_attributes = diag_file_yaml%get_file_global_meta() do i = 1, size(yaml_file_attributes,1) @@ -1288,6 +1323,12 @@ subroutine write_global_metadata(this) enddo deallocate(yaml_file_attributes) endif + + !! Write out the 'title' global attribute + title = diag_yaml%get_title() + call register_global_attribute(fms2io_fileobj, 'title', trim(title), & + str_len=len_trim(title)) + end subroutine write_global_metadata !< @brief Writes a variable's metadata in the netcdf file @@ -1800,7 +1841,8 @@ subroutine write_field_metadata(this, diag_field, diag_axis) cell_measures = "" if (field_ptr%has_area()) then - cell_measures = "area: "//diag_field(field_ptr%get_area())%get_varname(to_write=.true.) + cell_measures = "area: "//diag_field(field_ptr%get_area())%get_varname(to_write=.true., & + filename=diag_file%get_file_fname()) !! Determine if the area field is already in the file. If it is not create the "associated_files" attribute !! which contains the file name of the file the area field is in. This is needed for PP/fregrid. @@ -1811,7 +1853,8 @@ subroutine write_field_metadata(this, diag_field, diag_axis) endif if (field_ptr%has_volume()) then - cell_measures = trim(cell_measures)//" volume: "//diag_field(field_ptr%get_volume())%get_varname(to_write=.true.) + cell_measures = trim(cell_measures)//" volume: "//diag_field(field_ptr%get_volume())%get_varname(& + to_write=.true., filename=diag_file%get_file_fname()) !! Determine if the volume field is already in the file. If it is not create the "associated_files" attribute !! which contains the file name of the file the volume field is in. This is needed for PP/fregrid. @@ -1822,7 +1865,8 @@ subroutine write_field_metadata(this, diag_field, diag_axis) endif call field_ptr%write_field_metadata(fms2io_fileobj, diag_file%id, diag_file%yaml_ids(i), diag_axis, & - this%FMS_diag_file%get_file_unlimdim(), is_regional, cell_measures) + this%FMS_diag_file%get_file_unlimdim(), is_regional, cell_measures, & + diag_file%is_using_collective_writes(), diag_file%axis_ids(1:diag_file%number_of_axis)) enddo if (need_associated_files) & diff --git a/diag_manager/fms_diag_input_buffer.F90 b/diag_manager/fms_diag_input_buffer.F90 index 0a4f0737e0..4422ffa319 100644 --- a/diag_manager/fms_diag_input_buffer.F90 +++ b/diag_manager/fms_diag_input_buffer.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup fms_diag_input_buffer_mod fms_diag_input_buffer_mod !> @ingroup diag_manager diff --git a/diag_manager/fms_diag_object.F90 b/diag_manager/fms_diag_object.F90 index 684c979f93..9f61f5efb9 100644 --- a/diag_manager/fms_diag_object.F90 +++ b/diag_manager/fms_diag_object.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** module fms_diag_object_mod use mpp_mod, only: fatal, note, warning, mpp_error, mpp_pe, mpp_root_pe, stdout diff --git a/diag_manager/fms_diag_outfield.F90 b/diag_manager/fms_diag_outfield.F90 index 2d30900293..83ddae0f3b 100644 --- a/diag_manager/fms_diag_outfield.F90 +++ b/diag_manager/fms_diag_outfield.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup fms_diag_outfield_mod fms_diag_outfield_mod diff --git a/diag_manager/fms_diag_output_buffer.F90 b/diag_manager/fms_diag_output_buffer.F90 index 3aeedc8fcb..a47e8d144d 100644 --- a/diag_manager/fms_diag_output_buffer.F90 +++ b/diag_manager/fms_diag_output_buffer.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @author Ryan Mulhall !> @email ryan.mulhall@noaa.gov diff --git a/diag_manager/fms_diag_reduction_methods.F90 b/diag_manager/fms_diag_reduction_methods.F90 index 802d251377..e0a45bc855 100644 --- a/diag_manager/fms_diag_reduction_methods.F90 +++ b/diag_manager/fms_diag_reduction_methods.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup fms_diag_reduction_methods_mod fms_diag_reduction_methods_mod diff --git a/diag_manager/fms_diag_time_reduction.F90 b/diag_manager/fms_diag_time_reduction.F90 index 78de19a25a..46b185c943 100644 --- a/diag_manager/fms_diag_time_reduction.F90 +++ b/diag_manager/fms_diag_time_reduction.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup fms_diag_time_reduction_mod fms_diag_time_reduction_mod diff --git a/diag_manager/fms_diag_time_utils.F90 b/diag_manager/fms_diag_time_utils.F90 index f142271223..4e353ca7f6 100644 --- a/diag_manager/fms_diag_time_utils.F90 +++ b/diag_manager/fms_diag_time_utils.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup fms_diag_time_utils_mod fms_diag_time_utils_mod !> @ingroup diag_manager diff --git a/diag_manager/fms_diag_yaml.F90 b/diag_manager/fms_diag_yaml.F90 index d5ff730e33..69e39f9381 100644 --- a/diag_manager/fms_diag_yaml.F90 +++ b/diag_manager/fms_diag_yaml.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup fms_diag_yaml_mod fms_diag_yaml_mod @@ -34,7 +33,7 @@ module fms_diag_yaml_mod index_gridtype, null_gridtype, DIAG_SECONDS, DIAG_MINUTES, DIAG_HOURS, DIAG_DAYS, & DIAG_MONTHS, DIAG_YEARS, time_average, time_rms, time_max, time_min, time_sum, & time_diurnal, time_power, time_none, r8, i8, r4, i4, DIAG_NOT_REGISTERED, & - middle_time, begin_time, end_time, MAX_STR_LEN + middle_time, begin_time, end_time, MAX_STR_LEN, MAX_DIMENSIONS use yaml_parser_mod, only: open_and_parse_file, get_value_from_key, get_num_blocks, get_nkeys, & get_block_ids, get_key_value, get_key_ids, get_key_name, missing_file_error_code use fms_yaml_output_mod, only: fmsYamlOutKeys_type, fmsYamlOutValues_type, write_yaml_from_struct_3, & @@ -152,6 +151,8 @@ module fms_diag_yaml_mod character (len=:), allocatable :: default_var_module !< The module for all of the variables in the file !! This may be overridden if the modules was defined at the !! variable level + logical :: use_collective_writes !< True if using collective writes, default is false + integer, dimension(MAX_DIMENSIONS):: default_chunksizes !< Specified chunksizes to use by default contains !> All getter functions (functions named get_x(), for member field named x) @@ -171,6 +172,7 @@ module fms_diag_yaml_mod procedure, public :: get_file_varlist procedure, public :: get_file_global_meta procedure, public :: get_filename_time + procedure, public :: is_using_collective_writes procedure, public :: is_global_meta !> Has functions to determine if allocatable variables are true. If a variable is not an allocatable !! then is will always return .true. @@ -208,6 +210,7 @@ module fms_diag_yaml_mod !! 0 if var_reduction is not "diurnalXX" integer , private :: pow_value !< The power value !! 0 if pow_value is not "powXX" + integer, dimension(MAX_DIMENSIONS), private :: chunksizes !< Specified chunksize for each axis in the field logical , private :: var_file_is_subregional !< true if the file this entry !! belongs to is subregional @@ -230,6 +233,7 @@ module fms_diag_yaml_mod procedure :: get_var_attributes procedure :: get_n_diurnal procedure :: get_pow_value + procedure :: get_chunksizes procedure :: is_var_attributes procedure :: has_var_fname @@ -245,6 +249,7 @@ module fms_diag_yaml_mod procedure :: has_n_diurnal procedure :: has_pow_value procedure :: has_standname + procedure :: has_chunksizes procedure :: add_axis_name procedure :: is_file_subregional procedure :: add_standname @@ -390,6 +395,15 @@ subroutine diag_yaml_object_init(diag_subset_output) logical :: is_instantaneous !< .True. if the file is instantaneous (i.e no averaging) character(len=FMS_FILE_LEN) :: yamlfilename !< Name of the expected diag_table.yaml + integer :: nmods !< Number of module block in a file + integer, allocatable :: mod_ids(:) !< Ids for each module block in a file + integer, allocatable :: nvars_per_file(:) !< Number of variables in each file that are actually + !! being written + logical, allocatable :: has_module_block(:)!< True if each file is using the module block + character(len=FMS_FILE_LEN), allocatable :: mod_name(:) !< Buffer to store module name + character(len=FMS_FILE_LEN) :: buffer !< Buffer to stote string variables + integer :: istart, iend !< Starting and ending indices of the file block + if (diag_yaml_module_initialized) return ! If doing and ensemble or nest run add the filename appendix (ens_XX or nest_XX) to the filename @@ -432,6 +446,8 @@ subroutine diag_yaml_object_init(diag_subset_output) !< Determine how many files are in the diag_yaml, ignoring those with write_file = False actual_num_files = 0 + allocate(nvars_per_file(nfiles)) + allocate(has_module_block(nfiles)) do i = 1, nfiles write_file = .true. call get_value_from_key(diag_yaml_id, diag_file_ids(i), "write_file", write_file, is_optional=.true.) @@ -439,7 +455,31 @@ subroutine diag_yaml_object_init(diag_subset_output) !< If ignoring the file, ignore the fields in that file too! if (.not. ignore(i)) then - nvars = get_total_num_vars(diag_yaml_id, diag_file_ids(i)) + ! Determine if the file has defined a module block + nmods = 0 + nmods = get_num_blocks(diag_yaml_id, "modules", parent_block_id=diag_file_ids(i)) + + nvars_per_file(i) = get_num_blocks(diag_yaml_id, "varlist", parent_block_id=diag_file_ids(i)) + if (nmods .ne. 0) then + has_module_block(i) = .true. + ! Get the total number of variables in each module block, ignoring those with write_var = .false. + if (nvars_per_file(i) .ne. 0) & + call mpp_error(FATAL, "diag_manager_mod:: the file:"//trim(filename)//" has a 'modules' block defined "//& + "and a 'module' key defined at the file level. This is not allowed!") + + allocate(mod_ids(nmods)) + call get_block_ids(diag_yaml_id, "modules", mod_ids, parent_block_id=diag_file_ids(i)) + + nvars = 0 + do j = 1, nmods + nvars_per_file(i) = nvars_per_file(i) + get_num_blocks(diag_yaml_id, "varlist", parent_block_id=mod_ids(j)) + nvars = nvars + get_total_num_vars(diag_yaml_id, mod_ids(j)) + enddo + deallocate(mod_ids) + else + nvars = get_total_num_vars(diag_yaml_id, diag_file_ids(i)) + has_module_block(i) = .false. + endif total_nvars = total_nvars + nvars if (nvars .ne. 0) then actual_num_files = actual_num_files + 1 @@ -472,16 +512,43 @@ subroutine diag_yaml_object_init(diag_subset_output) file_list%file_name(file_count) = trim(diag_yaml%diag_files(file_count)%file_fname)//c_null_char file_list%diag_file_indices(file_count) = file_count - nvars = 0 - nvars = get_num_blocks(diag_yaml_id, "varlist", parent_block_id=diag_file_ids(i)) - allocate(var_ids(nvars)) - call get_block_ids(diag_yaml_id, "varlist", var_ids, parent_block_id=diag_file_ids(i)) + if (has_module_block(i)) then + allocate(var_ids(nvars_per_file(i))) + allocate(mod_name(nvars_per_file(i))) + nmods = get_num_blocks(diag_yaml_id, "modules", parent_block_id=diag_file_ids(i)) + allocate(mod_ids(nmods)) + call get_block_ids(diag_yaml_id, "modules", mod_ids, parent_block_id=diag_file_ids(i)) + + istart = 1 + nvars_per_file(i) = 0 + do j = 1, nmods + iend = istart + get_num_blocks(diag_yaml_id, "varlist", parent_block_id=mod_ids(j)) - 1 + call get_block_ids(diag_yaml_id, "varlist", var_ids(istart:iend), parent_block_id=mod_ids(j)) + + ! Update nvars_per_file to only include those are actually being written + nvars_per_file(i) = nvars_per_file(i) + get_total_num_vars(diag_yaml_id, mod_ids(j)) + + call get_value_from_key(diag_yaml_id, mod_ids(j), "module", buffer) + mod_name(istart:iend) = trim(buffer) + + istart = iend + 1 + enddo + + deallocate(mod_ids) + else + allocate(var_ids(get_num_blocks(diag_yaml_id, "varlist", parent_block_id=diag_file_ids(i)))) + allocate(mod_name(size(var_ids))) + call get_block_ids(diag_yaml_id, "varlist", var_ids, parent_block_id=diag_file_ids(i)) + nvars_per_file(i) = get_total_num_vars(diag_yaml_id, diag_file_ids(i)) + endif + file_var_count = 0 - allocate(diag_yaml%diag_files(file_count)%file_varlist(get_total_num_vars(diag_yaml_id, diag_file_ids(i)))) - allocate(diag_yaml%diag_files(file_count)%file_outlist(get_total_num_vars(diag_yaml_id, diag_file_ids(i)))) + allocate(diag_yaml%diag_files(file_count)%file_varlist(nvars_per_file(i))) + allocate(diag_yaml%diag_files(file_count)%file_outlist(nvars_per_file(i))) + allow_averages = .not. diag_yaml%diag_files(file_count)%file_freq(1) < 1 is_instantaneous = .false. - nvars_loop: do j = 1, nvars + nvars_loop: do j = 1, size(var_ids) write_var = .true. call get_value_from_key(diag_yaml_id, var_ids(j), "write_var", write_var, is_optional=.true.) if (.not. write_var) cycle @@ -497,7 +564,7 @@ subroutine diag_yaml_object_init(diag_subset_output) diag_yaml%diag_fields(var_count)%var_file_is_subregional = diag_yaml%diag_files(file_count)%has_file_sub_region() call fill_in_diag_fields(diag_yaml_id, diag_yaml%diag_files(file_count), var_ids(j), & - diag_yaml%diag_fields(var_count), allow_averages) + diag_yaml%diag_fields(var_count), allow_averages, has_module_block(i), mod_name(j)) !> Save the variable name in the diag_file type diag_yaml%diag_files(file_count)%file_varlist(file_var_count) = diag_yaml%diag_fields(var_count)%var_varname @@ -515,6 +582,7 @@ subroutine diag_yaml_object_init(diag_subset_output) variable_list%diag_field_indices(var_count) = var_count enddo nvars_loop deallocate(var_ids) + deallocate(mod_name) enddo nfiles_loop !> Sort the file list in alphabetical order @@ -646,16 +714,28 @@ subroutine fill_in_diag_files(diag_yaml_id, diag_file_id, yaml_fileobj) is_optional=.true.) call diag_get_value_from_key(diag_yaml_id, diag_file_id, "module", yaml_fileobj%default_var_module, & is_optional=.true.) + + yaml_fileobj%use_collective_writes = .false. + call get_value_from_key(diag_yaml_id, diag_file_id, "use_collective_writes", & + yaml_fileobj%use_collective_writes, is_optional=.true.) + + yaml_fileobj%default_chunksizes = DIAG_NULL + call get_value_from_key(diag_yaml_id, diag_file_id, "chunksizes", & + yaml_fileobj%default_chunksizes, is_optional=.true.) + end subroutine !> @brief Fills in a diagYamlFilesVar_type with the contents of a variable block in !! diag_table.yaml -subroutine fill_in_diag_fields(diag_file_id, yaml_fileobj, var_id, field, allow_averages) +subroutine fill_in_diag_fields(diag_file_id, yaml_fileobj, var_id, field, allow_averages, & + has_module_block, mod_name) integer, intent(in) :: diag_file_id !< Id of the file block in the yaml file type(diagYamlFiles_type), intent(in) :: yaml_fileobj !< The yaml file obj for the variables integer, intent(in) :: var_id !< Id of the variable block in the yaml file type(diagYamlFilesVar_type), intent(inout) :: field !< diagYamlFilesVar_type obj to read the contents into logical, intent(in) :: allow_averages !< .True. if averages are allowed for this file + logical, intent(in) :: has_module_block + character(len=*), intent(in) :: mod_name integer :: natt !< Number of attributes in variable integer :: var_att_id(1) !< Id of the variable attribute block @@ -685,13 +765,17 @@ subroutine fill_in_diag_fields(diag_file_id, yaml_fileobj, var_id, field, allow_ "Check your diag_table.yaml for the field:"//trim(field%var_varname)) endif - if (yaml_fileobj%default_var_module .eq. "") then + if (yaml_fileobj%default_var_module .eq. "" .and. .not. has_module_block) then call diag_get_value_from_key(diag_file_id, var_id, "module", field%var_module) - else + else call diag_get_value_from_key(diag_file_id, var_id, "module", buffer, is_optional=.true.) !! If the module was set for the variable, override it with the default if (trim(buffer) .eq. "") then - field%var_module = yaml_fileobj%default_var_module + if (has_module_block) then + field%var_module = trim(mod_name) + else + field%var_module = yaml_fileobj%default_var_module + endif else field%var_module = trim(buffer) endif @@ -735,6 +819,12 @@ subroutine fill_in_diag_fields(diag_file_id, yaml_fileobj, var_id, field, allow_ field%var_zbounds = DIAG_NULL call get_value_from_key(diag_file_id, var_id, "zbounds", field%var_zbounds, is_optional=.true.) if (field%has_var_zbounds()) MAX_SUBAXES = MAX_SUBAXES + 1 + + field%chunksizes = DIAG_NULL + call get_value_from_key(diag_file_id, var_id, "chunksizes", field%chunksizes, is_optional=.true.) + if (.not. field%has_chunksizes()) then + field%chunksizes = yaml_fileobj%default_chunksizes + endif end subroutine !> @brief diag_manager wrapper to get_value_from_key to use for allocatable @@ -1143,6 +1233,16 @@ function is_global_meta(this) & res = .true. end function +!> \brief Determines whether or not the file is using netcdf collective writes +!! \return logical indicating whether or not the file is using netcdf collective writes +pure function is_using_collective_writes(this) & + result(res) + class (diagYamlFiles_type), intent(in) :: this !< The object being inquiried + + logical :: res + res = this%use_collective_writes +end function + !> @brief Increate the current_new_file_freq_index by 1 subroutine increase_new_file_freq_index(this) class(diagYamlFiles_type), intent(inout) :: this !< The file object @@ -1256,6 +1356,17 @@ pure function get_pow_value(this) & integer :: res !< What is returned res = this%pow_value end function get_pow_value + +!> @brief Inquiry for chunksizes +!! @return the chunksizes for the fiel +pure function get_chunksizes(this) & +result(res) + class (diagYamlFilesVar_type), intent(in) :: this !< The object being inquiried + integer :: res(MAX_DIMENSIONS) !< What is returned + + res = this%chunksizes +end function get_chunksizes + !> @brief Inquiry for whether var_attributes is allocated !! @return Flag indicating if var_attributes is allocated function is_var_attributes(this) & @@ -1463,6 +1574,13 @@ pure logical function has_standname(this) has_standname = (this%standard_name .ne. "") end function has_standname +!> @brief Checks if chunksizes is set for the diag field +!! @return true if chunksizes is set for the diag field +pure logical function has_chunksizes(this) + class(diagYamlFilesVar_type), intent(in) :: this !< diagYamlvar_type object to inquire + has_chunksizes = any(this%chunksizes .ne. DIAG_NULL) +end function has_chunksizes + !> @brief Checks if diag_file_obj%diag_title is allocated !! @return true if diag_file_obj%diag_title is allocated pure logical function has_diag_title (this) @@ -1742,7 +1860,7 @@ subroutine fms_diag_yaml_out(ntimes, ntiles, ndistributedfiles) !! This is the number of distributed files !! If the diag files were not combined, the name of the diag file is going to be - !! filename_tileXX.nc.YY, where YY is the distributed file number + !! filename_tileXX.nc.YY, where YY is the distributed file number !! (1 to the number of distributed files) call fms_f2c_string(keys2(i)%key13, 'number_of_distributed_files') diff --git a/diag_manager/include/fms_diag_fieldbuff_update.fh b/diag_manager/include/fms_diag_fieldbuff_update.fh index 61e86b2d56..fc7750612b 100644 --- a/diag_manager/include/fms_diag_fieldbuff_update.fh +++ b/diag_manager/include/fms_diag_fieldbuff_update.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief This code will be used by the preprocessor to generate an implementation diff --git a/diag_manager/include/fms_diag_fieldbuff_update.inc b/diag_manager/include/fms_diag_fieldbuff_update.inc index be6f51d0f1..02f4d9fe90 100644 --- a/diag_manager/include/fms_diag_fieldbuff_update.inc +++ b/diag_manager/include/fms_diag_fieldbuff_update.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** #undef FMS_DIAG_FBU_DATA_TYPE_ diff --git a/diag_manager/include/fms_diag_input_buffer.inc b/diag_manager/include/fms_diag_input_buffer.inc index 7f699fc79d..700e5a3f83 100644 --- a/diag_manager/include/fms_diag_input_buffer.inc +++ b/diag_manager/include/fms_diag_input_buffer.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief Appends the input_data_buffer and the mask (only when the mask is set to .True.) diff --git a/diag_manager/include/fms_diag_input_buffer_r4.fh b/diag_manager/include/fms_diag_input_buffer_r4.fh index 9799cf9998..86ececc7e0 100644 --- a/diag_manager/include/fms_diag_input_buffer_r4.fh +++ b/diag_manager/include/fms_diag_input_buffer_r4.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief Imports the input buffer routines from other include files used diff --git a/diag_manager/include/fms_diag_input_buffer_r8.fh b/diag_manager/include/fms_diag_input_buffer_r8.fh index a77dfb15a5..77eeba5f2b 100644 --- a/diag_manager/include/fms_diag_input_buffer_r8.fh +++ b/diag_manager/include/fms_diag_input_buffer_r8.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief Imports the input buffer routines from other include files used diff --git a/diag_manager/include/fms_diag_reduction_methods.inc b/diag_manager/include/fms_diag_reduction_methods.inc index e85037098c..74b829e668 100644 --- a/diag_manager/include/fms_diag_reduction_methods.inc +++ b/diag_manager/include/fms_diag_reduction_methods.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** ! for any debug prints diff --git a/diag_manager/include/fms_diag_reduction_methods_r4.fh b/diag_manager/include/fms_diag_reduction_methods_r4.fh index 1fe2b05539..2ccbbdb757 100644 --- a/diag_manager/include/fms_diag_reduction_methods_r4.fh +++ b/diag_manager/include/fms_diag_reduction_methods_r4.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief Imports the time reduction methods routines from other include files used diff --git a/diag_manager/include/fms_diag_reduction_methods_r8.fh b/diag_manager/include/fms_diag_reduction_methods_r8.fh index 2e60a64e73..9e245b98dc 100644 --- a/diag_manager/include/fms_diag_reduction_methods_r8.fh +++ b/diag_manager/include/fms_diag_reduction_methods_r8.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief Imports the time reduction methods routines from other include files used diff --git a/docs/Doxyfile.in b/docs/Doxyfile.in index df7e8596db..011a1a67e9 100644 --- a/docs/Doxyfile.in +++ b/docs/Doxyfile.in @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # Doxyfile 1.8.12 diff --git a/docs/Makefile.am b/docs/Makefile.am index 65bcf63f0c..2b008420f0 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of FMS. It creates the Makefile for the docs diff --git a/docs/grouping.h b/docs/grouping.h index 2cefac675c..e8e827778b 100644 --- a/docs/grouping.h +++ b/docs/grouping.h @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !! This header file is used exclusively for doxygen documentation !! Defines groups for each subdirectory to add their modules into diff --git a/drifters/Makefile.am b/drifters/Makefile.am index f365f8e1f2..bbd3efa156 100644 --- a/drifters/Makefile.am +++ b/drifters/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the drifters directory of the FMS diff --git a/drifters/cloud_interpolator.F90 b/drifters/cloud_interpolator.F90 index ef2ca004b2..3f865492e6 100644 --- a/drifters/cloud_interpolator.F90 +++ b/drifters/cloud_interpolator.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** #define _FLATTEN(A) reshape((A), (/size((A))/) ) diff --git a/drifters/drifters.F90 b/drifters/drifters.F90 index 4f5110cbdd..77a44a4138 100644 --- a/drifters/drifters.F90 +++ b/drifters/drifters.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** #include "fms_switches.h" diff --git a/drifters/drifters_combine b/drifters/drifters_combine index 3bb4b00693..8f98891cb1 100755 --- a/drifters/drifters_combine +++ b/drifters/drifters_combine @@ -1,22 +1,20 @@ #!/usr/bin/env python #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with the FV3 dynamical core. -#* If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** VERSION = "_FILE_VERSION" diff --git a/drifters/drifters_comm.F90 b/drifters/drifters_comm.F90 index b5a40e82e3..a0138da645 100644 --- a/drifters/drifters_comm.F90 +++ b/drifters/drifters_comm.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** #include "fms_switches.h" diff --git a/drifters/drifters_compute_k.fh b/drifters/drifters_compute_k.fh index 7336079747..01f2e9b133 100644 --- a/drifters/drifters_compute_k.fh +++ b/drifters/drifters_compute_k.fh @@ -1,21 +1,20 @@ ! -*-f90-*- !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** subroutine drifters_compute_k_XXX(self, positions, u, v, & diff --git a/drifters/drifters_core.F90 b/drifters/drifters_core.F90 index 8d35d05cf4..0c1cc8f25b 100644 --- a/drifters/drifters_core.F90 +++ b/drifters/drifters_core.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup drifters_core_mod drifters_core_mod !> @ingroup drifters diff --git a/drifters/drifters_input.F90 b/drifters/drifters_input.F90 index 157d12b215..973abff9c0 100644 --- a/drifters/drifters_input.F90 +++ b/drifters/drifters_input.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup drifters_input_mod drifters_input_mod !> @ingroup drifters diff --git a/drifters/drifters_io.F90 b/drifters/drifters_io.F90 index e9754f4487..e5f3091671 100644 --- a/drifters/drifters_io.F90 +++ b/drifters/drifters_io.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup drifters_io_mod drifters_io_mod !> @ingroup drifters diff --git a/drifters/drifters_push.fh b/drifters/drifters_push.fh index 330be19ae6..7e8621d93d 100644 --- a/drifters/drifters_push.fh +++ b/drifters/drifters_push.fh @@ -1,21 +1,20 @@ ! -*-f90-*- !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !============================================================================ subroutine drifters_push_XXX(self, u, v, & diff --git a/drifters/drifters_set_field.fh b/drifters/drifters_set_field.fh index dd60b20f3b..a3be14a492 100644 --- a/drifters/drifters_set_field.fh +++ b/drifters/drifters_set_field.fh @@ -1,21 +1,20 @@ ! -*-f90-*- !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** subroutine drifters_set_field_XXX(self, index_field, x, y, & diff --git a/drifters/fms_switches.h b/drifters/fms_switches.h index e659e214f8..fe995211c6 100644 --- a/drifters/fms_switches.h +++ b/drifters/fms_switches.h @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** #if !defined(use_libMPI) #define _SERIAL diff --git a/drifters/quicksort.F90 b/drifters/quicksort.F90 index 6f751858d1..479d3df16f 100644 --- a/drifters/quicksort.F90 +++ b/drifters/quicksort.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @cond #undef _TYP diff --git a/exchange/Makefile.am b/exchange/Makefile.am index e62ad1eb79..343b186b62 100644 --- a/exchange/Makefile.am +++ b/exchange/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the exchange directory of the FMS diff --git a/exchange/stock_constants.F90 b/exchange/stock_constants.F90 index 2be734878a..55e4a2c745 100644 --- a/exchange/stock_constants.F90 +++ b/exchange/stock_constants.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup stock_constants_mod stock_constants_mod !> @ingroup exchange diff --git a/exchange/xgrid.F90 b/exchange/xgrid.F90 index e67b4fbe9a..947c30a530 100644 --- a/exchange/xgrid.F90 +++ b/exchange/xgrid.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup xgrid_mod xgrid_mod !> @ingroup exchange @@ -3245,13 +3244,14 @@ end function xgrid_count !> Scatters data to exchange grid subroutine put_side1_to_xgrid(d, grid_id, x, xmap, remap_method, complete) - real(r8_kind), dimension(:,:), intent(in) :: d !< data to send - character(len=3), intent(in) :: grid_id !< 3 character grid ID - real(r8_kind), dimension(:), intent(inout) :: x !< xgrid data - type (xmap_type), intent(inout) :: xmap !< exchange grid - integer, intent(in), optional :: remap_method !< exchange grid interpolation method can + use, intrinsic :: iso_c_binding, only: c_ptr, c_null_ptr, c_loc + real(r8_kind), target, contiguous, intent(in) :: d(:,:) !< data to send + character(len=3), intent(in) :: grid_id !< 3 character grid ID + real(r8_kind), target, contiguous, intent(inout) :: x(:) !< xgrid data + type (xmap_type), intent(inout) :: xmap !< exchange grid + integer, intent(in), optional :: remap_method !< exchange grid interpolation method can !! be FIRST_ORDER(=1) or SECOND_ORDER(=2) - logical, intent(in), optional :: complete + logical, intent(in), optional :: complete logical :: is_complete, set_mismatch integer :: g, method @@ -3262,8 +3262,8 @@ subroutine put_side1_to_xgrid(d, grid_id, x, xmap, remap_method, complete) integer, save :: xsize=0 integer, save :: method_saved=0 character(len=3), save :: grid_id_saved="" - integer(i8_kind), dimension(MAX_FIELDS), save :: d_addrs = -9999_i8_kind - integer(i8_kind), dimension(MAX_FIELDS), save :: x_addrs = -9999_i8_kind + type(c_ptr), dimension(MAX_FIELDS), save :: d_addrs = c_null_ptr + type(c_ptr), dimension(MAX_FIELDS), save :: x_addrs = c_null_ptr if (grid_id==xmap%grids(1)%id) then method = FIRST_ORDER ! default @@ -3275,8 +3275,8 @@ subroutine put_side1_to_xgrid(d, grid_id, x, xmap, remap_method, complete) write( text,'(i2)' ) MAX_FIELDS call error_mesg ('xgrid_mod', 'MAX_FIELDS='//trim(text)//' exceeded for group put_side1_to_xgrid', FATAL) endif - d_addrs(lsize) = LOC(d) - x_addrs(lsize) = LOC(x) + d_addrs(lsize) = c_loc(d) + x_addrs(lsize) = c_loc(x) if(lsize == 1) then isize = size(d,1) @@ -3311,8 +3311,8 @@ subroutine put_side1_to_xgrid(d, grid_id, x, xmap, remap_method, complete) call put_1_to_xgrid_order_2(d_addrs, x_addrs, xmap, isize, jsize, xsize, lsize) endif - d_addrs = -9999_i8_kind - x_addrs = -9999_i8_kind + d_addrs = c_null_ptr + x_addrs = c_null_ptr isize = 0 jsize = 0 xsize = 0 @@ -3362,11 +3362,12 @@ end subroutine put_side2_to_xgrid !####################################################################### subroutine get_side1_from_xgrid(d, grid_id, x, xmap, complete) - real(r8_kind), dimension(:,:), intent(out) :: d !< received xgrid data - character(len=3), intent(in) :: grid_id !< 3 character grid ID - real(r8_kind), dimension(:), intent(in) :: x !< xgrid data - type (xmap_type), intent(inout) :: xmap !< exchange grid - logical, intent(in), optional :: complete + use, intrinsic :: iso_c_binding, only: c_ptr, c_null_ptr, c_loc + real(r8_kind), target, contiguous, intent(out) :: d(:,:) !< received xgrid data + character(len=3), intent(in) :: grid_id !< 3 character grid ID + real(r8_kind), target, contiguous, intent(in) :: x(:) !< xgrid data + type (xmap_type), intent(inout) :: xmap !< exchange grid + logical, intent(in), optional :: complete logical :: is_complete, set_mismatch integer :: g @@ -3376,8 +3377,8 @@ subroutine get_side1_from_xgrid(d, grid_id, x, xmap, complete) integer, save :: lsize=0 integer, save :: xsize=0 character(len=3), save :: grid_id_saved="" - integer(i8_kind), dimension(MAX_FIELDS), save :: d_addrs = -9999_i8_kind - integer(i8_kind), dimension(MAX_FIELDS), save :: x_addrs = -9999_i8_kind + type(c_ptr), dimension(MAX_FIELDS), save :: d_addrs = c_null_ptr + type(c_ptr), dimension(MAX_FIELDS), save :: x_addrs = c_null_ptr d = 0.0_r8_kind if (grid_id==xmap%grids(1)%id) then @@ -3388,8 +3389,8 @@ subroutine get_side1_from_xgrid(d, grid_id, x, xmap, complete) write( text,'(i2)' ) MAX_FIELDS call error_mesg ('xgrid_mod', 'MAX_FIELDS='//trim(text)//' exceeded for group get_side1_from_xgrid', FATAL) endif - d_addrs(lsize) = LOC(d) - x_addrs(lsize) = LOC(x) + d_addrs(lsize) = c_loc(d) + x_addrs(lsize) = c_loc(x) if(lsize == 1) then isize = size(d,1) @@ -3415,8 +3416,8 @@ subroutine get_side1_from_xgrid(d, grid_id, x, xmap, complete) else call get_1_from_xgrid(d_addrs, x_addrs, xmap, isize, jsize, xsize, lsize) end if - d_addrs(1:lsize) = -9999 - x_addrs(1:lsize) = -9999 + d_addrs(1:lsize) = c_null_ptr + x_addrs(1:lsize) = c_null_ptr isize = 0 jsize = 0 xsize = 0 @@ -3547,8 +3548,9 @@ end subroutine get_2_from_xgrid !####################################################################### subroutine put_1_to_xgrid_order_1(d_addrs, x_addrs, xmap, isize, jsize, xsize, lsize) - integer(i8_kind), dimension(:), intent(in) :: d_addrs - integer(i8_kind), dimension(:), intent(in) :: x_addrs + use, intrinsic :: iso_c_binding, only: c_ptr, c_f_pointer + type(c_ptr), dimension(:), intent(in) :: d_addrs + type(c_ptr), dimension(:), intent(in) :: x_addrs type (xmap_type), intent(inout) :: xmap integer, intent(in) :: isize, jsize, xsize, lsize @@ -3560,10 +3562,8 @@ subroutine put_1_to_xgrid_order_1(d_addrs, x_addrs, xmap, isize, jsize, xsize, l real(r8_kind) :: send_buffer(xmap%put1%sendsize*lsize) real(r8_kind) :: unpack_buffer(xmap%put1%recvsize) - real(r8_kind), dimension(isize, jsize) :: d - real(r8_kind), dimension(xsize) :: x - pointer(ptr_d, d) - pointer(ptr_x, x) + real(r8_kind), pointer :: d(:,:) ! isize, jsize + real(r8_kind), pointer :: x(:) ! xsize call mpp_clock_begin(id_put_1_to_xgrid_order_1) @@ -3583,7 +3583,7 @@ subroutine put_1_to_xgrid_order_1(d_addrs, x_addrs, xmap, isize, jsize, xsize, l to_pe = comm%send(p)%pe pos = buffer_pos do l = 1, lsize - ptr_d = d_addrs(l) + call c_f_pointer(d_addrs(l), d, shape=[isize, jsize]) do n = 1, comm%send(p)%count pos = pos + 1 i = comm%send(p)%i(n) @@ -3599,16 +3599,16 @@ subroutine put_1_to_xgrid_order_1(d_addrs, x_addrs, xmap, isize, jsize, xsize, l !--- unpack the buffer if( lsize == 1) then - ptr_x = x_addrs(1) + call c_f_pointer(x_addrs(1), x, shape=[xsize]) do l=1,xmap%size_put1 x(l) = recv_buffer(xmap%x1_put(l)%pos) end do else start_pos = 0 -!$OMP parallel do default(none) shared(lsize,x_addrs,comm,recv_buffer,xmap) & -!$OMP private(ptr_x,count,ibegin,istart,iend,pos,unpack_buffer) +!$OMP parallel do default(none) shared(lsize,xsize,x_addrs,comm,recv_buffer,xmap) & +!$OMP private(x,count,ibegin,istart,iend,pos,unpack_buffer) do l = 1, lsize - ptr_x = x_addrs(l) + call c_f_pointer(x_addrs(l), x, shape=[xsize]) do p = 1, comm%nrecv count = comm%recv(p)%count ibegin = comm%recv(p)%buffer_pos*lsize + 1 @@ -3636,10 +3636,11 @@ end subroutine put_1_to_xgrid_order_1 subroutine put_1_to_xgrid_order_2(d_addrs, x_addrs, xmap, isize, jsize, xsize, lsize) - integer(i8_kind), dimension(:), intent(in) :: d_addrs - integer(i8_kind), dimension(:), intent(in) :: x_addrs - type (xmap_type), intent(inout) :: xmap - integer, intent(in) :: isize, jsize, xsize, lsize + use, intrinsic :: iso_c_binding, only: c_ptr, c_f_pointer + type(c_ptr), intent(in) :: d_addrs(:) + type(c_ptr), intent(in) :: x_addrs(:) + type (xmap_type), intent(inout) :: xmap + integer, intent(in) :: isize, jsize, xsize, lsize !: NOTE: halo size is assumed to be 1 in setup_xmap real(r8_kind), dimension(0:isize+1, 0:jsize+1, lsize) :: tmp @@ -3657,10 +3658,8 @@ subroutine put_1_to_xgrid_order_2(d_addrs, x_addrs, xmap, isize, jsize, xsize, l real(r8_kind) :: send_buffer(xmap%put1%sendsize*lsize*3) real(r8_kind) :: unpack_buffer(xmap%put1%recvsize*3) logical :: on_west_edge, on_east_edge, on_south_edge, on_north_edge - real(r8_kind), dimension(isize, jsize) :: d - real(r8_kind), dimension(xsize) :: x - pointer(ptr_d, d) - pointer(ptr_x, x) + real(r8_kind), pointer :: d(:,:) + real(r8_kind), pointer :: x(:) call mpp_clock_begin(id_put_1_to_xgrid_order_2) grid1 => xmap%grids(1) @@ -3670,10 +3669,10 @@ subroutine put_1_to_xgrid_order_2(d_addrs, x_addrs, xmap, isize, jsize, xsize, l isd = grid1%isd_me jsd = grid1%jsd_me -!$OMP parallel do default(none) shared(lsize,tmp,d_addrs,isize,jsize) private(ptr_d) +!$OMP parallel do default(none) shared(lsize,isize,jsize,tmp,d_addrs) private(d) do l = 1, lsize tmp(:,:,l) = LARGE_NUMBER - ptr_d = d_addrs(l) + call c_f_pointer(d_addrs(l), d, shape=[isize, jsize]) tmp(1:isize,1:jsize,l) = d(:,:) enddo @@ -3746,7 +3745,7 @@ subroutine put_1_to_xgrid_order_2(d_addrs, x_addrs, xmap, isize, jsize, xsize, l msgsize = comm%send(p)%count*lsize to_pe = comm%send(p)%pe do l = 1, lsize - ptr_d = d_addrs(l) + call c_f_pointer(d_addrs(l), d, shape=[isize, jsize]) do n = 1, comm%send(p)%count pos = pos + 1 i = comm%send(p)%i(n) @@ -3763,7 +3762,7 @@ subroutine put_1_to_xgrid_order_2(d_addrs, x_addrs, xmap, isize, jsize, xsize, l to_pe = comm%send(p)%pe pos = buffer_pos do l = 1, lsize - ptr_d = d_addrs(l) + call c_f_pointer(d_addrs(l), d, shape=[isize, jsize]) do n = 1, comm%send(p)%count pos = pos + 1 i = comm%send(p)%i(n) @@ -3785,7 +3784,7 @@ subroutine put_1_to_xgrid_order_2(d_addrs, x_addrs, xmap, isize, jsize, xsize, l to_pe = comm%send(p)%pe pos = buffer_pos do l = 1, lsize - ptr_d = d_addrs(l) + call c_f_pointer(d_addrs(l), d, shape=[isize, jsize]) do n = 1, comm%send(p)%count pos = pos + 3 i = comm%send(p)%i(n) @@ -3805,14 +3804,14 @@ subroutine put_1_to_xgrid_order_2(d_addrs, x_addrs, xmap, isize, jsize, xsize, l !--- unpack the buffer if(monotonic_exchange) then if( lsize == 1) then - ptr_x = x_addrs(1) + call c_f_pointer(x_addrs(1), x, shape=[xsize]) do l=1,xmap%size_put1 pos = xmap%x1_put(l)%pos x(l) = recv_buffer(pos) end do else do l = 1, lsize - ptr_x = x_addrs(l) + call c_f_pointer(x_addrs(l), x, shape=[xsize]) pos = 0 do p = 1, comm%nsend count = comm%send(p)%count @@ -3833,17 +3832,17 @@ subroutine put_1_to_xgrid_order_2(d_addrs, x_addrs, xmap, isize, jsize, xsize, l endif else if( lsize == 1) then - ptr_x = x_addrs(1) -!$OMP parallel do default(none) shared(xmap,recv_buffer,ptr_x) private(pos) + call c_f_pointer(x_addrs(1), x, shape=[xsize]) +!$OMP parallel do default(none) shared(xmap,recv_buffer,x) private(pos) do l=1,xmap%size_put1 pos = xmap%x1_put(l)%pos x(l) = recv_buffer(3*pos-2) + recv_buffer(3*pos-1)*xmap%x1_put(l)%dj + recv_buffer(3*pos)*xmap%x1_put(l)%di end do else -!$OMP parallel do default(none) shared(lsize,comm,xmap,recv_buffer,x_addrs) & -!$OMP private(ptr_x,pos,ibegin,istart,iend,count,unpack_buffer) +!$OMP parallel do default(none) shared(lsize,xsize,comm,xmap,recv_buffer,x_addrs) & +!$OMP private(x,pos,ibegin,istart,iend,count,unpack_buffer) do l = 1, lsize - ptr_x = x_addrs(l) + call c_f_pointer(x_addrs(l), x, shape=[xsize]) pos = 0 ibegin = 1 do p = 1, comm%nrecv @@ -3874,10 +3873,11 @@ end subroutine put_1_to_xgrid_order_2 !####################################################################### subroutine get_1_from_xgrid(d_addrs, x_addrs, xmap, isize, jsize, xsize, lsize) - integer(i8_kind), dimension(:), intent(in) :: d_addrs - integer(i8_kind), dimension(:), intent(in) :: x_addrs - type (xmap_type), intent(inout) :: xmap - integer, intent(in) :: isize, jsize, xsize, lsize + use, intrinsic :: iso_c_binding, only: c_ptr, c_f_pointer + type(c_ptr), intent(in) :: d_addrs(:) + type(c_ptr), intent(in) :: x_addrs(:) + type (xmap_type), intent(inout) :: xmap + integer, intent(in) :: isize, jsize, xsize, lsize real(r8_kind), dimension(xmap%size), target :: dg(xmap%size, lsize) integer :: i, j, l, p, n, m @@ -3890,10 +3890,8 @@ subroutine get_1_from_xgrid(d_addrs, x_addrs, xmap, isize, jsize, xsize, lsize) type(overlap_type), pointer, save :: recv => NULL() real(r8_kind) :: recv_buffer(xmap%get1%recvsize*lsize*3) real(r8_kind) :: send_buffer(xmap%get1%sendsize*lsize*3) - real(r8_kind) :: d(isize,jsize) - real(r8_kind), dimension(xsize) :: x - pointer(ptr_d, d) - pointer(ptr_x, x) + real(r8_kind), pointer :: d(:,:) + real(r8_kind), pointer :: x(:) call mpp_clock_begin(id_get_1_from_xgrid) @@ -3908,9 +3906,9 @@ subroutine get_1_from_xgrid(d_addrs, x_addrs, xmap, isize, jsize, xsize, lsize) enddo dg = 0.0_r8_kind; -!$OMP parallel do default(none) shared(lsize,xmap,dg,x_addrs) private(dgp,ptr_x) +!$OMP parallel do default(none) shared(lsize,xsize,xmap,dg,x_addrs) private(dgp,x) do l = 1, lsize - ptr_x = x_addrs(l) + call c_f_pointer(x_addrs(l), x, shape=[xsize]) do i=1,xmap%size dgp => dg(xmap%x1(i)%pos,l) dgp = dgp + xmap%x1(i)%area*x(i) @@ -3942,7 +3940,7 @@ subroutine get_1_from_xgrid(d_addrs, x_addrs, xmap, isize, jsize, xsize, lsize) !--- unpack the buffer do l = 1, lsize - ptr_d = d_addrs(l) + call c_f_pointer(d_addrs(l), d, shape=[isize, jsize]) d = 0.0_r8_kind enddo !--- To bitwise reproduce old results, first copy the data onto its own pe. @@ -3952,11 +3950,11 @@ subroutine get_1_from_xgrid(d_addrs, x_addrs, xmap, isize, jsize, xsize, lsize) count = recv%count buffer_pos = recv%buffer_pos*lsize if( recv%pe == xmap%me ) then -!$OMP parallel do default(none) shared(lsize,recv,recv_buffer,buffer_pos,d_addrs,count) & -!$OMP private(ptr_d,i,j,pos) +!$OMP parallel do default(none) shared(lsize,isize,jsize,recv,recv_buffer,buffer_pos,d_addrs,count) & +!$OMP private(d,i,j,pos) do l = 1, lsize pos = buffer_pos + (l-1)*count - ptr_d = d_addrs(l) + call c_f_pointer(d_addrs(l), d, shape=[isize, jsize]) do n = 1,count i = recv%i(n) j = recv%j(n) @@ -3976,11 +3974,11 @@ subroutine get_1_from_xgrid(d_addrs, x_addrs, xmap, isize, jsize, xsize, lsize) cycle endif buffer_pos = recv%buffer_pos*lsize -!$OMP parallel do default(none) shared(lsize,recv,recv_buffer,buffer_pos,d_addrs) & -!$OMP private(ptr_d,i,j,pos) +!$OMP parallel do default(none) shared(lsize,isize,jsize,recv,recv_buffer,buffer_pos,d_addrs) & +!$OMP private(d,i,j,pos) do l = 1, lsize pos = buffer_pos + (l-1)*recv%count - ptr_d = d_addrs(l) + call c_f_pointer(d_addrs(l), d, shape=[isize, jsize]) do n = 1, recv%count i = recv%i(n) j = recv%j(n) @@ -3993,9 +3991,9 @@ subroutine get_1_from_xgrid(d_addrs, x_addrs, xmap, isize, jsize, xsize, lsize) ! ! normalize with side 1 grid cell areas ! -!$OMP parallel do default(none) shared(lsize,d_addrs,grid1) private(ptr_d) +!$OMP parallel do default(none) shared(lsize,isize,jsize,d_addrs,grid1) private(d) do l = 1, lsize - ptr_d = d_addrs(l) + call c_f_pointer(d_addrs(l), d, shape=[isize, jsize]) d = d * grid1%area_inv enddo call mpp_sync_self() @@ -4006,10 +4004,11 @@ end subroutine get_1_from_xgrid !####################################################################### subroutine get_1_from_xgrid_repro(d_addrs, x_addrs, xmap, xsize, lsize) - integer(i8_kind), dimension(:), intent(in) :: d_addrs - integer(i8_kind), dimension(:), intent(in) :: x_addrs - type (xmap_type), intent(inout) :: xmap - integer, intent(in) :: xsize, lsize + use, intrinsic :: iso_c_binding, only: c_ptr, c_f_pointer + type(c_ptr), intent(in) :: d_addrs(:) + type(c_ptr), intent(in) :: x_addrs(:) + type (xmap_type), intent(inout) :: xmap + integer, intent(in) :: xsize, lsize integer :: g, i, j, k, p, l, n, l2, l3 integer :: msgsize, buffer_pos, pos @@ -4020,13 +4019,13 @@ subroutine get_1_from_xgrid_repro(d_addrs, x_addrs, xmap, xsize, lsize) integer, dimension(0:xmap%npes-1) :: pl, ml real(r8_kind) :: recv_buffer(xmap%recv_count_repro_tot*lsize) real(r8_kind) :: send_buffer(xmap%send_count_repro_tot*lsize) - real(r8_kind) :: d(xmap%grids(1)%is_me:xmap%grids(1)%ie_me, & - xmap%grids(1)%js_me:xmap%grids(1)%je_me) - real(r8_kind), dimension(xsize) :: x - pointer(ptr_d, d) - pointer(ptr_x, x) + real(r8_kind), pointer :: d(:,:) + real(r8_kind), pointer :: x(:) + real(r8_kind), pointer, contiguous :: tmpptr(:,:) + integer :: shape_d(2) call mpp_clock_begin(id_get_1_from_xgrid_repro) + shape_d = [xmap%grids(1)%ie_me-xmap%grids(1)%is_me+1, xmap%grids(1)%je_me-xmap%grids(1)%js_me+1] comm => xmap%get1_repro !--- pre-post receiving do p = 1, comm%nrecv @@ -4041,13 +4040,13 @@ subroutine get_1_from_xgrid_repro(d_addrs, x_addrs, xmap, xsize, lsize) !pack the data send_buffer(:) = 0.0_r8_kind -!$OMP parallel do default(none) shared(lsize,x_addrs,comm,xmap,send_buffer) & -!$OMP private(ptr_x,i,j,g,l2,pos,send) +!$OMP parallel do default(none) shared(lsize,xsize,x_addrs,comm,xmap,send_buffer) & +!$OMP private(x,i,j,g,l2,pos,send) do p = 1, comm%nsend pos = comm%send(p)%buffer_pos*lsize send => comm%send(p) do l = 1,lsize - ptr_x = x_addrs(l) + call c_f_pointer(x_addrs(l), x, shape=[xsize]) do n = 1, send%count i = send%i(n) j = send%j(n) @@ -4071,16 +4070,18 @@ subroutine get_1_from_xgrid_repro(d_addrs, x_addrs, xmap, xsize, lsize) enddo do l = 1, lsize - ptr_d = d_addrs(l) + call c_f_pointer(d_addrs(l), tmpptr, shape=shape_d) + d(xmap%grids(1)%is_me:xmap%grids(1)%ie_me, xmap%grids(1)%js_me:xmap%grids(1)%je_me) => tmpptr d = 0 enddo call mpp_sync_self(check=EVENT_RECV) -!$OMP parallel do default(none) shared(lsize,d_addrs,xmap,recv_buffer,pl,ml) & -!$OMP private(ptr_d,grid,i,j,p,pos) +!$OMP parallel do default(none) shared(lsize,shape_d,d_addrs,xmap,recv_buffer,pl,ml) & +!$OMP private(d,tmpptr,grid,i,j,p,pos) do l = 1, lsize - ptr_d = d_addrs(l) + call c_f_pointer(d_addrs(l), tmpptr, shape=shape_d) + d(xmap%grids(1)%is_me:xmap%grids(1)%ie_me, xmap%grids(1)%js_me:xmap%grids(1)%je_me) => tmpptr do g=2,size(xmap%grids(:)) grid => xmap%grids(g) do l3=1,grid%size_repro ! index into side1 grid's patterns @@ -4842,15 +4843,16 @@ end function is_lat_lon ! ! ! -! +! ! subroutine get_side1_from_xgrid_ug(d, grid_id, x, xmap, complete) - real(r8_kind), dimension(:), intent(out) :: d - character(len=3), intent(in) :: grid_id - real(r8_kind), dimension(:), intent(in) :: x - type (xmap_type), intent(inout) :: xmap - logical, intent(in), optional :: complete + use, intrinsic :: iso_c_binding, only: c_ptr, c_null_ptr, c_loc + real(r8_kind), target, contiguous, intent(out) :: d(:) + character(len=3), intent(in) :: grid_id + real(r8_kind), target, contiguous, intent(in) :: x(:) + type (xmap_type), intent(inout) :: xmap + logical, intent(in), optional :: complete logical :: is_complete, set_mismatch integer :: g @@ -4859,8 +4861,8 @@ subroutine get_side1_from_xgrid_ug(d, grid_id, x, xmap, complete) integer, save :: lsize=0 integer, save :: xsize=0 character(len=3), save :: grid_id_saved="" - integer(i8_kind), dimension(MAX_FIELDS), save :: d_addrs = -9999_i8_kind - integer(i8_kind), dimension(MAX_FIELDS), save :: x_addrs = -9999_i8_kind + type(c_ptr), dimension(MAX_FIELDS), save :: d_addrs = c_null_ptr + type(c_ptr), dimension(MAX_FIELDS), save :: x_addrs = c_null_ptr d = 0.0_r8_kind if (grid_id==xmap%grids(1)%id) then @@ -4871,8 +4873,8 @@ subroutine get_side1_from_xgrid_ug(d, grid_id, x, xmap, complete) write( text,'(i2)' ) MAX_FIELDS call error_mesg ('xgrid_mod', 'MAX_FIELDS='//trim(text)//' exceeded for group get_side1_from_xgrid_ug', FATAL) endif - d_addrs(lsize) = LOC(d) - x_addrs(lsize) = LOC(x) + d_addrs(lsize) = c_loc(d) + x_addrs(lsize) = c_loc(x) if(lsize == 1) then isize = size(d(:)) @@ -4896,8 +4898,8 @@ subroutine get_side1_from_xgrid_ug(d, grid_id, x, xmap, complete) else call get_1_from_xgrid_ug(d_addrs, x_addrs, xmap, isize, xsize, lsize) end if - d_addrs(1:lsize) = -9999_i8_kind - x_addrs(1:lsize) = -9999_i8_kind + d_addrs(1:lsize) = c_null_ptr + x_addrs(1:lsize) = c_null_ptr isize = 0 xsize = 0 lsize = 0 @@ -4928,11 +4930,12 @@ end subroutine get_side1_from_xgrid_ug !> @brief Currently only support first order. subroutine put_side1_to_xgrid_ug(d, grid_id, x, xmap, complete) - real(r8_kind), dimension(:), intent(in) :: d !< - character(len=3), intent(in) :: grid_id - real(r8_kind), dimension(:), intent(inout) :: x - type (xmap_type), intent(inout) :: xmap - logical, intent(in), optional :: complete + use, intrinsic :: iso_c_binding, only: c_ptr, c_null_ptr, c_loc + real(r8_kind), target, contiguous, intent(in) :: d(:) !< + character(len=3), intent(in) :: grid_id + real(r8_kind), target, contiguous, intent(inout) :: x(:) + type (xmap_type), intent(inout) :: xmap + logical, intent(in), optional :: complete logical :: is_complete, set_mismatch integer :: g @@ -4941,8 +4944,8 @@ subroutine put_side1_to_xgrid_ug(d, grid_id, x, xmap, complete) integer, save :: lsize=0 integer, save :: xsize=0 character(len=3), save :: grid_id_saved="" - integer(i8_kind), dimension(MAX_FIELDS), save :: d_addrs = -9999_i8_kind - integer(i8_kind), dimension(MAX_FIELDS), save :: x_addrs = -9999_i8_kind + type(c_ptr), dimension(MAX_FIELDS), save :: d_addrs = c_null_ptr + type(c_ptr), dimension(MAX_FIELDS), save :: x_addrs = c_null_ptr if (grid_id==xmap%grids(1)%id) then is_complete = .true. @@ -4952,8 +4955,8 @@ subroutine put_side1_to_xgrid_ug(d, grid_id, x, xmap, complete) write( text,'(i2)' ) MAX_FIELDS call error_mesg ('xgrid_mod', 'MAX_FIELDS='//trim(text)//' exceeded for group put_side1_to_xgrid_ug', FATAL) endif - d_addrs(lsize) = LOC(d) - x_addrs(lsize) = LOC(x) + d_addrs(lsize) = c_loc(d) + x_addrs(lsize) = c_loc(x) if(lsize == 1) then dsize = size(d(:)) @@ -4973,8 +4976,8 @@ subroutine put_side1_to_xgrid_ug(d, grid_id, x, xmap, complete) if(is_complete) then call put_1_to_xgrid_ug_order_1(d_addrs, x_addrs, xmap, dsize, xsize, lsize) - d_addrs(1:lsize) = -9999_i8_kind - x_addrs(1:lsize) = -9999_i8_kind + d_addrs(1:lsize) = c_null_ptr + x_addrs(1:lsize) = c_null_ptr dsize = 0 xsize = 0 lsize = 0 @@ -5062,10 +5065,11 @@ end subroutine get_side2_from_xgrid_ug !####################################################################### subroutine put_1_to_xgrid_ug_order_1(d_addrs, x_addrs, xmap, dsize, xsize, lsize) - integer(i8_kind), dimension(:), intent(in) :: d_addrs - integer(i8_kind), dimension(:), intent(in) :: x_addrs - type (xmap_type), intent(inout) :: xmap - integer, intent(in) :: dsize, xsize, lsize + use, intrinsic :: iso_c_binding, only: c_ptr, c_f_pointer + type(c_ptr), intent(in) :: d_addrs(:) + type(c_ptr), intent(in) :: x_addrs(:) + type (xmap_type), intent(inout) :: xmap + integer, intent(in) :: dsize, xsize, lsize integer :: i, p, buffer_pos, msgsize integer :: from_pe, to_pe, pos, n, l, count @@ -5075,10 +5079,8 @@ subroutine put_1_to_xgrid_ug_order_1(d_addrs, x_addrs, xmap, dsize, xsize, lsize real(r8_kind) :: send_buffer(xmap%put1%sendsize*lsize) real(r8_kind) :: unpack_buffer(xmap%put1%recvsize) - real(r8_kind), dimension(dsize) :: d - real(r8_kind), dimension(xsize) :: x - pointer(ptr_d, d) - pointer(ptr_x, x) + real(r8_kind), pointer :: d(:) + real(r8_kind), pointer :: x(:) integer :: lll call mpp_clock_begin(id_put_1_to_xgrid_order_1) @@ -5099,7 +5101,7 @@ subroutine put_1_to_xgrid_ug_order_1(d_addrs, x_addrs, xmap, dsize, xsize, lsize to_pe = comm%send(p)%pe pos = buffer_pos do l = 1, lsize - ptr_d = d_addrs(l) + call c_f_pointer(d_addrs(l), d, shape=[dsize]) do n = 1, comm%send(p)%count pos = pos + 1 lll = comm%send(p)%i(n) @@ -5114,16 +5116,16 @@ subroutine put_1_to_xgrid_ug_order_1(d_addrs, x_addrs, xmap, dsize, xsize, lsize !--- unpack the buffer if( lsize == 1) then - ptr_x = x_addrs(1) + call c_f_pointer(x_addrs(1), x, shape=[xsize]) do l=1,xmap%size_put1 x(l) = recv_buffer(xmap%x1_put(l)%pos) end do else start_pos = 0 -!$OMP parallel do default(none) shared(lsize,x_addrs,comm,recv_buffer,xmap) & -!$OMP private(ptr_x,count,ibegin,istart,iend,pos,unpack_buffer) +!$OMP parallel do default(none) shared(lsize,xsize,x_addrs,comm,recv_buffer,xmap) & +!$OMP private(x,count,ibegin,istart,iend,pos,unpack_buffer) do l = 1, lsize - ptr_x = x_addrs(l) + call c_f_pointer(x_addrs(l), x, shape=[xsize]) do p = 1, comm%nrecv count = comm%recv(p)%count ibegin = comm%recv(p)%buffer_pos*lsize + 1 @@ -5167,10 +5169,11 @@ end subroutine put_2_to_xgrid_ug subroutine get_1_from_xgrid_ug(d_addrs, x_addrs, xmap, isize, xsize, lsize) - integer(i8_kind), dimension(:), intent(in) :: d_addrs - integer(i8_kind), dimension(:), intent(in) :: x_addrs - type (xmap_type), intent(inout) :: xmap - integer, intent(in) :: isize, xsize, lsize + use, intrinsic :: iso_c_binding, only: c_ptr, c_f_pointer + type(c_ptr), intent(in) :: d_addrs(:) + type(c_ptr), intent(in) :: x_addrs(:) + type (xmap_type), intent(inout) :: xmap + integer, intent(in) :: isize, xsize, lsize real(r8_kind), dimension(xmap%size), target :: dg(xmap%size, lsize) integer :: i, j, l, p, n, m @@ -5183,10 +5186,8 @@ subroutine get_1_from_xgrid_ug(d_addrs, x_addrs, xmap, isize, xsize, lsize) type(overlap_type), pointer, save :: recv => NULL() real(r8_kind) :: recv_buffer(xmap%get1%recvsize*lsize*3) real(r8_kind) :: send_buffer(xmap%get1%sendsize*lsize*3) - real(r8_kind) :: d(isize) - real(r8_kind), dimension(xsize) :: x - pointer(ptr_d, d) - pointer(ptr_x, x) + real(r8_kind), pointer :: d(:) + real(r8_kind), pointer :: x(:) call mpp_clock_begin(id_get_1_from_xgrid) @@ -5201,9 +5202,9 @@ subroutine get_1_from_xgrid_ug(d_addrs, x_addrs, xmap, isize, xsize, lsize) enddo dg = 0.0_r8_kind; -!$OMP parallel do default(none) shared(lsize,xmap,dg,x_addrs) private(dgp,ptr_x) +!$OMP parallel do default(none) shared(lsize,xsize,xmap,dg,x_addrs) private(dgp,x) do l = 1, lsize - ptr_x = x_addrs(l) + call c_f_pointer(x_addrs(l), x, shape=[xsize]) do i=1,xmap%size dgp => dg(xmap%x1(i)%pos,l) dgp = dgp + xmap%x1(i)%area*x(i) @@ -5235,7 +5236,7 @@ subroutine get_1_from_xgrid_ug(d_addrs, x_addrs, xmap, isize, xsize, lsize) !--- unpack the buffer do l = 1, lsize - ptr_d = d_addrs(l) + call c_f_pointer(d_addrs(l), d, shape=[isize]) d = 0.0_r8_kind enddo !--- To bitwise reproduce old results, first copy the data onto its own pe. @@ -5245,11 +5246,11 @@ subroutine get_1_from_xgrid_ug(d_addrs, x_addrs, xmap, isize, xsize, lsize) count = recv%count buffer_pos = recv%buffer_pos*lsize if( recv%pe == xmap%me ) then -!$OMP parallel do default(none) shared(lsize,recv,recv_buffer,buffer_pos,d_addrs,count) & -!$OMP private(ptr_d,i,pos) +!$OMP parallel do default(none) shared(lsize,isize,recv,recv_buffer,buffer_pos,d_addrs,count) & +!$OMP private(d,i,pos) do l = 1, lsize pos = buffer_pos + (l-1)*count - ptr_d = d_addrs(l) + call c_f_pointer(d_addrs(l), d, shape=[isize]) do n = 1,count i = recv%i(n) pos = pos + 1 @@ -5268,11 +5269,11 @@ subroutine get_1_from_xgrid_ug(d_addrs, x_addrs, xmap, isize, xsize, lsize) cycle endif buffer_pos = recv%buffer_pos*lsize -!$OMP parallel do default(none) shared(lsize,recv,recv_buffer,buffer_pos,d_addrs) & -!$OMP private(ptr_d,i,j,pos) +!$OMP parallel do default(none) shared(lsize,isize,recv,recv_buffer,buffer_pos,d_addrs) & +!$OMP private(d,i,j,pos) do l = 1, lsize pos = buffer_pos + (l-1)*recv%count - ptr_d = d_addrs(l) + call c_f_pointer(d_addrs(l), d, shape=[isize]) do n = 1, recv%count i = recv%i(n) pos = pos + 1 @@ -5284,9 +5285,9 @@ subroutine get_1_from_xgrid_ug(d_addrs, x_addrs, xmap, isize, xsize, lsize) ! ! normalize with side 1 grid cell areas ! -!$OMP parallel do default(none) shared(lsize,d_addrs,grid1) private(ptr_d) +!$OMP parallel do default(none) shared(lsize,isize,d_addrs,grid1) private(d) do l = 1, lsize - ptr_d = d_addrs(l) + call c_f_pointer(d_addrs(l), d, shape=[isize]) d = d * grid1%area_inv(:,1) enddo call mpp_sync_self() @@ -5297,10 +5298,11 @@ end subroutine get_1_from_xgrid_ug !####################################################################### subroutine get_1_from_xgrid_ug_repro(d_addrs, x_addrs, xmap, xsize, lsize) - integer(i8_kind), dimension(:), intent(in) :: d_addrs - integer(i8_kind), dimension(:), intent(in) :: x_addrs - type (xmap_type), intent(inout) :: xmap - integer, intent(in) :: xsize, lsize + use, intrinsic :: iso_c_binding, only: c_ptr, c_f_pointer + type(c_ptr), intent(in) :: d_addrs(:) + type(c_ptr), intent(in) :: x_addrs(:) + type (xmap_type), intent(inout) :: xmap + integer, intent(in) :: xsize, lsize integer :: g, i, j, k, p, l, n, l2, l3 integer :: msgsize, buffer_pos, pos @@ -5311,12 +5313,13 @@ subroutine get_1_from_xgrid_ug_repro(d_addrs, x_addrs, xmap, xsize, lsize) integer, dimension(0:xmap%npes-1) :: pl, ml real(r8_kind) :: recv_buffer(xmap%recv_count_repro_tot*lsize) real(r8_kind) :: send_buffer(xmap%send_count_repro_tot*lsize) - real(r8_kind) :: d(xmap%grids(1)%ls_me:xmap%grids(1)%le_me) - real(r8_kind), dimension(xsize) :: x - pointer(ptr_d, d) - pointer(ptr_x, x) + real(r8_kind), pointer :: d(:) + real(r8_kind), pointer :: x(:) + real(r8_kind), pointer, contiguous :: tmpptr(:) + integer :: shape_d(1) call mpp_clock_begin(id_get_1_from_xgrid_repro) + shape_d = [xmap%grids(1)%le_me-xmap%grids(1)%ls_me+1] comm => xmap%get1_repro !--- pre-post receiving do p = 1, comm%nrecv @@ -5331,13 +5334,13 @@ subroutine get_1_from_xgrid_ug_repro(d_addrs, x_addrs, xmap, xsize, lsize) !pack the data send_buffer(:) = 0.0_r8_kind -!$OMP parallel do default(none) shared(lsize,x_addrs,comm,xmap,send_buffer) & -!$OMP private(ptr_x,i,j,g,l2,pos,send) +!$OMP parallel do default(none) shared(lsize,xsize,x_addrs,comm,xmap,send_buffer) & +!$OMP private(x,i,j,g,l2,pos,send) do p = 1, comm%nsend pos = comm%send(p)%buffer_pos*lsize send => comm%send(p) do l = 1,lsize - ptr_x = x_addrs(l) + call c_f_pointer(x_addrs(l), x, shape=[xsize]) do n = 1, send%count i = send%i(n) j = send%j(n) @@ -5361,16 +5364,18 @@ subroutine get_1_from_xgrid_ug_repro(d_addrs, x_addrs, xmap, xsize, lsize) enddo do l = 1, lsize - ptr_d = d_addrs(l) + call c_f_pointer(d_addrs(l), tmpptr, shape=shape_d) + d(xmap%grids(1)%ls_me:xmap%grids(1)%le_me) => tmpptr d = 0 enddo call mpp_sync_self(check=EVENT_RECV) -!$OMP parallel do default(none) shared(lsize,d_addrs,xmap,recv_buffer,pl,ml) & -!$OMP private(ptr_d,grid,i,j,p,pos) +!$OMP parallel do default(none) shared(lsize,shape_d,d_addrs,xmap,recv_buffer,pl,ml) & +!$OMP private(d,tmpptr,grid,i,j,p,pos) do l = 1, lsize - ptr_d = d_addrs(l) + call c_f_pointer(d_addrs(l), tmpptr, shape=shape_d) + d(xmap%grids(1)%ls_me:xmap%grids(1)%le_me) => tmpptr do g=2,size(xmap%grids(:)) grid => xmap%grids(g) do l3=1,grid%size_repro ! index into side1 grid's patterns diff --git a/field_manager/Makefile.am b/field_manager/Makefile.am index 7d845e59a5..d24486e557 100644 --- a/field_manager/Makefile.am +++ b/field_manager/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the field_manager directory of the FMS @@ -34,7 +33,7 @@ libfield_manager_la_SOURCES = \ field_manager.F90 \ fm_yaml.F90 \ fm_util.F90 \ - parse.inc \ + include/parse.inc \ include/field_manager.inc \ include/field_manager_r4.fh \ include/field_manager_r8.fh \ @@ -42,7 +41,7 @@ libfield_manager_la_SOURCES = \ include/fm_util_r4.fh \ include/fm_util_r8.fh -field_manager_mod.$(FC_MODEXT): parse.inc fm_yaml_mod.$(FC_MODEXT) \ +field_manager_mod.$(FC_MODEXT): include/parse.inc fm_yaml_mod.$(FC_MODEXT) \ include/field_manager.inc include/field_manager_r4.fh include/field_manager_r8.fh fm_util_mod.$(FC_MODEXT): field_manager_mod.$(FC_MODEXT) \ include/fm_util.inc include/fm_util_r4.fh include/fm_util_r8.fh diff --git a/field_manager/field_manager.F90 b/field_manager/field_manager.F90 index e95496f132..09e57b5a28 100644 --- a/field_manager/field_manager.F90 +++ b/field_manager/field_manager.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup field_manager_mod field_manager_mod !> @ingroup field_manager @@ -246,10 +245,6 @@ module field_manager_mod !> The length of a character string representing the field name. integer, parameter, public :: fm_field_name_len = 48 -!! TODO this should be removed in favor of the global FMS_PATH_LEN -!! when possible, currently used in ocean_BGC and land_lad2 -!> The length of a character string representing the field path. -integer, parameter, public :: fm_path_name_len = FMS_PATH_LEN !> The length of a character string representing character values for the field. integer, parameter, public :: fm_string_len = 1024 !> The length of a character string representing the various types that the values of the field can take. @@ -562,12 +557,20 @@ subroutine field_manager_init(nfields, table_name) call mpp_error(FATAL, "You cannot have the legacy field_table if use_field_table_yaml=.true.") call mpp_error(NOTE, "field_manager_init:: You are using the yaml version of the field_table") + call mpp_error(NOTE, & + &"field_manager_init:: You are using the yaml version of the field_table. & +The legacy field_table format will be deprecated in a future release, & +please switch to the yaml format.") call read_field_table_yaml(nfields, table_name) #endif else if (file_exists("field_table.yaml")) & call mpp_error(FATAL, "You cannot have the yaml field_table if use_field_table_yaml=.false.") call mpp_error(NOTE, "field_manager_init:: You are using the legacy version of the field_table") + call mpp_error(NOTE, & + &"field_manager_init:: You are using the yaml version of the field_table. & +The legacy field_table format will be deprecated in a future release, & +please switch to the yaml format.") call read_field_table_legacy(nfields, table_name) endif diff --git a/field_manager/fm_util.F90 b/field_manager/fm_util.F90 index 1105257ab8..f9f381e31a 100644 --- a/field_manager/fm_util.F90 +++ b/field_manager/fm_util.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup fm_util_mod fm_util_mod !> @ingroup field_manager diff --git a/field_manager/fm_yaml.F90 b/field_manager/fm_yaml.F90 index 3dabc2d093..1636cb92ee 100644 --- a/field_manager/fm_yaml.F90 +++ b/field_manager/fm_yaml.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup fm_yaml_mod fm_yaml_mod diff --git a/field_manager/include/field_manager.inc b/field_manager/include/field_manager.inc index c462152c7f..e1d83cd4da 100644 --- a/field_manager/include/field_manager.inc +++ b/field_manager/include/field_manager.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @returns The number of values that have been decoded. This allows !! a user to define a large array and fill it partially with diff --git a/field_manager/include/field_manager_r4.fh b/field_manager/include/field_manager_r4.fh index 5ea7435743..f8b4c6ffae 100644 --- a/field_manager/include/field_manager_r4.fh +++ b/field_manager/include/field_manager_r4.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup field_manager_mod !> @{ diff --git a/field_manager/include/field_manager_r8.fh b/field_manager/include/field_manager_r8.fh index d29138ebf6..40827d6470 100644 --- a/field_manager/include/field_manager_r8.fh +++ b/field_manager/include/field_manager_r8.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup field_manager_mod !> @{ diff --git a/field_manager/include/fm_util.inc b/field_manager/include/fm_util.inc index 6102532e96..5604bd4e97 100644 --- a/field_manager/include/fm_util.inc +++ b/field_manager/include/fm_util.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup fm_util_mod fm_util_mod !> @ingroup field_manager diff --git a/field_manager/include/fm_util_r4.fh b/field_manager/include/fm_util_r4.fh index d3215f1f2f..87e677c56e 100644 --- a/field_manager/include/fm_util_r4.fh +++ b/field_manager/include/fm_util_r4.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup fm_util_mod fm_util_mod !> @ingroup field_manager diff --git a/field_manager/include/fm_util_r8.fh b/field_manager/include/fm_util_r8.fh index 8d72fa512c..421dcba1b1 100644 --- a/field_manager/include/fm_util_r8.fh +++ b/field_manager/include/fm_util_r8.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup fm_util_mod fm_util_mod !> @ingroup field_manager diff --git a/field_manager/parse.inc b/field_manager/include/parse.inc similarity index 74% rename from field_manager/parse.inc rename to field_manager/include/parse.inc index edd40c849a..4e3ccb9cc2 100644 --- a/field_manager/parse.inc +++ b/field_manager/include/parse.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** diff --git a/fms/Makefile.am b/fms/Makefile.am index 7a8190f8be..575f6edbf8 100644 --- a/fms/Makefile.am +++ b/fms/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the fms directory of the FMS diff --git a/fms/fms.F90 b/fms/fms.F90 index 0947bfee1c..89188be2c7 100644 --- a/fms/fms.F90 +++ b/fms/fms.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup fms_mod fms_mod !> @ingroup fms diff --git a/fms/fms_stacksize.c b/fms/fms_stacksize.c index 7631656475..ebe84a7ae4 100644 --- a/fms/fms_stacksize.c +++ b/fms/fms_stacksize.c @@ -1,21 +1,20 @@ /*********************************************************************** - * GNU Lesser General Public License + * Apache License 2.0 * * This file is part of the GFDL Flexible Modeling System (FMS). * - * FMS is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or (at - * your option) any later version. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * FMS is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Lesser General Public - * License along with FMS. If not, see . - **********************************************************************/ + * FMS is distributed in the hope that it will be useful, but WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the License for the specific language + * governing permissions and limitations under the License. + ***********************************************************************/ #include diff --git a/fms/include/fms.inc b/fms/include/fms.inc index 960a529ced..46882b39c8 100644 --- a/fms/include/fms.inc +++ b/fms/include/fms.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief Determines if a real input array has values which increase or diff --git a/fms2_io/Makefile.am b/fms2_io/Makefile.am index 3938fa4e71..685c364668 100644 --- a/fms2_io/Makefile.am +++ b/fms2_io/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the fms2_io directory of the FMS package. diff --git a/fms2_io/blackboxio.F90 b/fms2_io/blackboxio.F90 index f7d26eb3d2..8c6b9bc39c 100644 --- a/fms2_io/blackboxio.F90 +++ b/fms2_io/blackboxio.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup blackboxio blackboxio !> @ingroup fms2_io diff --git a/fms2_io/fms2_io.F90 b/fms2_io/fms2_io.F90 index 00f6046a67..cbbcbafea4 100644 --- a/fms2_io/fms2_io.F90 +++ b/fms2_io/fms2_io.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup fms2_io_mod fms2_io_mod !> @ingroup fms2_io diff --git a/fms2_io/fms_io_utils.F90 b/fms2_io/fms_io_utils.F90 index 0e46dd9ea1..83a05be992 100644 --- a/fms2_io/fms_io_utils.F90 +++ b/fms2_io/fms_io_utils.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup fms_io_utils_mod fms_io_utils_mod !> @ingroup fms2_io diff --git a/fms2_io/fms_netcdf_domain_io.F90 b/fms2_io/fms_netcdf_domain_io.F90 index 008e010f26..3e49752810 100644 --- a/fms2_io/fms_netcdf_domain_io.F90 +++ b/fms2_io/fms_netcdf_domain_io.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup fms_netcdf_domain_io_mod fms_netcdf_domain_io_mod !> @ingroup fms2_io @@ -319,11 +318,10 @@ function is_dimension_registered(fileobj, dimension_name) & end function is_dimension_registered - !> @brief Open a domain netcdf file. !! @return Flag telling if the open completed successfully. -function open_domain_file(fileobj, path, mode, domain, nc_format, is_restart, dont_add_res_to_filename) & - result(success) +function open_domain_file(fileobj, path, mode, domain, nc_format, is_restart, dont_add_res_to_filename, & + use_netcdf_mpi, use_collective) result(success) type(FmsNetcdfDomainFile_t),intent(inout) :: fileobj !< File object. character(len=*), intent(in) :: path !< File path. @@ -340,8 +338,12 @@ function open_domain_file(fileobj, path, mode, domain, nc_format, is_restart, do logical, intent(in), optional :: is_restart !< Flag telling if this file !! is a restart file. Defaults !! to false. - logical, intent(in), optional :: dont_add_res_to_filename !< Flag indicating not to add - !! ".res" to the filename + logical, intent(in), optional :: dont_add_res_to_filename !< Flag indicating not to add ".res" to the filename + logical, intent(in), optional :: use_netcdf_mpi !< Flag telling if this file should be using netcdf4 parallel + !! reads and writes. Defaults to false. + !! nc_format is automatically set to netcdf4 + logical, intent(in), optional :: use_collective !< Flag indicating whether reads and writes should be performed + !! collectively rather than independently. logical :: success integer, dimension(2) :: io_layout @@ -354,6 +356,42 @@ function open_domain_file(fileobj, path, mode, domain, nc_format, is_restart, do logical :: success2 type(FmsNetcdfDomainFile_t) :: fileobj2 + io_domain => mpp_get_io_domain(domain) + + if (present(use_netcdf_mpi)) then + if (use_netcdf_mpi) then + if (associated(io_domain)) then + call mpp_error(NOTE, "NetCDF MPI is enabled: ignoring I/O domain. Only one output file will be produced.") + endif + + fileobj%domain = domain + + allocate(fileobj%xdims(max_num_domain_decomposed_dims)) + fileobj%nx = 0 + allocate(fileobj%ydims(max_num_domain_decomposed_dims)) + fileobj%ny = 0 + + call string_copy(fileobj%non_mangled_path, path) + + !! If the number of tiles is greater than 1 or if the current tile is greater + !than 1 add .tileX. to the filename + tile_id = mpp_get_tile_id(domain) + if (mpp_get_ntile_count(domain) .gt. 1 .or. tile_id(1) > 1) then + call domain_tile_filepath_mangle(combined_filepath, path, tile_id(1)) + else + call string_copy(combined_filepath, path) + endif + + success = netcdf_file_open(fileobj, combined_filepath, mode, & + nc_format="netcdf4", & + is_restart=is_restart, & + dont_add_res_to_filename=dont_add_res_to_filename, & + tile_comm=mpp_get_domain_tile_commid(domain), & + use_collective=use_collective) + return + endif + endif + !Get the path of a "combined" file. io_layout = mpp_get_io_domain_layout(domain) tile_id = mpp_get_tile_id(domain) @@ -367,7 +405,6 @@ function open_domain_file(fileobj, path, mode, domain, nc_format, is_restart, do endif !Get the path of a "distributed" file. - io_domain => mpp_get_io_domain(domain) if (.not. associated(io_domain)) then call error("The domain associated with the file:"//trim(path)//" does not have an io_domain.") endif @@ -441,7 +478,7 @@ end subroutine close_domain_file !> @brief Add a dimension to a file associated with a two-dimensional domain. subroutine register_domain_decomposed_dimension(fileobj, dim_name, xory, domain_position) - type(FmsNetcdfDomainFile_t), intent(inout) :: fileobj !< File object. + type(FmsNetcdfDomainFile_t), target, intent(inout) :: fileobj !< File object. character(len=*), intent(in) :: dim_name !< Dimension name. character(len=*), intent(in) :: xory !< Flag telling if the dimension !! is associated with the "x" or "y" @@ -458,7 +495,15 @@ subroutine register_domain_decomposed_dimension(fileobj, dim_name, xory, domain_ if (mpp_domain_is_symmetry(fileobj%domain) .and. present(domain_position)) then dpos = domain_position endif - io_domain => mpp_get_io_domain(fileobj%domain) + + ! If using NetCDF MPI, the IO domain is ignored, so use the domain to determine the correct size of each + ! domain-decomposed dimension. + if (fileobj%use_netcdf_mpi) then + io_domain => fileobj%domain + else + io_domain => mpp_get_io_domain(fileobj%domain) + endif + if (string_compare(xory, x, .true.)) then if (dpos .ne. center .and. dpos .ne. east) then call error("Only domain_position=center or domain_position=EAST is supported for x dimensions."// & @@ -509,9 +554,10 @@ subroutine add_domain_attribute(fileobj, variable_name) integer, dimension(2) :: io_layout !< Io_layout in the fileobj's domain !< Don't add the "domain_decomposition" variable attribute if the io_layout is - !! 1,1, to avoid frecheck "failures" + !! 1,1, or if using mpi netcdf for writes, to avoid frecheck "failures" io_layout = mpp_get_io_domain_layout(fileobj%domain) if (io_layout(1) .eq. 1 .and. io_layout(2) .eq. 1) return + if (fileobj%use_netcdf_mpi) return io_domain => mpp_get_io_domain(fileobj%domain) dpos = get_domain_decomposed_index(variable_name, fileobj%xdims, fileobj%nx) diff --git a/fms2_io/fms_netcdf_unstructured_domain_io.F90 b/fms2_io/fms_netcdf_unstructured_domain_io.F90 index cb98dd62eb..4f53257952 100644 --- a/fms2_io/fms_netcdf_unstructured_domain_io.F90 +++ b/fms2_io/fms_netcdf_unstructured_domain_io.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup fms_netcdf_unstructured_domain_io_mod fms_netcdf_unstructured_domain_io_mod !> @ingroup fms2_io diff --git a/fms2_io/include/array_utils.inc b/fms2_io/include/array_utils.inc index 6d67e62b03..d258131f02 100644 --- a/fms2_io/include/array_utils.inc +++ b/fms2_io/include/array_utils.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief Array allocation routines for multiple types for @ref allocate_array interface diff --git a/fms2_io/include/array_utils_char.inc b/fms2_io/include/array_utils_char.inc index 528aa5520b..a5f09665dc 100644 --- a/fms2_io/include/array_utils_char.inc +++ b/fms2_io/include/array_utils_char.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief Character array routines used in @ref fms_io_utils_mod diff --git a/fms2_io/include/compressed_read.inc b/fms2_io/include/compressed_read.inc index 9f0de7c794..154c4f4804 100644 --- a/fms2_io/include/compressed_read.inc +++ b/fms2_io/include/compressed_read.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief Compressed read routines for @ref read_data interface diff --git a/fms2_io/include/compressed_write.inc b/fms2_io/include/compressed_write.inc index 17986b6b28..4f1ab51a7d 100644 --- a/fms2_io/include/compressed_write.inc +++ b/fms2_io/include/compressed_write.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief Compressed write routines for @ref write_data interface diff --git a/fms2_io/include/compute_global_checksum.inc b/fms2_io/include/compute_global_checksum.inc index 7a0df67671..3e6558f493 100644 --- a/fms2_io/include/compute_global_checksum.inc +++ b/fms2_io/include/compute_global_checksum.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief Routines for calculating variable checksums across pes for the @ref compute_global_checksum interface diff --git a/fms2_io/include/domain_read.inc b/fms2_io/include/domain_read.inc index 3afdbded3f..fa404270f4 100644 --- a/fms2_io/include/domain_read.inc +++ b/fms2_io/include/domain_read.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief Reads domain decomposed variables and scatters data to pe's for the @ref read_data interface @@ -141,6 +140,30 @@ subroutine domain_read_2d(fileobj, variable_name, vdata, unlim_dim_level, & return endif + call domain_offsets(size(vdata, xdim_index), size(vdata, ydim_index), fileobj%domain, & + xpos, ypos, isd, isc, xc_size, jsd, jsc, yc_size, buffer_includes_halos, & + msg="file:"//trim(fileobj%path)//" and variable:"//trim(variable_name)) + + if (fileobj%use_netcdf_mpi) then + c = 1 + e = shape(vdata) + + if (buffer_includes_halos) then + c(xdim_index) = isd + c(ydim_index) = jsd + e(xdim_index) = xc_size + 2*(isc - isd) + e(ydim_index) = yc_size + 2*(jsc - jsd) + else + c(xdim_index) = isc + c(ydim_index) = jsc + e(xdim_index) = xc_size + e(ydim_index) = yc_size + endif + + call netcdf_read_data(fileobj, variable_name, vdata, unlim_dim_level=unlim_dim_level, corner=c, edge_lengths=e) + return + endif + if (xdim_index .ne. 1 .or. ydim_index .ne. 2) then ! This is a KLUDGE ! mpp_scatter assumes that the variable is (x,y), if that is not the case it remaps the data @@ -150,9 +173,6 @@ subroutine domain_read_2d(fileobj, variable_name, vdata, unlim_dim_level, & return endif io_domain => mpp_get_io_domain(fileobj%domain) - call domain_offsets(size(vdata, xdim_index), size(vdata, ydim_index), fileobj%domain, & - xpos, ypos, isd, isc, xc_size, jsd, jsc, yc_size, buffer_includes_halos, & - msg="file:"//trim(fileobj%path)//" and variable:"//trim(variable_name)) c(:) = 1 e(:) = shape(vdata) @@ -321,6 +341,30 @@ subroutine domain_read_3d(fileobj, variable_name, vdata, unlim_dim_level, & return endif + call domain_offsets(size(vdata, xdim_index), size(vdata, ydim_index), fileobj%domain, & + xpos, ypos, isd, isc, xc_size, jsd, jsc, yc_size, buffer_includes_halos, & + msg="file:"//trim(fileobj%path)//" and variable:"//trim(variable_name)) + + if (fileobj%use_netcdf_mpi) then + c = 1 + e = shape(vdata) + + if (buffer_includes_halos) then + c(xdim_index) = isd + c(ydim_index) = jsd + e(xdim_index) = xc_size + 2*(isc - isd) + e(ydim_index) = yc_size + 2*(jsc - jsd) + else + c(xdim_index) = isc + c(ydim_index) = jsc + e(xdim_index) = xc_size + e(ydim_index) = yc_size + endif + + call netcdf_read_data(fileobj, variable_name, vdata, unlim_dim_level=unlim_dim_level, corner=c, edge_lengths=e) + return + endif + if (xdim_index .ne. 1 .or. ydim_index .ne. 2) then ! This is a KLUDGE ! mpp_scatter assumes that the variable is (x,y), if that is not the case it remaps the data @@ -330,9 +374,6 @@ subroutine domain_read_3d(fileobj, variable_name, vdata, unlim_dim_level, & return endif io_domain => mpp_get_io_domain(fileobj%domain) - call domain_offsets(size(vdata, xdim_index), size(vdata, ydim_index), fileobj%domain, & - xpos, ypos, isd, isc, xc_size, jsd, jsc, yc_size, buffer_includes_halos, & - msg="file:"//trim(fileobj%path)//" and variable:"//trim(variable_name)) c(:) = 1 if (present(corner)) c = corner @@ -500,10 +541,32 @@ subroutine domain_read_4d(fileobj, variable_name, vdata, unlim_dim_level, & edge_lengths=edge_lengths, broadcast=.true.) return endif - io_domain => mpp_get_io_domain(fileobj%domain) + call domain_offsets(size(vdata, xdim_index), size(vdata, ydim_index), fileobj%domain, & xpos, ypos, isd, isc, xc_size, jsd, jsc, yc_size, buffer_includes_halos, & msg="file:"//trim(fileobj%path)//" and variable:"//trim(variable_name)) + + if (fileobj%use_netcdf_mpi) then + c = 1 + e = shape(vdata) + + if (buffer_includes_halos) then + c(xdim_index) = isd + c(ydim_index) = jsd + e(xdim_index) = xc_size + 2*(isc - isd) + e(ydim_index) = yc_size + 2*(jsc - jsd) + else + c(xdim_index) = isc + c(ydim_index) = jsc + e(xdim_index) = xc_size + e(ydim_index) = yc_size + endif + + call netcdf_read_data(fileobj, variable_name, vdata, unlim_dim_level=unlim_dim_level, corner=c, edge_lengths=e) + return + endif + + io_domain => mpp_get_io_domain(fileobj%domain) c(:) = 1 e(:) = shape(vdata) if (present(edge_lengths)) e = edge_lengths @@ -716,10 +779,32 @@ subroutine domain_read_5d(fileobj, variable_name, vdata, unlim_dim_level, & edge_lengths=edge_lengths, broadcast=.true.) return endif - io_domain => mpp_get_io_domain(fileobj%domain) + call domain_offsets(size(vdata, xdim_index), size(vdata, ydim_index), fileobj%domain, & xpos, ypos, isd, isc, xc_size, jsd, jsc, yc_size, buffer_includes_halos, & msg="file:"//trim(fileobj%path)//" and variable:"//trim(variable_name)) + + if (fileobj%use_netcdf_mpi) then + c = 1 + e = shape(vdata) + + if (buffer_includes_halos) then + c(xdim_index) = isd + c(ydim_index) = jsd + e(xdim_index) = xc_size + 2*(isc - isd) + e(ydim_index) = yc_size + 2*(jsc - jsd) + else + c(xdim_index) = isc + c(ydim_index) = jsc + e(xdim_index) = xc_size + e(ydim_index) = yc_size + endif + + call netcdf_read_data(fileobj, variable_name, vdata, unlim_dim_level=unlim_dim_level, corner=c, edge_lengths=e) + return + endif + + io_domain => mpp_get_io_domain(fileobj%domain) c(:) = 1 e(:) = shape(vdata) if (present(edge_lengths)) e = edge_lengths diff --git a/fms2_io/include/domain_write.inc b/fms2_io/include/domain_write.inc index 5ce4e5b6f0..3d9f52c1bf 100644 --- a/fms2_io/include/domain_write.inc +++ b/fms2_io/include/domain_write.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief Routines for writing domain decomposed variables for the @ref write_data interface @@ -79,15 +78,15 @@ end subroutine domain_write_1d !> @brief Gather "compute" domain data on the I/O root rank and then have !! the I/O root write out the data that spans the "global" domain. !! This routine may only be used with variables that are "domain -!! decomposed". +!! decomposed" using mpp_gather. subroutine domain_write_2d(fileobj, variable_name, vdata, unlim_dim_level, & corner, edge_lengths) type(FmsNetcdfDomainFile_t), intent(in) :: fileobj !< File object. character(len=*), intent(in) :: variable_name !< Variable name. - class(*), dimension(:,:), intent(in) :: vdata !< Data that will - !! be written out - !! to the netcdf file. + class(*), contiguous, dimension(:,:), target, intent(in) :: vdata !< Data that will + !! be written out + !! to the netcdf file. integer, intent(in), optional :: unlim_dim_level !< Level for the unlimited !! dimension. integer, dimension(2), intent(in), optional :: corner !< Array of starting @@ -99,29 +98,16 @@ subroutine domain_write_2d(fileobj, variable_name, vdata, unlim_dim_level, & !! will be written !! in each dimension. - integer(kind=i4_kind), dimension(:,:), allocatable :: buf_i4_kind - integer(kind=i8_kind), dimension(:,:), allocatable :: buf_i8_kind - real(kind=r4_kind), dimension(:,:), allocatable :: buf_r4_kind - real(kind=r8_kind), dimension(:,:), allocatable :: buf_r8_kind - logical :: buffer_includes_halos - integer, dimension(2) :: c - integer, dimension(2) :: e integer(kind=i4_kind), dimension(:,:), allocatable :: global_buf_i4_kind integer(kind=i8_kind), dimension(:,:), allocatable :: global_buf_i8_kind real(kind=r4_kind), dimension(:,:), allocatable :: global_buf_r4_kind real(kind=r8_kind), dimension(:,:), allocatable :: global_buf_r8_kind - integer :: i + logical :: buffer_includes_halos type(domain2d), pointer :: io_domain integer :: isc integer :: isd integer :: jsc integer :: jsd - integer, dimension(:), allocatable :: pe_icsize - integer, dimension(:), allocatable :: pe_iec - integer, dimension(:), allocatable :: pe_isc - integer, dimension(:), allocatable :: pe_jcsize - integer, dimension(:), allocatable :: pe_jec - integer, dimension(:), allocatable :: pe_jsc integer :: xc_size integer :: xdim_index integer :: xpos @@ -132,11 +118,19 @@ subroutine domain_write_2d(fileobj, variable_name, vdata, unlim_dim_level, & integer(kind=i8_kind) :: fill_i8_kind !< Fill value of a i8_kind variable real(kind=r4_kind) :: fill_r4_kind !< Fill value of a r4_kind variable real(kind=r8_kind) :: fill_r8_kind !< Fill value of a r8_kind variable - integer :: xgmax !< Ending x index of the global io domain + class(*), dimension(:,:,:,:), pointer :: vdata_dummy !< Vdata remapped as 4D integer :: xgmin !< Starting x index of the global io domain - integer :: ygmax !< Ending y index of the global io domain integer :: ygmin !< Ending y index of the global io domain + integer :: xgsize, ygsize + integer :: istart, jstart, iend, jend + integer :: ioff, joff + if (fileobj%use_netcdf_mpi) then + call netcdf_mpi_write_2d(fileobj, variable_name, vdata, unlim_dim_level, corner, edge_lengths) + return + endif + + ! If the file is not domain decomposed, do not do anything in this routine if (.not. is_variable_domain_decomposed(fileobj, variable_name, .true., & xdim_index, ydim_index, xpos, ypos)) then call compressed_write(fileobj, variable_name, vdata, & @@ -144,527 +138,301 @@ subroutine domain_write_2d(fileobj, variable_name, vdata, unlim_dim_level, & edge_lengths=edge_lengths) return endif + + if (xdim_index .ne. 1 .or. ydim_index .ne. 2) then + ! This is a KLUDGE + ! mpp_scatter assumes that the variable is (x,y), if that is not the case it remaps the data + ! to a 4D array and calls domain_read_4d which does not use mpp_scatter yet + vdata_dummy(1:size(vdata,1),1:size(vdata,2), 1:1, 1:1) => vdata(:,:) + call domain_write_4d(fileobj, variable_name, vdata_dummy, unlim_dim_level) + return + endif + + ! Get the io domain from the fileobj io_domain => mpp_get_io_domain(fileobj%domain) - call domain_offsets(size(vdata, xdim_index), size(vdata, ydim_index), fileobj%domain, & - xpos, ypos, isd, isc, xc_size, jsd, jsc, yc_size, & - buffer_includes_halos, msg="file:"//trim(fileobj%path)//" and variable:"//trim(variable_name)) - c(:) = 1 - e(:) = shape(vdata) - !I/O root gathers the data and writes it. - if (fileobj%is_root) then - allocate(pe_isc(size(fileobj%pelist))) - allocate(pe_iec(size(fileobj%pelist))) - allocate(pe_icsize(size(fileobj%pelist))) - call mpp_get_compute_domains(io_domain, xbegin=pe_isc, xend=pe_iec, xsize=pe_icsize, & - position=xpos) - allocate(pe_jsc(size(fileobj%pelist))) - allocate(pe_jec(size(fileobj%pelist))) - allocate(pe_jcsize(size(fileobj%pelist))) - call mpp_get_compute_domains(io_domain, ybegin=pe_jsc, yend=pe_jec, ysize=pe_jcsize, & - position=ypos) + ! Get some info about the domain: + call domain_offsets(size(vdata, xdim_index), size(vdata, ydim_index), fileobj%domain, & + xpos, ypos, isd, isc, xc_size, jsd, jsc, yc_size, buffer_includes_halos, & + msg="file:"//trim(fileobj%path)//" and variable:"//trim(variable_name)) - !< Determine the size of the global io domain - call mpp_get_global_domain(io_domain, ybegin=ygmin, yend=ygmax, position=ypos) - call mpp_get_global_domain(io_domain, xbegin=xgmin, xend=xgmax, position=xpos) + ! Get the global io domain: + call mpp_get_global_domain(io_domain, xbegin=xgmin, xsize=xgsize, position=xpos) + call mpp_get_global_domain(io_domain, ybegin=ygmin, ysize=ygsize, position=ypos) - !Write the out the data. - !< Set e to equal the size of the global io domain - e(xdim_index) = xgmax - xgmin + 1 - e(ydim_index) = ygmax - ygmin + 1 + ! Root pe allocates room to gather the data and computes offsets for data placement + if (fileobj%is_root) then + ! Offsets used to place data in recv buffer + ioff = 1-xgmin + joff = 1-ygmin - !< Allocate a global buffer, get the fill value if it exists in the file, and initialize - !! the buffer to the fill value - select type(vdata) + ! Allocate recv buffer for gather + select type(vdata) type is (integer(kind=i4_kind)) - call allocate_array(global_buf_i4_kind, e) + allocate(global_buf_i4_kind(xgsize, ygsize)) global_buf_i4_kind = 0 if (get_fill_value(fileobj, variable_name, fill_i4_kind, broadcast=.false.)) then global_buf_i4_kind = fill_i4_kind endif type is (integer(kind=i8_kind)) - call allocate_array(global_buf_i8_kind, e) + allocate(global_buf_i8_kind(xgsize, ygsize)) global_buf_i8_kind = 0 if (get_fill_value(fileobj, variable_name, fill_i8_kind, broadcast=.false.)) then global_buf_i8_kind = fill_i8_kind endif type is (real(kind=r4_kind)) - call allocate_array(global_buf_r4_kind, e) + allocate(global_buf_r4_kind(xgsize, ygsize)) global_buf_r4_kind = 0. if (get_fill_value(fileobj, variable_name, fill_r4_kind, broadcast=.false.)) then global_buf_r4_kind = fill_r4_kind endif type is (real(kind=r8_kind)) - call allocate_array(global_buf_r8_kind, e) + allocate(global_buf_r8_kind(xgsize, ygsize)) global_buf_r8_kind = 0. if (get_fill_value(fileobj, variable_name, fill_r8_kind, broadcast=.false.)) then global_buf_r8_kind = fill_r8_kind endif class default - call error("unsupported variable type: domain_write_2d: file: "//trim(fileobj%path)//" variable:"// & - & trim(variable_name)) - end select + call error("unsupported variable type: domain_write_2d_mpp_gather: file: " & + & //trim(fileobj%path)//" variable:"//trim(variable_name)) + end select + endif - do i = 1, size(fileobj%pelist) - !< Set c relative to the starting global io domain index - c(xdim_index) = pe_isc(i) - xgmin + 1 - c(ydim_index) = pe_jsc(i) - ygmin + 1 - e(xdim_index) = pe_icsize(i) - e(ydim_index) = pe_jcsize(i) - select type(vdata) - type is (integer(kind=i4_kind)) - call allocate_array(buf_i4_kind, e) - !Get the data for fileobj%pelist(i)'s portion of the compute domain. - if (i .eq. 1) then - !Root rank gets the data directly. - if (buffer_includes_halos) then - !Adjust if the input buffer has room for halos. - c(xdim_index) = isc - isd + 1 - c(ydim_index) = jsc - jsd + 1 - else - c(xdim_index) = 1 - c(ydim_index) = 1 - endif - call get_array_section(buf_i4_kind, vdata, c, e) - c(xdim_index) = pe_isc(i) - xgmin + 1 - c(ydim_index) = pe_jsc(i) - ygmin + 1 - else - !Receive data from non-root ranks. - call mpp_recv(buf_i4_kind, size(buf_i4_kind), fileobj%pelist(i), block=.true.) - endif - !Put local data into the global buffer. - call put_array_section(buf_i4_kind, global_buf_i4_kind, c, e) - deallocate(buf_i4_kind) - type is (integer(kind=i8_kind)) - call allocate_array(buf_i8_kind, e) - !Get the data for fileobj%pelist(i)'s portion of the compute domain. - if (i .eq. 1) then - !Root rank gets the data directly. - if (buffer_includes_halos) then - !Adjust if the input buffer has room for halos. - c(xdim_index) = isc - isd + 1 - c(ydim_index) = jsc - jsd + 1 - else - c(xdim_index) = 1 - c(ydim_index) = 1 - endif - call get_array_section(buf_i8_kind, vdata, c, e) - c(xdim_index) = pe_isc(i) - xgmin + 1 - c(ydim_index) = pe_jsc(i) - ygmin + 1 - else - !Receive data from non-root ranks. - call mpp_recv(buf_i8_kind, size(buf_i8_kind), fileobj%pelist(i), block=.true.) - endif - !Put local data into the global buffer. - call put_array_section(buf_i8_kind, global_buf_i8_kind, c, e) - deallocate(buf_i8_kind) - type is (real(kind=r4_kind)) - call allocate_array(buf_r4_kind, e) - !Get the data for fileobj%pelist(i)'s portion of the compute domain. - if (i .eq. 1) then - !Root rank gets the data directly. - if (buffer_includes_halos) then - !Adjust if the input buffer has room for halos. - c(xdim_index) = isc - isd + 1 - c(ydim_index) = jsc - jsd + 1 - else - c(xdim_index) = 1 - c(ydim_index) = 1 - endif - call get_array_section(buf_r4_kind, vdata, c, e) - c(xdim_index) = pe_isc(i) - xgmin + 1 - c(ydim_index) = pe_jsc(i) - ygmin + 1 - else - !Receive data from non-root ranks. - call mpp_recv(buf_r4_kind, size(buf_r4_kind), fileobj%pelist(i), block=.true.) - endif - !Put local data into the global buffer. - call put_array_section(buf_r4_kind, global_buf_r4_kind, c, e) - deallocate(buf_r4_kind) - type is (real(kind=r8_kind)) - call allocate_array(buf_r8_kind, e) - !Get the data for fileobj%pelist(i)'s portion of the compute domain. - if (i .eq. 1) then - !Root rank gets the data directly. - if (buffer_includes_halos) then - !Adjust if the input buffer has room for halos. - c(xdim_index) = isc - isd + 1 - c(ydim_index) = jsc - jsd + 1 - else - c(xdim_index) = 1 - c(ydim_index) = 1 - endif - call get_array_section(buf_r8_kind, vdata, c, e) - c(xdim_index) = pe_isc(i) - xgmin + 1 - c(ydim_index) = pe_jsc(i) - ygmin + 1 - else - !Receive data from non-root ranks. - call mpp_recv(buf_r8_kind, size(buf_r8_kind), fileobj%pelist(i), block=.true.) - endif - !Put local data into the global buffer. - call put_array_section(buf_r8_kind, global_buf_r8_kind, c, e) - deallocate(buf_r8_kind) - end select - enddo - deallocate(pe_isc) - deallocate(pe_iec) - deallocate(pe_icsize) - deallocate(pe_jsc) - deallocate(pe_jec) - deallocate(pe_jcsize) + ! Get the starting and indices of the compute domain relative to vdata (note that vdata start indices at 1 #Fortran) + istart = 1 + jstart = 1 - !Write the out the data. + ! If the buffer contains halos, get the portion of vdata with only the compute domain + if (buffer_includes_halos) then + istart = isc - isd + 1 + jstart = jsc - jsd + 1 + endif + + iend = istart + xc_size - 1 + jend = jstart + yc_size - 1 + + ! Gather the data + select type(vdata) + type is (integer(kind=i4_kind)) + call mpp_gather(isc, isc+xc_size-1, jsc, jsc+yc_size-1, fileobj%pelist, vdata(istart:iend, jstart:jend), & + & global_buf_i4_kind, fileobj%is_root, ishift=ioff, jshift=joff) + type is (integer(kind=i8_kind)) + call mpp_gather(isc, isc+xc_size-1, jsc, jsc+yc_size-1, fileobj%pelist, vdata(istart:iend, jstart:jend), & + & global_buf_i8_kind, fileobj%is_root, ishift=ioff, jshift=joff) + type is (real(kind=r4_kind)) + call mpp_gather(isc, isc+xc_size-1, jsc, jsc+yc_size-1, fileobj%pelist, vdata(istart:iend, jstart:jend), & + & global_buf_r4_kind, fileobj%is_root, ishift=ioff, jshift=joff) + type is (real(kind=r8_kind)) + call mpp_gather(isc, isc+xc_size-1, jsc, jsc+yc_size-1, fileobj%pelist, vdata(istart:iend, jstart:jend), & + & global_buf_r8_kind, fileobj%is_root, ishift=ioff, jshift=joff) + class default + call error("unsupported variable type: domain_write_2d_mpp_gather: file: " & + & //trim(fileobj%path)//" variable:"// trim(variable_name)) + end select + + ! Root pe writes out the data + if (fileobj%is_root) then select type(vdata) type is (integer(kind=i4_kind)) call netcdf_write_data(fileobj, variable_name, global_buf_i4_kind, & - unlim_dim_level=unlim_dim_level) - deallocate(global_buf_i4_kind) + & unlim_dim_level=unlim_dim_level) type is (integer(kind=i8_kind)) call netcdf_write_data(fileobj, variable_name, global_buf_i8_kind, & - unlim_dim_level=unlim_dim_level) - deallocate(global_buf_i8_kind) + & unlim_dim_level=unlim_dim_level) type is (real(kind=r4_kind)) call netcdf_write_data(fileobj, variable_name, global_buf_r4_kind, & - unlim_dim_level=unlim_dim_level) - deallocate(global_buf_r4_kind) + & unlim_dim_level=unlim_dim_level) type is (real(kind=r8_kind)) call netcdf_write_data(fileobj, variable_name, global_buf_r8_kind, & - unlim_dim_level=unlim_dim_level) - deallocate(global_buf_r8_kind) - end select - else - if (buffer_includes_halos) then - c(xdim_index) = isc - isd + 1 - c(ydim_index) = jsc - jsd + 1 - endif - e(xdim_index) = xc_size - e(ydim_index) = yc_size - select type(vdata) - type is (integer(kind=i4_kind)) - call allocate_array(buf_i4_kind, e) - call get_array_section(buf_i4_kind, vdata, c, e) - call mpp_send(buf_i4_kind, size(buf_i4_kind), fileobj%io_root) - call mpp_sync_self(check=event_send) - deallocate(buf_i4_kind) - type is (integer(kind=i8_kind)) - call allocate_array(buf_i8_kind, e) - call get_array_section(buf_i8_kind, vdata, c, e) - call mpp_send(buf_i8_kind, size(buf_i8_kind), fileobj%io_root) - call mpp_sync_self(check=event_send) - deallocate(buf_i8_kind) - type is (real(kind=r4_kind)) - call allocate_array(buf_r4_kind, e) - call get_array_section(buf_r4_kind, vdata, c, e) - call mpp_send(buf_r4_kind, size(buf_r4_kind), fileobj%io_root) - call mpp_sync_self(check=event_send) - deallocate(buf_r4_kind) - type is (real(kind=r8_kind)) - call allocate_array(buf_r8_kind, e) - call get_array_section(buf_r8_kind, vdata, c, e) - call mpp_send(buf_r8_kind, size(buf_r8_kind), fileobj%io_root) - call mpp_sync_self(check=event_send) - deallocate(buf_r8_kind) + & unlim_dim_level=unlim_dim_level) class default - call error("unsupported variable type: domain_write_2d: file: "//trim(fileobj%path)//" variable:"// & - & trim(variable_name)) + call error("unsupported variable type: domain_write_2d_mpp_gather: file: " & + & //trim(fileobj%path)//" variable:"// trim(variable_name)) end select endif + end subroutine domain_write_2d !> @brief Gather "compute" domain data on the I/O root rank and then have !! the I/O root write out the data that spans the "global" domain. !! This routine may only be used with variables that are "domain -!! decomposed". +!! decomposed" using mpp_gather. subroutine domain_write_3d(fileobj, variable_name, vdata, unlim_dim_level, & - corner, edge_lengths) + corner, edge_lengths) - type(FmsNetcdfDomainFile_t), intent(in) :: fileobj !< File object. - character(len=*), intent(in) :: variable_name !< Variable name. - class(*), dimension(:,:,:), intent(in) :: vdata !< Data that will - !! be written out - !! to the netcdf file. - integer, intent(in), optional :: unlim_dim_level !< Level for the unlimited - !! dimension. - integer, dimension(3), intent(in), optional :: corner !< Array of starting - !! indices describing - !! where the data - !! will be written to. - integer, dimension(3), intent(in), optional :: edge_lengths !< The number of - !! elements that - !! will be written - !! in each dimension. - - integer(kind=i4_kind), dimension(:,:,:), allocatable :: buf_i4_kind - integer(kind=i8_kind), dimension(:,:,:), allocatable :: buf_i8_kind - real(kind=r4_kind), dimension(:,:,:), allocatable :: buf_r4_kind - real(kind=r8_kind), dimension(:,:,:), allocatable :: buf_r8_kind - logical :: buffer_includes_halos - integer, dimension(3) :: c - integer, dimension(3) :: e - integer(kind=i4_kind), dimension(:,:,:), allocatable :: global_buf_i4_kind - integer(kind=i8_kind), dimension(:,:,:), allocatable :: global_buf_i8_kind - real(kind=r4_kind), dimension(:,:,:), allocatable :: global_buf_r4_kind - real(kind=r8_kind), dimension(:,:,:), allocatable :: global_buf_r8_kind - integer :: i - type(domain2d), pointer :: io_domain - integer :: isc - integer :: isd - integer :: jsc - integer :: jsd - integer, dimension(:), allocatable :: pe_icsize - integer, dimension(:), allocatable :: pe_iec - integer, dimension(:), allocatable :: pe_isc - integer, dimension(:), allocatable :: pe_jcsize - integer, dimension(:), allocatable :: pe_jec - integer, dimension(:), allocatable :: pe_jsc - integer :: xc_size - integer :: xdim_index - integer :: xpos - integer :: ydim_index - integer :: ypos - integer :: yc_size - integer(kind=i4_kind) :: fill_i4_kind !< Fill value of a i4_kind variable - integer(kind=i8_kind) :: fill_i8_kind !< Fill value of a i8_kind variable - real(kind=r4_kind) :: fill_r4_kind !< Fill value of a r4_kind variable - real(kind=r8_kind) :: fill_r8_kind !< Fill value of a r8_kind variable - integer :: xgmax !< Ending x index of the global io domain - integer :: xgmin !< Starting x index of the global io domain - integer :: ygmax !< Ending y index of the global io domain - integer :: ygmin !< Ending y index of the global io domain - - if (.not. is_variable_domain_decomposed(fileobj, variable_name, .true., & - xdim_index, ydim_index, xpos, ypos)) then - call compressed_write(fileobj, variable_name, vdata, & - unlim_dim_level=unlim_dim_level, corner=corner, & - edge_lengths=edge_lengths) - return - endif - io_domain => mpp_get_io_domain(fileobj%domain) - call domain_offsets(size(vdata, xdim_index), size(vdata, ydim_index), fileobj%domain, & - xpos, ypos, isd, isc, xc_size, jsd, jsc, yc_size, & - buffer_includes_halos, msg="file:"//trim(fileobj%path)//" and variable:"//trim(variable_name)) - c(:) = 1 - e(:) = shape(vdata) - - !I/O root gathers the data and writes it. - if (fileobj%is_root) then - allocate(pe_isc(size(fileobj%pelist))) - allocate(pe_iec(size(fileobj%pelist))) - allocate(pe_icsize(size(fileobj%pelist))) - call mpp_get_compute_domains(io_domain, xbegin=pe_isc, xend=pe_iec, xsize=pe_icsize, & - position=xpos) - allocate(pe_jsc(size(fileobj%pelist))) - allocate(pe_jec(size(fileobj%pelist))) - allocate(pe_jcsize(size(fileobj%pelist))) - call mpp_get_compute_domains(io_domain, ybegin=pe_jsc, yend=pe_jec, ysize=pe_jcsize, & - position=ypos) - - !< Determine the size of the global io domain - call mpp_get_global_domain(io_domain, ybegin=ygmin, yend=ygmax, position=ypos) - call mpp_get_global_domain(io_domain, xbegin=xgmin, xend=xgmax, position=xpos) - - !Write the out the data. - !< Set e to equal the size of the global io domain - e(xdim_index) = xgmax - xgmin + 1 - e(ydim_index) = ygmax - ygmin + 1 - - !< Allocate a global buffer, get the fill value if it exists in the file, and initialize - !! the buffer to the fill value - select type(vdata) - type is (integer(kind=i4_kind)) - call allocate_array(global_buf_i4_kind, e) - global_buf_i4_kind = 0 - if (get_fill_value(fileobj, variable_name, fill_i4_kind, broadcast=.false.)) then - global_buf_i4_kind = fill_i4_kind - endif - type is (integer(kind=i8_kind)) - call allocate_array(global_buf_i8_kind, e) - global_buf_i8_kind = 0 - if (get_fill_value(fileobj, variable_name, fill_i8_kind, broadcast=.false.)) then - global_buf_i8_kind = fill_i8_kind - endif - type is (real(kind=r4_kind)) - call allocate_array(global_buf_r4_kind, e) - global_buf_r4_kind = 0. - if (get_fill_value(fileobj, variable_name, fill_r4_kind, broadcast=.false.)) then - global_buf_r4_kind = fill_r4_kind - endif - type is (real(kind=r8_kind)) - call allocate_array(global_buf_r8_kind, e) - global_buf_r8_kind = 0. - if (get_fill_value(fileobj, variable_name, fill_r8_kind, broadcast=.false.)) then - global_buf_r8_kind = fill_r8_kind - endif - class default - call error("unsupported variable type: domain_write_3d: file: "//trim(fileobj%path)//" variable:"// & - & trim(variable_name)) - end select - - do i = 1, size(fileobj%pelist) - !< Set c relative to the starting global io domain index - c(xdim_index) = pe_isc(i) - xgmin + 1 - c(ydim_index) = pe_jsc(i) - ygmin + 1 - e(xdim_index) = pe_icsize(i) - e(ydim_index) = pe_jcsize(i) - select type(vdata) - type is (integer(kind=i4_kind)) - call allocate_array(buf_i4_kind, e) - !Get the data for fileobj%pelist(i)'s portion of the compute domain. - if (i .eq. 1) then - !Root rank gets the data directly. - if (buffer_includes_halos) then - !Adjust if the input buffer has room for halos. - c(xdim_index) = isc - isd + 1 - c(ydim_index) = jsc - jsd + 1 - else - c(xdim_index) = 1 - c(ydim_index) = 1 - endif - call get_array_section(buf_i4_kind, vdata, c, e) - c(xdim_index) = pe_isc(i) - xgmin + 1 - c(ydim_index) = pe_jsc(i) - ygmin + 1 - else - !Receive data from non-root ranks. - call mpp_recv(buf_i4_kind, size(buf_i4_kind), fileobj%pelist(i), block=.true.) - endif - !Put local data into the global buffer. - call put_array_section(buf_i4_kind, global_buf_i4_kind, c, e) - deallocate(buf_i4_kind) - type is (integer(kind=i8_kind)) - call allocate_array(buf_i8_kind, e) - !Get the data for fileobj%pelist(i)'s portion of the compute domain. - if (i .eq. 1) then - !Root rank gets the data directly. - if (buffer_includes_halos) then - !Adjust if the input buffer has room for halos. - c(xdim_index) = isc - isd + 1 - c(ydim_index) = jsc - jsd + 1 - else - c(xdim_index) = 1 - c(ydim_index) = 1 - endif - call get_array_section(buf_i8_kind, vdata, c, e) - c(xdim_index) = pe_isc(i) - xgmin + 1 - c(ydim_index) = pe_jsc(i) - ygmin + 1 - else - !Receive data from non-root ranks. - call mpp_recv(buf_i8_kind, size(buf_i8_kind), fileobj%pelist(i), block=.true.) - endif - !Put local data into the global buffer. - call put_array_section(buf_i8_kind, global_buf_i8_kind, c, e) - deallocate(buf_i8_kind) - type is (real(kind=r4_kind)) - call allocate_array(buf_r4_kind, e) - !Get the data for fileobj%pelist(i)'s portion of the compute domain. - if (i .eq. 1) then - !Root rank gets the data directly. - if (buffer_includes_halos) then - !Adjust if the input buffer has room for halos. - c(xdim_index) = isc - isd + 1 - c(ydim_index) = jsc - jsd + 1 - else - c(xdim_index) = 1 - c(ydim_index) = 1 - endif - call get_array_section(buf_r4_kind, vdata, c, e) - c(xdim_index) = pe_isc(i) - xgmin + 1 - c(ydim_index) = pe_jsc(i) - ygmin + 1 - else - !Receive data from non-root ranks. - call mpp_recv(buf_r4_kind, size(buf_r4_kind), fileobj%pelist(i), block=.true.) - endif - !Put local data into the global buffer. - call put_array_section(buf_r4_kind, global_buf_r4_kind, c, e) - deallocate(buf_r4_kind) - type is (real(kind=r8_kind)) - call allocate_array(buf_r8_kind, e) - !Get the data for fileobj%pelist(i)'s portion of the compute domain. - if (i .eq. 1) then - !Root rank gets the data directly. - if (buffer_includes_halos) then - !Adjust if the input buffer has room for halos. - c(xdim_index) = isc - isd + 1 - c(ydim_index) = jsc - jsd + 1 - else - c(xdim_index) = 1 - c(ydim_index) = 1 - endif - call get_array_section(buf_r8_kind, vdata, c, e) - c(xdim_index) = pe_isc(i) - xgmin + 1 - c(ydim_index) = pe_jsc(i) - ygmin + 1 - else - !Receive data from non-root ranks. - call mpp_recv(buf_r8_kind, size(buf_r8_kind), fileobj%pelist(i), block=.true.) - endif - !Put local data into the global buffer. - call put_array_section(buf_r8_kind, global_buf_r8_kind, c, e) - deallocate(buf_r8_kind) - end select - enddo - deallocate(pe_isc) - deallocate(pe_iec) - deallocate(pe_icsize) - deallocate(pe_jsc) - deallocate(pe_jec) - deallocate(pe_jcsize) + type(FmsNetcdfDomainFile_t), intent(in) :: fileobj !< File object. + character(len=*), intent(in) :: variable_name !< Variable name. + class(*), contiguous, dimension(:,:,:), target, intent(in) :: vdata !< Data that will + !! be written out + !! to the netcdf file. + integer, intent(in), optional :: unlim_dim_level !< Level for the unlimited + !! dimension. + integer, dimension(3), intent(in), optional :: corner !< Array of starting + !! indices describing + !! where the data + !! will be written to. + integer, dimension(3), intent(in), optional :: edge_lengths !< The number of + !! elements that + !! will be written + !! in each dimension. - !Write the out the data. + integer(kind=i4_kind), dimension(:,:,:), allocatable :: global_buf_i4_kind + integer(kind=i8_kind), dimension(:,:,:), allocatable :: global_buf_i8_kind + real(kind=r4_kind), dimension(:,:,:), allocatable :: global_buf_r4_kind + real(kind=r8_kind), dimension(:,:,:), allocatable :: global_buf_r8_kind + logical :: buffer_includes_halos + type(domain2d), pointer :: io_domain + integer :: isc + integer :: isd + integer :: jsc + integer :: jsd + integer :: xc_size + integer :: xdim_index + integer :: xpos + integer :: ydim_index + integer :: ypos + integer :: yc_size + integer(kind=i4_kind) :: fill_i4_kind !< Fill value of a i4_kind variable + integer(kind=i8_kind) :: fill_i8_kind !< Fill value of a i8_kind variable + real(kind=r4_kind) :: fill_r4_kind !< Fill value of a r4_kind variable + real(kind=r8_kind) :: fill_r8_kind !< Fill value of a r8_kind variable + class(*), dimension(:,:,:,:), pointer :: vdata_dummy !< Vdata remapped as 4D + integer :: xgmin !< Starting x index of the global io domain + integer :: ygmin !< Ending y index of the global io domain + integer :: xgsize, ygsize + integer :: istart, jstart, iend, jend + integer :: ioff, joff + + if (fileobj%use_netcdf_mpi) then + call netcdf_mpi_write_3d(fileobj, variable_name, vdata, unlim_dim_level, corner, edge_lengths) + return + endif + + if (.not. is_variable_domain_decomposed(fileobj, variable_name, .true., & + xdim_index, ydim_index, xpos, ypos)) then + call compressed_write(fileobj, variable_name, vdata, & + unlim_dim_level=unlim_dim_level, corner=corner, & + edge_lengths=edge_lengths) + return + endif + + if (xdim_index .ne. 1 .or. ydim_index .ne. 2) then + ! This is a KLUDGE + ! mpp_scatter assumes that the variable is (x,y), if that is not the case it remaps the data + ! to a 4D array and calls domain_read_4d which does not use mpp_scatter yet + vdata_dummy(1:size(vdata,1),1:size(vdata,2), 1:size(vdata,3), 1:1) => vdata(:,:,:) + call domain_write_4d(fileobj, variable_name, vdata_dummy, unlim_dim_level) + return + endif + + ! Get the io domain from the fileobj + io_domain => mpp_get_io_domain(fileobj%domain) + + ! Get some info about the domain: + call domain_offsets(size(vdata, xdim_index), size(vdata, ydim_index), fileobj%domain, & + xpos, ypos, isd, isc, xc_size, jsd, jsc, yc_size, buffer_includes_halos, & + msg="file:"//trim(fileobj%path)//" and variable:"//trim(variable_name)) + + ! Get the global io domain: + call mpp_get_global_domain(io_domain, xbegin=xgmin, xsize=xgsize, position=xpos) + call mpp_get_global_domain(io_domain, ybegin=ygmin, ysize=ygsize, position=ypos) + + ! Root pe allocates room to gather the data and computes offsets for data placement + if (fileobj%is_root) then + ! Offsets used to place data in recv buffer + ioff = 1-xgmin + joff = 1-ygmin + + ! Allocate recv buffer for gather + select type(vdata) + type is (integer(kind=i4_kind)) + allocate(global_buf_i4_kind(xgsize, ygsize, size(vdata,3))) + global_buf_i4_kind = 0 + if (get_fill_value(fileobj, variable_name, fill_i4_kind, broadcast=.false.)) then + global_buf_i4_kind = fill_i4_kind + endif + type is (integer(kind=i8_kind)) + allocate(global_buf_i8_kind(xgsize, ygsize, size(vdata,3))) + global_buf_i8_kind = 0 + if (get_fill_value(fileobj, variable_name, fill_i8_kind, broadcast=.false.)) then + global_buf_i8_kind = fill_i8_kind + endif + type is (real(kind=r4_kind)) + allocate(global_buf_r4_kind(xgsize, ygsize, size(vdata,3))) + global_buf_r4_kind = 0. + if (get_fill_value(fileobj, variable_name, fill_r4_kind, broadcast=.false.)) then + global_buf_r4_kind = fill_r4_kind + endif + type is (real(kind=r8_kind)) + allocate(global_buf_r8_kind(xgsize, ygsize, size(vdata,3))) + global_buf_r8_kind = 0. + if (get_fill_value(fileobj, variable_name, fill_r8_kind, broadcast=.false.)) then + global_buf_r8_kind = fill_r8_kind + endif + class default + call error("unsupported variable type: domain_write_3d_mpp_gather: file: " & + & //trim(fileobj%path)//" variable:"//trim(variable_name)) + end select + endif + + ! Get the starting and indices of the compute domain relative to vdata(note that vdata start indices at 1 #Fortran) + istart = 1 + jstart = 1 + + ! If the buffer contains halos, get the portion of vdata with only the compute domain + if (buffer_includes_halos) then + istart = isc - isd + 1 + jstart = jsc - jsd + 1 + endif + + iend = istart + xc_size - 1 + jend = jstart + yc_size - 1 + + ! Get offsets for buffer + ioff = 1-xgmin + joff = 1-ygmin + + ! Gather the data + select type(vdata) + type is (integer(kind=i4_kind)) + call mpp_gather(isc, isc+xc_size-1, jsc, jsc+yc_size-1, size(vdata,3), fileobj%pelist, & + & vdata(istart:iend, jstart:jend,:), global_buf_i4_kind, fileobj%is_root, ishift=ioff, jshift=joff) + type is (integer(kind=i8_kind)) + call mpp_gather(isc, isc+xc_size-1, jsc, jsc+yc_size-1, size(vdata,3), fileobj%pelist, & + & vdata(istart:iend, jstart:jend,:), global_buf_i8_kind, fileobj%is_root, ishift=ioff, jshift=joff) + type is (real(kind=r4_kind)) + call mpp_gather(isc, isc+xc_size-1, jsc, jsc+yc_size-1, size(vdata,3), fileobj%pelist, & + & vdata(istart:iend, jstart:jend,:), global_buf_r4_kind, fileobj%is_root, ishift=ioff, jshift=joff) + type is (real(kind=r8_kind)) + call mpp_gather(isc, isc+xc_size-1, jsc, jsc+yc_size-1, size(vdata,3), fileobj%pelist, & + & vdata(istart:iend, jstart:jend,:), global_buf_r8_kind, fileobj%is_root, ishift=ioff, jshift=joff) + class default + call error("unsupported variable type: domain_write_3d_mpp_gather: file: " & + & //trim(fileobj%path)//" variable:"//trim(variable_name)) + end select + + ! Root pe writes out the data + if (fileobj%is_root) then select type(vdata) type is (integer(kind=i4_kind)) call netcdf_write_data(fileobj, variable_name, global_buf_i4_kind, & unlim_dim_level=unlim_dim_level) - deallocate(global_buf_i4_kind) type is (integer(kind=i8_kind)) call netcdf_write_data(fileobj, variable_name, global_buf_i8_kind, & unlim_dim_level=unlim_dim_level) - deallocate(global_buf_i8_kind) type is (real(kind=r4_kind)) call netcdf_write_data(fileobj, variable_name, global_buf_r4_kind, & unlim_dim_level=unlim_dim_level) - deallocate(global_buf_r4_kind) type is (real(kind=r8_kind)) call netcdf_write_data(fileobj, variable_name, global_buf_r8_kind, & unlim_dim_level=unlim_dim_level) - deallocate(global_buf_r8_kind) - end select - else - if (buffer_includes_halos) then - c(xdim_index) = isc - isd + 1 - c(ydim_index) = jsc - jsd + 1 - endif - e(xdim_index) = xc_size - e(ydim_index) = yc_size - select type(vdata) - type is (integer(kind=i4_kind)) - call allocate_array(buf_i4_kind, e) - call get_array_section(buf_i4_kind, vdata, c, e) - call mpp_send(buf_i4_kind, size(buf_i4_kind), fileobj%io_root) - call mpp_sync_self(check=event_send) - deallocate(buf_i4_kind) - type is (integer(kind=i8_kind)) - call allocate_array(buf_i8_kind, e) - call get_array_section(buf_i8_kind, vdata, c, e) - call mpp_send(buf_i8_kind, size(buf_i8_kind), fileobj%io_root) - call mpp_sync_self(check=event_send) - deallocate(buf_i8_kind) - type is (real(kind=r4_kind)) - call allocate_array(buf_r4_kind, e) - call get_array_section(buf_r4_kind, vdata, c, e) - call mpp_send(buf_r4_kind, size(buf_r4_kind), fileobj%io_root) - call mpp_sync_self(check=event_send) - deallocate(buf_r4_kind) - type is (real(kind=r8_kind)) - call allocate_array(buf_r8_kind, e) - call get_array_section(buf_r8_kind, vdata, c, e) - call mpp_send(buf_r8_kind, size(buf_r8_kind), fileobj%io_root) - call mpp_sync_self(check=event_send) - deallocate(buf_r8_kind) class default - call error("unsupported variable type: domain_write_3d: file: "//trim(fileobj%path)//" variable:"// & - & trim(variable_name)) + call error("unsupported variable type: domain_write_3d_mpp_gather: file: " & + & //trim(fileobj%path)//" variable:"//trim(variable_name)) end select endif + end subroutine domain_write_3d @@ -729,6 +497,11 @@ subroutine domain_write_4d(fileobj, variable_name, vdata, unlim_dim_level, & integer :: ygmax !< Ending y index of the global io domain integer :: ygmin !< Ending y index of the global io domain + if (fileobj%use_netcdf_mpi) then + call netcdf_mpi_write_4d(fileobj, variable_name, vdata, unlim_dim_level, corner, edge_lengths) + return + endif + if (.not. is_variable_domain_decomposed(fileobj, variable_name, .true., & xdim_index, ydim_index, xpos, ypos)) then call compressed_write(fileobj, variable_name, vdata, & @@ -1025,6 +798,11 @@ subroutine domain_write_5d(fileobj, variable_name, vdata, unlim_dim_level, & integer :: ygmax !< Ending y index of the global io domain integer :: ygmin !< Ending y index of the global io domain + if (fileobj%use_netcdf_mpi) then + call netcdf_mpi_write_5d(fileobj, variable_name, vdata, unlim_dim_level, corner, edge_lengths) + return + endif + if (.not. is_variable_domain_decomposed(fileobj, variable_name, .true., & xdim_index, ydim_index, xpos, ypos)) then call compressed_write(fileobj, variable_name, vdata, & @@ -1258,4 +1036,567 @@ subroutine domain_write_5d(fileobj, variable_name, vdata, unlim_dim_level, & end select endif end subroutine domain_write_5d + +!> @brief Write 2D data using NetCDF MPI +subroutine netcdf_mpi_write_2d(fileobj, variable_name, vdata, unlim_dim_level, corner, edge_lengths) + type(FmsNetcdfDomainFile_t), intent(in) :: fileobj !< File object. + character(len=*), intent(in) :: variable_name !< Variable name. + class(*), dimension(:,:), intent(in) :: vdata !< Data that will be written out to the netcdf file. + integer, intent(in), optional :: unlim_dim_level !< Level for the unlimited dimension. + integer, dimension(2), intent(in), optional :: corner !< Array of starting indices describing where the data + !! will be written to. + integer, dimension(2), intent(in), optional :: edge_lengths !< The number of elements that will be written + !! in each dimension. + + integer :: xdim_index + integer :: ydim_index + integer :: xpos + integer :: ypos + + integer :: isd !< Starting "x" index of the data domain + integer :: isc !< Starting "x" index of the compute domain + integer :: jsd !< Starting "y" index of the data domain + integer :: jsc !< Starting "y" index of the compute domain + integer :: xc_size !< Size of the compute domain + integer :: yc_size !< Size of the compute domain + logical :: buffer_includes_halos !< True if "vdata" is the size of the data domain + !! (i.e it includes halos (which are not written)) + + integer, dimension(3) :: c !< Indices of the corners for each dimension + integer, dimension(3) :: e !< Size of the data for each dimension + integer :: varid + integer :: unlim_dim_index + + integer :: i0, i1 + integer :: j0, j1 + integer :: err + + if (.not. is_variable_domain_decomposed(fileobj, variable_name, .true., xdim_index, ydim_index, xpos, ypos)) then + call compressed_write(fileobj, variable_name, vdata, unlim_dim_level=unlim_dim_level, corner=corner, & + edge_lengths=edge_lengths) + return + endif + + !! Get some more info about the variable + call domain_offsets(size(vdata, xdim_index), size(vdata, ydim_index), fileobj%domain, & + xpos, ypos, isd, isc, xc_size, jsd, jsc, yc_size, & + buffer_includes_halos, msg="file:"//trim(fileobj%path)//" and variable:"//trim(variable_name)) + + c = 1 + e = [shape(vdata), 1] + + c(xdim_index) = isc + c(ydim_index) = jsc + e(xdim_index) = xc_size + e(ydim_index) = yc_size + + if (present(unlim_dim_level)) then + unlim_dim_index = get_variable_unlimited_dimension_index(fileobj, variable_name, broadcast=.false.) + if (unlim_dim_index .ne. 3) then + call error("unlimited dimension must be the slowest varying dimension in variable: "//trim(variable_name)) + endif + c(unlim_dim_index) = unlim_dim_level + endif + + i0 = 1 + j0 = 1 + select case (xdim_index) + case (1) + ! X is the first dimension + if (buffer_includes_halos) then + i0 = isc - isd + 1 + j0 = jsc - jsd + 1 + endif + i1 = i0 + xc_size - 1 + j1 = j0 + yc_size - 1 + case (2) + ! X is the second dimension + if (buffer_includes_halos) then + i0 = jsc - jsd + 1 + j0 = isc - isd + 1 + endif + i1 = i0 + yc_size - 1 + j1 = j0 + xc_size - 1 + end select + + varid = get_variable_id(fileobj%ncid, trim(variable_name), & + msg="file:"//trim(fileobj%path)//" and variable:"//trim(variable_name)) + + select type(vdata) + type is (integer(kind=i4_kind)) + err = nf90_put_var(fileobj%ncid, varid, & + vdata(i0:i1, j0:j1), & + start=c, count=e) + type is (integer(kind=i8_kind)) + err = nf90_put_var(fileobj%ncid, varid, & + vdata(i0:i1, j0:j1), & + start=c, count=e) + type is (real(kind=r4_kind)) + err = nf90_put_var(fileobj%ncid, varid, & + vdata(i0:i1, j0:j1), & + start=c, count=e) + type is (real(kind=r8_kind)) + err = nf90_put_var(fileobj%ncid, varid, & + vdata(i0:i1, j0:j1), & + start=c, count=e) + end select + + call check_netcdf_code(err, "Failed to write variable: "//trim(variable_name)) +end subroutine netcdf_mpi_write_2d + +!> @brief Write 3D data using NetCDF MPI +subroutine netcdf_mpi_write_3d(fileobj, variable_name, vdata, unlim_dim_level, corner, edge_lengths) + type(FmsNetcdfDomainFile_t), intent(in) :: fileobj !< File object. + character(len=*), intent(in) :: variable_name !< Variable name. + class(*), dimension(:,:,:), intent(in) :: vdata !< Data that will be written out to the netcdf file. + integer, intent(in), optional :: unlim_dim_level !< Level for the unlimited dimension. + integer, dimension(3), intent(in), optional :: corner !< Array of starting indices describing where the data + !! will be written to. + integer, dimension(3), intent(in), optional :: edge_lengths !< The number of elements that will be written + !! in each dimension. + + integer :: xdim_index + integer :: ydim_index + integer :: xpos + integer :: ypos + + integer :: isd !< Starting "x" index of the data domain + integer :: isc !< Starting "x" index of the compute domain + integer :: jsd !< Starting "y" index of the data domain + integer :: jsc !< Starting "y" index of the compute domain + integer :: xc_size !< Size of the compute domain + integer :: yc_size !< Size of the compute domain + logical :: buffer_includes_halos !< True if "vdata" is the size of the data domain + !! (i.e it includes halos (which are not written)) + + integer, dimension(4) :: c !< Indices of the corners for each dimension + integer, dimension(4) :: e !< Size of the data for each dimension + integer :: varid + integer :: unlim_dim_index + + integer :: i0, i1 + integer :: j0, j1 + integer :: k0, k1 + integer :: err + + if (.not. is_variable_domain_decomposed(fileobj, variable_name, .true., xdim_index, ydim_index, xpos, ypos)) then + call compressed_write(fileobj, variable_name, vdata, unlim_dim_level=unlim_dim_level, corner=corner, & + edge_lengths=edge_lengths) + return + endif + + !! Get some more info about the variable + call domain_offsets(size(vdata, xdim_index), size(vdata, ydim_index), fileobj%domain, & + xpos, ypos, isd, isc, xc_size, jsd, jsc, yc_size, & + buffer_includes_halos, msg="file:"//trim(fileobj%path)//" and variable:"//trim(variable_name)) + + c = 1 + e = [shape(vdata), 1] + + c(xdim_index) = isc + c(ydim_index) = jsc + e(xdim_index) = xc_size + e(ydim_index) = yc_size + + if (present(unlim_dim_level)) then + unlim_dim_index = get_variable_unlimited_dimension_index(fileobj, variable_name, broadcast=.false.) + if (unlim_dim_index .ne. 4) then + call error("unlimited dimension must be the slowest varying dimension in variable: "//trim(variable_name)) + endif + c(unlim_dim_index) = unlim_dim_level + endif + + i0 = 1 + j0 = 1 + k0 = 1 + + i1 = size(vdata, 1) + j1 = size(vdata, 2) + k1 = size(vdata, 3) + + select case (xdim_index) + case (1) + ! X is the first dimension + if (buffer_includes_halos) then + i0 = isc - isd + 1 + endif + i1 = i0 + xc_size - 1 + case (2) + ! X is the second dimension + if (buffer_includes_halos) then + j0 = isc - isd + 1 + endif + j1 = j0 + xc_size - 1 + case (3) + ! X is the third dimension + if (buffer_includes_halos) then + k0 = isc - isd + 1 + endif + k1 = k0 + xc_size - 1 + end select + + select case (ydim_index) + case (1) + ! y is the first dimension + if (buffer_includes_halos) then + i0 = jsc - jsd + 1 + endif + i1 = i0 + yc_size - 1 + case (2) + ! y is the second dimension + if (buffer_includes_halos) then + j0 = jsc - jsd + 1 + endif + j1 = j0 + yc_size - 1 + case (3) + ! y is the third dimension + if (buffer_includes_halos) then + k0 = jsc - jsd + 1 + endif + k1 = k0 + yc_size - 1 + end select + + varid = get_variable_id(fileobj%ncid, trim(variable_name), & + msg="file:"//trim(fileobj%path)//" and variable:"//trim(variable_name)) + + select type(vdata) + type is (integer(kind=i4_kind)) + err = nf90_put_var(fileobj%ncid, varid, & + vdata(i0:i1, j0:j1, k0:k1), & + start=c, count=e) + type is (integer(kind=i8_kind)) + err = nf90_put_var(fileobj%ncid, varid, & + vdata(i0:i1, j0:j1, k0:k1), & + start=c, count=e) + type is (real(kind=r4_kind)) + err = nf90_put_var(fileobj%ncid, varid, & + vdata(i0:i1, j0:j1, k0:k1), & + start=c, count=e) + type is (real(kind=r8_kind)) + err = nf90_put_var(fileobj%ncid, varid, & + vdata(i0:i1, j0:j1, k0:k1), & + start=c, count=e) + end select + + call check_netcdf_code(err, "Failed to write variable: "//trim(variable_name)) +end subroutine netcdf_mpi_write_3d + +!> @brief Write 4D data using NetCDF MPI +subroutine netcdf_mpi_write_4d(fileobj, variable_name, vdata, unlim_dim_level, corner, edge_lengths) + type(FmsNetcdfDomainFile_t), intent(in) :: fileobj !< File object. + character(len=*), intent(in) :: variable_name !< Variable name. + class(*), dimension(:,:,:,:), intent(in) :: vdata !< Data that will be written out to the netcdf file. + integer, intent(in), optional :: unlim_dim_level !< Level for the unlimited dimension. + integer, dimension(4), intent(in), optional :: corner !< Array of starting indices describing where the data + !! will be written to. + integer, dimension(4), intent(in), optional :: edge_lengths !< The number of elements that will be written + !! in each dimension. + + integer :: xdim_index + integer :: ydim_index + integer :: xpos + integer :: ypos + + integer :: isd !< Starting "x" index of the data domain + integer :: isc !< Starting "x" index of the compute domain + integer :: jsd !< Starting "y" index of the data domain + integer :: jsc !< Starting "y" index of the compute domain + integer :: xc_size !< Size of the compute domain + integer :: yc_size !< Size of the compute domain + logical :: buffer_includes_halos !< True if "vdata" is the size of the data domain + !! (i.e it includes halos (which are not written)) + + integer, dimension(5) :: c !< Indices of the corners for each dimension + integer, dimension(5) :: e !< Size of the data for each dimension + integer :: varid + integer :: unlim_dim_index + + integer :: i0, i1 + integer :: j0, j1 + integer :: k0, k1 + integer :: l0, l1 + integer :: err + + if (.not. is_variable_domain_decomposed(fileobj, variable_name, .true., xdim_index, ydim_index, xpos, ypos)) then + call compressed_write(fileobj, variable_name, vdata, unlim_dim_level=unlim_dim_level, corner=corner, & + edge_lengths=edge_lengths) + return + endif + + !! Get some more info about the variable + call domain_offsets(size(vdata, xdim_index), size(vdata, ydim_index), fileobj%domain, & + xpos, ypos, isd, isc, xc_size, jsd, jsc, yc_size, & + buffer_includes_halos, msg="file:"//trim(fileobj%path)//" and variable:"//trim(variable_name)) + + c = 1 + e = [shape(vdata), 1] + + c(xdim_index) = isc + c(ydim_index) = jsc + e(xdim_index) = xc_size + e(ydim_index) = yc_size + + if (present(unlim_dim_level)) then + unlim_dim_index = get_variable_unlimited_dimension_index(fileobj, variable_name, broadcast=.false.) + if (unlim_dim_index .ne. 5) then + call error("unlimited dimension must be the slowest varying dimension in variable: "//trim(variable_name)) + endif + c(unlim_dim_index) = unlim_dim_level + endif + + i0 = 1 + j0 = 1 + k0 = 1 + l0 = 1 + + i1 = size(vdata, 1) + j1 = size(vdata, 2) + k1 = size(vdata, 3) + l1 = size(vdata, 4) + + select case (xdim_index) + case (1) + ! X is the first dimension + if (buffer_includes_halos) then + i0 = isc - isd + 1 + endif + i1 = i0 + xc_size - 1 + case (2) + ! X is the second dimension + if (buffer_includes_halos) then + j0 = isc - isd + 1 + endif + j1 = j0 + xc_size - 1 + case (3) + ! X is the third dimension + if (buffer_includes_halos) then + k0 = isc - isd + 1 + endif + k1 = k0 + xc_size - 1 + case (4) + ! X is the fourth dimension + if (buffer_includes_halos) then + l0 = isc - isd + 1 + endif + l1 = l0 + xc_size - 1 + end select + + select case (ydim_index) + case (1) + ! y is the first dimension + if (buffer_includes_halos) then + i0 = jsc - jsd + 1 + endif + i1 = i0 + yc_size - 1 + case (2) + ! y is the second dimension + if (buffer_includes_halos) then + j0 = jsc - jsd + 1 + endif + j1 = j0 + yc_size - 1 + case (3) + ! y is the third dimension + if (buffer_includes_halos) then + k0 = jsc - jsd + 1 + endif + k1 = k0 + yc_size - 1 + case (4) + ! y is the fourth dimension + if (buffer_includes_halos) then + l0 = jsc - jsd + 1 + endif + l1 = l0 + yc_size - 1 + end select + + varid = get_variable_id(fileobj%ncid, trim(variable_name), & + msg="file:"//trim(fileobj%path)//" and variable:"//trim(variable_name)) + + select type(vdata) + type is (integer(kind=i4_kind)) + err = nf90_put_var(fileobj%ncid, varid, & + vdata(i0:i1, j0:j1, k0:k1, l0:l1), & + start=c, count=e) + type is (integer(kind=i8_kind)) + err = nf90_put_var(fileobj%ncid, varid, & + vdata(i0:i1, j0:j1, k0:k1, l0:l1), & + start=c, count=e) + type is (real(kind=r4_kind)) + err = nf90_put_var(fileobj%ncid, varid, & + vdata(i0:i1, j0:j1, k0:k1, l0:l1), & + start=c, count=e) + type is (real(kind=r8_kind)) + err = nf90_put_var(fileobj%ncid, varid, & + vdata(i0:i1, j0:j1, k0:k1, l0:l1), & + start=c, count=e) + end select + + call check_netcdf_code(err, "Failed to write variable: "//trim(variable_name)) +end subroutine netcdf_mpi_write_4d + +!> @brief Write 5D data using NetCDF MPI +subroutine netcdf_mpi_write_5d(fileobj, variable_name, vdata, unlim_dim_level, corner, edge_lengths) + type(FmsNetcdfDomainFile_t), intent(in) :: fileobj !< File object. + character(len=*), intent(in) :: variable_name !< Variable name. + class(*), dimension(:,:,:,:,:), intent(in) :: vdata !< Data that will be written out to the netcdf file. + integer, intent(in), optional :: unlim_dim_level !< Level for the unlimited dimension. + integer, dimension(5), intent(in), optional :: corner !< Array of starting indices describing where the data + !! will be written to. + integer, dimension(5), intent(in), optional :: edge_lengths !< The number of elements that will be written + !! in each dimension. + + integer :: xdim_index + integer :: ydim_index + integer :: xpos + integer :: ypos + + integer :: isd !< Starting "x" index of the data domain + integer :: isc !< Starting "x" index of the compute domain + integer :: jsd !< Starting "y" index of the data domain + integer :: jsc !< Starting "y" index of the compute domain + integer :: xc_size !< Size of the compute domain + integer :: yc_size !< Size of the compute domain + logical :: buffer_includes_halos !< True if "vdata" is the size of the data domain + !! (i.e it includes halos (which are not written)) + + integer, dimension(6) :: c !< Indices of the corners for each dimension + integer, dimension(6) :: e !< Size of the data for each dimension + integer :: varid + integer :: unlim_dim_index + + integer :: i0, i1 + integer :: j0, j1 + integer :: k0, k1 + integer :: l0, l1 + integer :: m0, m1 + integer :: err + + if (.not. is_variable_domain_decomposed(fileobj, variable_name, .true., xdim_index, ydim_index, xpos, ypos)) then + call compressed_write(fileobj, variable_name, vdata, unlim_dim_level=unlim_dim_level, corner=corner, & + edge_lengths=edge_lengths) + return + endif + + !! Get some more info about the variable + call domain_offsets(size(vdata, xdim_index), size(vdata, ydim_index), fileobj%domain, & + xpos, ypos, isd, isc, xc_size, jsd, jsc, yc_size, & + buffer_includes_halos, msg="file:"//trim(fileobj%path)//" and variable:"//trim(variable_name)) + + c = 1 + e = [shape(vdata), 1] + + c(xdim_index) = isc + c(ydim_index) = jsc + e(xdim_index) = xc_size + e(ydim_index) = yc_size + + if (present(unlim_dim_level)) then + unlim_dim_index = get_variable_unlimited_dimension_index(fileobj, variable_name, broadcast=.false.) + if (unlim_dim_index .ne. 6) then + call error("unlimited dimension must be the slowest varying dimension in variable: "//trim(variable_name)) + endif + c(unlim_dim_index) = unlim_dim_level + endif + + i0 = 1 + j0 = 1 + k0 = 1 + l0 = 1 + m0 = 1 + + i1 = size(vdata, 1) + j1 = size(vdata, 2) + k1 = size(vdata, 3) + l1 = size(vdata, 4) + m1 = size(vdata, 5) + + select case (xdim_index) + case (1) + ! X is the first dimension + if (buffer_includes_halos) then + i0 = isc - isd + 1 + endif + i1 = i0 + xc_size - 1 + case (2) + ! X is the second dimension + if (buffer_includes_halos) then + j0 = isc - isd + 1 + endif + j1 = j0 + xc_size - 1 + case (3) + ! X is the third dimension + if (buffer_includes_halos) then + k0 = isc - isd + 1 + endif + k1 = k0 + xc_size - 1 + case (4) + ! X is the fourth dimension + if (buffer_includes_halos) then + l0 = isc - isd + 1 + endif + l1 = l0 + xc_size - 1 + case (5) + ! X is the fifth dimension + if (buffer_includes_halos) then + m0 = isc - isd + 1 + endif + m1 = m0 + xc_size - 1 + end select + + select case (ydim_index) + case (1) + ! y is the first dimension + if (buffer_includes_halos) then + i0 = jsc - jsd + 1 + endif + i1 = i0 + yc_size - 1 + case (2) + ! y is the second dimension + if (buffer_includes_halos) then + j0 = jsc - jsd + 1 + endif + j1 = j0 + yc_size - 1 + case (3) + ! y is the third dimension + if (buffer_includes_halos) then + k0 = jsc - jsd + 1 + endif + k1 = k0 + yc_size - 1 + case (4) + ! y is the fourth dimension + if (buffer_includes_halos) then + l0 = jsc - jsd + 1 + endif + l1 = l0 + yc_size - 1 + case (5) + ! y is the fifth dimension + if (buffer_includes_halos) then + m0 = jsc - jsd + 1 + endif + m1 = m0 + yc_size - 1 + end select + + varid = get_variable_id(fileobj%ncid, trim(variable_name), & + msg="file:"//trim(fileobj%path)//" and variable:"//trim(variable_name)) + + select type(vdata) + type is (integer(kind=i4_kind)) + err = nf90_put_var(fileobj%ncid, varid, & + vdata(i0:i1, j0:j1, k0:k1, l0:l1, m0:m1), & + start=c, count=e) + type is (integer(kind=i8_kind)) + err = nf90_put_var(fileobj%ncid, varid, & + vdata(i0:i1, j0:j1, k0:k1, l0:l1, m0:m1), & + start=c, count=e) + type is (real(kind=r4_kind)) + err = nf90_put_var(fileobj%ncid, varid, & + vdata(i0:i1, j0:j1, k0:k1, l0:l1, m0:m1), & + start=c, count=e) + type is (real(kind=r8_kind)) + err = nf90_put_var(fileobj%ncid, varid, & + vdata(i0:i1, j0:j1, k0:k1, l0:l1, m0:m1), & + start=c, count=e) + end select + + call check_netcdf_code(err, "Failed to write variable: "//trim(variable_name)) +end subroutine netcdf_mpi_write_5d !> @} diff --git a/fms2_io/include/gather_data_bc.inc b/fms2_io/include/gather_data_bc.inc index 004069b545..3734ca401c 100644 --- a/fms2_io/include/gather_data_bc.inc +++ b/fms2_io/include/gather_data_bc.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief Routines for the @ref gather_data_bc interface diff --git a/fms2_io/include/get_data_type_string.inc b/fms2_io/include/get_data_type_string.inc index 71910ee867..2c87aed65b 100644 --- a/fms2_io/include/get_data_type_string.inc +++ b/fms2_io/include/get_data_type_string.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief Routines to return a given arguments data type as a string. diff --git a/fms2_io/include/get_global_attribute.inc b/fms2_io/include/get_global_attribute.inc index 571f444da2..90dc99466d 100644 --- a/fms2_io/include/get_global_attribute.inc +++ b/fms2_io/include/get_global_attribute.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief Routines for retrieving global attribute values from netcdf files with different diff --git a/fms2_io/include/get_variable_attribute.inc b/fms2_io/include/get_variable_attribute.inc index 50de10d163..8184bb96af 100644 --- a/fms2_io/include/get_variable_attribute.inc +++ b/fms2_io/include/get_variable_attribute.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief Routines for retrieving variable attribute values from netcdf files with different diff --git a/fms2_io/include/netcdf_add_restart_variable.inc b/fms2_io/include/netcdf_add_restart_variable.inc index b5151fce11..de0b74a836 100644 --- a/fms2_io/include/netcdf_add_restart_variable.inc +++ b/fms2_io/include/netcdf_add_restart_variable.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief Routines to add restart variables to a netcdf file with different dimension sizes diff --git a/fms2_io/include/netcdf_read_data.inc b/fms2_io/include/netcdf_read_data.inc index b69046cc64..8b2ff2d41e 100644 --- a/fms2_io/include/netcdf_read_data.inc +++ b/fms2_io/include/netcdf_read_data.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief Routines for retrieving variable values from netcdf files with different @@ -151,6 +150,8 @@ subroutine netcdf_read_data_0d(fileobj, variable_name, buf, unlim_dim_level, & else bcast = .true. endif + if (fileobj%use_netcdf_mpi) bcast = .false. + c(1) = 1 if (present(unlim_dim_level)) then unlim_dim_index = get_variable_unlimited_dimension_index(fileobj, variable_name, & @@ -160,8 +161,15 @@ subroutine netcdf_read_data_0d(fileobj, variable_name, buf, unlim_dim_level, & endif c(unlim_dim_index) = unlim_dim_level endif + if (fileobj%is_root) then varid = get_variable_id(fileobj%ncid, trim(variable_name), msg=append_error_msg) + + if (fileobj%use_netcdf_mpi.and.fileobj%use_collective) then + err = nf90_var_par_access(fileobj%ncid, varid, nf90_collective) + call check_netcdf_code(err, append_error_msg) + endif + select type(buf) type is (integer(kind=i4_kind)) err = nf90_get_var(fileobj%ncid, varid, buf, start=c) @@ -179,6 +187,7 @@ subroutine netcdf_read_data_0d(fileobj, variable_name, buf, unlim_dim_level, & call check_netcdf_code(err, append_error_msg) call unpack_data_0d(fileobj, varid, variable_name, buf) endif + if (bcast) then select type(buf) type is (integer(kind=i4_kind)) @@ -240,6 +249,8 @@ subroutine netcdf_read_data_1d(fileobj, variable_name, buf, unlim_dim_level, & else bcast = .true. endif + if (fileobj%use_netcdf_mpi) bcast = .false. + c(:) = 1 if (present(corner)) then c(1) = corner(1) @@ -258,8 +269,15 @@ subroutine netcdf_read_data_1d(fileobj, variable_name, buf, unlim_dim_level, & endif c(unlim_dim_index) = unlim_dim_level endif + if (fileobj%is_root) then varid = get_variable_id(fileobj%ncid, trim(variable_name), msg=append_error_msg) + + if (fileobj%use_netcdf_mpi.and.fileobj%use_collective) then + err = nf90_var_par_access(fileobj%ncid, varid, nf90_collective) + call check_netcdf_code(err, append_error_msg) + endif + select type(buf) type is (integer(kind=i4_kind)) err = nf90_get_var(fileobj%ncid, varid, buf, start=c, count=e) @@ -277,6 +295,7 @@ subroutine netcdf_read_data_1d(fileobj, variable_name, buf, unlim_dim_level, & call check_netcdf_code(err, append_error_msg) call unpack_data_1d(fileobj, varid, variable_name, buf) endif + if (bcast) then select type(buf) type is (integer(kind=i4_kind)) @@ -336,6 +355,8 @@ subroutine netcdf_read_data_2d(fileobj, variable_name, buf, unlim_dim_level, & else bcast = .true. endif + if (fileobj%use_netcdf_mpi) bcast = .false. + c(:) = 1 if (present(corner)) then c(1:2) = corner(1:2) @@ -354,12 +375,15 @@ subroutine netcdf_read_data_2d(fileobj, variable_name, buf, unlim_dim_level, & endif c(unlim_dim_index) = unlim_dim_level endif - if(fileobj%use_collective) then + + if (fileobj%is_root) then varid = get_variable_id(fileobj%ncid, trim(variable_name), msg=append_error_msg) - ! NetCDF does not have the ability to specify collective I/O at - ! the file basis so we must activate at the variable level - err = nf90_var_par_access(fileobj%ncid, varid, nf90_collective) - call check_netcdf_code(err, append_error_msg) + + if (fileobj%use_netcdf_mpi.and.fileobj%use_collective) then + err = nf90_var_par_access(fileobj%ncid, varid, nf90_collective) + call check_netcdf_code(err, append_error_msg) + endif + select type(buf) type is (integer(kind=i4_kind)) err = nf90_get_var(fileobj%ncid, varid, buf, start=c, count=e) @@ -374,38 +398,21 @@ subroutine netcdf_read_data_2d(fileobj, variable_name, buf, unlim_dim_level, & end select call check_netcdf_code(err, append_error_msg) call unpack_data_2d(fileobj, varid, variable_name, buf) - else - if (fileobj%is_root) then - varid = get_variable_id(fileobj%ncid, trim(variable_name), msg=append_error_msg) - select type(buf) - type is (integer(kind=i4_kind)) - err = nf90_get_var(fileobj%ncid, varid, buf, start=c, count=e) - type is (integer(kind=i8_kind)) - err = nf90_get_var(fileobj%ncid, varid, buf, start=c, count=e) - type is (real(kind=r4_kind)) - err = nf90_get_var(fileobj%ncid, varid, buf, start=c, count=e) - type is (real(kind=r8_kind)) - err = nf90_get_var(fileobj%ncid, varid, buf, start=c, count=e) - class default - call error("Unsupported variable type: "//trim(append_error_msg)) - end select - call check_netcdf_code(err, append_error_msg) - call unpack_data_2d(fileobj, varid, variable_name, buf) - endif - if (bcast) then - select type(buf) - type is (integer(kind=i4_kind)) - call mpp_broadcast(buf, size(buf), fileobj%io_root, pelist=fileobj%pelist) - type is (integer(kind=i8_kind)) - call mpp_broadcast(buf, size(buf), fileobj%io_root, pelist=fileobj%pelist) - type is (real(kind=r4_kind)) - call mpp_broadcast(buf, size(buf), fileobj%io_root, pelist=fileobj%pelist) - type is (real(kind=r8_kind)) - call mpp_broadcast(buf, size(buf), fileobj%io_root, pelist=fileobj%pelist) - class default - call error("Unsupported variable type: "//trim(append_error_msg)) - end select - endif + endif + + if (bcast) then + select type(buf) + type is (integer(kind=i4_kind)) + call mpp_broadcast(buf, size(buf), fileobj%io_root, pelist=fileobj%pelist) + type is (integer(kind=i8_kind)) + call mpp_broadcast(buf, size(buf), fileobj%io_root, pelist=fileobj%pelist) + type is (real(kind=r4_kind)) + call mpp_broadcast(buf, size(buf), fileobj%io_root, pelist=fileobj%pelist) + type is (real(kind=r8_kind)) + call mpp_broadcast(buf, size(buf), fileobj%io_root, pelist=fileobj%pelist) + class default + call error("Unsupported variable type: "//trim(append_error_msg)) + end select endif end subroutine netcdf_read_data_2d @@ -450,6 +457,8 @@ subroutine netcdf_read_data_3d(fileobj, variable_name, buf, unlim_dim_level, & else bcast = .true. endif + if (fileobj%use_netcdf_mpi) bcast = .false. + c(:) = 1 if (present(corner)) then c(1:3) = corner(1:3) @@ -468,12 +477,15 @@ subroutine netcdf_read_data_3d(fileobj, variable_name, buf, unlim_dim_level, & endif c(unlim_dim_index) = unlim_dim_level endif - if(fileobj%use_collective) then + + if (fileobj%is_root) then varid = get_variable_id(fileobj%ncid, trim(variable_name), msg=append_error_msg) - ! NetCDF does not have the ability to specify collective I/O at - ! the file basis so we must activate at the variable level - err = nf90_var_par_access(fileobj%ncid, varid, nf90_collective) - call check_netcdf_code(err, append_error_msg) + + if (fileobj%use_netcdf_mpi.and.fileobj%use_collective) then + err = nf90_var_par_access(fileobj%ncid, varid, nf90_collective) + call check_netcdf_code(err, append_error_msg) + endif + select type(buf) type is (integer(kind=i4_kind)) err = nf90_get_var(fileobj%ncid, varid, buf, start=c, count=e) @@ -488,38 +500,21 @@ subroutine netcdf_read_data_3d(fileobj, variable_name, buf, unlim_dim_level, & end select call check_netcdf_code(err, append_error_msg) call unpack_data_3d(fileobj, varid, variable_name, buf) - else - if (fileobj%is_root) then - varid = get_variable_id(fileobj%ncid, trim(variable_name), msg=append_error_msg) - select type(buf) - type is (integer(kind=i4_kind)) - err = nf90_get_var(fileobj%ncid, varid, buf, start=c, count=e) - type is (integer(kind=i8_kind)) - err = nf90_get_var(fileobj%ncid, varid, buf, start=c, count=e) - type is (real(kind=r4_kind)) - err = nf90_get_var(fileobj%ncid, varid, buf, start=c, count=e) - type is (real(kind=r8_kind)) - err = nf90_get_var(fileobj%ncid, varid, buf, start=c, count=e) - class default - call error("Unsupported variable type: "//trim(append_error_msg)) - end select - call check_netcdf_code(err, append_error_msg) - call unpack_data_3d(fileobj, varid, variable_name, buf) - endif - if (bcast) then - select type(buf) - type is (integer(kind=i4_kind)) - call mpp_broadcast(buf, size(buf), fileobj%io_root, pelist=fileobj%pelist) - type is (integer(kind=i8_kind)) - call mpp_broadcast(buf, size(buf), fileobj%io_root, pelist=fileobj%pelist) - type is (real(kind=r4_kind)) - call mpp_broadcast(buf, size(buf), fileobj%io_root, pelist=fileobj%pelist) - type is (real(kind=r8_kind)) - call mpp_broadcast(buf, size(buf), fileobj%io_root, pelist=fileobj%pelist) - class default - call error("Unsupported variable type: "//trim(append_error_msg)) - end select - endif + endif + + if (bcast) then + select type(buf) + type is (integer(kind=i4_kind)) + call mpp_broadcast(buf, size(buf), fileobj%io_root, pelist=fileobj%pelist) + type is (integer(kind=i8_kind)) + call mpp_broadcast(buf, size(buf), fileobj%io_root, pelist=fileobj%pelist) + type is (real(kind=r4_kind)) + call mpp_broadcast(buf, size(buf), fileobj%io_root, pelist=fileobj%pelist) + type is (real(kind=r8_kind)) + call mpp_broadcast(buf, size(buf), fileobj%io_root, pelist=fileobj%pelist) + class default + call error("Unsupported variable type: "//trim(append_error_msg)) + end select endif end subroutine netcdf_read_data_3d @@ -564,6 +559,8 @@ subroutine netcdf_read_data_4d(fileobj, variable_name, buf, unlim_dim_level, & else bcast = .true. endif + if (fileobj%use_netcdf_mpi) bcast = .false. + c(:) = 1 if (present(corner)) then c(1:4) = corner(1:4) @@ -582,8 +579,15 @@ subroutine netcdf_read_data_4d(fileobj, variable_name, buf, unlim_dim_level, & endif c(unlim_dim_index) = unlim_dim_level endif + if (fileobj%is_root) then varid = get_variable_id(fileobj%ncid, trim(variable_name), msg=append_error_msg) + + if (fileobj%use_netcdf_mpi.and.fileobj%use_collective) then + err = nf90_var_par_access(fileobj%ncid, varid, nf90_collective) + call check_netcdf_code(err, append_error_msg) + endif + select type(buf) type is (integer(kind=i4_kind)) err = nf90_get_var(fileobj%ncid, varid, buf, start=c, count=e) @@ -599,6 +603,7 @@ subroutine netcdf_read_data_4d(fileobj, variable_name, buf, unlim_dim_level, & call check_netcdf_code(err, append_error_msg) call unpack_data_4d(fileobj, varid, variable_name, buf) endif + if (bcast) then select type(buf) type is (integer(kind=i4_kind)) @@ -656,6 +661,8 @@ subroutine netcdf_read_data_5d(fileobj, variable_name, buf, unlim_dim_level, & else bcast = .true. endif + if (fileobj%use_netcdf_mpi) bcast = .false. + c(:) = 1 if (present(corner)) then c(1:5) = corner(1:5) @@ -674,8 +681,15 @@ subroutine netcdf_read_data_5d(fileobj, variable_name, buf, unlim_dim_level, & endif c(unlim_dim_index) = unlim_dim_level endif + if (fileobj%is_root) then varid = get_variable_id(fileobj%ncid, trim(variable_name), msg=append_error_msg) + + if (fileobj%use_netcdf_mpi.and.fileobj%use_collective) then + err = nf90_var_par_access(fileobj%ncid, varid, nf90_collective) + call check_netcdf_code(err, append_error_msg) + endif + select type(buf) type is (integer(kind=i4_kind)) err = nf90_get_var(fileobj%ncid, varid, buf, start=c, count=e) @@ -691,6 +705,7 @@ subroutine netcdf_read_data_5d(fileobj, variable_name, buf, unlim_dim_level, & call check_netcdf_code(err, append_error_msg) call unpack_data_5d(fileobj, varid, variable_name, buf) endif + if (bcast) then select type(buf) type is (integer(kind=i4_kind)) diff --git a/fms2_io/include/netcdf_write_data.inc b/fms2_io/include/netcdf_write_data.inc index 0c5748bf3b..a922714740 100644 --- a/fms2_io/include/netcdf_write_data.inc +++ b/fms2_io/include/netcdf_write_data.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief Routines for writing variable values to netcdf files with different diff --git a/fms2_io/include/register_domain_restart_variable.inc b/fms2_io/include/register_domain_restart_variable.inc index f628d7e195..d319238b05 100644 --- a/fms2_io/include/register_domain_restart_variable.inc +++ b/fms2_io/include/register_domain_restart_variable.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief Adds domain decomposed variable for restarts for the @ref register_restart_field diff --git a/fms2_io/include/register_global_attribute.inc b/fms2_io/include/register_global_attribute.inc index e23c195380..fb26559994 100644 --- a/fms2_io/include/register_global_attribute.inc +++ b/fms2_io/include/register_global_attribute.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief Routines for different dimensions to add global attributes in netcdf files for the diff --git a/fms2_io/include/register_unstructured_domain_restart_variable.inc b/fms2_io/include/register_unstructured_domain_restart_variable.inc index b2ca435b4e..d5ad5325f2 100644 --- a/fms2_io/include/register_unstructured_domain_restart_variable.inc +++ b/fms2_io/include/register_unstructured_domain_restart_variable.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief Adds restart variable for unstructured domains for different dimension to be used in diff --git a/fms2_io/include/register_variable_attribute.inc b/fms2_io/include/register_variable_attribute.inc index 87848a84ca..32909ff9b4 100644 --- a/fms2_io/include/register_variable_attribute.inc +++ b/fms2_io/include/register_variable_attribute.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief Routines to add variable attributes for different dimensions to be used in diff --git a/fms2_io/include/scatter_data_bc.inc b/fms2_io/include/scatter_data_bc.inc index 702cc4493c..7d9704af7b 100644 --- a/fms2_io/include/scatter_data_bc.inc +++ b/fms2_io/include/scatter_data_bc.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief Routines for the @ref gather_data_bc interface diff --git a/fms2_io/include/unpack_data.inc b/fms2_io/include/unpack_data.inc index 23bc19f8bd..c0c347bda1 100644 --- a/fms2_io/include/unpack_data.inc +++ b/fms2_io/include/unpack_data.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief Routines for the @ref gather_data_bc interface diff --git a/fms2_io/include/unstructured_domain_read.inc b/fms2_io/include/unstructured_domain_read.inc index 089496f5de..9fb7dc76d4 100644 --- a/fms2_io/include/unstructured_domain_read.inc +++ b/fms2_io/include/unstructured_domain_read.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief Routines for reading unstructured domain data, used in @ref read_data interface diff --git a/fms2_io/include/unstructured_domain_write.inc b/fms2_io/include/unstructured_domain_write.inc index 9dc36166c2..29db7e0672 100644 --- a/fms2_io/include/unstructured_domain_write.inc +++ b/fms2_io/include/unstructured_domain_write.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief Routines to write data from an unstructured domain decomposition. diff --git a/fms2_io/netcdf_io.F90 b/fms2_io/netcdf_io.F90 index ff7b2e4c85..be65205eec 100644 --- a/fms2_io/netcdf_io.F90 +++ b/fms2_io/netcdf_io.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup netcdf_io_mod netcdf_io_mod !> @ingroup fms2_io @@ -30,6 +29,7 @@ module netcdf_io_mod #endif use netcdf use mpp_mod +use mpp_domains_mod use fms_io_utils_mod use platform_mod implicit none @@ -123,6 +123,17 @@ module netcdf_io_mod !! cur_dim_len(3) : z dimensions endtype dimension_information +type, public :: fmsOffloadingIn_type + !TODO should be private, need getter functions + integer, public :: id !< unique identifier for each type + integer, public, allocatable :: offloading_pes(:) !< list of pe numbers that will be used to just write + integer, public, allocatable :: model_pes(:) !< list of pe numbers that will be running the model + logical :: is_model_pe !< true if current pe is in model_pes + type(domain2D) :: domain_in !< domain for grid that is to be written out + contains + procedure :: init +endtype fmsOffloadingIn_type + !> @brief Netcdf file type. !> @ingroup netcdf_io_mod type, public :: FmsNetcdfFile_t @@ -149,11 +160,17 @@ module netcdf_io_mod character (len=20) :: time_name type(dimension_information) :: bc_dimensions ! @ingroup netcdf_io_mod interface netcdf_add_restart_variable @@ -537,8 +555,8 @@ end function get_variable_type !> @brief Open a netcdf file. !! @return .true. if open succeeds, or else .false. -function netcdf_file_open(fileobj, path, mode, nc_format, pelist, is_restart, dont_add_res_to_filename) & - result(success) +function netcdf_file_open(fileobj, path, mode, nc_format, pelist, is_restart, dont_add_res_to_filename, & + tile_comm, use_collective) result(success) class(FmsNetcdfFile_t), intent(inout) :: fileobj !< File object. character(len=*), intent(in) :: path !< File path. @@ -562,59 +580,83 @@ function netcdf_file_open(fileobj, path, mode, nc_format, pelist, is_restart, do !! is a restart file. Defaults !! to false. logical, intent(in), optional :: dont_add_res_to_filename !< Flag indicating not to add - !! ".res" to the filename + !! ".res" to the filename + integer, intent(in), optional :: tile_comm !< MPI communicator used for parallel I/O. Passing this + !! argument enables parallel I/O. + logical, intent(in), optional :: use_collective !< Flag indicating whether reads and writes should be performed + !! collectively rather than independently. logical :: success integer :: nc_format_param integer :: err integer :: netcdf4 !< Query the file for the _IsNetcdf4 global attribute in the event !! that the open for collective reads fails - character(len=FMS_PATH_LEN) :: buf !< File path with .res in the filename if it is a restart - character(len=FMS_PATH_LEN) :: buf2 !< File path with the filename appendix if there is one + character(len=FMS_PATH_LEN) :: full_path !< File path with .res in the filename if it is a restart logical :: is_res logical :: dont_add_res !< flag indicated to not add ".res" to the filename + success = .true. + + if (fms2_nc_format_param.eq.-1) then + call error("netcdf_file_open :: fms2_io has not been initialized") + endif + if (allocated(fileobj%is_open)) then - if (fileobj%is_open) then - success = .true. - return - endif + if (fileobj%is_open) return + endif + + fileobj%use_netcdf_mpi = .false. + + if (fileobj%tile_comm.ne.MPP_COMM_NULL) then + call mpp_error(NOTE, "netcdf_file_open :: Setting fileobj%tile_comm is deprecated. & + Please use open_file(..., tile_comm=...) instead.") + fileobj%use_netcdf_mpi = .true. + elseif (present(tile_comm)) then + fileobj%use_netcdf_mpi = .true. + fileobj%tile_comm = tile_comm endif + + if (fileobj%use_collective) then + fileobj%use_netcdf_mpi = .true. + call mpp_error(NOTE, "Setting fileobj%use_collective to enable collective reads is deprecated. & + Please use open_file(..., use_collective=.true.) instead.") + else + fileobj%use_collective = .false. + if (present(use_collective)) fileobj%use_collective = use_collective + endif + !< Only add ".res" to the file path if is_restart is set to true !! and dont_add_res_to_filename is set to false. is_res = .false. if (present(is_restart)) then is_res = is_restart endif + fileobj%is_restart = is_res + dont_add_res = .false. if (present(dont_add_res_to_filename)) then dont_add_res = dont_add_res_to_filename endif if (is_res .and. .not. dont_add_res) then - call restart_filepath_mangle(buf, trim(path)) + call restart_filepath_mangle(full_path, trim(path)) else - call string_copy(buf, trim(path)) + call string_copy(full_path, trim(path)) endif !< If it is a restart add the filename_appendix to the filename if (is_res) then - call get_instance_filename(trim(buf), buf2) + call get_instance_filename(trim(full_path), fileobj%path) else - call string_copy(buf2, trim(buf)) + call string_copy(fileobj%path, trim(full_path)) endif - !Check if the file exists. - success = .true. + ! Check if the file exists. if (string_compare(mode, "read", .true.) .or. string_compare(mode, "append", .true.)) then - success = file_exists(buf2) - if (.not. success) then - return - endif + success = file_exists(fileobj%path) + if (.not.success) return endif - !Store properties in the derived type. - call string_copy(fileobj%path, trim(buf2)) if (present(pelist)) then allocate(fileobj%pelist(size(pelist))) fileobj%pelist(:) = pelist(:) @@ -623,11 +665,9 @@ function netcdf_file_open(fileobj, path, mode, nc_format, pelist, is_restart, do fileobj%pelist(1) = mpp_pe() endif fileobj%io_root = fileobj%pelist(1) - fileobj%is_root = mpp_pe() .eq. fileobj%io_root + fileobj%is_root = mpp_pe().eq.fileobj%io_root fileobj%is_netcdf4 = .false. - if (fms2_ncchksz == -1) call error("netcdf_file_open:: fms2_ncchksz not set, call fms2_io_init") - if (fms2_nc_format_param == -1) call error("netcdf_file_open:: fms2_nc_format_param not set, call fms2_io_init") if (present(nc_format)) then if (string_compare(nc_format, "64bit", .true.)) then @@ -648,62 +688,48 @@ function netcdf_file_open(fileobj, path, mode, nc_format, pelist, is_restart, do fileobj%is_netcdf4 = fms2_is_netcdf4 endif - !Open the file with netcdf if this rank is the I/O root. - if (fileobj%is_root .and. .not.(fileobj%use_collective)) then - if (string_compare(mode, "read", .true.)) then - err = nf90_open(trim(fileobj%path), nf90_nowrite, fileobj%ncid, chunksize=fms2_ncchksz) - elseif (string_compare(mode, "append", .true.)) then - err = nf90_open(trim(fileobj%path), nf90_write, fileobj%ncid, chunksize=fms2_ncchksz) + if (fileobj%use_netcdf_mpi) then +#ifdef NO_NC_PARALLEL4 + call error("NetCDF was not built with HDF5 parallel I/O features, so use_netcdf_mpi cannot be used. & + &Please turn use_netcdf_mpi off for the file: " // trim(path)) +#endif + nc_format_param = ior(nc_format_param, nf90_mpiio) + endif + + if (fileobj%use_netcdf_mpi) then + ! Using MPI-IO: Every PE opens the file + if(string_compare(mode, "read", .true.)) then + err = nf90_open(trim(fileobj%path), ior(nf90_nowrite, nf90_mpiio), fileobj%ncid, & + comm=fileobj%tile_comm, info=MPP_INFO_NULL) + elseif(string_compare(mode, "append", .true.)) then + err = nf90_open(trim(fileobj%path), ior(nf90_write, nf90_mpiio), fileobj%ncid, & + comm=fileobj%tile_comm, info=MPP_INFO_NULL) elseif (string_compare(mode, "write", .true.)) then - err = nf90_create(trim(fileobj%path), ior(nf90_noclobber, nc_format_param), fileobj%ncid, chunksize=fms2_ncchksz) + err = nf90_create(trim(fileobj%path), ior(nf90_noclobber, nc_format_param), fileobj%ncid, & + comm = fileobj%tile_comm, info = MPP_INFO_NULL) elseif (string_compare(mode,"overwrite",.true.)) then - err = nf90_create(trim(fileobj%path), ior(nf90_clobber, nc_format_param), fileobj%ncid, chunksize=fms2_ncchksz) + err = nf90_create(trim(fileobj%path), ior(nf90_clobber, nc_format_param), fileobj%ncid, & + comm = fileobj%tile_comm, info = MPP_INFO_NULL) else call error("unrecognized file mode: '"//trim(mode)//"' for file:"//trim(fileobj%path)//& &"Check your open_file call, the acceptable values are read, append, write, overwrite") endif - call check_netcdf_code(err, "netcdf_file_open:"//trim(fileobj%path)) - elseif(fileobj%use_collective .and. (fileobj%tile_comm /= MPP_COMM_NULL)) then - if(string_compare(mode, "read", .true.)) then - ! Open the file for collective reads if the user requested that treatment in their application. - ! NetCDF does not have the ability to specify collective I/O at the file basis - ! so we must activate each variable in netcdf_read_data_2d() and netcdf_read_data_3d() - err = nf90_open(trim(fileobj%path), ior(NF90_NOWRITE, NF90_MPIIO), fileobj%ncid, & - comm=fileobj%tile_comm, info=MPP_INFO_NULL) - if(err /= nf90_noerr) then - err = nf90_open(trim(fileobj%path), nf90_nowrite, fileobj%ncid) - err = nf90_get_att(fileobj%ncid, nf90_global, "_IsNetcdf4", netcdf4) - err = nf90_close(fileobj%ncid) - if(netcdf4 /= 1) then - call mpp_error(NOTE,"netcdf_file_open: Open for collective read failed because the file is not & - netCDF-4 format."// & - " Falling back to parallel independent for file "// trim(fileobj%path)) - fileobj%use_collective = .false. - fileobj%tile_comm = MPP_COMM_NULL - else -#ifdef NO_NC_PARALLEL4 - call mpp_error(FATAL, "netCDF was not build with HDF5 parallel I/O features, "//& - "so collective netcdf io is not allowed. Please turn collective read off for file "//& - trim(fileobj%path)) -#endif - endif - err = nf90_open(trim(fileobj%path), nf90_nowrite, fileobj%ncid, chunksize=fms2_ncchksz) - endif + call check_netcdf_code(err, "netcdf_file_open (using netcdf mpi): "//trim(fileobj%path)) + elseif (fileobj%is_root) then + ! Not using MPI-IO: Only the root PE opens the file + if (string_compare(mode, "read", .true.)) then + err = nf90_open(trim(fileobj%path), nf90_nowrite, fileobj%ncid, chunksize=fms2_ncchksz) + elseif (string_compare(mode, "append", .true.)) then + err = nf90_open(trim(fileobj%path), nf90_write, fileobj%ncid, chunksize=fms2_ncchksz) elseif (string_compare(mode, "write", .true.)) then - call mpp_error(FATAL,"netcdf_file_open: Attempt to create a file for collective write"// & - " This feature is not implemented"// trim(fileobj%path)) - !err = nf90_create(trim(fileobj%path), ior(nf90_noclobber, nc_format_param), fileobj%ncid, & - ! comm=fileobj%tile_comm, info=MPP_INFO_NULL) + err = nf90_create(trim(fileobj%path), ior(nf90_noclobber, nc_format_param), fileobj%ncid, chunksize=fms2_ncchksz) elseif (string_compare(mode,"overwrite",.true.)) then - call mpp_error(FATAL,"netcdf_file_open: Attempt to create a file for collective overwrite"// & - " This feature is not implemented"// trim(fileobj%path)) - !err = nf90_create(trim(fileobj%path), ior(nf90_clobber, nc_format_param), fileobj%ncid, & - ! comm=fileobj%tile_comm, info=MPP_INFO_NULL) + err = nf90_create(trim(fileobj%path), ior(nf90_clobber, nc_format_param), fileobj%ncid, chunksize=fms2_ncchksz) else call error("unrecognized file mode: '"//trim(mode)//"' for file:"//trim(fileobj%path)//& &"Check your open_file call, the acceptable values are read, append, write, overwrite") endif - call check_netcdf_code(err, "netcdf_file_open:"//trim(fileobj%path)) + call check_netcdf_code(err, "netcdf_file_open: "//trim(fileobj%path)) else fileobj%ncid = missing_ncid endif @@ -711,11 +737,11 @@ function netcdf_file_open(fileobj, path, mode, nc_format, pelist, is_restart, do fileobj%is_diskless = .false. !Allocate memory. - fileobj%is_restart = is_res if (fileobj%is_restart) then allocate(fileobj%restart_vars(max_num_restart_vars)) fileobj%num_restart_vars = 0 endif + fileobj%is_readonly = string_compare(mode, "read", .true.) fileobj%mode_is_append = string_compare(mode, "append", .true.) allocate(fileobj%compressed_dims(max_num_compressed_dims)) @@ -908,7 +934,7 @@ subroutine netcdf_add_dimension(fileobj, dimension_name, dimension_length, & dim_len = sum(npes_count) endif endif - if (fileobj%is_root .and. .not. fileobj%is_readonly) then + if ((fileobj%is_root) .and. .not. fileobj%is_readonly) then call set_netcdf_mode(fileobj%ncid, define_mode) err = nf90_def_dim(fileobj%ncid, trim(dimension_name), dim_len, dimid) call check_netcdf_code(err, "Netcdf_add_dimension: file:"//trim(fileobj%path)//" dimension name:"// & @@ -1009,6 +1035,11 @@ subroutine netcdf_add_variable(fileobj, variable_name, variable_type, dimensions endif call check_netcdf_code(err, append_error_msg) endif + + if (fileobj%use_netcdf_mpi.and.fileobj%use_collective) then + err = nf90_var_par_access(fileobj%ncid, varid, nf90_collective) + call check_netcdf_code(err, append_error_msg) + endif end subroutine netcdf_add_variable @@ -2045,8 +2076,8 @@ end subroutine compressed_start_and_count include "unpack_data.inc" !> @brief Wrapper to distinguish interfaces. -function netcdf_file_open_wrap(fileobj, path, mode, nc_format, pelist, is_restart, dont_add_res_to_filename) & - result(success) +function netcdf_file_open_wrap(fileobj, path, mode, nc_format, pelist, is_restart, & + dont_add_res_to_filename) result(success) type(FmsNetcdfFile_t), intent(inout) :: fileobj !< File object. character(len=*), intent(in) :: path !< File path. @@ -2399,6 +2430,32 @@ subroutine flush_file(fileobj) endif end subroutine flush_file +!> Initialization routine for fmsOffloadingIn_type +subroutine init(this, offloading_obj_id, offloading_pes, model_pes, domain) + class(fmsOffloadingIn_type), intent(inout) :: this !< offloading object to initialize + integer, intent(in) :: offloading_obj_id !< unique id number to set + integer, intent(in) :: offloading_pes(:) !< list of pe's from current list to offload writes to + integer, intent(in) :: model_pes(:) !< list of model pe's (any pes not in offloading_pes argument) + type(domain2D) :: domain + + this%id = offloading_obj_id + allocate(this%offloading_pes(size(offloading_pes))) + this%offloading_pes = offloading_pes + allocate(this%model_pes(size(model_pes))) + this%model_pes = model_pes + + this%is_model_pe = .false. + if (any(model_pes .eq. mpp_pe())) & + this%is_model_pe = .true. + this%domain_in = domain +end subroutine +!> @brief Getter for use_netcdf_mpi +pure logical function is_file_using_netcdf_mpi(this) + class(FmsNetcdfFile_t), intent(in) :: this !< fms2io fileobj to query + + is_file_using_netcdf_mpi = this%use_netcdf_mpi +end function is_file_using_netcdf_mpi + end module netcdf_io_mod !> @} ! close documentation grouping diff --git a/fms2_io/readme.md b/fms2_io/readme.md index 5ce16da916..fc651fc1ea 100644 --- a/fms2_io/readme.md +++ b/fms2_io/readme.md @@ -14,6 +14,7 @@ Before introducing the FMS2_io module, subroutines and functions in fms_io and m - [G. Ascii_io](readme.md#g-ascii_io) - [H. FMS2_io namelist](readme.md#h-fms2_io-namelist) - [I. Chunking](readme.md#i-chunking) +- [J. MPI-IO](readme.md#j-mpi-io) ### A. FMS2_io Fileobjs FMS2_io provides three new derived types, which target the different I/O paradigms used in GFDL models. @@ -630,3 +631,15 @@ dim_names, chunsizes=chunksizes) - **NOTE: This argument is only valid with "NETCDF4" file formats, otherwise it will be ignored. You can set the netcdf file format for all files using the 'netcdf_default_format' namelist or in a per file basis by using the 'nc_format' argument in the 'open_file' call** - See the NETCDF user guide for more information: (https://cluster.earlham.edu/bccd-ng/testing/mobeen/GALAXSEEHPC/netcdf-4.1.3/man4/netcdf.html#Chunking) + +### J. MPI-IO +When opening a NetCDF-4 file, the HDF5 library's MPI-IO driver can be used by calling `open_file` with the optional +`use_netcdf_mpi=.true.` argument. When a file is opened in this manner, the I/O domain is ignored and every PE directly +performs reads or writes in parallel. In the case of parallel reads, the MPI-IO driver handles coordination and metadata +sharing among the PEs, which can improve performance compared to the standard POSIX I/O driver. Additionally, the +`use_collective=.true.` argument can be passed to `open_file` to enable collective reads/writes: this can improve I/O +performance significantly, but it requires each read/write call to run synchronously across all participating PEs (i.e., +it introduces an MPI barrier at the start of each read/write call). + +MPI-IO support is only available for NetCDF-4 files. `use_netcdf_mpi` and `use_collective` are both disabled by default. +`use_collective` has no effect unless `use_netcdf_mpi` is enabled. diff --git a/grid_utils/Makefile.am b/grid_utils/Makefile.am index 1e80ba2c13..542dd979b9 100644 --- a/grid_utils/Makefile.am +++ b/grid_utils/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the mosaic directory of the FMS diff --git a/grid_utils/constant.h b/grid_utils/constant.h index 71f5b645ce..dfadf9bd1c 100644 --- a/grid_utils/constant.h +++ b/grid_utils/constant.h @@ -1,21 +1,20 @@ /*********************************************************************** - * GNU Lesser General Public License + * Apache License 2.0 * * This file is part of the GFDL Flexible Modeling System (FMS). * - * FMS is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or (at - * your option) any later version. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * FMS is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Lesser General Public - * License along with FMS. If not, see . - **********************************************************************/ + * FMS is distributed in the hope that it will be useful, but WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the License for the specific language + * governing permissions and limitations under the License. + ***********************************************************************/ #define RADIUS (6371000.) #define STRING 255 diff --git a/grid_utils/gradient.F90 b/grid_utils/gradient.F90 index 6e1f72532d..a827544f95 100644 --- a/grid_utils/gradient.F90 +++ b/grid_utils/gradient.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup gradient_mod gradient_mod !> @ingroup mosaic diff --git a/grid_utils/gradient_c2l.c b/grid_utils/gradient_c2l.c index 1afb15e9cf..d53a318c0e 100644 --- a/grid_utils/gradient_c2l.c +++ b/grid_utils/gradient_c2l.c @@ -1,21 +1,20 @@ /*********************************************************************** - * GNU Lesser General Public License + * Apache License 2.0 * * This file is part of the GFDL Flexible Modeling System (FMS). * - * FMS is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or (at - * your option) any later version. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * FMS is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Lesser General Public - * License along with FMS. If not, see . - **********************************************************************/ + * FMS is distributed in the hope that it will be useful, but WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the License for the specific language + * governing permissions and limitations under the License. + ***********************************************************************/ #include #include #include "constant.h" diff --git a/grid_utils/gradient_c2l.h b/grid_utils/gradient_c2l.h index 67810914c4..bb27cac701 100644 --- a/grid_utils/gradient_c2l.h +++ b/grid_utils/gradient_c2l.h @@ -1,21 +1,20 @@ /*********************************************************************** - * GNU Lesser General Public License + * Apache License 2.0 * * This file is part of the GFDL Flexible Modeling System (FMS). * - * FMS is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or (at - * your option) any later version. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * FMS is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Lesser General Public - * License along with FMS. If not, see . - **********************************************************************/ + * FMS is distributed in the hope that it will be useful, but WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the License for the specific language + * governing permissions and limitations under the License. + ***********************************************************************/ #ifndef GRADIENT_H_ #define GRADIENT_H_ diff --git a/grid_utils/grid_utils.c b/grid_utils/grid_utils.c index b2693054e5..b19279b09d 100644 --- a/grid_utils/grid_utils.c +++ b/grid_utils/grid_utils.c @@ -1,21 +1,20 @@ /*********************************************************************** - * GNU Lesser General Public License + * Apache License 2.0 * * This file is part of the GFDL Flexible Modeling System (FMS). * - * FMS is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or (at - * your option) any later version. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * FMS is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Lesser General Public - * License along with FMS. If not, see . - **********************************************************************/ + * FMS is distributed in the hope that it will be useful, but WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the License for the specific language + * governing permissions and limitations under the License. + ***********************************************************************/ #include #include #include diff --git a/grid_utils/grid_utils.h b/grid_utils/grid_utils.h index d6d9e91046..5630447985 100644 --- a/grid_utils/grid_utils.h +++ b/grid_utils/grid_utils.h @@ -1,21 +1,20 @@ /*********************************************************************** - * GNU Lesser General Public License + * Apache License 2.0 * * This file is part of the GFDL Flexible Modeling System (FMS). * - * FMS is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or (at - * your option) any later version. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * FMS is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Lesser General Public - * License along with FMS. If not, see . - **********************************************************************/ + * FMS is distributed in the hope that it will be useful, but WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the License for the specific language + * governing permissions and limitations under the License. + ***********************************************************************/ /*********************************************************************** mosaic_util.h This header file provide some utilities routine that will be used in many tools. diff --git a/grid_utils/tree_utils.c b/grid_utils/tree_utils.c index 96cac1ab06..f3be4dbfcb 100644 --- a/grid_utils/tree_utils.c +++ b/grid_utils/tree_utils.c @@ -1,21 +1,20 @@ /*********************************************************************** - * GNU Lesser General Public License + * Apache License 2.0 * * This file is part of the GFDL Flexible Modeling System (FMS). * - * FMS is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or (at - * your option) any later version. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * FMS is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Lesser General Public - * License along with FMS. If not, see . - **********************************************************************/ + * FMS is distributed in the hope that it will be useful, but WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the License for the specific language + * governing permissions and limitations under the License. + ***********************************************************************/ #include #include #include diff --git a/grid_utils/tree_utils.h b/grid_utils/tree_utils.h index 572fe0a350..ca33a5a9db 100644 --- a/grid_utils/tree_utils.h +++ b/grid_utils/tree_utils.h @@ -1,21 +1,20 @@ /*********************************************************************** - * GNU Lesser General Public License + * Apache License 2.0 * * This file is part of the GFDL Flexible Modeling System (FMS). * - * FMS is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or (at - * your option) any later version. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * FMS is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Lesser General Public - * License along with FMS. If not, see . - **********************************************************************/ + * FMS is distributed in the hope that it will be useful, but WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the License for the specific language + * governing permissions and limitations under the License. + ***********************************************************************/ /*********************************************************************** mosaic_util.h This header file provide some utilities routine that will be used in many tools. diff --git a/horiz_interp/Makefile.am b/horiz_interp/Makefile.am index 3c5289e62a..cd1a2f5968 100644 --- a/horiz_interp/Makefile.am +++ b/horiz_interp/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the horiz_interp directory of the FMS diff --git a/horiz_interp/horiz_interp.F90 b/horiz_interp/horiz_interp.F90 index ec0250e629..9bdbb91ce5 100644 --- a/horiz_interp/horiz_interp.F90 +++ b/horiz_interp/horiz_interp.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup horiz_interp_mod horiz_interp_mod !> @ingroup horiz_interp diff --git a/horiz_interp/horiz_interp_bicubic.F90 b/horiz_interp/horiz_interp_bicubic.F90 index b4e8778cd1..d567506c09 100644 --- a/horiz_interp/horiz_interp_bicubic.F90 +++ b/horiz_interp/horiz_interp_bicubic.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup horiz_interp_bicubic_mod horiz_interp_bicubic_mod !> @ingroup horiz_interp diff --git a/horiz_interp/horiz_interp_bilinear.F90 b/horiz_interp/horiz_interp_bilinear.F90 index d8db732b22..d0d8a15cc1 100644 --- a/horiz_interp/horiz_interp_bilinear.F90 +++ b/horiz_interp/horiz_interp_bilinear.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup horiz_interp_bilinear_mod horiz_interp_bilinear_mod !> @ingroup horiz_interp @@ -71,6 +70,7 @@ module horiz_interp_bilinear_mod !> @{ real(r8_kind), parameter :: epsln=1.e-10_r8_kind + real(r4_kind), parameter :: epsln_r4=1.e-4_r4_kind integer, parameter :: DUMMY = -999 !! Private helper routines, interfaces for mixed real precision support diff --git a/horiz_interp/horiz_interp_conserve.F90 b/horiz_interp/horiz_interp_conserve.F90 index 5f345e9769..4efac0031e 100644 --- a/horiz_interp/horiz_interp_conserve.F90 +++ b/horiz_interp/horiz_interp_conserve.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup horiz_interp_conserve_mod horiz_interp_conserve_mod !> @ingroup horiz_interp diff --git a/horiz_interp/horiz_interp_spherical.F90 b/horiz_interp/horiz_interp_spherical.F90 index 28110d343b..8e5a58459e 100644 --- a/horiz_interp/horiz_interp_spherical.F90 +++ b/horiz_interp/horiz_interp_spherical.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup horiz_interp_spherical_mod horiz_interp_spherical_mod !> @ingroup horiz_interp diff --git a/horiz_interp/horiz_interp_type.F90 b/horiz_interp/horiz_interp_type.F90 index a2bc90a821..a59eecf3db 100644 --- a/horiz_interp/horiz_interp_type.F90 +++ b/horiz_interp/horiz_interp_type.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup horiz_interp_type_mod horiz_interp_type_mod !> @ingroup horiz_interp diff --git a/horiz_interp/include/horiz_interp.inc b/horiz_interp/include/horiz_interp.inc index c3fe335b14..2067bb07a6 100644 --- a/horiz_interp/include/horiz_interp.inc +++ b/horiz_interp/include/horiz_interp.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup horiz_interp_mod !> @{ diff --git a/horiz_interp/include/horiz_interp_bicubic.inc b/horiz_interp/include/horiz_interp_bicubic.inc index e4f180c657..934ef87e5b 100644 --- a/horiz_interp/include/horiz_interp_bicubic.inc +++ b/horiz_interp/include/horiz_interp_bicubic.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup horiz_interp_bicubic_mod !> @{ diff --git a/horiz_interp/include/horiz_interp_bicubic_r4.fh b/horiz_interp/include/horiz_interp_bicubic_r4.fh index bc9c0037d7..25dc1990db 100644 --- a/horiz_interp/include/horiz_interp_bicubic_r4.fh +++ b/horiz_interp/include/horiz_interp_bicubic_r4.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup horiz_interp_bicubic !> @{ diff --git a/horiz_interp/include/horiz_interp_bicubic_r8.fh b/horiz_interp/include/horiz_interp_bicubic_r8.fh index e37a234bf5..766b55efd6 100644 --- a/horiz_interp/include/horiz_interp_bicubic_r8.fh +++ b/horiz_interp/include/horiz_interp_bicubic_r8.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup horiz_interp_bicubic !> @{ diff --git a/horiz_interp/include/horiz_interp_bilinear.inc b/horiz_interp/include/horiz_interp_bilinear.inc index f998b823f7..d746fcafab 100644 --- a/horiz_interp/include/horiz_interp_bilinear.inc +++ b/horiz_interp/include/horiz_interp_bilinear.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup horiz_interp_bilinear_mod !> @{ @@ -270,7 +269,11 @@ epsln2 = real(epsln,FMS_HI_KIND_)* 1.0e5_kindl call FIND_NEIGHBOR_NEW_(Interp, lon_in, lat_in, lon_out, lat_out, src_is_modulo, no_crash) else - epsln2 = real(epsln,FMS_HI_KIND_) + if(kindl == r8_kind) then + epsln2 = epsln + else + epsln2 = epsln_r4 + endif call FIND_NEIGHBOR_(Interp, lon_in, lat_in, lon_out, lat_out, src_is_modulo) endif @@ -389,8 +392,17 @@ if (x > 1.0_kindl) x = 1.0_kindl if (y > 1.0_kindl) y = 1.0_kindl endif - if( x>1.0_kindl .or. x<0.0_kindl .or. y>1.0_kindl .or. y < 0.0_kindl) & - call mpp_error(FATAL, "horiz_interp_bilinear_mod: weight should be between 0 and 1") + !! if using 4 byte reals, allow a bit more tolerance (1e-4) on weight values + if( kindl == r8_kind ) then + if( x>1.0_kindl .or. x<0.0_kindl .or. y>1.0_kindl .or. y < 0.0_kindl) & + call mpp_error(FATAL, "horiz_interp_bilinear_mod: weight should be between 0 and 1, x=" & + //string(x)//" y="//string(y)) + else + if( x>1.0_kindl + epsln2 .or. x<0.0_kindl - epsln2 .or. & + y>1.0_kindl + epsln2 .or. y < 0.0_kindl - epsln2) & + call mpp_error(FATAL, "horiz_interp_bilinear_mod: weight should be between 0 and 1, x=" & + //string(x)//" y="//string(y)) + endif Interp % HI_KIND_TYPE_ % wti(m,n,1)=1.0_kindl-x Interp % HI_KIND_TYPE_ % wti(m,n,2)=x Interp % HI_KIND_TYPE_ % wtj(m,n,1)=1.0_kindl-y diff --git a/horiz_interp/include/horiz_interp_bilinear_r4.fh b/horiz_interp/include/horiz_interp_bilinear_r4.fh index 36c462a057..784d749f8a 100644 --- a/horiz_interp/include/horiz_interp_bilinear_r4.fh +++ b/horiz_interp/include/horiz_interp_bilinear_r4.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup horiz_interp_bilinear !> @{ diff --git a/horiz_interp/include/horiz_interp_bilinear_r8.fh b/horiz_interp/include/horiz_interp_bilinear_r8.fh index 05187557fc..4b62e02890 100644 --- a/horiz_interp/include/horiz_interp_bilinear_r8.fh +++ b/horiz_interp/include/horiz_interp_bilinear_r8.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup horiz_interp_bilinear !> @{ diff --git a/horiz_interp/include/horiz_interp_conserve.inc b/horiz_interp/include/horiz_interp_conserve.inc index 1d2212dabc..0cd61eb3c7 100644 --- a/horiz_interp/include/horiz_interp_conserve.inc +++ b/horiz_interp/include/horiz_interp_conserve.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup horiz_interp_conserve_mod !> @{ @@ -246,17 +245,12 @@ subroutine HORIZ_INTERP_CONSERVE_NEW_1DX1D_ ( Interp, lon_in, lat_in, lon_out, l integer :: nincrease, ndecrease logical :: flip_lat - integer :: wordsz integer(kind=1) :: one_byte(8) integer, parameter :: kindl = FMS_HI_KIND_ !< compiled kind size if(.not. module_is_initialized) call mpp_error(FATAL, & 'HORIZ_INTERP_CONSERVE_NEW_1DX2D_: horiz_interp_conserve_init is not called') - wordsz=size(transfer(lon_in(1), one_byte)) - if(wordsz .NE. 4 .AND. wordsz .NE. 8) call mpp_error(FATAL, & - 'HORIZ_INTERP_CONSERVE_NEW_1DX2D_: wordsz should be 4 or 8') - if( (size(lon_out,1) .NE. size(lat_out,1)) .OR. (size(lon_out,2) .NE. size(lat_out,2)) ) & call mpp_error(FATAL, 'horiz_interp_conserve_mod: size mismatch between lon_out and lat_out') nlon_in = size(lon_in(:)) - 1; nlat_in = size(lat_in(:)) - 1 @@ -413,17 +407,12 @@ subroutine HORIZ_INTERP_CONSERVE_NEW_1DX1D_ ( Interp, lon_in, lat_in, lon_out, l real(r8_kind), allocatable, dimension(:) :: lon_out_r8, lat_out_r8 real(r8_kind), allocatable, dimension(:,:) :: lon_in_r8, lat_in_r8 real(r8_kind), allocatable, dimension(:,:) :: lon_dst, lat_dst - integer :: wordsz integer(kind=1) :: one_byte(8) integer, parameter :: kindl = FMS_HI_KIND_ !< compiled kind size if(.not. module_is_initialized) call mpp_error(FATAL, & 'HORIZ_INTERP_CONSERVE_NEW_2DX1D_: horiz_interp_conserve_init is not called') - wordsz=size(transfer(lon_in(1,1), one_byte)) - if(wordsz .NE. 8) call mpp_error(FATAL, & - 'HORIZ_INTERP_CONSERVE_NEW_2DX1D_: currently only support 64-bit real(FMS_HI_KIND_), contact developer') - if( (size(lon_in,1) .NE. size(lat_in,1)) .OR. (size(lon_in,2) .NE. size(lat_in,2)) ) & call mpp_error(FATAL, 'horiz_interp_conserve_mod: size mismatch between lon_in and lat_in') nlon_in = size(lon_in,1) - 1; nlat_in = size(lon_in,2) - 1 @@ -524,17 +513,12 @@ subroutine HORIZ_INTERP_CONSERVE_NEW_1DX1D_ ( Interp, lon_in, lat_in, lon_out, l real(r8_kind), allocatable, dimension(:,:) :: dst_area real(r8_kind), allocatable, dimension(:,:) :: lon_in_r8, lat_in_r8 real(r8_kind), allocatable, dimension(:,:) :: lon_out_r8, lat_out_r8 - integer :: wordsz integer(kind=1) :: one_byte(8) integer, parameter :: kindl = FMS_HI_KIND_ !< compiled kind size if(.not. module_is_initialized) call mpp_error(FATAL, & 'HORIZ_INTERP_CONSERVE_NEW_2DX2D_: horiz_interp_conserve_init is not called') - wordsz=size(transfer(lon_in(1,1), one_byte)) - if(wordsz .NE. 4 .AND. wordsz .NE. 8) call mpp_error(FATAL, & - 'HORIZ_INTERP_CONSERVE_NEW_2DX2D_: wordsz should be 4 or 8') - if( (size(lon_in,1) .NE. size(lat_in,1)) .OR. (size(lon_in,2) .NE. size(lat_in,2)) ) & call mpp_error(FATAL, 'horiz_interp_conserve_mod: size mismatch between lon_in and lat_in') if( (size(lon_out,1) .NE. size(lat_out,1)) .OR. (size(lon_out,2) .NE. size(lat_out,2)) ) & diff --git a/horiz_interp/include/horiz_interp_conserve_r4.fh b/horiz_interp/include/horiz_interp_conserve_r4.fh index a4531b7824..387a85cf31 100644 --- a/horiz_interp/include/horiz_interp_conserve_r4.fh +++ b/horiz_interp/include/horiz_interp_conserve_r4.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup horiz_interp_conserve !> @{ diff --git a/horiz_interp/include/horiz_interp_conserve_r8.fh b/horiz_interp/include/horiz_interp_conserve_r8.fh index a1646ff95d..e82aba109c 100644 --- a/horiz_interp/include/horiz_interp_conserve_r8.fh +++ b/horiz_interp/include/horiz_interp_conserve_r8.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup horiz_interp_conserve !> @{ diff --git a/horiz_interp/include/horiz_interp_conserve_xgrid.c b/horiz_interp/include/horiz_interp_conserve_xgrid.c index 9b7233ea13..51c4844781 100644 --- a/horiz_interp/include/horiz_interp_conserve_xgrid.c +++ b/horiz_interp/include/horiz_interp_conserve_xgrid.c @@ -1,21 +1,20 @@ /*********************************************************************** - * GNU Lesser General Public License + * Apache License 2.0 * * This file is part of the GFDL Flexible Modeling System (FMS). * - * FMS is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or (at - * your option) any later version. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * FMS is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Lesser General Public - * License along with FMS. If not, see . - **********************************************************************/ + * FMS is distributed in the hope that it will be useful, but WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the License for the specific language + * governing permissions and limitations under the License. + ***********************************************************************/ #include #include #include diff --git a/horiz_interp/include/horiz_interp_conserve_xgrid.h b/horiz_interp/include/horiz_interp_conserve_xgrid.h index 4711723357..4aeab07e89 100644 --- a/horiz_interp/include/horiz_interp_conserve_xgrid.h +++ b/horiz_interp/include/horiz_interp_conserve_xgrid.h @@ -1,21 +1,20 @@ /*********************************************************************** - * GNU Lesser General Public License + * Apache License 2.0 * * This file is part of the GFDL Flexible Modeling System (FMS). * - * FMS is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or (at - * your option) any later version. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * FMS is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Lesser General Public - * License along with FMS. If not, see . - **********************************************************************/ + * FMS is distributed in the hope that it will be useful, but WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the License for the specific language + * governing permissions and limitations under the License. + ***********************************************************************/ #ifndef HORIZ_INTERP_CREATE_XGRID_H_ #define HORIZ_INTERP_CREATE_XGRID_H_ diff --git a/horiz_interp/include/horiz_interp_r4.fh b/horiz_interp/include/horiz_interp_r4.fh index 89b3e60559..770f660ed7 100644 --- a/horiz_interp/include/horiz_interp_r4.fh +++ b/horiz_interp/include/horiz_interp_r4.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup horiz_interp !> @{ diff --git a/horiz_interp/include/horiz_interp_r8.fh b/horiz_interp/include/horiz_interp_r8.fh index 312a31403a..2114b829d3 100644 --- a/horiz_interp/include/horiz_interp_r8.fh +++ b/horiz_interp/include/horiz_interp_r8.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup horiz_interp !> @{ diff --git a/horiz_interp/include/horiz_interp_spherical.inc b/horiz_interp/include/horiz_interp_spherical.inc index f848622a7c..8419fc9bf3 100644 --- a/horiz_interp/include/horiz_interp_spherical.inc +++ b/horiz_interp/include/horiz_interp_spherical.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup horiz_interp_spherical_mod !> @{ diff --git a/horiz_interp/include/horiz_interp_spherical_r4.fh b/horiz_interp/include/horiz_interp_spherical_r4.fh index b3c58dd1c9..39d26cd4ef 100644 --- a/horiz_interp/include/horiz_interp_spherical_r4.fh +++ b/horiz_interp/include/horiz_interp_spherical_r4.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup horiz_interp_spherical !> @{ diff --git a/horiz_interp/include/horiz_interp_spherical_r8.fh b/horiz_interp/include/horiz_interp_spherical_r8.fh index eeaf615b0c..669cfc17ab 100644 --- a/horiz_interp/include/horiz_interp_spherical_r8.fh +++ b/horiz_interp/include/horiz_interp_spherical_r8.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup horiz_interp_spherical !> @{ diff --git a/horiz_interp/include/horiz_interp_type.inc b/horiz_interp/include/horiz_interp_type.inc index 38a48b43ea..f0f0984717 100644 --- a/horiz_interp/include/horiz_interp_type.inc +++ b/horiz_interp/include/horiz_interp_type.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup horiz_interp_type_mod !> @{ diff --git a/horiz_interp/include/horiz_interp_type_r4.fh b/horiz_interp/include/horiz_interp_type_r4.fh index 1df83b8653..5c0458414c 100644 --- a/horiz_interp/include/horiz_interp_type_r4.fh +++ b/horiz_interp/include/horiz_interp_type_r4.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup horiz_interp_type !> @{ diff --git a/horiz_interp/include/horiz_interp_type_r8.fh b/horiz_interp/include/horiz_interp_type_r8.fh index e2ceb3a8be..872a4746ea 100644 --- a/horiz_interp/include/horiz_interp_type_r8.fh +++ b/horiz_interp/include/horiz_interp_type_r8.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup horiz_interp_type !> @{ diff --git a/include/file_version.h b/include/file_version.h index 794fc707f7..798cef7eca 100644 --- a/include/file_version.h +++ b/include/file_version.h @@ -1,21 +1,20 @@ ! -*-f90-*- !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** #ifdef _FILE_VERSION diff --git a/include/fms_platform.h b/include/fms_platform.h index 9a473f49f8..c5d3b8abca 100644 --- a/include/fms_platform.h +++ b/include/fms_platform.h @@ -1,21 +1,20 @@ ! -*-f90-*-* !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** #ifndef __FMS_PLATFORM_ @@ -80,11 +79,13 @@ use,intrinsic :: iso_c_binding, only: c_double,c_float,c_int64_t, & !If you do not want to use 64-bit integers. #ifdef no_8byte_integers +#undef LONG_KIND #define LONG_KIND INT_KIND #endif !If you want to use quad-precision. #ifndef ENABLE_QUAD_PRECISION +#undef QUAD_KIND #define QUAD_KIND DOUBLE_KIND #endif diff --git a/interpolator/Makefile.am b/interpolator/Makefile.am index c9d7bacc7b..a0b31bb8b9 100644 --- a/interpolator/Makefile.am +++ b/interpolator/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the interpolator directory of the FMS diff --git a/interpolator/include/interpolator.inc b/interpolator/include/interpolator.inc index a60512fd6c..fca7b66092 100644 --- a/interpolator/include/interpolator.inc +++ b/interpolator/include/interpolator.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup interpolator_mod interpolator_mod !> @ingroup interpolator @@ -68,6 +67,42 @@ logical, intent(out), optional :: single_year_file ! to the interpolator routine. ! clim_units :: A list of the units for the components listed in data_names. ! + +character(len=FMS_FILE_LEN) :: src_file +!++lwh +real(FMS_INTP_KIND_) :: dlat, dlon +!--lwh +type(time_type) :: base_time +integer :: fileday, filemon, fileyr, filehr, filemin,filesec, m,m1 +character(len= 20) :: fileunits +character(len=128) :: var_dimname(6) +character(len=128), allocatable :: var_names(:) +integer, allocatable :: var_ndims(:) +integer :: j, i +logical :: non_monthly +character(len=24) :: file_calendar +character(len=256) :: error_mesg +integer :: model_calendar +integer :: yr, mo, dy, hr, mn, sc +integer :: n +type(time_type) :: Julian_time, Noleap_time +real(r8_kind), allocatable :: time_in(:) +real(FMS_INTP_KIND_), allocatable, save :: agrid_mod(:,:,:) +integer :: nx, ny +type(FmsNetcdfFile_t) :: fileobj + +integer, parameter :: lkind=FMS_INTP_KIND_ +real(FMS_INTP_KIND_), parameter :: lPI=real(PI,FMS_INTP_KIND_) + +!> variables used to set time +logical :: yearly !< flags to indicate if time data is in units of months or years +integer :: num_years !< number of years +integer :: base_year, base_month, base_day, base_hour, base_minute, base_second +integer :: nn !< counter +logical :: noleap_file_calendar !< is the file calendar noleap or julian +real(r8_kind) :: num_days, frac_year !< variables for yearly=.true. +type(time_type) :: n_time !< temporary time + integer :: io, ierr if (.not. module_is_initialized) then @@ -106,62 +141,6 @@ endif clim_type%FMS_INTP_TYPE_%is_allocated = .true. -call fms2io_interpolator_init(clim_type, file_name, lonb_mod, latb_mod, & - data_names, data_out_of_bounds, & - vert_interp, clim_units, single_year_file) - -end subroutine INTERPOLATOR_INIT_ - -subroutine FMS2IO_INTERPOLATOR_INIT_(clim_type, file_name, lonb_mod, latb_mod, & - data_names, data_out_of_bounds, & - vert_interp, clim_units, single_year_file) - -type(interpolate_type), intent(inout) :: clim_type -character(len=*), intent(in) :: file_name -real(FMS_INTP_KIND_) , intent(in) :: lonb_mod(:,:), latb_mod(:,:) -character(len=*), intent(in) , optional :: data_names(:) -!++lwh -integer , intent(in) :: data_out_of_bounds(:) -integer , intent(in), optional :: vert_interp(:) -!--lwh -character(len=*), intent(out), optional :: clim_units(:) -logical, intent(out), optional :: single_year_file - -character(len=FMS_FILE_LEN) :: src_file -!++lwh -real(FMS_INTP_KIND_) :: dlat, dlon -!--lwh -type(time_type) :: base_time -integer :: fileday, filemon, fileyr, filehr, filemin,filesec, m,m1 -character(len= 20) :: fileunits -character(len=128) :: var_dimname(6) -character(len=128), allocatable :: var_names(:) -integer, allocatable :: var_ndims(:) -integer :: j, i -logical :: non_monthly -character(len=24) :: file_calendar -character(len=256) :: error_mesg -integer :: model_calendar -integer :: yr, mo, dy, hr, mn, sc -integer :: n -type(time_type) :: Julian_time, Noleap_time -real(r8_kind), allocatable :: time_in(:) -real(FMS_INTP_KIND_), allocatable, save :: agrid_mod(:,:,:) -integer :: nx, ny -type(FmsNetcdfFile_t) :: fileobj - -integer, parameter :: lkind=FMS_INTP_KIND_ -real(FMS_INTP_KIND_), parameter :: lPI=real(PI,FMS_INTP_KIND_) - -!> variables used to set time -logical :: yearly !< flags to indicate if time data is in units of months or years -integer :: num_years !< number of years -integer :: base_year, base_month, base_day, base_hour, base_minute, base_second -integer :: nn !< counter -logical :: noleap_file_calendar !< is the file calendar noleap or julian -real(r8_kind) :: num_days, frac_year !< variables for yearly=.true. -type(time_type) :: n_time !< temporary time - clim_type%separate_time_vary_calc = .false. num_fields = 0 @@ -844,7 +823,7 @@ if (present (single_year_file)) then single_year_file = clim_type%climatological_year endif -end subroutine FMS2IO_INTERPOLATOR_INIT_ +end subroutine INTERPOLATOR_INIT_ subroutine GET_AXIS_LATLON_DATA_(fileobj, name, latlon_data) type(FmsNetcdfFile_t), intent(in) :: fileobj diff --git a/interpolator/include/interpolator_r4.fh b/interpolator/include/interpolator_r4.fh index f0ab958f5f..0ff356dd44 100644 --- a/interpolator/include/interpolator_r4.fh +++ b/interpolator/include/interpolator_r4.fh @@ -7,9 +7,6 @@ #undef INTERPOLATOR_INIT_ #define INTERPOLATOR_INIT_ interpolator_init_r4 -#undef FMS2IO_INTERPOLATOR_INIT_ -#define FMS2IO_INTERPOLATOR_INIT_ fms2io_interpolator_init_r4 - #undef GET_AXIS_LATLON_DATA_ #define GET_AXIS_LATLON_DATA_ get_axis_latlon_data_r4 diff --git a/interpolator/include/interpolator_r8.fh b/interpolator/include/interpolator_r8.fh index 4aeb81e532..1e881b3ef1 100644 --- a/interpolator/include/interpolator_r8.fh +++ b/interpolator/include/interpolator_r8.fh @@ -7,9 +7,6 @@ #undef INTERPOLATOR_INIT_ #define INTERPOLATOR_INIT_ interpolator_init_r8 -#undef FMS2IO_INTERPOLATOR_INIT_ -#define FMS2IO_INTERPOLATOR_INIT_ fms2io_interpolator_init_r8 - #undef GET_AXIS_LATLON_DATA_ #define GET_AXIS_LATLON_DATA_ get_axis_latlon_data_r8 diff --git a/interpolator/interpolator.F90 b/interpolator/interpolator.F90 index e645e89545..e37528e83d 100644 --- a/interpolator/interpolator.F90 +++ b/interpolator/interpolator.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup interpolator_mod interpolator_mod !> @ingroup interpolator @@ -172,11 +171,6 @@ module interpolator_mod module procedure interpolator_init_r8 end interface interpolator_init -interface fms2io_interpolator_init - module procedure fms2io_interpolator_init_r4 - module procedure fms2io_interpolator_init_r8 -end interface fms2io_interpolator_init - interface get_axis_latlon_data module procedure get_axis_latlon_data_r4 module procedure get_axis_latlon_data_r8 diff --git a/libFMS.F90 b/libFMS.F90 index eba1628925..8fe1fb4c99 100644 --- a/libFMS.F90 +++ b/libFMS.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup FMS FMS !> @ingroup libfms @@ -291,7 +290,7 @@ module fms fms_field_manager_fm_find_methods => fm_find_methods, & fms_field_manager_fm_copy_list => fm_copy_list, & fms_field_manager_fm_field_name_len => fm_field_name_len, & - fms_field_manager_fm_path_name_len => fm_path_name_len, & + !fms_field_manager_fm_path_name_len => fm_path_name_len, & fms_field_manager_fm_string_len => fm_string_len, & fms_field_manager_fm_type_name_len => fm_type_name_len, & NUM_MODELS, NO_FIELD, MODEL_ATMOS, MODEL_OCEAN, MODEL_LAND, MODEL_ICE, MODEL_COUPLER, & @@ -702,7 +701,7 @@ module fms !> platform use platform_mod, only: r8_kind, r4_kind, i8_kind, i4_kind, c8_kind, c4_kind, & - l8_kind, l4_kind, i2_kind, ptr_kind + l8_kind, l4_kind, i2_kind, ptr_kind, FMS_PATH_LEN !> random_numbers use random_numbers_mod, only: fms_random_numbers_randomNumberStream => randomNumberStream, & diff --git a/libFMS/Makefile.am b/libFMS/Makefile.am index 536e41177f..849a68f423 100644 --- a/libFMS/Makefile.am +++ b/libFMS/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the libFMS directory of the FMS @@ -28,7 +27,7 @@ lib_LTLIBRARIES = libFMS.la # These linker flags specify libtool version info. # See http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning # for information regarding incrementing `-version-info`. -libFMS_la_LDFLAGS = -version-info 23:0:0 +libFMS_la_LDFLAGS = -version-info 26:0:0 # Add the convenience libraries to the FMS library. libFMS_la_LIBADD = $(top_builddir)/platform/libplatform.la @@ -64,6 +63,7 @@ libFMS_la_LIBADD += $(top_builddir)/diag_integral/libdiag_integral.la libFMS_la_LIBADD += $(top_builddir)/sat_vapor_pres/libsat_vapor_pres.la libFMS_la_LIBADD += $(top_builddir)/parser/libparser.la libFMS_la_LIBADD += $(top_builddir)/string_utils/libstring_utils.la +libFMS_la_LIBADD += $(top_builddir)/offloading/liboffload.la libFMS_la_LIBADD += $(top_builddir)/libFMS_mod.la libFMS_la_SOURCES = diff --git a/m4/gx_compiler_bug_checks.m4 b/m4/gx_compiler_bug_checks.m4 index 7c046714db..bdd8ee0101 100644 --- a/m4/gx_compiler_bug_checks.m4 +++ b/m4/gx_compiler_bug_checks.m4 @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # =========================================================================== @@ -32,18 +31,17 @@ # # Copyright (c) 2020 Seth Underwood , @uramirez8707 # -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. +# http://www.apache.org/licenses/LICENSE-2.0 # -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. # GX_FC_CLASS_CHAR_ARRAY_BUG_CHECK([ACTION-IF-BUG-PRESENT = FAILURE]) # ---------------------------------------------------------------------- diff --git a/m4/gx_f08_support.m4 b/m4/gx_f08_support.m4 index b19b60aeb8..75eb480d42 100644 --- a/m4/gx_f08_support.m4 +++ b/m4/gx_f08_support.m4 @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # =========================================================================== @@ -31,28 +30,19 @@ # # LICENSE # -# Copyright (c) 2020 Seth Underwood +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 3 of the License, or (at your -# option) any later version. +# http://www.apache.org/licenses/LICENSE-2.0 # -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. # -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. +# Copyright (c) 2020 Seth Underwood # GX_FC_08_OPEN_NEWUNIT([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE]) # ---------------------------------------------------------------------- diff --git a/m4/gx_fortran_legacy_options.m4 b/m4/gx_fortran_legacy_options.m4 index cd7ed2e8df..225cca59fa 100644 --- a/m4/gx_fortran_legacy_options.m4 +++ b/m4/gx_fortran_legacy_options.m4 @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # =========================================================================== @@ -30,28 +29,19 @@ # # LICENSE # -# Copyright (c) 2022 Seth Underwood +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 3 of the License, or (at your -# option) any later version. +# http://www.apache.org/licenses/LICENSE-2.0 # -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. # -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. +# Copyright (c) 2022 Seth Underwood # GX_FC_ALLOW_ARG_MISMATCH([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE]) # ---------------------------------------------------------------------- diff --git a/m4/gx_fortran_options.m4 b/m4/gx_fortran_options.m4 index 65fd4e43da..3645ec4de8 100644 --- a/m4/gx_fortran_options.m4 +++ b/m4/gx_fortran_options.m4 @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # =========================================================================== @@ -37,28 +36,19 @@ # # LICENSE # -# Copyright (c) 2019,2020 Seth Underwood +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 3 of the License, or (at your -# option) any later version. +# http://www.apache.org/licenses/LICENSE-2.0 # -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. # -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. +# Copyright (c) 2019,2020 Seth Underwood # GX_FC_DEFAULT_REAL_KIND8_FLAG([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE]) # ---------------------------------------------------------------------- diff --git a/m4/gx_mpi.m4 b/m4/gx_mpi.m4 index 9bff135fe0..f5693b2c0b 100644 --- a/m4/gx_mpi.m4 +++ b/m4/gx_mpi.m4 @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # =========================================================================== @@ -35,28 +34,19 @@ # # LICENSE # -# Copyright (c) 2022 Seth Underwood +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 3 of the License, or (at your -# option) any later version. +# http://www.apache.org/licenses/LICENSE-2.0 # -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. # -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. +# Copyright (c) 2022 Seth Underwood # GX_MPI([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE]) # ---------------------------------------------------------------------- diff --git a/memutils/Makefile.am b/memutils/Makefile.am index abc889313d..826cd8b36a 100644 --- a/memutils/Makefile.am +++ b/memutils/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the memutils directory of the FMS package. diff --git a/memutils/memutils.F90 b/memutils/memutils.F90 index 708027cb53..0e443d2eab 100644 --- a/memutils/memutils.F90 +++ b/memutils/memutils.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!! GNU Lesser General Public License -!! -!! This file is part of the GFDL Flexible Modeling System (FMS). -!! -!! FMS is free software: you can redistribute it and/or modify it under -!! the terms of the GNU Lesser General Public License as published by -!! the Free Software Foundation, either version 3 of the License, or (at -!! your option) any later version. -!! -!! FMS is distributed in the hope that it will be useful, but WITHOUT -!! ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!! FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!! for more details. -!! -!! You should have received a copy of the GNU Lesser General Public -!! License along with FMS. If not, see . +!* Apache License 2.0 +!* +!* This file is part of the GFDL Flexible Modeling System (FMS). +!* +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at +!* +!* http://www.apache.org/licenses/LICENSE-2.0 +!* +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup memutils_mod memutils_mod !> @ingroup memutils diff --git a/monin_obukhov/Makefile.am b/monin_obukhov/Makefile.am index a40c96640a..f862983817 100644 --- a/monin_obukhov/Makefile.am +++ b/monin_obukhov/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the monin_obukhov directory of the FMS diff --git a/monin_obukhov/include/monin_obukhov.inc b/monin_obukhov/include/monin_obukhov.inc index 27be02b5d7..4150daa8fb 100644 --- a/monin_obukhov/include/monin_obukhov.inc +++ b/monin_obukhov/include/monin_obukhov.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** diff --git a/monin_obukhov/include/monin_obukhov_inter.inc b/monin_obukhov/include/monin_obukhov_inter.inc index 12eb2a8abc..900838526a 100644 --- a/monin_obukhov/include/monin_obukhov_inter.inc +++ b/monin_obukhov/include/monin_obukhov_inter.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup monin_obukhov_inter diff --git a/monin_obukhov/include/monin_obukhov_inter_r4.fh b/monin_obukhov/include/monin_obukhov_inter_r4.fh index 6504a6e568..ec07407abe 100644 --- a/monin_obukhov/include/monin_obukhov_inter_r4.fh +++ b/monin_obukhov/include/monin_obukhov_inter_r4.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup monin_obukhov_inter monin_obukhov_inter !> @ingroup monin_obukhov diff --git a/monin_obukhov/include/monin_obukhov_inter_r8.fh b/monin_obukhov/include/monin_obukhov_inter_r8.fh index b261f64bb0..be5e0d2bfc 100644 --- a/monin_obukhov/include/monin_obukhov_inter_r8.fh +++ b/monin_obukhov/include/monin_obukhov_inter_r8.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup monin_obukhov_inter monin_obukhov_inter !> @ingroup monin_obukhov diff --git a/monin_obukhov/include/monin_obukhov_r4.fh b/monin_obukhov/include/monin_obukhov_r4.fh index 9b738233f9..60cd7c6d43 100644 --- a/monin_obukhov/include/monin_obukhov_r4.fh +++ b/monin_obukhov/include/monin_obukhov_r4.fh @@ -1,22 +1,21 @@ ! -*-f90-*- !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup monin_obukhov_mod monin_obukhov_mod !> @ingroup monin_obukhov diff --git a/monin_obukhov/include/monin_obukhov_r8.fh b/monin_obukhov/include/monin_obukhov_r8.fh index bb056f2b30..6d2da85bdf 100644 --- a/monin_obukhov/include/monin_obukhov_r8.fh +++ b/monin_obukhov/include/monin_obukhov_r8.fh @@ -1,22 +1,21 @@ ! -*-f90-*- !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup monin_obukhov_mod monin_obukhov_mod !> @ingroup monin_obukhov diff --git a/monin_obukhov/monin_obukhov.F90 b/monin_obukhov/monin_obukhov.F90 index 257889ff62..297de2505b 100644 --- a/monin_obukhov/monin_obukhov.F90 +++ b/monin_obukhov/monin_obukhov.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup monin_obukhov_mod monin_obukhov_mod !> @ingroup monin_obukhov diff --git a/monin_obukhov/monin_obukhov_inter.F90 b/monin_obukhov/monin_obukhov_inter.F90 index a4af79c314..26dcb6e6c1 100644 --- a/monin_obukhov/monin_obukhov_inter.F90 +++ b/monin_obukhov/monin_obukhov_inter.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup monin_obukhov_inter monin_obukhov_inter !> @ingroup monin_obukhov diff --git a/mosaic2/Makefile.am b/mosaic2/Makefile.am index 8801461b03..151054b1f2 100644 --- a/mosaic2/Makefile.am +++ b/mosaic2/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the mosaic directory of the FMS @@ -23,7 +22,7 @@ # Ed Hartnett 2/22/19 # Include .h and .mod files. -AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/mosaic -I$(top_srcdir)/mosaic2/include +AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/mosaic2/include AM_FCFLAGS = $(FC_MODINC). $(FC_MODOUT)$(MODDIR) # Build these uninstalled convenience libraries. diff --git a/mosaic2/grid2.F90 b/mosaic2/grid2.F90 index dbf6a59c5f..e523edf04e 100644 --- a/mosaic2/grid2.F90 +++ b/mosaic2/grid2.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup grid2_mod grid2_mod !> @ingroup mosaic2 @@ -159,12 +158,30 @@ end subroutine grid_init !> @brief Shutdown the grid2 module subroutine grid_end + if (.not. module_is_initialized) return if (grid_spec_exists) then if (grid_version == VERSION_OCN_MOSAIC_FILE) call close_component_mosaics call close_file(gridfileobj) endif + module_is_initialized = .FALSE. end subroutine grid_end +!> @brief Checks that the grid2 module was initialized propertly +subroutine init_checks(subroutine_name) + character(len=*), intent(in) :: subroutine_name !< Name of the subroutine calling this from + + if (.not. module_is_initialized) then + call mpp_error(FATAL, "grid2_mod::"//trim(subroutine_name)//" is being called but grid2 was never initialized. "//& + "Please ensure that grid_init is called before calling "//trim(subroutine_name)//".") + endif + + if (.not. grid_spec_exists) then + call mpp_error(FATAL, "grid2_mod::"//trim(subroutine_name)//" is being called, but "//trim(grid_file)//& + " does not exist, so grid2 was not initialized properly."//& + " Please ensure that "//trim(grid_file)//" is accessible.") + endif +end subroutine init_checks + !> @brief Determine if we are using the great circle algorithm !! @return Logical flag describing if we are using the great circlealgorithm function get_great_circle_algorithm() @@ -200,9 +217,7 @@ subroutine open_mosaic_file(mymosaicfileobj, component) character(len=3), intent(in) :: component !< Component (atm, lnd, etc.) character(len=FMS_PATH_LEN) :: mosaicfilename - if (.not. grid_spec_exists) then - call mpp_error(FATAL, 'grid2_mod(open_mosaic_file): grid_spec does not exist') - end if + call read_data(gridfileobj,trim(lowercase(component))//'_mosaic_file', mosaicfilename) call open_grid_file(mymosaicfileobj, grid_dir//trim(mosaicfilename)) end subroutine open_mosaic_file @@ -248,9 +263,6 @@ end function get_grid_version !> @brief Assign the component mosaic files if grid_spec is Version 3 subroutine assign_component_mosaics - if (.not. grid_spec_exists) then - call mpp_error(FATAL, 'grid2_mod(assign_component_mosaics): grid_spec does not exist') - end if mosaic_fileobj(1) = gridfileobj mosaic_fileobj(2) = gridfileobj mosaic_fileobj(3) = gridfileobj @@ -258,9 +270,6 @@ end subroutine assign_component_mosaics !> @brief Open the component mosaic files for atm, lnd, and ocn subroutine open_component_mosaics - if (.not. grid_spec_exists) then - call mpp_error(FATAL, 'grid2_mod(open_component_mosaics): grid_spec does not exist') - end if if (variable_exists(gridfileobj, 'atm_mosaic_file')) call open_mosaic_file(mosaic_fileobj(1), 'atm') if (variable_exists(gridfileobj, 'ocn_mosaic_file')) call open_mosaic_file(mosaic_fileobj(2), 'ocn') if (variable_exists(gridfileobj, 'lnd_mosaic_file')) call open_mosaic_file(mosaic_fileobj(3), 'lnd') @@ -268,9 +277,6 @@ end subroutine open_component_mosaics !> @brief Close the component mosaic files for atm, lnd, and ocn subroutine close_component_mosaics - if (.not. grid_spec_exists) then - call mpp_error(FATAL, 'grid2_mod(close_component_mosaics): grid_spec does not exist') - end if if (variable_exists(gridfileobj, 'atm_mosaic_file')) call close_file(mosaic_fileobj(1)) if (variable_exists(gridfileobj, 'ocn_mosaic_file')) call close_file(mosaic_fileobj(2)) if (variable_exists(gridfileobj, 'lnd_mosaic_file')) call close_file(mosaic_fileobj(3)) @@ -296,6 +302,7 @@ subroutine get_grid_ntiles(component,ntiles) character(len=*) :: component !< Component model (atm, lnd, ocn) integer, intent(out) :: ntiles !< Number of tiles + call init_checks("get_grid_ntiles") select case (grid_version) case(VERSION_GEOLON_T,VERSION_X_T) ntiles = 1 @@ -313,13 +320,11 @@ subroutine get_grid_size_for_all_tiles(component,nx,ny) integer :: siz(2) ! for the size of external fields character(len=MAX_NAME) :: varname1 + call init_checks("get_grid_size") varname1 = 'AREA_'//trim(uppercase(component)) select case (grid_version) case(VERSION_GEOLON_T,VERSION_X_T) - if (.not. grid_spec_exists) then - call mpp_error(FATAL, 'grid2_mod(get_grid_size_for_all_tiles): grid_spec does not exist') - end if call get_variable_size(gridfileobj, varname1, siz) nx(1) = siz(1); ny(1)=siz(2) case(VERSION_OCN_MOSAIC_FILE, VERSION_GRIDFILES) ! mosaic file @@ -337,6 +342,7 @@ subroutine get_grid_size_for_one_tile(component,tile,nx,ny) integer, allocatable :: nnx(:), nny(:) integer :: ntiles + call init_checks("get_grid_size") call get_grid_ntiles(component, ntiles) if(tile>0.and.tile<=ntiles) then allocate(nnx(ntiles),nny(ntiles)) @@ -369,6 +375,7 @@ subroutine define_cube_mosaic(component, domain, layout, halo, maskmap) integer, allocatable :: is1(:),ie1(:),js1(:),je1(:) integer, allocatable :: is2(:),ie2(:),js2(:),je2(:) + call init_checks("define_cube_mosaic") call get_grid_ntiles(component,ntiles) allocate(nlon(ntiles), nlat(ntiles)) allocate(global_indices(4,ntiles)) diff --git a/mosaic2/include/grid2.inc b/mosaic2/include/grid2.inc index 42156420bd..da237c7177 100644 --- a/mosaic2/include/grid2.inc +++ b/mosaic2/include/grid2.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file @@ -31,13 +30,11 @@ subroutine GET_GRID_CELL_AREA_SG_(component, tile, cellarea, domain) real(kind=r8_kind), allocatable :: glonb(:,:), glatb(:,:) real(kind=r8_kind), allocatable :: cellarea8(:,:) + call init_checks("get_grid_cell_area") allocate(cellarea8(size(cellarea,1),size(cellarea,2))) select case(grid_version) case(VERSION_GEOLON_T,VERSION_X_T) - if (.not. grid_spec_exists) then - call mpp_error(FATAL, 'grid2_mod(get_grid_cell_area_SG): grid_spec does not exist') - end if select case(trim(component)) case('LND') call read_data(gridfileobj, 'AREA_LND_CELL', cellarea8) @@ -103,13 +100,11 @@ subroutine GET_GRID_COMP_AREA_SG_(component,tile,area,domain) real(r8_kind),allocatable :: area8(:,:) + call init_checks("get_grid_comp_area") allocate(area8(size(area,1),size(area,2))) select case (grid_version ) case(VERSION_GEOLON_T,VERSION_X_T) - if (.not. grid_spec_exists) then - call mpp_error(FATAL, 'grid2_mod(get_grid_comp_area_SG): grid_spec does not exist') - end if select case(component) case('ATM') call read_data(gridfileobj,'AREA_ATM',area8) @@ -134,16 +129,10 @@ subroutine GET_GRID_COMP_AREA_SG_(component,tile,area,domain) return case ('LND') xgrid_name = 'aXl_file' - if (.not. grid_spec_exists) then - call mpp_error(FATAL, 'grid2_mod(get_grid_comp_area_SG): grid_spec does not exist') - end if call read_data(gridfileobj, 'lnd_mosaic', mosaic_name) tile_name = trim(mosaic_name)//'_tile'//char(tile+ichar('0')) case ('OCN') xgrid_name = 'aXo_file' - if (.not. grid_spec_exists) then - call mpp_error(FATAL, 'grid2_mod(get_grid_comp_area_SG): grid_spec does not exist') - end if call read_data(gridfileobj, 'ocn_mosaic', mosaic_name) tile_name = trim(mosaic_name)//'_tile'//char(tile+ichar('0')) case default @@ -164,9 +153,6 @@ subroutine GET_GRID_COMP_AREA_SG_(component,tile,area,domain) 'size of the output argument "area" is not consistent with the domain') ! find the nest tile - if (.not. grid_spec_exists) then - call mpp_error(FATAL, 'grid2_mod(get_grid_comp_area_SG): grid_spec does not exist') - end if call read_data(gridfileobj, 'atm_mosaic', mosaic_name) call get_grid_ntiles('atm', ntiles) allocate(nest_tile_name(ntiles)) @@ -187,9 +173,6 @@ subroutine GET_GRID_COMP_AREA_SG_(component,tile,area,domain) call close_file(tilefileobj) end do area8(:,:) = 0.0_r8_kind - if (.not. grid_spec_exists) then - call mpp_error(FATAL, 'grid2_mod(get_grid_comp_area_SG): grid_spec does not exist') - end if if(variable_exists(gridfileobj,xgrid_name)) then ! get the number of the exchange-grid files call get_variable_size(gridfileobj,xgrid_name,siz) @@ -266,6 +249,7 @@ subroutine GET_GRID_CELL_AREA_UG_(component, tile, cellarea, SG_domain, UG_domai integer :: is, ie, js, je real(kind=FMS_MOS_KIND_), allocatable :: SG_area(:,:) + call init_checks("get_grid_cell_area") call mpp_get_compute_domain(SG_domain, is, ie, js, je) allocate(SG_area(is:ie, js:je)) call get_grid_cell_area(component, tile, SG_area, SG_domain) @@ -283,6 +267,7 @@ subroutine GET_GRID_COMP_AREA_UG_(component, tile, area, SG_domain, UG_domain) integer :: is, ie, js, je real(kind=FMS_MOS_KIND_), allocatable :: SG_area(:,:) + call init_checks("get_grid_comp_area") call mpp_get_compute_domain(SG_domain, is, ie, js, je) allocate(SG_area(is:ie, js:je)) call get_grid_comp_area(component, tile, SG_area, SG_domain) @@ -304,6 +289,7 @@ subroutine GET_GRID_CELL_VERTICES_1D_(component, tile, glonb, glatb) character(len=FMS_PATH_LEN) :: tilefile type(FmsNetcdfFile_t) :: tilefileobj + call init_checks("get_grid_cell_vertices") call get_grid_size_for_one_tile(component, tile, nlon, nlat) if (size(glonb(:))/=nlon+1) & call mpp_error (FATAL, module_name//'/get_grid_cell_vertices_1D '//& @@ -318,9 +304,6 @@ subroutine GET_GRID_CELL_VERTICES_1D_(component, tile, glonb, glatb) select case(grid_version) case(VERSION_GEOLON_T) - if (.not. grid_spec_exists) then - call mpp_error(FATAL, 'grid2_mod(get_grid_cell_vertices_1D): grid_spec does not exist') - end if select case(trim(component)) case('ATM','LND') call read_data(gridfileobj, 'xb'//lowercase(component(1:1)), glonb) @@ -330,9 +313,6 @@ subroutine GET_GRID_CELL_VERTICES_1D_(component, tile, glonb, glatb) call read_data(gridfileobj, "gridlat_vert_t", glatb) end select case(VERSION_X_T) - if (.not. grid_spec_exists) then - call mpp_error(FATAL, 'grid2_mod(get_grid_cell_vertices_1D): grid_spec does not exist') - end if select case(trim(component)) case('ATM','LND') call read_data(gridfileobj, 'xb'//lowercase(component(1:1)), glonb) @@ -395,6 +375,7 @@ subroutine GET_GRID_CELL_VERTICES_2D_(component, tile, lonb, latb, domain) character(len=FMS_PATH_LEN) :: tilefile type(FmsNetcdfFile_t) :: tilefileobj + call init_checks("get_grid_cell_vertices") call get_grid_size_for_one_tile(component, tile, nlon, nlat) if (present(domain)) then @@ -423,9 +404,6 @@ subroutine GET_GRID_CELL_VERTICES_2D_(component, tile, lonb, latb, domain) !! use lonb, latb as r4 select case(grid_version) case(VERSION_GEOLON_T) - if (.not. grid_spec_exists) then - call mpp_error(FATAL, 'grid2_mod(get_grid_cell_vertices_2D): grid_spec does not exist') - end if select case(component) case('ATM','LND') allocate(buffer(max(nlon,nlat)+1)) @@ -456,9 +434,6 @@ subroutine GET_GRID_CELL_VERTICES_2D_(component, tile, lonb, latb, domain) endif end select case(VERSION_X_T) - if (.not. grid_spec_exists) then - call mpp_error(FATAL, 'grid2_mod(get_grid_cell_vertices_2D): grid_spec does not exist') - end if select case(component) case('ATM','LND') allocate(buffer(max(nlon,nlat)+1)) @@ -544,6 +519,7 @@ subroutine GET_GRID_CELL_VERTICES_UG_(component, tile, lonb, latb, SG_domain, UG integer :: is, ie, js, je, i, j real(kind=FMS_MOS_KIND_), allocatable :: SG_lonb(:,:), SG_latb(:,:), tmp(:,:,:) + call init_checks("get_grid_cell_vertices") call mpp_get_compute_domain(SG_domain, is, ie, js, je) allocate(SG_lonb(is:ie+1, js:je+1)) allocate(SG_latb(is:ie+1, js:je+1)) @@ -584,6 +560,7 @@ subroutine GET_GRID_CELL_CENTERS_1D_(component, tile, glon, glat) character(len=FMS_PATH_LEN) :: tilefile type(FmsNetcdfFile_t) :: tilefileobj + call init_checks("get_grid_cell_centers") call get_grid_size_for_one_tile(component, tile, nlon, nlat) if (size(glon(:))/=nlon) & call mpp_error (FATAL, module_name//'/get_grid_cell_centers_1D '//& @@ -598,9 +575,6 @@ subroutine GET_GRID_CELL_CENTERS_1D_(component, tile, glon, glat) select case(grid_version) case(VERSION_GEOLON_T) - if (.not. grid_spec_exists) then - call mpp_error(FATAL, 'grid2_mod(get_grid_cell_centers_1D): grid_spec does not exist') - end if select case(trim(component)) case('ATM','LND') call read_data(gridfileobj, 'xt'//lowercase(component(1:1)), glon) @@ -610,9 +584,6 @@ subroutine GET_GRID_CELL_CENTERS_1D_(component, tile, glon, glat) call read_data(gridfileobj, "gridlat_t", glat) end select case(VERSION_X_T) - if (.not. grid_spec_exists) then - call mpp_error(FATAL, 'grid2_mod(get_grid_cell_centers_1D): grid_spec does not exist') - end if select case(trim(component)) case('ATM','LND') call read_data(gridfileobj, 'xt'//lowercase(component(1:1)), glon) @@ -660,6 +631,7 @@ subroutine GET_GRID_CELL_CENTERS_2D_(component, tile, lon, lat, domain) character(len=FMS_PATH_LEN) :: tilefile type(FmsNetcdfFile_t) :: tilefileobj + call init_checks("get_grid_cell_centers") call get_grid_size_for_one_tile(component, tile, nlon, nlat) if (present(domain)) then call mpp_get_compute_domain(domain,is,ie,js,je) @@ -686,9 +658,6 @@ subroutine GET_GRID_CELL_CENTERS_2D_(component, tile, lon, lat, domain) select case(grid_version) case(VERSION_GEOLON_T) - if (.not. grid_spec_exists) then - call mpp_error(FATAL, 'grid2_mod(get_grid_cell_centers_2D): grid_spec does not exist') - end if select case (trim(component)) case('ATM','LND') allocate(buffer(max(nlon,nlat))) @@ -711,9 +680,6 @@ subroutine GET_GRID_CELL_CENTERS_2D_(component, tile, lon, lat, domain) call read_data(gridfileobj, 'geolat_t', lat) end select case(VERSION_X_T) - if (.not. grid_spec_exists) then - call mpp_error(FATAL, 'grid2_mod(get_grid_cell_centers_2D): grid_spec does not exist') - end if select case(trim(component)) case('ATM','LND') allocate(buffer(max(nlon,nlat))) @@ -789,6 +755,7 @@ subroutine GET_GRID_CELL_CENTERS_UG_(component, tile, lon, lat, SG_domain, UG_do integer :: is, ie, js, je real(kind=FMS_MOS_KIND_), allocatable :: SG_lon(:,:), SG_lat(:,:) + call init_checks("get_grid_cell_centers") call mpp_get_compute_domain(SG_domain, is, ie, js, je) allocate(SG_lon(is:ie, js:je)) allocate(SG_lat(is:ie, js:je)) diff --git a/mosaic2/include/grid2_r4.fh b/mosaic2/include/grid2_r4.fh index 07b069fdbb..b1740e058f 100644 --- a/mosaic2/include/grid2_r4.fh +++ b/mosaic2/include/grid2_r4.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief include file for grid2_mod to generate subroutines/functions for r4_kind arguments diff --git a/mosaic2/include/grid2_r8.fh b/mosaic2/include/grid2_r8.fh index c9cbf9eb23..9b3d67a898 100644 --- a/mosaic2/include/grid2_r8.fh +++ b/mosaic2/include/grid2_r8.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief include file for grid2_mod to generate subroutines/functions for r8_kind arguments diff --git a/mosaic2/include/mosaic2.inc b/mosaic2/include/mosaic2.inc index c87481e700..0a70bdb0be 100644 --- a/mosaic2/include/mosaic2.inc +++ b/mosaic2/include/mosaic2.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file diff --git a/mosaic2/include/mosaic2_r4.fh b/mosaic2/include/mosaic2_r4.fh index fa663bec41..996275e9c7 100644 --- a/mosaic2/include/mosaic2_r4.fh +++ b/mosaic2/include/mosaic2_r4.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief include file for mosaic22_mod to generate subroutines/functions for r4_kind arguments diff --git a/mosaic2/include/mosaic2_r8.fh b/mosaic2/include/mosaic2_r8.fh index fa410a245a..ab7e2aa86e 100644 --- a/mosaic2/include/mosaic2_r8.fh +++ b/mosaic2/include/mosaic2_r8.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief include file for mosaic2_mod to generate subroutines/functions for r8_kind arguments diff --git a/mosaic2/mosaic2.F90 b/mosaic2/mosaic2.F90 index 370f3680bf..dbc926ff57 100644 --- a/mosaic2/mosaic2.F90 +++ b/mosaic2/mosaic2.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup mosaic2_mod mosaic2_mod !> @ingroup mosaic2 diff --git a/mpp/Makefile.am b/mpp/Makefile.am index 08a1525b5f..2b935a9781 100644 --- a/mpp/Makefile.am +++ b/mpp/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the mpp directory of the MPP diff --git a/mpp/include/group_update_pack.inc b/mpp/include/group_update_pack.inc index 142106aece..de08b89e56 100644 --- a/mpp/include/group_update_pack.inc +++ b/mpp/include/group_update_pack.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** if( group%k_loop_inside ) then diff --git a/mpp/include/group_update_unpack.inc b/mpp/include/group_update_unpack.inc index 7f60ed93df..49fb2555ce 100644 --- a/mpp/include/group_update_unpack.inc +++ b/mpp/include/group_update_unpack.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** if( group%k_loop_inside ) then diff --git a/mpp/include/mpp_alltoall_mpi.fh b/mpp/include/mpp_alltoall_mpi.fh index ec8fd27585..3fc91c5ea0 100644 --- a/mpp/include/mpp_alltoall_mpi.fh +++ b/mpp/include/mpp_alltoall_mpi.fh @@ -1,22 +1,21 @@ ! -*-f90-*- !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file diff --git a/mpp/include/mpp_alltoall_nocomm.fh b/mpp/include/mpp_alltoall_nocomm.fh index f8446a475b..1de25917aa 100644 --- a/mpp/include/mpp_alltoall_nocomm.fh +++ b/mpp/include/mpp_alltoall_nocomm.fh @@ -1,22 +1,21 @@ ! -*-f90-*- !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief @ref mpp_alltoall routine implementations without MPI diff --git a/mpp/include/mpp_chksum.fh b/mpp/include/mpp_chksum.fh index 9efbfec73f..3b8cbef408 100644 --- a/mpp/include/mpp_chksum.fh +++ b/mpp/include/mpp_chksum.fh @@ -1,22 +1,21 @@ ! -*-f90-*- !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file diff --git a/mpp/include/mpp_chksum_int.fh b/mpp/include/mpp_chksum_int.fh index 1d511a2381..80284f26ee 100644 --- a/mpp/include/mpp_chksum_int.fh +++ b/mpp/include/mpp_chksum_int.fh @@ -1,22 +1,21 @@ ! -*-f90-*- !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief Routines for calculating global integer checksums for the @ref mpp_chksum interface. diff --git a/mpp/include/mpp_chksum_scalar.fh b/mpp/include/mpp_chksum_scalar.fh index 5335fe8915..e70ea00feb 100644 --- a/mpp/include/mpp_chksum_scalar.fh +++ b/mpp/include/mpp_chksum_scalar.fh @@ -1,22 +1,21 @@ ! -*-f90-*- !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file diff --git a/mpp/include/mpp_comm.inc b/mpp/include/mpp_comm.inc index 5246841387..8a04f70b97 100644 --- a/mpp/include/mpp_comm.inc +++ b/mpp/include/mpp_comm.inc @@ -1,22 +1,21 @@ ! -*-f90-*- !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief Imports checksum, gather, and scatter routines from other include files used diff --git a/mpp/include/mpp_comm_mpi.inc b/mpp/include/mpp_comm_mpi.inc index 82df7e3164..8345b23fa0 100644 --- a/mpp/include/mpp_comm_mpi.inc +++ b/mpp/include/mpp_comm_mpi.inc @@ -1,22 +1,21 @@ ! -*-f90-*- !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief Routines to initialize and finalize @ref mpp_mod with mpi enabled. diff --git a/mpp/include/mpp_comm_nocomm.inc b/mpp/include/mpp_comm_nocomm.inc index 3f841bf617..7c6723b00f 100644 --- a/mpp/include/mpp_comm_nocomm.inc +++ b/mpp/include/mpp_comm_nocomm.inc @@ -1,22 +1,21 @@ ! -*-f90-*- !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief Routines to initialize and finalize @ref mpp_mod without MPI. diff --git a/mpp/include/mpp_data_mpi.inc b/mpp/include/mpp_data_mpi.inc index 03c247c869..43493cd24b 100644 --- a/mpp/include/mpp_data_mpi.inc +++ b/mpp/include/mpp_data_mpi.inc @@ -1,22 +1,21 @@ ! -*-f90-*- !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @ingroup mpp_data_mod diff --git a/mpp/include/mpp_data_nocomm.inc b/mpp/include/mpp_data_nocomm.inc index a6dac8bf67..f7de0670e4 100644 --- a/mpp/include/mpp_data_nocomm.inc +++ b/mpp/include/mpp_data_nocomm.inc @@ -1,22 +1,21 @@ ! -*-f90-*- !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @ingroup mpp_data_mod diff --git a/mpp/include/mpp_define_nest_domains.inc b/mpp/include/mpp_define_nest_domains.inc index 14caad7d8c..21c82223ed 100644 --- a/mpp/include/mpp_define_nest_domains.inc +++ b/mpp/include/mpp_define_nest_domains.inc @@ -2,22 +2,21 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file diff --git a/mpp/include/mpp_do_check.fh b/mpp/include/mpp_do_check.fh index ef2e4a0753..e724f924ff 100644 --- a/mpp/include/mpp_do_check.fh +++ b/mpp/include/mpp_do_check.fh @@ -1,21 +1,20 @@ ! -*-f90-*- !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief Updates data domain of 3D field whose computational domains have been computed diff --git a/mpp/include/mpp_do_checkV.fh b/mpp/include/mpp_do_checkV.fh index edd73e4382..2c6df7a0df 100644 --- a/mpp/include/mpp_do_checkV.fh +++ b/mpp/include/mpp_do_checkV.fh @@ -1,21 +1,20 @@ ! -*-f90-*- !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief Updates data domain of 3D field whose computational domains have been computed diff --git a/mpp/include/mpp_do_get_boundary.fh b/mpp/include/mpp_do_get_boundary.fh index a8c683bbf8..5c391ac5b5 100644 --- a/mpp/include/mpp_do_get_boundary.fh +++ b/mpp/include/mpp_do_get_boundary.fh @@ -1,21 +1,20 @@ ! -*-f90-*- !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** subroutine MPP_DO_GET_BOUNDARY_3D_( f_addrs, domain, bound, b_addrs, bsize, ke, d_type) type(domain2D), intent(in) :: domain diff --git a/mpp/include/mpp_do_get_boundary_ad.fh b/mpp/include/mpp_do_get_boundary_ad.fh index b4d83786d6..2787ec4955 100644 --- a/mpp/include/mpp_do_get_boundary_ad.fh +++ b/mpp/include/mpp_do_get_boundary_ad.fh @@ -1,22 +1,21 @@ ! -*-f90-*- !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** subroutine MPP_DO_GET_BOUNDARY_AD_3D_( f_addrs, domain, bound, b_addrs, bsize, ke, d_type) diff --git a/mpp/include/mpp_do_global_field.fh b/mpp/include/mpp_do_global_field.fh index 7dfe2ab42b..1a665e1a50 100644 --- a/mpp/include/mpp_do_global_field.fh +++ b/mpp/include/mpp_do_global_field.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup mpp_domains_mod !> @{ diff --git a/mpp/include/mpp_do_global_field_ad.fh b/mpp/include/mpp_do_global_field_ad.fh index cb635cae11..8fa726a26f 100644 --- a/mpp/include/mpp_do_global_field_ad.fh +++ b/mpp/include/mpp_do_global_field_ad.fh @@ -2,22 +2,21 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup mpp_domains_mod !> @{ diff --git a/mpp/include/mpp_do_redistribute.fh b/mpp/include/mpp_do_redistribute.fh index 26c9dc9ff3..5acf4bb314 100644 --- a/mpp/include/mpp_do_redistribute.fh +++ b/mpp/include/mpp_do_redistribute.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup mpp_domains_mod !> @{ diff --git a/mpp/include/mpp_do_update.fh b/mpp/include/mpp_do_update.fh index c770d86483..0fa38a8a76 100644 --- a/mpp/include/mpp_do_update.fh +++ b/mpp/include/mpp_do_update.fh @@ -1,21 +1,20 @@ ! -*-f90-*- !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup mpp_domains_mod !> @{ diff --git a/mpp/include/mpp_do_updateV.fh b/mpp/include/mpp_do_updateV.fh index adc509b3fb..378a2a6211 100644 --- a/mpp/include/mpp_do_updateV.fh +++ b/mpp/include/mpp_do_updateV.fh @@ -1,21 +1,20 @@ ! -*-f90-*- !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup mpp_domains_mod !> @{ diff --git a/mpp/include/mpp_do_updateV_ad.fh b/mpp/include/mpp_do_updateV_ad.fh index f1d11ec809..a8a2f54e88 100644 --- a/mpp/include/mpp_do_updateV_ad.fh +++ b/mpp/include/mpp_do_updateV_ad.fh @@ -2,22 +2,21 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup mpp_domains_mod !> @{ diff --git a/mpp/include/mpp_do_updateV_nonblock.fh b/mpp/include/mpp_do_updateV_nonblock.fh index 7ae9e73f14..321e993c4c 100644 --- a/mpp/include/mpp_do_updateV_nonblock.fh +++ b/mpp/include/mpp_do_updateV_nonblock.fh @@ -1,21 +1,20 @@ ! -*-f90-*- !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup mpp_domains_mod !> @{ diff --git a/mpp/include/mpp_do_update_ad.fh b/mpp/include/mpp_do_update_ad.fh index 7e7382dcb8..e729ed6338 100644 --- a/mpp/include/mpp_do_update_ad.fh +++ b/mpp/include/mpp_do_update_ad.fh @@ -1,21 +1,20 @@ ! -*-f90-*- !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup mpp_domains_mod !> @{ diff --git a/mpp/include/mpp_do_update_nest.fh b/mpp/include/mpp_do_update_nest.fh index 4122516da2..a97d06492f 100644 --- a/mpp/include/mpp_do_update_nest.fh +++ b/mpp/include/mpp_do_update_nest.fh @@ -1,21 +1,20 @@ ! -*-f90-*- !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup mpp_domains_mod !> @{ diff --git a/mpp/include/mpp_do_update_nonblock.fh b/mpp/include/mpp_do_update_nonblock.fh index 7d1e90f92d..5090c780b6 100644 --- a/mpp/include/mpp_do_update_nonblock.fh +++ b/mpp/include/mpp_do_update_nonblock.fh @@ -1,21 +1,20 @@ ! -*-f90-*- !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup mpp_domains_mod !> @{ diff --git a/mpp/include/mpp_domains_comm.inc b/mpp/include/mpp_domains_comm.inc index 071932f136..c4048c2637 100644 --- a/mpp/include/mpp_domains_comm.inc +++ b/mpp/include/mpp_domains_comm.inc @@ -2,22 +2,21 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file diff --git a/mpp/include/mpp_domains_define.inc b/mpp/include/mpp_domains_define.inc index 99948660ce..a3e94e8643 100644 --- a/mpp/include/mpp_domains_define.inc +++ b/mpp/include/mpp_domains_define.inc @@ -1,21 +1,20 @@ ! -*-f90-*- !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file diff --git a/mpp/include/mpp_domains_misc.inc b/mpp/include/mpp_domains_misc.inc index f64dd2fc77..64c20ed386 100644 --- a/mpp/include/mpp_domains_misc.inc +++ b/mpp/include/mpp_domains_misc.inc @@ -1,21 +1,20 @@ ! -*-f90-*- !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file diff --git a/mpp/include/mpp_domains_reduce.inc b/mpp/include/mpp_domains_reduce.inc index 613a1eaeb4..66aaffdcf4 100644 --- a/mpp/include/mpp_domains_reduce.inc +++ b/mpp/include/mpp_domains_reduce.inc @@ -1,22 +1,21 @@ ! -*-f90-*- !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief Routines for calculating data from distributed arrays diff --git a/mpp/include/mpp_domains_util.inc b/mpp/include/mpp_domains_util.inc index ab2933e131..3f3ad00ab2 100644 --- a/mpp/include/mpp_domains_util.inc +++ b/mpp/include/mpp_domains_util.inc @@ -1,22 +1,21 @@ ! -*-f90-*- !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file diff --git a/mpp/include/mpp_error_a_a.fh b/mpp/include/mpp_error_a_a.fh index 5d54dae05f..bb3cf5f08b 100644 --- a/mpp/include/mpp_error_a_a.fh +++ b/mpp/include/mpp_error_a_a.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** subroutine _SUBNAME_(errortype, errormsg1, array1, errormsg2, array2, errormsg3) integer, intent(in) :: errortype diff --git a/mpp/include/mpp_error_a_s.fh b/mpp/include/mpp_error_a_s.fh index 3b8a07f56e..c12dbb086d 100644 --- a/mpp/include/mpp_error_a_s.fh +++ b/mpp/include/mpp_error_a_s.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** subroutine _SUBNAME_(errortype, errormsg1, array, errormsg2, scalar, errormsg3) integer, intent(in) :: errortype diff --git a/mpp/include/mpp_error_s_a.fh b/mpp/include/mpp_error_s_a.fh index e3f5927875..f1a8fab321 100644 --- a/mpp/include/mpp_error_s_a.fh +++ b/mpp/include/mpp_error_s_a.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** subroutine _SUBNAME_(errortype, errormsg1, scalar2, errormsg2, array2, errormsg3) integer, intent(in) :: errortype diff --git a/mpp/include/mpp_error_s_s.fh b/mpp/include/mpp_error_s_s.fh index 37e57ed66d..58d2a621b8 100644 --- a/mpp/include/mpp_error_s_s.fh +++ b/mpp/include/mpp_error_s_s.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** subroutine _SUBNAME_(errortype, errormsg1, scalar1, errormsg2, scalar2, errormsg3) integer, intent(in) :: errortype diff --git a/mpp/include/mpp_gather.fh b/mpp/include/mpp_gather.fh index 2f0165bdf0..f3f7c6d160 100644 --- a/mpp/include/mpp_gather.fh +++ b/mpp/include/mpp_gather.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file @@ -46,7 +45,7 @@ subroutine MPP_GATHER_1D_(sbuf, rbuf, pelist) op_root = pelist2(1) cnt = size(sbuf(:)) - if(size(rbuf(:)) < cnt*nproc) call mpp_error(FATAL, & + if((mpp_pe().eq.op_root).AND.(size(rbuf(:)) < cnt*nproc)) call mpp_error(FATAL, & "MPP_GATHER_1D_: size(rbuf) must be at least npes*size(sbuf) ") call mpp_gather( sbuf, rbuf, size(sbuf), op_root, pelist2, ierr ) @@ -133,13 +132,13 @@ subroutine MPP_GATHER_PELIST_3D_(is, ie, js, je, nk, pelist, array_seg, gather_d logical, intent(in) :: is_root_pe integer, optional, intent(in) :: ishift, jshift - integer :: i, msgsize, root_pe, root_pe_test + integer :: i, j, k + integer :: root_pe, root_pe_test integer :: i1, i2, j1, j2, ioff, joff - integer :: my_ind(4), gind(4,size(pelist)) - type array3D - MPP_TYPE_, dimension(:,:,:), allocatable :: data3D_type - endtype array3D - type(array3d), dimension(:), allocatable :: temp + integer :: base_idx, send_count, msg_start + integer :: blocksize_i, blocksize_j, blocksize + integer, dimension(:), allocatable :: gind, counts + MPP_TYPE_, dimension(:), allocatable :: rbuf if (.not.ANY(mpp_pe().eq.pelist(:))) return @@ -167,76 +166,51 @@ subroutine MPP_GATHER_PELIST_3D_(is, ie, js, je, nk, pelist, array_seg, gather_d if (present(ishift)) ioff=ishift if (present(jshift)) joff=jshift - my_ind(1) = is - my_ind(2) = ie - my_ind(3) = js - my_ind(4) = je + ! gather indices into global index on root_pe + if (is_root_pe) allocate(gind(4*size(pelist))) + call mpp_gather((/is, ie, js, je/), gind, pelist) -! gather indices into global index on root_pe + ! Compute and allocate counts and 1d recv buffer (rbuf) if (is_root_pe) then - allocate(temp(1:size(pelist))) - do i = 1, size(pelist) -! root_pe data copy - no send to self - if (pelist(i).eq.root_pe) then - gind(:,i) = my_ind(:) - else - call mpp_recv(gind(:,i:i), 4, pelist(i), .FALSE., COMM_TAG_1) - endif - enddo - call mpp_sync_self(check=EVENT_RECV) - gind(1,:)=gind(1,:)+ioff - gind(2,:)=gind(2,:)+ioff - gind(3,:)=gind(3,:)+joff - gind(4,:)=gind(4,:)+joff -! check indices to make sure they are within the range of "data" - if ((minval(gind).lt.1) .OR. (maxval(gind(1:2,:)).gt.size(gather_data,1)) .OR. & - (maxval(gind(3:4,:)).gt.size(gather_data,2))) & - call mpp_error(FATAL,"fms_io(mpp_gather_pelist): specified indices (with shift) are outside of the & - &range of the receiving array") - else -! non root_pe's send indices to root_pe - call mpp_send(my_ind(:), 4, root_pe, COMM_TAG_1) - call mpp_sync_self(check=EVENT_SEND) + allocate(counts(size(pelist))) + + do k = 1, size(pelist) + base_idx = 4*(k-1) + i1 = gind( base_idx + 1 ) ;; i2 = gind( base_idx + 2 ) + j1 = gind( base_idx + 3 ) ;; j2 = gind( base_idx + 4 ) + counts(k) = (i2 - i1 + 1) * (j2 - j1 + 1) * nk + enddo + + allocate(rbuf(sum(counts))) endif -! gather segments into data based on indices + send_count = (ie-is+1)*(je-js+1)*nk + + ! gather data into 1d recv buffer + call mpp_gather(reshape(array_seg(is:ie,js:je,1:nk),[send_count]), send_count, rbuf, counts, pelist) + + ! Unpack recv buffer into return array (gather_data) if (is_root_pe) then - do i = 1, size(pelist) - if (pelist(i).ne.root_pe) then ! no send to self - i1 = gind(1,i) - i2 = gind(2,i) - j1 = gind(3,i) - j2 = gind(4,i) - msgsize = (i2-i1+1)*(j2-j1+1)*nk - allocate(temp(i)%data3D_type(i1:i2,j1:j2,1:nk)) - call mpp_recv(temp(i)%data3D_type(i1:i2,j1:j2,1:nk), msgsize, pelist(i), .FALSE., COMM_TAG_2) - endif - enddo - call mpp_sync_self(check=EVENT_RECV) -! unbuffer/copy the data into the return array - do i = 1, size(pelist) - if (pelist(i).eq.root_pe) then -! data copy - no send to self - gather_data(is+ioff:ie+ioff,js+joff:je+joff,1:nk) = array_seg(is:ie,js:je,1:nk) - else - i1 = gind(1,i) - i2 = gind(2,i) - j1 = gind(3,i) - j2 = gind(4,i) - gather_data(i1:i2,j1:j2,1:nk)=temp(i)%data3D_type(i1:i2,j1:j2,1:nk) - deallocate(temp(i)%data3D_type) - endif - enddo - deallocate(temp) - else -! non root_pe's send data to root_pe - msgsize = (my_ind(2)-my_ind(1)+1) * (my_ind(4)-my_ind(3)+1) * nk - call mpp_send(array_seg, msgsize, root_pe, COMM_TAG_2) - call mpp_sync_self(check=EVENT_SEND) + msg_start = 1 + do k = 1, size(pelist) + base_idx = 4*(k-1) + i1 = gind( base_idx + 1 ) + ioff ;; i2 = gind( base_idx + 2 ) + ioff + j1 = gind( base_idx + 3 ) + joff ;; j2 = gind( base_idx + 4 ) + joff + + blocksize_i = i2 - i1 + 1 + blocksize_j = j2 - j1 + 1 + blocksize = blocksize_i * blocksize_j * nk + + gather_data(i1:i2, j1:j2, 1:nk) = reshape(rbuf(msg_start:msg_start+blocksize-1), & + [blocksize_i, blocksize_j, nk]) + + msg_start = msg_start + blocksize + enddo + + deallocate(gind, rbuf, counts) endif call mpp_sync_self() - return end subroutine MPP_GATHER_PELIST_3D_ !> @} diff --git a/mpp/include/mpp_get_boundary.fh b/mpp/include/mpp_get_boundary.fh index 2103aea05d..800b238498 100644 --- a/mpp/include/mpp_get_boundary.fh +++ b/mpp/include/mpp_get_boundary.fh @@ -1,21 +1,20 @@ ! -*-f90-*- !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup mpp_domains_mod !> @{ diff --git a/mpp/include/mpp_get_boundary_ad.fh b/mpp/include/mpp_get_boundary_ad.fh index 6701d375dd..fc8c62bc1d 100644 --- a/mpp/include/mpp_get_boundary_ad.fh +++ b/mpp/include/mpp_get_boundary_ad.fh @@ -1,22 +1,21 @@ ! -*-f90-*- !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup mpp_domains_mod !> @{ diff --git a/mpp/include/mpp_global_field.fh b/mpp/include/mpp_global_field.fh index 1dd3d1121a..044f6f8050 100644 --- a/mpp/include/mpp_global_field.fh +++ b/mpp/include/mpp_global_field.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup mpp_domains_mod !> @{ diff --git a/mpp/include/mpp_global_field_ad.fh b/mpp/include/mpp_global_field_ad.fh index 712d12e48e..d4f560959d 100644 --- a/mpp/include/mpp_global_field_ad.fh +++ b/mpp/include/mpp_global_field_ad.fh @@ -2,22 +2,21 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup mpp_domains_mod !> @{ diff --git a/mpp/include/mpp_global_field_ug.fh b/mpp/include/mpp_global_field_ug.fh index e21a7bffa8..07f2eb2d3a 100644 --- a/mpp/include/mpp_global_field_ug.fh +++ b/mpp/include/mpp_global_field_ug.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup mpp_domains_mod !> @{ diff --git a/mpp/include/mpp_global_reduce.fh b/mpp/include/mpp_global_reduce.fh index 942f7876e1..a777cd2940 100644 --- a/mpp/include/mpp_global_reduce.fh +++ b/mpp/include/mpp_global_reduce.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup mpp_domains_mod !> @{ diff --git a/mpp/include/mpp_global_sum.fh b/mpp/include/mpp_global_sum.fh index 1a487a4f4d..5085a396a8 100644 --- a/mpp/include/mpp_global_sum.fh +++ b/mpp/include/mpp_global_sum.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup mpp_domains_mod !> @{ diff --git a/mpp/include/mpp_global_sum_ad.fh b/mpp/include/mpp_global_sum_ad.fh index d1d9bb7699..60f0990004 100644 --- a/mpp/include/mpp_global_sum_ad.fh +++ b/mpp/include/mpp_global_sum_ad.fh @@ -2,22 +2,21 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup mpp_domains_mod !> @{ diff --git a/mpp/include/mpp_global_sum_tl.fh b/mpp/include/mpp_global_sum_tl.fh index 817d7a89fd..38dbbddb2f 100644 --- a/mpp/include/mpp_global_sum_tl.fh +++ b/mpp/include/mpp_global_sum_tl.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup mpp_domains_mod !> @{ diff --git a/mpp/include/mpp_group_update.fh b/mpp/include/mpp_group_update.fh index 45be7ea531..c1eadcaf71 100644 --- a/mpp/include/mpp_group_update.fh +++ b/mpp/include/mpp_group_update.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** ! -*-f90-*- !> @addtogroup mpp_domains_mod diff --git a/mpp/include/mpp_read_2Ddecomp.fh b/mpp/include/mpp_read_2Ddecomp.fh index 4526cf4f75..baeffd69f1 100644 --- a/mpp/include/mpp_read_2Ddecomp.fh +++ b/mpp/include/mpp_read_2Ddecomp.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** subroutine READ_RECORD_CORE_(unit, field, num_words, data, start, axsiz) integer, intent(in) :: unit diff --git a/mpp/include/mpp_read_compressed.fh b/mpp/include/mpp_read_compressed.fh index 118d1f37f6..8a7851d6a6 100644 --- a/mpp/include/mpp_read_compressed.fh +++ b/mpp/include/mpp_read_compressed.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** subroutine MPP_READ_COMPRESSED_1D_(unit, field, domain, data, tindex) integer, intent(in) :: unit diff --git a/mpp/include/mpp_read_distributed_ascii.fh b/mpp/include/mpp_read_distributed_ascii.fh index b2715d7348..bd3f1f3395 100644 --- a/mpp/include/mpp_read_distributed_ascii.fh +++ b/mpp/include/mpp_read_distributed_ascii.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** subroutine MPP_READ_DISTRIBUTED_ASCII_1D_ (unit,fmt,ssize,data,iostat) integer, intent(in) :: unit diff --git a/mpp/include/mpp_read_distributed_ascii.inc b/mpp/include/mpp_read_distributed_ascii.inc index a597cb909b..296aad55e5 100644 --- a/mpp/include/mpp_read_distributed_ascii.inc +++ b/mpp/include/mpp_read_distributed_ascii.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file diff --git a/mpp/include/mpp_reduce_mpi.fh b/mpp/include/mpp_reduce_mpi.fh index 3064ae36d6..fcc0651916 100644 --- a/mpp/include/mpp_reduce_mpi.fh +++ b/mpp/include/mpp_reduce_mpi.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> Find the max of scalar a the PEs in pelist (all PEs if this argument is omitted) !! result is also automatically broadcast to all PEs diff --git a/mpp/include/mpp_reduce_nocomm.fh b/mpp/include/mpp_reduce_nocomm.fh index fa681dcf60..f92612528a 100644 --- a/mpp/include/mpp_reduce_nocomm.fh +++ b/mpp/include/mpp_reduce_nocomm.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> Find the max of scalar a the PEs in pelist (all PEs if this argument is omitted) !! result is also automatically broadcast to all PEs. Nocomm version diff --git a/mpp/include/mpp_scatter.fh b/mpp/include/mpp_scatter.fh index 6a0276842f..60f8ea6f38 100644 --- a/mpp/include/mpp_scatter.fh +++ b/mpp/include/mpp_scatter.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> addtogroup mpp_mod diff --git a/mpp/include/mpp_sum.inc b/mpp/include/mpp_sum.inc index cbb1e12923..d81125a7a6 100644 --- a/mpp/include/mpp_sum.inc +++ b/mpp/include/mpp_sum.inc @@ -1,22 +1,21 @@ ! -*-f90-*- !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file diff --git a/mpp/include/mpp_sum_ad.inc b/mpp/include/mpp_sum_ad.inc index 19cdea822a..ad07137859 100644 --- a/mpp/include/mpp_sum_ad.inc +++ b/mpp/include/mpp_sum_ad.inc @@ -1,22 +1,21 @@ ! -*-f90-*- !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief Adjoint summation routines for @ref mpp_mod diff --git a/mpp/include/mpp_sum_mpi.fh b/mpp/include/mpp_sum_mpi.fh index 5a5cd4858f..df5cc59c03 100644 --- a/mpp/include/mpp_sum_mpi.fh +++ b/mpp/include/mpp_sum_mpi.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> Sums array a over the PEs in pelist (all PEs if this argument is omitted) !! result is also automatically broadcast: all PEs have the sum in a at the end diff --git a/mpp/include/mpp_sum_mpi_ad.fh b/mpp/include/mpp_sum_mpi_ad.fh index ee28d6c4bf..d766e8d161 100644 --- a/mpp/include/mpp_sum_mpi_ad.fh +++ b/mpp/include/mpp_sum_mpi_ad.fh @@ -2,22 +2,21 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> Sums array a over the PEs in pelist (all PEs if this argument is omitted) !! forward array is already summed and broadcasted: all PEs already have the ad sum diff --git a/mpp/include/mpp_sum_nocomm.fh b/mpp/include/mpp_sum_nocomm.fh index 3ae6ad4138..fa00492dc6 100644 --- a/mpp/include/mpp_sum_nocomm.fh +++ b/mpp/include/mpp_sum_nocomm.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> Sums array a over the PEs in pelist (all PEs if this argument is omitted) !! result is also automatically broadcast: all PEs have the sum in a at the end diff --git a/mpp/include/mpp_sum_nocomm_ad.fh b/mpp/include/mpp_sum_nocomm_ad.fh index 263bfde8d6..e2d113e310 100644 --- a/mpp/include/mpp_sum_nocomm_ad.fh +++ b/mpp/include/mpp_sum_nocomm_ad.fh @@ -2,22 +2,21 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> Sums array a over the PEs in pelist (all PEs if this argument is omitted) diff --git a/mpp/include/mpp_transmit.inc b/mpp/include/mpp_transmit.inc index aaa770cc06..1c445ed0c5 100644 --- a/mpp/include/mpp_transmit.inc +++ b/mpp/include/mpp_transmit.inc @@ -1,22 +1,21 @@ ! -*-f90-*- !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief Routines for data transmission between PE's diff --git a/mpp/include/mpp_transmit_mpi.fh b/mpp/include/mpp_transmit_mpi.fh index 1fdfc2f6cb..df7b4f262c 100644 --- a/mpp/include/mpp_transmit_mpi.fh +++ b/mpp/include/mpp_transmit_mpi.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! ! diff --git a/mpp/include/mpp_transmit_nocomm.fh b/mpp/include/mpp_transmit_nocomm.fh index 8baaee60f5..6c6e6f1d03 100644 --- a/mpp/include/mpp_transmit_nocomm.fh +++ b/mpp/include/mpp_transmit_nocomm.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! ! diff --git a/mpp/include/mpp_type_mpi.fh b/mpp/include/mpp_type_mpi.fh index c1fa4e15c5..092f36c0ad 100644 --- a/mpp/include/mpp_type_mpi.fh +++ b/mpp/include/mpp_type_mpi.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup mpp_mod !> @{ diff --git a/mpp/include/mpp_type_nocomm.fh b/mpp/include/mpp_type_nocomm.fh index c1b11fdef5..8aa7e98e25 100644 --- a/mpp/include/mpp_type_nocomm.fh +++ b/mpp/include/mpp_type_nocomm.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** subroutine MPP_TYPE_CREATE_(field, array_of_subsizes, array_of_starts, dtype) diff --git a/mpp/include/mpp_unstruct_domain.inc b/mpp/include/mpp_unstruct_domain.inc index 2b88c630a1..d30876e238 100644 --- a/mpp/include/mpp_unstruct_domain.inc +++ b/mpp/include/mpp_unstruct_domain.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief Routines for defining and managing unstructured grids diff --git a/mpp/include/mpp_unstruct_pass_data.fh b/mpp/include/mpp_unstruct_pass_data.fh index 9dddff0f3d..1c5076cd66 100644 --- a/mpp/include/mpp_unstruct_pass_data.fh +++ b/mpp/include/mpp_unstruct_pass_data.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup mpp_domains_mod !> @{ diff --git a/mpp/include/mpp_update_domains2D.fh b/mpp/include/mpp_update_domains2D.fh index 8f13cd235a..b9b0a95e09 100644 --- a/mpp/include/mpp_update_domains2D.fh +++ b/mpp/include/mpp_update_domains2D.fh @@ -1,21 +1,20 @@ ! -*-f90-*- !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup mpp_domains_mod !> @{ diff --git a/mpp/include/mpp_update_domains2D_ad.fh b/mpp/include/mpp_update_domains2D_ad.fh index 8a876fdba5..b17e8e7f90 100644 --- a/mpp/include/mpp_update_domains2D_ad.fh +++ b/mpp/include/mpp_update_domains2D_ad.fh @@ -1,21 +1,20 @@ ! -*-f90-*- !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup mpp_domains_mod !> @{ diff --git a/mpp/include/mpp_update_domains2D_nonblock.fh b/mpp/include/mpp_update_domains2D_nonblock.fh index 7549abb533..b1854a18c5 100644 --- a/mpp/include/mpp_update_domains2D_nonblock.fh +++ b/mpp/include/mpp_update_domains2D_nonblock.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup mpp_domains_mod !> @{ diff --git a/mpp/include/mpp_update_nest_domains.fh b/mpp/include/mpp_update_nest_domains.fh index 054bc4ba2b..1c08ddcead 100644 --- a/mpp/include/mpp_update_nest_domains.fh +++ b/mpp/include/mpp_update_nest_domains.fh @@ -1,21 +1,20 @@ ! -*-f90-*- !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup mpp_domains_mod !> @{ diff --git a/mpp/include/mpp_util.inc b/mpp/include/mpp_util.inc index d5ac0681cf..aedf4725b0 100644 --- a/mpp/include/mpp_util.inc +++ b/mpp/include/mpp_util.inc @@ -2,22 +2,21 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief General utility functions for use in @ref mpp_mod diff --git a/mpp/include/mpp_util_mpi.inc b/mpp/include/mpp_util_mpi.inc index c849947bec..2b1a28f37d 100644 --- a/mpp/include/mpp_util_mpi.inc +++ b/mpp/include/mpp_util_mpi.inc @@ -1,22 +1,21 @@ ! -*-f90-*- !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief Utility routines for parallelization with MPI diff --git a/mpp/include/mpp_util_nocomm.inc b/mpp/include/mpp_util_nocomm.inc index 3fcdf6446e..6fd6e20d87 100644 --- a/mpp/include/mpp_util_nocomm.inc +++ b/mpp/include/mpp_util_nocomm.inc @@ -1,22 +1,21 @@ ! -*-f90-*- !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief Utility routines for parallelization, non-mpi version diff --git a/mpp/include/mpp_write.fh b/mpp/include/mpp_write.fh index a26e1f61cc..bfd6f43622 100644 --- a/mpp/include/mpp_write.fh +++ b/mpp/include/mpp_write.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** subroutine MPP_WRITE_( unit, field, data, tstamp) use mpp_parameter_mod, only : NULLUNIT diff --git a/mpp/include/mpp_write_2Ddecomp.fh b/mpp/include/mpp_write_2Ddecomp.fh index 69cd0ec60d..a739613321 100644 --- a/mpp/include/mpp_write_2Ddecomp.fh +++ b/mpp/include/mpp_write_2Ddecomp.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** subroutine WRITE_RECORD_( unit, field, num_words, data, time_in, domain, tile_count) !routine that is finally called by all mpp_write routines to perform the write diff --git a/mpp/include/mpp_write_compressed.fh b/mpp/include/mpp_write_compressed.fh index 9de14f8386..3117e1cc02 100644 --- a/mpp/include/mpp_write_compressed.fh +++ b/mpp/include/mpp_write_compressed.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** subroutine MPP_WRITE_COMPRESSED_1D_(unit, field, domain, data, nelems_io, tstamp, default_data) integer, intent(in) :: unit diff --git a/mpp/include/mpp_write_unlimited_axis.fh b/mpp/include/mpp_write_unlimited_axis.fh index ee0bf0186e..130c71d852 100644 --- a/mpp/include/mpp_write_unlimited_axis.fh +++ b/mpp/include/mpp_write_unlimited_axis.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** subroutine MPP_WRITE_UNLIMITED_AXIS_1D_(unit,field,domain,data,nelems_io) integer, intent(in) :: unit diff --git a/mpp/include/system_clock.fh b/mpp/include/system_clock.fh index 1ba8fda2ef..6ad5de8eb9 100644 --- a/mpp/include/system_clock.fh +++ b/mpp/include/system_clock.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file diff --git a/mpp/mpp.F90 b/mpp/mpp.F90 index e4ad262ca0..b10de61c46 100644 --- a/mpp/mpp.F90 +++ b/mpp/mpp.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !----------------------------------------------------------------------- ! Communication for message-passing codes diff --git a/mpp/mpp_data.F90 b/mpp/mpp_data.F90 index 639417fb07..1536da2dbd 100644 --- a/mpp/mpp_data.F90 +++ b/mpp/mpp_data.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup mpp_data_mod mpp_data_mod !> @ingroup mpp diff --git a/mpp/mpp_domains.F90 b/mpp/mpp_domains.F90 index a8873ae3fa..5579605482 100644 --- a/mpp/mpp_domains.F90 +++ b/mpp/mpp_domains.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !----------------------------------------------------------------------- !> @defgroup mpp_domains_mod mpp_domains_mod diff --git a/mpp/mpp_efp.F90 b/mpp/mpp_efp.F90 index cdfc7728bd..df9917c15e 100644 --- a/mpp/mpp_efp.F90 +++ b/mpp/mpp_efp.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup mpp_efp_mod mpp_efp_mod !> @ingroup mpp diff --git a/mpp/mpp_memuse.c b/mpp/mpp_memuse.c index 3a2e232177..1ccf1829d8 100644 --- a/mpp/mpp_memuse.c +++ b/mpp/mpp_memuse.c @@ -1,22 +1,3 @@ -/*********************************************************************** - * GNU Lesser General Public License - * - * This file is part of the GFDL Flexible Modeling System (FMS). - * - * FMS is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or (at - * your option) any later version. - * - * FMS is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FMS. If not, see . - **********************************************************************/ - /** * \Author David Robert Nadeau * Site: http://NadeauSoftware.com/ diff --git a/mpp/mpp_memutils.F90 b/mpp/mpp_memutils.F90 index 79a5f00467..941b3c9860 100644 --- a/mpp/mpp_memutils.F90 +++ b/mpp/mpp_memutils.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup mpp_memutils_mod mpp_memutils_mod !> @ingroup mpp diff --git a/mpp/mpp_parameter.F90 b/mpp/mpp_parameter.F90 index 1a8c895ad9..9d96b276d1 100644 --- a/mpp/mpp_parameter.F90 +++ b/mpp/mpp_parameter.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup mpp_parameter_mod mpp_parameter_mod !> @ingroup mpp diff --git a/mpp/mpp_pset.F90 b/mpp/mpp_pset.F90 index 918e1021d4..2b5ae5a568 100644 --- a/mpp/mpp_pset.F90 +++ b/mpp/mpp_pset.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** #ifdef test_mpp_pset !PSET_DEBUG is always turned on in the test program diff --git a/mpp/mpp_utilities.F90 b/mpp/mpp_utilities.F90 index 1e7bf78fb5..852073f1e0 100644 --- a/mpp/mpp_utilities.F90 +++ b/mpp/mpp_utilities.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup mpp_utilities_mod mpp_utilities_mod !> @ingroup mpp diff --git a/offloading/Makefile.am b/offloading/Makefile.am new file mode 100644 index 0000000000..3ec20a0276 --- /dev/null +++ b/offloading/Makefile.am @@ -0,0 +1,44 @@ +#*********************************************************************** +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. +#*********************************************************************** +# This is an automake file for the offloading directory of the FMS +# package. + +# Ryan Mulhall 2025 + +# Include .h and .mod files. +AM_CPPFLAGS = -I$(top_srcdir)/include +AM_FCFLAGS = $(FC_MODINC). $(FC_MODOUT)$(MODDIR) + +# Build this uninstalled convenience library. +noinst_LTLIBRARIES = liboffload.la + +# The convenience library depends on its source. +liboffload_la_SOURCES = \ + metadata_transfer.F90 \ + offloading_io.F90 + +MODFILES = \ + metadata_transfer_mod.$(FC_MODEXT) \ + offloading_io_mod.$(FC_MODEXT) + +offloading_io_mod.$(FC_MODEXT): metadata_transfer_mod.$(FC_MODEXT) + +BUILT_SOURCES = $(MODFILES) +nodist_include_HEADERS = $(MODFILES) + +include $(top_srcdir)/mkmods.mk diff --git a/offloading/metadata_transfer.F90 b/offloading/metadata_transfer.F90 new file mode 100644 index 0000000000..a484b94d72 --- /dev/null +++ b/offloading/metadata_transfer.F90 @@ -0,0 +1,322 @@ +!*********************************************************************** +!* Apache License 2.0 +!* +!* This file is part of the GFDL Flexible Modeling System (FMS). +!* +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at +!* +!* http://www.apache.org/licenses/LICENSE-2.0 +!* +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. +!*********************************************************************** +module metadata_transfer_mod + use platform_mod +#ifdef use_libMPI + use mpi, only: MPI_Type_create_struct, MPI_Type_commit, MPI_INTEGER, MPI_CHARACTER, & + MPI_DOUBLE, MPI_FLOAT, MPI_INT, MPI_LONG_INT, MPI_SUCCESS, MPI_ADDRESS_KIND +#endif + use mpp_mod, only: mpp_pe, mpp_root_pe, mpp_error, FATAL, mpp_get_current_pelist, mpp_npes + use fms_mod, only: string + + implicit none + + public + +#ifdef use_libMPI + external MPI_Bcast +#endif + + integer, parameter :: real8_type = 1 !< enumeration for real(kind=8) data type + integer, parameter :: real4_type = 2 !< enumeration for real(kind=4) data type + integer, parameter :: int8_type = 3 !< enumeration for integer(kind=8) data type + integer, parameter :: int4_type = 4 !< enumeration for integer(kind=4) data type + integer, parameter :: str_type = 5 !< enumeration for string data type + + integer, parameter :: ATTR_NAME_MAX_LENGTH = 128 + integer, parameter :: ATTR_VALUE_MAX_LENGTH = 128 + + !> Base class for broadcasting netcdf attribute data as a struct, holds the common fields + !! and routines for initializing the mpi datatype so that children classes can + !! be broadcasted. + type, abstract :: metadata_class + private + integer :: mpi_type_id = -1 !< MPI datatype id corresponding to this data objects data + !! -1 if not set + integer :: attribute_length = -1 !< length of the attribute value array, -1 if not set + character(len=ATTR_NAME_MAX_LENGTH) :: attribute_name !< name of the attribute to write + contains + procedure :: fms_metadata_broadcast + procedure :: fms_metadata_transfer_init + procedure :: get_attribute_name + procedure :: set_attribute_name + end type + + + !> Metadata class for real(kind=8) attribute values + type, extends(metadata_class) :: metadata_r8_type + real(r8_kind) :: attribute_value(ATTR_VALUE_MAX_LENGTH) + contains + procedure :: get_attribute_value => get_attribute_r8_value + procedure :: set_attribute_value => set_attribute_r8_value + end type metadata_r8_type + + !> Metadata class for real(kind=4) attribute values + type, extends(metadata_class) :: metadata_r4_type + real(r4_kind) :: attribute_value(ATTR_VALUE_MAX_LENGTH) + contains + procedure :: get_attribute_value => get_attribute_r4_value + procedure :: set_attribute_value => set_attribute_r4_value + end type metadata_r4_type + + !> Metadata class for integer(kind=8) attribute values + type, extends(metadata_class) :: metadata_i8_type + integer(i8_kind) :: attribute_value(ATTR_VALUE_MAX_LENGTH) + contains + procedure :: get_attribute_value => get_attribute_i8_value + procedure :: set_attribute_value => set_attribute_i8_value + end type metadata_i8_type + + !> Metadata class for integer(kind=4) attribute values + type, extends(metadata_class) :: metadata_i4_type + integer(i4_kind) :: attribute_value(ATTR_VALUE_MAX_LENGTH) + contains + procedure :: get_attribute_value => get_attribute_i4_value + procedure :: set_attribute_value => set_attribute_i4_value + end type metadata_i4_type + + !> Metadata class for string attribute values + type, extends(metadata_class) :: metadata_str_type + character(len=ATTR_VALUE_MAX_LENGTH) :: attribute_value + contains + procedure :: get_attribute_value => get_attribute_str_value + procedure :: set_attribute_value => set_attribute_str_value + end type metadata_str_type + + contains + + !> Initialize the mpi datatype for future broadcasts + !! The metadata object's functions (not subroutines) are stored as fields in memory, + !! so they need to be included in the MPI struct declaration. + subroutine fms_metadata_transfer_init(this, dtype) + class(metadata_class), intent(inout) :: this ! Broadcast the entire metadata object to all PEs in the current pelist + subroutine fms_metadata_broadcast(this) + class(metadata_class), intent(inout) :: this !< object that inherits metadata_class + integer :: ierror, curr_comm_id + integer, allocatable :: broadcasting_pes(:) + if (this%mpi_type_id .eq. -1) then + call mpp_error(FATAL, "fms_metadata_broadcast: metadata_transfer not initialized") + end if + + allocate(broadcasting_pes(mpp_npes())) + call mpp_get_current_pelist(broadcasting_pes, commID=curr_comm_id) + +#ifdef use_libMPI + ! Broadcast the metadata transfer type to all processes + select type(this) + type is (metadata_r8_type) + call MPI_Bcast(this, 1, this%mpi_type_id, mpp_root_pe(), curr_comm_id, ierror) + type is (metadata_r4_type) + call MPI_Bcast(this, 1, this%mpi_type_id, mpp_root_pe(), curr_comm_id, ierror) + type is (metadata_i4_type) + call MPI_Bcast(this, 1, this%mpi_type_id, mpp_root_pe(), curr_comm_id, ierror) + type is (metadata_i8_type) + call MPI_Bcast(this, 1, this%mpi_type_id, mpp_root_pe(), curr_comm_id, ierror) + type is (metadata_str_type) + call MPI_Bcast(this, 1, this%mpi_type_id, mpp_root_pe(), curr_comm_id, ierror) + end select + if (ierror /= MPI_SUCCESS) then + call mpp_error(FATAL, "fms_metadata_broadcast: MPI_Bcast failed") + end if +#else + call mpp_error(FATAL, "fms_metadata_broadcast: MPI library not enabled") +#endif + + + end subroutine fms_metadata_broadcast + + !> Broadcast an array of metadata objects to all PEs in the current pelist + subroutine fms_metadata_broadcast_all(metadata_objs) + class(metadata_class), intent(inout) :: metadata_objs(:) !< list of metadata objects + integer :: i + + do i=1, size(metadata_objs) + if (metadata_objs(i)%mpi_type_id .eq. -1) then + call mpp_error(FATAL, "fms_metadata_broadcast_all: metadata_transfer not initialized") + end if + call metadata_objs(i)%fms_metadata_broadcast() + enddo + + end subroutine fms_metadata_broadcast_all + + !> Getter for real 8 attribute_value + function get_attribute_r8_value(this) result(val) + class(metadata_r8_type), intent(inout) :: this + real(r8_kind), allocatable :: val(:) + val = this%attribute_value(1:this%attribute_length) + end function + + !> Setter for real 8 attribute_value + subroutine set_attribute_r8_value(this, val) + class(metadata_r8_type), intent(inout) :: this + real(r8_kind), intent(in) :: val(:) !< 8 byte real value to set attribute value to + if(size(val) .gt. ATTR_VALUE_MAX_LENGTH) then + call mpp_error(FATAL, & + "metadata_transfer_mod: attribute value array exceeds max length of "//string(ATTR_NAME_MAX_LENGTH)) + endif + this%attribute_length = size(val) + this%attribute_value(1:size(val)) = val + end subroutine + + !> Getter for real 4 attribute_value + function get_attribute_r4_value(this) result(val) + class(metadata_r4_type), intent(inout) :: this + real(r4_kind), allocatable :: val(:) + val = this%attribute_value(1:this%attribute_length) + end function + + !> Setter for real 4 attribute_value + subroutine set_attribute_r4_value(this, val) + class(metadata_r4_type), intent(inout) :: this + real(r4_kind), intent(in) :: val(:) !< 4 byte real attribute to set + if(size(val) .gt. ATTR_VALUE_MAX_LENGTH) then + call mpp_error(FATAL, & + "metadata_transfer_mod: attribute value array exceeds max length of "//string(ATTR_NAME_MAX_LENGTH)) + endif + this%attribute_length = size(val) + this%attribute_value(1:size(val)) = val + end subroutine + + !> Getter for integer(kind=8) attribute_value + function get_attribute_i8_value(this) result(val) + class(metadata_i8_type), intent(inout) :: this + integer(i8_kind), allocatable :: val(:) + val = this%attribute_value(1:this%attribute_length) + end function + + !> Setter for integer(kind=8) attribute_value + subroutine set_attribute_i8_value(this, val) + class(metadata_i8_type), intent(inout) :: this + integer(i8_kind), intent(in) :: val(:) !< 8 byte int attribute to set + if(size(val) .gt. ATTR_VALUE_MAX_LENGTH) then + call mpp_error(FATAL, & + "metadata_transfer_mod: attribute value array exceeds max length of "//string(ATTR_NAME_MAX_LENGTH)) + endif + this%attribute_length = size(val) + this%attribute_value(1:size(val)) = val + end subroutine + + !> Getter for integer(kind=4) attribute_value + function get_attribute_i4_value(this) result(val) + class(metadata_i4_type), intent(inout) :: this + integer(i4_kind), allocatable :: val(:) + val = this%attribute_value(1:this%attribute_length) + end function + + !> Setter for integer(kind=4) attribute_value + subroutine set_attribute_i4_value(this, val) + class(metadata_i4_type), intent(inout) :: this + integer(i4_kind), intent(in) :: val(:) !< 4 byte integer to set attribute value to + if(size(val) .gt. ATTR_VALUE_MAX_LENGTH) then + call mpp_error(FATAL, & + "metadata_transfer_mod: attribute value array exceeds max length of "//string(ATTR_NAME_MAX_LENGTH)) + endif + this%attribute_length = size(val) + this%attribute_value(1:size(val)) = val + end subroutine + + !> Getter for string attribute_value + function get_attribute_str_value(this) result(val) + class(metadata_str_type), intent(inout) :: this + character(len=:), allocatable :: val + val = this%attribute_value(1:this%attribute_length) + end function + + !> Setter for string attribute_value + subroutine set_attribute_str_value(this, val) + class(metadata_str_type), intent(inout) :: this + character(len=*), intent(in) :: val !< character string to set attribute value to + if(len(val) .gt. ATTR_VALUE_MAX_LENGTH) then + call mpp_error(FATAL, & + "metadata_transfer_mod: attribute value array exceeds max length of "//string(ATTR_NAME_MAX_LENGTH)) + endif + this%attribute_length = len(val) + this%attribute_value(1:len(val)) = val + end subroutine + + !> Getter for attribute_name (for all metadata types) + function get_attribute_name(this) result(val) + class(metadata_class), intent(inout) :: this + character(len=ATTR_NAME_MAX_LENGTH) :: val + val = trim(this%attribute_name) + end function + + !> Setter for attribute_name (for all metadata types) + subroutine set_attribute_name(this, val) + class(metadata_class), intent(inout) :: this + character(len=*), intent(in) :: val !< character string to set attribute name to + if(len(val) .gt. ATTR_NAME_MAX_LENGTH) then + call mpp_error(FATAL, & + "metadata_transfer_mod: attribute name exceeds max length of "//string(ATTR_VALUE_MAX_LENGTH)) + endif + this%attribute_name = val + end subroutine + +end module metadata_transfer_mod diff --git a/offloading/offloading_io.F90 b/offloading/offloading_io.F90 new file mode 100644 index 0000000000..74dadc15d6 --- /dev/null +++ b/offloading/offloading_io.F90 @@ -0,0 +1,972 @@ +!*********************************************************************** +!* Apache License 2.0 +!* +!* This file is part of the GFDL Flexible Modeling System (FMS). +!* +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at +!* +!* http://www.apache.org/licenses/LICENSE-2.0 +!* +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. +!*********************************************************************** +module offloading_io_mod + use mpp_mod + use mpp_domains_mod + use fms_string_utils_mod, only: string + use fms2_io_mod + use metadata_transfer_mod + use platform_mod + use fms_mod + + implicit none + + integer :: current_files_init !< number of currently initialized offloading files + logical :: module_is_initialized !< .true. if module has been initialized + + integer :: max_files = 10 !< amount of offloaded files to allocate space for + + namelist / offloading_io_nml / max_files + + !> Structure to hold offloading file information + type :: offloading_obj_out + integer :: id + character(len=:), allocatable :: filename !< filename of the offloaded netcdf file + class(FmsNetcdfFile_t), allocatable :: fileobj !< fms2_io file object + type(domain2D) :: domain_out !< domain on offloading PEs + end type + + !> Offload equivalent of register_axis in fms2_io_mod + !! Registers an axis to a netcdf file on offloaded PEs. File must have been opened with open_file_offload. + !! TODO: add register_unstructured_axis_offload for the unstructured grid + interface register_axis_offload + procedure :: register_netcdf_axis_offload + procedure :: register_domain_axis_offload + end interface + + !> Offload equivalent of write_data in fms2_io_mod + !! Writes data to a netcdf file on offloaded PEs. File must have been opened with open_file_offload. + interface write_data_offload + procedure :: write_data_offload_2d + procedure :: write_data_offload_3d + end interface + + !> Array of offloading objects that have been initialized by this module. + type(offloading_obj_out), allocatable, target :: offloading_objs(:) + + private + + public :: offloading_io_init, open_file_offload + public :: global_metadata_offload, close_file_offload, register_axis_offload, register_field_offload + public :: write_data_offload + public :: create_cubic_domain, create_lat_lon_domain + + contains + + !> Initialize by allocating array used to keep track of offloading file objects. + subroutine offloading_io_init() + integer :: ierr, io + if (module_is_initialized) return + current_files_init = 0 + allocate(offloading_objs(max_files)) + module_is_initialized = .true. + read (input_nml_file, offloading_io_nml, iostat=io) + ierr = check_nml_error(io,'offloading_io_nml') + end subroutine offloading_io_init + + !> Open a netcdf file and set it up for offloaded writes + !! This routine should be called from both the model PEs and the offload PEs, with the full list + !! of pes for each group being provided. The model PEs will broadcast the filename and domain. + subroutine open_file_offload(fileobj, filename, domain_in, pe_in, pe_out) + class(FmsNetcdfFile_t), intent(inout) :: fileobj !< fms2_io file object + character(len=*), intent(in) :: filename !< filename to open + type(domain2D), intent(inout) :: domain_in !< model domain (from model pes) + integer, intent(in) :: pe_in(:) !< model pes + integer, intent(in) :: pe_out(:) !< offload pes + + integer, parameter :: str_len = 255 + character(len=str_len) :: filename_out(1) + integer :: object_id + integer :: global_domain_size(2) + integer :: ntile + integer, allocatable :: all_current_pes(:) + integer, allocatable :: broadcasting_pes(:) + logical :: is_pe_out + + is_pe_out = ANY(pe_out .eq. mpp_pe()) + + ! This should be called from the model PEs and the offload PEs + if (.not. module_is_initialized) & + call mpp_error(FATAL, "offloading_io_mod is not initialized") + + allocate(all_current_pes(mpp_npes())) + call mpp_get_current_pelist(all_current_pes) + + filename_out(1) = "" + if (mpp_pe() .eq. pe_in(1)) then + !< The root model pe gets the domain info (ntiles and size of global domain) + ntile = mpp_get_ntile_count(domain_in) + + !< The number of tiles must be the same as the number of offloading pes + if ( MOD(size(pe_out), ntile) .ne. 0 ) & + call mpp_error(FATAL, "The number of offloading PEs must be the same as the number of tiles of the domain") + filename_out(1) = filename + + call mpp_get_global_domain(domain_in, xsize=global_domain_size(1), ysize=global_domain_size(2)) + endif + + ! A "Root" model PE broadcasts the filename, domain size, and number of tiles to the offload pes + if (mpp_pe() .eq. pe_in(1) .or. is_pe_out) then + allocate(broadcasting_pes(1 + size(pe_out))) + broadcasting_pes(1) = pe_in(1) ! root pe + broadcasting_pes(2:size(broadcasting_pes)) = pe_out ! offload pes + call mpp_set_current_pelist( broadcasting_pes ) + ! TODO bundle these into a single derived type to reduce the number of broadcasts + call mpp_broadcast(filename_out, str_len, pe_in(1)) + call mpp_broadcast(global_domain_size, size(global_domain_size), pe_in(1)) + call mpp_broadcast(ntile, pe_in(1)) + endif + + ! Broadcast the domain + call mpp_set_current_pelist(all_current_pes) + if (is_pe_out) call mpp_define_null_domain(domain_in) + call mpp_broadcast_domain(domain_in) + + ! The offload pes inits the offloading object and return an object id + if (is_pe_out) then + call mpp_set_current_pelist(pe_out) + object_id = init_offloading_object(filename_out(1), global_domain_size(1), global_domain_size(2),& + ntile) + endif + call mpp_set_current_pelist(all_current_pes) + call mpp_broadcast(object_id, pe_out(1)) + + ! Init the "offloading object" in the fileobj + call fileobj%offloading_obj_in%init(object_id, pe_out, pe_in, domain_in) + end subroutine open_file_offload + + !> Broadcast and register a global metadata attribute on offloading PEs + subroutine global_metadata_offload(fileobj, attribute_name, attribute_value) + class(FmsNetcdfFile_t), intent(inout) :: fileobj !< fms2_io file object + character(len=*), intent(in) :: attribute_name !< name of the global attribute to register + class(*), intent(in) :: attribute_value !< value of the global attribute to register (r4, r8, i4, i8, str) + + integer :: id + type(offloading_obj_out), pointer :: this + + !TODO better PEs management! + integer, allocatable :: offloading_pes(:) + integer, allocatable :: model_pes(:) + integer, allocatable :: all_current_pes(:) + integer, allocatable :: broadcasting_pes(:) + logical :: is_model_pe + character(len=255) :: att_name(1) + + integer :: int_buf + real(r4_kind), allocatable :: r4_tmp(:) + real(r8_kind), allocatable :: r8_tmp(:) + integer(i4_kind) , allocatable :: i4_tmp(:) + integer(i8_kind) , allocatable :: i8_tmp(:) + character(len=:), allocatable :: str_tmp + class(metadata_class), allocatable :: transfer_obj + + select type (attribute_value) + type is (real(kind=r8_kind)) + allocate(metadata_r8_type :: transfer_obj) + call transfer_obj%fms_metadata_transfer_init(real8_type) + type is (real(kind=r4_kind)) + allocate(metadata_r4_type :: transfer_obj) + call transfer_obj%fms_metadata_transfer_init(real4_type) + type is (integer(kind=i4_kind)) + allocate(metadata_i4_type :: transfer_obj) + call transfer_obj%fms_metadata_transfer_init(int4_type) + type is (integer(kind=i8_kind)) + allocate(metadata_i8_type :: transfer_obj) + call transfer_obj%fms_metadata_transfer_init(int8_type) + type is (character(*)) + allocate(metadata_str_type :: transfer_obj) + call transfer_obj%fms_metadata_transfer_init(str_type) + class default + call mpp_error(FATAL, "Unsupported attribute type for offloading: " // string(attribute_value)) + end select + + offloading_pes = fileobj%offloading_obj_in%offloading_pes + model_pes = fileobj%offloading_obj_in%model_pes + is_model_pe = fileobj%offloading_obj_in%is_model_pe + + id = fileobj%offloading_obj_in%id + this => offloading_objs(id) + + if (is_model_pe) then + att_name(1) = attribute_name + call transfer_obj%set_attribute_name(attribute_name) + endif + + allocate(all_current_pes(mpp_npes())) + call mpp_get_current_pelist(all_current_pes) + + if (mpp_pe() .eq. model_pes(1) .or. .not. is_model_pe) then + + allocate(broadcasting_pes(1 + size(offloading_pes))) + broadcasting_pes(1) = model_pes(1) + broadcasting_pes(2:size(broadcasting_pes)) = offloading_pes + call mpp_set_current_pelist( broadcasting_pes ) + + select type (attribute_value) + type is (real(kind=r4_kind)) + ! TODO replace this mess with a single call if possible + if (is_model_pe) then + select type(transfer_obj) + type is (metadata_r4_type) + call transfer_obj%set_attribute_value([attribute_value]) + end select + endif + call transfer_obj%fms_metadata_broadcast() + select type(transfer_obj) + type is (metadata_r4_type) + r4_tmp = transfer_obj%get_attribute_value() + end select + att_name(1) = transfer_obj%get_attribute_name() + if (.not. is_model_pe) then + call register_global_attribute(this%fileobj, att_name(1), r4_tmp) + endif + + type is (real(kind=r8_kind)) + ! TODO replace this mess with a single call if possible + if (is_model_pe) then + select type(transfer_obj) + type is (metadata_r8_type) + call transfer_obj%set_attribute_value([attribute_value]) + end select + endif + call transfer_obj%fms_metadata_broadcast() + select type(transfer_obj) + type is (metadata_r8_type) + r8_tmp = transfer_obj%get_attribute_value() + end select + att_name(1) = transfer_obj%get_attribute_name() + if (.not. is_model_pe) then + call register_global_attribute(this%fileobj, att_name(1), r8_tmp) + endif + + type is (integer(kind=i4_kind)) + if (is_model_pe) then + select type(transfer_obj) + type is (metadata_i4_type) + call transfer_obj%set_attribute_value([attribute_value]) + int_buf = attribute_value + end select + endif + call transfer_obj%fms_metadata_broadcast() + select type(transfer_obj) + type is (metadata_i4_type) + i4_tmp = transfer_obj%get_attribute_value() + end select + att_name(1) = transfer_obj%get_attribute_name() + if (.not. is_model_pe) then + call register_global_attribute(this%fileobj, att_name(1), i4_tmp) + endif + + type is (integer(kind=i8_kind)) + ! TODO replace this mess with a single call if possible + if (is_model_pe) then + select type(transfer_obj) + type is (metadata_i8_type) + call transfer_obj%set_attribute_value([attribute_value]) + end select + endif + call transfer_obj%fms_metadata_broadcast() + select type(transfer_obj) + type is (metadata_i8_type) + i8_tmp = transfer_obj%get_attribute_value() + end select + att_name(1) = transfer_obj%get_attribute_name() + if (.not. is_model_pe) then + call register_global_attribute(this%fileobj, att_name(1), i8_tmp) + endif + + type is (character(len=*)) + ! TODO replace this mess with a single call if possible + if (is_model_pe) then + select type(transfer_obj) + type is (metadata_str_type) + call transfer_obj%set_attribute_value(attribute_value) + end select + endif + call transfer_obj%fms_metadata_broadcast() + select type(transfer_obj) + type is (metadata_str_type) + str_tmp = transfer_obj%get_attribute_value() + end select + att_name(1) = transfer_obj%get_attribute_name() + if (.not. is_model_pe) then + call register_global_attribute(this%fileobj, att_name(1), str_tmp) + endif + + end select + endif + + call mpp_set_current_pelist(all_current_pes) + end subroutine + + !> Register a domain axis (ie. x or y) on offloading PEs + subroutine register_domain_axis_offload(fileobj, axis_name, cart) + class(FmsNetcdfFile_t), intent(inout) :: fileobj !< fms2_io file object + character(len=*), intent(in) :: axis_name !< axis name to be written to file + character(len=1), intent(in) :: cart !< must be either 'x' or 'y' for cartesian axis + + integer :: id + type(offloading_obj_out), pointer :: this + + integer, allocatable :: offloading_pes(:) + integer, allocatable :: model_pes(:) + integer, allocatable :: all_current_pes(:) + integer, allocatable :: broadcasting_pes(:) + logical :: is_model_pe + character(len=ATTR_NAME_MAX_LENGTH) :: var_info(2) + + offloading_pes = fileobj%offloading_obj_in%offloading_pes + model_pes = fileobj%offloading_obj_in%model_pes + is_model_pe = fileobj%offloading_obj_in%is_model_pe + + id = fileobj%offloading_obj_in%id + this => offloading_objs(id) + + if (is_model_pe) then + var_info(1) = axis_name + var_info(2) = cart + endif + + allocate(all_current_pes(mpp_npes())) + call mpp_get_current_pelist(all_current_pes) + + if (mpp_pe() .eq. model_pes(1) .or. .not. is_model_pe) then + allocate(broadcasting_pes(1 + size(offloading_pes))) + broadcasting_pes(1) = model_pes(1) + broadcasting_pes(2:size(broadcasting_pes)) = offloading_pes + call mpp_set_current_pelist( broadcasting_pes ) + call mpp_broadcast(var_info, 255, model_pes(1)) + endif + + if (.not. is_model_pe) then + select type(file=>this%fileobj) + type is(FmsNetcdfDomainFile_t) + call register_axis(file, trim(var_info(1)), trim(var_info(2))) + class default + call mpp_error(FATAL, & + "offloading_io_mod::register_domain_axis_offload currently only supports FmsNetcdfDomainFile_t") + end select + endif + + call mpp_set_current_pelist(all_current_pes) + end subroutine register_domain_axis_offload + + !> Register a netcdf axis on offloading PEs + subroutine register_netcdf_axis_offload(fileobj, axis_name, length) + class(FmsNetcdfFile_t), intent(inout) :: fileobj !< fms2_io file object + character(len=*), intent(in) :: axis_name !< axis name to be written to file + integer, intent(in) :: length !< length of the axis + + integer :: id + type(offloading_obj_out), pointer :: this + + !TODO better PEs management! + integer, allocatable :: offloading_pes(:) + integer, allocatable :: model_pes(:) + integer, allocatable :: all_current_pes(:) + integer, allocatable :: broadcasting_pes(:) + logical :: is_model_pe + character(len=255) :: var_axis(1) + integer :: var_length + integer :: axis_length + + offloading_pes = fileobj%offloading_obj_in%offloading_pes + model_pes = fileobj%offloading_obj_in%model_pes + is_model_pe = fileobj%offloading_obj_in%is_model_pe + + id = fileobj%offloading_obj_in%id + this => offloading_objs(id) + + ! get var data on root for broadcasting to offload pes + if (mpp_pe() .eq. model_pes(1)) then + var_axis(1) = trim(axis_name) + axis_length = len_trim(var_axis(1)) + var_length = length + endif + + allocate(all_current_pes(mpp_npes())) + call mpp_get_current_pelist(all_current_pes) + + ! root pe broadcasts the axis name and length to offload pes + if (mpp_pe() .eq. model_pes(1) .or. .not. is_model_pe) then + allocate(broadcasting_pes(1 + size(offloading_pes))) + broadcasting_pes(1) = model_pes(1) + broadcasting_pes(2:size(broadcasting_pes)) = offloading_pes + call mpp_set_current_pelist( broadcasting_pes ) + ! TODO bundle these into a single derived type to reduce the number of broadcasts + call mpp_broadcast(axis_length, model_pes(1)) + call mpp_broadcast(var_axis, axis_length, model_pes(1)) + call mpp_broadcast(var_length, model_pes(1)) + endif + + if (.not. is_model_pe) then + select type(wut=>this%fileobj) + type is(FmsNetcdfDomainFile_t) + call register_axis(this%fileobj, var_axis(1)(1:axis_length), var_length) + class default + call mpp_error(FATAL, & + "offloading_io_mod::register_netcdf_axis_offload currently only supports FmsNetcdfDomainFile_t") + end select + endif + + call mpp_set_current_pelist(all_current_pes) + end subroutine register_netcdf_axis_offload + + !> Register a netcdf field on offloading PEs + subroutine register_field_offload(fileobj, varname, vartype, dimensions) + class(FmsNetcdfFile_t), intent(inout) :: fileobj !> fms2_io file object + character(len=*), intent(in) :: varname !> name of the variable to be registered + character(len=*), intent(in) :: vartype !> type of the variable to be registered + !! must be one of {r4_type, r8_type, i4_type, i8_type, str_type} + character(len=*), intent(in) :: dimensions(:) !< previously registered dimension/axis names for the variable + + integer :: id + type(offloading_obj_out), pointer :: this + integer :: ndim + + !TODO better PEs management! + integer, allocatable :: offloading_pes(:) + integer, allocatable :: model_pes(:) + integer, allocatable :: all_current_pes(:) + integer, allocatable :: broadcasting_pes(:) + logical :: is_model_pe + character(len=255), allocatable :: var_info(:) + + offloading_pes = fileobj%offloading_obj_in%offloading_pes + model_pes = fileobj%offloading_obj_in%model_pes + is_model_pe = fileobj%offloading_obj_in%is_model_pe + + id = fileobj%offloading_obj_in%id + this => offloading_objs(id) + + allocate(all_current_pes(mpp_npes())) + call mpp_get_current_pelist(all_current_pes) + + if (is_model_pe) then + ndim = size(dimensions) + + allocate(var_info(ndim + 2)) + var_info(1) = varname + var_info(2) = vartype + var_info(3:) = dimensions + + endif + + if (mpp_pe() .eq. model_pes(1) .or. .not. is_model_pe) then + allocate(broadcasting_pes(1 + size(offloading_pes))) + broadcasting_pes(1) = model_pes(1) + broadcasting_pes(2:size(broadcasting_pes)) = offloading_pes + call mpp_set_current_pelist( broadcasting_pes ) + call mpp_broadcast(ndim, model_pes(1)) + + if (.not. is_model_pe) allocate(var_info(ndim + 2)) + call mpp_broadcast(var_info, 255, model_pes(1)) + endif + + if (.not. is_model_pe) then + !select type(wut=>this%fileobj) + ! type is(FmsNetcdfDomainFile_t) + call register_field(this%fileobj, trim(var_info(1)), trim(var_info(2)), var_info(3:)) + !end select + endif + + call mpp_set_current_pelist(all_current_pes) + end subroutine + + !> Write 3D data to offloaded netcdf file + subroutine write_data_offload_3d(fileobj, varname, vardata, unlim_dim_level) + class(FmsNetcdfFile_t), intent(inout) :: fileobj !< fms2_io file object + character(len=*), intent(in) :: varname !< name of the variable to be written + real(kind=r4_kind), intent(in) :: vardata(:,:,:) !< 3D data to be written + integer, intent(in), optional :: unlim_dim_level !< level along unlimited dimension to write to + + integer :: id + type(offloading_obj_out), pointer :: this + + !TODO better PEs management! + integer, allocatable :: offloading_pes(:) + integer, allocatable :: model_pes(:) + integer, allocatable :: all_current_pes(:) + logical :: is_model_pe + + real(kind=r4_kind), allocatable :: var_r4_data(:,:,:) + type(domain2D) :: domain_out + type(domain2D) :: domain_in + integer :: isc, iec, jsc, jec, nz, redistribute_clock + character(len=ATTR_NAME_MAX_LENGTH) :: varname_tmp(1) + + offloading_pes = fileobj%offloading_obj_in%offloading_pes + model_pes = fileobj%offloading_obj_in%model_pes + is_model_pe = fileobj%offloading_obj_in%is_model_pe + + id = fileobj%offloading_obj_in%id + this => offloading_objs(id) + + allocate(all_current_pes(mpp_npes())) + call mpp_get_current_pelist(all_current_pes) + + redistribute_clock = mpp_clock_id( 'data_transfer' ) + call mpp_clock_begin(redistribute_clock) + + nz = size(vardata, 3) + call mpp_broadcast(nz, model_pes(1)) + + !Allocate space to store the data! + if (.not. is_model_pe) then + domain_out = this%domain_out + call mpp_get_data_domain(domain_out, isc, iec, jsc, jec) + allocate(var_r4_data(isc:iec, jsc:jec, nz)) + call mpp_define_null_domain(domain_in) + else + domain_in = fileobj%offloading_obj_in%domain_in + call mpp_define_null_domain(domain_out) + endif + + ! get domain from the other pes + call mpp_broadcast_domain(domain_out) + call mpp_broadcast_domain(domain_in) + + call mpp_redistribute( domain_in, vardata, domain_out, var_r4_data) + call mpp_redistribute( domain_in, vardata, domain_out, var_r4_data, free=.true.) + + if(mpp_pe() .eq. model_pes(1)) then + varname_tmp(1) = trim(varname) + endif + call mpp_broadcast(varname_tmp, 255, model_pes(1)) + + call mpp_clock_end(redistribute_clock) + + if (.not. is_model_pe) then + select type(wut=>this%fileobj) + type is(FmsNetcdfDomainFile_t) + if (present(unlim_dim_level)) then + call write_data(wut, varname, var_r4_data, unlim_dim_level=unlim_dim_level) + else + call write_data(wut, varname, var_r4_data) + endif + end select + endif + call mpp_set_current_pelist(all_current_pes) + end subroutine write_data_offload_3d + + !> Write 2D data to offloaded netcdf file + subroutine write_data_offload_2d(fileobj, varname, vardata) + class(FmsNetcdfFile_t), intent(inout) :: fileobj !< fms2_io file object + character(len=*), intent(in) :: varname !< name of the variable to be written + real(kind=r4_kind), intent(in) :: vardata(:,:) !< 2D data to be written + + integer :: id + type(offloading_obj_out), pointer :: this + + !TODO better PEs management! + integer, allocatable :: offloading_pes(:) + integer, allocatable :: model_pes(:) + integer, allocatable :: all_current_pes(:) + logical :: is_model_pe + + real(kind=r4_kind), allocatable :: var_r4_data(:,:) + type(domain2D) :: domain_out + type(domain2D) :: domain_in + integer :: isc, iec, jsc, jec + character(len=255) :: varname_tmp(1) + + offloading_pes = fileobj%offloading_obj_in%offloading_pes + model_pes = fileobj%offloading_obj_in%model_pes + is_model_pe = fileobj%offloading_obj_in%is_model_pe + + id = fileobj%offloading_obj_in%id + this => offloading_objs(id) + + allocate(all_current_pes(mpp_npes())) + call mpp_get_current_pelist(all_current_pes) + + !Allocate space to store the data! + if (.not. is_model_pe) then + domain_out = this%domain_out + call mpp_get_compute_domain(domain_out, isc, iec, jsc, jec) + allocate(var_r4_data(isc:iec, jsc:jec)) + call mpp_define_null_domain(domain_in) + else + domain_in = fileobj%offloading_obj_in%domain_in + call mpp_define_null_domain(domain_out) + endif + + call mpp_broadcast_domain(domain_out) + call mpp_broadcast_domain(domain_in) + + ! redistribute data from model domain to offload domain and then free memory for future calls + call mpp_redistribute( domain_in, vardata, domain_out, var_r4_data) + call mpp_redistribute( domain_in, vardata, domain_out, var_r4_data, free=.true.) + + ! broadcast the variable name + if(mpp_pe() .eq. model_pes(1)) then + varname_tmp(1) = trim(varname) + endif + call mpp_broadcast(varname_tmp, 255, model_pes(1)) + + if (.not. is_model_pe) then + select type(wut=>this%fileobj) + type is(FmsNetcdfDomainFile_t) + call write_data(wut, varname_tmp(1), var_r4_data) + end select + endif + call mpp_set_current_pelist(all_current_pes) + end subroutine write_data_offload_2d + + !> Close offloaded netcdf file + subroutine close_file_offload(fileobj) + class(FmsNetcdfFile_t), intent(inout) :: fileobj !> fms2_io file object to close + + integer :: id + type(offloading_obj_out), pointer :: this + logical :: is_model_pe + + id = fileobj%offloading_obj_in%id + this => offloading_objs(id) + is_model_pe = fileobj%offloading_obj_in%is_model_pe + + if (.not. is_model_pe) call close_file(this%fileobj) + end subroutine close_file_offload + + !> Initialize an offloading object on offload PEs + integer function init_offloading_object(filename, nx, ny, ntile) + character(len=*), intent(in) :: filename !< filename to open + integer, intent(in) :: nx !< x size of the global domain + integer, intent(in) :: ny !< y size of the global domain + integer, intent(in) :: ntile !< number of tiles, only supports 1 for lat-lon or 6 for cubed-sphere + + type(offloading_obj_out), pointer :: this + integer, allocatable :: curr_pelist(:) + + current_files_init = current_files_init + 1 + if (current_files_init .gt. max_files) & + call mpp_error(FATAL, "The number of files is too large") + + ! An array of offloading objects is stored in this module, the "id" is the index of the object in the array + this => offloading_objs(current_files_init) + this%id = current_files_init + this%filename = trim(filename) + + ! does npes return current pelist or total?? + allocate(curr_pelist(mpp_npes())) + call mpp_get_current_pelist(curr_pelist) + + select case (ntile) + case (1) + this%domain_out = create_lat_lon_domain(nx, ny) + case (6) + this%domain_out = create_cubic_domain(nx, ny, ntile, (/1,1/), offload_pes=curr_pelist) + case default + call mpp_error(FATAL, "Unsupported number of tiles for offloading: " // trim(adjustl(string(ntile)))) + end select + + allocate(FmsNetcdfDomainFile_t :: this%fileobj) + select type (fileobj => this%fileobj) + type is (FmsNetcdfDomainFile_t) + if ( .not. open_file(fileobj, trim(this%filename), "overwrite", this%domain_out)) & + call mpp_error(FATAL, "Error opening file") + end select + + init_offloading_object = current_files_init + end function + + !! TODO move this somewhere else + function create_lat_lon_domain(nx_in, ny_in, halox, haloy ) & + result(domain_out) + integer, intent(in) :: nx_in !< number of lat-lon grid points in x direction + integer, intent(in) :: ny_in !< number of lat-lon grid points in y direction + integer, intent(in), optional :: halox !< number of halo points in x direction + integer, intent(in), optional :: haloy !< number of halo points in y direction + type(domain2d) :: domain_out + integer :: layout(2) + + call mpp_define_layout( (/1,nx_in,1,ny_in/), mpp_npes(), layout ) + call mpp_define_domains( (/1,nx_in,1,ny_in/), layout, domain_out, xhalo=halox, yhalo=haloy) + call mpp_define_io_domain(domain_out, (/1,1/)) + end function create_lat_lon_domain + + !! TODO move this somewhere else + function create_cubic_domain(nx_in, ny_in, ntiles, io_layout, nhalos, offload_pes, layout) & + result(domain_out) + integer, intent(in) :: nx_in !< number of grid points in x direction per tile + integer, intent(in) :: ny_in !< number of grid points in y direction per tile + integer, intent(in) :: ntiles !< number of tiles, must be 6 for cubed-sphere + integer, intent(in) :: io_layout(2) !< layout for I/O operations + integer, intent(in), optional :: nhalos !< number of halo points + integer, intent(in), optional :: offload_pes(:) !< list of PEs used for offloading write operations + integer, optional :: layout(2) !< layout to be used for each tile) + + type(domain2d) :: domain_out + + integer :: npes + integer :: npes_per_tile + integer :: layout_tmp(2) + integer, allocatable :: global_indices(:,:) + integer, allocatable :: layout2D(:,:) + integer, allocatable :: pe_start(:) + integer, allocatable :: pe_end(:) + integer :: n + + npes = mpp_npes() + if( mod(npes, ntiles) .NE. 0 ) call mpp_error(FATAL, & + "create_cubic_domain: npes is not divisible by ntiles") + + npes_per_tile = npes/ntiles + if( .not. present(layout)) then + call mpp_define_layout ((/1,nx_in,1,ny_in/), npes_per_tile, layout_tmp ) + else + layout_tmp = layout + endif + + allocate(global_indices(4, ntiles)) + allocate(layout2D(2, ntiles)) + allocate(pe_start(ntiles), pe_end(ntiles)) + + do n = 1, ntiles + global_indices(:,n) = (/1,nx_in,1,ny_in/) + layout2D(:,n) = layout_tmp + if( present(offload_pes)) then + pe_start(n) = offload_pes((n-1)*npes_per_tile+1) + pe_end(n) = offload_pes((n)*npes_per_tile) + else + pe_start(n) = (n-1)*npes_per_tile + pe_end(n) = n*npes_per_tile-1 + endif + end do + + print *, "pe: ", mpp_pe(), "creating mosaic with pe_start", pe_start, "pe_end", pe_end + + call define_cubic_mosaic(domain_out, (/nx_in,nx_in,nx_in,nx_in,nx_in,nx_in/), & + (/ny_in,ny_in,ny_in,ny_in,ny_in,ny_in/), & + global_indices, layout2D, pe_start, pe_end, io_layout, nhalos ) + end function create_cubic_domain + + !> @brief Initialize a cubed-sphere atomsphere domain. + !! TODO move this somehere else + subroutine define_cubic_mosaic(domain, ni, nj, global_indices, layout, pe_start, pe_end, & + io_layout, nhalos) + + integer, dimension(:), intent(in) :: ni !< number of grid points in i direction per tile + integer, dimension(:), intent(in) :: nj !< number of grid points in j direction per tile + integer, dimension(:,:), intent(in) :: global_indices !< global indices for each tile + integer, dimension(:,:), intent(in) :: layout !< array of layouts for each tile + integer, dimension(:), intent(in) :: pe_start !< starting PE for each tile + integer, dimension(:), intent(in) :: pe_end !< ending PE for each tile + integer, dimension(2), intent(in) :: io_layout !< layout for I/O operations + type(domain2d), intent(inout) :: domain !< A cubed-sphere domain. + integer, optional, intent(in) :: nhalos !< number of halo points + + integer, dimension(12) :: tile1 + integer, dimension(12) :: tile2 + integer, dimension(12) :: istart1 + integer, dimension(12) :: iend1 + integer, dimension(12) :: jstart1 + integer, dimension(12) :: jend1 + integer, dimension(12) :: istart2 + integer, dimension(12) :: iend2 + integer, dimension(12) :: jstart2 + integer, dimension(12) :: jend2 + integer :: ntiles + integer :: num_contact + integer, dimension(2) :: msize + integer :: whalo + integer :: ehalo + integer :: shalo + integer :: nhalo + + ntiles = 6 + num_contact = 12 + + whalo = 2 + if (present(nhalos)) whalo = nhalos + ehalo = whalo + shalo = whalo + nhalo = whalo + + if (size(pe_start) .ne. 6 .or. size(pe_end) .ne. 6 ) then + call mpp_error(FATAL, "size of pe_start and pe_end should be 6.") + endif + if (size(global_indices,1) .ne. 4) then + call mpp_error(FATAL, "size of first dimension of global_indices should be 4.") + endif + if (size(global_indices,2) .ne. 6) then + call mpp_error(FATAL, "size of second dimension of global_indices should be 6.") + endif + if (size(layout,1) .ne. 2) then + call mpp_error(FATAL, "size of first dimension of layout should be 2.") + endif + if (size(layout,2) .ne. 6) then + call mpp_error(FATAL, "size of second dimension of layout should be 6.") + endif + if (size(ni) .ne. 6 .or. size(nj) .ne. 6) then + call mpp_error(FATAL, "size of ni and nj should be 6.") + endif + + !Contact line 1, between tile 1 (EAST) and tile 2 (WEST) + tile1(1) = 1 + tile2(1) = 2 + istart1(1) = ni(1) + iend1(1) = ni(1) + jstart1(1) = 1 + jend1(1) = nj(1) + istart2(1) = 1 + iend2(1) = 1 + jstart2(1) = 1 + jend2(1) = nj(2) + + !Contact line 2, between tile 1 (NORTH) and tile 3 (WEST) + tile1(2) = 1 + tile2(2) = 3 + istart1(2) = 1 + iend1(2) = ni(1) + jstart1(2) = nj(1) + jend1(2) = nj(1) + istart2(2) = 1 + iend2(2) = 1 + jstart2(2) = nj(3) + jend2(2) = 1 + + !Contact line 3, between tile 1 (WEST) and tile 5 (NORTH) + tile1(3) = 1 + tile2(3) = 5 + istart1(3) = 1 + iend1(3) = 1 + jstart1(3) = 1 + jend1(3) = nj(1) + istart2(3) = ni(5) + iend2(3) = 1 + jstart2(3) = nj(5) + jend2(3) = nj(5) + + !Contact line 4, between tile 1 (SOUTH) and tile 6 (NORTH) + tile1(4) = 1 + tile2(4) = 6 + istart1(4) = 1 + iend1(4) = ni(1) + jstart1(4) = 1 + jend1(4) = 1 + istart2(4) = 1 + iend2(4) = ni(6) + jstart2(4) = nj(6) + jend2(4) = nj(6) + + !Contact line 5, between tile 2 (NORTH) and tile 3 (SOUTH) + tile1(5) = 2 + tile2(5) = 3 + istart1(5) = 1 + iend1(5) = ni(2) + jstart1(5) = nj(2) + jend1(5) = nj(2) + istart2(5) = 1 + iend2(5) = ni(3) + jstart2(5) = 1 + jend2(5) = 1 + + !Contact line 6, between tile 2 (EAST) and tile 4 (SOUTH) + tile1(6) = 2 + tile2(6) = 4 + istart1(6) = ni(2) + iend1(6) = ni(2) + jstart1(6) = 1 + jend1(6) = nj(2) + istart2(6) = ni(4) + iend2(6) = 1 + jstart2(6) = 1 + jend2(6) = 1 + + !Contact line 7, between tile 2 (SOUTH) and tile 6 (EAST) + tile1(7) = 2 + tile2(7) = 6 + istart1(7) = 1 + iend1(7) = ni(2) + jstart1(7) = 1 + jend1(7) = 1 + istart2(7) = ni(6) + iend2(7) = ni(6) + jstart2(7) = nj(6) + jend2(7) = 1 + + !Contact line 8, between tile 3 (EAST) and tile 4 (WEST) + tile1(8) = 3 + tile2(8) = 4 + istart1(8) = ni(3) + iend1(8) = ni(3) + jstart1(8) = 1 + jend1(8) = nj(3) + istart2(8) = 1 + iend2(8) = 1 + jstart2(8) = 1 + jend2(8) = nj(4) + + !Contact line 9, between tile 3 (NORTH) and tile 5 (WEST) + tile1(9) = 3 + tile2(9) = 5 + istart1(9) = 1 + iend1(9) = ni(3) + jstart1(9) = nj(3) + jend1(9) = nj(3) + istart2(9) = 1 + iend2(9) = 1 + jstart2(9) = nj(5) + jend2(9) = 1 + + !Contact line 10, between tile 4 (NORTH) and tile 5 (SOUTH) + tile1(10) = 4 + tile2(10) = 5 + istart1(10) = 1 + iend1(10) = ni(4) + jstart1(10) = nj(4) + jend1(10) = nj(4) + istart2(10) = 1 + iend2(10) = ni(5) + jstart2(10) = 1 + jend2(10) = 1 + + !Contact line 11, between tile 4 (EAST) and tile 6 (SOUTH) + tile1(11) = 4 + tile2(11) = 6 + istart1(11) = ni(4) + iend1(11) = ni(4) + jstart1(11) = 1 + jend1(11) = nj(4) + istart2(11) = ni(6) + iend2(11) = 1 + jstart2(11) = 1 + jend2(11) = 1 + + !Contact line 12, between tile 5 (EAST) and tile 6 (WEST) + tile1(12) = 5 + tile2(12) = 6 + istart1(12) = ni(5) + iend1(12) = ni(5) + jstart1(12) = 1 + jend1(12) = nj(5) + istart2(12) = 1 + iend2(12) = 1 + jstart2(12) = 1 + jend2(12) = nj(6) + msize(1) = maxval(ni(:)/layout(1,:)) + whalo + ehalo + 1 + msize(2) = maxval(nj(:)/layout(2,:)) + shalo + nhalo + 1 + call mpp_define_mosaic(global_indices, layout, domain, ntiles, num_contact, tile1, & + tile2, istart1, iend1, jstart1, jend1, istart2, iend2, & + jstart2, jend2, pe_start, pe_end, symmetry = .true., & + whalo=whalo, ehalo=ehalo, shalo=shalo, nhalo=nhalo, & + name=trim("Cubed-sphere"), memory_size=msize) + call mpp_define_io_domain(domain, io_layout) + end subroutine define_cubic_mosaic +end module offloading_io_mod diff --git a/parser/Makefile.am b/parser/Makefile.am index b4b7fa3298..fbc807bdf8 100644 --- a/parser/Makefile.am +++ b/parser/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the constants directory of the FMS diff --git a/parser/fms_yaml_output.F90 b/parser/fms_yaml_output.F90 index f87cb0481f..91a0dfd9ed 100644 --- a/parser/fms_yaml_output.F90 +++ b/parser/fms_yaml_output.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup fms_yaml_output_mod fms_yaml_output_mod !> @ingroup parser diff --git a/parser/yaml_output_functions.c b/parser/yaml_output_functions.c index e748a82729..81f51a230c 100644 --- a/parser/yaml_output_functions.c +++ b/parser/yaml_output_functions.c @@ -1,21 +1,20 @@ /*********************************************************************** - * GNU Lesser General Public License + * Apache License 2.0 * * This file is part of the GFDL Flexible Modeling System (FMS). * - * FMS is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or (at - * your option) any later version. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * FMS is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Lesser General Public - * License along with FMS. If not, see . - **********************************************************************/ + * FMS is distributed in the hope that it will be useful, but WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the License for the specific language + * governing permissions and limitations under the License. + ***********************************************************************/ #ifdef use_yaml #include diff --git a/parser/yaml_parser.F90 b/parser/yaml_parser.F90 index d7a500e8e1..88fa8b2fc6 100644 --- a/parser/yaml_parser.F90 +++ b/parser/yaml_parser.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup yaml_parser_mod yaml_parser_mod @@ -66,6 +65,8 @@ module yaml_parser_mod integer, parameter :: MISSING_FILE = -1 !< Error code if the yaml file is missing integer, parameter :: PARSER_INIT_ERROR = -2 !< Error code if unable to create a parser object integer, parameter :: INVALID_YAML = -3 !< Error code if unable to parse a yaml file +integer, parameter :: INVALID_ALIAS = -4 !< Error code if an invalid alias was passed in +integer, parameter :: MAX_LEVELS_REACH = -5 !< Error code if the MAX_LEVELS is reach integer, parameter :: SUCCESSFUL = 1 !< "Error" code if the parsing was successful !> @brief c functions binding @@ -279,6 +280,12 @@ subroutine check_error_code(error_code, filename) call mpp_error(FATAL, "Error initializing the parser for the file:"//trim(filename)) case (INVALID_YAML) call mpp_error(FATAL, "Error parsing the file:"//trim(filename)//". Check that your yaml file is valid") + case (INVALID_ALIAS) + call mpp_error(FATAL, "An alias (*alias_name) in your file:"//trim(filename)//" is invalid."//& + "Make sure that all aliases correspond to an anchor (&anchor_name)!") + case (MAX_LEVELS_REACH) + call mpp_error(FATAL, "The file:"//trim(filename)//" has reached the maximum number of level!"//& + "Try setting -DMAX_LEVELS to a number greater than the current limit and recompile") end select end subroutine check_error_code diff --git a/parser/yaml_parser_binding.c b/parser/yaml_parser_binding.c index 9967f96a52..859cb251e8 100644 --- a/parser/yaml_parser_binding.c +++ b/parser/yaml_parser_binding.c @@ -1,21 +1,20 @@ /*********************************************************************** - * GNU Lesser General Public License + * Apache License 2.0 * * This file is part of the GFDL Flexible Modeling System (FMS). * - * FMS is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or (at - * your option) any later version. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * FMS is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Lesser General Public - * License along with FMS. If not, see . - **********************************************************************/ + * FMS is distributed in the hope that it will be useful, but WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the License for the specific language + * governing permissions and limitations under the License. + ***********************************************************************/ #ifdef use_yaml @@ -23,406 +22,790 @@ #include #include -/* Type to store info about key */ +// TODO: FMS_MAX_FILE_LEN is repeated from fms_platform.h. +// Consider consolidating constant definitions or using a shared header. +#ifndef FMS_MAX_FILE_LEN +#define FMS_MAX_FILE_LEN 255 +#endif + +#define FMS_FILE_LEN FMS_MAX_FILE_LEN + +// TODO: These constants are also defined in yaml_parser.F90 +// Consider consolidating constant definitions or using a shared header. +const int MISSING_FILE = -1; +const int PARSER_INIT_ERROR = -2; +const int INVALID_YAML = -3; +const int INVALID_ALIAS = -4; +const int MAX_LEVELS_REACH = -5; +const int SUCCESSFUL = 1; + +#ifndef MAX_LEVELS +#define MAX_LEVELS 10 +#endif + +// DEBUG_FMS_YAML_PARSER is a hidden macro that may be useful when debugging parser issues +#ifdef DEBUG_FMS_YAML_PARSER + #define DEBUG_PRINT(...) printf(__VA_ARGS__) +#else + #define DEBUG_PRINT(...) // nothing +#endif + +/** + * @brief Represents a key-value pair within a YAML file. + * + * Includes metadata for tracking the key's structure and origin. + */ +typedef struct { + int key_id; ///< ID of this key + char key[FMS_FILE_LEN]; ///< Name of the key + char value[FMS_FILE_LEN]; ///< Value associated with the key + char parent_name[FMS_FILE_LEN]; ///< Name of the parent block + int parent_key; ///< ID of the parent block +} KeyValuePairs; + +/** + * @brief Represents the contents of a YAML anchor as an array of key-value pairs. + */ +typedef struct { + int nkeys; ///< Number of keys defined for the anchor + KeyValuePairs *keys; ///< Array of key-value pairs + char anchor_name[FMS_FILE_LEN]; ///< Name of the anchor + int nlevels; + int pid[MAX_LEVELS]; + char parent_names[MAX_LEVELS][FMS_FILE_LEN]; +} AnchorsType; + +/** + * @brief Represents the contents of a YAML file as an array of key-value pairs. + */ typedef struct { - int key_number; /* Id of this key */ - char key[255]; /* Name of the key */ - char value[255]; /* Value of the key */ - char parent_name[255]; /* Name of the block the key belongs to */ - int parent_key; /* Id of the block the key belongs to */ -}key_value_pairs; - -/* Type to store all of the keys */ -typedef struct { - int nkeys; - key_value_pairs *keys; -}yaml_file; - -/* Type to store all the yaml files that are opened */ + int nkeys; ///< Number of keys defined in the YAML file + KeyValuePairs *keys; ///< Array of key-value pairs + AnchorsType *Anchors; ///< Array of anchors in the yaml file + int nanchors; ///< Number of anchors that have been defined in the file +} YamlFile; + +/** + * @brief Represents all YAML files that have been opened and parsed. + */ typedef struct { - yaml_file *files; -}file_type; + YamlFile *files; ///< Array of parsed YAML files +} FileType; -file_type my_files; /* Array of opened yaml files */ -int nfiles = 0; /* Number of files in the yaml file */ +// Local Variables: +FileType my_files; // Struct holding parsed YAML files +int nfiles = 0; // Number of files opened and parsed so far -/* @brief Private c function that gets the number of key-value pairs in a block - @return Number of key-value pairs in this block */ -int get_nkeys_binding(int *file_id, int *block_id) +/** + * @brief Private C function that gets the number of key-value pairs in a block. + * + * @param file_id Pointer to the file index. + * @param block_id Pointer to the block identifier. + * @return Number of key-value pairs in this block. + */ +int get_nkeys_binding(const int *file_id, const int *block_id) { - int nkeys = 0; /* Number of key-value pairs */ - int i; /* For loops */ - int j = *file_id; /* To minimize the typing :) */ + int nkeys = 0; + int j = *file_id; - for ( i = 1; i <= my_files.files[j].nkeys; i++ ) + for (int i = 1; i <= my_files.files[j].nkeys; i++) { - if(my_files.files[j].keys[i].parent_key == *block_id && !strcmp(my_files.files[j].keys[i].parent_name, "") ) nkeys = nkeys + 1; + if (my_files.files[j].keys[i].parent_key == *block_id && + my_files.files[j].keys[i].parent_name[0] == '\0') + nkeys++; } return nkeys; - } -/* @brief Private c function that gets the ids of the key-value pairs in a block */ -void get_key_ids_binding(int *file_id, int *block_id, int *key_ids) +/** + * @brief Private C function that gets the ids of the key-value pairs in a block. + * + * @param file_id Pointer to the file index. + * @param block_id Pointer to the block identifier. + * @param key_ids Output array to store the key ids. +*/ +void get_key_ids_binding(const int *file_id, const int *block_id, int *key_ids) { - int i; /* For loops */ - int key_count = -1; /* Number of key-value pairs */ - int j = *file_id; /* To minimize the typing :) */ - - for ( i = 1; i <= my_files.files[j].nkeys; i++ ) - { - if(my_files.files[j].keys[i].parent_key == *block_id && !strcmp(my_files.files[j].keys[i].parent_name, "") ){ - key_count = key_count + 1; - key_ids[key_count] = i; - } - } + int j = *file_id; + int key_count = 0; - return; + for (int i = 1; i <= my_files.files[j].nkeys; i++) + { + if (my_files.files[j].keys[i].parent_key == *block_id && + my_files.files[j].keys[i].parent_name[0] == '\0') + { + key_ids[key_count++] = i; + } + } } -/* @brief Private c function that get the key from a key_id in a yaml file - @return Name of the key obtained */ -char *get_key(int *file_id, int *key_id) +/** + * @brief Gets the key name corresponding to a key ID in a YAML file. + * + * @param file_id Pointer to the index of the YAML file (read-only). + * @param key_id Pointer to the index of the key within that file (read-only). + * @return Pointer to the key name. + * + * @note Assumes file_id and key_id are valid and checked beforehand. + */ +char *get_key(const int *file_id, const int *key_id) { - int j = *file_id; /* To minimize the typing :) */ - return my_files.files[j].keys[*key_id].key; + return my_files.files[*file_id].keys[*key_id].key; } -/* @brief Private c function that get the value from a key_id in a yaml file - @return String containing the value obtained */ -char *get_value(int *file_id, int *key_id) +/** + * @brief Gets the key value corresponding to a key ID in a YAML file. + * + * @param file_id Pointer to the index of the YAML file (read-only). + * @param key_id Pointer to the index of the key within that file (read-only). + * @return Pointer to the key value. + * + * @note Assumes file_id and key_id are valid and checked beforehand. + */ +char *get_value(const int *file_id, const int *key_id) { - int j = *file_id; /* To minimize the typing :) */ - return my_files.files[j].keys[*key_id].value; + return my_files.files[*file_id].keys[*key_id].value; } -/* @brief Private c functions get gets the block name from a block id - @return String containing the value obtained */ -char *get_block(int *file_id, int *block_id) +/** + * @brief Gets the block name corresponding to a block id in a YAML file. + * + * @param file_id Pointer to the index of the YAML file (read-only). + * @param block_id Pointer to the index of the block within that file (read-only). + * @return Pointer to the block name. + * + * @note Assumes file_id and block_id are valid and checked beforehand. + */ +char *get_block(const int *file_id, const int *block_id) { - int j = *file_id; /* To minimize the typing :) */ - return my_files.files[j].keys[*block_id].parent_name; + return my_files.files[*file_id].keys[*block_id].parent_name; } -/* @brief Private c function that determines they value of a key in yaml_file - @return c pointer with the value obtained */ -char *get_value_from_key_wrap(int *file_id, int *block_id, char *key_name, int *sucess) /*, char *key_name) */ +/** + * @brief Searches for the value of a given key name within a specified block in a YAML file. + * + * @param file_id Pointer to the index of the YAML file (read-only). + * @param block_id Pointer to the ID of the block to search within (read-only). + * @param key_name The name of the key to search for (read-only). + * @param success Pointer to an int flag that will be set to 1 if found, 0 otherwise. + * @return Pointer to the value string if found, or NULL if not found. + * + * @note Assumes file_id and block_id are valid and checked beforehand. + */ +char *get_value_from_key_wrap(const int *file_id, const int *block_id, const char *key_name, int *success) { - int i; /* For loops */ - int j = *file_id; /* To minimize the typing :) */ + int i; + int j = *file_id; - *sucess = 0; /* Flag indicating if the search was sucessful */ + *success = 0; // Initialize flag to failure - for ( i = 1; i <= my_files.files[j].nkeys; i++ ) - { - if (my_files.files[j].keys[i].parent_key == *block_id) - { - if( strcmp(my_files.files[j].keys[i].key, key_name) == 0) + for (i = 1; i <= my_files.files[j].nkeys; i++) + { + if (my_files.files[j].keys[i].parent_key == *block_id) { - *sucess = 1; - break; + if (strcmp(my_files.files[j].keys[i].key, key_name) == 0) + { + *success = 1; + return my_files.files[j].keys[i].value; + } } - } - } - if (*sucess == 1) {return my_files.files[j].keys[i].value;} else {return "";} + } + + return ""; // Key not found } -/* @brief Private c function that determines the number of blocks with block_name in the yaml file - @return Number of blocks with block_name */ -int get_num_blocks_all(int *file_id, char *block_name) +/** + * @brief Counts the number of blocks with a given block name in a YAML file. + * + * @param file_id Pointer to the index of the YAML file (read-only). + * @param block_name Name of the block to count (read-only). + * @return Number of blocks matching the given block name. + * + * @note Assumes valid file_id and non-null block_name. + * The function skips the key at index 0 (if indexing starts at 1). + */ +int get_num_blocks_all(const int *file_id, const char *block_name) { - int nblocks = 0; /* Number of blocks */ - int i; /* For loops */ - int j = *file_id; /* To minimize the typing :) */ + int nblocks = 0; + int i; + int fid = *file_id; - for ( i = 1; i <= my_files.files[j].nkeys; i++ ) - { - if(strcmp(my_files.files[j].keys[i].parent_name, block_name) == 0) nblocks = nblocks + 1; - } + /* Loop through keys, assuming keys are 1-based indexed */ + for (i = 1; i <= my_files.files[fid].nkeys; i++) + { + if (strcmp(my_files.files[fid].keys[i].parent_name, block_name) == 0) + { + nblocks++; + } + } - return nblocks; + return nblocks; } -/* @brief Private c function that determines the number of unique blocks (i.e diag_files, varlist, etc) - @return The number of unique blocks */ -int get_num_unique_blocks_bind(int *file_id, int *parent_block_id) +/** + * @brief Counts the number of unique blocks with a given parent block ID. + * + * @param file_id Pointer to the index of the YAML file (read-only). + * @param parent_block_id Pointer to the ID of the parent block (read-only). + * @return Number of unique blocks found. + */ +int get_num_unique_blocks_bind(const int *file_id, const int *parent_block_id) { - int nblocks = 0; /* Number of blocks */ - int i; /* For loops */ - int j = *file_id; /* To minimize the typing :) */ - char block_names[my_files.files[j].nkeys][255]; /* Array that stores the names of the unique blocks*/ - bool found; /* True if the block name was already found (i.e it not unqiue)*/ - int k; /* For loops */ - - for ( i = 1; i <= my_files.files[j].nkeys; i++ ) - { - if (my_files.files[j].keys[i].parent_key == *parent_block_id ) + int nblocks = 0; + int i, k; + int fid = *file_id; + char block_names[my_files.files[fid].nkeys][FMS_FILE_LEN]; // Assuming 255 or defined length + bool found; + + for (i = 1; i <= my_files.files[fid].nkeys; i++) { - if (strcmp(my_files.files[j].keys[i].parent_name, "") == 0){ - continue; - } - found = false; - for (k = 1; k <= nblocks; k++) - { - if (strcmp(block_names[k], my_files.files[j].keys[i].parent_name) == 0) + if (my_files.files[fid].keys[i].parent_key == *parent_block_id) { - found = true; - break; + if (strcmp(my_files.files[fid].keys[i].parent_name, "") == 0) + continue; + + found = false; + for (k = 0; k < nblocks; k++) + { + if (strcmp(block_names[k], my_files.files[fid].keys[i].parent_name) == 0) + { + found = true; + break; + } + } + + if (found) + continue; + + strcpy(block_names[nblocks], my_files.files[fid].keys[i].parent_name); + ++nblocks; } - } + } - if (found) continue; + return nblocks; +} - nblocks = nblocks + 1; - strcpy(block_names[nblocks], my_files.files[j].keys[i].parent_name); - // printf("Block names: %s \n", block_names[nblocks]); +/** + * @brief Gets the IDs of the unique blocks with a given parent block ID. + * + * @param file_id Pointer to the index of the YAML file (read-only). + * @param block_ids Array to store the unique block IDs (output). + * @param parent_block_id Pointer to the ID of the parent block (read-only). + */ +void get_unique_block_ids_bind(const int *file_id, int *block_ids, const int *parent_block_id) +{ + int nblocks = 0; + int i, k; + int fid = *file_id; + char block_names[my_files.files[fid].nkeys][FMS_FILE_LEN]; + bool found; + + for (i = 1; i <= my_files.files[fid].nkeys; i++) + { + if (my_files.files[fid].keys[i].parent_key == *parent_block_id) + { + if (strcmp(my_files.files[fid].keys[i].parent_name, "") == 0) + continue; + + found = false; + for (k = 0; k < nblocks; k++) + { + if (strcmp(block_names[k], my_files.files[fid].keys[i].parent_name) == 0) + { + found = true; + break; + } + } + + if (found) + continue; + + block_ids[nblocks] = my_files.files[fid].keys[i].key_id; + strcpy(block_names[nblocks], my_files.files[fid].keys[i].parent_name); + ++nblocks; + } } - } - return nblocks; } -/* @brief Private c function that determines the ids of the unique blocks (i.e diag_files, varlist, etc) - @return The ids of the unique blocks */ -void get_unique_block_ids_bind(int *file_id, int *block_ids, int *parent_block_id) +/** + * @brief Counts the number of blocks with a given name that belong to a specified parent block. + * + * @param file_id Pointer to the index of the YAML file (read-only). + * @param block_name Name of the blocks to count. + * @param parent_block_id Pointer to the ID of the parent block (read-only). + * @return Number of blocks with the specified block_name and parent_block_id. + */ +int get_num_blocks_child(const int *file_id, const char *block_name, const int *parent_block_id) { - int nblocks = 0; /* Number of blocks */ - int i; /* For loops */ - int j = *file_id; /* To minimize the typing :) */ - char block_names[my_files.files[j].nkeys][255]; /* Array that stores the names of the unique blocks*/ - bool found; /* True if the block name was already found (i.e it not unqiue)*/ - int k; /* For loops */ - - for ( i = 1; i <= my_files.files[j].nkeys; i++ ) - { - if (my_files.files[j].keys[i].parent_key == *parent_block_id ) + int nblocks = 0; // Counter for matching blocks + int i; + int fid = *file_id; // Local copy for clarity + + for (i = 1; i <= my_files.files[fid].nkeys; i++) { - if (strcmp(my_files.files[j].keys[i].parent_name, "") == 0){ - continue; - } - found = false; - for (k = 1; k <= nblocks; k++) - { - if (strcmp(block_names[k], my_files.files[j].keys[i].parent_name) == 0) + if (strcmp(my_files.files[fid].keys[i].parent_name, block_name) == 0 && + my_files.files[fid].keys[i].parent_key == *parent_block_id) { - found = true; - break; + nblocks++; } - } + } - if (found) continue; + return nblocks; +} - nblocks = nblocks + 1; - block_ids[nblocks - 1] = my_files.files[j].keys[i].key_number; - strcpy(block_names[nblocks], my_files.files[j].keys[i].parent_name); - //printf("Block names: %s \n", block_names[nblocks]); +/** + * @brief Retrieves the IDs of all blocks with the specified block_name in a YAML file. + * + * @param file_id Pointer to the index of the YAML file (read-only). + * @param block_name Name of the block to search for. + * @param block_ids Output array to store the found block IDs. + * + * @note Assumes block_ids points to enough memory to hold all matching block IDs. + */ +void get_block_ids_all(const int *file_id, const char *block_name, int *block_ids) +{ + int i; + int nblocks = 0; // Number of matching blocks found + int fid = *file_id; // Local copy of file ID for convenience + + // Loop over keys; assuming keys index starts at 1 + for (i = 1; i <= my_files.files[fid].nkeys; i++) + { + if (strcmp(my_files.files[fid].keys[i].parent_name, block_name) == 0) + { + block_ids[nblocks] = my_files.files[fid].keys[i].key_id; + nblocks++; + } } - } - return; } -/* @brief Private c function that determines the number of blocks with block_name that belong to - a parent block with parent_block_id in the yaml file - @return Number of blocks with block_name */ -int get_num_blocks_child(int *file_id, char *block_name, int *parent_block_id) + +/** + * @brief Finds the IDs of child blocks with a given name and parent block ID in a YAML file. + * + * @param file_id Pointer to the index of the YAML file (read-only). + * @param block_name Name of the block to search for (read-only). + * @param block_ids Output array to store matching block IDs. + * @param parent_key_id Pointer to the parent block ID (read-only). + * + * @note Assumes block_ids points to an array large enough to hold all matching IDs. + * Assumes valid file_id and non-null pointers. + */ +void get_block_ids_child(const int *file_id, const char *block_name, int *block_ids, const int *parent_key_id) { - int nblocks = 0; /* Number of blocks */ - int i; /* For loops */ - int j = *file_id; /* To minimize the typing :) */ + int nblocks = 0; // Tracks number of matches found + int fid = *file_id; - for ( i = 1; i <= my_files.files[j].nkeys; i++ ) + // no need to check i == 0 + for ( int i = 1; i <= my_files.files[fid].nkeys; i++ ) { - if(strcmp(my_files.files[j].keys[i].parent_name, block_name) == 0 && my_files.files[j].keys[i].parent_key == *parent_block_id) nblocks = nblocks + 1; + if(strcmp(my_files.files[fid].keys[i].parent_name, block_name) == 0 && + my_files.files[fid].keys[i].parent_key == *parent_key_id) + { + block_ids[nblocks++] = my_files.files[fid].keys[i].key_id; + } } - - return nblocks; } +/** + * @brief Checks whether a given block ID is valid within a YAML file. + * + * @param file_id Pointer to the index of the YAML file (read-only). + * @param block_id Pointer to the block ID to validate (read-only). + * @return true if the block ID is valid, false otherwise. + * + * @note A block ID is invalid if: + * - It is less than zero or greater than the number of keys in the file. + * - Its associated parent name is empty (except for block ID 0). + */ +bool is_valid_block_id(const int *file_id, const int *block_id) +{ + int fid = *file_id; + int bid = *block_id; + + if (bid <= -1 || bid > my_files.files[fid].nkeys) { + return false; + } -/* @brief Private c function that gets the ids of the blocks with block_name in the yaml file */ -void get_block_ids_all(int *file_id, char *block_name, int *block_ids) + if (bid != 0 && strcmp(my_files.files[fid].keys[bid].parent_name, "") == 0) { + return false; + } + + return true; +} + +/** + * @brief Checks whether a given key ID is valid within a YAML file. + * + * @param file_id Pointer to the index of the YAML file (read-only). + * @param key_id Pointer to the key ID to validate (read-only). + * @return true if the key ID is valid, false otherwise. + * + * @note A key ID is valid if it is between 0 and the number of keys in the file (inclusive). + */ +bool is_valid_key_id(const int *file_id, const int *key_id) { - int i; /* For loops */ - int nblocks = -1; /* Number of blocks */ - int j = *file_id; /* To minimize the typing :) */ + int fid = *file_id; + int kid = *key_id; - for ( i = 1; i <= my_files.files[j].nkeys; i++ ) - { - if(strcmp(my_files.files[j].keys[i].parent_name, block_name) == 0) { - nblocks = nblocks + 1; - block_ids[nblocks] = my_files.files[j].keys[i].key_number; - } - } - return; + return (kid > -1 && kid <= my_files.files[fid].nkeys); } -/* @brief Private c function that gets the ids of the blocks with block_name and that - belong to a parent block id in the yaml file */ -void get_block_ids_child(int *file_id, char *block_name, int *block_ids, int *parent_key_id ) +/** + * @brief Checks whether a given file ID is valid. + * + * @param file_id Pointer to the file ID to validate (read-only). + * @return true if the file ID is valid, false otherwise. + * + * @note A file ID is valid if it is between 0 (inclusive) and nfiles (exclusive). + */ +bool is_valid_file_id(const int *file_id) { - int i; /* For loops */ - int nblocks = -1; /* Number of blocks */ - int j = *file_id; /* To minimize the typing :) */ + int fid = *file_id; - for ( i = 1; i <= my_files.files[j].nkeys; i++ ) - { - if(strcmp(my_files.files[j].keys[i].parent_name, block_name) == 0 && my_files.files[j].keys[i].parent_key == *parent_key_id) { - nblocks = nblocks + 1; - block_ids[nblocks] = my_files.files[j].keys[i].key_number; - } - } - return; + return (fid > -1 && fid < nfiles); +} + +/** + * @brief Increments the number of levels, enforcing a maximum limit. + * + * Increments the value pointed to by `nlevels`. If the new value exceeds + * the maximum allowed (`MAX_LEVELS`), the function returns an error code. + * + * @param nlevels Pointer to the current number of levels to be incremented. + * + * @return SUCCESSFUL (typically 0) if increment is valid; + * MAX_LEVELS_REACH if the maximum level count is exceeded. + */ +int increment_nlevels(int *nlevels) { + (*nlevels) ++; + if (*nlevels > MAX_LEVELS){ + return MAX_LEVELS_REACH; + } + return SUCCESSFUL; } -/* @brief Private c function to determine if a block_id is valid */ -bool is_valid_block_id(int *file_id, int *block_id) +/** + * @brief Initializes an AnchorsType instance. + * + * @param anchor Pointer to the AnchorsType to initialize. + * @param name Name of the anchor (null-terminated string). + */ +void init_anchor(AnchorsType *anchor, const char *name, const char *parent_name) { - /* If the block id it not in the allowed range is not a valid block id */ - if (*block_id <= -1 || *block_id > my_files.files[*file_id].nkeys) {return false;} + if (anchor == NULL || name == NULL) return; + + anchor->nkeys = 0; + anchor->keys = (KeyValuePairs*)calloc(1, sizeof(KeyValuePairs)); + strcpy(anchor->anchor_name, name); + anchor->nlevels = 0; + anchor->pid[0] = 0; + strcpy(anchor->parent_names[0], parent_name); +} - /* If the block id has an empty parent name then it is not a valid block id */ - if (*block_id != 0 && strcmp(my_files.files[*file_id].keys[*block_id].parent_name, "") == 0) {return false;} - return true; +/** + * @brief Populates a KeyValuePairs structure with provided key data. + * + * @param my_key Pointer to a KeyValuePairs structure to populate. + * @param key_id Integer identifier for the key. + * @param parent_key Integer identifier for the parent key. + * @param key String representing the key name (can be NULL). + * @param value String representing the key value (can be NULL). + * @param parent_name String representing the parent key's name (can be NULL). + */ +void add_key(KeyValuePairs *my_key, const int key_id, const int parent_key, + const char *key, const char *value, const char *parent_name) { + + my_key->key_id = key_id; + my_key->parent_key = parent_key; + + if (key) { + strncpy(my_key->key, key, sizeof(my_key->key) - 1); + my_key->key[sizeof(my_key->key) - 1] = '\0'; + } else { + my_key->key[0] = '\0'; + } + + if (value) { + strncpy(my_key->value, value, sizeof(my_key->value) - 1); + my_key->value[sizeof(my_key->value) - 1] = '\0'; + } else { + my_key->value[0] = '\0'; + } + + if (parent_name) { + strncpy(my_key->parent_name, parent_name, sizeof(my_key->parent_name) - 1); + my_key->parent_name[sizeof(my_key->parent_name) - 1] = '\0'; + } else { + my_key->parent_name[0] = '\0'; + } } -/* @brief Private c function to determine if a key_id is valid */ -bool is_valid_key_id(int *file_id, int *key_id) +/** + * @brief Populates a KeyValuePairs structure in anchor with a key/value + * + * @param anchor Pointer to the AnchorsType to populate + * @param key Key of the yaml key/value pair + * @param value Value of the yaml key/value pair + */ +void add_anchor_key(AnchorsType *anchor, const char *key, const char *value) { - if (*key_id > -1 && *key_id <= my_files.files[*file_id].nkeys) {return true;} - else { return false;} + anchor->nkeys++; + anchor->keys = realloc(anchor->keys, (anchor->nkeys+1)*sizeof(KeyValuePairs)); + + KeyValuePairs *my_key = &anchor->keys[anchor->nkeys]; + add_key(my_key, anchor->nkeys, anchor->pid[anchor->nlevels], + key, value, ""); + + DEBUG_PRINT("ANCHOR :: Key_number: %i, parent_key: %i, %s:%s \n ", my_key->key_id, my_key->parent_key, my_key->key, my_key->value); } -/* @brief Private c function to determine if a file_id is valid */ -bool is_valid_file_id(int *file_id) +/** + * @brief Populates a KeyValuePairs structure in anchor with a new block + * + * @param anchor Pointer to the AnchorsType to populate + * @param key Name of the block + * @return 1 if successful otherwise error code + */ +int add_anchor_parent(AnchorsType *anchor, const char *key) { - if (*file_id > -1 && *file_id < nfiles) {return true;} - else { return false;} + anchor->nkeys++; + + anchor->keys = realloc(anchor->keys, (anchor->nkeys+1)*sizeof(KeyValuePairs)); + int err_code = increment_nlevels(&anchor->nlevels); + if (err_code =! SUCCESSFUL) return err_code; + + anchor->pid[anchor->nlevels] = anchor->nkeys; + + if (strcmp(key, "")) { + strcpy(anchor->parent_names[anchor->nlevels],key ); + } + KeyValuePairs *my_key = &anchor->keys[anchor->nkeys]; + add_key(my_key, anchor->nkeys, anchor->pid[anchor->nlevels -1], + "", "", anchor->parent_names[anchor->nlevels]); + DEBUG_PRINT("ANCHOR :: Key_number: %i, parent_key: %i, parent_name: %s \n ", my_key->key_id, my_key->parent_key, my_key->parent_name); + + return SUCCESSFUL; +} +/** + * @brief Retrieves the index of an anchor by its alias name. + * + * Searches the YamlFile's list of anchors for a matching alias name. + * If a match is found, returns the corresponding index (starting from 1). + * + * @param this Pointer to the YamlFile structure containing anchors. + * @param alias_name The alias name to search for. + * + * @return Index of the matching anchor if found; otherwise, returns INVALID_ALIAS. + */ +int get_anchor_id(YamlFile *this, const char *alias_name) +{ + for (int i = 1; i < this->nanchors + 1; i++) { + AnchorsType *my_anchor = &this->Anchors[i]; + if (strcmp(my_anchor->anchor_name, alias_name) == 0) { + return i; + } + } + return INVALID_ALIAS; } -/* @brief Private c function that opens and parses a yaml file and saves it in a struct - @return Flag indicating if the read was sucessful */ -int open_and_parse_file_wrap(char *filename, int *file_id) +/** + * @brief Opens and parses a YAML file. + * + * @param filename Pointer to the name of the YAML file (read-only). + * @param file_id Pointer to an integer where the assigned file ID will be stored (output). + * @return 1 if the file was read successfully, or < 0 if there was an error. + */ +int open_and_parse_file_wrap(const char *filename, int *file_id) { yaml_parser_t parser; yaml_token_t token; - FILE *file; - bool is_key = false; /* Flag indicating if the current token in a key */ - char key_value[255]; /* Value of a key */ - int layer = 0; /* Current layer (block level) */ - int key_count=0; /* Current number of keys */ - int parent[10]; /* Ids of blocks */ - int current_parent; /* Id of the current block */ - char layer_name[10][255]; /* Array of block names */ - char current_layername[255]; /* Name of the current block */ - int i; /* To minimize the typing :) */ - int j; /* To minimize the typing :) */ + int fid; /* To minimize the typing :) */ + // Allocate space to store all the yaml file's info if (nfiles == 0 ) { - my_files.files = (yaml_file*)calloc(1, sizeof(yaml_file)); + my_files.files = (YamlFile*)calloc(1, sizeof(YamlFile)); } else { - my_files.files = realloc(my_files.files, (nfiles+1)*sizeof(yaml_file)); + my_files.files = realloc(my_files.files, (nfiles+1)*sizeof(YamlFile)); } - j = nfiles; - *file_id =j; + // Assign the file id + fid = nfiles; + *file_id =fid; + + DEBUG_PRINT("Opening file: %s.\n There are %i files opened.\n", filename, nfiles); -/* printf("Opening file: %s.\nThere are %i files opened.\n", filename, j); */ + FILE *file; file = fopen(filename, "r"); - if (file == NULL) return -1; + if (file == NULL) return MISSING_FILE; + + if(!yaml_parser_initialize(&parser)) return PARSER_INIT_ERROR; - if(!yaml_parser_initialize(&parser)) return -2; + YamlFile *my_file = &my_files.files[fid]; + my_file->keys = (KeyValuePairs*)calloc(1, sizeof(KeyValuePairs)); - my_files.files[j].keys = (key_value_pairs*)calloc(1, sizeof(key_value_pairs)); + int nlevels = 0; + int nkeys = 0; + int pid[MAX_LEVELS]; // parent_ids + char parent_names[MAX_LEVELS][FMS_FILE_LEN]; // the name of the parent at each level + char key_value[FMS_FILE_LEN]; + bool defining_value; + bool defining_anchor; + + // Initialize some variables + defining_value = false; + defining_anchor = false; + pid[0]=0; + strcpy(parent_names[0], "TOP"); - parent[0]=0; - strcpy(layer_name[0], "TOP"); - /* Set input file */ yaml_parser_set_input_file(&parser, file); do { if (!yaml_parser_scan(&parser, &token)) { - return -3; + return INVALID_YAML; } switch(token.type) { case YAML_KEY_TOKEN: - { - is_key = true; + DEBUG_PRINT("YAML_KEY_TOKEN \n"); + defining_value = false; break; - } + case YAML_VALUE_TOKEN: - { - is_key = false; + DEBUG_PRINT("YAML_VALUE_TOKEN \n"); + defining_value = true; break; - } - case YAML_BLOCK_ENTRY_TOKEN: - { - layer = layer + 1; - if (strcmp(key_value, "")) - { - strcpy(layer_name[layer], key_value); + case YAML_SCALAR_TOKEN: + DEBUG_PRINT("YAML_SCALAR_TOKEN \n"); + if (!defining_value) { + strcpy(key_value, token.data.scalar.value); + break; } - key_count = key_count + 1; - i = key_count; - my_files.files[j].keys = realloc(my_files.files[j].keys, (i+1)*sizeof(key_value_pairs)); - my_files.files[j].keys[i].key_number=i; - my_files.files[j].keys[i].parent_key = parent[layer-1]; - strcpy(my_files.files[j].keys[i].parent_name, layer_name[layer]); - strcpy(my_files.files[j].keys[i].key, ""); - strcpy(my_files.files[j].keys[i].value, ""); - parent[layer]=key_count; - /*printf("KEY:%i LAYER:%i NAME:%s for %s=%i\n", key_count, layer, layer_name[layer], layer_name[layer-1], parent[layer-1]); */ + if (defining_anchor) { + AnchorsType *my_anchor = &my_file->Anchors[my_file->nanchors]; + add_anchor_key(my_anchor, key_value, token.data.scalar.value); + } else { + nkeys ++; + my_file->keys = realloc(my_file->keys, (nkeys+1)*sizeof(KeyValuePairs)); + KeyValuePairs *my_key = &my_file->keys[nkeys]; + add_key(my_key, nkeys, pid[nlevels], + key_value, token.data.scalar.value, ""); + DEBUG_PRINT("Key_number: %i, parent_key: %i, ----- %s:%s \n ", + my_file->keys[nkeys].key_id, my_file->keys[nkeys].parent_key, + my_file->keys[nkeys].key, my_file->keys[nkeys].value); + } + defining_value = false; + strcpy(key_value, "" ); + break; + case YAML_BLOCK_ENTRY_TOKEN: + DEBUG_PRINT("YAML_BLOCK_ENTRY_TOKEN \n"); + if (defining_anchor) { + AnchorsType *my_anchor = &my_file->Anchors[my_file->nanchors]; + + int err_code = add_anchor_parent(my_anchor, key_value); + if (err_code != SUCCESSFUL) return err_code; + + } else { + int err_code = increment_nlevels(&nlevels); + if (err_code == MAX_LEVELS_REACH) return MAX_LEVELS_REACH; + + nkeys ++; + pid[nlevels] = nkeys; + if (strcmp(key_value, "")) { + strcpy(parent_names[nlevels], key_value); + } + my_file->keys = realloc(my_file->keys, (nkeys+1)*sizeof(KeyValuePairs)); + KeyValuePairs *my_key = &my_file->keys[nkeys]; + add_key(my_key, nkeys, pid[nlevels-1], + "", "", parent_names[nlevels]); + DEBUG_PRINT("Key_number: %i, parent_key: %i, parent_name: %s \n ", my_file->keys[nkeys].key_id, my_file->keys[nkeys].parent_key, my_file->keys[nkeys].parent_name); + } + defining_value = false; + strcpy(key_value, "" ); break; - } case YAML_BLOCK_END_TOKEN: - { - layer = layer - 1; + DEBUG_PRINT("YAML_BLOCK_END_TOKEN \n"); + if (defining_anchor) { + AnchorsType *my_anchor = &my_file->Anchors[my_file->nanchors]; + my_anchor->nlevels--; + if (my_anchor->nlevels == -1) { + defining_anchor = false; + DEBUG_PRINT("FINISHED WITH ANCHOR :: ----------------------------- \n"); + } + } else { + nlevels --; + } + defining_value = false; + strcpy(key_value, "" ); break; - } - case YAML_SCALAR_TOKEN: - { - if ( ! is_key) - { - current_parent = parent[layer]; - strcpy(current_layername, ""); - key_count = key_count + 1; - i = key_count; - my_files.files[j].keys = realloc(my_files.files[j].keys, (i+1)*sizeof(key_value_pairs)); - my_files.files[j].keys[i].key_number=i; - my_files.files[j].keys[i].parent_key = current_parent; - strcpy(my_files.files[j].keys[i].parent_name, current_layername); - strcpy(my_files.files[j].keys[i].key, key_value); - strcpy(my_files.files[j].keys[i].value, token.data.scalar.value); - my_files.files[j].nkeys = key_count; - /* printf("----> LAYER:%i LAYER_NAME=%s PARENT:%i, KEYCOUNT:%i KEY: %s VALUE: %s \n", layer, current_layername, current_parent, key_count, key_value, token.data.scalar.value); */ - strcpy(key_value,""); + case YAML_ANCHOR_TOKEN: { + DEBUG_PRINT("YAML_ANCHOR_TOKEN \n"); + my_file->nanchors ++; + if (my_file->nanchors == 1) { + my_file->Anchors = (AnchorsType*)calloc(my_file->nanchors + 1, sizeof(AnchorsType)); + } else { + my_file->Anchors = realloc(my_file->Anchors, (my_file->nanchors + 1)*sizeof(AnchorsType)); } - else - {strcpy(key_value,token.data.scalar.value);} + defining_anchor = true; + defining_value = false; + AnchorsType *my_anchor = &my_file->Anchors[my_file->nanchors]; + init_anchor(my_anchor, token.data.anchor.value, key_value); + break; + } + case YAML_ALIAS_TOKEN: { + DEBUG_PRINT("YAML_ALIAS_TOKEN \n"); + int top_key = nkeys; + + int aid = get_anchor_id(my_file, token.data.alias.value); + if (aid == INVALID_ALIAS) return INVALID_ALIAS; + + AnchorsType *my_anchor = &my_file->Anchors[aid]; + for (int i = 2; i < my_anchor->nkeys + 1; i++) { + nkeys ++; + my_file->keys = realloc(my_file->keys, (nkeys+1)*sizeof(KeyValuePairs)); + KeyValuePairs *my_key = &my_file->keys[nkeys]; + int parent_key_id; + char parent_name[FMS_FILE_LEN]; + if (my_anchor->keys[i].parent_key == 0){ + strcpy(parent_name, parent_names[nlevels]); + parent_key_id = pid[nlevels-1]; + } else { + strcpy(parent_name, my_anchor->keys[i].parent_name); + parent_key_id = top_key + my_anchor->keys[i].parent_key - 1; + } + add_key(my_key, nkeys, parent_key_id, + my_anchor->keys[i].key, my_anchor->keys[i].value, parent_name); + if (strcmp(my_file->keys[nkeys].key, "")) { + DEBUG_PRINT("**:: Key_number: %i, parent_key: %i, ----- %s:%s \n ", + my_file->keys[nkeys].key_id, my_file->keys[nkeys].parent_key, + my_file->keys[nkeys].key, my_file->keys[nkeys].value); + }else { + DEBUG_PRINT("**:: Key_number: %i, parent_key: %i, parent_name: %s \n ", + my_file->keys[nkeys].key_id, my_file->keys[nkeys].parent_key, + my_file->keys[nkeys].parent_name); + } } - break; - } + nlevels --; + + break; + } + } //end of switch if(token.type != YAML_STREAM_END_TOKEN) yaml_token_delete(&token); } while(token.type != YAML_STREAM_END_TOKEN); yaml_token_delete(&token); yaml_parser_delete(&parser); - /* - for ( i = 1; i <= my_files.files[j].nkeys; i++ ) { - printf("Key_number:%i Parent_key:%i Parent_name:%s Key:%s Value:%s \n", my_files.files[j].keys[i].key_number, my_files.files[j].keys[i].parent_key, my_files.files[j].keys[i].parent_name, my_files.files[j].keys[i].key, my_files.files[j].keys[i].value); - } - printf("/\n"); - */ - + my_file->nkeys = nkeys; nfiles = nfiles + 1; -/* printf("closing file: %s\n", filename); */ + DEBUG_PRINT("closing file: %s\n", filename); fclose(file); - return 1; + return SUCCESSFUL; } #endif diff --git a/platform/Makefile.am b/platform/Makefile.am index 9fd9bfd028..065e0dc971 100644 --- a/platform/Makefile.am +++ b/platform/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the platform directory of the FMS diff --git a/platform/platform.F90 b/platform/platform.F90 index 9845d3f330..e016ace5b9 100644 --- a/platform/platform.F90 +++ b/platform/platform.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup platform_mod platform_mod !> @ingroup platform diff --git a/random_numbers/Makefile.am b/random_numbers/Makefile.am index 6961f0daa9..a5e56f5409 100644 --- a/random_numbers/Makefile.am +++ b/random_numbers/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the random_numbers directory of the FMS diff --git a/random_numbers/include/random_numbers.inc b/random_numbers/include/random_numbers.inc index 5a6f7f7a36..4dfeabf1d4 100644 --- a/random_numbers/include/random_numbers.inc +++ b/random_numbers/include/random_numbers.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> Draws random scalar diff --git a/random_numbers/include/random_numbers_r4.fh b/random_numbers/include/random_numbers_r4.fh index cb0487d303..016cfc2a8f 100644 --- a/random_numbers/include/random_numbers_r4.fh +++ b/random_numbers/include/random_numbers_r4.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** #undef FMS_RN_KIND_ diff --git a/random_numbers/include/random_numbers_r8.fh b/random_numbers/include/random_numbers_r8.fh index cca7cef28e..a46d367501 100644 --- a/random_numbers/include/random_numbers_r8.fh +++ b/random_numbers/include/random_numbers_r8.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** #undef FMS_RN_KIND_ diff --git a/random_numbers/mersennetwister.F90 b/random_numbers/mersennetwister.F90 index 3561f88498..f963d3cc1d 100644 --- a/random_numbers/mersennetwister.F90 +++ b/random_numbers/mersennetwister.F90 @@ -1,21 +1,4 @@ -!*********************************************************************** -!* GNU Lesser General Public License -!* -!* This file is part of the GFDL Flexible Modeling System (FMS). -!* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. -!* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. -!* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . -!*********************************************************************** +!* This file includes a 3 clause BSD license header below. !> @defgroup mersennetwister_mod MersenneTwister_mod !> @ingroup random_numbers diff --git a/random_numbers/random_numbers.F90 b/random_numbers/random_numbers.F90 index 640260fc3e..231a3fb923 100644 --- a/random_numbers/random_numbers.F90 +++ b/random_numbers/random_numbers.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup random_numbers_mod random_numbers_mod diff --git a/sat_vapor_pres/Makefile.am b/sat_vapor_pres/Makefile.am index 2511061c62..aed05c21e3 100644 --- a/sat_vapor_pres/Makefile.am +++ b/sat_vapor_pres/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the sat_vapor_pres directory of the FMS diff --git a/sat_vapor_pres/include/sat_vapor_pres.inc b/sat_vapor_pres/include/sat_vapor_pres.inc index 46c29a80b4..af5350d0af 100644 --- a/sat_vapor_pres/include/sat_vapor_pres.inc +++ b/sat_vapor_pres/include/sat_vapor_pres.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup sat_vapor_pres_mod !> @{ diff --git a/sat_vapor_pres/include/sat_vapor_pres_k.inc b/sat_vapor_pres/include/sat_vapor_pres_k.inc index 00ce7089d0..f1e4f85a62 100644 --- a/sat_vapor_pres/include/sat_vapor_pres_k.inc +++ b/sat_vapor_pres/include/sat_vapor_pres_k.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup sat_vapor_pres_k_mod !> @brief Kernel module to be used by @ref sat_vapor_pres_mod for diff --git a/sat_vapor_pres/include/sat_vapor_pres_k_r4.fh b/sat_vapor_pres/include/sat_vapor_pres_k_r4.fh index e58285fc20..a1f8ecaf36 100644 --- a/sat_vapor_pres/include/sat_vapor_pres_k_r4.fh +++ b/sat_vapor_pres/include/sat_vapor_pres_k_r4.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup sat_vapor_pres_k_mod !> @{ diff --git a/sat_vapor_pres/include/sat_vapor_pres_k_r8.fh b/sat_vapor_pres/include/sat_vapor_pres_k_r8.fh index 247dd33d1f..177f1d1e38 100644 --- a/sat_vapor_pres/include/sat_vapor_pres_k_r8.fh +++ b/sat_vapor_pres/include/sat_vapor_pres_k_r8.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup sat_vapor_pres_k_mod !> @{ diff --git a/sat_vapor_pres/include/sat_vapor_pres_r4.fh b/sat_vapor_pres/include/sat_vapor_pres_r4.fh index 462a131f23..371d4a2bb6 100644 --- a/sat_vapor_pres/include/sat_vapor_pres_r4.fh +++ b/sat_vapor_pres/include/sat_vapor_pres_r4.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup sat_vapor_pres !> @{ diff --git a/sat_vapor_pres/include/sat_vapor_pres_r8.fh b/sat_vapor_pres/include/sat_vapor_pres_r8.fh index 0f2e6a315f..f2c9538dd7 100644 --- a/sat_vapor_pres/include/sat_vapor_pres_r8.fh +++ b/sat_vapor_pres/include/sat_vapor_pres_r8.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup sat_vapor_pres !> @{ diff --git a/sat_vapor_pres/sat_vapor_pres.F90 b/sat_vapor_pres/sat_vapor_pres.F90 index 93310f97ca..d0c709d3b0 100644 --- a/sat_vapor_pres/sat_vapor_pres.F90 +++ b/sat_vapor_pres/sat_vapor_pres.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup sat_vapor_pres_mod sat_vapor_pres_mod !> @ingroup sat_vapor_pres diff --git a/sat_vapor_pres/sat_vapor_pres_k.F90 b/sat_vapor_pres/sat_vapor_pres_k.F90 index 66f44549cc..afce32d9a1 100644 --- a/sat_vapor_pres/sat_vapor_pres_k.F90 +++ b/sat_vapor_pres/sat_vapor_pres_k.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup sat_vapor_pres_k_mod sat_vapor_pres_k_mod !> @ingroup sat_vapor_pres diff --git a/string_utils/Makefile.am b/string_utils/Makefile.am index 408c5eea7a..1b45cb9ae6 100644 --- a/string_utils/Makefile.am +++ b/string_utils/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the constants directory of the FMS diff --git a/string_utils/fms_string_utils.F90 b/string_utils/fms_string_utils.F90 index 78d086f571..e79a90d97f 100644 --- a/string_utils/fms_string_utils.F90 +++ b/string_utils/fms_string_utils.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup fms_string_utils_mod fms_string_utils_mod diff --git a/string_utils/fms_string_utils_binding.c b/string_utils/fms_string_utils_binding.c index 3b949a9eca..03161a41e8 100644 --- a/string_utils/fms_string_utils_binding.c +++ b/string_utils/fms_string_utils_binding.c @@ -1,21 +1,20 @@ /*********************************************************************** - * GNU Lesser General Public License + * Apache License 2.0 * * This file is part of the GFDL Flexible Modeling System (FMS). * - * FMS is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or (at - * your option) any later version. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * FMS is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * http://www.apache.org/licenses/LICENSE-2.0 * - * You should have received a copy of the GNU Lesser General Public - * License along with FMS. If not, see . - **********************************************************************/ + * FMS is distributed in the hope that it will be useful, but WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the License for the specific language + * governing permissions and limitations under the License. + ***********************************************************************/ #include #include diff --git a/string_utils/include/fms_string_utils.inc b/string_utils/include/fms_string_utils.inc index db6e067c4f..fe17661485 100644 --- a/string_utils/include/fms_string_utils.inc +++ b/string_utils/include/fms_string_utils.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief Converts a 1D array of real numbers to a string diff --git a/string_utils/include/fms_string_utils_r4.fh b/string_utils/include/fms_string_utils_r4.fh index c12cb7e001..edc7c3b08b 100644 --- a/string_utils/include/fms_string_utils_r4.fh +++ b/string_utils/include/fms_string_utils_r4.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** #define STRING_UTILS_KIND_ r4_kind diff --git a/string_utils/include/fms_string_utils_r8.fh b/string_utils/include/fms_string_utils_r8.fh index 4e40b1264a..73fc1a1dd6 100644 --- a/string_utils/include/fms_string_utils_r8.fh +++ b/string_utils/include/fms_string_utils_r8.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** #define STRING_UTILS_KIND_ r8_kind diff --git a/test_fms/Makefile.am b/test_fms/Makefile.am index 42725cbf85..59d65c7302 100644 --- a/test_fms/Makefile.am +++ b/test_fms/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is the automake file for the test_fms directory. @@ -24,10 +23,10 @@ ACLOCAL_AMFLAGS = -I m4 # Make targets will be run in each subdirectory. Order is significant. -SUBDIRS = astronomy coupler diag_manager data_override exchange monin_obukhov drifters \ +SUBDIRS = common astronomy coupler diag_manager data_override exchange monin_obukhov drifters \ mosaic2 interpolator fms mpp time_interp time_manager horiz_interp topography \ field_manager axis_utils affinity fms2_io parser string_utils sat_vapor_pres tracer_manager \ -random_numbers diag_integral column_diagnostics tridiagonal block_control +random_numbers diag_integral column_diagnostics tridiagonal offloading block_control # testing utility scripts to distribute EXTRA_DIST = test-lib.sh.in intel_coverage.sh.in tap-driver.sh diff --git a/test_fms/affinity/Makefile.am b/test_fms/affinity/Makefile.am index ba54f71d97..21004b4ce3 100644 --- a/test_fms/affinity/Makefile.am +++ b/test_fms/affinity/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the test_fms/data_override directory of the FMS diff --git a/test_fms/affinity/test_affinity.F90 b/test_fms/affinity/test_affinity.F90 index 75c8257e6a..15851d7fb2 100644 --- a/test_fms/affinity/test_affinity.F90 +++ b/test_fms/affinity/test_affinity.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** program test_affinity diff --git a/test_fms/affinity/test_affinity2.sh b/test_fms/affinity/test_affinity2.sh index abff3e7943..bde00c605c 100755 --- a/test_fms/affinity/test_affinity2.sh +++ b/test_fms/affinity/test_affinity2.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # # Copyright (c) 2021 Seth Underwood diff --git a/test_fms/astronomy/Makefile.am b/test_fms/astronomy/Makefile.am index ff313aca26..be94f3c8b4 100644 --- a/test_fms/astronomy/Makefile.am +++ b/test_fms/astronomy/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the test_fms/astronomy directory of the @@ -38,8 +37,8 @@ test_astronomy_r4_SOURCES = test_astronomy.F90 test_astronomy_r8_SOURCES = test_astronomy.F90 # Set r4_kind and r8_kind -test_astronomy_r4_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_AST_KIND_=r4_kind -test_astronomy_r8_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_AST_KIND_=r8_kind +test_astronomy_r4_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_FMS_KIND_=r4_kind +test_astronomy_r8_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_FMS_KIND_=r8_kind # Run the test program. TESTS = test_astronomy.sh diff --git a/test_fms/astronomy/test_astronomy.F90 b/test_fms/astronomy/test_astronomy.F90 index 0b94a7f976..92b2884db7 100644 --- a/test_fms/astronomy/test_astronomy.F90 +++ b/test_fms/astronomy/test_astronomy.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @author Mikyung Lee, Caitlyn McAllister @@ -53,9 +52,9 @@ subroutine test_set_get_orbital_parameters ! test that whatever values get sent into set_orbital_parameters ! are the same after calling get_orbital_parameters implicit none - real(kind=TEST_AST_KIND_) :: ecc_in, obliq_in, per_in - real(kind=TEST_AST_KIND_) :: ecc_out, obliq_out, per_out - integer, parameter :: lkind = TEST_AST_KIND_ + real(kind=TEST_FMS_KIND_) :: ecc_in, obliq_in, per_in + real(kind=TEST_FMS_KIND_) :: ecc_out, obliq_out, per_out + integer, parameter :: lkind = TEST_FMS_KIND_ ecc_in = 0.0_lkind obliq_in = 0.0_lkind @@ -76,12 +75,12 @@ subroutine test_diurnal_solar ! very simple test cases where all input arguments are set to 0.0, ! expected output --> cosz=0.0, fracday=0.0, and rrsun=1.0 implicit none - real(kind=TEST_AST_KIND_), dimension(1,1) :: lat2D, lon2D, cosz2D, fracday2D - real(kind=TEST_AST_KIND_), dimension(1) :: lat1D, lon1D, cosz1D, fracday1D - real(kind=TEST_AST_KIND_) :: lat0D, lon0D, cosz0D, fracday0D - real(kind=TEST_AST_KIND_) :: gmt, time_since_ae, rrsun + real(kind=TEST_FMS_KIND_), dimension(1,1) :: lat2D, lon2D, cosz2D, fracday2D + real(kind=TEST_FMS_KIND_), dimension(1) :: lat1D, lon1D, cosz1D, fracday1D + real(kind=TEST_FMS_KIND_) :: lat0D, lon0D, cosz0D, fracday0D + real(kind=TEST_FMS_KIND_) :: gmt, time_since_ae, rrsun type(time_type) :: time_in - integer, parameter :: lkind = TEST_AST_KIND_ + integer, parameter :: lkind = TEST_FMS_KIND_ time_since_ae = 0.0_lkind gmt = 0.0_lkind @@ -149,15 +148,15 @@ subroutine test_daily_mean_solar ! defined in the constants_mod, the expected values lose precision ! without the use of half_pi implicit none - real(kind=TEST_AST_KIND_), dimension(1,1) :: lat2D, cosz2D, h_out2D - real(kind=TEST_AST_KIND_), dimension(1) :: lat1D, cosz1D, h_out1D, solar1D - real(kind=TEST_AST_KIND_) :: lat0D, cosz0D, h_out0D - real(kind=TEST_AST_KIND_) :: time_since_ae, rr_out, solar_local + real(kind=TEST_FMS_KIND_), dimension(1,1) :: lat2D, cosz2D, h_out2D + real(kind=TEST_FMS_KIND_), dimension(1) :: lat1D, cosz1D, h_out1D, solar1D + real(kind=TEST_FMS_KIND_) :: lat0D, cosz0D, h_out0D + real(kind=TEST_FMS_KIND_) :: time_since_ae, rr_out, solar_local type(time_type) :: time_in - integer, parameter :: lkind = TEST_AST_KIND_ - real(kind=TEST_AST_KIND_), parameter :: half_pi = acos(0.0_lkind) - real(kind=TEST_AST_KIND_), parameter :: cosz_local = 1.0_lkind/half_pi - real(kind=TEST_AST_KIND_), parameter :: hout_local = half_pi/real(PI,TEST_AST_KIND_) + integer, parameter :: lkind = TEST_FMS_KIND_ + real(kind=TEST_FMS_KIND_), parameter :: half_pi = acos(0.0_lkind) + real(kind=TEST_FMS_KIND_), parameter :: cosz_local = 1.0_lkind/half_pi + real(kind=TEST_FMS_KIND_), parameter :: hout_local = half_pi/real(PI,TEST_FMS_KIND_) time_since_ae = 0.0_lkind time_in = set_time(seconds=0, days=1, ticks=0 ) @@ -166,14 +165,14 @@ subroutine test_daily_mean_solar lat2D = 0.0_lkind call daily_mean_solar(lat2D, time_since_ae, cosz2D, h_out2D, rr_out) call check_answers(cosz2D(1,1), 1.0_lkind/half_pi, 'test_daily_mean_solar_2D cosz2D') - call check_answers(h_out2D(1,1),half_pi/real(PI,TEST_AST_KIND_), 'test_diurnal_solar_2D h_out2D') + call check_answers(h_out2D(1,1),half_pi/real(PI,TEST_FMS_KIND_), 'test_diurnal_solar_2D h_out2D') call check_answers(rr_out, 1.0_lkind, 'test_dirunal_solar_2D rr_out') ! test daily_mean_solar_1d lat1D = 0.0_lkind call daily_mean_solar(lat1D, time_since_ae, cosz1D, h_out1D, rr_out) call check_answers(cosz1D(1), 1.0_lkind/half_pi, 'test_daily_mean_solar_1D cosz1D') - call check_answers(h_out1D(1),half_pi/real(PI,TEST_AST_KIND_), 'test_diurnal_solar_1D h_out1D') + call check_answers(h_out1D(1),half_pi/real(PI,TEST_FMS_KIND_), 'test_diurnal_solar_1D h_out1D') call check_answers(rr_out, 1.0_lkind, 'test_dirunal_solar_1D rr_out') @@ -181,7 +180,7 @@ subroutine test_daily_mean_solar lat0D = 0.0_lkind call daily_mean_solar(lat0D, time_since_ae, cosz0D, h_out0D, rr_out) call check_answers(cosz0D, 1.0_lkind/half_pi, 'test_daily_mean_solar_0D cosz0D') - call check_answers(h_out0D,half_pi/real(PI,TEST_AST_KIND_), 'test_diurnal_solar_0D h_out0D') + call check_answers(h_out0D,half_pi/real(PI,TEST_FMS_KIND_), 'test_diurnal_solar_0D h_out0D') call check_answers(rr_out, 1.0_lkind, 'test_dirunal_solar_0D rr_out') @@ -189,21 +188,21 @@ subroutine test_daily_mean_solar lat2D = 0.0_lkind call daily_mean_solar(lat2D, time_in, cosz2D, h_out2D, rr_out) call check_answers(cosz2D(1,1), 1.0_lkind/half_pi, 'test_daily_mean_solar_cal_2D cosz2D') - call check_answers(h_out2D(1,1),half_pi/real(PI,TEST_AST_KIND_), 'test_diurnal_solar_cal_2D h_out2D') + call check_answers(h_out2D(1,1),half_pi/real(PI,TEST_FMS_KIND_), 'test_diurnal_solar_cal_2D h_out2D') call check_answers(rr_out, 1.0_lkind, 'test_dirunal_solar_cal_2D rr_out') ! test daily_mean_solar_cal_1d lat1D = 0.0_lkind call daily_mean_solar(lat1D, time_in, cosz1D, h_out1D, rr_out) call check_answers(cosz1D(1), 1.0_lkind/half_pi, 'test_daily_mean_solar_cal_1D cosz1D') - call check_answers(h_out1D(1),half_pi/real(PI,TEST_AST_KIND_), 'test_diurnal_solar_cal_1D h_out1D') + call check_answers(h_out1D(1),half_pi/real(PI,TEST_FMS_KIND_), 'test_diurnal_solar_cal_1D h_out1D') call check_answers(rr_out, 1.0_lkind, 'test_dirunal_solar_cal_1D rr_out') ! test daily_mean_solar_cal_0d lat0D = 0.0_lkind call daily_mean_solar(lat0D, time_in, cosz0D, h_out0D, rr_out) call check_answers(cosz0D, 1.0_lkind/half_pi, 'test_daily_mean_solar_cal_0D cosz0D') - call check_answers(h_out0D,half_pi/real(PI,TEST_AST_KIND_), 'test_diurnal_solar_cal_0D h_out0D') + call check_answers(h_out0D,half_pi/real(PI,TEST_FMS_KIND_), 'test_diurnal_solar_cal_0D h_out0D') call check_answers(rr_out, 1.0_lkind, 'test_dirunal_solar_cal_0D rr_out') ! test daily_mean_solar_2level @@ -225,14 +224,14 @@ subroutine test_annual_mean_solar implicit none integer :: js, je - real(kind=TEST_AST_KIND_), dimension(1,1) :: lat2D, solar2D, cosz2D, fracday2D - real(kind=TEST_AST_KIND_), dimension(1) :: lat1D, solar1D, cosz1D, fracday1D - real(kind=TEST_AST_KIND_) :: rrsun - real(kind=TEST_AST_KIND_), parameter :: half_pi = acos(0.0_r8_kind) - integer, parameter :: lkind = TEST_AST_KIND_ - real(kind=TEST_AST_KIND_) :: cosz_local, solar_local - - solar_local = (1.0_lkind/half_pi)*(half_pi/real(PI, TEST_AST_KIND_)) + real(kind=TEST_FMS_KIND_), dimension(1,1) :: lat2D, solar2D, cosz2D, fracday2D + real(kind=TEST_FMS_KIND_), dimension(1) :: lat1D, solar1D, cosz1D, fracday1D + real(kind=TEST_FMS_KIND_) :: rrsun + real(kind=TEST_FMS_KIND_), parameter :: half_pi = acos(0.0_r8_kind) + integer, parameter :: lkind = TEST_FMS_KIND_ + real(kind=TEST_FMS_KIND_) :: cosz_local, solar_local + + solar_local = (1.0_lkind/half_pi)*(half_pi/real(PI, TEST_FMS_KIND_)) cosz_local = 1.0_lkind/half_pi*solar_local ! test annual_mean_solar_2d @@ -241,7 +240,7 @@ subroutine test_annual_mean_solar call annual_mean_solar(js, je, lat2D, cosz2D, solar2D, fracday2D, rrsun) call check_answers(cosz2D(1,1), cosz_local/solar_local, 'test_annual_mean_solar_2D cosz2D') call check_answers(solar2D(1,1), solar_local, 'test_annual_mean_solar_2D solar2D') - call check_answers(fracday2D(1,1), half_pi/real(PI,TEST_AST_KIND_), 'test_annual_mean_solar_2D fracday2D') + call check_answers(fracday2D(1,1), half_pi/real(PI,TEST_FMS_KIND_), 'test_annual_mean_solar_2D fracday2D') call check_answers(rrsun, 1.0_lkind, 'test_annual_mean_solar_2D rrsun') ! test annual_mean_solar_1d @@ -250,7 +249,7 @@ subroutine test_annual_mean_solar call annual_mean_solar(js, je, lat1D, cosz1D, solar1D, fracday1D, rrsun) call check_answers(cosz1D(1), cosz_local/solar_local, 'test_annual_mean_solar_1D cosz1D') call check_answers(solar1D(1), solar_local, 'test_annual_mean_solar_1D solar1D') - call check_answers(fracday1D(1), half_pi/real(PI,TEST_AST_KIND_), 'test_annual_mean_solar_1D fracday1D') + call check_answers(fracday1D(1), half_pi/real(PI,TEST_FMS_KIND_), 'test_annual_mean_solar_1D fracday1D') call check_answers(rrsun, 1.0_lkind, 'test_annual_mean_solar_1D rrsun') !call astronomy_end @@ -261,18 +260,21 @@ subroutine test_annual_mean_solar lat1D = 0.0_lkind call annual_mean_solar(lat1D, cosz1D, solar1D) call test_set_get_orbital_parameters - if (solar1D(1) .ne. solar_local) call mpp_error(FATAL, 'test_annual_mean_solar_2level solar1D') - if (cosz1D(1) .ne. 1.0_lkind/half_pi) call mpp_error(FATAL, 'test_annual_mean_solar_2level cosz1D') + if (abs(solar1D(1) - solar_local) .gt. 1.0e-5_lkind) & + call mpp_error(FATAL, 'test_annual_mean_solar_2level solar1D') + if (abs(cosz1D(1) - 1.0_lkind/half_pi) .gt. 1.0e-5_lkind) & + call mpp_error(FATAL, 'test_annual_mean_solar_2level cosz1D') end subroutine test_annual_mean_solar !---------------------------------------------! subroutine check_answers( results, answers, whoami ) implicit none - real(TEST_AST_KIND_) :: answers, results + real(TEST_FMS_KIND_) :: answers, results character(*) :: whoami + integer, parameter :: lkind = TEST_FMS_KIND_ - if (results.ne.answers) then + if (abs(results - answers) .gt. 1.0e-5_lkind) then write(*,*) 'EXPECTED ', answers, ' but computed ', results call mpp_error(FATAL, trim(whoami)) end if diff --git a/test_fms/astronomy/test_astronomy.sh b/test_fms/astronomy/test_astronomy.sh index 9d108d5fd5..f95aac1ce6 100755 --- a/test_fms/astronomy/test_astronomy.sh +++ b/test_fms/astronomy/test_astronomy.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/axis_utils/Makefile.am b/test_fms/axis_utils/Makefile.am index 3db495ecd6..54a719d790 100644 --- a/test_fms/axis_utils/Makefile.am +++ b/test_fms/axis_utils/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the test_fms/data_override directory of the FMS @@ -37,8 +36,8 @@ check_PROGRAMS = \ test_axis_utils_r4_SOURCES = test_axis_utils.F90 test_axis_utils_r8_SOURCES = test_axis_utils.F90 -test_axis_utils_r4_CPPFLAGS = $(AM_CPPFLAGS) -DAU_TEST_KIND_=r4_kind -test_axis_utils_r8_CPPFLAGS = $(AM_CPPFLAGS) -DAU_TEST_KIND_=r8_kind +test_axis_utils_r4_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_FMS_KIND_=r4_kind +test_axis_utils_r8_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_FMS_KIND_=r8_kind TEST_EXTENSIONS = .sh SH_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ diff --git a/test_fms/axis_utils/test_axis_utils.F90 b/test_fms/axis_utils/test_axis_utils.F90 index 6304bac60c..68406cc1e6 100644 --- a/test_fms/axis_utils/test_axis_utils.F90 +++ b/test_fms/axis_utils/test_axis_utils.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** program test_axis_utils @@ -40,7 +39,7 @@ program test_axis_utils type(GetAxisCartTestCase_t), pointer :: next => NULL() end type -integer, parameter :: k = AU_TEST_KIND_ +integer, parameter :: k = TEST_FMS_KIND_ real(k), parameter :: pi = 4._k * atan(1._k) integer :: i @@ -376,7 +375,7 @@ subroutine frac_index_assert(fval, arr, ret_expected) ret_test = frac_index(fval, arr) - if (ret_test /= ret_expected) then + if (abs(ret_test - ret_expected) .gt. 1.0e-5_k) then write(stderr(), "(A)") "frac_index(" // string(fval) // ", " // stringify(arr) // & & ") returned erroneous value: " // string(ret_test) write(stderr(), "(A)") "Expected return value: " // string(ret_expected) diff --git a/test_fms/axis_utils/test_axis_utils2.sh b/test_fms/axis_utils/test_axis_utils2.sh index 8b49c6bdd5..2fa57bdb25 100755 --- a/test_fms/axis_utils/test_axis_utils2.sh +++ b/test_fms/axis_utils/test_axis_utils2.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # Copyright 2021 Seth Underwood diff --git a/test_fms/block_control/Makefile.am b/test_fms/block_control/Makefile.am index 4fc64f93b0..e8b805cf3a 100644 --- a/test_fms/block_control/Makefile.am +++ b/test_fms/block_control/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the test_fms/block_control directory of the diff --git a/test_fms/block_control/test_block_control.F90 b/test_fms/block_control/test_block_control.F90 index 97ff4aa7f6..b2f928e293 100644 --- a/test_fms/block_control/test_block_control.F90 +++ b/test_fms/block_control/test_block_control.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** program test_block_control diff --git a/test_fms/block_control/test_block_control.sh b/test_fms/block_control/test_block_control.sh index a5e76f68c3..0e32256dc8 100755 --- a/test_fms/block_control/test_block_control.sh +++ b/test_fms/block_control/test_block_control.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/column_diagnostics/Makefile.am b/test_fms/column_diagnostics/Makefile.am index d8fb204ff5..34c870b85b 100644 --- a/test_fms/column_diagnostics/Makefile.am +++ b/test_fms/column_diagnostics/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the test_fms/time_manager directory of the FMS @@ -34,8 +33,8 @@ check_PROGRAMS = test_column_diagnostics_r4 test_column_diagnostics_r8 test_column_diagnostics_r4_SOURCES = test_column_diagnostics.F90 test_column_diagnostics_r8_SOURCES = test_column_diagnostics.F90 -test_column_diagnostics_r4_CPPFLAGS=$(AM_CPPFLAGS) -DTEST_CD_KIND_=4 -test_column_diagnostics_r8_CPPFLAGS=$(AM_CPPFLAGS) -DTEST_CD_KIND_=8 +test_column_diagnostics_r4_CPPFLAGS=$(AM_CPPFLAGS) -DTEST_FMS_KIND_=r4_kind +test_column_diagnostics_r8_CPPFLAGS=$(AM_CPPFLAGS) -DTEST_FMS_KIND_=r8_kind TEST_EXTENSIONS = .sh SH_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(abs_top_srcdir)/test_fms/tap-driver.sh diff --git a/test_fms/column_diagnostics/test_column_diagnostics.F90 b/test_fms/column_diagnostics/test_column_diagnostics.F90 index 33ebc824aa..0dac6cc7bd 100644 --- a/test_fms/column_diagnostics/test_column_diagnostics.F90 +++ b/test_fms/column_diagnostics/test_column_diagnostics.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !! @brief unit test for column_diagnostics_mod @@ -39,22 +38,22 @@ program test_column_diagnostics integer, parameter :: num_diag_pts_ij=2 !< number of diagnostics column describes in terms of i/j indices integer :: global_i(num_diag_pts_ij) ! global i coordinates of the diagnostic column integer :: global_j(num_diag_pts_ij) ! global j coordinates of the diagnostic column - real(TEST_CD_KIND_) :: global_lat_latlon(num_diag_pts_latlon)!< latitude value for the diagnostic column - real(TEST_CD_KIND_) :: global_lon_latlon(num_diag_pts_latlon)!< longitude value for the diagnostic columns + real(TEST_FMS_KIND_) :: global_lat_latlon(num_diag_pts_latlon)!< latitude value for the diagnostic column + real(TEST_FMS_KIND_) :: global_lon_latlon(num_diag_pts_latlon)!< longitude value for the diagnostic columns integer, parameter :: nlatlon=6 !< number of latlon grid points - real(TEST_CD_KIND_) :: lonb_in(nlatlon,nlatlon) !< model longitude grid point - real(TEST_CD_KIND_) :: latb_in(nlatlon,nlatlon) !< model latitude point + real(TEST_FMS_KIND_) :: lonb_in(nlatlon,nlatlon) !< model longitude grid point + real(TEST_FMS_KIND_) :: latb_in(nlatlon,nlatlon) !< model latitude point logical :: do_column_diagnostics(nlatlon,nlatlon) !< out integer, parameter :: num_diag_pts=num_diag_pts_latlon + num_diag_pts_ij !< total number of diagnostics column integer :: diag_i(num_diag_pts) !< out integer :: diag_j(num_diag_pts) !< out - real(TEST_CD_KIND_) :: diag_lat(num_diag_pts) !< out - real(TEST_CD_KIND_) :: diag_lon(num_diag_pts) !< out + real(TEST_FMS_KIND_) :: diag_lat(num_diag_pts) !< out + real(TEST_FMS_KIND_) :: diag_lon(num_diag_pts) !< out integer :: diag_units(num_diag_pts) - integer, parameter :: lkind=TEST_CD_KIND_ !< local kind; either r4_kind or r8_kind + integer, parameter :: lkind=TEST_FMS_KIND_ !< local kind; either r4_kind or r8_kind call fms_init() call time_manager_init() @@ -108,7 +107,7 @@ subroutine test_initialize_diagnostic_columns integer :: i integer :: i_answers(num_diag_pts), j_answers(num_diag_pts) - real(TEST_CD_KIND_) :: lon_answers(num_diag_pts), lat_answers(num_diag_pts) + real(TEST_FMS_KIND_) :: lon_answers(num_diag_pts), lat_answers(num_diag_pts) call initialize_diagnostic_columns(mod_name, num_diag_pts_latlon, num_diag_pts_ij, & global_i, global_j, global_lat_latlon, global_lon_latlon, & diff --git a/test_fms/column_diagnostics/test_column_diagnostics.sh b/test_fms/column_diagnostics/test_column_diagnostics.sh index 909a539bfb..b4b7d242f2 100755 --- a/test_fms/column_diagnostics/test_column_diagnostics.sh +++ b/test_fms/column_diagnostics/test_column_diagnostics.sh @@ -1,13 +1,19 @@ -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#*********************************************************************** +#* Apache License 2.0 #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/common/Makefile.am b/test_fms/common/Makefile.am new file mode 100644 index 0000000000..2b079f3393 --- /dev/null +++ b/test_fms/common/Makefile.am @@ -0,0 +1,26 @@ +#*********************************************************************** +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. +#*********************************************************************** + +# Find the fms and mpp mod files. +AM_CPPFLAGS = -I$(MODDIR) -I$(top_srcdir)/test_fms/common/include + +noinst_LIBRARIES = libtest_fms.a +libtest_fms_a_SOURCES = test_fms.F90 include/test_fms.inc include/test_fms_real.inc + +# Clean up +CLEANFILES = *.o *.mod *.a diff --git a/test_fms/common/include/test_fms.inc b/test_fms/common/include/test_fms.inc new file mode 100644 index 0000000000..4c6252a102 --- /dev/null +++ b/test_fms/common/include/test_fms.inc @@ -0,0 +1,69 @@ +!*********************************************************************** +!* Apache License 2.0 +!* +!* This file is part of the GFDL Flexible Modeling System (FMS). +!* +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at +!* +!* http://www.apache.org/licenses/LICENSE-2.0 +!* +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. +!*********************************************************************** + + subroutine ARR_INIT_2D_ (arr) + FMS_TEST_TYPE_ (FMS_TEST_KIND_), intent(out) :: arr(:,:) + real(r8_kind) :: unif(size(arr,1), size(arr,2)) + type(randomNumberStream), save :: random_stream + logical, save :: initialized = .false. + + if (.not.initialized) then + random_stream = initializeRandomNumberStream(0) + initialized = .true. + endif + + call getRandomNumbers(random_stream, unif) + + arr = TYPECAST_ (1e9_r8_kind * (unif - 0.5_r8_kind), FMS_TEST_KIND_) + end subroutine ARR_INIT_2D_ + + subroutine ARR_INIT_3D_ (arr) + FMS_TEST_TYPE_ (FMS_TEST_KIND_), intent(out) :: arr(:,:,:) + integer :: k + + do k = 1, size(arr, 3) + call arr_init(arr(:, :, k)) + enddo + end subroutine ARR_INIT_3D_ + + subroutine ARR_COMPARE_2D_ (arr0, arr1, msg) + FMS_TEST_TYPE_ (FMS_TEST_KIND_), intent(in), dimension(:,:) :: arr0, arr1 + character(*), intent(in) :: msg + + if (any(arr0.ne.arr1)) then + call mpp_error(FATAL, "[2D] Unexpected result: " // msg) + endif + end subroutine ARR_COMPARE_2D_ + + subroutine ARR_COMPARE_3D_ (arr0, arr1, msg) + FMS_TEST_TYPE_ (FMS_TEST_KIND_), intent(in), dimension(:,:,:) :: arr0, arr1 + character(*), intent(in) :: msg + + if (any(arr0.ne.arr1)) then + call mpp_error(FATAL, "[3D] Unexpected result: " // msg) + endif + end subroutine ARR_COMPARE_3D_ + + subroutine ARR_COMPARE_4D_ (arr0, arr1, msg) + FMS_TEST_TYPE_ (FMS_TEST_KIND_), intent(in), dimension(:,:,:,:) :: arr0, arr1 + character(*), intent(in) :: msg + + if (any(arr0.ne.arr1)) then + call mpp_error(FATAL, "[4D] Unexpected result: " // msg) + endif + end subroutine ARR_COMPARE_4D_ diff --git a/test_fms/common/include/test_fms_real.inc b/test_fms/common/include/test_fms_real.inc new file mode 100644 index 0000000000..e0eb5629dd --- /dev/null +++ b/test_fms/common/include/test_fms_real.inc @@ -0,0 +1,80 @@ +!*********************************************************************** +!* Apache License 2.0 +!* +!* This file is part of the GFDL Flexible Modeling System (FMS). +!* +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at +!* +!* http://www.apache.org/licenses/LICENSE-2.0 +!* +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. +!*********************************************************************** + + subroutine ARR_COMPARE_TOL_2D_ (arr0, arr1, tol, msg) + real(FMS_TEST_KIND_), intent(in), dimension(:,:) :: arr0, arr1 + real(FMS_TEST_KIND_), intent(in) :: tol + character(*), intent(in) :: msg + + if (any(abs(arr1 - arr0).gt.tol)) then + call mpp_error(FATAL, "[2D] Unexpected result: " // msg) + endif + end subroutine ARR_COMPARE_TOL_2D_ + + subroutine ARR_COMPARE_TOL_3D_ (arr0, arr1, tol, msg) + real(FMS_TEST_KIND_), intent(in), dimension(:,:,:) :: arr0, arr1 + real(FMS_TEST_KIND_), intent(in) :: tol + character(*), intent(in) :: msg + + if (any(abs(arr1 - arr0).gt.tol)) then + call mpp_error(FATAL, "[3D] Unexpected result: " // msg) + endif + end subroutine ARR_COMPARE_TOL_3D_ + + subroutine ARR_COMPARE_TOL_4D_ (arr0, arr1, tol, msg) + real(FMS_TEST_KIND_), intent(in), dimension(:,:,:,:) :: arr0, arr1 + real(FMS_TEST_KIND_), intent(in) :: tol + character(*), intent(in) :: msg + + if (any(abs(arr1 - arr0).gt.tol)) then + call mpp_error(FATAL, "[4D] Unexpected result: " // msg) + endif + end subroutine ARR_COMPARE_TOL_4D_ + + subroutine ARR_COMPARE_TOL_2D_SCALAR_ (arr, ans, tol, msg) + real(FMS_TEST_KIND_), intent(in), dimension(:,:) :: arr + real(FMS_TEST_KIND_), intent(in) :: ans + real(FMS_TEST_KIND_), intent(in) :: tol + character(*), intent(in) :: msg + + if (any(abs(arr - ans).gt.tol)) then + call mpp_error(FATAL, "[2D] Unexpected result: " // msg) + endif + end subroutine ARR_COMPARE_TOL_2D_SCALAR_ + + subroutine ARR_COMPARE_TOL_3D_SCALAR_ (arr, ans, tol, msg) + real(FMS_TEST_KIND_), intent(in), dimension(:,:,:) :: arr + real(FMS_TEST_KIND_), intent(in) :: ans + real(FMS_TEST_KIND_), intent(in) :: tol + character(*), intent(in) :: msg + + if (any(abs(arr - ans).gt.tol)) then + call mpp_error(FATAL, "[3D] Unexpected result: " // msg) + endif + end subroutine ARR_COMPARE_TOL_3D_SCALAR_ + + subroutine ARR_COMPARE_TOL_4D_SCALAR_ (arr, ans, tol, msg) + real(FMS_TEST_KIND_), intent(in), dimension(:,:,:,:) :: arr + real(FMS_TEST_KIND_), intent(in) :: ans + real(FMS_TEST_KIND_), intent(in) :: tol + character(*), intent(in) :: msg + + if (any(abs(arr - ans).gt.tol)) then + call mpp_error(FATAL, "[4D] Unexpected result: " // msg) + endif + end subroutine ARR_COMPARE_TOL_4D_SCALAR_ diff --git a/test_fms/common/test_fms.F90 b/test_fms/common/test_fms.F90 new file mode 100644 index 0000000000..13e8c0eca5 --- /dev/null +++ b/test_fms/common/test_fms.F90 @@ -0,0 +1,270 @@ +!*********************************************************************** +!* Apache License 2.0 +!* +!* This file is part of the GFDL Flexible Modeling System (FMS). +!* +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at +!* +!* http://www.apache.org/licenses/LICENSE-2.0 +!* +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. +!*********************************************************************** + +! This module allows arrays to be permuted, and provides a data type for the +! purpose of storing permuted array bounds. It provides procedures for +! initializing a 2D or 3D array with random data, and for comparing a 2D or +! 3D array with reference answers. + +module fms_test_mod + use random_numbers_mod, only: randomNumberStream, initializeRandomNumberStream, getRandomNumbers + use mpp_mod, only: mpp_error, FATAL + use platform_mod + + implicit none + + interface arr_init + module procedure :: arr_init_2d_r4, arr_init_2d_r8, arr_init_2d_i4, arr_init_2d_i8 + module procedure :: arr_init_3d_r4, arr_init_3d_r8, arr_init_3d_i4, arr_init_3d_i8 + end interface arr_init + + interface arr_compare + module procedure :: arr_compare_2d_r4, arr_compare_2d_r8, arr_compare_2d_i4, arr_compare_2d_i8 + module procedure :: arr_compare_3d_r4, arr_compare_3d_r8, arr_compare_3d_i4, arr_compare_3d_i8 + module procedure :: arr_compare_4d_r4, arr_compare_4d_r8, arr_compare_4d_i4, arr_compare_4d_i8 + end interface arr_compare + + interface arr_compare_tol + module procedure :: arr_compare_tol_2d_r4, arr_compare_tol_2d_r8 + module procedure :: arr_compare_tol_3d_r4, arr_compare_tol_3d_r8 + module procedure :: arr_compare_tol_4d_r4, arr_compare_tol_4d_r8 + + module procedure :: arr_compare_tol_2d_scalar_r4, arr_compare_tol_2d_scalar_r8 + module procedure :: arr_compare_tol_3d_scalar_r4, arr_compare_tol_3d_scalar_r8 + module procedure :: arr_compare_tol_4d_scalar_r4, arr_compare_tol_4d_scalar_r8 + end interface arr_compare_tol + + ! TODO: `permutable_indices` should really be implemented as a parameterized derived type, but because gfortran 13 + ! doesn't support parameterized derived types with type-bound procedures, the following workaround is needed. This + ! should be changed to a parameterized derived type once gfortran 13 support is no longer needed. + + type permutable_indices_2d + integer :: lb(2), ub(2) + + contains + + procedure :: permute => permutable_indices_permute_2d + procedure :: n => permutable_indices_n_2d + end type permutable_indices_2d + + type permutable_indices_3d + integer :: lb(3), ub(3) + + contains + + procedure :: permute => permutable_indices_permute_3d + procedure :: n => permutable_indices_n_3d + end type permutable_indices_3d + + type permutable_indices_4d + integer :: lb(4), ub(4) + + contains + + procedure :: permute => permutable_indices_permute_4d + procedure :: n => permutable_indices_n_4d + end type permutable_indices_4d + + contains + +#define FMS_TEST_TYPE_ real +#define TYPECAST_ real + +#define FMS_TEST_KIND_ r4_kind + +#define ARR_INIT_2D_ arr_init_2d_r4 +#define ARR_INIT_3D_ arr_init_3d_r4 +#define ARR_COMPARE_2D_ arr_compare_2d_r4 +#define ARR_COMPARE_3D_ arr_compare_3d_r4 +#define ARR_COMPARE_4D_ arr_compare_4d_r4 +#include "test_fms.inc" +#undef ARR_INIT_2D_ +#undef ARR_INIT_3D_ +#undef ARR_COMPARE_2D_ +#undef ARR_COMPARE_3D_ +#undef ARR_COMPARE_4D_ + +#define ARR_COMPARE_TOL_2D_ arr_compare_tol_2d_r4 +#define ARR_COMPARE_TOL_3D_ arr_compare_tol_3d_r4 +#define ARR_COMPARE_TOL_4D_ arr_compare_tol_4d_r4 +#define ARR_COMPARE_TOL_2D_SCALAR_ arr_compare_tol_2d_scalar_r4 +#define ARR_COMPARE_TOL_3D_SCALAR_ arr_compare_tol_3d_scalar_r4 +#define ARR_COMPARE_TOL_4D_SCALAR_ arr_compare_tol_4d_scalar_r4 +#include "test_fms_real.inc" +#undef ARR_COMPARE_TOL_2D_ +#undef ARR_COMPARE_TOL_3D_ +#undef ARR_COMPARE_TOL_4D_ +#undef ARR_COMPARE_TOL_2D_SCALAR_ +#undef ARR_COMPARE_TOL_3D_SCALAR_ +#undef ARR_COMPARE_TOL_4D_SCALAR_ + +#undef FMS_TEST_KIND_ +#define FMS_TEST_KIND_ r8_kind + +#define ARR_INIT_2D_ arr_init_2d_r8 +#define ARR_INIT_3D_ arr_init_3d_r8 +#define ARR_COMPARE_2D_ arr_compare_2d_r8 +#define ARR_COMPARE_3D_ arr_compare_3d_r8 +#define ARR_COMPARE_4D_ arr_compare_4d_r8 +#include "test_fms.inc" +#undef ARR_INIT_2D_ +#undef ARR_INIT_3D_ +#undef ARR_COMPARE_2D_ +#undef ARR_COMPARE_3D_ +#undef ARR_COMPARE_4D_ +#undef ARR_COMPARE_TOL_2D_SCALAR_ +#undef ARR_COMPARE_TOL_3D_SCALAR_ +#undef ARR_COMPARE_TOL_4D_SCALAR_ + +#define ARR_COMPARE_TOL_2D_ arr_compare_tol_2d_r8 +#define ARR_COMPARE_TOL_3D_ arr_compare_tol_3d_r8 +#define ARR_COMPARE_TOL_4D_ arr_compare_tol_4d_r8 +#define ARR_COMPARE_TOL_2D_SCALAR_ arr_compare_tol_2d_scalar_r8 +#define ARR_COMPARE_TOL_3D_SCALAR_ arr_compare_tol_3d_scalar_r8 +#define ARR_COMPARE_TOL_4D_SCALAR_ arr_compare_tol_4d_scalar_r8 +#include "test_fms_real.inc" +#undef ARR_COMPARE_TOL_2D_ +#undef ARR_COMPARE_TOL_3D_ +#undef ARR_COMPARE_TOL_4D_ +#undef ARR_COMPARE_TOL_2D_SCALAR_ +#undef ARR_COMPARE_TOL_3D_SCALAR_ +#undef ARR_COMPARE_TOL_4D_SCALAR_ + +#undef FMS_TEST_KIND_ + +#undef FMS_TEST_TYPE_ +#undef TYPECAST_ + +#define FMS_TEST_TYPE_ integer +#define TYPECAST_ int + +#define FMS_TEST_KIND_ i4_kind +#define ARR_INIT_2D_ arr_init_2d_i4 +#define ARR_INIT_3D_ arr_init_3d_i4 +#define ARR_COMPARE_2D_ arr_compare_2d_i4 +#define ARR_COMPARE_3D_ arr_compare_3d_i4 +#define ARR_COMPARE_4D_ arr_compare_4d_i4 +#include "test_fms.inc" +#undef FMS_TEST_KIND_ +#undef ARR_INIT_2D_ +#undef ARR_INIT_3D_ +#undef ARR_COMPARE_2D_ +#undef ARR_COMPARE_3D_ +#undef ARR_COMPARE_4D_ + +#define FMS_TEST_KIND_ i8_kind +#define ARR_INIT_2D_ arr_init_2d_i8 +#define ARR_INIT_3D_ arr_init_3d_i8 +#define ARR_COMPARE_2D_ arr_compare_2d_i8 +#define ARR_COMPARE_3D_ arr_compare_3d_i8 +#define ARR_COMPARE_4D_ arr_compare_4d_i8 +#include "test_fms.inc" +#undef FMS_TEST_KIND_ +#undef ARR_INIT_2D_ +#undef ARR_INIT_3D_ +#undef ARR_COMPARE_2D_ +#undef ARR_COMPARE_3D_ +#undef ARR_COMPARE_4D_ + +#undef FMS_TEST_TYPE_ +#undef TYPECAST_ + + subroutine permutable_indices_permute_2d(self, p) + class(permutable_indices_2d), intent(inout) :: self + integer, intent(in) :: p + + call permute_arr(self%lb, p) + call permute_arr(self%ub, p) + end subroutine permutable_indices_permute_2d + + subroutine permutable_indices_permute_3d(self, p) + class(permutable_indices_3d), intent(inout) :: self + integer, intent(in) :: p + + call permute_arr(self%lb, p) + call permute_arr(self%ub, p) + end subroutine permutable_indices_permute_3d + + subroutine permutable_indices_permute_4d(self, p) + class(permutable_indices_4d), intent(inout) :: self + integer, intent(in) :: p + + call permute_arr(self%lb, p) + call permute_arr(self%ub, p) + end subroutine permutable_indices_permute_4d + + function permutable_indices_n_2d(self, i) result(n) + class(permutable_indices_2d), intent(inout) :: self + integer, intent(in) :: i + integer :: n + + n = self%ub(i) - self%lb(i) + 1 + end function permutable_indices_n_2d + + function permutable_indices_n_3d(self, i) result(n) + class(permutable_indices_3d), intent(inout) :: self + integer, intent(in) :: i + integer :: n + + n = self%ub(i) - self%lb(i) + 1 + end function permutable_indices_n_3d + + function permutable_indices_n_4d(self, i) result(n) + class(permutable_indices_4d), intent(inout) :: self + integer, intent(in) :: i + integer :: n + + n = self%ub(i) - self%lb(i) + 1 + end function permutable_indices_n_4d + + pure recursive function factorial(n) result(res) + integer, intent(in) :: n + integer :: res + + if (n.eq.0) then + res = 1 + else + res = n * factorial(n-1) + endif + end function factorial + + subroutine permute_arr(arr, p) + integer, intent(inout) :: arr(:) !< List to be permuted + integer, intent(in) :: p !< Which permutation to produce: may range from 1 to size(arr)! + integer :: choices(size(arr)) + integer :: n, k, i, f, indx + + n = size(arr) + if (p.lt.1 .or. p.gt.factorial(n)) then + print *, "Error: p parameter is out of bounds" + stop 1 + endif + + choices = arr + k = p - 1 + + do i=1,n + f = factorial(n - i) + indx = k / f + 1 + k = mod(k, f) + + arr(i) = choices(indx) + choices(indx) = choices(n + 1 - i) + enddo + end subroutine permute_arr +end module fms_test_mod diff --git a/test_fms/coupler/Makefile.am b/test_fms/coupler/Makefile.am index 3159a46503..a117b597b3 100644 --- a/test_fms/coupler/Makefile.am +++ b/test_fms/coupler/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the test_fms/data_override directory of the FMS @@ -47,14 +46,14 @@ test_atmos_ocean_fluxes_r8_SOURCES = test_atmos_ocean_fluxes.F90 test_gex_SOURCES = test_gex.F90 # add macro flags for kind and r4/r8 child type -test_coupler_2d_r4_CPPFLAGS=-DFMS_CP_TEST_KIND_=r4_kind -DFMS_TEST_BC_TYPE_=bc_r4 -I$(MODDIR) -test_coupler_2d_r8_CPPFLAGS=-DFMS_CP_TEST_KIND_=r8_kind -DFMS_TEST_BC_TYPE_=bc -I$(MODDIR) -test_coupler_3d_r4_CPPFLAGS=-DFMS_CP_TEST_KIND_=r4_kind -DFMS_TEST_BC_TYPE_=bc_r4 -I$(MODDIR) -test_coupler_3d_r8_CPPFLAGS=-DFMS_CP_TEST_KIND_=r8_kind -DFMS_TEST_BC_TYPE_=bc -I$(MODDIR) -test_coupler_types_r4_CPPFLAGS=-DFMS_CP_TEST_KIND_=r4_kind -DFMS_TEST_BC_TYPE_=bc_r4 -I$(MODDIR) -test_coupler_types_r8_CPPFLAGS=-DFMS_CP_TEST_KIND_=r8_kind -DFMS_TEST_BC_TYPE_=bc -I$(MODDIR) -test_atmos_ocean_fluxes_r4_CPPFLAGS=-DFMS_CP_TEST_KIND_=r4_kind -DFMS_TEST_BC_TYPE_=bc_r4 -I$(MODDIR) -test_atmos_ocean_fluxes_r8_CPPFLAGS=-DFMS_CP_TEST_KIND_=r8_kind -DFMS_TEST_BC_TYPE_=bc -I$(MODDIR) +test_coupler_2d_r4_CPPFLAGS=-DTEST_FMS_KIND_=r4_kind -DFMS_TEST_BC_TYPE_=bc_r4 -I$(MODDIR) +test_coupler_2d_r8_CPPFLAGS=-DTEST_FMS_KIND_=r8_kind -DFMS_TEST_BC_TYPE_=bc -I$(MODDIR) +test_coupler_3d_r4_CPPFLAGS=-DTEST_FMS_KIND_=r4_kind -DFMS_TEST_BC_TYPE_=bc_r4 -I$(MODDIR) +test_coupler_3d_r8_CPPFLAGS=-DTEST_FMS_KIND_=r8_kind -DFMS_TEST_BC_TYPE_=bc -I$(MODDIR) +test_coupler_types_r4_CPPFLAGS=-DTEST_FMS_KIND_=r4_kind -DFMS_TEST_BC_TYPE_=bc_r4 -I$(MODDIR) +test_coupler_types_r8_CPPFLAGS=-DTEST_FMS_KIND_=r8_kind -DFMS_TEST_BC_TYPE_=bc -I$(MODDIR) +test_atmos_ocean_fluxes_r4_CPPFLAGS=-DTEST_FMS_KIND_=r4_kind -DFMS_TEST_BC_TYPE_=bc_r4 -I$(MODDIR) +test_atmos_ocean_fluxes_r8_CPPFLAGS=-DTEST_FMS_KIND_=r8_kind -DFMS_TEST_BC_TYPE_=bc -I$(MODDIR) test_gex_CPPFLAGS = -I$(MODDIR) TEST_EXTENSIONS = .sh @@ -64,12 +63,14 @@ SH_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ # Run the test program. TESTS = test_coupler.sh test_gex.sh -if ! USING_YAML - TESTS_ENVIRONMENT = skip_yaml=yes +if USING_YAML + TESTS_ENVIRONMENT = parser_skip="" +else + TESTS_ENVIRONMENT = parser_skip=skip endif # Include these files with the distribution. EXTRA_DIST = test_coupler.sh test_gex.sh # Clean up -CLEANFILES = input.nml *.nc* *.out *.dpi *.spi *.dyn *.spl *_table* INPUT/*.nc +CLEANFILES = input.nml *.nc* *.out *.dpi *.spi *.dyn *.spl *_table* INPUT/*.nc test_coupler-files/* test_gex-files/* test_coupler-files/*/* test_gex-files/*/* diff --git a/test_fms/coupler/test_atmos_ocean_fluxes.F90 b/test_fms/coupler/test_atmos_ocean_fluxes.F90 index 7eb50880df..a35213bb3b 100644 --- a/test_fms/coupler/test_atmos_ocean_fluxes.F90 +++ b/test_fms/coupler/test_atmos_ocean_fluxes.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !! @brief unit tests for atmos_ocean_fluxes_mod @@ -45,8 +44,8 @@ program test_atmos_ocean_fluxes character(8), dimension(num_bcs) :: flux_name !< flux name character(24), dimension(num_bcs) :: flux_type !< flux_type for the given flux name character(6), dimension(num_bcs) :: impl !< implementation type for a given flux_type - real(FMS_CP_TEST_KIND_), dimension(num_bcs) :: mol_wt !< value of mol_wt - real(FMS_CP_TEST_KIND_), dimension(num_bcs) :: param_array !< parameter array + real(TEST_FMS_KIND_), dimension(num_bcs) :: mol_wt !< value of mol_wt + real(TEST_FMS_KIND_), dimension(num_bcs) :: param_array !< parameter array !> The flux names are made up. flux_name=["vampires", & @@ -94,7 +93,7 @@ subroutine test_atmos_ocean_fluxes_init write(*,*) "*** TEST_ATMOS_OCEAN_FLUXES_INIT ***" call atmos_ocean_fluxes_init(gas_fluxes, gas_fields_atm, gas_fields_ice, & - use_r4_kind= FMS_CP_TEST_KIND_ .eq. r4_kind) + use_r4_kind= TEST_FMS_KIND_ .eq. r4_kind) end subroutine test_atmos_ocean_fluxes_init !-------------------------------------- @@ -105,7 +104,7 @@ subroutine test_aof_set_coupler_flux implicit none character(100) :: cresults, thelist - real(FMS_CP_TEST_KIND_) :: rresults, rresults2(num_bcs) + real(TEST_FMS_KIND_) :: rresults, rresults2(num_bcs) integer :: i, n logical :: success diff --git a/test_fms/coupler/test_coupler.sh b/test_fms/coupler/test_coupler.sh index 4512cca557..6a9c98d042 100755 --- a/test_fms/coupler/test_coupler.sh +++ b/test_fms/coupler/test_coupler.sh @@ -1,21 +1,20 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to # execute tests in the test_fms/coupler directory. @@ -26,6 +25,8 @@ # Set common test settings. . ../test-lib.sh +output_dir + rm -f input.nml touch input.nml @@ -106,11 +107,11 @@ mkdir INPUT test_expect_success "coupler types interfaces (r4_kind)" ' - mpirun -n 4 ./test_coupler_types_r4 + mpirun -n 4 ../test_coupler_types_r4 ' test_expect_success "coupler types interfaces (r8_kind)" ' - mpirun -n 4 ./test_coupler_types_r8 + mpirun -n 4 ../test_coupler_types_r8 ' # delete lines from the table to make sure we see the difference in the send_data return status @@ -125,36 +126,36 @@ _EOF test_expect_success "coupler types interfaces - check send_data return vals (r4_kind)" ' - mpirun -n 4 ./test_coupler_types_r4 + mpirun -n 4 ../test_coupler_types_r4 ' test_expect_success "coupler types interfaces - check send_data return vals (r8_kind)" ' - mpirun -n 4 ./test_coupler_types_r8 + mpirun -n 4 ../test_coupler_types_r8 ' mkdir RESTART test_expect_success "coupler register restart 2D(r4_kind)" ' - mpirun -n 1 ./test_coupler_2d_r4 + mpirun -n 1 ../test_coupler_2d_r4 ' test_expect_success "coupler register restart 2D(r8_kind)" ' - mpirun -n 1 ./test_coupler_2d_r8 + mpirun -n 1 ../test_coupler_2d_r8 ' test_expect_success "coupler register restart 3D (r4_kind)" ' - mpirun -n 1 ./test_coupler_3d_r4 + mpirun -n 1 ../test_coupler_3d_r4 ' test_expect_success "coupler register restart 3D (r8_kind)" ' - mpirun -n 1 ./test_coupler_3d_r8 + mpirun -n 1 ../test_coupler_3d_r8 ' test_expect_success "test atmos_ocean_fluxes (r4_kind)" ' - mpirun -n 1 ./test_atmos_ocean_fluxes_r4 + mpirun -n 1 ../test_atmos_ocean_fluxes_r4 ' test_expect_success "test atmos_ocean_fluxes (r8_kind)" ' - mpirun -n 1 ./test_atmos_ocean_fluxes_r8 + mpirun -n 1 ../test_atmos_ocean_fluxes_r8 ' rm -rf RESTART diff --git a/test_fms/coupler/test_coupler_2d.F90 b/test_fms/coupler/test_coupler_2d.F90 index 7e954be756..b6d17273a4 100644 --- a/test_fms/coupler/test_coupler_2d.F90 +++ b/test_fms/coupler/test_coupler_2d.F90 @@ -1,31 +1,21 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** -!! defaults to ensure compilation -#ifndef FMS_CP_TEST_KIND_ -#define FMS_CP_TEST_KIND_ r8_kind -#endif - -#ifndef FMS_TEST_BC_TYPE_ -#define FMS_TEST_BC_TYPE_ bc -#endif - !> @brief This programs tests the functionality in !! 1. coupler_type_register_restarts (CT_register_restarts_2d) !! 2. coupler_type_restore_state (CT_restore_state_2d) @@ -56,7 +46,7 @@ program test_coupler_2d integer :: num_rest_files !< Number of restart files integer :: i !< No description type(FmsNetcdfFile_t) :: fileobj !< fms2_io fileobjs -real(FMS_CP_TEST_KIND_), allocatable :: dummy_var(:,:) !< Dummy variable +real(TEST_FMS_KIND_), allocatable :: dummy_var(:,:) !< Dummy variable call fms_init() @@ -83,10 +73,10 @@ program test_coupler_2d call register_variable_attribute(fileobj, "laty", "axis", "y", str_len=1) allocate(dummy_var(nlon, nlat)) - dummy_var = real(1, kind=FMS_CP_TEST_KIND_) + dummy_var = real(1, kind=TEST_FMS_KIND_) call write_data(fileobj, "var_1", dummy_var) - dummy_var = real(2, kind=FMS_CP_TEST_KIND_) + dummy_var = real(2, kind=TEST_FMS_KIND_) call write_data(fileobj, "var_2", dummy_var) call close_file(fileobj) diff --git a/test_fms/coupler/test_coupler_3d.F90 b/test_fms/coupler/test_coupler_3d.F90 index dd1d481c51..c8bcfa21b5 100644 --- a/test_fms/coupler/test_coupler_3d.F90 +++ b/test_fms/coupler/test_coupler_3d.F90 @@ -1,31 +1,21 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** -!! defaults to ensure compilation -#ifndef FMS_CP_TEST_KIND_ -#define FMS_CP_TEST_KIND_ r8_kind -#endif - -#ifndef FMS_TEST_BC_TYPE_ -#define FMS_TEST_BC_TYPE_ bc -#endif - !> @brief This programs tests the functionality in !! 1. coupler_type_register_restarts (CT_register_restarts_3d) !! 2. coupler_type_restore_state (CT_restore_state_3d) @@ -41,7 +31,7 @@ program test_coupler_3d use coupler_types_mod, only: coupler_3d_bc_type, coupler_2d_bc_type, coupler_type_register_restarts, & coupler_type_restore_state use coupler_types_mod, only: coupler_1d_bc_type -use platform_mod, only: FMS_CP_TEST_KIND_ +use platform_mod, only: TEST_FMS_KIND_ implicit none @@ -57,7 +47,7 @@ program test_coupler_3d integer :: num_rest_files !< Number of restart files integer :: i !< No description type(FmsNetcdfFile_t) :: fileobj !< fms2_io fileobjs -real(FMS_CP_TEST_KIND_), allocatable :: dummy_var(:,:,:) !< Dummy variable +real(TEST_FMS_KIND_), allocatable :: dummy_var(:,:,:) !< Dummy variable call fms_init() @@ -89,10 +79,10 @@ program test_coupler_3d call register_variable_attribute(fileobj, "laty", "axis", "y", str_len=1) allocate(dummy_var(nlon, nlat, data_grid(5))) - dummy_var = real(1, kind=FMS_CP_TEST_KIND_) + dummy_var = real(1, kind=TEST_FMS_KIND_) call write_data(fileobj, "var_1", dummy_var) - dummy_var = real(2, kind=FMS_CP_TEST_KIND_) + dummy_var = real(2, kind=TEST_FMS_KIND_) call write_data(fileobj, "var_2", dummy_var) call close_file(fileobj) diff --git a/test_fms/coupler/test_coupler_types.F90 b/test_fms/coupler/test_coupler_types.F90 index 4204f768b6..9a6e04445a 100644 --- a/test_fms/coupler/test_coupler_types.F90 +++ b/test_fms/coupler/test_coupler_types.F90 @@ -1,32 +1,22 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** ! Ryan Mulhall 8/23 -!! defaults to ensure compilation -#ifndef FMS_CP_TEST_KIND_ -#define FMS_CP_TEST_KIND_ r8_kind -#endif - -#ifndef FMS_TEST_BC_TYPE_ -#define FMS_TEST_BC_TYPE_ bc -#endif - !> Tests for the coupler types interfaces not tested in test_coupler_2d/3d program test_coupler_types @@ -61,14 +51,14 @@ program test_coupler_types integer :: data_grid(5) !< i/j starting and ending indices for data domain character(len=3) :: appendix !< appoendix added to filename type(time_type) :: time_t -integer, parameter :: lkind = FMS_CP_TEST_KIND_ -real(FMS_CP_TEST_KIND_), allocatable :: array_2d(:,:), array_3d(:,:,:) +integer, parameter :: lkind = TEST_FMS_KIND_ +real(TEST_FMS_KIND_), allocatable :: array_2d(:,:), array_3d(:,:,:) integer, parameter :: num_bc = 2, num_fields = 2 !< these are set in set_up_coupler_type routines -real(FMS_CP_TEST_KIND_), allocatable :: lats(:), lons(:), nzs(:) !< arrays of coordinate values for diag_axis +real(TEST_FMS_KIND_), allocatable :: lats(:), lons(:), nzs(:) !< arrays of coordinate values for diag_axis !! initalization integer :: id_x, id_y, id_z, chksum_unit character(len=128) :: chksum_2d, chksum_3d -real(FMS_CP_TEST_KIND_), allocatable :: expected_2d(:,:), expected_3d(:,:,:) +real(TEST_FMS_KIND_), allocatable :: expected_2d(:,:), expected_3d(:,:,:) integer :: err, ncid, dim1D, varid, day logical, allocatable :: return_stats(:,:) @@ -258,7 +248,7 @@ program test_coupler_types err = nf90_close(ncid) endif call mpp_sync() -call data_override_init(Atm_domain_in=Domain, mode=FMS_CP_TEST_KIND_) +call data_override_init(Atm_domain_in=Domain, mode=TEST_FMS_KIND_) time_t = set_date(1, 1, 15) call coupler_type_data_override("ATM", bc_2d_new, time_t) @@ -305,8 +295,8 @@ program test_coupler_types subroutine check_field_data_2d(bc_2d, expected) type(coupler_2d_bc_type) :: bc_2d - real(FMS_CP_TEST_KIND_), intent(in) :: expected(:,:) - real(FMS_CP_TEST_KIND_), pointer :: values_ptr(:,:) + real(TEST_FMS_KIND_), intent(in) :: expected(:,:) + real(TEST_FMS_KIND_), pointer :: values_ptr(:,:) do i=1, bc_2d%num_bcs do j=1, bc_2d%FMS_TEST_BC_TYPE_(i)%num_fields @@ -322,8 +312,8 @@ subroutine check_field_data_2d(bc_2d, expected) subroutine check_field_data_3d(bc_3d, expected) type(coupler_3d_bc_type) :: bc_3d - real(FMS_CP_TEST_KIND_), intent(in) :: expected(:,:,:) - real(FMS_CP_TEST_KIND_), pointer :: values_ptr(:,:,:) + real(TEST_FMS_KIND_), intent(in) :: expected(:,:,:) + real(TEST_FMS_KIND_), pointer :: values_ptr(:,:,:) integer :: x, y, z, vals_start(3) !< need start point for indices, passed in will always be 1-n do i=1, bc_3d%num_bcs diff --git a/test_fms/coupler/test_coupler_utils.inc b/test_fms/coupler/test_coupler_utils.inc index 6c2ee91d77..30211b48a9 100644 --- a/test_fms/coupler/test_coupler_utils.inc +++ b/test_fms/coupler/test_coupler_utils.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> Include file to hold common routines for the coupler tests !! Uses the FMS_TEST_BC_TYPE_ macro to test both r4/r8 @@ -48,7 +47,7 @@ subroutine set_up_1d_coupler_type(bc_type, data_grid) write(field_num,'(i1)') j bc_type%FMS_TEST_BC_TYPE_(i)%field(j)%name="var_"//field_num allocate(bc_type%FMS_TEST_BC_TYPE_(i)%field(j)%values(data_grid(1):data_grid(2))) - bc_type%FMS_TEST_BC_TYPE_(i)%field(j)%values = real(j, kind=FMS_CP_TEST_KIND_) + bc_type%FMS_TEST_BC_TYPE_(i)%field(j)%values = real(j, kind=TEST_FMS_KIND_) end do end do @@ -101,9 +100,9 @@ subroutine set_up_2d_coupler_type(bc_type, data_grid, appendix, to_read) bc_type%FMS_TEST_BC_TYPE_(i)%field(j)%name="var_"//field_num allocate(bc_type%FMS_TEST_BC_TYPE_(i)%field(j)%values(data_grid(1):data_grid(2), data_grid(3):data_grid(4))) if (to_read) then - bc_type%FMS_TEST_BC_TYPE_(i)%field(j)%values = real(999., kind=FMS_CP_TEST_KIND_) + bc_type%FMS_TEST_BC_TYPE_(i)%field(j)%values = real(999., kind=TEST_FMS_KIND_) else - bc_type%FMS_TEST_BC_TYPE_(i)%field(j)%values = real(j, kind=FMS_CP_TEST_KIND_) + bc_type%FMS_TEST_BC_TYPE_(i)%field(j)%values = real(j, kind=TEST_FMS_KIND_) endif end do end do @@ -214,9 +213,9 @@ subroutine set_up_3d_coupler_type(bc_type, data_grid, appendix, to_read) data_grid(5))) if (to_read) then - bc_type%FMS_TEST_BC_TYPE_(i)%field(j)%values = real(999., kind=FMS_CP_TEST_KIND_) + bc_type%FMS_TEST_BC_TYPE_(i)%field(j)%values = real(999., kind=TEST_FMS_KIND_) else - bc_type%FMS_TEST_BC_TYPE_(i)%field(j)%values = real(j, kind=FMS_CP_TEST_KIND_) + bc_type%FMS_TEST_BC_TYPE_(i)%field(j)%values = real(j, kind=TEST_FMS_KIND_) endif end do end do diff --git a/test_fms/coupler/test_gex.F90 b/test_fms/coupler/test_gex.F90 index ba1c29be23..8b14f3ae82 100644 --- a/test_fms/coupler/test_gex.F90 +++ b/test_fms/coupler/test_gex.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> This program tests the public API of gex_mod. diff --git a/test_fms/coupler/test_gex.sh b/test_fms/coupler/test_gex.sh index 5f8596155c..93a688fac7 100755 --- a/test_fms/coupler/test_gex.sh +++ b/test_fms/coupler/test_gex.sh @@ -1,33 +1,30 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # Set common test settings. . ../test-lib.sh -if [ ! -z $skip_yaml ] -then - SKIP_TESTS='test_gex.2' -fi +output_dir -test_cmd="mpirun -n 1 ./test_gex" + +test_cmd="mpirun -n 1 ../test_gex" # Create input.nml and field table (legacy field table) prepare_legacy () { @@ -83,8 +80,10 @@ EOF prepare_legacy default_test test_expect_success "Test gex with atm_to_lnd tracer (legacy field_table)" "$test_cmd" -prepare_yaml default_test -test_expect_success "Test gex with atm_to_lnd tracer (YAML field_table)" "$test_cmd" +if [ -z "$parser_skip" ]; then + prepare_yaml default_test + test_expect_success "Test gex with atm_to_lnd tracer (YAML field_table)" "$test_cmd" +fi prepare_legacy get_n_ex_invalid_model_src test_expect_failure "Test gex_get_n_ex with invalid model_src" "$test_cmd" diff --git a/test_fms/data_override/Makefile.am b/test_fms/data_override/Makefile.am index 2925304e89..50c8f80e7b 100644 --- a/test_fms/data_override/Makefile.am +++ b/test_fms/data_override/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the test_fms/data_override directory of the FMS @@ -23,10 +22,10 @@ # uramirez, Ed Hartnett # Find the needed mod and .inc files. -AM_CPPFLAGS = -I$(MODDIR) -I$(top_srcdir)/include -I$(top_srcdir)/test_fms/data_override/include +AM_CPPFLAGS = -I$(MODDIR) -I$(top_srcdir)/include -I$(top_srcdir)/test_fms/data_override/include -I$(top_builddir)/test_fms/common # Link to the FMS library. -LDADD = $(top_builddir)/libFMS/libFMS.la +LDADD = $(top_builddir)/libFMS/libFMS.la $(top_builddir)/test_fms/common/libtest_fms.a # Build this test program. check_PROGRAMS = \ @@ -50,32 +49,34 @@ test_data_override_ongrid_SOURCES = test_data_override_ongrid.F90 \ test_get_grid_v1_r4_SOURCES = test_get_grid_v1.F90 test_get_grid_v1_r8_SOURCES = test_get_grid_v1.F90 -test_data_override_r4_CPPFLAGS = $(AM_CPPFLAGS) -DDO_TEST_KIND_=r4_kind -test_data_override_r8_CPPFLAGS = $(AM_CPPFLAGS) -DDO_TEST_KIND_=r8_kind +test_data_override_r4_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_FMS_KIND_=r4_kind +test_data_override_r8_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_FMS_KIND_=r8_kind + +test_get_grid_v1_r4_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_FMS_KIND_=r4_kind +test_get_grid_v1_r8_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_FMS_KIND_=r8_kind -test_get_grid_v1_r4_CPPFLAGS = $(AM_CPPFLAGS) -DDO_TEST_KIND_=r4_kind -test_get_grid_v1_r8_CPPFLAGS = $(AM_CPPFLAGS) -DDO_TEST_KIND_=r8_kind if USING_YAML -skipflag="" + TESTS_ENVIRONMENT = parser_skip="" else -skipflag="skip" + TESTS_ENVIRONMENT = parser_skip=skip endif TEST_EXTENSIONS = .sh SH_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ $(abs_top_srcdir)/test_fms/tap-driver.sh -TESTS_ENVIRONMENT= test_input_path="@TEST_INPUT_PATH@" \ - parser_skip=${skipflag} +TESTS_ENVIRONMENT+= test_input_path="@TEST_INPUT_PATH@" # Run the test program. TESTS = test_data_override2.sh test_data_override_init.sh test_data_override2_mono.sh test_data_override2_ongrid.sh \ - test_data_override2_scalar.sh test_data_override_weights.sh test_data_override_ensembles.sh + test_data_override2_scalar.sh test_data_override_weights.sh test_data_override_ensembles.sh \ + test_data_override_multi_file.sh # Include these files with the distribution. EXTRA_DIST = test_data_override2.sh test_data_override_init.sh test_data_override2_mono.sh test_data_override2_ongrid.sh \ - test_data_override2_scalar.sh test_data_override_weights.sh test_data_override_ensembles.sh + test_data_override2_scalar.sh test_data_override_weights.sh test_data_override_ensembles.sh \ + test_data_override_multi_file.sh # Clean up CLEANFILES = input.nml *.nc* *.out diag_table data_table data_table.yaml INPUT/* *.dpi *.spi *.dyn *.spl *-files/* diff --git a/test_fms/data_override/include/test_data_override_ongrid.inc b/test_fms/data_override/include/test_data_override_ongrid.inc index 16df212e79..1813ea909d 100644 --- a/test_fms/data_override/include/test_data_override_ongrid.inc +++ b/test_fms/data_override/include/test_data_override_ongrid.inc @@ -1,46 +1,48 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** -subroutine COMPARE_DATA_ (Domain_in, actual_result, expected_result) - integer, parameter :: lkind = DO_TEST_KIND_ !< Real precision of the test +subroutine COMPARE_DATA_ (Domain_in, actual_result, expected_result, p) + integer, parameter :: lkind = TEST_FMS_KIND_ !< Real precision of the test type(domain2d), intent(in) :: Domain_in !< Domain with mask table - real(lkind), intent(in) :: expected_result !< Expected result from data_override real(lkind), dimension(:,:), intent(in) :: actual_result !< Result from data_override + real(lkind), intent(in) :: expected_result !< Expected result from data_override + integer, intent(in) :: p !< Dimension order permutation index integer :: xsizec, ysizec !< Size of the compute domain integer :: xsized, ysized !< Size of the data domain - integer :: nx, ny !< Size of acual_result - integer :: nhx, nhy !< Size of the halos + integer :: n(2) !< Size of acual_result + integer :: nh(2) !< Size of the halos integer :: i, j !< Helper indices !< Data is only expected to be overridden for the compute domain -not at the halos. call mpp_get_compute_domain(Domain_in, xsize=xsizec, ysize=ysizec) call mpp_get_data_domain(Domain_in, xsize=xsized, ysize=ysized) - !< Note that actual_result has indices at (1:nx,1:ny) not (is:ie,js:je) - nhx= (xsized-xsizec)/2 - nhy = (ysized-ysizec)/2 - nx = size(actual_result, 1) - ny = size(actual_result, 2) + !< Note that actual_result has indices at (1:n(1),1:n(2)) not (is:ie,js:je) + n(1) = size(actual_result, 1) + n(2) = size(actual_result, 2) - do i = 1, nx - do j = 1, ny - if (i <= nhx .or. i > (nx-nhx) .or. j <= nhy .or. j > (ny-nhy)) then + nh(1) = (xsized-xsizec)/2 + nh(2) = (ysized-ysizec)/2 + call permute_arr(nh, p) + + do i = 1, n(1) + do j = 1, n(2) + if (i <= nh(1) .or. i > (n(1)-nh(1)) .or. j <= nh(2) .or. j > (n(2)-nh(2))) then !< This is the result at the halos it should 999. if (actual_result(i,j) .ne. 999._lkind) then print *, "for i=", i, " and j=", j, " result=", actual_result(i,j) @@ -59,13 +61,19 @@ end subroutine COMPARE_DATA_ !> @brief Tests ongrid data overrides. !! In the first case there is no time interpolation !! In the second case there is time interpolation -subroutine ONGRID_TEST_ - integer, parameter :: lkind = DO_TEST_KIND_ !< Real precision of the test - real(lkind) :: expected_result !< Expected result from data_override - type(time_type) :: Time !< Time - real(lkind), allocatable, dimension(:,:) :: runoff !< Data to be written +subroutine ONGRID_TEST_ (p) + integer, intent(in) :: p + integer, parameter :: lkind = TEST_FMS_KIND_ !< Real precision of the test + real(lkind) :: expected_result !< Expected result from data_override + type(time_type) :: Time !< Time + real(lkind), allocatable, dimension(:,:) :: runoff !< Data to be written + type(permutable_indices_2d) :: ind !< Dimension boundaries + + ind%lb = [is, js] + ind%ub = [ie, je] + call ind%permute(p) - allocate(runoff(is:ie,js:je)) + allocate(runoff(ind%lb(1):ind%ub(1), ind%lb(2):ind%ub(2))) runoff = 999._lkind !< Run it when time=3 @@ -74,7 +82,7 @@ subroutine ONGRID_TEST_ !< Because you are getting the data when time=3, and this is an "ongrid" case, the expected result is just !! equal to the data at time=3, which is 3. expected_result = 3._lkind - call COMPARE_DATA_ (Domain, runoff, expected_result) + call COMPARE_DATA_ (Domain, runoff, expected_result, p) !< Run it when time=4 runoff = 999._lkind @@ -83,24 +91,28 @@ subroutine ONGRID_TEST_ !< You are getting the data when time=4, the data at time=3 is 3. and at time=5 is 4., so the expected result !! is the average of the 2 (because this is is an "ongrid" case and there is no horizontal interpolation). expected_result = (3._lkind + 4._lkind) / 2._lkind - call COMPARE_DATA_ (Domain, runoff, expected_result) - - deallocate(runoff) + call COMPARE_DATA_ (Domain, runoff, expected_result, p) end subroutine ONGRID_TEST_ !> @brief Tests bilinear data_override with and increasing and decreasing grid case !! and comares the output betweeen the cases to ensure it is correct -subroutine BILINEAR_TEST_ - integer, parameter :: lkind = DO_TEST_KIND_ !< Real precision of the test - type(time_type) :: Time !< Time - real(lkind), allocatable, dimension(:,:) :: runoff_decreasing !< Data to be written - real(lkind), allocatable, dimension(:,:) :: runoff_increasing !< Data to be written +subroutine BILINEAR_TEST_ (p) + integer, intent(in) :: p + integer, parameter :: lkind = TEST_FMS_KIND_ !< Real precision of the test + type(time_type) :: Time !< Time + real(lkind), allocatable, dimension(:,:) :: runoff_decreasing !< Data to be written + real(lkind), allocatable, dimension(:,:) :: runoff_increasing !< Data to be written + type(permutable_indices_2d) :: ind !< Dimension boundaries integer :: i, j, k logical :: success - allocate(runoff_decreasing(is:ie,js:je)) - allocate(runoff_increasing(is:ie,js:je)) + ind%lb = [is, js] + ind%ub = [ie, je] + call ind%permute(p) + + allocate(runoff_decreasing(ind%lb(1):ind%ub(1), ind%lb(2):ind%ub(2))) + allocate(runoff_increasing(ind%lb(1):ind%ub(1), ind%lb(2):ind%ub(2))) runoff_decreasing = 999_lkind runoff_increasing = 999_lkind @@ -119,21 +131,26 @@ subroutine BILINEAR_TEST_ endif enddo enddo - deallocate(runoff_decreasing, runoff_increasing) end subroutine BILINEAR_TEST_ -subroutine WEIGHT_FILE_TEST_ - integer, parameter :: lkind = DO_TEST_KIND_ !< Real precision of the test - type(time_type) :: Time !< Time - real(lkind), allocatable, dimension(:,:) :: runoff !< Data from normal override - real(lkind), allocatable, dimension(:,:) :: runoff_weight !< Data from weight file override - real(lkind) :: threshold !< Threshold for the difference in answers +subroutine WEIGHT_FILE_TEST_ (p) + integer, intent(in) :: p + integer, parameter :: lkind = TEST_FMS_KIND_ !< Real precision of the test + type(time_type) :: Time !< Time + real(lkind), allocatable, dimension(:,:) :: runoff !< Data from normal override + real(lkind), allocatable, dimension(:,:) :: runoff_weight !< Data from weight file override + real(lkind) :: threshold !< Threshold for the difference in answers + type(permutable_indices_2d) :: ind !< Dimension boundaries integer :: i, j, k logical :: success - allocate(runoff(is:ie,js:je)) - allocate(runoff_weight(is:ie,js:je)) + ind%lb = [is, js] + ind%ub = [ie, je] + call ind%permute(p) + + allocate(runoff(ind%lb(1):ind%ub(1), ind%lb(2):ind%ub(2))) + allocate(runoff_weight(ind%lb(1):ind%ub(1), ind%lb(2):ind%ub(2))) runoff = 999_lkind runoff_weight = 999_lkind @@ -157,11 +174,10 @@ subroutine WEIGHT_FILE_TEST_ endif enddo enddo - deallocate(runoff, runoff_weight) end subroutine WEIGHT_FILE_TEST_ subroutine SCALAR_TEST_ - integer, parameter :: lkind = DO_TEST_KIND_ !< Real precision of the test + integer, parameter :: lkind = TEST_FMS_KIND_ !< Real precision of the test real(lkind) :: expected_result !< Expected result from data_override type(time_type) :: Time !< Time real(lkind) :: co2 !< Data to be written @@ -185,16 +201,22 @@ subroutine SCALAR_TEST_ if (co2 .ne. expected_result) call mpp_error(FATAL, "co2 was not overridden to the correct value!") end subroutine SCALAR_TEST_ -subroutine ENSEMBLE_TEST_ - integer, parameter :: lkind = DO_TEST_KIND_ !< Real precision of the test - real(lkind) :: expected_result !< Expected result from data_override - type(time_type) :: Time !< Time - real(lkind), allocatable, dimension(:,:) :: runoff !< Data to be written - integer :: scale_fac !< Scale factor to use when determining - !! the expected answer +subroutine ENSEMBLE_TEST_ (p) + integer, intent(in) :: p + integer, parameter :: lkind = TEST_FMS_KIND_ !< Real precision of the test + real(lkind) :: expected_result !< Expected result from data_override + type(time_type) :: Time !< Time + real(lkind), allocatable, dimension(:,:) :: runoff !< Data to be written + type(permutable_indices_2d) :: ind !< Dimension boundaries + integer :: scale_fac !< Scale factor to use when determining + !! the expected answer logical :: sucessful !< .True. if the data_override was sucessful - allocate(runoff(is:ie,js:je)) + ind%lb = [is, js] + ind%ub = [ie, je] + call ind%permute(p) + + allocate(runoff(ind%lb(1):ind%ub(1), ind%lb(2):ind%ub(2))) scale_fac = ensemble_id if (test_case .eq. ensemble_same_yaml) scale_fac = 1 @@ -207,7 +229,7 @@ subroutine ENSEMBLE_TEST_ !< Because you are getting the data when time=3, and this is an "ongrid" case, the expected result is just !! equal to the data at time=3, which is 3+scale_fac. expected_result = 3._lkind + real(scale_fac,kind=lkind) - call COMPARE_DATA_ (Domain, runoff, expected_result) + call COMPARE_DATA_ (Domain, runoff, expected_result, p) !< Run it when time=4 runoff = 999._lkind @@ -218,7 +240,45 @@ subroutine ENSEMBLE_TEST_ !! so the expected result is the average of the 2 (because this is is an "ongrid" case and there !! is no horizontal interpolation). expected_result = (3._lkind + real(scale_fac,kind=lkind) + 4._lkind + real(scale_fac,kind=lkind)) / 2._lkind - call COMPARE_DATA_ (Domain, runoff, expected_result) - - deallocate(runoff) + call COMPARE_DATA_ (Domain, runoff, expected_result, p) end subroutine ENSEMBLE_TEST_ + +subroutine MULTI_FILE_TESTS_ (p) + integer, intent(in) :: p + integer, parameter :: lkind = TEST_FMS_KIND_ !< Real precision of the test + real(lkind) :: expected_result !< Expected result from data_override + type(time_type) :: Time !< Time + real(lkind), allocatable, dimension(:,:) :: runoff !< Data to be written + type(permutable_indices_2d) :: ind !< Dimension boundaries + logical :: sucessful !< .True. if the data_override was sucessful + + ind%lb = [is, js] + ind%ub = [ie, je] + call ind%permute(p) + + allocate(runoff(ind%lb(1):ind%ub(1), ind%lb(2):ind%ub(2))) + + !< Run it when time=3, this is going to use the previous file and the current file + Time = set_date(1,1,4,0,0,0) + runoff = 999._lkind + call data_override('OCN','runoff',runoff, Time, override=sucessful) + if (.not. sucessful) call mpp_error(FATAL, "The data was not overridden correctly") + expected_result = 3._lkind + call COMPARE_DATA_ (Domain, runoff, expected_result, p) + + !< Run it when time=4, this is going to use the current file + Time = set_date(1,1,5,0,0,0) + runoff = 999._lkind + call data_override('OCN','runoff',runoff, Time, override=sucessful) + if (.not. sucessful) call mpp_error(FATAL, "The data was not overridden correctly") + expected_result = 4._lkind + call COMPARE_DATA_ (Domain, runoff, expected_result, p) + + !< Run it when time=5, this is going to use the current file and the next file + Time = set_date(1,1,6,0,0,0) + runoff = 999._lkind + call data_override('OCN','runoff',runoff, Time, override=sucessful) + if (.not. sucessful) call mpp_error(FATAL, "The data was not overridden correctly") + expected_result = 5._lkind + call COMPARE_DATA_ (Domain, runoff, expected_result, p) +end subroutine MULTI_FILE_TESTS_ diff --git a/test_fms/data_override/include/test_data_override_ongrid_r4.fh b/test_fms/data_override/include/test_data_override_ongrid_r4.fh index 99613c6a87..5de99b1674 100644 --- a/test_fms/data_override/include/test_data_override_ongrid_r4.fh +++ b/test_fms/data_override/include/test_data_override_ongrid_r4.fh @@ -1,36 +1,37 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** -#undef DO_TEST_KIND_ +#undef TEST_FMS_KIND_ #undef COMPARE_DATA_ #undef ONGRID_TEST_ #undef BILINEAR_TEST_ #undef WEIGHT_FILE_TEST_ #undef SCALAR_TEST_ #undef ENSEMBLE_TEST_ +#undef MULTI_FILE_TESTS_ -#define DO_TEST_KIND_ r4_kind +#define TEST_FMS_KIND_ r4_kind #define COMPARE_DATA_ compare_data_r4 #define ONGRID_TEST_ ongrid_test_r4 #define BILINEAR_TEST_ bilinear_test_r4 #define WEIGHT_FILE_TEST_ weight_file_test_r4 #define SCALAR_TEST_ scalar_test_r4 #define ENSEMBLE_TEST_ ensemble_test_r4 +#define MULTI_FILE_TESTS_ multi_file_r4 #include "test_data_override_ongrid.inc" diff --git a/test_fms/data_override/include/test_data_override_ongrid_r8.fh b/test_fms/data_override/include/test_data_override_ongrid_r8.fh index 1b07b482a2..65103dca59 100644 --- a/test_fms/data_override/include/test_data_override_ongrid_r8.fh +++ b/test_fms/data_override/include/test_data_override_ongrid_r8.fh @@ -1,36 +1,37 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** -#undef DO_TEST_KIND_ +#undef TEST_FMS_KIND_ #undef COMPARE_DATA_ #undef ONGRID_TEST_ #undef BILINEAR_TEST_ #undef WEIGHT_FILE_TEST_ #undef SCALAR_TEST_ #undef ENSEMBLE_TEST_ +#undef MULTI_FILE_TESTS_ -#define DO_TEST_KIND_ r8_kind +#define TEST_FMS_KIND_ r8_kind #define COMPARE_DATA_ compare_data_r8 #define ONGRID_TEST_ ongrid_test_r8 #define BILINEAR_TEST_ bilinear_test_r8 #define WEIGHT_FILE_TEST_ weight_file_test_r8 #define SCALAR_TEST_ scalar_test_r8 #define ENSEMBLE_TEST_ ensemble_test_r8 +#define MULTI_FILE_TESTS_ multi_file_r8 #include "test_data_override_ongrid.inc" diff --git a/test_fms/data_override/test_data_override.F90 b/test_fms/data_override/test_data_override.F90 index d3012ac4c7..7220955758 100644 --- a/test_fms/data_override/test_data_override.F90 +++ b/test_fms/data_override/test_data_override.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** ! The diag_table needed for the test is included below. @@ -92,7 +91,7 @@ program test implicit none - integer, parameter :: lkind = DO_TEST_KIND_ + integer, parameter :: lkind = TEST_FMS_KIND_ integer :: stdoutunit integer :: num_threads = 1 integer :: isw, iew, jsw, jew diff --git a/test_fms/data_override/test_data_override2.sh b/test_fms/data_override/test_data_override2.sh index 48940debf7..9b5e702db9 100755 --- a/test_fms/data_override/test_data_override2.sh +++ b/test_fms/data_override/test_data_override2.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # # Copyright (c) 2019-2021 Ed Hartnett, Uriel Ramirez, Seth Underwood diff --git a/test_fms/data_override/test_data_override2_mono.sh b/test_fms/data_override/test_data_override2_mono.sh index 4e12f171e8..b42f409425 100755 --- a/test_fms/data_override/test_data_override2_mono.sh +++ b/test_fms/data_override/test_data_override2_mono.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # # Copyright (c) 2019-2021 Ed Hartnett, Uriel Ramirez, Seth Underwood @@ -24,6 +23,9 @@ # Set common test settings. . ../test-lib.sh +# TODO: Enable this test once generalized indices work is complete +SKIP_TESTS="test_data_override2_mono.2" + output_dir [ ! -d "INPUT" ] && mkdir -p "INPUT" @@ -84,6 +86,9 @@ _EOF #Repeat the test with yaml if needed if [ -z $parser_skip ]; then + # TODO: Enable this test once generalized indices work is complete + SKIP_TESTS="$SKIP_TESTS test_data_override2_mono.4" + rm -rf INPUT/* sed 's/write_only = .False./write_only = .True./g' input_base.nml > input.nml test_expect_success "Creating input files" ' diff --git a/test_fms/data_override/test_data_override2_ongrid.sh b/test_fms/data_override/test_data_override2_ongrid.sh index 7c6fc35cc2..7e3d8d305c 100755 --- a/test_fms/data_override/test_data_override2_ongrid.sh +++ b/test_fms/data_override/test_data_override2_ongrid.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # # Copyright (c) 2019-2021 Ed Hartnett, Uriel Ramirez, Seth Underwood @@ -24,6 +23,12 @@ # Set common test settings. . ../test-lib.sh +# TODO: Enable these tests once generalized indices work is complete +SKIP_TESTS="test_data_override2_ongrid.2 \ + test_data_override2_ongrid.3 \ + test_data_override2_ongrid.4 \ + test_data_override2_ongrid.5" + output_dir rm -rf data_table data_table.yaml input.nml input_base.nml diff --git a/test_fms/data_override/test_data_override2_scalar.sh b/test_fms/data_override/test_data_override2_scalar.sh index cbb8ed7adb..f9047e0539 100755 --- a/test_fms/data_override/test_data_override2_scalar.sh +++ b/test_fms/data_override/test_data_override2_scalar.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # # Copyright (c) 2019-2021 Ed Hartnett, Uriel Ramirez, Seth Underwood diff --git a/test_fms/data_override/test_data_override_ensembles.sh b/test_fms/data_override/test_data_override_ensembles.sh index bdde312943..596dd948a1 100755 --- a/test_fms/data_override/test_data_override_ensembles.sh +++ b/test_fms/data_override/test_data_override_ensembles.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # # Copyright (c) 2019-2021 Ed Hartnett, Uriel Ramirez, Seth Underwood @@ -66,6 +65,11 @@ _EOF #The test only runs with yaml if [ -z $parser_skip ]; then + # TODO: Enable these tests once generalized indices work is complete + SKIP_TESTS="test_data_override_ensembles.2 \ + test_data_override_ensembles.3 \ + test_data_override_ensembles.4" + rm -rf INPUT/. sed 's/write_only = .False./write_only = .True./g' input_base.nml > input.nml diff --git a/test_fms/data_override/test_data_override_init.F90 b/test_fms/data_override/test_data_override_init.F90 index dceec5aca3..a205e7f181 100644 --- a/test_fms/data_override/test_data_override_init.F90 +++ b/test_fms/data_override/test_data_override_init.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** program test_data_override_init diff --git a/test_fms/data_override/test_data_override_init.sh b/test_fms/data_override/test_data_override_init.sh index 8598cb3039..12a3eed072 100755 --- a/test_fms/data_override/test_data_override_init.sh +++ b/test_fms/data_override/test_data_override_init.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # # Copyright (c) 2019-2021 Ed Hartnett, Uriel Ramirez, Seth Underwood diff --git a/test_fms/data_override/test_data_override_multi_file.sh b/test_fms/data_override/test_data_override_multi_file.sh new file mode 100755 index 0000000000..64641ff858 --- /dev/null +++ b/test_fms/data_override/test_data_override_multi_file.sh @@ -0,0 +1,78 @@ +#!/bin/sh + +#*********************************************************************** +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. +#*********************************************************************** +# +# Copyright (c) 2019-2021 Ed Hartnett, Uriel Ramirez, Seth Underwood + +# Set common test settings. +. ../test-lib.sh + +# TODO: Enable this test once generalized indices work is complete +SKIP_TESTS="test_data_override_multi_file.2" + +output_dir +rm -rf data_table data_table.yaml input.nml input_base.nml + +if [ -z $parser_skip ]; then + +cat <<_EOF > input_base.nml +&data_override_nml +use_data_table_yaml=.True. +/ +&test_data_override_ongrid_nml + test_case = 7 + nlon = 5 + nlat = 6 + layout = 1, 2 + write_only = .False. +/ +_EOF + +cat <<_EOF > data_table.yaml +data_table: + - grid_name : OCN + fieldname_in_model : runoff + override_file: + - file_name : INPUT/hadisst_ice.data_yr1.nc + fieldname_in_file : runoff + interp_method : none + multi_file: + - next_file_name: INPUT/hadisst_ice.data_yr2.nc + prev_file_name: INPUT/hadisst_ice.data_yr0.nc + factor : 1 +_EOF + +[ ! -d "INPUT" ] && mkdir -p "INPUT" +rm -rf INPUT/* + +sed 's/write_only = .False./write_only = .True./g' input_base.nml > input.nml +test_expect_success "Creating input files" ' + mpirun -n 2 ../test_data_override_ongrid +' + +cp input_base.nml input.nml +test_expect_success "data_override multi_file" ' + mpirun -n 2 ../test_data_override_ongrid +' + +rm -rf INPUT *.nc # remove any leftover files to reduce size + +fi + +test_done diff --git a/test_fms/data_override/test_data_override_ongrid.F90 b/test_fms/data_override/test_data_override_ongrid.F90 index 6c54243be1..e249625827 100644 --- a/test_fms/data_override/test_data_override_ongrid.F90 +++ b/test_fms/data_override/test_data_override_ongrid.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** program test_data_override_ongrid @@ -36,6 +35,7 @@ program test_data_override_ongrid nf90_double, nf90_unlimited use ensemble_manager_mod, only: get_ensemble_size, ensemble_manager_init use fms_mod, only: string, fms_init, fms_end +use fms_test_mod, only: permutable_indices_2d, factorial, permute_arr implicit none @@ -55,6 +55,7 @@ program test_data_override_ongrid integer, parameter :: weight_file = 4 integer, parameter :: ensemble_case = 5 integer, parameter :: ensemble_same_yaml = 6 +integer, parameter :: multi_file = 7 integer :: test_case = ongrid logical :: init_with_mode = .false. integer :: npes @@ -112,6 +113,8 @@ program test_data_override_ongrid call generate_weight_input_file () case (ensemble_case, ensemble_same_yaml) call generate_ensemble_input_file() + case (multi_file) + call generate_multi_file_input_file() end select call mpp_sync() @@ -135,21 +138,24 @@ program test_data_override_ongrid select case (test_case) case (ongrid) - call ongrid_test_r4 - call ongrid_test_r8 + call run_tests(ongrid_test_r4, 2) + call run_tests(ongrid_test_r8, 2) case (bilinear) - call bilinear_test_r4 - call bilinear_test_r8 + call run_tests(bilinear_test_r4, 2) + call run_tests(bilinear_test_r8, 2) case (scalar) call scalar_test_r4 call scalar_test_r8 case (weight_file) - call weight_file_test_r4 - call weight_file_test_r8 + call run_tests(weight_file_test_r4, 2) + call run_tests(weight_file_test_r8, 2) case (ensemble_case, ensemble_same_yaml) - call ensemble_test_r4 - call ensemble_test_r8 + call run_tests(ensemble_test_r4, 2) + call run_tests(ensemble_test_r8, 2) call mpp_set_current_pelist(pelist) + case (multi_file) + call run_tests(multi_file_r4, 2) + call run_tests(multi_file_r8, 2) end select endif @@ -157,6 +163,22 @@ program test_data_override_ongrid contains +subroutine run_tests(test, ndims) + interface + subroutine test_permuted_indices(f) + integer, intent(in) :: f + end subroutine test_permuted_indices + end interface + + procedure(test_permuted_indices) :: test + integer, intent(in) :: ndims + integer :: p + + do p=1,factorial(ndims) + call test(p) + enddo +end subroutine run_tests + subroutine create_grid_spec_file type(FmsNetcdfFile_t) :: fileobj @@ -288,6 +310,63 @@ subroutine create_ongrid_data_file(is_ensemble) deallocate(runoff_in) end subroutine create_ongrid_data_file +subroutine create_multi_file_data_file + type(FmsNetcdfFile_t) :: fileobj + character(len=10) :: dimnames(3) + real(r4_kind), allocatable, dimension(:,:,:) :: runoff_in + real(r4_kind), allocatable, dimension(:) :: time_data + integer :: i + + integer, parameter :: ntimes = 9 + integer, parameter :: nfiles = 3 + integer :: starting + integer :: ending + + allocate(runoff_in(nlon, nlat, ntimes)) + allocate(time_data(ntimes)) + + time_data = (/1_r4_kind, 2_r4_kind, 3_r4_kind, & + 4_r4_kind, 5_r4_kind, 6_r4_kind, & + 7_r4_kind, 7_r4_kind, 9_r4_kind /) + + do i = 1, ntimes + runoff_in(:,:,i) = real(i, r4_kind) + enddo + + dimnames(1) = 'i' + dimnames(2) = 'j' + dimnames(3) = 'time' + + do i = 1, nfiles + if (open_file(fileobj, "INPUT/hadisst_ice.data_yr"//string(i-1)//".nc", "overwrite")) then + call register_axis(fileobj, "i", nlon) + call register_axis(fileobj, "j", nlat) + call register_axis(fileobj, "time", unlimited) + + call register_field(fileobj, "i", "float", (/"i"/)) + call register_variable_attribute(fileobj, "i", "cartesian_axis", "x", str_len=1) + + call register_field(fileobj, "j", "float", (/"j"/)) + call register_variable_attribute(fileobj, "j", "cartesian_axis", "y", str_len=1) + + call register_field(fileobj, "time", "float", (/"time"/)) + call register_variable_attribute(fileobj, "time", "cartesian_axis", "T", str_len=1) + call register_variable_attribute(fileobj, "time", "calendar", "noleap", str_len=6) + call register_variable_attribute(fileobj, "time", "units", "days since 0001-01-01 00:00:00", str_len=30) + + call register_field(fileobj, "runoff", "float", dimnames) + + starting = 2 * (i - 1) + 1 + ending = starting + 1 + + call write_data(fileobj, "runoff", runoff_in(:,:, starting:ending)) + call write_data(fileobj, "time", time_data(starting:ending)) + call close_file(fileobj) + endif + enddo + +end subroutine create_multi_file_data_file + subroutine generate_ongrid_input_file !< Create some files needed by data_override! if (mpp_pe() .eq. mpp_root_pe()) then @@ -299,6 +378,17 @@ subroutine generate_ongrid_input_file call mpp_sync() end subroutine generate_ongrid_input_file +subroutine generate_multi_file_input_file + if (mpp_pe() .eq. mpp_root_pe()) then + call create_grid_spec_file() + call create_ocean_mosaic_file() + call create_ocean_hgrid_file() + call create_multi_file_data_file() + endif + + call mpp_sync() +end subroutine generate_multi_file_input_file + !> @brief Creates an input netcdf data file to use for the ongrid data_override test case !! with either an increasing or decreasing lat, lon grid subroutine create_bilinear_data_file(increasing_grid) diff --git a/test_fms/data_override/test_data_override_weights.sh b/test_fms/data_override/test_data_override_weights.sh index 6cba8c0cc0..666c0a67e1 100755 --- a/test_fms/data_override/test_data_override_weights.sh +++ b/test_fms/data_override/test_data_override_weights.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # # Copyright (c) 2019-2021 Ed Hartnett, Uriel Ramirez, Seth Underwood @@ -24,6 +23,9 @@ # Set common test settings. . ../test-lib.sh +# TODO: Enable this test once generalized indices work is complete +SKIP_TESTS="test_data_override_weights.2" + output_dir [ ! -d "INPUT" ] && mkdir -p "INPUT" diff --git a/test_fms/data_override/test_get_grid_v1.F90 b/test_fms/data_override/test_get_grid_v1.F90 index f199bacf21..e152136a70 100644 --- a/test_fms/data_override/test_get_grid_v1.F90 +++ b/test_fms/data_override/test_get_grid_v1.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief This programs tests calls to get_grid_version_1 used by data_override @@ -35,7 +34,7 @@ program test_get_grid_v1 implicit none -integer, parameter :: lkind = DO_TEST_KIND_ !< r4_kind or r8_kind +integer, parameter :: lkind = TEST_FMS_KIND_ !< r4_kind or r8_kind type(domain2d) :: Domain !< 2D domain integer :: nlon, nlat !< Number of lat, lon in grid real(lkind) :: min_lon, max_lon !< Maximum lat and lon diff --git a/test_fms/diag_integral/Makefile.am b/test_fms/diag_integral/Makefile.am index f93787f492..caaf4b3703 100644 --- a/test_fms/diag_integral/Makefile.am +++ b/test_fms/diag_integral/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the test_fms/diag_integral directory of the FMS @@ -33,8 +32,8 @@ check_PROGRAMS = test_diag_integral_r4 test_diag_integral_r8 test_diag_integral_r4_SOURCES = test_diag_integral.F90 test_diag_integral_r8_SOURCES = test_diag_integral.F90 -test_diag_integral_r4_CPPFLAGS=-DTEST_DI_KIND_=4 -I$(MODDIR) -test_diag_integral_r8_CPPFLAGS=-DTEST_DI_KIND_=8 -I$(MODDIR) +test_diag_integral_r4_CPPFLAGS=-DTEST_FMS_KIND_=4 -I$(MODDIR) +test_diag_integral_r8_CPPFLAGS=-DTEST_FMS_KIND_=8 -I$(MODDIR) TEST_EXTENSIONS = .sh SH_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(abs_top_srcdir)/test_fms/tap-driver.sh diff --git a/test_fms/diag_integral/test_diag_integral.F90 b/test_fms/diag_integral/test_diag_integral.F90 index e8b25413c6..6667b31f6d 100644 --- a/test_fms/diag_integral/test_diag_integral.F90 +++ b/test_fms/diag_integral/test_diag_integral.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !! @brief unit tests forr diag_integral_mod @@ -51,11 +50,11 @@ program test_diag_integral character(9), parameter :: field_nameh='immadeuph' !> made up field name to test character(8), parameter :: std_digits = 'e23.15e3' !> write out precision for r8_kind data - real(TEST_DI_KIND_) :: immadeup2(nxy,nxy) !> array to test sum_field_2d - real(TEST_DI_KIND_) :: immadeup3(nxy,nxy,nxy) !> array to test sum_field_3d - real(TEST_DI_KIND_) :: immadeupw(nxy,nxy,nxy) !> array to test sum_field_wght_3d - real(TEST_DI_KIND_) :: weight(nxy,nxy,nxy) !> weights required to test sum_field_wght_3d - real(TEST_DI_KIND_) :: immadeuph(nxy,nxy) !> array to test sum_field_2d_hemi + real(TEST_FMS_KIND_) :: immadeup2(nxy,nxy) !> array to test sum_field_2d + real(TEST_FMS_KIND_) :: immadeup3(nxy,nxy,nxy) !> array to test sum_field_3d + real(TEST_FMS_KIND_) :: immadeupw(nxy,nxy,nxy) !> array to test sum_field_wght_3d + real(TEST_FMS_KIND_) :: weight(nxy,nxy,nxy) !> weights required to test sum_field_wght_3d + real(TEST_FMS_KIND_) :: immadeuph(nxy,nxy) !> array to test sum_field_2d_hemi real(r8_kind) :: lat(nxyp,nxyp), lon(nxyp,nxyp) real(r8_kind) :: area(nxy,nxy) @@ -71,7 +70,7 @@ program test_diag_integral real(r8_kind) :: field_avgw !> result from sum_field_avgw real(r8_kind) :: field_avgh !> result from field_avgh - integer, parameter :: lkind=TEST_DI_KIND_ !> local version of TEST_DI_KIND_ + integer, parameter :: lkind=TEST_FMS_KIND_ !> local version of TEST_FMS_KIND_ call fms_init call initialize_arrays @@ -80,6 +79,7 @@ program test_diag_integral !> Made up time. Set the initial time. Time=set_time(0,1,0) + Time_init = set_time(0,0,0) call test_diag_integral_init !< Test that diag_integral_init call works call test_diag_integral_field_init !< Register the fields diff --git a/test_fms/diag_integral/test_diag_integral2.sh b/test_fms/diag_integral/test_diag_integral2.sh index 53df2327fc..b0a34d02a6 100755 --- a/test_fms/diag_integral/test_diag_integral2.sh +++ b/test_fms/diag_integral/test_diag_integral2.sh @@ -1,13 +1,19 @@ -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#*********************************************************************** +#* Apache License 2.0 #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/diag_manager/Makefile.am b/test_fms/diag_manager/Makefile.am index b2b42764ce..c3b8d7d944 100644 --- a/test_fms/diag_manager/Makefile.am +++ b/test_fms/diag_manager/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the test_fms/diag_manager directory of the FMS @@ -34,8 +33,8 @@ check_PROGRAMS = test_diag_manager test_diag_manager_time \ check_time_min check_time_max check_time_sum check_time_avg test_diag_diurnal check_time_diurnal \ check_time_pow check_time_rms check_subregional test_cell_measures test_var_masks \ check_var_masks test_multiple_send_data test_diag_out_yaml test_output_every_freq \ - test_dm_weights test_prepend_date test_ens_runs test_multi_file test_diag_attribute_add \ - check_new_file_freq + test_dm_weights test_prepend_date test_ens_runs test_diag_multi_file test_diag_attribute_add \ + check_new_file_freq test_zbounds_limits test_multiple_zbounds # This is the source code for the test. test_output_every_freq_SOURCES = test_output_every_freq.F90 @@ -66,10 +65,12 @@ test_var_masks_SOURCES = test_var_masks.F90 check_var_masks_SOURCES = check_var_masks.F90 test_multiple_send_data_SOURCES = test_multiple_send_data.F90 test_prepend_date_SOURCES = test_prepend_date.F90 -test_multi_file_SOURCES = test_multi_file.F90 +test_diag_multi_file_SOURCES = test_diag_multi_file.F90 test_ens_runs_SOURCES = test_ens_runs.F90 test_diag_attribute_add_SOURCES = test_diag_attribute_add.F90 check_new_file_freq_SOURCES = check_new_file_freq.F90 +test_zbounds_limits_SOURCES = test_zbounds_limits.F90 +test_multiple_zbounds_SOURCES = test_multiple_zbounds.F90 TEST_EXTENSIONS = .sh SH_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ @@ -79,8 +80,8 @@ SH_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ TESTS = test_diag_manager2.sh test_time_none.sh test_time_min.sh test_time_max.sh test_time_sum.sh \ test_time_avg.sh test_time_pow.sh test_time_rms.sh test_time_diurnal.sh test_cell_measures.sh \ test_subregional.sh test_var_masks.sh test_multiple_send_data.sh test_output_every_freq.sh \ - test_dm_weights.sh test_flush_nc_file.sh test_prepend_date.sh test_ens_runs.sh test_multi_file.sh \ - test_diag_attribute_add.sh + test_dm_weights.sh test_flush_nc_file.sh test_prepend_date.sh test_ens_runs.sh test_diag_multi_file.sh \ + test_diag_attribute_add.sh test_time_none_netcdf4.sh test_zbounds_limits.sh test_multiple_zbounds.sh testing_utils.mod: testing_utils.$(OBJEXT) @@ -89,15 +90,27 @@ EXTRA_DIST = test_diag_manager2.sh check_crashes.sh test_time_none.sh test_time_ test_time_sum.sh test_time_avg.sh test_time_pow.sh test_time_rms.sh test_time_diurnal.sh \ test_cell_measures.sh test_subregional.sh test_var_masks.sh test_multiple_send_data.sh \ test_flush_nc_file.sh test_dm_weights.sh test_output_every_freq.sh test_prepend_date.sh \ - test_ens_runs.sh test_multi_file.sh test_diag_attribute_add.sh + test_ens_runs.sh test_diag_multi_file.sh test_diag_attribute_add.sh test_time_none_netcdf4.sh \ + test_zbounds_limits.sh test_multiple_zbounds.sh if USING_YAML -skipflag="" + parser_skip="" else -skipflag="skip" + parser_skip="skip" endif -TESTS_ENVIRONMENT = skipflag=${skipflag} +if SKIP_NCDUMP_CHECKS + ncdump_skip="skip" +else + ncdump_skip="" +endif + +if SKIP_PARALLEL_TEST + parallel_skip="skip" +else + parallel_skip="" +endif +TESTS_ENVIRONMENT = ncdump_skip=${ncdump_skip} parallel_skip=${parallel_skip} parser_skip=${parser_skip} CLEANFILES = *.yaml input.nml *.nc *.out diag_table* *-files/* *.dpi *.spi *.dyn *.spl *.mod diff --git a/test_fms/diag_manager/check_crashes.sh b/test_fms/diag_manager/check_crashes.sh index 0a9a7cfeca..027cd9699d 100755 --- a/test_fms/diag_manager/check_crashes.sh +++ b/test_fms/diag_manager/check_crashes.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/diag_manager/check_new_file_freq.F90 b/test_fms/diag_manager/check_new_file_freq.F90 index 11f8c671be..c8ee04c404 100644 --- a/test_fms/diag_manager/check_new_file_freq.F90 +++ b/test_fms/diag_manager/check_new_file_freq.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief General program to check the output corner cases with the new_file_freq keys diff --git a/test_fms/diag_manager/check_subregional.F90 b/test_fms/diag_manager/check_subregional.F90 index 0c3eec80ca..3fe18cb69d 100644 --- a/test_fms/diag_manager/check_subregional.F90 +++ b/test_fms/diag_manager/check_subregional.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief Checks the output file after running test_subregional diff --git a/test_fms/diag_manager/check_time_avg.F90 b/test_fms/diag_manager/check_time_avg.F90 index e729619f77..5e5a804a44 100644 --- a/test_fms/diag_manager/check_time_avg.F90 +++ b/test_fms/diag_manager/check_time_avg.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief Checks the output file after running test_reduction_methods using the "time_avg" reduction method diff --git a/test_fms/diag_manager/check_time_diurnal.F90 b/test_fms/diag_manager/check_time_diurnal.F90 index 3302da0ff4..33eb2a588a 100644 --- a/test_fms/diag_manager/check_time_diurnal.F90 +++ b/test_fms/diag_manager/check_time_diurnal.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !! TODO more complicated cases and data !> @brief Checks the output file after running test_reduction_methods using the "time_diurnal" reduction method diff --git a/test_fms/diag_manager/check_time_max.F90 b/test_fms/diag_manager/check_time_max.F90 index fd835ce4a3..66a56dcfc9 100644 --- a/test_fms/diag_manager/check_time_max.F90 +++ b/test_fms/diag_manager/check_time_max.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief Checks the output file after running test_reduction_methods using the "max" reduction method diff --git a/test_fms/diag_manager/check_time_min.F90 b/test_fms/diag_manager/check_time_min.F90 index da2440a638..00be253f1f 100644 --- a/test_fms/diag_manager/check_time_min.F90 +++ b/test_fms/diag_manager/check_time_min.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief Checks the output file after running test_reduction_methods using the "min" reduction method diff --git a/test_fms/diag_manager/check_time_none.F90 b/test_fms/diag_manager/check_time_none.F90 index 3925aeaad8..ab5e089481 100644 --- a/test_fms/diag_manager/check_time_none.F90 +++ b/test_fms/diag_manager/check_time_none.F90 @@ -1,26 +1,26 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief Checks the output file after running test_reduction_methods using the "none" reduction method program check_time_none use fms_mod, only: fms_init, fms_end, string - use fms2_io_mod, only: FmsNetcdfFile_t, read_data, close_file, open_file, get_dimension_size + use fms2_io_mod, only: FmsNetcdfFile_t, read_data, close_file, open_file, get_dimension_size, & + get_global_attribute use mpp_mod, only: mpp_npes, mpp_error, FATAL, mpp_pe, input_nml_file use platform_mod, only: r4_kind, r8_kind use testing_utils, only: allocate_buffer, test_normal, test_openmp, test_halos, no_mask, logical_mask, real_mask @@ -62,12 +62,15 @@ program check_time_none if (.not. open_file(fileobj, "test_none.nc", "read")) & call mpp_error(FATAL, "unable to open test_none.nc") + call check_global_attribute(fileobj) if (.not. open_file(fileobj1, "test_none_regional.nc.0004", "read")) & call mpp_error(FATAL, "unable to open test_none_regional.nc.0004") + call check_global_attribute(fileobj) if (.not. open_file(fileobj2, "test_none_regional.nc.0005", "read")) & call mpp_error(FATAL, "unable to open test_none_regional.nc.0005") + call check_global_attribute(fileobj) print *, "Checking the dimensions of the subaxis" ! This is only done for the "none" reduction because the logic that determines the subaxis @@ -232,4 +235,19 @@ subroutine check_data_3d(buffer, time_level, is_regional, nx_offset, ny_offset, enddo enddo end subroutine check_data_3d + + !< @brief Check if the global attribute is the expected value + subroutine check_global_attribute(fileobj) + type(FmsNetcdfFile_t), intent(in) :: fileobj + + character(len=100) :: attribute_value + character(len=100) :: EXPECTED_ATTRIBUTE_VALUE + + EXPECTED_ATTRIBUTE_VALUE = "test_none" + call get_global_attribute(fileobj, "title", attribute_value) + if (trim(attribute_value) .ne. trim(EXPECTED_ATTRIBUTE_VALUE)) then + call mpp_error(FATAL, "The global attribute 'title' is not present in the file.") + endif + end subroutine + end program diff --git a/test_fms/diag_manager/check_time_pow.F90 b/test_fms/diag_manager/check_time_pow.F90 index 8c0f3d420a..e803a0a303 100644 --- a/test_fms/diag_manager/check_time_pow.F90 +++ b/test_fms/diag_manager/check_time_pow.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief Checks the output file after running test_reduction_methods using the "time_pow" reduction method diff --git a/test_fms/diag_manager/check_time_rms.F90 b/test_fms/diag_manager/check_time_rms.F90 index 5ac59845a0..bbb6114818 100644 --- a/test_fms/diag_manager/check_time_rms.F90 +++ b/test_fms/diag_manager/check_time_rms.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief Checks the output file after running test_reduction_methods using the "rms" reduction method diff --git a/test_fms/diag_manager/check_time_sum.F90 b/test_fms/diag_manager/check_time_sum.F90 index 463e1cea5f..a194ac448b 100644 --- a/test_fms/diag_manager/check_time_sum.F90 +++ b/test_fms/diag_manager/check_time_sum.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief Checks the output file after running test_reduction_methods using the "time_sum" reduction method diff --git a/test_fms/diag_manager/check_var_masks.F90 b/test_fms/diag_manager/check_var_masks.F90 index b9cfe99a09..5c7bc3341f 100644 --- a/test_fms/diag_manager/check_var_masks.F90 +++ b/test_fms/diag_manager/check_var_masks.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief Checks the output for when running with a field that has a mask that changes diff --git a/test_fms/diag_manager/test_cell_measures.F90 b/test_fms/diag_manager/test_cell_measures.F90 index c7b9b194fe..f236546453 100644 --- a/test_fms/diag_manager/test_cell_measures.F90 +++ b/test_fms/diag_manager/test_cell_measures.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief This program tests the diag_manager with fields with cell measures (area, volume) @@ -101,5 +100,16 @@ subroutine check_output() if (trim(buffer) .ne. "area: area") & call mpp_error(FATAL, "The cell_measures attribute is not the expected result! "//trim(buffer)) call close_file(fileobj) + + ! Check that file1.nc exists, that the var1 exists and it contains the cell_measures attributes + ! Here area is in the file, but the output name is area_file2 instead of area + if (.not. open_file(fileobj, "file2.nc", "read")) & + call mpp_error(FATAL, "file1.nc was not created by the diag manager!") + call get_variable_attribute(fileobj, "var1", "cell_measures", buffer) + if (trim(buffer) .ne. "area: area_file2") & + call mpp_error(FATAL, "The cell_measures attribute is not the expected result! ("//trim(buffer)//") vs "//& + "(area: area_file2)") + call close_file(fileobj) + call close_file(fileobj) end subroutine check_output end program diff --git a/test_fms/diag_manager/test_cell_measures.sh b/test_fms/diag_manager/test_cell_measures.sh index c97216fdb4..877d494c37 100755 --- a/test_fms/diag_manager/test_cell_measures.sh +++ b/test_fms/diag_manager/test_cell_measures.sh @@ -1,28 +1,27 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # Set common test settings. . ../test-lib.sh -if [ -z "${skipflag}" ]; then +if [ -z "${parser_skip}" ]; then # create and enter directory for in/output files output_dir @@ -31,15 +30,6 @@ title: test_diag_manager base_date: 2 1 1 0 0 0 diag_files: -- file_name: static_file - freq: -1 - time_units: hours - unlimdim: time - varlist: - - module: fun_mod - var_name: area - reduction: none - kind: r4 # Here file 1 does not have the "area" variable so the associated files attribute is expected - file_name: file1 freq: 6 hours @@ -50,6 +40,26 @@ diag_files: var_name: var1 reduction: average kind: r4 +- file_name: file2 + freq: 1 hours + time_units: hours + unlimdim: time + module: fun_mod + reduction: none + kind: r4 + varlist: + - var_name: var1 + - var_name: area + output_name: area_file2 +- file_name: static_file + freq: -1 + time_units: hours + unlimdim: time + varlist: + - module: fun_mod + var_name: area + reduction: none + kind: r4 _EOF # remove any existing files that would result in false passes during checks diff --git a/test_fms/diag_manager/test_diag_attribute_add.F90 b/test_fms/diag_manager/test_diag_attribute_add.F90 index e7a756b47d..47c84d9e2d 100644 --- a/test_fms/diag_manager/test_diag_attribute_add.F90 +++ b/test_fms/diag_manager/test_diag_attribute_add.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** program test_diag_attribute_add diff --git a/test_fms/diag_manager/test_diag_attribute_add.sh b/test_fms/diag_manager/test_diag_attribute_add.sh index f7f9caf922..455f3714b3 100755 --- a/test_fms/diag_manager/test_diag_attribute_add.sh +++ b/test_fms/diag_manager/test_diag_attribute_add.sh @@ -1,28 +1,27 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # Set common test settings. . ../test-lib.sh -if [ -z "${skipflag}" ]; then +if [ -z "${parser_skip}" ]; then # create and enter directory for in/output files output_dir diff --git a/test_fms/diag_manager/test_diag_buffer.F90 b/test_fms/diag_manager/test_diag_buffer.F90 index 33bcbffcd1..ebde7c2842 100644 --- a/test_fms/diag_manager/test_diag_buffer.F90 +++ b/test_fms/diag_manager/test_diag_buffer.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief This program tests the output buffer functionality diff --git a/test_fms/diag_manager/test_diag_diurnal.F90 b/test_fms/diag_manager/test_diag_diurnal.F90 index 5890cff294..4b31199841 100644 --- a/test_fms/diag_manager/test_diag_diurnal.F90 +++ b/test_fms/diag_manager/test_diag_diurnal.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !! TODO send more complicated data than just the current hour diff --git a/test_fms/diag_manager/test_diag_manager.F90 b/test_fms/diag_manager/test_diag_manager.F90 index 0d2a0f5fcc..403de9b463 100644 --- a/test_fms/diag_manager/test_diag_manager.F90 +++ b/test_fms/diag_manager/test_diag_manager.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** ! This program runs only one of many possible tests with each execution. diff --git a/test_fms/diag_manager/test_diag_manager2.sh b/test_fms/diag_manager/test_diag_manager2.sh index 1fc7c40da7..0f62960a4b 100755 --- a/test_fms/diag_manager/test_diag_manager2.sh +++ b/test_fms/diag_manager/test_diag_manager2.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # Copyright (c) 2019-2020 Ed Hartnett, Seth Underwood @@ -510,7 +509,7 @@ test_expect_success "Test the diag update_buffer (test $my_test_count)" ' ## run tests that are ifdef'd out only if compiled with yaml ## otherwise just run the updated end to end to check for error -if [ -z "${skipflag}" ]; then +if [ -z "${parser_skip}" ]; then cat <<_EOF > diag_table.yaml title: test_diag_manager diff --git a/test_fms/diag_manager/test_diag_manager_time.F90 b/test_fms/diag_manager/test_diag_manager_time.F90 index aad8031686..ff36d8d803 100644 --- a/test_fms/diag_manager/test_diag_manager_time.F90 +++ b/test_fms/diag_manager/test_diag_manager_time.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief This programs tests diag_manager with the following diag_table diff --git a/test_fms/diag_manager/test_multi_file.F90 b/test_fms/diag_manager/test_diag_multi_file.F90 similarity index 93% rename from test_fms/diag_manager/test_multi_file.F90 rename to test_fms/diag_manager/test_diag_multi_file.F90 index f3461c500a..74e15813b1 100644 --- a/test_fms/diag_manager/test_multi_file.F90 +++ b/test_fms/diag_manager/test_diag_multi_file.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** program test_multi_file use fms_mod, only: fms_init, fms_end diff --git a/test_fms/diag_manager/test_multi_file.sh b/test_fms/diag_manager/test_diag_multi_file.sh similarity index 82% rename from test_fms/diag_manager/test_multi_file.sh rename to test_fms/diag_manager/test_diag_multi_file.sh index 1f23da3818..d167ae485f 100755 --- a/test_fms/diag_manager/test_multi_file.sh +++ b/test_fms/diag_manager/test_diag_multi_file.sh @@ -1,28 +1,27 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # Set common test settings. . ../test-lib.sh -if [ -z "${skipflag}" ]; then +if [ -z "${parser_skip}" ]; then # create and enter directory for in/output files output_dir @@ -51,7 +50,7 @@ rm -f *.nc my_test_count=1 printf "&diag_manager_nml \n use_modern_diag=.true. \n/" | cat > input.nml test_expect_success "Running diag_manager (test $my_test_count)" ' - mpirun -n 1 ../test_multi_file + mpirun -n 1 ../test_diag_multi_file ' ########################################################################### @@ -86,7 +85,7 @@ cat <<_EOF > input.nml / _EOF test_expect_success "Running diag_manager (test $my_test_count)" ' - mpirun -n 1 ../test_multi_file + mpirun -n 1 ../test_diag_multi_file ' ########################################################################### @@ -119,7 +118,7 @@ cat <<_EOF > input.nml / _EOF test_expect_success "Running diag_manager (test $my_test_count)" ' - mpirun -n 1 ../test_multi_file + mpirun -n 1 ../test_diag_multi_file ' ########################################################################### @@ -154,7 +153,7 @@ cat <<_EOF > input.nml / _EOF test_expect_success "Running diag_manager (test $my_test_count)" ' - mpirun -n 1 ../test_multi_file + mpirun -n 1 ../test_diag_multi_file ' fi test_done diff --git a/test_fms/diag_manager/test_diag_ocean.F90 b/test_fms/diag_manager/test_diag_ocean.F90 index 1723c3248b..b800dbd39e 100644 --- a/test_fms/diag_manager/test_diag_ocean.F90 +++ b/test_fms/diag_manager/test_diag_ocean.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief This program tests the diag_model_subset feature of diag_mananger_init diff --git a/test_fms/diag_manager/test_diag_out_yaml.F90 b/test_fms/diag_manager/test_diag_out_yaml.F90 index 9253bac9d0..1ca6212f87 100644 --- a/test_fms/diag_manager/test_diag_out_yaml.F90 +++ b/test_fms/diag_manager/test_diag_out_yaml.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @author Ryan Mulhall !> @brief Simple test program for diag manager output yaml file. diff --git a/test_fms/diag_manager/test_diag_update_buffer.F90 b/test_fms/diag_manager/test_diag_update_buffer.F90 index 7efab2d1e8..1fff3f0d7f 100644 --- a/test_fms/diag_manager/test_diag_update_buffer.F90 +++ b/test_fms/diag_manager/test_diag_update_buffer.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief This programs tests the update of field data buffers with diff --git a/test_fms/diag_manager/test_diag_yaml.F90 b/test_fms/diag_manager/test_diag_yaml.F90 index 442ddce468..e1e30ccf44 100644 --- a/test_fms/diag_manager/test_diag_yaml.F90 +++ b/test_fms/diag_manager/test_diag_yaml.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief This program tests the diag_yaml_object_init and diag_yaml_object_end subroutines diff --git a/test_fms/diag_manager/test_dm_weights.sh b/test_fms/diag_manager/test_dm_weights.sh index 0f291180ae..45fa372722 100755 --- a/test_fms/diag_manager/test_dm_weights.sh +++ b/test_fms/diag_manager/test_dm_weights.sh @@ -1,28 +1,27 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # Set common test settings. . ../test-lib.sh -if [ -z "${skipflag}" ]; then +if [ -z "${parser_skip}" ]; then # create and enter directory for in/output files output_dir diff --git a/test_fms/diag_manager/test_ens_runs.F90 b/test_fms/diag_manager/test_ens_runs.F90 index e37a2c0922..e563ef4380 100644 --- a/test_fms/diag_manager/test_ens_runs.F90 +++ b/test_fms/diag_manager/test_ens_runs.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief This programs tests diag manager when the file frequency is set to 0 days diff --git a/test_fms/diag_manager/test_ens_runs.sh b/test_fms/diag_manager/test_ens_runs.sh index f73825d5bd..da6e5e7da1 100755 --- a/test_fms/diag_manager/test_ens_runs.sh +++ b/test_fms/diag_manager/test_ens_runs.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # Copyright (c) 2019-2020 Ed Hartnett, Seth Underwood @@ -24,7 +23,7 @@ # Set common test settings. . ../test-lib.sh -if [ -z "${skipflag}" ]; then +if [ -z "${parser_skip}" ]; then # create and enter directory for in/output files output_dir diff --git a/test_fms/diag_manager/test_flexible_time.F90 b/test_fms/diag_manager/test_flexible_time.F90 index 2dd881177d..d308db8c5b 100644 --- a/test_fms/diag_manager/test_flexible_time.F90 +++ b/test_fms/diag_manager/test_flexible_time.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief This programs tests the flexible timing capability in the modern diag_manager diff --git a/test_fms/diag_manager/test_flush_nc_file.F90 b/test_fms/diag_manager/test_flush_nc_file.F90 index b0134f4a05..36157fcd48 100644 --- a/test_fms/diag_manager/test_flush_nc_file.F90 +++ b/test_fms/diag_manager/test_flush_nc_file.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief This programs tests when flush_nc_file=.true. diff --git a/test_fms/diag_manager/test_flush_nc_file.sh b/test_fms/diag_manager/test_flush_nc_file.sh index 7337bd8499..55f8df6b0a 100755 --- a/test_fms/diag_manager/test_flush_nc_file.sh +++ b/test_fms/diag_manager/test_flush_nc_file.sh @@ -1,28 +1,27 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # Set common test settings. . ../test-lib.sh -if [ -z "${skipflag}" ]; then +if [ -z "${parser_skip}" ]; then # create and enter directory for in/output files output_dir diff --git a/test_fms/diag_manager/test_modern_diag.F90 b/test_fms/diag_manager/test_modern_diag.F90 index 03923de7b4..499355b0d6 100644 --- a/test_fms/diag_manager/test_modern_diag.F90 +++ b/test_fms/diag_manager/test_modern_diag.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief This programs tests the modern diag_manager diff --git a/test_fms/diag_manager/test_multiple_send_data.F90 b/test_fms/diag_manager/test_multiple_send_data.F90 index d8df31b42f..8c2a05dabb 100644 --- a/test_fms/diag_manager/test_multiple_send_data.F90 +++ b/test_fms/diag_manager/test_multiple_send_data.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief This programs tests fields that call send_data multiple times diff --git a/test_fms/diag_manager/test_multiple_send_data.sh b/test_fms/diag_manager/test_multiple_send_data.sh index 1240e1d414..132c5ba1b0 100755 --- a/test_fms/diag_manager/test_multiple_send_data.sh +++ b/test_fms/diag_manager/test_multiple_send_data.sh @@ -1,28 +1,27 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # Set common test settings. . ../test-lib.sh -if [ -z "${skipflag}" ]; then +if [ -z "${parser_skip}" ]; then # create and enter directory for in/output files output_dir diff --git a/test_fms/diag_manager/test_multiple_zbounds.F90 b/test_fms/diag_manager/test_multiple_zbounds.F90 new file mode 100644 index 0000000000..1ccb6eaca8 --- /dev/null +++ b/test_fms/diag_manager/test_multiple_zbounds.F90 @@ -0,0 +1,130 @@ +!*********************************************************************** +!* Apache License 2.0 +!* +!* This file is part of the GFDL Flexible Modeling System (FMS). +!* +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at +!* +!* http://www.apache.org/licenses/LICENSE-2.0 +!* +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. +!*********************************************************************** + +program test_multiple_zbounds + use fms_mod, only: fms_init, fms_end + use fms2_io_mod + use mpp_mod + use time_manager_mod, only: time_type, set_calendar_type, set_date, JULIAN, set_time, OPERATOR(+) + use diag_manager_mod + + implicit none + + type(time_type) :: Time !< Time of the simulation + type(time_type) :: Time_step !< Time_step of the simulation + integer :: id_z1 !< Axis id for the z dimension + integer :: id_z2 !< Axis id for the z dimension + integer :: id_var1 !< var id for the first variable + integer :: id_var2 !< var_id for the second variable + real, allocatable :: z(:) !< z axis data + integer :: nz !< Size of the z dimension + integer :: i + logical :: used !< Dummy argument to send_data + + call fms_init + call set_calendar_type(JULIAN) + call diag_manager_init + + nz = 10 + allocate(z(nz)) + do i=1, nz + z(i) = i + enddo + + Time = set_date(2,1,1,0,0,0) + Time_step = set_time (3600,0) + + id_z1 = diag_axis_init('zaxis1', z, 'z', 'z', long_name='Z1') + id_z2 = diag_axis_init('zaxis2', z, 'z', 'z', long_name='Z2') + id_var1 = register_diag_field ('atmos', 'ua_1', (/id_z1/), Time) + id_var2 = register_diag_field ('atmos', 'ua_2', (/id_z2/), Time) + + call diag_manager_set_time_end(set_date(2,1,2,0,0,0)) + do i = 1, 24 + Time = Time + Time_step + z = real(i) + used = send_data(id_var1, z, Time) + used = send_data(id_var2, z, Time) + + call diag_send_complete(Time_step) + end do + + call diag_manager_end(Time) + + call check_output() + call fms_end + + contains + + subroutine check_output() + type(FmsNetcdfFile_t) :: fileobj + integer :: EXPECTED_NTIMES = 24 + integer :: SUB1_SIZE = 3 + integer :: SUB2_SIZE = 1 + character(len=20) :: EXPECTED_DIM_NAMES(2) + + EXPECTED_DIM_NAMES(2) = "time" + if (.not. open_file(fileobj, "test_multiple_zbounds.nc", "read")) then + call mpp_error(FATAL, "Unable to open the expected output file: test_var_masks.nc") + endif + + call check_dimension(fileobj, "time", EXPECTED_NTIMES) + call check_dimension(fileobj, "zaxis1_sub01", SUB1_SIZE) + call check_dimension(fileobj, "zaxis2_sub02", SUB2_SIZE) + + EXPECTED_DIM_NAMES(1) = "zaxis1_sub01" + call check_variable(fileobj, "ua_1", EXPECTED_DIM_NAMES) + + EXPECTED_DIM_NAMES(1) = "zaxis2_sub02" + call check_variable(fileobj, "ua_2", EXPECTED_DIM_NAMES) + call close_file(fileobj) + + end subroutine check_output + + subroutine check_variable(fileobj, variable_name, expected_dimnames) + type(FmsNetcdfFile_t), intent(in) :: fileobj + character(len=*), intent(in) :: variable_name + character(len=*), intent(in) :: expected_dimnames(:) + + character(len=20) :: dim_names(2) + integer :: i + + call get_variable_dimension_names(fileobj, variable_name, dim_names) + do i = 1, size(dim_names) + if (trim(dim_names(i)) .ne. trim(expected_dimnames(i))) then + print *, trim(dim_names(i)), " vs ", trim(expected_dimnames(i)) + call mpp_error(FATAL, "The dimension names are correct for "//trim(variable_name)) + endif + enddo + + end subroutine check_variable + + subroutine check_dimension(fileobj, dimension_name, expected_size) + type(FmsNetcdfFile_t), intent(in) :: fileobj + character(len=*), intent(in) :: dimension_name + integer, intent(in) :: expected_size + + integer :: dim_size + + call get_dimension_size(fileobj, dimension_name, dim_size) + if (dim_size .ne. expected_size) then + call mpp_error(FATAL, trim(dimension_name)//" is not the expected size!") + endif + + end subroutine +end program test_multiple_zbounds \ No newline at end of file diff --git a/test_fms/diag_manager/test_multiple_zbounds.sh b/test_fms/diag_manager/test_multiple_zbounds.sh new file mode 100755 index 0000000000..44db78c036 --- /dev/null +++ b/test_fms/diag_manager/test_multiple_zbounds.sh @@ -0,0 +1,57 @@ +#!/bin/sh + +#*********************************************************************** +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. +#*********************************************************************** + +# Set common test settings. +. ../test-lib.sh + +output_dir + +if [ -z "${parser_skip}" ] +then + cat <<_EOF > input.nml +&diag_manager_nml + use_modern_diag = .true. +/ +_EOF + + cat <<_EOF > diag_table.yaml +title: test_multiple_zbounds +base_date: 2 1 1 0 0 0 +diag_files: +- file_name: test_multiple_zbounds + freq: 1 hours + time_units: hours + unlimdim: time + module: atmos + reduction: average + kind: r4 + varlist: + - var_name: ua_1 + zbounds: 3 5 + - var_name: ua_2 + zbounds: 1 1 +_EOF + + test_expect_success "Test with multiple zbounds limits (modern diag manager)" ' + mpirun -n 1 ../test_multiple_zbounds + ' +fi + +test_done diff --git a/test_fms/diag_manager/test_output_every_freq.F90 b/test_fms/diag_manager/test_output_every_freq.F90 index c947168b13..323024ed19 100644 --- a/test_fms/diag_manager/test_output_every_freq.F90 +++ b/test_fms/diag_manager/test_output_every_freq.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief This programs tests diag manager when the file frequency is set to 0 days diff --git a/test_fms/diag_manager/test_output_every_freq.sh b/test_fms/diag_manager/test_output_every_freq.sh index 37869a7d10..93dd8cf3e1 100755 --- a/test_fms/diag_manager/test_output_every_freq.sh +++ b/test_fms/diag_manager/test_output_every_freq.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # Copyright (c) 2019-2020 Ed Hartnett, Seth Underwood @@ -24,7 +23,7 @@ # Set common test settings. . ../test-lib.sh -if [ -z "${skipflag}" ]; then +if [ -z "${parser_skip}" ]; then # create and enter directory for in/output files output_dir diff --git a/test_fms/diag_manager/test_prepend_date.F90 b/test_fms/diag_manager/test_prepend_date.F90 index 24a5ae2986..3254540ad9 100644 --- a/test_fms/diag_manager/test_prepend_date.F90 +++ b/test_fms/diag_manager/test_prepend_date.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief This programs tests diag manager when the init date is prepended to the file name diff --git a/test_fms/diag_manager/test_prepend_date.sh b/test_fms/diag_manager/test_prepend_date.sh index 13bbf7c77a..76c4f580ab 100755 --- a/test_fms/diag_manager/test_prepend_date.sh +++ b/test_fms/diag_manager/test_prepend_date.sh @@ -1,28 +1,27 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # Set common test settings. . ../test-lib.sh -if [ -z "${skipflag}" ]; then +if [ -z "${parser_skip}" ]; then # create and enter directory for in/output files output_dir diff --git a/test_fms/diag_manager/test_reduction_methods.F90 b/test_fms/diag_manager/test_reduction_methods.F90 index 7a0bb8efc6..837520bf34 100644 --- a/test_fms/diag_manager/test_reduction_methods.F90 +++ b/test_fms/diag_manager/test_reduction_methods.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief General program to test the different possible reduction methods @@ -186,7 +185,7 @@ program test_reduction_methods 'mullions', missing_value = missing_value) id_var3 = register_diag_field ('ocn_mod', 'var3', (/id_x, id_y, id_z/), Time, 'Var3d', & 'mullions', missing_value = missing_value) - id_var4 = register_diag_field ('ocn_mod', 'var4', (/id_x, id_y, id_z, id_w/), Time, 'Var4d', & + id_var4 = register_diag_field ('ocn_z_mod', 'var4', (/id_x, id_y, id_z, id_w/), Time, 'Var4d', & 'mullions', missing_value = missing_value) id_var999 = register_diag_field ('ocn_mod', 'IOnASphere', Time, missing_value=missing_value) @@ -208,13 +207,13 @@ program test_reduction_methods used = send_data(id_var2missing, cdata(:,:,1,1)*0_r8_kind + missing_value, Time) used = send_data(id_var2c, cdata_corner(:,:,1,1), Time) - used = send_data(id_var0, cdata(1,1,1,1), Time) + used = send_data(id_var0, get_scalar_data(cdata(1,1,1,1)), Time) select case(test_case) case (test_normal) select case (mask_case) case (no_mask) - used = send_data(id_var1, cdata(:,1,1,1), Time) + used = send_data(id_var1, get_1d_data(cdata(:,1,1,1)), Time) used = send_data(id_var2, cdata(:,:,1,1), Time) used = send_data(id_var3, cdata(:,:,:,1), Time) used = send_data(id_var4, cdata(:,:,:,:), Time) @@ -384,6 +383,29 @@ subroutine init_buffer(buffer, is, ie, js, je, nhalo) end subroutine init_buffer + !> @brief This is so that all ranks get and pass in the same scalar data + function get_scalar_data(data_in) & + result(rslt) + real(kind=r8_kind), intent(in) :: data_in + real(kind=r8_kind) :: rslt + + if (mpp_pe() .eq. mpp_root_pe()) rslt = data_in + + call mpp_broadcast(rslt, mpp_root_pe()) + end function + + !> @brief This is so that all ranks get and pass in the same 1d data + function get_1d_data(data_in) & + result (rslt) + real(kind=r8_kind), intent(in) :: data_in(:) + real(kind=r8_kind), allocatable :: rslt(:) + + allocate(rslt(size(data_in))) + if (mpp_pe() .eq. mpp_root_pe()) rslt = data_in + + call mpp_broadcast(rslt, size(rslt), mpp_root_pe()) + end function get_1d_data + !> @brief Set the buffer based on the time_index subroutine set_buffer(buffer, time_index) real(kind=r8_kind), intent(inout) :: buffer(:,:,:,:) !< Output buffer diff --git a/test_fms/diag_manager/test_subregional.sh b/test_fms/diag_manager/test_subregional.sh index dcb1f5e9da..f0007f30a7 100755 --- a/test_fms/diag_manager/test_subregional.sh +++ b/test_fms/diag_manager/test_subregional.sh @@ -1,28 +1,27 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # Set common test settings. . ../test-lib.sh -if [ -z "${skipflag}" ]; then +if [ -z "${parser_skip}" ]; then # create and enter directory for in/output files output_dir diff --git a/test_fms/diag_manager/test_time_avg.sh b/test_fms/diag_manager/test_time_avg.sh index e31e243fa5..f0123870b7 100755 --- a/test_fms/diag_manager/test_time_avg.sh +++ b/test_fms/diag_manager/test_time_avg.sh @@ -1,28 +1,27 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # Set common test settings. . ../test-lib.sh -if [ -z "${skipflag}" ]; then +if [ -z "${parser_skip}" ]; then # create and enter directory for in/output files output_dir @@ -55,7 +54,7 @@ diag_files: output_name: var3_avg reduction: average kind: r4 - - module: ocn_mod + - module: ocn_z_mod var_name: var4 output_name: var4_avg reduction: average diff --git a/test_fms/diag_manager/test_time_diurnal.sh b/test_fms/diag_manager/test_time_diurnal.sh index aef8a29e02..5a35da6a42 100755 --- a/test_fms/diag_manager/test_time_diurnal.sh +++ b/test_fms/diag_manager/test_time_diurnal.sh @@ -1,28 +1,27 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # tests the diurnal (daily average) reduction method # Set common test settings. . ../test-lib.sh -if [ -z "${skipflag}" ]; then +if [ -z "${parser_skip}" ]; then # create and enter directory for in/output files output_dir diff --git a/test_fms/diag_manager/test_time_max.sh b/test_fms/diag_manager/test_time_max.sh index d2a0fd7cdc..685a36ac38 100755 --- a/test_fms/diag_manager/test_time_max.sh +++ b/test_fms/diag_manager/test_time_max.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # Copyright (c) 2019-2020 Ed Hartnett, Seth Underwood @@ -24,7 +23,7 @@ # Set common test settings. . ../test-lib.sh -if [ -z "${skipflag}" ]; then +if [ -z "${parser_skip}" ]; then # create and enter directory for in/output files output_dir @@ -58,7 +57,7 @@ diag_files: output_name: var3_max reduction: max kind: r4 - - module: ocn_mod + - module: ocn_z_mod var_name: var4 output_name: var4_max reduction: max diff --git a/test_fms/diag_manager/test_time_min.sh b/test_fms/diag_manager/test_time_min.sh index f2969d47c9..2af0f1847c 100755 --- a/test_fms/diag_manager/test_time_min.sh +++ b/test_fms/diag_manager/test_time_min.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # Copyright (c) 2019-2020 Ed Hartnett, Seth Underwood @@ -24,7 +23,7 @@ # Set common test settings. . ../test-lib.sh -if [ -z "${skipflag}" ]; then +if [ -z "${parser_skip}" ]; then # create and enter directory for in/output files output_dir @@ -58,7 +57,7 @@ diag_files: output_name: var3_min reduction: min kind: r4 - - module: ocn_mod + - module: ocn_z_mod var_name: var4 output_name: var4_min reduction: min diff --git a/test_fms/diag_manager/test_time_none.sh b/test_fms/diag_manager/test_time_none.sh index 74110a0340..baa1c9954c 100755 --- a/test_fms/diag_manager/test_time_none.sh +++ b/test_fms/diag_manager/test_time_none.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # Copyright (c) 2019-2020 Ed Hartnett, Seth Underwood @@ -24,7 +23,7 @@ # Set common test settings. . ../test-lib.sh -if [ -z "${skipflag}" ]; then +if [ -z "${parser_skip}" ]; then # create and enter directory for in/output files output_dir @@ -42,6 +41,12 @@ diag_files: output_name: var0_none reduction: none kind: r4 + - module: ocn_mod + var_name: var3 + output_name: this_does_not_matter + write_var: False + reduction: none + kind: r4 - module: ocn_mod var_name: var1 output_name: var1_none @@ -57,7 +62,7 @@ diag_files: output_name: var3_none reduction: none kind: r4 - - module: ocn_mod + - module: ocn_z_mod var_name: var4 output_name: var4_none reduction: none @@ -271,5 +276,133 @@ test_expect_success "Testing diag manager new_file_freq and file_durations keys mpirun -n 1 ../check_new_file_freq ' +cat <<_EOF > diag_table.yaml +my_variables: &my_variables + - module: ocn_mod + var_name: var0 + output_name: var0_none + reduction: none + kind: r4 + - module: ocn_mod + var_name: var1 + output_name: var1_none + reduction: none + kind: r4 + - module: ocn_mod + var_name: var2 + output_name: var2_none + reduction: none + kind: r4 + - module: ocn_mod + var_name: var3 + output_name: var3_none + reduction: none + kind: r4 + - module: ocn_z_mod + var_name: var4 + output_name: var4_none + reduction: none + kind: r4 + +title: test_none +base_date: 2 1 1 0 0 0 +diag_files: +- file_name: test_none + freq: 6 hours + time_units: hours + unlimdim: time + varlist: + - *my_variables + - module: ocn_mod + var_name: var3 + output_name: var3_Z + reduction: none + zbounds: 2. 3. + kind: r4 +- file_name: test_none_regional + freq: 6 hours + time_units: hours + unlimdim: time + sub_region: + - grid_type: latlon + corner1: 78. 78. + corner2: 78. 78. + corner3: 81. 81. + corner4: 81. 81. + varlist: + - module: ocn_mod + var_name: var3 + output_name: var3_none + reduction: none + zbounds: 2. 3. + kind: r4 +_EOF + +my_test_count=`expr $my_test_count + 1` +printf "&diag_manager_nml \n use_modern_diag=.true. \n / \n&test_reduction_methods_nml \n test_case = 0 \n/" | cat > input.nml +test_expect_success "Running diag_manager with "none" reduction method using a diag table with anchors(test $my_test_count)" ' + mpirun -n 6 ../test_reduction_methods +' +test_expect_success "Checking answers for the "none" reduction method using a diag table with anchors (test $my_test_count)" ' + mpirun -n 1 ../check_time_none +' + +cat <<_EOF > diag_table.yaml +title: test_none +base_date: 2 1 1 0 0 0 +diag_files: +- file_name: test_none + freq: 6 hours + time_units: hours + unlimdim: time + reduction: none + kind: r4 + modules: + - module: ocn_mod + varlist: + - var_name: var0 + output_name: var0_none + - var_name: var3 + output_name: this_does_not_matter + write_var: False + - var_name: var1 + output_name: var1_none + - var_name: var2 + output_name: var2_none + - var_name: var3 + output_name: var3_none + - var_name: var3 + output_name: var3_Z + zbounds: 2. 3. + - module: ocn_z_mod + varlist: + - var_name: var4 + output_name: var4_none +- file_name: test_none_regional + freq: 6 hours + time_units: hours + unlimdim: time + sub_region: + - grid_type: latlon + corner1: 78. 78. + corner2: 78. 78. + corner3: 81. 81. + corner4: 81. 81. + varlist: + - module: ocn_mod + var_name: var3 + output_name: var3_none + reduction: none + zbounds: 2. 3. + kind: r4 +_EOF +my_test_count=`expr $my_test_count + 1` +printf "&diag_manager_nml \n use_modern_diag=.true. \n / \n&test_reduction_methods_nml \n test_case = 0 \n/" | cat > input.nml +test_expect_success "Running diag_manager with "none" reduction method using a diag table with modular yaml(test $my_test_count)" ' + mpirun -n 6 ../test_reduction_methods +' +test_expect_success "Checking answers for the "none" reduction method using a diag table with modular yaml(test $my_test_count)" ' + mpirun -n 1 ../check_time_none +' fi test_done diff --git a/test_fms/diag_manager/test_time_none_netcdf4.sh b/test_fms/diag_manager/test_time_none_netcdf4.sh new file mode 100755 index 0000000000..b35fe19109 --- /dev/null +++ b/test_fms/diag_manager/test_time_none_netcdf4.sh @@ -0,0 +1,225 @@ +#!/bin/sh + +#*********************************************************************** +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. +#*********************************************************************** + +# Copyright (c) 2019-2020 Ed Hartnett, Seth Underwood + +# Set common test settings. +. ../test-lib.sh + +if [ -z "${parser_skip}" ] && [ -z "${parallel_skip}" ]; then +# create and enter directory for in/output files +output_dir + +cat <<_EOF > diag_table.yaml +title: test_none +base_date: 2 1 1 0 0 0 +diag_files: +- file_name: test_none + freq: 6 hours + time_units: hours + unlimdim: time + module: ocn_mod + reduction: none + kind: r4 + use_collective_writes: True + varlist: + - var_name: var0 + output_name: var0_none + - var_name: var1 + output_name: var1_none + - var_name: var2 + output_name: var2_none + - var_name: var3 + output_name: var3_none + - var_name: var4 + output_name: var4_none + module: ocn_z_mod + - var_name: var3 + output_name: var3_Z + zbounds: 2. 3. +- file_name: test_none_regional + freq: 6 hours + time_units: hours + unlimdim: time + sub_region: + - grid_type: latlon + corner1: 78. 78. + corner2: 78. 78. + corner3: 81. 81. + corner4: 81. 81. + varlist: + - module: ocn_mod + var_name: var3 + output_name: var3_none + reduction: none + zbounds: 2. 3. + kind: r4 +_EOF + +my_test_count=1 +printf "&diag_manager_nml \n use_modern_diag=.true. \n / \n&test_reduction_methods_nml \n test_case = 0 \n/" | cat > input.nml +test_expect_success "Running diag_manager with "none" reduction method - collective netcdf writes (test $my_test_count)" ' + mpirun -n 6 ../test_reduction_methods +' +test_expect_success "Checking answers for the "none" reduction method (test $my_test_count)" ' + mpirun -n 1 ../check_time_none +' + +if [ -z "${SKIP_NCDUMP_CHECKS}" ]; then +test_expect_success "Checking chunksizes" ' + ncdump -hs test_none.nc | grep -E "var4_none:_ChunkSizes *= *1, *2, *5, *16, *96" && + ncdump -hs test_none.nc | grep -E "var3_none:_ChunkSizes *= *1, *5, *16, *96" && + ncdump -hs test_none.nc | grep -E "var2_none:_ChunkSizes *= *1, *16, *96" + ' +fi + +# Repeat the test with specified chunksizes +cat <<_EOF > diag_table.yaml +title: test_none +base_date: 2 1 1 0 0 0 +diag_files: +- file_name: test_none + freq: 6 hours + time_units: hours + unlimdim: time + module: ocn_mod + reduction: none + kind: r4 + use_collective_writes: True + chunksizes: 96, 8, 1, 1, 1 + varlist: + - var_name: var0 + output_name: var0_none + - var_name: var1 + output_name: var1_none + - var_name: var2 + output_name: var2_none + - var_name: var3 + output_name: var3_none + - var_name: var4 + output_name: var4_none + module: ocn_z_mod + - var_name: var3 + output_name: var3_Z + zbounds: 2. 3. +- file_name: test_none_regional + freq: 6 hours + time_units: hours + unlimdim: time + sub_region: + - grid_type: latlon + corner1: 78. 78. + corner2: 78. 78. + corner3: 81. 81. + corner4: 81. 81. + varlist: + - module: ocn_mod + var_name: var3 + output_name: var3_none + reduction: none + zbounds: 2. 3. + kind: r4 +_EOF + +my_test_count=1 +printf "&diag_manager_nml \n use_modern_diag=.true. \n / \n&test_reduction_methods_nml \n test_case = 0 \n/" | cat > input.nml +test_expect_success "Running diag_manager with "none" reduction method - collective netcdf writes - specified chunksizes(test $my_test_count)" ' + mpirun -n 6 ../test_reduction_methods +' +test_expect_success "Checking answers for the "none" reduction method (test $my_test_count)" ' + mpirun -n 1 ../check_time_none +' + +if [ -z "${SKIP_NCDUMP_CHECKS}" ]; then +test_expect_success "Checking chunksizes" ' + ncdump -hs test_none.nc | grep -E "var4_none:_ChunkSizes *= *1, *1, *1, *8, *96" && + ncdump -hs test_none.nc | grep -E "var3_none:_ChunkSizes *= *1, *1, *8, *96" && + ncdump -hs test_none.nc | grep -E "var2_none:_ChunkSizes *= *1, *8, *96" + ' +fi + +# Repeat the test with specified chunksizes at variable level +cat <<_EOF > diag_table.yaml +title: test_none +base_date: 2 1 1 0 0 0 +diag_files: +- file_name: test_none + freq: 6 hours + time_units: hours + unlimdim: time + module: ocn_mod + reduction: none + kind: r4 + use_collective_writes: True + chunksizes: 96, 8, 1, 1, 1 + varlist: + - var_name: var0 + output_name: var0_none + - var_name: var1 + output_name: var1_none + - var_name: var2 + output_name: var2_none + - var_name: var3 + output_name: var3_none + - var_name: var4 + output_name: var4_none + module: ocn_z_mod + chunksizes: 96, 8, 5, 2, 1 + - var_name: var3 + output_name: var3_Z + zbounds: 2. 3. +- file_name: test_none_regional + freq: 6 hours + time_units: hours + unlimdim: time + sub_region: + - grid_type: latlon + corner1: 78. 78. + corner2: 78. 78. + corner3: 81. 81. + corner4: 81. 81. + varlist: + - module: ocn_mod + var_name: var3 + output_name: var3_none + reduction: none + zbounds: 2. 3. + kind: r4 +_EOF + +my_test_count=1 +printf "&diag_manager_nml \n use_modern_diag=.true. \n / \n&test_reduction_methods_nml \n test_case = 0 \n/" | cat > input.nml +test_expect_success "Running diag_manager with "none" reduction method - collective netcdf writes - specified chunksizes at variable level (test $my_test_count)" ' + mpirun -n 6 ../test_reduction_methods +' +test_expect_success "Checking answers for the "none" reduction method (test $my_test_count)" ' + mpirun -n 1 ../check_time_none +' + +if [ -z "${SKIP_NCDUMP_CHECKS}" ]; then +test_expect_success "Checking chunksizes" ' + ncdump -hs test_none.nc | grep -E "var4_none:_ChunkSizes *= *1, *2, *5, *8, *96" && + ncdump -hs test_none.nc | grep -E "var3_none:_ChunkSizes *= *1, *1, *8, *96" && + ncdump -hs test_none.nc | grep -E "var2_none:_ChunkSizes *= *1, *8, *96" + ' +fi + +fi +test_done diff --git a/test_fms/diag_manager/test_time_pow.sh b/test_fms/diag_manager/test_time_pow.sh index 5e343de9bb..7dd8f04bbf 100755 --- a/test_fms/diag_manager/test_time_pow.sh +++ b/test_fms/diag_manager/test_time_pow.sh @@ -1,28 +1,27 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # Set common test settings. . ../test-lib.sh -if [ -z "${skipflag}" ]; then +if [ -z "${parser_skip}" ]; then # create and enter directory for in/output files output_dir diff --git a/test_fms/diag_manager/test_time_rms.sh b/test_fms/diag_manager/test_time_rms.sh index 8f3c526f77..39f0055a89 100755 --- a/test_fms/diag_manager/test_time_rms.sh +++ b/test_fms/diag_manager/test_time_rms.sh @@ -1,28 +1,27 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # Set common test settings. . ../test-lib.sh -if [ -z "${skipflag}" ]; then +if [ -z "${parser_skip}" ]; then # create and enter directory for in/output files output_dir @@ -55,7 +54,7 @@ diag_files: output_name: var3_rms reduction: average kind: r4 - - module: ocn_mod + - module: ocn_z_mod var_name: var4 output_name: var4_rms reduction: average diff --git a/test_fms/diag_manager/test_time_sum.sh b/test_fms/diag_manager/test_time_sum.sh index c7631217a4..5f85b9625b 100755 --- a/test_fms/diag_manager/test_time_sum.sh +++ b/test_fms/diag_manager/test_time_sum.sh @@ -1,28 +1,27 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # Set common test settings. . ../test-lib.sh -if [ -z "${skipflag}" ]; then +if [ -z "${parser_skip}" ]; then # create and enter directory for in/output files output_dir @@ -55,7 +54,7 @@ diag_files: output_name: var3_sum reduction: sum kind: r4 - - module: ocn_mod + - module: ocn_z_mod var_name: var4 output_name: var4_sum reduction: sum diff --git a/test_fms/diag_manager/test_var_masks.F90 b/test_fms/diag_manager/test_var_masks.F90 index d1030d236c..0093b584d0 100644 --- a/test_fms/diag_manager/test_var_masks.F90 +++ b/test_fms/diag_manager/test_var_masks.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief This programs tests fields that have a mask that changes over time diff --git a/test_fms/diag_manager/test_var_masks.sh b/test_fms/diag_manager/test_var_masks.sh index 761fb345cf..ec452f9d90 100755 --- a/test_fms/diag_manager/test_var_masks.sh +++ b/test_fms/diag_manager/test_var_masks.sh @@ -1,28 +1,27 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # Set common test settings. . ../test-lib.sh -if [ -z "${skipflag}" ]; then +if [ -z "${parser_skip}" ]; then # create and enter directory for in/output files output_dir diff --git a/test_fms/diag_manager/test_zbounds_limits.F90 b/test_fms/diag_manager/test_zbounds_limits.F90 new file mode 100644 index 0000000000..62bd6e778e --- /dev/null +++ b/test_fms/diag_manager/test_zbounds_limits.F90 @@ -0,0 +1,188 @@ +!*********************************************************************** +!* Apache License 2.0 +!* +!* This file is part of the GFDL Flexible Modeling System (FMS). +!* +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at +!* +!* http://www.apache.org/licenses/LICENSE-2.0 +!* +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. +!*********************************************************************** + +!> @brief This programs tests diag_manager with the following diag_table + +program test_modern_diag +use mpp_domains_mod, only: domain2d, mpp_domains_set_stack_size, mpp_define_domains, mpp_define_io_domain, & + mpp_define_mosaic, domainug, mpp_get_compute_domains, mpp_define_unstruct_domain, & + mpp_get_compute_domain, mpp_get_data_domain, mpp_get_UG_domain_grid_index, & + mpp_get_UG_compute_domain +use diag_manager_mod, only: diag_manager_init, diag_manager_end, diag_axis_init, register_diag_field, & + diag_axis_add_attribute, diag_field_add_attribute, diag_send_complete, & + diag_manager_set_time_end, send_data, register_static_field, & + diag_field_add_cell_measures +use platform_mod, only: r8_kind, r4_kind +use fms_mod, only: fms_init, fms_end +use mpp_mod, only: FATAL, mpp_error, mpp_npes, mpp_pe, mpp_root_pe, mpp_broadcast, input_nml_file +use time_manager_mod, only: time_type, set_calendar_type, set_date, JULIAN, set_time, OPERATOR(+) +use fms_diag_object_mod,only: dump_diag_obj + +implicit none + +type(time_type) :: Time !< Time of the simulation +type(time_type) :: Time_step !< Time_step of the simulation +integer, dimension(2) :: layout !< Layout to use when setting up the domain +integer, dimension(2) :: io_layout !< io layout to use when setting up the io domain +integer :: nx !< Number of x points +integer :: ny !< Number of y points +integer :: nz !< Number of z points +integer :: ug_dim_size !< Number of points in the UG +type(domain2d) :: Domain !< 2D domain +type(domain2d) :: Domain_cube_sph !< cube sphere domain +type(domainug) :: land_domain !< Unstructured domain +real, dimension(:), allocatable:: x !< X axis data +real, dimension(:), allocatable:: y !< Y axis_data +real, dimension(:), allocatable:: z !< Z axis_data +integer, dimension(:), allocatable:: ug_dim_data !< UG axis_data +integer :: i !< For do loops +integer :: id_x !< axis id for the x dimension +integer :: id_y !< axis id for the y dimension +integer :: id_UG !< axis id for the unstructured dimension +integer :: id_z !< axis id for the z dimention +integer :: id_lon +integer :: id_lat + +integer :: id_var +real, dimension(:,:), allocatable :: var_data !< Dummy variable data to send to diag_manager +logical :: used !< Used for send_data call + +call fms_init +call set_calendar_type(JULIAN) +call diag_manager_init + +nx = 96 +ny = 96 +nz = 5 +layout = (/1, mpp_npes()/) +io_layout = (/1, 1/) + +!> Set up a normal (lat/lon) 2D domain, a cube sphere, and UG domain +call set_up_2D_domain(domain, layout, nx, ny, io_layout) +call set_up_cube_sph_domain(Domain_cube_sph, nx, ny, io_layout) +call create_land_domain(Domain_cube_sph, nx, ny, 6, land_domain, npes_group=1) +call mpp_get_UG_compute_domain(land_domain, size=ug_dim_size) + +allocate(ug_dim_data(ug_dim_size)) +call mpp_get_UG_domain_grid_index(land_domain, ug_dim_data) +ug_dim_data = ug_dim_data - 1 + +! Set up the data +allocate(x(ug_dim_size), y(ug_dim_size), z(nz)) +do i=1,ug_dim_size + x(i) = i +enddo +do i=1,ug_dim_size + y(i) = i +enddo +do i=1,nz + z(i) = i +enddo + +! Set up the initial time +Time = set_date(2,1,1,0,0,0) + +! Register the diags axis +id_x = diag_axis_init('grid_xt', x, 'point_E', 'x', long_name='point_E', set_name="land") +id_y = diag_axis_init('grid_yt', y, 'point_N', 'y', long_name='point_N', set_name="land") +id_z = diag_axis_init('z', z, 'point_Z', 'z', long_name='point_Z') + +id_ug = diag_axis_init("grid_index", real(ug_dim_data), "none", "U", long_name="grid indices", & + DomainU=land_domain, aux="geolon_t geolat_t", set_name="land") + +call diag_axis_add_attribute (id_ug, 'compress', 'grid_xt grid_yt') + +! Register the variables +id_lon = register_diag_field ('lnd_mod', 'grid_xt', (/id_x/), Time, 'lon', 'mullions') +id_lat = register_diag_field ('lnd_mod', 'grid_yt', (/id_y/), Time, 'lat', 'mullions') + + +id_var = register_diag_field ('lnd_mod', 'var1', (/id_ug, id_z /), Time, 'Some scalar var', 'mullions', & + standard_name="Land is important!") + +call diag_manager_set_time_end(Time) +call diag_manager_set_time_end(set_date(2,1,2,0,0,0)) + +allocate(var_data(ug_dim_size, nz)) + +Time_step = set_time (3600,0) !< 1 hour + +used = send_data(id_lon, x, Time) +used = send_data(id_lat, y, Time) + +do i=1,23 + Time = Time + Time_step + var_data = real(i) + + used = send_data(id_var, var_data, Time) + + call diag_send_complete(Time_step) +enddo + +call diag_manager_end(Time) +call fms_end + +contains + +include "../fms2_io/create_atmosphere_domain.inc" +include "../fms2_io/create_land_domain.inc" + +!> @brief Sets up a lat/lon domain +subroutine set_up_2D_domain(Domain, layout, nx, ny, io_layout) + type(domain2d), intent(out) :: Domain !< 2D domain + integer, intent(in) :: layout(:) !< Layout to use when setting up the domain + integer, intent(in) :: nx !< Number of x points + integer, intent(in) :: ny !< Number of y points + integer, intent(in) :: io_layout(:) !< Io layout to use when setting up the io_domain + + call mpp_domains_set_stack_size(17280000) + call mpp_define_domains( (/1,nx,1,ny/), layout, Domain, name='2D domain') + call mpp_define_io_domain(Domain, io_layout) +end subroutine set_up_2D_domain + +!> @brief Sets up a cube sphere domain +subroutine set_up_cube_sph_domain(Domain_cube_sph, nx, ny, io_layout) + type(domain2d), intent(out) :: Domain_cube_sph !< 2D domain + integer, intent(in) :: nx !< Number of x points + integer, intent(in) :: ny !< Number of y points + integer, intent(in) :: io_layout(:) !< Io layout to use when setting up the io_domain + + integer :: i !< For do loops + integer :: npes !< Number of pes + integer, parameter :: ntiles=6 !< Number of tiles + integer, dimension(4,ntiles) :: global_indices !< The global indices of each tile + integer, dimension(2,ntiles) :: layout !< The layout of each tile + integer, dimension(ntiles) :: pe_start !< The starting PE of each tile + integer, dimension(ntiles) :: pe_end !< The ending PE of eeach tile + + npes = mpp_npes() + + !< Create the domain + do i = 1,ntiles + global_indices(:, i) = (/1, ny, 1, ny/) + layout(:, i) = (/1, npes/ntiles/) + pe_start(i) = (i-1)*(npes/ntiles) + pe_end(i) = i*(npes/ntiles) - 1 + end do + + call create_atmosphere_domain((/nx, nx, nx, nx, nx, nx/), & + (/ny, ny, ny, ny, ny, ny/), & + global_indices, layout, pe_start, pe_end, & + io_layout, Domain_cube_sph) +end subroutine set_up_cube_sph_domain +end program test_modern_diag diff --git a/test_fms/diag_manager/test_zbounds_limits.sh b/test_fms/diag_manager/test_zbounds_limits.sh new file mode 100755 index 0000000000..254e957851 --- /dev/null +++ b/test_fms/diag_manager/test_zbounds_limits.sh @@ -0,0 +1,72 @@ +#!/bin/sh + +#*********************************************************************** +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. +#*********************************************************************** + +# Set common test settings. +. ../test-lib.sh + +output_dir + +touch input.nml +cat <<_EOF > diag_table +test_diag_manager_01 +2 1 1 0 0 0 + +"file_1", 1, "hours", 1, "hours", "time" + "lnd_mod", "var1", "var1", "file_1", "all", "max", "-1 -1 -1 -1 2 3", 2 +_EOF + +rm -f *.nc +test_expect_success "Test zbounds limits (legacy diag manager)" ' + mpirun -n 6 ../test_zbounds_limits +' + +if [ -z "${parser_skip}" ] +then + # Repeat the test with the modern diag_manager + cat <<_EOF > input.nml +&diag_manager_nml + use_modern_diag = .true. +/ +_EOF + + cat <<_EOF > diag_table.yaml +title: test_diag_manager_01 +base_date: 2 1 1 0 0 0 +diag_files: +- file_name: file_1 + time_units: hours + unlimdim: time + freq: 1 hours + varlist: + - module: lnd_mod + var_name: var1 + reduction: max + zbounds: 2 3 + kind: r4 +_EOF + + rm -rf diag_table + rm -f *.nc + test_expect_success "Test zbounds limits (modern diag manager)" ' + mpirun -n 6 ../test_zbounds_limits + ' +fi + +test_done diff --git a/test_fms/diag_manager/testing_utils.F90 b/test_fms/diag_manager/testing_utils.F90 index 45530fcc3e..ba4616fa1f 100644 --- a/test_fms/diag_manager/testing_utils.F90 +++ b/test_fms/diag_manager/testing_utils.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief Utilities used in multiple test diff --git a/test_fms/drifters/Makefile.am b/test_fms/drifters/Makefile.am index c2a3be84f7..39d355735e 100644 --- a/test_fms/drifters/Makefile.am +++ b/test_fms/drifters/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the test_fms/drifters directory of the FMS diff --git a/test_fms/drifters/test_cloud_interpolator.F90 b/test_fms/drifters/test_cloud_interpolator.F90 index 204e5d545e..4cea7fa72e 100644 --- a/test_fms/drifters/test_cloud_interpolator.F90 +++ b/test_fms/drifters/test_cloud_interpolator.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** program test_cloud_interpolator diff --git a/test_fms/drifters/test_drifters.F90 b/test_fms/drifters/test_drifters.F90 index ab6cb91c89..99d72cf684 100644 --- a/test_fms/drifters/test_drifters.F90 +++ b/test_fms/drifters/test_drifters.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** program test_drifters diff --git a/test_fms/drifters/test_drifters2.sh b/test_fms/drifters/test_drifters2.sh index d2bc490763..218fb24fb4 100755 --- a/test_fms/drifters/test_drifters2.sh +++ b/test_fms/drifters/test_drifters2.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/drifters/test_drifters_comm.F90 b/test_fms/drifters/test_drifters_comm.F90 index 85108fa4d2..fad30618e5 100644 --- a/test_fms/drifters/test_drifters_comm.F90 +++ b/test_fms/drifters/test_drifters_comm.F90 @@ -1,22 +1,21 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . -!********************************************************************** +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. +!*********************************************************************** program test_drifters_comm #ifdef use_drifters diff --git a/test_fms/drifters/test_drifters_core.F90 b/test_fms/drifters/test_drifters_core.F90 index 51e81efc72..cb9526448a 100644 --- a/test_fms/drifters/test_drifters_core.F90 +++ b/test_fms/drifters/test_drifters_core.F90 @@ -1,22 +1,21 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . -!********************************************************************** +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. +!*********************************************************************** program test_drifters_core #ifdef use_drifters diff --git a/test_fms/drifters/test_drifters_input.F90 b/test_fms/drifters/test_drifters_input.F90 index 297b751493..6736a10d75 100644 --- a/test_fms/drifters/test_drifters_input.F90 +++ b/test_fms/drifters/test_drifters_input.F90 @@ -1,21 +1,20 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** program test_drifters_input diff --git a/test_fms/drifters/test_drifters_io.F90 b/test_fms/drifters/test_drifters_io.F90 index f74e8cb500..a6abf9acf4 100644 --- a/test_fms/drifters/test_drifters_io.F90 +++ b/test_fms/drifters/test_drifters_io.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** program test_drifters_io diff --git a/test_fms/drifters/test_quicksort.F90 b/test_fms/drifters/test_quicksort.F90 index 04cb268112..6e258836d1 100644 --- a/test_fms/drifters/test_quicksort.F90 +++ b/test_fms/drifters/test_quicksort.F90 @@ -1,21 +1,20 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** program test_quicksort diff --git a/test_fms/exchange/Makefile.am b/test_fms/exchange/Makefile.am index 1157ad3826..8b699f801a 100644 --- a/test_fms/exchange/Makefile.am +++ b/test_fms/exchange/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the test_fms/exchange directory of the FMS diff --git a/test_fms/exchange/test_xgrid.F90 b/test_fms/exchange/test_xgrid.F90 index e28cab347d..f8a1eb2438 100644 --- a/test_fms/exchange/test_xgrid.F90 +++ b/test_fms/exchange/test_xgrid.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** ! Now only test some simple test, will test cubic grid mosaic in the future. diff --git a/test_fms/exchange/test_xgrid2.sh b/test_fms/exchange/test_xgrid2.sh index 909d66e883..20a3b5149f 100755 --- a/test_fms/exchange/test_xgrid2.sh +++ b/test_fms/exchange/test_xgrid2.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/field_manager/Makefile.am b/test_fms/field_manager/Makefile.am index 01f10ed0dd..9a01b22867 100644 --- a/test_fms/field_manager/Makefile.am +++ b/test_fms/field_manager/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the test_fms/field_manager directory of @@ -36,18 +35,17 @@ test_field_manager_r4_SOURCES = test_field_manager.F90 test_field_manager_r8_SOURCES = test_field_manager.F90 test_field_table_read_SOURCES = test_field_table_read.F90 -test_field_manager_r4_CPPFLAGS=-DTEST_FM_KIND_=4 -I$(MODDIR) -test_field_manager_r8_CPPFLAGS=-DTEST_FM_KIND_=8 -I$(MODDIR) +test_field_manager_r4_CPPFLAGS=-DTEST_FMS_KIND_=4 -I$(MODDIR) +test_field_manager_r8_CPPFLAGS=-DTEST_FMS_KIND_=8 -I$(MODDIR) if USING_YAML -skipflag="skip" + TESTS_ENVIRONMENT = parser_skip="" else -skipflag="" + TESTS_ENVIRONMENT = parser_skip=skip endif TEST_EXTENSIONS = .sh SH_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(abs_top_srcdir)/test_fms/tap-driver.sh -TESTS_ENVIRONMENT= parser_skip=${skipflag} # Run the test program. TESTS = test_field_manager2.sh diff --git a/test_fms/field_manager/test_field_manager.F90 b/test_fms/field_manager/test_field_manager.F90 index 7749a8647c..e8856e1406 100644 --- a/test_fms/field_manager/test_field_manager.F90 +++ b/test_fms/field_manager/test_field_manager.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !********************* Sample field table required: ********************* @@ -45,17 +44,17 @@ program test_field_manager integer :: i, j, nfields, num_methods, model character(len=fm_string_len) :: field_type, field_name, str, name_field_type, path character(len=512) :: method_name, method_control -real(TEST_FM_KIND_) :: param, param_out +real(TEST_FMS_KIND_) :: param, param_out integer :: flag, index logical :: success type(method_type), dimension(20) :: methods -real(TEST_FM_KIND_) :: slope_value -real(TEST_FM_KIND_) :: slope_value_array(2) -integer, parameter :: lkind=TEST_FM_KIND_ +real(TEST_FMS_KIND_) :: slope_value +real(TEST_FMS_KIND_) :: slope_value_array(2) +integer, parameter :: lkind=TEST_FMS_KIND_ integer, parameter :: array_size=4 -real(TEST_FM_KIND_) :: array_values(array_size), array_out(array_size) +real(TEST_FMS_KIND_) :: array_values(array_size), array_out(array_size) call mpp_init call field_manager_init(nfields) diff --git a/test_fms/field_manager/test_field_manager2.sh b/test_fms/field_manager/test_field_manager2.sh index 29b77ff19a..090640f2ed 100755 --- a/test_fms/field_manager/test_field_manager2.sh +++ b/test_fms/field_manager/test_field_manager2.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to @@ -100,9 +99,12 @@ cat <<_EOF > input.nml / _EOF -if [ ! $parser_skip ]; then +if [ ! -z "$parser_skip" ]; then + test_expect_failure "field table read with use_field_table.yaml = .true. but not compiling with yaml" 'mpirun -n 1 ./test_field_table_read' + else + test_expect_success "field table read with use_field_table.yaml = .true." 'mpirun -n 1 ./test_field_table_read' test_expect_success "field manager functional r4 with yaml table" 'mpirun -n 2 ./test_field_manager_r4' test_expect_success "field manager functional r8 with yaml table" 'mpirun -n 2 ./test_field_manager_r8' @@ -173,8 +175,8 @@ field_table: longname: bad radon! _EOF -rm -rf field_table.ens_01.yaml field_table.ens_02.yaml -test_expect_success "field manager test with 2 ensembles same yaml" 'mpirun -n 2 ./test_field_table_read' + rm -rf field_table.ens_01.yaml field_table.ens_02.yaml + test_expect_success "field manager test with 2 ensembles same yaml" 'mpirun -n 2 ./test_field_table_read' fi test_done diff --git a/test_fms/field_manager/test_field_table_read.F90 b/test_fms/field_manager/test_field_table_read.F90 index 4f2b993f30..84381da92b 100644 --- a/test_fms/field_manager/test_field_table_read.F90 +++ b/test_fms/field_manager/test_field_table_read.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !********************* Sample field table required: ********************* diff --git a/test_fms/fms/Makefile.am b/test_fms/fms/Makefile.am index 8c2e2fb46b..0a1a2a8729 100644 --- a/test_fms/fms/Makefile.am +++ b/test_fms/fms/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the test_fms/fms directory of the FMS diff --git a/test_fms/fms/test_fms2.sh b/test_fms/fms/test_fms2.sh index f11d98b278..6e7e2600c5 100755 --- a/test_fms/fms/test_fms2.sh +++ b/test_fms/fms/test_fms2.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/fms2_io/Makefile.am b/test_fms/fms2_io/Makefile.am index 3a36c62f18..2c8ce709fd 100644 --- a/test_fms/fms2_io/Makefile.am +++ b/test_fms/fms2_io/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the test_fms/fms2_io directory of the FMS @@ -31,7 +30,7 @@ LDADD = $(top_builddir)/libFMS/libFMS.la # Build this test program. check_PROGRAMS = test_get_is_valid test_file_appendix test_fms2_io test_atmosphere_io test_io_simple test_io_with_mask test_global_att \ test_packed_reads test_bc_restart test_get_mosaic_tile_grid test_read_ascii_file test_unlimit_compressed test_chunksizes \ - test_domain_io test_compressed_writes test_collective_io + test_domain_io test_compressed_writes test_collective_io test_parallel_writes test_generalized_indices # This is the source code for the test. test_get_is_valid_SOURCES = test_get_is_valid.F90 @@ -54,6 +53,8 @@ test_packed_reads_SOURCES = test_packed_reads.F90 test_compressed_writes_SOURCES = test_compressed_writes.F90 test_domain_io_SOURCES = test_domain_io.F90 test_collective_io_SOURCES = test_collective_io.F90 +test_parallel_writes_SOURCES = test_parallel_writes.F90 +test_generalized_indices_SOURCES = test_generalized_indices.F90 EXTRA_DIST = test_bc_restart.sh test_fms2_io.sh test_atmosphere_io.sh test_io_simple.sh test_global_att.sh test_io_with_mask.sh test_read_ascii_file.sh \ test_collective_io.sh diff --git a/test_fms/fms2_io/argparse.F90 b/test_fms/fms2_io/argparse.F90 index 4caddb538a..4006dca3dc 100644 --- a/test_fms/fms2_io/argparse.F90 +++ b/test_fms/fms2_io/argparse.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief A simple command line argument parsing module for Fortran programs diff --git a/test_fms/fms2_io/atmosphere_restart_file_test.inc b/test_fms/fms2_io/atmosphere_restart_file_test.inc index 4661ee2f7c..5ca95ff89d 100644 --- a/test_fms/fms2_io/atmosphere_restart_file_test.inc +++ b/test_fms/fms2_io/atmosphere_restart_file_test.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** subroutine atmosphere_restart_file(domain, nz, nt, debug_flag) diff --git a/test_fms/fms2_io/create_atmosphere_domain.inc b/test_fms/fms2_io/create_atmosphere_domain.inc index cb926551d4..92a6587b3f 100644 --- a/test_fms/fms2_io/create_atmosphere_domain.inc +++ b/test_fms/fms2_io/create_atmosphere_domain.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief Initialize a cubed-sphere atomsphere domain. diff --git a/test_fms/fms2_io/create_land_domain.inc b/test_fms/fms2_io/create_land_domain.inc index e8a18f9fc5..fca8a68ad4 100644 --- a/test_fms/fms2_io/create_land_domain.inc +++ b/test_fms/fms2_io/create_land_domain.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief Create an unstructured land-like domain. diff --git a/test_fms/fms2_io/create_ocean_domain.inc b/test_fms/fms2_io/create_ocean_domain.inc index 447286d38c..2dcb182730 100644 --- a/test_fms/fms2_io/create_ocean_domain.inc +++ b/test_fms/fms2_io/create_ocean_domain.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief Initialize an ocean style tripolar domain. diff --git a/test_fms/fms2_io/land_compressed_restart_file_test.inc b/test_fms/fms2_io/land_compressed_restart_file_test.inc index ddc0a40e68..98da7f31f0 100644 --- a/test_fms/fms2_io/land_compressed_restart_file_test.inc +++ b/test_fms/fms2_io/land_compressed_restart_file_test.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** subroutine land_compressed_restart_file(nz, nt, debug_flag) diff --git a/test_fms/fms2_io/land_unstructured_restart_file_test.inc b/test_fms/fms2_io/land_unstructured_restart_file_test.inc index 97a5bf338e..a95168307f 100644 --- a/test_fms/fms2_io/land_unstructured_restart_file_test.inc +++ b/test_fms/fms2_io/land_unstructured_restart_file_test.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** subroutine land_unstructured_restart_file(domain, nz, nt, debug_flag) diff --git a/test_fms/fms2_io/ocean_restart_file_test.inc b/test_fms/fms2_io/ocean_restart_file_test.inc index 2046d2674d..5b3f72a39a 100644 --- a/test_fms/fms2_io/ocean_restart_file_test.inc +++ b/test_fms/fms2_io/ocean_restart_file_test.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** subroutine ocean_restart_file(domain, nz, nt, debug_flag) diff --git a/test_fms/fms2_io/setup.F90 b/test_fms/fms2_io/setup.F90 index a4ab44589e..05643db95a 100644 --- a/test_fms/fms2_io/setup.F90 +++ b/test_fms/fms2_io/setup.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** module setup diff --git a/test_fms/fms2_io/test_atmosphere_io.F90 b/test_fms/fms2_io/test_atmosphere_io.F90 index aae7f987ff..aae4053050 100644 --- a/test_fms/fms2_io/test_atmosphere_io.F90 +++ b/test_fms/fms2_io/test_atmosphere_io.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** program test_atmosphere_io diff --git a/test_fms/fms2_io/test_atmosphere_io.sh b/test_fms/fms2_io/test_atmosphere_io.sh index 22f62b47f6..3a4f8d6a8c 100755 --- a/test_fms/fms2_io/test_atmosphere_io.sh +++ b/test_fms/fms2_io/test_atmosphere_io.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/fms2_io/test_bc_restart.F90 b/test_fms/fms2_io/test_bc_restart.F90 index f863284984..28a36f5fa2 100644 --- a/test_fms/fms2_io/test_bc_restart.F90 +++ b/test_fms/fms2_io/test_bc_restart.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief This programs tests the functionality that writes the boundary diff --git a/test_fms/fms2_io/test_bc_restart.sh b/test_fms/fms2_io/test_bc_restart.sh index faac53e0cb..4c75c1908d 100755 --- a/test_fms/fms2_io/test_bc_restart.sh +++ b/test_fms/fms2_io/test_bc_restart.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/fms2_io/test_chunksizes.F90 b/test_fms/fms2_io/test_chunksizes.F90 index f735b325cf..c6bb3f80de 100644 --- a/test_fms/fms2_io/test_chunksizes.F90 +++ b/test_fms/fms2_io/test_chunksizes.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** program test_chunksizes diff --git a/test_fms/fms2_io/test_collective_io.F90 b/test_fms/fms2_io/test_collective_io.F90 index d541a1057f..b80367b7f9 100644 --- a/test_fms/fms2_io/test_collective_io.F90 +++ b/test_fms/fms2_io/test_collective_io.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** program test_collective_io @@ -106,9 +105,8 @@ program test_collective_io endif call mpp_sync() - fileobj%use_collective = .true. - fileobj%tile_comm = mpp_get_domain_tile_commid(Domain_read) - if (open_file(fileobj, "test_collective_io.nc", "read", Domain_read, nc_format=nc_format)) then + if (open_file(fileobj, "test_collective_io.nc", "read", Domain_read, nc_format=nc_format, & + use_netcdf_mpi=.true., use_collective=.true.)) then names(1) = "lon" names(2) = "lat" call register_axis(fileobj, "lon", "x") diff --git a/test_fms/fms2_io/test_collective_io.sh b/test_fms/fms2_io/test_collective_io.sh index f62ce5c94d..0c548ddbdb 100755 --- a/test_fms/fms2_io/test_collective_io.sh +++ b/test_fms/fms2_io/test_collective_io.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to @@ -27,7 +26,7 @@ . ../test-lib.sh if [ ! -z $parallel_skip ]; then - SKIP_TESTS="test_collective_io.1" + SKIP_TESTS="test_collective_io.[1-3]" fi # Create and enter output directory @@ -35,19 +34,23 @@ output_dir touch input.nml -test_expect_success "Test the collective netcdf io functionality" ' +test_expect_success "Test NetCDF-4 MPI-IO parallel writes" ' + mpirun -n 6 ../test_parallel_writes +' + +test_expect_success "Test NetCDF-4 MPI-IO collective reads" ' mpirun -n 6 ../test_collective_io ' rm -rf *.nc* -# The code should still run if not using netcdf4 files, it just won't use collective io cat <<_EOF > input.nml &test_collective_io_nml nc_format = "64bit" / _EOF -test_expect_success "Test the collective netcdf io functionality" ' +test_expect_failure "Attempt to open a 64-bit NetCDF file for MPI-IO collective reads" ' mpirun -n 6 ../test_collective_io ' + test_done diff --git a/test_fms/fms2_io/test_compressed_writes.F90 b/test_fms/fms2_io/test_compressed_writes.F90 index 38d44f6392..0547259c3c 100644 --- a/test_fms/fms2_io/test_compressed_writes.F90 +++ b/test_fms/fms2_io/test_compressed_writes.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief This programs tests the compressed writes in fms2_io diff --git a/test_fms/fms2_io/test_domain_io.F90 b/test_fms/fms2_io/test_domain_io.F90 index 90d399bf3d..7937c562ef 100644 --- a/test_fms/fms2_io/test_domain_io.F90 +++ b/test_fms/fms2_io/test_domain_io.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** program test_domain_read diff --git a/test_fms/fms2_io/test_file_appendix.F90 b/test_fms/fms2_io/test_file_appendix.F90 index aa0644971d..60b1a154a5 100644 --- a/test_fms/fms2_io/test_file_appendix.F90 +++ b/test_fms/fms2_io/test_file_appendix.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief This programs tests calls to diff --git a/test_fms/fms2_io/test_fms2_io.F90 b/test_fms/fms2_io/test_fms2_io.F90 index 1057b544f5..31ef712f64 100644 --- a/test_fms/fms2_io/test_fms2_io.F90 +++ b/test_fms/fms2_io/test_fms2_io.F90 @@ -1,24 +1,23 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** program main -use, intrinsic :: iso_fortran_env +use, intrinsic :: iso_fortran_env, only: output_unit, error_unit use argparse use mpi use mpp_mod diff --git a/test_fms/fms2_io/test_fms2_io.sh b/test_fms/fms2_io/test_fms2_io.sh index 5e0bd31c0e..4633dfc494 100755 --- a/test_fms/fms2_io/test_fms2_io.sh +++ b/test_fms/fms2_io/test_fms2_io.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to @@ -107,4 +106,10 @@ test_expect_success "Domain Read Write Tests with a ocean mask" ' mpirun -n 17 ../test_domain_io ' +rm input.nml +touch input.nml +test_expect_success "Write and read domain-decomposed data with generalized indices" ' + mpirun -n 16 ../test_generalized_indices +' + test_done diff --git a/test_fms/fms2_io/test_generalized_indices.F90 b/test_fms/fms2_io/test_generalized_indices.F90 new file mode 100644 index 0000000000..f4707b340b --- /dev/null +++ b/test_fms/fms2_io/test_generalized_indices.F90 @@ -0,0 +1,154 @@ +!*********************************************************************** +!* Apache License 2.0 +!* +!* This file is part of the GFDL Flexible Modeling System (FMS). +!* +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at +!* +!* http://www.apache.org/licenses/LICENSE-2.0 +!* +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. +!*********************************************************************** + +program test_generalized_indices +use fms_mod, only: fms_init, fms_end +use mpp_mod, only: mpp_pe +use fms_string_utils_mod, only: string +use fms2_io_mod, only: FmsNetcdfDomainFile_t, register_field, register_axis, unlimited, & + read_data +use fms2_io_mod, only: open_file, close_file, write_data +use mpp_domains_mod, only: mpp_define_domains, mpp_define_io_domain, mpp_get_compute_domain, & + domain2d, center +use random_numbers_mod, only: randomNumberStream, initializeRandomNumberStream, getRandomNumbers +use platform_mod, only: r8_kind + +implicit none + +integer, parameter :: nx = 16 +integer, parameter :: ny = 16 +integer, parameter :: nz = 10 +integer, parameter :: nt = 5 +integer, dimension(2), parameter :: layout = [4, 4] +integer, dimension(2), parameter :: io_layout = [2, 2] +character(*), parameter :: var_name = "rand" +character(1), parameter :: axis_labels(3) = ["x", "y", "z"] + +type (domain2d) :: domain + +real(r8_kind), dimension(:, :, :, :, :), allocatable :: data +integer :: lb(3), ub(3) + +call fms_init + +call define_domain + +call test_permutation(1, 2, 3) +call test_permutation(1, 3, 2) +call test_permutation(2, 1, 3) +call test_permutation(2, 3, 1) +call test_permutation(3, 1, 2) +call test_permutation(3, 2, 1) + +call fms_end + +contains + +subroutine define_domain + integer :: isc, iec, jsc, jec !< Compute domain + + call mpp_define_domains( [1, nx, 1, ny], layout, domain) + call mpp_define_io_domain(domain, io_layout) + call mpp_get_compute_domain(domain, isc, iec, jsc, jec) + + lb = [isc, jsc, 1] + ub = [iec, jec, nz] +end subroutine define_domain + +subroutine set_data(arr) + real(r8_kind), intent(out) :: arr(:, :, :, :) + type(randomNumberStream) :: random_stream + integer :: i3, i4, n3, n4 + + random_stream = initializeRandomNumberStream(mpp_pe()) + + n4 = size(arr, 4) + n3 = size(arr, 3) + + do i4=1, n4 + do i3=1, n3 + call getRandomNumbers(random_stream, arr(:, :, i3, i4)) + enddo + enddo +end subroutine set_data + +subroutine test_permutation(n1, n2, n3) + integer, intent(in) :: n1, n2, n3 + character(1) :: axes(4) + + axes(1) = axis_labels(n1) + axes(2) = axis_labels(n2) + axes(3) = axis_labels(n3) + axes(4) = "t" + + allocate(data(lb(n1):ub(n1), lb(n2):ub(n2), lb(n3):ub(n3), nt, 2)) + + call set_data(data(:, :, :, :, 1)) + call write_permutation(axes, data(:, :, :, :, 1)) + call read_permutation(axes, data(:, :, :, :, 2)) + + if (any(data(:, :, :, :, 1).ne.data(:, :, :, :, 2))) then + print "(A)", "The data written out do not match the data read back in" + stop 1 + endif + + deallocate(data) +end subroutine test_permutation + +subroutine open_netcdf_file(fileobj, axes, mode) + type(FmsNetcdfDomainFile_t), intent(out) :: fileobj + character(1), intent(in) :: axes(4) + character(*), intent(in) :: mode + character(:), allocatable :: filename + + filename = "permutation_" // axes(1) // axes(2) // axes(3) // ".nc" + + if (.not.open_file(fileobj, filename, mode, domain)) then + print "(A)", "Error: Could not open "//filename//" in "//mode//" mode" + stop 1 + endif + + call register_axis(fileobj, "x", "x") + call register_axis(fileobj, "y", "y") + call register_axis(fileobj, "z", nz) + call register_axis(fileobj, "t", unlimited) +end subroutine open_netcdf_file + +subroutine write_permutation(axes, arr) + character(1), intent(in) :: axes(4) + real(r8_kind), intent(in) :: arr(:, :, :, :) + type(FmsNetcdfDomainFile_t) :: fileobj + + call open_netcdf_file(fileobj, axes, "write") + + call register_field(fileobj, var_name, "double", axes) + call write_data(fileobj, var_name, arr) + call close_file(fileobj) +end subroutine write_permutation + +subroutine read_permutation(axes, arr) + character(1), intent(in) :: axes(4) + real(r8_kind), intent(out) :: arr(:, :, :, :) + type(FmsNetcdfDomainFile_t) :: fileobj + + call open_netcdf_file(fileobj, axes, "read") + call read_data(fileobj, var_name, arr) + call close_file(fileobj) +end subroutine read_permutation + +end program test_generalized_indices diff --git a/test_fms/fms2_io/test_get_is_valid.F90 b/test_fms/fms2_io/test_get_is_valid.F90 index e1efca4f5e..3bf7e4ec2c 100644 --- a/test_fms/fms2_io/test_get_is_valid.F90 +++ b/test_fms/fms2_io/test_get_is_valid.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief This programs tests calls to fms2_io get_valid and is_valid @@ -28,7 +27,6 @@ program test_get_is_valid use netcdf , only: nf90_create, nf90_def_var, nf90_put_att, nf90_enddef, & nf90_close, nf90_clobber, nf90_64bit_offset, nf90_double -use, intrinsic :: iso_fortran_env use platform_mod implicit none diff --git a/test_fms/fms2_io/test_get_mosaic_tile_grid.F90 b/test_fms/fms2_io/test_get_mosaic_tile_grid.F90 index 00e8abc284..8e3710bf96 100644 --- a/test_fms/fms2_io/test_get_mosaic_tile_grid.F90 +++ b/test_fms/fms2_io/test_get_mosaic_tile_grid.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief This programs tests test_get_mosaic_tile_grid. diff --git a/test_fms/fms2_io/test_global_att.F90 b/test_fms/fms2_io/test_global_att.F90 index 912bfd867f..67fcc27965 100644 --- a/test_fms/fms2_io/test_global_att.F90 +++ b/test_fms/fms2_io/test_global_att.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief This programs tests the "register_global_attribute" and diff --git a/test_fms/fms2_io/test_global_att.sh b/test_fms/fms2_io/test_global_att.sh index 94a0f2dd90..13a9f292fd 100755 --- a/test_fms/fms2_io/test_global_att.sh +++ b/test_fms/fms2_io/test_global_att.sh @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/fms2_io/test_io_simple.F90 b/test_fms/fms2_io/test_io_simple.F90 index b6e82d5a2d..d1262847fc 100644 --- a/test_fms/fms2_io/test_io_simple.F90 +++ b/test_fms/fms2_io/test_io_simple.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> \brief This is a very simple test of FMS IO. diff --git a/test_fms/fms2_io/test_io_simple.sh b/test_fms/fms2_io/test_io_simple.sh index 1c934615c6..3a6744e520 100755 --- a/test_fms/fms2_io/test_io_simple.sh +++ b/test_fms/fms2_io/test_io_simple.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/fms2_io/test_io_with_mask.F90 b/test_fms/fms2_io/test_io_with_mask.F90 index 77e1a5163f..ce6e7951e4 100644 --- a/test_fms/fms2_io/test_io_with_mask.F90 +++ b/test_fms/fms2_io/test_io_with_mask.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** program test_io_with_mask diff --git a/test_fms/fms2_io/test_io_with_mask.sh b/test_fms/fms2_io/test_io_with_mask.sh index 2fe9c2e2ce..017e7b1bc2 100755 --- a/test_fms/fms2_io/test_io_with_mask.sh +++ b/test_fms/fms2_io/test_io_with_mask.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/fms2_io/test_packed_reads.F90 b/test_fms/fms2_io/test_packed_reads.F90 index bc2a1206a5..665588aaf2 100644 --- a/test_fms/fms2_io/test_packed_reads.F90 +++ b/test_fms/fms2_io/test_packed_reads.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** program test_packed_reads use fms_mod, only: fms_init, fms_end diff --git a/test_fms/fms2_io/test_parallel_writes.F90 b/test_fms/fms2_io/test_parallel_writes.F90 new file mode 100644 index 0000000000..9ba8b3296e --- /dev/null +++ b/test_fms/fms2_io/test_parallel_writes.F90 @@ -0,0 +1,269 @@ +program test_parallel_writes + use fms_mod, only: fms_init, fms_end + use platform_mod, only: r8_kind + use random_numbers_mod, only: randomNumberStream, initializeRandomNumberStream, getRandomNumbers + use mpp_mod, only: mpp_sync, mpp_broadcast, mpp_pe, mpp_root_pe, mpp_error, FATAL + use mpp_domains_mod, only: mpp_define_domains, mpp_define_io_domain, mpp_get_data_domain, domain2d, & + mpp_domains_set_stack_size + use fms2_io_mod, only: FmsNetcdfDomainFile_t, register_field, register_axis, unlimited, open_file, & + close_file, write_data, read_data +use fms_string_utils_mod, only: string + implicit none + + integer, parameter :: nx = 96 !< Size of the "x" dimension + integer, parameter :: ny = 96 !< Size of the "y" dimension + integer, parameter :: nu = 5 !< Size of the "u" dimension + integer, parameter :: nv = 4 !< Size of the "v" dimension + integer, parameter :: nw = 3 !< Size of the "w" dimension + integer, parameter :: nt = 2 !< Number of time levels + + integer, parameter :: layout(2) = [1,6] !< Layout of the domain + type(domain2d) :: domain + integer :: is, ie, js, je !< Starting and ending indices of the data domain + + character(*), parameter :: dim_names(*) = ["x", "y", "u", "v", "w", "t"] + character(*), parameter :: filename = "test_parallel_writes.nc" + + interface init_data + procedure :: init_data_1d + procedure :: init_data_2d + procedure :: init_data_3d + procedure :: init_data_4d + procedure :: init_data_5d + procedure :: init_data_6d + end interface init_data + + interface check_answers + procedure :: check_answers_1d + procedure :: check_answers_2d + procedure :: check_answers_3d + procedure :: check_answers_4d + procedure :: check_answers_5d + procedure :: check_answers_6d + end interface check_answers + + real(r8_kind), allocatable :: data_0d(:,:) + real(r8_kind), allocatable :: data_1d(:,:,:) + real(r8_kind), allocatable :: data_2d(:,:,:,:) + real(r8_kind), allocatable :: data_3d(:,:,:,:,:) + real(r8_kind), allocatable :: data_4d(:,:,:,:,:,:) + real(r8_kind), allocatable :: data_5d(:,:,:,:,:,:,:) + + type(randomNumberStream) :: random_stream + + call fms_init + call define_domain + + random_stream = initializeRandomNumberStream(mpp_pe()) + + allocate(data_0d(nt, 2)) + allocate(data_1d(nu, nt, 2)) + allocate(data_2d(is:ie, js:je, nt, 2)) + allocate(data_3d(is:ie, js:je, nu, nt, 2)) + allocate(data_4d(is:ie, js:je, nu, nv, nt, 2)) + allocate(data_5d(is:ie, js:je, nu, nv, nw, nt, 2)) + + if (mpp_pe().eq.mpp_root_pe()) then + call init_data(data_0d(:,1)) + call init_data(data_1d(:,:,1)) + endif + + call mpp_broadcast(data_0d(:,1), nt, mpp_root_pe()) + call mpp_broadcast(data_1d(:,:,1), nu*nt, mpp_root_pe()) + + call init_data(data_2d(:,:,:,1)) + call init_data(data_3d(:,:,:,:,1)) + call init_data(data_4d(:,:,:,:,:,1)) + call init_data(data_5d(:,:,:,:,:,:,1)) + + call write_netcdf + call mpp_sync + call read_netcdf + + call check_answers(data_0d) + call check_answers(data_1d) + call check_answers(data_2d) + call check_answers(data_3d) + call check_answers(data_4d) + call check_answers(data_5d) + + call fms_end + +contains + + subroutine define_domain + call mpp_domains_set_stack_size(17280000) + call mpp_define_domains( [1,nx,1,ny], layout, domain, xhalo=0, yhalo=0) + call mpp_define_io_domain(domain, [1,1]) + call mpp_get_data_domain(domain, is, ie, js, je) + end subroutine define_domain + + subroutine check_answers_1d(arr) + real(r8_kind), intent(in) :: arr(:,:) + + if (any(arr(:, 1).ne.arr(:, 2))) then + call mpp_error(FATAL, "The data written out do not match the data read back in") + endif + end subroutine check_answers_1d + + subroutine check_answers_2d(arr) + real(r8_kind), intent(in) :: arr(:,:,:) + + if (any(arr(:, :, 1).ne.arr(:, :, 2))) then + call mpp_error(FATAL, "The data written out do not match the data read back in") + endif + end subroutine check_answers_2d + + subroutine check_answers_3d(arr) + real(r8_kind), intent(in) :: arr(:,:,:,:) + + if (any(arr(:, :, :, 1).ne.arr(:, :, :, 2))) then + call mpp_error(FATAL, "The data written out do not match the data read back in") + endif + end subroutine check_answers_3d + + subroutine check_answers_4d(arr) + real(r8_kind), intent(in) :: arr(:,:,:,:,:) + + if (any(arr(:, :, :, :, 1).ne.arr(:, :, :, :, 2))) then + call mpp_error(FATAL, "The data written out do not match the data read back in") + endif + end subroutine check_answers_4d + + subroutine check_answers_5d(arr) + real(r8_kind), intent(in) :: arr(:,:,:,:,:,:) + + if (any(arr(:, :, :, :, :, 1).ne.arr(:, :, :, :, :, 2))) then + call mpp_error(FATAL, "The data written out do not match the data read back in") + endif + end subroutine check_answers_5d + + subroutine check_answers_6d(arr) + real(r8_kind), intent(in) :: arr(:,:,:,:,:,:,:) + + if (any(arr(:, :, :, :, :, :, 1).ne.arr(:, :, :, :, :, :, 2))) then + call mpp_error(FATAL, "The data written out do not match the data read back in") + endif + end subroutine check_answers_6d + + subroutine init_data_1d(arr) + real(r8_kind), intent(out) :: arr(:) + + call getRandomNumbers(random_stream, arr) + end subroutine init_data_1d + + subroutine init_data_2d(arr) + real(r8_kind), intent(out) :: arr(:,:) + + call getRandomNumbers(random_stream, arr) + end subroutine init_data_2d + + subroutine init_data_3d(arr) + real(r8_kind), intent(out) :: arr(:,:,:) + integer :: i, n + + n = size(arr, 3) + do i = 1, n + call init_data(arr(:, :, i)) + enddo + end subroutine init_data_3d + + subroutine init_data_4d(arr) + real(r8_kind), intent(out) :: arr(:,:,:,:) + integer :: i, n + + n = size(arr, 4) + do i = 1, n + call init_data(arr(:, :, :, i)) + enddo + end subroutine init_data_4d + + subroutine init_data_5d(arr) + real(r8_kind), intent(out) :: arr(:,:,:,:,:) + integer :: i, n + + n = size(arr, 5) + do i = 1, n + call init_data(arr(:, :, :, :, i)) + enddo + end subroutine init_data_5d + + subroutine init_data_6d(arr) + real(r8_kind), intent(out) :: arr(:,:,:,:,:,:) + integer :: i, n + + n = size(arr, 6) + do i = 1, n + call init_data(arr(:, :, :, :, :, i)) + enddo + end subroutine init_data_6d + + subroutine netcdf_file_register_fields(fileobj) + type(FmsNetcdfDomainFile_t), intent(inout) :: fileobj + + call register_axis(fileobj, dim_names(1), "x") + call register_axis(fileobj, dim_names(2), "y") + call register_axis(fileobj, dim_names(3), nu) + call register_axis(fileobj, dim_names(4), nv) + call register_axis(fileobj, dim_names(5), nw) + call register_axis(fileobj, dim_names(6), unlimited) + + call register_field(fileobj, "random_0d", "double", & + pack(dim_names, [.false., .false., .false., .false., .false., .true.])) + call register_field(fileobj, "random_1d", "double", & + pack(dim_names, [.false., .false., .true., .false., .false., .true.])) + call register_field(fileobj, "random_2d", "double", & + pack(dim_names, [.true., .true., .false., .false., .false., .true.])) + call register_field(fileobj, "random_3d", "double", & + pack(dim_names, [.true., .true., .true., .false., .false., .true.])) + call register_field(fileobj, "random_4d", "double", & + pack(dim_names, [.true., .true., .true., .true., .false., .true.])) + call register_field(fileobj, "random_5d", "double", & + pack(dim_names, [.true., .true., .true., .true., .true., .true.])) + end subroutine netcdf_file_register_fields + + subroutine write_netcdf + type(FmsNetcdfDomainFile_t) :: fileobj + integer :: i + + if (.not.open_file(fileobj, filename, "overwrite", domain, use_netcdf_mpi=.true., & + use_collective=.true.)) then + call mpp_error(FATAL, "Unable to open the NetCDF file for writing") + endif + + call netcdf_file_register_fields(fileobj) + + do i = 1, nt + call write_data(fileobj, "random_0d", data_0d(i, 1), unlim_dim_level=i) + call write_data(fileobj, "random_1d", data_1d(:, i, 1), unlim_dim_level=i) + call write_data(fileobj, "random_2d", data_2d(:, :, i, 1), unlim_dim_level=i) + call write_data(fileobj, "random_3d", data_3d(:, :, :, i, 1), unlim_dim_level=i) + call write_data(fileobj, "random_4d", data_4d(:, :, :, :, i, 1), unlim_dim_level=i) + call write_data(fileobj, "random_5d", data_5d(:, :, :, :, :, i, 1), unlim_dim_level=i) + enddo + + call close_file(fileobj) + end subroutine write_netcdf + + subroutine read_netcdf + type(FmsNetcdfDomainFile_t) :: fileobj + integer :: i + + if (.not.open_file(fileobj, filename, "read", domain)) then + call mpp_error(FATAL, "Unable to open the NetCDF file for reading") + endif + + call netcdf_file_register_fields(fileobj) + + do i = 1, nt + call read_data(fileobj, "random_0d", data_0d(i, 2), unlim_dim_level=i) + call read_data(fileobj, "random_1d", data_1d(:, i, 2), unlim_dim_level=i) + call read_data(fileobj, "random_2d", data_2d(:, :, i, 2), unlim_dim_level=i) + call read_data(fileobj, "random_3d", data_3d(:, :, :, i, 2), unlim_dim_level=i) + call read_data(fileobj, "random_4d", data_4d(:, :, :, :, i, 2), unlim_dim_level=i) + call read_data(fileobj, "random_5d", data_5d(:, :, :, :, :, i, 2), unlim_dim_level=i) + enddo + + call close_file(fileobj) + end subroutine read_netcdf +end program test_parallel_writes diff --git a/test_fms/fms2_io/test_read_ascii_file.F90 b/test_fms/fms2_io/test_read_ascii_file.F90 index 0b38fc8420..ee6bbff66d 100644 --- a/test_fms/fms2_io/test_read_ascii_file.F90 +++ b/test_fms/fms2_io/test_read_ascii_file.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file diff --git a/test_fms/fms2_io/test_read_ascii_file.sh b/test_fms/fms2_io/test_read_ascii_file.sh index 030d36a20e..c03ea36b6b 100755 --- a/test_fms/fms2_io/test_read_ascii_file.sh +++ b/test_fms/fms2_io/test_read_ascii_file.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/fms2_io/test_unlimit_compressed.F90 b/test_fms/fms2_io/test_unlimit_compressed.F90 index d086005d08..85c759e468 100644 --- a/test_fms/fms2_io/test_unlimit_compressed.F90 +++ b/test_fms/fms2_io/test_unlimit_compressed.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief This programs tests the register_unlimited_compressed_axis feature in diff --git a/test_fms/horiz_interp/Makefile.am b/test_fms/horiz_interp/Makefile.am index 27de50a932..078486593c 100644 --- a/test_fms/horiz_interp/Makefile.am +++ b/test_fms/horiz_interp/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the test_fms/horiz_interp directory of @@ -36,9 +35,9 @@ test_horiz_interp_r4_SOURCES = test_horiz_interp.F90 test_horiz_interp_r8_SOURCES = test_horiz_interp.F90 test_create_xgrid_order2_r8_SOURCES = test_create_xgrid_order2.F90 -test_horiz_interp_r4_CPPFLAGS=-DHI_TEST_KIND=4 -I$(MODDIR) -test_horiz_interp_r8_CPPFLAGS=-DHI_TEST_KIND=8 -I$(MODDIR) -test_create_xgrid_order2_r8_CPPFLAGS=-DHI_TEST_KIND_=8 -I$(MODDIR) +test_horiz_interp_r4_CPPFLAGS=-DTEST_FMS_KIND_=4 -I$(MODDIR) +test_horiz_interp_r8_CPPFLAGS=-DTEST_FMS_KIND_=8 -I$(MODDIR) +test_create_xgrid_order2_r8_CPPFLAGS=-DTEST_FMS_KIND_=8 -I$(MODDIR) TEST_EXTENSIONS = .sh SH_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ diff --git a/test_fms/horiz_interp/test_create_xgrid_order2.F90 b/test_fms/horiz_interp/test_create_xgrid_order2.F90 index 5a3252c303..dc0309303e 100644 --- a/test_fms/horiz_interp/test_create_xgrid_order2.F90 +++ b/test_fms/horiz_interp/test_create_xgrid_order2.F90 @@ -1,21 +1,20 @@ !*********************************************************************** -! GNU Lesser General Public License -! -! This file is part of the GFDL Flexible Modeling System (FMS). -! -! FMS is free software: you can redistribute it and/or modify it under -! the terms of the GNU Lesser General Public License as published by -! the Free Software Foundation, either version 3 of the License, or (at -! your option) any later version. -! -! FMS is distributed in the hope that it will be useful, but WITHOUT -! ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -! FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -! for more details. -! -! You should have received a copy of the GNU Lesser General Public -! License along with FMS. If not, see . -!**********************************************************************/ +!* Apache License 2.0 +!* +!* This file is part of the GFDL Flexible Modeling System (FMS). +!* +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at +!* +!* http://www.apache.org/licenses/LICENSE-2.0 +!* +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. +!***********************************************************************/ !> This program ensures all necessary functions exist in grid_utils for !! creating the exchange grid for second order remapping. !! The first order exchange grid creation is tested in test_horiz_interp. @@ -26,9 +25,10 @@ program test_create_xgrid_order2 use horiz_interp_mod use constants_mod, only: DEG_TO_RAD + use platform_mod implicit none - integer, parameter :: lkind = HI_TEST_KIND_ + integer, parameter :: lkind = TEST_FMS_KIND_ integer, parameter :: nlon_in = 10 !< number of input grid cells in lon direction integer, parameter :: nlat_in = 10 !< number of input grid cells in the lat direction @@ -38,19 +38,19 @@ program test_create_xgrid_order2 integer, parameter :: ngridpts_out = (nlon_out+1)*(nlat_out+1) !< number of output gridpoints integer, parameter :: nxgrid = nlon_out *nlat_out !< expected number of exchange grid cells - real(HI_TEST_KIND_) :: lon_in(ngridpts_in) !< longitudinal values of input grid cell vertices - real(HI_TEST_KIND_) :: lat_in(ngridpts_in) !< latitudinal values of input grid cell vertices - real(HI_TEST_KIND_) :: lon_out(ngridpts_out) !< longitudinal values of output grid cell vertices - real(HI_TEST_KIND_) :: lat_out(ngridpts_out) !< latitudinal values of output grid cell vertices - real(HI_TEST_KIND_) :: mask(nlon_in*nlat_in) !< mask to skip input grid cell + real(TEST_FMS_KIND_) :: lon_in(ngridpts_in) !< longitudinal values of input grid cell vertices + real(TEST_FMS_KIND_) :: lat_in(ngridpts_in) !< latitudinal values of input grid cell vertices + real(TEST_FMS_KIND_) :: lon_out(ngridpts_out) !< longitudinal values of output grid cell vertices + real(TEST_FMS_KIND_) :: lat_out(ngridpts_out) !< latitudinal values of output grid cell vertices + real(TEST_FMS_KIND_) :: mask(nlon_in*nlat_in) !< mask to skip input grid cell integer :: i_in(nxgrid) !< input parent cell indices integer :: j_in(nxgrid) !< input parent cell indices integer :: i_out(nxgrid) !< output parent cell indices integer :: j_out(nxgrid) !< output parent cell indices - real(HI_TEST_KIND_) :: xgrid_area(nxgrid) !< exchange grid cell areas - real(HI_TEST_KIND_) :: xgrid_clon(nxgrid) !< longitudinal values of exchange grid cell centroid point - real(HI_TEST_KIND_) :: xgrid_clat(nxgrid) !< latitudinal values of exchange grid cell centroid point + real(TEST_FMS_KIND_) :: xgrid_area(nxgrid) !< exchange grid cell areas + real(TEST_FMS_KIND_) :: xgrid_clon(nxgrid) !< longitudinal values of exchange grid cell centroid point + real(TEST_FMS_KIND_) :: xgrid_clat(nxgrid) !< latitudinal values of exchange grid cell centroid point mask = 1.0_lkind @@ -68,20 +68,20 @@ subroutine get_grid(nlon, nlat, lon, lat) implicit none integer, intent(in) :: nlon, nlat !< number of cell in lon and lat direction - real(HI_TEST_KIND_), intent(out) :: lon(:), lat(:) !< lon and lat values at cell vertices + real(TEST_FMS_KIND_), intent(out) :: lon(:), lat(:) !< lon and lat values at cell vertices integer :: ilon, ilat, igridpt real :: dlat=0.0_lkind, dlon=0.0_lkind real :: lon_start=0.0_lkind, lat_start=-90.0_lkind*DEG_TO_RAD - dlat = 180._lkind/real(nlat, HI_TEST_KIND_) * DEG_TO_RAD - dlon = 360._lkind/real(nlon, HI_TEST_KIND_) * DEG_TO_RAD + dlat = 180._lkind/real(nlat, TEST_FMS_KIND_) * DEG_TO_RAD + dlon = 360._lkind/real(nlon, TEST_FMS_KIND_) * DEG_TO_RAD igridpt = 1 do ilat=1, nlat+1 do ilon=1, nlon+1 - lon(igridpt) = lon_start + real(ilon-1, HI_TEST_KIND_)*dlon - lat(igridpt) = lat_start + real(ilat-1, HI_TEST_KIND_)*dlat + lon(igridpt) = lon_start + real(ilon-1, TEST_FMS_KIND_)*dlon + lat(igridpt) = lat_start + real(ilat-1, TEST_FMS_KIND_)*dlat igridpt = igridpt + 1 end do end do @@ -97,9 +97,9 @@ subroutine test_create_xgrid_2dx2d_order2(nlon_inl, nlat_inl, nlon_outl, nlat_ou implicit none integer, intent(in) :: nlon_inl, nlat_inl, nlon_outl, nlat_outl, nxgridl !< number of grid cells integer, intent(inout) :: i_inl(:), j_inl(:), i_outl(:), j_outl(:) !< parent cell indices - real(HI_TEST_KIND_), intent(in) :: lon_inl(:), lat_inl(:), lon_outl(:), lat_outl(:) !< lon and lat - real(HI_TEST_KIND_), intent(in) :: maskl(:) !< input grid cell mask - real(HI_TEST_KIND_), intent(out) :: xgrid_areal(:), xgrid_clonl(:), xgrid_clatl(:) !< returned xgrid info + real(TEST_FMS_KIND_), intent(in) :: lon_inl(:), lat_inl(:), lon_outl(:), lat_outl(:) !< lon and lat + real(TEST_FMS_KIND_), intent(in) :: maskl(:) !< input grid cell mask + real(TEST_FMS_KIND_), intent(out) :: xgrid_areal(:), xgrid_clonl(:), xgrid_clatl(:) !< returned xgrid info integer :: create_xgrid_2dx2d_order2 integer :: nxgrid_out diff --git a/test_fms/horiz_interp/test_create_xgrid_order2.sh b/test_fms/horiz_interp/test_create_xgrid_order2.sh index 6076ee3eba..2814564af2 100755 --- a/test_fms/horiz_interp/test_create_xgrid_order2.sh +++ b/test_fms/horiz_interp/test_create_xgrid_order2.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/horiz_interp/test_horiz_interp.F90 b/test_fms/horiz_interp/test_horiz_interp.F90 index 59ccdbb230..efba4bae17 100644 --- a/test_fms/horiz_interp/test_horiz_interp.F90 +++ b/test_fms/horiz_interp/test_horiz_interp.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @author Ryan Mulhall 2023 !> Original test is in test_conserve, modified to test the other 3 interp_method option and mixed precision reals @@ -22,11 +21,6 @@ !! Assignment test checks that the override is copying the data type properly !! TODO some larger tests with different data sets -!! defaults to 8 real kind, make check will compile with both 4 and 8 -#ifndef HI_TEST_KIND_ -#define HI_TEST_KIND_ 8 -#endif - program horiz_interp_test use mpp_mod, only : mpp_init, mpp_exit, mpp_error, FATAL, stdout, mpp_npes, WARNING @@ -66,7 +60,7 @@ program horiz_interp_test integer :: id1, id2, id3, id4 integer :: isc, iec, jsc, jec, i, j integer :: io, ierr, layout(2) - integer, parameter :: lkind = HI_TEST_KIND_ + integer, parameter :: lkind = TEST_FMS_KIND_ call fms_init call mpp_init @@ -110,43 +104,49 @@ program horiz_interp_test !! for finding the nearest points and distances so this gets run for both subroutine test_horiz_interp_spherical !! grid data - real(HI_TEST_KIND_), allocatable, dimension(:,:) :: lat_in_2D, lon_in_2D + real(TEST_FMS_KIND_), allocatable, dimension(:,:) :: lat_in_2D, lon_in_2D type(horiz_interp_type) :: interp_t, interp_copy !! input data - real(HI_TEST_KIND_), allocatable, dimension(:,:) :: data_src, data_dst + real(TEST_FMS_KIND_), allocatable, dimension(:,:) :: data_src, data_dst !! output data - real(HI_TEST_KIND_), allocatable, dimension(:,:) :: lat_out_2D, lon_out_2D - real(HI_TEST_KIND_), allocatable, dimension(:,:,:) :: wghts + real(TEST_FMS_KIND_), allocatable, dimension(:,:) :: lat_out_2D, lon_out_2D + real(TEST_FMS_KIND_), allocatable, dimension(:,:,:) :: wghts !! array sizes and number of lat/lon per index - real(HI_TEST_KIND_) :: dlon_src, dlat_src, dlon_dst, dlat_dst + real(TEST_FMS_KIND_) :: dlon_src, dlat_src, dlon_dst, dlat_dst !! parameters for lon/lat setup - real(HI_TEST_KIND_) :: lon_src_beg = 0._lkind, lon_src_end = 360._lkind - real(HI_TEST_KIND_) :: lat_src_beg = -90._lkind, lat_src_end = 90._lkind - real(HI_TEST_KIND_) :: lon_dst_beg = -280._lkind, lon_dst_end = 80._lkind - real(HI_TEST_KIND_) :: lat_dst_beg = -90._lkind, lat_dst_end = 90._lkind - real(HI_TEST_KIND_) :: D2R = real(PI,HI_TEST_KIND_)/180._lkind - real(HI_TEST_KIND_), parameter :: SMALL = 1.0e-10_lkind + real(TEST_FMS_KIND_) :: lon_src_beg = 0._lkind, lon_src_end = 360._lkind + real(TEST_FMS_KIND_) :: lat_src_beg = -90._lkind, lat_src_end = 90._lkind + real(TEST_FMS_KIND_) :: lon_dst_beg = -280._lkind, lon_dst_end = 80._lkind + real(TEST_FMS_KIND_) :: lat_dst_beg = -90._lkind, lat_dst_end = 90._lkind + real(TEST_FMS_KIND_) :: D2R = real(PI,TEST_FMS_KIND_)/180._lkind + real(TEST_FMS_KIND_) :: tolerance + + if(TEST_FMS_KIND_ == r8_kind) then + tolerance = 1.0e-10_lkind + else + tolerance = 1.0e-5_lkind + endif ! set up longitude and latitude of source/destination grid. - dlon_src = (lon_src_end-lon_src_beg)/real(ni_src, HI_TEST_KIND_) - dlat_src = (lat_src_end-lat_src_beg)/real(nj_src, HI_TEST_KIND_) - dlon_dst = (lon_dst_end-lon_dst_beg)/real(ni_dst, HI_TEST_KIND_) - dlat_dst = (lat_dst_end-lat_dst_beg)/real(nj_dst, HI_TEST_KIND_) + dlon_src = (lon_src_end-lon_src_beg)/real(ni_src, TEST_FMS_KIND_) + dlat_src = (lat_src_end-lat_src_beg)/real(nj_src, TEST_FMS_KIND_) + dlon_dst = (lon_dst_end-lon_dst_beg)/real(ni_dst, TEST_FMS_KIND_) + dlat_dst = (lat_dst_end-lat_dst_beg)/real(nj_dst, TEST_FMS_KIND_) ! set up 2d lon/lat allocate(lon_in_2D(ni_src, nj_src), lat_in_2D(ni_src, nj_src)) do i = 1, ni_src - lon_in_2D(i,:) = lon_src_beg + real(i-1, HI_TEST_KIND_)*dlon_src + lon_in_2D(i,:) = lon_src_beg + real(i-1, TEST_FMS_KIND_)*dlon_src end do do j = 1, nj_src - lat_in_2D(:,j) = lat_src_beg + real(j-1, HI_TEST_KIND_)*dlat_src + lat_in_2D(:,j) = lat_src_beg + real(j-1, TEST_FMS_KIND_)*dlat_src end do allocate(lon_out_2D(ni_dst, nj_dst), lat_out_2D(ni_dst, nj_dst)) do i = 1, ni_dst - lon_out_2D(i,:) = lon_dst_beg + real(i-1, HI_TEST_KIND_)*dlon_dst + lon_out_2D(i,:) = lon_dst_beg + real(i-1, TEST_FMS_KIND_)*dlon_dst end do do j = 1, nj_dst - lat_out_2D(:,j) = lat_src_beg + real(j-1, HI_TEST_KIND_)*dlat_dst + lat_out_2D(:,j) = lat_src_beg + real(j-1, TEST_FMS_KIND_)*dlat_dst end do ! scale to radians @@ -176,7 +176,7 @@ subroutine test_horiz_interp_spherical call mpp_clock_end(id1) do i=1, ni_dst-1 do j=1, nj_dst-1 - if(data_dst(i,j) - 1.0_lkind .gt. SMALL) then + if(data_dst(i,j) - 1.0_lkind .gt. tolerance) then print *, 'data_dst(i=', i, ', j=', j, ')=', data_dst(i,j), ' Expected value: 1.0' call mpp_error(FATAL, "test_horiz_interp_spherical: "// & "invalid output data after interpolation") @@ -198,13 +198,13 @@ subroutine test_horiz_interp_spherical !> Tests bilinear module interpolation with each dimension conversion !! test without passing in the type when test_solo is true subroutine test_horiz_interp_bilinear - real(HI_TEST_KIND_) :: dlon_src, dlat_src, dlon_dst, dlat_dst - real(HI_TEST_KIND_), allocatable, dimension(:) :: lon1D_src, lat1D_src, lon1D_dst, lat1D_dst - real(HI_TEST_KIND_), allocatable, dimension(:,:) :: lon2D_src, lat2d_src, lon2D_dst, lat2D_dst - real(HI_TEST_KIND_), allocatable, dimension(:,:) :: data_src, data_dst - real(HI_TEST_KIND_) :: lon_src_beg = 0._lkind, lon_src_end = 360.0_lkind - real(HI_TEST_KIND_) :: lat_src_beg = -90._lkind, lat_src_end = 90._lkind - real(HI_TEST_KIND_), parameter :: D2R = real(PI,lkind)/180._lkind + real(TEST_FMS_KIND_) :: dlon_src, dlat_src, dlon_dst, dlat_dst + real(TEST_FMS_KIND_), allocatable, dimension(:) :: lon1D_src, lat1D_src, lon1D_dst, lat1D_dst + real(TEST_FMS_KIND_), allocatable, dimension(:,:) :: lon2D_src, lat2d_src, lon2D_dst, lat2D_dst + real(TEST_FMS_KIND_), allocatable, dimension(:,:) :: data_src, data_dst + real(TEST_FMS_KIND_) :: lon_src_beg = 0._lkind, lon_src_end = 360.0_lkind + real(TEST_FMS_KIND_) :: lat_src_beg = -90._lkind, lat_src_end = 90._lkind + real(TEST_FMS_KIND_), parameter :: D2R = real(PI,lkind)/180._lkind type(horiz_interp_type) :: interp, interp_copy @@ -223,24 +223,24 @@ subroutine test_horiz_interp_bilinear allocate( data_dst(ni_src,nj_src) ) ! set up longitude and latitude of source/destination grid. - dlon_src = (lon_src_end-lon_src_beg)/real(ni_src,HI_TEST_KIND_) ; dlon_dst = dlon_src - dlat_src = (lat_src_end-lat_src_beg)/real(nj_src,HI_TEST_KIND_) ; dlat_dst = dlat_src + dlon_src = (lon_src_end-lon_src_beg)/real(ni_src,TEST_FMS_KIND_) ; dlon_dst = dlon_src + dlat_src = (lat_src_end-lat_src_beg)/real(nj_src,TEST_FMS_KIND_) ; dlat_dst = dlat_src ! set up 1d source grid do i = 1, ni_src - lon1D_src(i) = ( lon_src_beg + real(i-1,HI_TEST_KIND_)*dlon_src ) * D2R + lon1D_src(i) = ( lon_src_beg + real(i-1,TEST_FMS_KIND_)*dlon_src ) * D2R end do - lon1D_src(ni_src+1) = ( lon_src_beg + real(ni_src,HI_TEST_KIND_)*dlon_src ) * D2R + lon1D_src(ni_src+1) = ( lon_src_beg + real(ni_src,TEST_FMS_KIND_)*dlon_src ) * D2R do j = 1, nj_src - lat1D_src(j) = ( lat_src_beg + real(j-1,HI_TEST_KIND_)*dlat_src ) * D2R + lat1D_src(j) = ( lat_src_beg + real(j-1,TEST_FMS_KIND_)*dlat_src ) * D2R end do - lat1D_src(nj_src+1) = ( lat_src_beg + real(nj_src,HI_TEST_KIND_)*dlat_src ) * D2R + lat1D_src(nj_src+1) = ( lat_src_beg + real(nj_src,TEST_FMS_KIND_)*dlat_src ) * D2R !--- set up the source data do j = 1, nj_src do i = 1, ni_src - data_src(i,j) = real(i,HI_TEST_KIND_) + real(j,HI_TEST_KIND_)*0.001_lkind + data_src(i,j) = real(i,TEST_FMS_KIND_) + real(j,TEST_FMS_KIND_)*0.001_lkind end do end do @@ -632,24 +632,31 @@ end subroutine test_horiz_interp_bilinear !! test without passing in the type when test_solo is true subroutine test_horiz_interp_bicubic !! grid data - real(HI_TEST_KIND_), allocatable, dimension(:) :: lat_in_1D, lon_in_1D + real(TEST_FMS_KIND_), allocatable, dimension(:) :: lat_in_1D, lon_in_1D type(horiz_interp_type) :: interp_t, interp_copy !! input data - real(HI_TEST_KIND_), allocatable, dimension(:,:) :: data_src, data_dst + real(TEST_FMS_KIND_), allocatable, dimension(:,:) :: data_src, data_dst !! output data - real(HI_TEST_KIND_), allocatable, dimension(:) :: lat_out_1D, lon_out_1D - real(HI_TEST_KIND_), allocatable, dimension(:,:) :: lat_out_2D, lon_out_2D + real(TEST_FMS_KIND_), allocatable, dimension(:) :: lat_out_1D, lon_out_1D + real(TEST_FMS_KIND_), allocatable, dimension(:,:) :: lat_out_2D, lon_out_2D !! array sizes and number of lat/lon per index - real(HI_TEST_KIND_) :: nlon_in, nlat_in - real(HI_TEST_KIND_) :: nlon_out, nlat_out - real(HI_TEST_KIND_) :: dlon_src, dlat_src, dlon_dst, dlat_dst + real(TEST_FMS_KIND_) :: nlon_in, nlat_in + real(TEST_FMS_KIND_) :: nlon_out, nlat_out + real(TEST_FMS_KIND_) :: dlon_src, dlat_src, dlon_dst, dlat_dst !! parameters for lon/lat setup - real(HI_TEST_KIND_) :: lon_src_beg = 0._lkind, lon_src_end = 360._lkind - real(HI_TEST_KIND_) :: lat_src_beg = -90._lkind, lat_src_end = 90._lkind - real(HI_TEST_KIND_) :: lon_dst_beg = -280._lkind, lon_dst_end = 80._lkind - real(HI_TEST_KIND_) :: lat_dst_beg = -90._lkind, lat_dst_end = 90._lkind - real(HI_TEST_KIND_) :: D2R = real(PI,HI_TEST_KIND_)/180._lkind - real(HI_TEST_KIND_), parameter :: SMALL = 1.0e-10_lkind + real(TEST_FMS_KIND_) :: lon_src_beg = 0._lkind, lon_src_end = 360._lkind + real(TEST_FMS_KIND_) :: lat_src_beg = -90._lkind, lat_src_end = 90._lkind + real(TEST_FMS_KIND_) :: lon_dst_beg = -280._lkind, lon_dst_end = 80._lkind + real(TEST_FMS_KIND_) :: lat_dst_beg = -90._lkind, lat_dst_end = 90._lkind + real(TEST_FMS_KIND_) :: D2R = real(PI,TEST_FMS_KIND_)/180._lkind + real(TEST_FMS_KIND_) :: SMALL + + ! adjust tolerance used in checks based on kind size + if(TEST_FMS_KIND_ == r8_kind) then + small = 1.0e-10_lkind + else + small = 1.0e-3_lkind + end if ! set up longitude and latitude of source/destination grid. dlon_src = (lon_src_end-lon_src_beg)/real(ni_src, lkind) @@ -716,13 +723,14 @@ subroutine test_horiz_interp_bicubic if( interp_t%horizInterpReals4_type%is_allocated) then if( interp_t%horizInterpReals4_type%wti(i,j,1) * interp_t%horizInterpReals4_type%wti(i,j,2) & - interp_t%horizInterpReals4_type%wti(i,j,3) .gt. SMALL .or. & - interp_t%horizInterpReals4_type%wti(i,j,3) - (57.2958_lkind * 57.2958_lkind) .gt. SMALL) then + interp_t%horizInterpReals4_type%wti(i,j,3) - (57.2958_lkind * 57.2958_lkind) & + .gt. 1.0e-1_lkind) then print *, i, j, interp_t%horizInterpReals4_type%wti(i,j,:) call mpp_error(FATAL, "test_horiz_interp: bicubic test failed 1Dx1D weight calculation") endif else if( interp_t%horizInterpReals8_type%wti(i,j,1) * interp_t%horizInterpReals8_type%wti(i,j,2) & - - interp_t%horizInterpReals8_type%wti(i,j,3) .gt. SMALL .and. & + - interp_t%horizInterpReals8_type%wti(i,j,3) .gt. SMALL .or. & interp_t%horizInterpReals8_type%wti(i,j,3) - (57.2958_lkind * 57.2958_lkind) .gt. SMALL) then print *, i, j, interp_t%horizInterpReals8_type%wti(i,j,:) call mpp_error(FATAL, "test_horiz_interp: bicubic test failed 1Dx1D weight calculation") @@ -762,7 +770,8 @@ subroutine test_horiz_interp_bicubic if( interp_t%horizInterpReals4_type%is_allocated) then if( interp_t%horizInterpReals4_type%wti(i,j,1) * interp_t%horizInterpReals4_type%wti(i,j,2) & - interp_t%horizInterpReals4_type%wti(i,j,3) .gt. SMALL .or. & - interp_t%horizInterpReals4_type%wti(i,j,3) - (57.2958_lkind * 57.2958_lkind) .gt. SMALL) then + interp_t%horizInterpReals4_type%wti(i,j,3) - (57.2958_lkind * 57.2958_lkind) .gt. 1.0e-1_lkind)& + then print *, i, j, interp_t%horizInterpReals4_type%wti(i,j,:) call mpp_error(FATAL, "test_horiz_interp: bicubic test failed 1Dx1D weight calculation") endif @@ -795,16 +804,16 @@ end subroutine test_horiz_interp_bicubic !> Tests conservative (default) interpolation module and checks grids reproduce across 1/2d versions subroutine test_horiz_interp_conserve - real(HI_TEST_KIND_) :: dlon_src, dlat_src, dlon_dst, dlat_dst - real(HI_TEST_KIND_), allocatable, dimension(:) :: lon1D_src, lat1D_src, lon1D_dst, lat1D_dst - real(HI_TEST_KIND_), allocatable, dimension(:,:) :: lon2D_src, lat2D_src, lon2D_dst, lat2D_dst - real(HI_TEST_KIND_), allocatable, dimension(:,:) :: data_src, data1_dst, data2_dst, data3_dst, data4_dst - real(HI_TEST_KIND_) :: lon_src_beg = 0._lkind, lon_src_end = 360._lkind - real(HI_TEST_KIND_) :: lat_src_beg = -90._lkind, lat_src_end = 90._lkind - real(HI_TEST_KIND_) :: lon_dst_beg = -280._lkind, lon_dst_end = 80._lkind - real(HI_TEST_KIND_) :: lat_dst_beg = -90._lkind, lat_dst_end = 90._lkind - real(HI_TEST_KIND_) :: D2R = real(PI,HI_TEST_KIND_)/180._lkind - real(HI_TEST_KIND_), parameter :: SMALL = 1.0e-10_lkind + real(TEST_FMS_KIND_) :: dlon_src, dlat_src, dlon_dst, dlat_dst + real(TEST_FMS_KIND_), allocatable, dimension(:) :: lon1D_src, lat1D_src, lon1D_dst, lat1D_dst + real(TEST_FMS_KIND_), allocatable, dimension(:,:) :: lon2D_src, lat2D_src, lon2D_dst, lat2D_dst + real(TEST_FMS_KIND_), allocatable, dimension(:,:) :: data_src, data1_dst, data2_dst, data3_dst, data4_dst + real(TEST_FMS_KIND_) :: lon_src_beg = 0._lkind, lon_src_end = 360._lkind + real(TEST_FMS_KIND_) :: lat_src_beg = -90._lkind, lat_src_end = 90._lkind + real(TEST_FMS_KIND_) :: lon_dst_beg = -280._lkind, lon_dst_end = 80._lkind + real(TEST_FMS_KIND_) :: lat_dst_beg = -90._lkind, lat_dst_end = 90._lkind + real(TEST_FMS_KIND_) :: D2R = real(PI,TEST_FMS_KIND_)/180._lkind + real(TEST_FMS_KIND_), parameter :: SMALL = 1.0e-10_lkind type(horiz_interp_type) :: interp_conserve, interp_copy allocate(lon2D_src(ni_src+1, nj_src+1), lat2D_src(ni_src+1, nj_src+1) ) @@ -993,24 +1002,24 @@ subroutine test_horiz_interp_conserve !! they can be created/deleted without allocation errors. subroutine test_assignment() type(horiz_interp_type) :: Interp_new1, Interp_new2, Interp_cp - real(HI_TEST_KIND_), allocatable, dimension(:) :: lat_in_1D, lon_in_1D !< 1D grid data points - real(HI_TEST_KIND_), allocatable, dimension(:,:) :: lat_in_2D, lon_in_2D !< 2D grid data points - real(HI_TEST_KIND_), allocatable, dimension(:) :: lat_out_1D, lon_out_1D !< 1D grid output points - real(HI_TEST_KIND_), allocatable, dimension(:,:) :: lat_out_2D, lon_out_2D !< 2D grid output points + real(TEST_FMS_KIND_), allocatable, dimension(:) :: lat_in_1D, lon_in_1D !< 1D grid data points + real(TEST_FMS_KIND_), allocatable, dimension(:,:) :: lat_in_2D, lon_in_2D !< 2D grid data points + real(TEST_FMS_KIND_), allocatable, dimension(:) :: lat_out_1D, lon_out_1D !< 1D grid output points + real(TEST_FMS_KIND_), allocatable, dimension(:,:) :: lat_out_2D, lon_out_2D !< 2D grid output points integer :: nlon_in, nlat_in !< array sizes for input grids integer :: nlon_out, nlat_out !< array sizes for output grids - real(HI_TEST_KIND_) :: dlon_src, dlat_src, dlon_dst, dlat_dst !< lon/lat size per data point - real(HI_TEST_KIND_) :: lon_src_beg = 0._lkind, lon_src_end = 360._lkind!< source grid starting/ending + real(TEST_FMS_KIND_) :: dlon_src, dlat_src, dlon_dst, dlat_dst !< lon/lat size per data point + real(TEST_FMS_KIND_) :: lon_src_beg = 0._lkind, lon_src_end = 360._lkind!< source grid starting/ending !! longitudes - real(HI_TEST_KIND_) :: lat_src_beg = -90._lkind, lat_src_end = 90._lkind !< source grid starting/ending + real(TEST_FMS_KIND_) :: lat_src_beg = -90._lkind, lat_src_end = 90._lkind !< source grid starting/ending !! latitudes - real(HI_TEST_KIND_) :: lon_dst_beg = 0.0_lkind, lon_dst_end = 360._lkind !< destination grid + real(TEST_FMS_KIND_) :: lon_dst_beg = 0.0_lkind, lon_dst_end = 360._lkind !< destination grid !! starting/ending longitudes - real(HI_TEST_KIND_) :: lat_dst_beg = -90._lkind, lat_dst_end = 90._lkind !< destination grid + real(TEST_FMS_KIND_) :: lat_dst_beg = -90._lkind, lat_dst_end = 90._lkind !< destination grid !! starting/ending latitudes - real(HI_TEST_KIND_) :: D2R = real(PI,HI_TEST_KIND_)/180._lkind !< radians per degree - real(HI_TEST_KIND_), allocatable :: lon_src_1d(:), lat_src_1d(:) !< src data used for bicubic test - real(HI_TEST_KIND_), allocatable :: lon_dst_1d(:), lat_dst_1d(:) !< destination data used for bicubic test + real(TEST_FMS_KIND_) :: D2R = real(PI,TEST_FMS_KIND_)/180._lkind !< radians per degree + real(TEST_FMS_KIND_), allocatable :: lon_src_1d(:), lat_src_1d(:) !< src data used for bicubic test + real(TEST_FMS_KIND_), allocatable :: lon_dst_1d(:), lat_dst_1d(:) !< destination data used for bicubic test integer :: icount !< index for setting the output array when taking midpoints for bilinear @@ -1023,16 +1032,16 @@ subroutine test_assignment() allocate(lon_in_1D(ni_src+1), lat_in_1D(nj_src+1)) allocate(lon_out_1D(isc:iec+1), lat_out_1D(jsc:jec+1)) do i = 1, ni_src+1 - lon_in_1D(i) = lon_src_beg + real(i-1,HI_TEST_KIND_)*dlon_src + lon_in_1D(i) = lon_src_beg + real(i-1,TEST_FMS_KIND_)*dlon_src end do do j = 1, nj_src+1 - lat_in_1D(j) = lat_src_beg + real(j-1,HI_TEST_KIND_)*dlat_src + lat_in_1D(j) = lat_src_beg + real(j-1,TEST_FMS_KIND_)*dlat_src end do do i = isc, iec+1 - lon_out_1D(i) = lon_dst_beg + real(i-1,HI_TEST_KIND_)*dlon_dst + lon_out_1D(i) = lon_dst_beg + real(i-1,TEST_FMS_KIND_)*dlon_dst end do do j = jsc, jec+1 - lat_out_1D(j) = lat_dst_beg + real(j-1, HI_TEST_KIND_)*dlat_dst + lat_out_1D(j) = lat_dst_beg + real(j-1, TEST_FMS_KIND_)*dlat_dst end do lon_in_1D = lon_in_1D * D2R @@ -1158,16 +1167,16 @@ subroutine test_assignment() allocate(lon_out_2D(ni_dst, nj_dst), lat_out_2D(ni_dst, nj_dst)) allocate(lon_in_2D(ni_src, nj_src), lat_in_2D(ni_src, nj_src)) do i = 1, ni_dst - lon_out_2D(i,:) = lon_dst_beg + real(i-1, HI_TEST_KIND_)*dlon_dst + lon_out_2D(i,:) = lon_dst_beg + real(i-1, TEST_FMS_KIND_)*dlon_dst end do do j = 1, nj_dst - lat_out_2D(:,j) = lat_dst_beg + real(j-1, HI_TEST_KIND_)*dlat_dst + lat_out_2D(:,j) = lat_dst_beg + real(j-1, TEST_FMS_KIND_)*dlat_dst end do do i = 1, ni_src - lon_in_2D(i,:) = lon_src_beg + real(i-1, HI_TEST_KIND_)*dlon_src + lon_in_2D(i,:) = lon_src_beg + real(i-1, TEST_FMS_KIND_)*dlon_src end do do j = 1, nj_src - lat_in_2D(:,j) = lat_src_beg + real(j-1, HI_TEST_KIND_)*dlat_src + lat_in_2D(:,j) = lat_src_beg + real(j-1, TEST_FMS_KIND_)*dlat_src end do ! scale to radians lat_in_2D = lat_in_2D * D2R @@ -1215,10 +1224,10 @@ subroutine test_assignment() deallocate(lon_out_1D, lat_out_1D) allocate(lon_out_1D(ni_dst), lat_out_1D(nj_dst)) do i=1, ni_dst - lon_out_1d(i) = real(i-1, HI_TEST_KIND_) * dlon_dst + lon_dst_beg + lon_out_1d(i) = real(i-1, TEST_FMS_KIND_) * dlon_dst + lon_dst_beg enddo do j=1, nj_dst - lat_out_1d(j) = real(j-1, HI_TEST_KIND_) * dlat_dst + lat_dst_beg + lat_out_1d(j) = real(j-1, TEST_FMS_KIND_) * dlat_dst + lat_dst_beg enddo lat_out_1d = lat_out_1D * D2R lon_out_1d = lon_out_1D * D2R diff --git a/test_fms/horiz_interp/test_horiz_interp2.sh b/test_fms/horiz_interp/test_horiz_interp2.sh index cb8868d4e6..944852c7cb 100755 --- a/test_fms/horiz_interp/test_horiz_interp2.sh +++ b/test_fms/horiz_interp/test_horiz_interp2.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/intel_coverage.sh.in b/test_fms/intel_coverage.sh.in index bc452277be..4208266212 100755 --- a/test_fms/intel_coverage.sh.in +++ b/test_fms/intel_coverage.sh.in @@ -1,21 +1,20 @@ #!/usr/bin/sh #*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL Flexible Modeling System (FMS). -# -# FMS is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FMS is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # Produces a code coverage report for each subdirectory using intel's codecov tool # runs with `make check-code-coverage` after configuring with `--enable-code-coverage` diff --git a/test_fms/interpolator/Makefile.am b/test_fms/interpolator/Makefile.am index f795c3f597..4c22cd38dd 100644 --- a/test_fms/interpolator/Makefile.am +++ b/test_fms/interpolator/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the test_fms/interpolator directory of the FMS @@ -23,10 +22,10 @@ # uramirez, Ed Hartnett # Find the fms_mod.mod file. -AM_CPPFLAGS = -I$(MODDIR) -I$(top_srcdir)/include +AM_CPPFLAGS = -I$(MODDIR) -I$(top_srcdir)/include -I$(top_builddir)/test_fms/common # Link to the FMS library. -LDADD = $(top_builddir)/libFMS/libFMS.la +LDADD = $(top_builddir)/libFMS/libFMS.la $(top_builddir)/test_fms/common/libtest_fms.a # Build this test program. check_PROGRAMS = test_interpolator test_interpolator2_r4 test_interpolator2_r8 @@ -36,8 +35,8 @@ test_interpolator_SOURCES = test_interpolator.F90 test_interpolator2_r4_SOURCES = test_interpolator2.F90 test_interpolator_write_climatology.inc test_interpolator2_r8_SOURCES = test_interpolator2.F90 test_interpolator_write_climatology.inc -test_interpolator2_r4_CPPFLAGS=-DTEST_INTP_KIND_=4 -I$(MODDIR) -test_interpolator2_r8_CPPFLAGS=-DTEST_INTP_KIND_=8 -I$(MODDIR) +test_interpolator2_r4_CPPFLAGS=-DTEST_FMS_KIND_=4 $(AM_CPPFLAGS) +test_interpolator2_r8_CPPFLAGS=-DTEST_FMS_KIND_=8 $(AM_CPPFLAGS) # Run the test program. TESTS = test_interpolator2.sh diff --git a/test_fms/interpolator/test_interpolator.F90 b/test_fms/interpolator/test_interpolator.F90 index 6a5c0b5f02..5bc1dc1727 100644 --- a/test_fms/interpolator/test_interpolator.F90 +++ b/test_fms/interpolator/test_interpolator.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !*********************************************************************** diff --git a/test_fms/interpolator/test_interpolator2.F90 b/test_fms/interpolator/test_interpolator2.F90 index b202eb8b82..8170a6fa68 100644 --- a/test_fms/interpolator/test_interpolator2.F90 +++ b/test_fms/interpolator/test_interpolator2.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !! @brief unit tests for interpolator_mod @@ -40,38 +39,39 @@ program test_interpolator2 use fms_mod, only: fms_init use constants_mod, only: PI use platform_mod, only: r4_kind, r8_kind - + use fms_test_mod, only: permutable_indices_2d, permutable_indices_3d, permutable_indices_4d, factorial, & + arr_compare_tol use interpolator_mod implicit none character(100), parameter :: ncfile='immadeup.o3.climatology.nc' !< fake climatology file - integer, parameter :: lkind=TEST_INTP_KIND_ + integer, parameter :: lkind=TEST_FMS_KIND_ !> the interpolation methods are not perfect.Will not get perfectly agreeing answers - real(r8_kind), parameter :: tol=0.1_lkind + real(TEST_FMS_KIND_), parameter :: tol=1e-1 integer :: calendar_type !> climatology related variables and arrays (made up data) - integer :: nlonlat !< number of latitude and longitudinal center coordinates in file - integer :: nlonlatb !< number of latitude and longitudinal boundary coordinates in file + integer :: nlonlat !< number of latitude and longitudinal center coordinates in file + integer :: nlonlatb !< number of latitude and longitudinal boundary coordinates in file integer :: ntime !< number of time slices integer :: npfull !< number of p levels integer :: nphalf !< number of half p levels - real(TEST_INTP_KIND_), allocatable :: lat(:) !< climatology coordinates - real(TEST_INTP_KIND_), allocatable :: lon(:) !< climatology coordinates - real(TEST_INTP_KIND_), allocatable :: latb(:) !< climatology coordinates - real(TEST_INTP_KIND_), allocatable :: lonb(:) !< climatology coordinates + real(TEST_FMS_KIND_), allocatable :: lat(:) !< climatology coordinates + real(TEST_FMS_KIND_), allocatable :: lon(:) !< climatology coordinates + real(TEST_FMS_KIND_), allocatable :: latb(:) !< climatology coordinates + real(TEST_FMS_KIND_), allocatable :: lonb(:) !< climatology coordinates real(r8_kind), allocatable :: clim_time (:) !< climatology time - real(TEST_INTP_KIND_), allocatable :: pfull(:) !< climatology p level - real(TEST_INTP_KIND_), allocatable :: phalf(:) !< climatology p half level - real(TEST_INTP_KIND_), allocatable :: ozone(:,:,:,:) !< climatology ozone data + real(TEST_FMS_KIND_), allocatable :: pfull(:) !< climatology p level + real(TEST_FMS_KIND_), allocatable :: phalf(:) !< climatology p half level + real(TEST_FMS_KIND_), allocatable :: ozone(:,:,:,:) !< climatology ozone data !> model related variables and arrays integer :: nlonlat_mod, nlonlatb_mod !< number of latitude and longitude coordinates in the model - real(TEST_INTP_KIND_), allocatable :: lat_mod(:,:) !< model coordinates - real(TEST_INTP_KIND_), allocatable :: lon_mod(:,:) !< model coordinates - real(TEST_INTP_KIND_), allocatable :: latb_mod(:,:) !< model coordinates - real(TEST_INTP_KIND_), allocatable :: lonb_mod(:,:) !< model coordinates + real(TEST_FMS_KIND_), allocatable :: lat_mod(:,:) !< model coordinates + real(TEST_FMS_KIND_), allocatable :: lon_mod(:,:) !< model coordinates + real(TEST_FMS_KIND_), allocatable :: latb_mod(:,:) !< model coordinates + real(TEST_FMS_KIND_), allocatable :: lonb_mod(:,:) !< model coordinates !> array holding model times type(time_type), allocatable :: model_time_julian(:), model_time_noleap(:) @@ -143,74 +143,121 @@ subroutine test_interpolator_init(clim_type) call interpolator_init(clim_type,trim(ncfile), lonb_mod, latb_mod, data_out_of_bounds=data_out_of_bounds) end subroutine test_interpolator_init + !===============================================! - subroutine test_interpolator(clim_type, model_time) - !> call the variants of interpolator (4D-2d) that interpolates data at a given time-point - !! The tests here do not test the "no_axis" interpolator routines - !! This subroutine also tests obtain_interpolator_time_slices for the 2D case. + subroutine test_interpolator_2d(clim_type, phalf_in, test_time, answer) + type(interpolate_type), intent(inout) :: clim_type + real(TEST_FMS_KIND_), dimension(:,:,:), intent(in) :: phalf_in + type(time_type), intent(in) :: test_time + real(TEST_FMS_KIND_), intent(in) :: answer - implicit none + real(TEST_FMS_KIND_), allocatable, dimension(:,:) :: interp_data + type(permutable_indices_2d) :: dims + integer :: p + + do p=1,factorial(2) + dims%lb = [1, 1] + dims%ub = [nlonlat, nlonlat] + + call dims%permute(p) + + allocate(interp_data(dims%ub(1), dims%ub(2))) + interp_data = 0. + + !> test interpolator_2D_r4/8 + call interpolator(clim_type, test_time, interp_data, 'ozone') + call arr_compare_tol(interp_data, answer, tol, 'test interpolator_2D') + interp_data = 0. + + !> Test obtain_interpolator_time_slices + call obtain_interpolator_time_slices(clim_type,test_time) + call interpolator(clim_type, test_time, interp_data, 'ozone') + call unset_interpolator_time_flag(clim_type) + call arr_compare_tol(interp_data, answer, tol, 'test interpolator_2D') + + deallocate(interp_data) + enddo + end subroutine test_interpolator_2d + + subroutine test_interpolator_3d(clim_type, phalf_in, test_time, answer) type(interpolate_type), intent(inout) :: clim_type - type(time_type), dimension(ntime), intent(in) :: model_time - type(time_type) :: test_time - real(TEST_INTP_KIND_), dimension(nlonlat_mod,nlonlat_mod,npfull,1) :: interp_data ! test interpolator_3_r4/8 + call interpolator(clim_type, test_time, phalf_in, interp_data, 'ozone') + call arr_compare_tol(interp_data, answer, tol, 'test interpolator_3D') + + deallocate(interp_data) + enddo + end subroutine test_interpolator_3d - real(TEST_INTP_KIND_) :: answer + subroutine test_interpolator_4d(clim_type, phalf_in, test_time, answer) + type(interpolate_type), intent(inout) :: clim_type + real(TEST_FMS_KIND_), dimension(:,:,:), intent(in) :: phalf_in + type(time_type), intent(in) :: test_time + real(TEST_FMS_KIND_), intent(in) :: answer + + real(TEST_FMS_KIND_), allocatable, dimension(:,:,:,:) :: interp_data + type(permutable_indices_4d) :: dims + integer :: p + + do p=1,factorial(4) + dims%lb = [1, 1, 1, 1] + dims%ub = [nlonlat, nlonlat, npfull, 1] + + call dims%permute(p) + + allocate(interp_data(dims%ub(1), dims%ub(2), dims%ub(3), dims%ub(4))) + interp_data = 0. + + !> test interpolator_4D_r4/8 + call interpolator(clim_type, test_time, phalf_in, interp_data, 'ozone') + call arr_compare_tol(interp_data, answer, tol, 'test interpolator_4D') + deallocate(interp_data) + enddo + end subroutine test_interpolator_4d + + !> call the variants of interpolator (4D-2d) that interpolates data at a given time-point + !! The tests here do not test the "no_axis" interpolator routines + !! This subroutine also tests obtain_interpolator_time_slices for the 2D case. + subroutine test_interpolator(clim_type, model_time) + type(interpolate_type), intent(inout) :: clim_type + type(time_type), dimension(ntime), intent(in) :: model_time + type(time_type) :: test_time + real(TEST_FMS_KIND_), dimension(nlonlat_mod,nlonlat_mod,nphalf) :: phalf_in + integer :: itime, i + real(TEST_FMS_KIND_) :: answer do i=1, nphalf phalf_in(:,:,i)=phalf(i) end do do itime=2, ntime-1 - answer=0.5_lkind*ozone(1,1,1,itime-1)+0.5_lkind*ozone(1,1,1,itime) test_time=model_time(itime-1) + (model_time(itime)-model_time(itime-1))/2 - !> test interpolator_4D_r4/8 - call interpolator(clim_type, test_time, phalf_in, interp_data, 'ozone') - do i=1, npfull - do j=1, nlonlat_mod - do k=1, nlonlat_mod - call check_answers(interp_data(k,j,i,1), answer, tol, 'test interpolator_4D') - end do - end do - end do - - !> test interpolator_3_r4/8 - call interpolator(clim_type, test_time, phalf_in, interp_data(:,:,:,1), 'ozone') - do i=1, npfull - do j=1, nlonlat_mod - do k=1, nlonlat_mod - call check_answers(interp_data(k,j,i,1), answer, tol, 'test interpolator_3D') - end do - end do - end do - - !> test interpolator_2D_r4/8 - call interpolator(clim_type, test_time, interp_data(:,:,1,1), 'ozone') - do j=1, nlonlat_mod - do k=1, nlonlat_mod - call check_answers(interp_data(k,j,1,1), answer, tol, 'test interpolator_2D') - end do - end do - - !> Test obtain_interpolator_time_slices - call obtain_interpolator_time_slices(clim_type,test_time) - call interpolator(clim_type, test_time, interp_data(:,:,1,1), 'ozone') - call unset_interpolator_time_flag(clim_type) - do j=1, nlonlat_mod - do k=1, nlonlat_mod - call check_answers(interp_data(k,j,1,1), answer, tol, 'test interpolator_2D') - end do - end do - + call test_interpolator_2d(clim_type, phalf_in, test_time, answer) + call test_interpolator_3d(clim_type, phalf_in, test_time, answer) + call test_interpolator_4d(clim_type, phalf_in, test_time, answer) end do - end subroutine test_interpolator !===============================================! subroutine test_interpolator_end(clim_type) @@ -233,8 +280,8 @@ subroutine test_interpolator_no_time_axis(clim_type) type(interpolate_type) :: clim_type - real(TEST_INTP_KIND_), dimension(nlonlat,nlonlat,npfull,1) :: interp_data !< last column, there is only one field - real(TEST_INTP_KIND_), dimension(nlonlat,nlonlat,nphalf) :: phalf_in + real(TEST_FMS_KIND_), dimension(nlonlat,nlonlat,npfull,1) :: interp_data !< last column, there is only one field + real(TEST_FMS_KIND_), dimension(nlonlat,nlonlat,nphalf) :: phalf_in integer :: i, j, k do i=1, nphalf @@ -243,31 +290,15 @@ subroutine test_interpolator_no_time_axis(clim_type) !> test interpolator_4D_no_time_axis_r4/8 call interpolator(clim_type, phalf_in, interp_data, 'ozone') - do i=1, npfull - do j=1, nlonlat - do k=1, nlonlat - call check_answers(interp_data(k,j,i,1), ozone(k,j,i,1), tol, 'test interpolator_4D_no_time_axis') - end do - end do - end do + call arr_compare_tol(interp_data(:,:,:,:), ozone(:,:,:,:), tol, 'test interpolator_4D_no_time_axis') !> test interpolator_3D_no_time_axis_r4/8 call interpolator(clim_type, phalf_in, interp_data(:,:,:,1), 'ozone') - do i=1, npfull - do j=1, nlonlat - do k=1, nlonlat - call check_answers(interp_data(k,j,i,1), ozone(k,j,i,1), tol, 'test interpolator_3D_no_time_axis') - end do - end do - end do + call arr_compare_tol(interp_data(:,:,:,1), ozone(:,:,:,1), tol, 'test interpolator_3D_no_time_axis') !> test interpolator_2D_no_time_axis_r4/8 call interpolator(clim_type, interp_data(:,:,1,1), 'ozone') - do j=1, nlonlat - do k=1, nlonlat - call check_answers(interp_data(k,j,1,1), ozone(k,j,1,1), tol, 'test interpolator_2D_no_time_axis') - end do - end do + call arr_compare_tol(interp_data(:,:,1,1), ozone(:,:,1,1), tol, 'test interpolator_2D_no_time_axis') end subroutine test_interpolator_no_time_axis !===============================================! @@ -340,21 +371,6 @@ subroutine run_test_set end subroutine run_test_set !===============================================! - subroutine check_answers(results, answers, tol, whoami) - - implicit none - real(TEST_INTP_KIND_), intent(in) :: results, answers - real(r8_kind), intent(in) :: tol - character(*) :: whoami - - if (real(abs(results-answers),r8_kind).gt.tol) then - !if (results.ne.answers) then - write(*,*) ' EXPECTED ', answers, ' but computed ', results - call mpp_error(FATAL, trim(whoami)) - end if - - end subroutine check_answers - !===============================================! subroutine write_header diff --git a/test_fms/interpolator/test_interpolator2.sh b/test_fms/interpolator/test_interpolator2.sh index 7248b92c22..bd4cf7aab6 100755 --- a/test_fms/interpolator/test_interpolator2.sh +++ b/test_fms/interpolator/test_interpolator2.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to @@ -27,6 +26,16 @@ # Set common test settings. . ../test-lib.sh +# TODO: Enable these tests once generalized indices work is complete +SKIP_TESTS="test_interpolator2.2 \ + test_interpolator2.3 \ + test_interpolator2.4 \ + test_interpolator2.5 \ + test_interpolator2.6 \ + test_interpolator2.7 \ + test_interpolator2.8 \ + test_interpolator2.9" + # Tests to skip if input files not present if test ! -z "$test_input_path" ; then rm -rf INPUT && mkdir INPUT diff --git a/test_fms/interpolator/test_interpolator_write_climatology.inc b/test_fms/interpolator/test_interpolator_write_climatology.inc index c05c5deed5..ee1f7a1b8e 100644 --- a/test_fms/interpolator/test_interpolator_write_climatology.inc +++ b/test_fms/interpolator/test_interpolator_write_climatology.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> This file contains subroutines that initialize data and write out the climatology file. @@ -278,8 +277,8 @@ subroutine set_latlon_b() allocate(latb(nlonlat+1), lonb(nlonlat+1)) do i=1, nlonlat - lat(i)= real(2*i-1,TEST_INTP_KIND_) - lon(i)= real(2*i-1,TEST_INTP_KIND_) + lat(i)= real(2*i-1,TEST_FMS_KIND_) + lon(i)= real(2*i-1,TEST_FMS_KIND_) end do lonb(1)=1.0_lkind @@ -321,10 +320,10 @@ subroutine set_latlon_b_mod end do !> convert from degrees to radians - lon_mod = lon_mod*real(PI,TEST_INTP_KIND_)/180.0_lkind - lat_mod = lat_mod*real(PI,TEST_INTP_KIND_)/180.0_lkind - lonb_mod = lonb_mod*real(PI,TEST_INTP_KIND_)/180.0_lkind - latb_mod = latb_mod*real(PI,TEST_INTP_KIND_)/180.0_lkind + lon_mod = lon_mod*real(PI,TEST_FMS_KIND_)/180.0_lkind + lat_mod = lat_mod*real(PI,TEST_FMS_KIND_)/180.0_lkind + lonb_mod = lonb_mod*real(PI,TEST_FMS_KIND_)/180.0_lkind + latb_mod = latb_mod*real(PI,TEST_FMS_KIND_)/180.0_lkind end subroutine set_latlon_b_mod @@ -339,7 +338,7 @@ subroutine set_pfullhalf() allocate(pfull(npfull), phalf(nphalf)) do i=1, npfull - pfull(i) = 0.0001_lkind * real(i-1,TEST_INTP_KIND_) + pfull(i) = 0.0001_lkind * real(i-1,TEST_FMS_KIND_) end do phalf(1)=0.0_lkind @@ -364,7 +363,7 @@ subroutine set_ozone() do j=1, npfull do k=1, nlonlat do l=1, nlonlat - ozone(l,k,j,i)= real(i,TEST_INTP_KIND_) + ozone(l,k,j,i)= real(i,TEST_FMS_KIND_) end do end do end do diff --git a/test_fms/monin_obukhov/Makefile.am b/test_fms/monin_obukhov/Makefile.am index af2127cfdf..c77e67e5ca 100644 --- a/test_fms/monin_obukhov/Makefile.am +++ b/test_fms/monin_obukhov/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the test_fms/monin_obukhov directory of the FMS @@ -35,8 +34,8 @@ check_PROGRAMS = test_monin_obukhov_r4 test_monin_obukhov_r8 test_monin_obukhov_r4_SOURCES = test_monin_obukhov.F90 test_monin_obukhov_r8_SOURCES = test_monin_obukhov.F90 -test_monin_obukhov_r4_CPPFLAGS = $(AM_CPPFLAGS) -DMO_TEST_KIND_=4 -test_monin_obukhov_r8_CPPFLAGS = $(AM_CPPFLAGS) -DMO_TEST_KIND_=8 +test_monin_obukhov_r4_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_FMS_KIND_=4 +test_monin_obukhov_r8_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_FMS_KIND_=8 TEST_EXTENSIONS = .sh SH_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ diff --git a/test_fms/monin_obukhov/test_monin_obukhov.F90 b/test_fms/monin_obukhov/test_monin_obukhov.F90 index 27b386a250..b3b86438cd 100644 --- a/test_fms/monin_obukhov/test_monin_obukhov.F90 +++ b/test_fms/monin_obukhov/test_monin_obukhov.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** ! Check monin_obukhov_mod calculations against an array of known answer keys. @@ -39,13 +38,8 @@ program test_monin_obukhov implicit none -#if MO_TEST_KIND_ == 4 - integer, parameter :: kr = r4_kind - integer, parameter :: ki = i4_kind -#else - integer, parameter :: kr = r8_kind - integer, parameter :: ki = i8_kind -#endif + integer, parameter :: kr = TEST_FMS_KIND_ + integer, parameter :: ki = TEST_FMS_KIND_ integer(ki), parameter :: mi = 0_ki !< Mold for transfer() intrinsic @@ -180,7 +174,7 @@ subroutine write_answers character(:), allocatable :: filename integer :: fh - filename = "OUT.r" // string(MO_TEST_KIND_) // ".nml" + filename = "OUT.r" // string(TEST_FMS_KIND_) // ".nml" print "(A)", "Writing newly generated answer key to " // filename n_answers = n_answers + 1 diff --git a/test_fms/monin_obukhov/test_monin_obukhov2.sh b/test_fms/monin_obukhov/test_monin_obukhov2.sh index c125164c92..a03bf3b1e0 100755 --- a/test_fms/monin_obukhov/test_monin_obukhov2.sh +++ b/test_fms/monin_obukhov/test_monin_obukhov2.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/mosaic2/Makefile.am b/test_fms/mosaic2/Makefile.am index 7f2d6143ab..606d7f0e3c 100644 --- a/test_fms/mosaic2/Makefile.am +++ b/test_fms/mosaic2/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the test_fms/mosaic directory of the @@ -23,7 +22,7 @@ # uramirez, Ed Hartnett # Find the needed mod and include files. -AM_CPPFLAGS = -I$(top_srcdir)/include -I$(MODDIR) -I./INPUT -I$(top_srcdir)/mosaic -I./ +AM_CPPFLAGS = -I$(abs_top_srcdir)/test_fms/mosaic2 -I$(top_srcdir)/include -I$(MODDIR) # Link to the FMS library. LDADD = $(top_builddir)/libFMS/libFMS.la @@ -32,17 +31,26 @@ LDADD = $(top_builddir)/libFMS/libFMS.la check_PROGRAMS = test_mosaic2_r4 test_mosaic2_r8 test_grid2_r4 test_grid2_r8 # This is the source code for the test -test_mosaic2_r4_SOURCES = test_mosaic2.F90 write_files.inc -test_grid2_r4_SOURCES = test_grid2.F90 write_files.inc +test_mosaic2_r4_SOURCES = write_files.F90 write_files.inc test_mosaic2.F90 +test_grid2_r4_SOURCES = write_files.F90 write_files.inc test_mosaic2.F90 + +test_mosaic2_r8_SOURCES = test_mosaic2.F90 write_files.inc write_files.F90 +test_grid2_r8_SOURCES = test_grid2.F90 write_files.inc write_files.F90 -test_mosaic2_r8_SOURCES = test_mosaic2.F90 write_files.inc -test_grid2_r8_SOURCES = test_grid2.F90 write_files.inc +test_mosaic2_r4_CPPFLAGS=-DTEST_FMS_KIND_=4 -DWRITE_FILES_MOD_=write_files_r4 $(AM_CPPFLAGS) +test_grid2_r4_CPPFLAGS =-DTEST_FMS_KIND_=4 -DWRITE_FILES_MOD_=write_files_r4 $(AM_CPPFLAGS) -test_mosaic2_r4_CPPFLAGS=-DTEST_MOS_KIND_=4 $(AM_CPPFLAGS) -test_grid2_r4_CPPFLAGS =-DTEST_MOS_KIND_=4 $(AM_CPPFLAGS) +test_mosaic2_r8_CPPFLAGS=-DTEST_FMS_KIND_=8 -DWRITE_FILES_MOD_=write_files_r8 $(AM_CPPFLAGS) +test_grid2_r8_CPPFLAGS =-DTEST_FMS_KIND_=8 -DWRITE_FILES_MOD_=write_files_r8 $(AM_CPPFLAGS) -test_mosaic2_r8_CPPFLAGS=-DTEST_MOS_KIND_=8 $(AM_CPPFLAGS) -test_grid2_r8_CPPFLAGS =-DTEST_MOS_KIND_=8 $(AM_CPPFLAGS) +# compile helper module as well +%.o: %.mod +write_files_r8.mod: write_files.$(OBJEXT) +write_files_r4.mod: write_files.$(OBJEXT) +test_mosaic2_r4.$(OBJEXT): write_files_r4.mod +test_mosaic2_r8.$(OBJEXT): write_files_r8.mod +test_grid2_r4.$(OBJEXT): write_files_r4.mod +test_grid2_r8.$(OBJEXT): write_files_r8.mod # These files are also included in the distribution. EXTRA_DIST = test_mosaic2.sh @@ -51,7 +59,7 @@ EXTRA_DIST = test_mosaic2.sh TESTS = test_mosaic2.sh if SKIP_MOSAIC_TESTS - TESTS_ENVIRONMENT = SKIP_TESTS="test_mosaic2.1 test_mosaic2.2 test_mosaic2.3 test_mosaic2.4" + TESTS_ENVIRONMENT = parser_skip=${skipflag} endif TEST_EXTENSIONS = .sh diff --git a/test_fms/mosaic2/test_grid2.F90 b/test_fms/mosaic2/test_grid2.F90 index 3f008badb2..db84f33f30 100644 --- a/test_fms/mosaic2/test_grid2.F90 +++ b/test_fms/mosaic2/test_grid2.F90 @@ -1,28 +1,24 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief This programs tests calls to get_mosaic_ntiles, get_mosaic_ncontacts, !! get_mosaic_grid_sizes, get_mosaic_contact. All subroutines here are tested !! with C1 tiles where tiles 1-6 are identical. The tile points are made up with !! values that result in simple answers. See write_files module for grid details. - -#include "write_files.inc" !> including write_files.mod because I don't know how to compile when write_files.mod is - !! in a separate file. program test_mosaic use mpp_mod, only : mpp_init, mpp_error, FATAL, mpp_npes, mpp_pe, mpp_root_pe @@ -32,7 +28,7 @@ program test_mosaic use fms_mod, only : fms_init, fms_end use platform_mod, only : r4_kind, r8_kind use grid2_mod -use write_files +use WRITE_FILES_MOD_ implicit none @@ -60,6 +56,8 @@ program test_mosaic if(mpp_pe() .eq. mpp_root_pe()) write(*,*) 'TEST GET_GRID_COMP_AREA_UG' call test_get_grid_comp_area_ug +call fms_end() + contains !------------------------------------------! subroutine test_get_cell_vertices @@ -69,10 +67,10 @@ subroutine test_get_cell_vertices implicit none - real(TEST_MOS_KIND_) :: lonb_2d(c1_nx,c1_ny) !< returned values for lon 2d - real(TEST_MOS_KIND_) :: latb_2d(c1_nx,c1_ny) !< returned values for lat 2d - real(TEST_MOS_KIND_) :: answer_lon_2d(c1_nx,c1_ny) !< answers for lon 2d - real(TEST_MOS_KIND_) :: answer_lat_2d(c1_nx,c1_ny) !< answers for lat 2d + real(TEST_FMS_KIND_) :: lonb_2d(c1_nx,c1_ny) !< returned values for lon 2d + real(TEST_FMS_KIND_) :: latb_2d(c1_nx,c1_ny) !< returned values for lat 2d + real(TEST_FMS_KIND_) :: answer_lon_2d(c1_nx,c1_ny) !< answers for lon 2d + real(TEST_FMS_KIND_) :: answer_lat_2d(c1_nx,c1_ny) !< answers for lat 2d integer :: i,j @@ -101,10 +99,10 @@ subroutine test_get_cell_centers integer, parameter :: nx = c1_nx/2 !< number of center points integer, parameter :: ny = c1_ny/2 !< number of center points - real(TEST_MOS_KIND_) :: glon_2d(nx,ny) !< results from grid_cell_centers - real(TEST_MOS_KIND_) :: glat_2d(nx,ny) !< results from grid_cell_centers - real(TEST_MOS_KIND_) :: answer_glon_2d(nx,ny) !< answers for glon - real(TEST_MOS_KIND_) :: answer_glat_2d(nx,ny) !< answers for glat + real(TEST_FMS_KIND_) :: glon_2d(nx,ny) !< results from grid_cell_centers + real(TEST_FMS_KIND_) :: glat_2d(nx,ny) !< results from grid_cell_centers + real(TEST_FMS_KIND_) :: answer_glon_2d(nx,ny) !< answers for glon + real(TEST_FMS_KIND_) :: answer_glat_2d(nx,ny) !< answers for glat integer :: i, j @@ -131,8 +129,8 @@ subroutine test_get_grid_cell_area_sg implicit none type(domain2D) :: SG_domain - real(TEST_MOS_KIND_) :: area_out2(1,1) - real(TEST_MOS_KIND_) :: answer + real(TEST_FMS_KIND_) :: area_out2(1,1) + real(TEST_FMS_KIND_) :: answer answer = real(2.0_r8_kind*PI*RADIUS*RADIUS,lkind) @@ -159,8 +157,8 @@ subroutine test_get_grid_cell_area_ug implicit none type(domain2D) :: SG_domain type(domainUG) :: UG_domain !< UG_domain is the same as SG_domain - real(TEST_MOS_KIND_) :: area_out1(1) - real(TEST_MOS_KIND_) :: answer + real(TEST_FMS_KIND_) :: area_out1(1) + real(TEST_FMS_KIND_) :: answer integer :: i integer :: npts_tile(1),grid_nlevel(1), ndivs, grid_index(1) @@ -169,7 +167,7 @@ subroutine test_get_grid_cell_area_ug ndivs=1 grid_index=1 - answer = real( 4.0_r8_kind * area(1,1), TEST_MOS_KIND_) + answer = real( 4.0_r8_kind * area(1,1), TEST_FMS_KIND_) !> The unstructured grid is the same as the structured grid; there's only one center point in the tile. call mpp_define_domains((/1,1,1,1/), (/1,1/), SG_domain) @@ -191,10 +189,10 @@ subroutine test_get_grid_comp_area_sg implicit none type(domain2D) :: SG_domain - real(TEST_MOS_KIND_) :: area_out2(1,1) - real(TEST_MOS_KIND_) :: answer + real(TEST_FMS_KIND_) :: area_out2(1,1) + real(TEST_FMS_KIND_) :: answer - answer = real( 4.0_r8_kind * area(1,1), TEST_MOS_KIND_) + answer = real( 4.0_r8_kind * area(1,1), TEST_FMS_KIND_) call mpp_define_domains((/1,1,1,1/), (/1,1/), SG_domain) @@ -220,13 +218,13 @@ subroutine test_get_grid_comp_area_ug type(domain2D) :: SG_domain type(domainUG) :: UG_domain !< UG_domain is the same as SG_domain integer :: npts_tile(1), ntiles_grid(1), grid_index(1) - real(TEST_MOS_KIND_) :: answer - real(TEST_MOS_KIND_) :: area_out1(1) + real(TEST_FMS_KIND_) :: answer + real(TEST_FMS_KIND_) :: area_out1(1) npts_tile=1 ntiles_grid=1 grid_index(1)=1 - answer = real( 4.0_r8_kind * area(1,1), TEST_MOS_KIND_) + answer = real( 4.0_r8_kind * area(1,1), TEST_FMS_KIND_) !> the unstructured grid is the same as the structured grid call mpp_define_domains((/1,1,1,1/), (/1,1/), SG_domain) @@ -242,8 +240,8 @@ end subroutine test_get_grid_comp_area_ug subroutine check_answer(answer, myvalue, whoami) implicit none - real(TEST_MOS_KIND_) :: answer - real(TEST_MOS_KIND_) :: myvalue + real(TEST_FMS_KIND_) :: answer + real(TEST_FMS_KIND_) :: myvalue character(*) :: whoami if( answer .ne. myvalue ) then diff --git a/test_fms/mosaic2/test_mosaic2.F90 b/test_fms/mosaic2/test_mosaic2.F90 index 95cf1abe78..7e288b2a95 100644 --- a/test_fms/mosaic2/test_mosaic2.F90 +++ b/test_fms/mosaic2/test_mosaic2.F90 @@ -1,33 +1,29 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief This programs tests calls to get_mosaic_ntiles, get_mosaic_ncontacts, !! get_mosaic_grid_sizes, get_mosaic_contact. The subroutines are tested with !! made up C1 grids and exchange grids. See write_files mod for grid details. - -#include "write_files.inc" !> including write_files.mod because I don't know how to compile when write_files.mod is - !! in a separate file. program test_mosaic use mosaic2_mod use grid2_mod -use write_files +use WRITE_FILES_MOD_ use mpp_mod, only : mpp_init, mpp_error, FATAL, mpp_pe, mpp_root_pe use fms2_io_mod, only : open_file, close_file, FmsNetcdfFile_t, fms2_io_init, read_data use fms_mod, only : fms_init, fms_end @@ -168,14 +164,14 @@ subroutine test_calc_mosaic_grid_area implicit none - real(TEST_MOS_KIND_) :: x_rad(c1_nx, c1_ny), y_rad(c1_nx, c1_ny) !< x and y in radians - real(TEST_MOS_KIND_) :: area_out(1,1) !< area to be computed + real(TEST_FMS_KIND_) :: x_rad(c1_nx, c1_ny), y_rad(c1_nx, c1_ny) !< x and y in radians + real(TEST_FMS_KIND_) :: area_out(1,1) !< area to be computed !> x_rad and y_rad can be set to be be the entire cell !! x_rad = x(1:3:2, 1:3:2) and y_rad = y(1:3:2, 1:3:2) !! The answer will then be 4.0*area(1,1) - x_rad = real( real(x(1:2,1:2),r8_kind)*DEG_TO_RAD,TEST_MOS_KIND_) !< set coordinates - y_rad = real( real(y(1:2,1:2),r8_kind)*DEG_TO_RAD,TEST_MOS_KIND_) !< set coordinates + x_rad = real( real(x(1:2,1:2),r8_kind)*DEG_TO_RAD,TEST_FMS_KIND_) !< set coordinates + y_rad = real( real(y(1:2,1:2),r8_kind)*DEG_TO_RAD,TEST_FMS_KIND_) !< set coordinates call calc_mosaic_grid_area(x_rad, y_rad, area_out) call check_answer(area(1,1), area_out(1,1), 'TEST_CALC_MOSAIC_GRID_AREA') @@ -188,14 +184,14 @@ subroutine test_get_grid_great_circle_area implicit none - real(TEST_MOS_KIND_) :: x_rad(c1_nx, c1_ny), y_rad(c1_nx, c1_ny) !< x and y in radians - real(TEST_MOS_KIND_) :: area_out(1,1) !< area to be computed + real(TEST_FMS_KIND_) :: x_rad(c1_nx, c1_ny), y_rad(c1_nx, c1_ny) !< x and y in radians + real(TEST_FMS_KIND_) :: area_out(1,1) !< area to be computed !> x_rad and y_rad can be set to be be the entire cell !! x_rad = x(1:3:2, 1:3:2) and y_rad = y(1:3:2, 1:3:2) !! The answer will then be 4.0*area(1,1) - x_rad = real( real(x(1:2,1:2),r8_kind)*DEG_TO_RAD,TEST_MOS_KIND_) !< set coordinates - y_rad = real( real(y(1:2,1:2),r8_kind)*DEG_TO_RAD,TEST_MOS_KIND_) !< set coordinates + x_rad = real( real(x(1:2,1:2),r8_kind)*DEG_TO_RAD,TEST_FMS_KIND_) !< set coordinates + y_rad = real( real(y(1:2,1:2),r8_kind)*DEG_TO_RAD,TEST_FMS_KIND_) !< set coordinates call calc_mosaic_grid_great_circle_area(x_rad, y_rad, area_out) call check_answer(area(1,1), area_out(1,1), 'TEST_GET_GRID_GREAT_CIRCLE_AREA') @@ -208,7 +204,7 @@ subroutine test_get_mosaic_xgrid implicit none integer, dimension(ncells) :: i1, j1, i2, j2 !< indices of parent cells - real(TEST_MOS_KIND_), dimension(ncells) :: area !< area to be returned + real(TEST_FMS_KIND_), dimension(ncells) :: area !< area to be returned real(r8_kind) :: garea, get_global_area !< global area integer :: i !< counter @@ -243,11 +239,11 @@ subroutine test_is_inside_polygon integer, parameter :: n=5 integer :: i - real(TEST_MOS_KIND_) :: lat1, lon1, x1, y1, z1, r - real(TEST_MOS_KIND_), dimension(n) :: lon2, lat2, x2, y2, z2 + real(TEST_FMS_KIND_) :: lat1, lon1, x1, y1, z1, r + real(TEST_FMS_KIND_), dimension(n) :: lon2, lat2, x2, y2, z2 logical :: answer, is_inside - integer, parameter :: lkind=TEST_MOS_KIND_ !< local kind + integer, parameter :: lkind=TEST_FMS_KIND_ !< local kind !> polygon x2=0.0_lkind diff --git a/test_fms/mosaic2/test_mosaic2.sh b/test_fms/mosaic2/test_mosaic2.sh index 93d0b357c7..f07bf3f1f6 100755 --- a/test_fms/mosaic2/test_mosaic2.sh +++ b/test_fms/mosaic2/test_mosaic2.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to @@ -32,6 +31,10 @@ touch input.nml rm -rf INPUT mkdir INPUT +if [ ! $parser_skip ]; then + SKIP_TESTS='test_mosaic2.[1-4]' +fi + # The tests are skipped if FMS is compiled in r4 via ./configure --enable-mixedmode # because answers differ when FMS is compiled in r4. test_expect_success "test mosaic2 r4" 'mpirun -n 1 ./test_mosaic2_r4' diff --git a/test_fms/mosaic2/write_files.F90 b/test_fms/mosaic2/write_files.F90 new file mode 100644 index 0000000000..4978345da3 --- /dev/null +++ b/test_fms/mosaic2/write_files.F90 @@ -0,0 +1,16 @@ +module write_files_r4 + +#define TEST_FMS_KIND_ r4_kind +#include "write_files.inc" +#undef TEST_FMS_KIND_ + +end module + + +module write_files_r8 + +#define TEST_FMS_KIND_ r8_kind +#include "write_files.inc" +#undef TEST_FMS_KIND_ + +end module diff --git a/test_fms/mosaic2/write_files.inc b/test_fms/mosaic2/write_files.inc index 537f26ea30..ae52aab655 100644 --- a/test_fms/mosaic2/write_files.inc +++ b/test_fms/mosaic2/write_files.inc @@ -1,23 +1,22 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** -module write_files - +!! Helper routines for generating input files for test_mosaic2/grid2 +!! This portion of code is included in two modules, one for each real precision use fms2_io_mod, only: fms2_io_init, open_file, close_file, FmsNetcdfFile_t use fms2_io_mod, only: register_axis, register_field, write_data use mpp_mod, only: mpp_init, mpp_sync, mpp_npes, mpp_get_current_pelist @@ -58,15 +57,15 @@ module write_files ! variables for tile1 character(5) :: tile - real(TEST_MOS_KIND_), dimension(c1_nxp,c1_nyp) :: x - real(TEST_MOS_KIND_), dimension(c1_nxp,c1_nyp) :: y - real(TEST_MOS_KIND_), dimension(c1_nx,c1_ny) :: area + real(TEST_FMS_KIND_), dimension(c1_nxp,c1_nyp) :: x + real(TEST_FMS_KIND_), dimension(c1_nxp,c1_nyp) :: y + real(TEST_FMS_KIND_), dimension(c1_nx,c1_ny) :: area !variables for exchange grid cells - real(TEST_MOS_KIND_), dimension(2,ncells) :: tile1_cell, tile2_cell - real(TEST_MOS_KIND_), dimension(ncells) :: xgrid_area + real(TEST_FMS_KIND_), dimension(2,ncells) :: tile1_cell, tile2_cell + real(TEST_FMS_KIND_), dimension(ncells) :: xgrid_area - integer, parameter :: lkind=TEST_MOS_KIND_ !< local kind parameter + integer, parameter :: lkind=TEST_FMS_KIND_ !< local kind parameter contains !---------------------------------! @@ -181,7 +180,7 @@ contains implicit none character(5) :: tile - real(TEST_MOS_KIND_), parameter :: area_value = real(PI*RADIUS*RADIUS/2.0_r8_kind, TEST_MOS_KIND_) + real(TEST_FMS_KIND_), parameter :: area_value = real(PI*RADIUS*RADIUS/2.0_r8_kind, TEST_FMS_KIND_) real(r8_kind) :: xtmp(c1_nxp, c1_nyp), ytmp(c1_nxp, c1_nyp) xtmp(1,1)=0.0_r8_kind ; xtmp(2,1)=90.0_r8_kind ; xtmp(3,1)=180.0_r8_kind @@ -214,8 +213,8 @@ contains character(*) :: filename character(*) :: tile - real(TEST_MOS_KIND_), dimension(c1_nxp,c1_nyp), intent(in) :: x_in, y_in - real(TEST_MOS_KIND_), dimension(c1_nx,c1_ny), intent(in) :: area_in + real(TEST_FMS_KIND_), dimension(c1_nxp,c1_nyp), intent(in) :: x_in, y_in + real(TEST_FMS_KIND_), dimension(c1_nx,c1_ny), intent(in) :: area_in type(FmsNetcdfFile_t) :: fileobj integer, allocatable :: pes(:) @@ -311,7 +310,7 @@ contains end do do i=1, ncells - xgrid_area(i) = real(get_global_area(), TEST_MOS_KIND_) + xgrid_area(i) = real(get_global_area(), TEST_FMS_KIND_) end do allocate(pes(mpp_npes())) @@ -365,5 +364,3 @@ contains call write_exchange() end subroutine write_all - !---------------------------------! -end module write_files diff --git a/test_fms/mpp/Makefile.am b/test_fms/mpp/Makefile.am index c131f99545..aabe6dac70 100644 --- a/test_fms/mpp/Makefile.am +++ b/test_fms/mpp/Makefile.am @@ -1,29 +1,28 @@ #*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL Flexible Modeling System (FMS). -# -# FMS is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FMS is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # @uramirez, Ed Hartnett, @underwoo # Find the needed mod and inc files. -AM_CPPFLAGS = -I${top_srcdir}/include -I$(MODDIR) +AM_CPPFLAGS = -I${top_srcdir}/include -I$(MODDIR) -I$(top_srcdir)/test_fms/mpp/include -I$(top_builddir)/test_fms/common # Link to the FMS library. -LDADD = ${top_builddir}/libFMS/libFMS.la +LDADD = ${top_builddir}/libFMS/libFMS.la $(top_builddir)/test_fms/common/libtest_fms.a # Build these test programs. check_PROGRAMS = test_mpp \ @@ -37,7 +36,7 @@ check_PROGRAMS = test_mpp \ test_mpp_print_memuse_stats_file \ test_mpp_memutils_begin_2x \ test_mpp_memutils_end_before_begin \ - test_read_ascii_file \ + test_mpp_read_ascii_file \ test_read_input_nml \ test_stdout \ test_stderr \ @@ -61,7 +60,10 @@ check_PROGRAMS = test_mpp \ test_mpp_update_domains_ad \ test_mpp_transmit \ test_mpp_alltoall \ - test_mpp_global_field \ + test_mpp_global_field_r4 \ + test_mpp_global_field_r8 \ + test_mpp_global_field_i4 \ + test_mpp_global_field_i8 \ test_mpp_global_field_ug \ test_mpp_global_sum_ad \ test_mpp_init_logfile \ @@ -75,7 +77,8 @@ test_mpp_SOURCES = test_mpp.F90 test_mpp_domains_SOURCES = \ compare_data_checksums.F90 \ test_domains_utility_mod.F90 \ - test_mpp_domains.F90 + test_mpp_domains.F90 \ + include/group_update.inc test_mpp_nesting_SOURCES = \ compare_data_checksums.F90 \ test_domains_utility_mod.F90 \ @@ -87,7 +90,7 @@ test_mpp_print_memuse_stats_stderr_SOURCES = test_mpp_print_memuse_stats_stderr. test_mpp_print_memuse_stats_file_SOURCES = test_mpp_print_memuse_stats_file.F90 test_mpp_memutils_begin_2x_SOURCES = test_mpp_memutils_begin_2x.F90 test_mpp_memutils_end_before_begin_SOURCES = test_mpp_memutils_end_before_begin.F90 -test_read_ascii_file_SOURCES = test_read_ascii_file.F90 +test_mpp_read_ascii_file_SOURCES = test_mpp_read_ascii_file.F90 test_read_input_nml_SOURCES = test_read_input_nml.F90 test_stdout_SOURCES = test_stdout.F90 test_stderr_SOURCES = test_stderr.F90 @@ -106,7 +109,7 @@ test_mpp_update_domains_SOURCES = \ compare_data_checksums_int.F90 \ test_mpp_update_domains_real.F90 \ test_mpp_update_domains_int.F90 \ - test_mpp_update_domains_main.F90 + test_mpp_update_domains.F90 test_mpp_gatscat_SOURCES = test_mpp_gatscat.F90 test_mpp_sendrecv_SOURCES = test_mpp_sendrecv.F90 test_mpp_sum_SOURCES = test_mpp_sum.F90 @@ -120,10 +123,10 @@ test_global_arrays_SOURCES = test_global_arrays.F90 test_redistribute_int_SOURCES = test_redistribute_int.F90 test_mpp_transmit_SOURCES = test_mpp_transmit.F90 test_mpp_alltoall_SOURCES = test_mpp_alltoall.F90 -test_mpp_global_field_SOURCES = \ - compare_data_checksums.F90 \ - compare_data_checksums_int.F90 \ - test_mpp_global_field.F90 +test_mpp_global_field_r4_SOURCES = test_mpp_global_field.F90 +test_mpp_global_field_r8_SOURCES = test_mpp_global_field.F90 +test_mpp_global_field_i4_SOURCES = test_mpp_global_field.F90 +test_mpp_global_field_i8_SOURCES = test_mpp_global_field.F90 test_mpp_global_field_ug_SOURCES = \ compare_data_checksums.F90 \ compare_data_checksums_int.F90 \ @@ -136,6 +139,11 @@ test_super_grid_SOURCES = test_super_grid.F90 test_mpp_chksum_SOURCES = test_mpp_chksum.F90 test_stdlog_SOURCES = test_stdlog.F90 +test_mpp_global_field_r4_CPPFLAGS = $(AM_CPPFLAGS) -DFMS_TEST_TYPE_=real -DFMS_TEST_KIND_=r4_kind +test_mpp_global_field_r8_CPPFLAGS = $(AM_CPPFLAGS) -DFMS_TEST_TYPE_=real -DFMS_TEST_KIND_=r8_kind +test_mpp_global_field_i4_CPPFLAGS = $(AM_CPPFLAGS) -DFMS_TEST_TYPE_=integer -DFMS_TEST_KIND_=i4_kind +test_mpp_global_field_i8_CPPFLAGS = $(AM_CPPFLAGS) -DFMS_TEST_TYPE_=integer -DFMS_TEST_KIND_=i8_kind + # ifort gets a internal error during compilation for this test, issue #1071 # we'll just remove the openmp flag if present since it doesn't use openmp at all test_mpp_alltoall.$(OBJEXT): FCFLAGS:= $(filter-out -fopenmp,$(FCFLAGS)) @@ -150,7 +158,7 @@ TESTS = test_mpp_domains2.sh \ test_mpp_memuse.sh \ test_mpp_mem_dump.sh \ test_mpp_memutils_mod.sh \ - test_read_ascii_file.sh \ + test_mpp_read_ascii_file.sh \ test_read_input_nml2.sh \ test_stdout.sh \ test_stderr.sh \ @@ -193,7 +201,7 @@ EXTRA_DIST = test_mpp_domains2.sh \ test_mpp_memuse.sh \ test_mpp_mem_dump.sh \ test_mpp_memutils_mod.sh \ - test_read_ascii_file.sh \ + test_mpp_read_ascii_file.sh \ test_read_input_nml2.sh \ test_stdout.sh \ test_stderr.sh \ @@ -237,9 +245,8 @@ test_domains_utility_mod.mod: test_domains_utility_mod.$(OBJEXT) test_mpp_update_domains_real.$(OBJEXT): compare_data_checksums.mod fill_halo.mod test_mpp_update_domains test_mpp_update_domains_int.$(OBJEXT): compare_data_checksums_int.mod fill_halo.mod -test_mpp_update_domains_main.$(OBJEXT): test_mpp_update_domains_real.mod test_mpp_update_domains_int.mod +test_mpp_update_domains.$(OBJEXT): test_mpp_update_domains_real.mod test_mpp_update_domains_int.mod test_update_domains_performance.$(OBJEXT): compare_data_checksums_int.mod compare_data_checksums.mod -test_mpp_global_field.$(OBJEXT): compare_data_checksums_int.mod compare_data_checksums.mod test_mpp_global_field_ug.$(OBJEXT): compare_data_checksums_int.mod compare_data_checksums.mod test_mpp_domains.$(OBJEXT): compare_data_checksums.mod test_domains_utility_mod.mod test_mpp_nesting.$(OBJEXT): compare_data_checksums.mod test_domains_utility_mod.mod diff --git a/test_fms/mpp/compare_data_checksums.F90 b/test_fms/mpp/compare_data_checksums.F90 index 658e780c44..cf22304a8b 100644 --- a/test_fms/mpp/compare_data_checksums.F90 +++ b/test_fms/mpp/compare_data_checksums.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @author Jessica Liptak !> @brief Compare the checksums of 2D and 3D 32-bit or 64-bit real and integer arrays diff --git a/test_fms/mpp/compare_data_checksums_int.F90 b/test_fms/mpp/compare_data_checksums_int.F90 index e99047b16e..cfe2c9aa21 100644 --- a/test_fms/mpp/compare_data_checksums_int.F90 +++ b/test_fms/mpp/compare_data_checksums_int.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @author Jessica Liptak !> @brief Compare the checksums of 2D and 3D 32-bit or 64-bit integer arrays diff --git a/test_fms/mpp/fill_halo.F90 b/test_fms/mpp/fill_halo.F90 index 63013ddbf8..d18c826d3c 100644 --- a/test_fms/mpp/fill_halo.F90 +++ b/test_fms/mpp/fill_halo.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @author Jessica Liptak !> @brief This module contains routines to fill halos in different domain configurations diff --git a/test_fms/mpp/include/group_update.inc b/test_fms/mpp/include/group_update.inc new file mode 100644 index 0000000000..575a0f028b --- /dev/null +++ b/test_fms/mpp/include/group_update.inc @@ -0,0 +1,647 @@ +#define INDICES_MEM_ mem%lb(1):mem%ub(1), \ + mem%lb(2):mem%ub(2), \ + mem%lb(3):mem%ub(3) + +#define INDICES_MEM_ISHIFT_ mem_ishift%lb(1):mem_ishift%ub(1), \ + mem_ishift%lb(2):mem_ishift%ub(2), \ + mem_ishift%lb(3):mem_ishift%ub(3) + +#define INDICES_MEM_JSHIFT_ mem_jshift%lb(1):mem_jshift%ub(1), \ + mem_jshift%lb(2):mem_jshift%ub(2), \ + mem_jshift%lb(3):mem_jshift%ub(3) + +#define INDICES_MEM_IJSHIFT_ mem_ijshift%lb(1):mem_ijshift%ub(1), \ + mem_ijshift%lb(2):mem_ijshift%ub(2), \ + mem_ijshift%lb(3):mem_ijshift%ub(3) + +#define INDICES_COMPUTE_ compute%lb(1):compute%ub(1), \ + compute%lb(2):compute%ub(2), \ + compute%lb(3):compute%ub(3) + +#define INDICES_COMPUTE_ISHIFT_ compute_ishift%lb(1):compute_ishift%ub(1), \ + compute_ishift%lb(2):compute_ishift%ub(2), \ + compute_ishift%lb(3):compute_ishift%ub(3) + +#define INDICES_COMPUTE_JSHIFT_ compute_jshift%lb(1):compute_jshift%ub(1), \ + compute_jshift%lb(2):compute_jshift%ub(2), \ + compute_jshift%lb(3):compute_jshift%ub(3) + +#define INDICES_COMPUTE_IJSHIFT_ compute_ijshift%lb(1):compute_ijshift%ub(1), \ + compute_ijshift%lb(2):compute_ijshift%ub(2), \ + compute_ijshift%lb(3):compute_ijshift%ub(3) + +#define INDICES_COMPUTE_HALO_ compute_halo%lb(1):compute_halo%ub(1), \ + compute_halo%lb(2):compute_halo%ub(2), \ + compute_halo%lb(3):compute_halo%ub(3) + +#define INDICES_DATA_ data%lb(1):data%ub(1), \ + data%lb(2):data%ub(2), \ + data%lb(3):data%ub(3) + +#define INDICES_DATA_ISHIFT_ data_ishift%lb(1):data_ishift%ub(1), \ + data_ishift%lb(2):data_ishift%ub(2), \ + data_ishift%lb(3):data_ishift%ub(3) + +#define INDICES_DATA_JSHIFT_ data_jshift%lb(1):data_jshift%ub(1), \ + data_jshift%lb(2):data_jshift%ub(2), \ + data_jshift%lb(3):data_jshift%ub(3) + +#define INDICES_DATA_IJSHIFT_ data_ijshift%lb(1):data_ijshift%ub(1), \ + data_ijshift%lb(2):data_ijshift%ub(2), \ + data_ijshift%lb(3):data_ijshift%ub(3) + + subroutine TEST_GROUP_UPDATE_ (type, p) + character(len=*), intent(in) :: type !< Name of the test to run + integer, intent(in) :: p !< Permutation of array indices (ranges from 1 to 3!) + + real(FMS_TEST_KIND_), parameter :: zero = 0 + type(domain2D) :: domain + integer :: num_contact, ntiles, npes_per_tile + integer :: i, j, k, l, n, shift + integer :: isc, iec, jsc, jec, isd, ied, jsd, jed + integer :: ism, iem, jsm, jem + + integer, allocatable, dimension(:) :: pe_start, pe_end, tile1, tile2 + integer, allocatable, dimension(:) :: istart1, iend1, jstart1, jend1 + integer, allocatable, dimension(:) :: istart2, iend2, jstart2, jend2 + integer, allocatable, dimension(:,:) :: layout2D, global_indices + real(FMS_TEST_KIND_), allocatable, dimension(:,:,:,:) :: x1, y1, x2, y2 + real(FMS_TEST_KIND_), allocatable, dimension(:,:,:,:) :: a1, a2 + real(FMS_TEST_KIND_), allocatable, dimension(:,:,:) :: base + integer :: id1, id2, id3 + logical :: folded_north + logical :: cubic_grid + character(len=3) :: text + integer :: nx_save, ny_save + type(mpp_group_update_type) :: group_update + type(mpp_group_update_type), allocatable :: update_list(:) + type(permutable_indices_3d) :: mem, mem_ishift, mem_jshift, mem_ijshift, & + compute, compute_ishift, compute_jshift, compute_ijshift, compute_halo, & + data, data_ishift, data_jshift, data_ijshift + + folded_north = .false. + cubic_grid = .false. + + nx_save = nx + ny_save = ny + !--- check the type + select case(type) + case ( 'Folded-north' ) + ntiles = 1 + shift = 0 + num_contact = 2 + folded_north = .true. + npes_per_tile = npes + if(layout_tripolar(1)*layout_tripolar(2) == npes ) then + layout = layout_tripolar + else + call mpp_define_layout( (/1,nx,1,ny/), npes_per_tile, layout ) + endif + case ( 'Cubic-Grid' ) + if( nx_cubic == 0 ) then + call mpp_error(NOTE,'test_group_update: for Cubic_grid mosaic, nx_cubic is zero, '//& + 'No test is done for Cubic-Grid mosaic. ' ) + return + endif + if( nx_cubic .NE. ny_cubic ) then + call mpp_error(NOTE,'test_group_update: for Cubic_grid mosaic, nx_cubic does not equal ny_cubic, '//& + 'No test is done for Cubic-Grid mosaic. ' ) + return + endif + shift = 1 + nx = nx_cubic + ny = ny_cubic + ntiles = 6 + num_contact = 12 + cubic_grid = .true. + if( mod(npes, ntiles) == 0 ) then + npes_per_tile = npes/ntiles + write(outunit,*)'NOTE from update_domains_performance ==> For Mosaic "', trim(type), & + '", each tile will be distributed over ', npes_per_tile, ' processors.' + else + call mpp_error(NOTE,'test_group_update: npes should be multiple of ntiles No test is done for '//trim(type)) + return + endif + if(layout_cubic(1)*layout_cubic(2) == npes_per_tile) then + layout = layout_cubic + else + call mpp_define_layout( (/1,nx,1,ny/), npes_per_tile, layout ) + endif + case default + call mpp_error(FATAL, 'test_group_update: no such test: '//type) + end select + + allocate(layout2D(2,ntiles), global_indices(4,ntiles), pe_start(ntiles), pe_end(ntiles) ) + do n = 1, ntiles + pe_start(n) = (n-1)*npes_per_tile + pe_end(n) = n*npes_per_tile-1 + end do + + do n = 1, ntiles + global_indices(:,n) = (/1,nx,1,ny/) + layout2D(:,n) = layout + end do + + allocate(tile1(num_contact), tile2(num_contact) ) + allocate(istart1(num_contact), iend1(num_contact), jstart1(num_contact), jend1(num_contact) ) + allocate(istart2(num_contact), iend2(num_contact), jstart2(num_contact), jend2(num_contact) ) + + !--- define domain + if(folded_north) then + !--- Contact line 1, between tile 1 (EAST) and tile 1 (WEST) --- cyclic + tile1(1) = 1; tile2(1) = 1 + istart1(1) = nx; iend1(1) = nx; jstart1(1) = 1; jend1(1) = ny + istart2(1) = 1; iend2(1) = 1; jstart2(1) = 1; jend2(1) = ny + !--- Contact line 2, between tile 1 (NORTH) and tile 1 (NORTH) --- folded-north-edge + tile1(2) = 1; tile2(2) = 1 + istart1(2) = 1; iend1(2) = nx/2; jstart1(2) = ny; jend1(2) = ny + istart2(2) = nx; iend2(2) = nx/2+1; jstart2(2) = ny; jend2(2) = ny + call mpp_define_mosaic(global_indices, layout2D, domain, ntiles, num_contact, tile1, tile2, & + istart1, iend1, jstart1, jend1, istart2, iend2, jstart2, jend2, & + pe_start, pe_end, whalo=whalo, ehalo=ehalo, shalo=shalo, nhalo=nhalo, & + name = type, symmetry = .false. ) + else if( cubic_grid ) then + call define_cubic_mosaic(type, domain, (/nx,nx,nx,nx,nx,nx/), (/ny,ny,ny,ny,ny,ny/), & + global_indices, layout2D, pe_start, pe_end ) + endif + + !--- setup data + call mpp_get_compute_domain( domain, isc, iec, jsc, jec ) + call mpp_get_data_domain ( domain, isd, ied, jsd, jed ) + call mpp_get_memory_domain ( domain, ism, iem, jsm, jem ) + + mem%lb = [ism, jsm, 1] + mem%ub = [iem, jem, nz] + call mem%permute(p) + + mem_ishift%lb = [ism, jsm, 1] + mem_ishift%ub = [iem+shift, jem, nz] + call mem_ishift%permute(p) + + mem_jshift%lb = [ism, jsm, 1] + mem_jshift%ub = [iem, jem+shift, nz] + call mem_jshift%permute(p) + + mem_ijshift%lb = [ism, jsm, 1] + mem_ijshift%ub = [iem+shift, jem+shift, nz] + call mem_ijshift%permute(p) + + compute%lb = [isc, jsc, 1] + compute%ub = [iec, jec, nz] + call compute%permute(p) + + compute_ishift%lb = [isc, jsc, 1] + compute_ishift%ub = [iec+shift, jec, nz] + call compute_ishift%permute(p) + + compute_jshift%lb = [isc, jsc, 1] + compute_jshift%ub = [iec, jec+shift, nz] + call compute_jshift%permute(p) + + compute_ijshift%lb = [isc, jsc, 1] + compute_ijshift%ub = [iec+shift, jec+shift, nz] + call compute_ijshift%permute(p) + + compute_halo%lb = [isc-1, jsc-1, 1] + compute_halo%ub = [iec+1, jec+1, nz] + call compute_halo%permute(p) + + data%lb = [isd, jsd, 1] + data%ub = [ied, jed, nz] + call data%permute(p) + + data_ishift%lb = [isd, jsd, 1] + data_ishift%ub = [ied+shift, jed, nz] + call data_ishift%permute(p) + + data_jshift%lb = [isd, jsd, 1] + data_jshift%ub = [ied, jed+shift, nz] + call data_jshift%permute(p) + + data_ijshift%lb = [isd, jsd, 1] + data_ijshift%ub = [ied+shift, jed+shift, nz] + call data_ijshift%permute(p) + + if(num_fields<1) then + call mpp_error(FATAL, "test_mpp_domains: num_fields must be a positive integer") + endif + + allocate(update_list(num_fields)) + + id1 = mpp_clock_id( type//' group 2D', flags=MPP_CLOCK_SYNC ) + id2 = mpp_clock_id( type//' non-group 2D', flags=MPP_CLOCK_SYNC ) + id3 = mpp_clock_id( type//' non-block group 2D', flags=MPP_CLOCK_SYNC ) + + allocate(a1(INDICES_MEM_, num_fields)) + allocate(x1(INDICES_MEM_ISHIFT_, num_fields)) + allocate(y1(INDICES_MEM_JSHIFT_, num_fields)) + allocate(a2(INDICES_MEM_, num_fields)) + allocate(x2(INDICES_MEM_ISHIFT_, num_fields)) + allocate(y2(INDICES_MEM_JSHIFT_, num_fields)) + allocate(base(INDICES_COMPUTE_IJSHIFT_)) + + a1 = zero + x1 = zero + y1 = zero + + call arr_init(base) + + !--- Test for partial direction update + do l =1, num_fields + call mpp_create_group_update(group_update, a1(:,:,:,l), domain, flags=WUPDATE+SUPDATE) + end do + + do l = 1, num_fields + a1(INDICES_COMPUTE_HALO_,l) = 999 + a1(INDICES_COMPUTE_,l) = base(INDICES_COMPUTE_) + l*1e3 + enddo + + a2 = a1 + call mpp_do_group_update(group_update, domain, zero) + + do l = 1, num_fields + call mpp_update_domains( a2(:,:,:,l), domain, flags=WUPDATE+SUPDATE, complete=l==num_fields ) + enddo + + do l = 1, num_fields + write(text, '(i3.3)') l + call compare_checksums(a1(INDICES_DATA_,l),a2(INDICES_DATA_,l),type//' CENTER South West '//text) + enddo + + call mpp_clear_group_update(group_update) + + !--- Test for DGRID update + if(type == 'Cubic-Grid' ) then + x1 = zero + y1 = zero + + do l =1, num_fields + call mpp_create_group_update(group_update, x1(:,:,:,l), y1(:,:,:,l), domain, gridtype=DGRID_NE) + end do + + do l = 1, num_fields + y1(INDICES_COMPUTE_ISHIFT_,l) = base(INDICES_COMPUTE_ISHIFT_) + l*1e3 + 1e6 + x1(INDICES_COMPUTE_JSHIFT_,l) = base(INDICES_COMPUTE_JSHIFT_) + l*1e3 + 2*1e6 + enddo + x2 = x1 + y2 = y1 + call mpp_start_group_update(group_update, domain, zero) + call mpp_complete_group_update(group_update, domain, zero) + + do l = 1, num_fields + call mpp_update_domains( x2(:,:,:,l), y2(:,:,:,l), domain, gridtype=DGRID_NE, complete=l==num_fields ) + enddo + + !--- compare checksum + do l = 1, num_fields + write(text, '(i3.3)') l + call compare_checksums(x1(INDICES_DATA_ISHIFT_,l),x2(INDICES_DATA_ISHIFT_,l),type//' DGRID X'//text) + call compare_checksums(y1(INDICES_DATA_JSHIFT_,l),y2(INDICES_DATA_JSHIFT_,l),type//' DGRID Y'//text) + enddo + + call mpp_clear_group_update(group_update) + endif + + !--- Test for CGRID + a1 = zero + x1 = zero + y1 = zero + + do l =1, num_fields + call mpp_create_group_update(group_update, a1(:,:,:,l), domain) + call mpp_create_group_update(group_update, x1(:,:,:,l), y1(:,:,:,l), domain, gridtype=CGRID_NE) + end do + + do n = 1, num_iter + a1 = zero + x1 = zero + y1 = zero + + do l = 1, num_fields + a1(INDICES_COMPUTE_,l) = base(INDICES_COMPUTE_) + l*1e3 + x1(INDICES_COMPUTE_ISHIFT_,l) = base(INDICES_COMPUTE_ISHIFT_) + l*1e3 + 1e6 + y1(INDICES_COMPUTE_JSHIFT_,l) = base(INDICES_COMPUTE_JSHIFT_) + l*1e3 + 2*1e6 + enddo + a2 = a1; x2 = x1; y2 = y1 + call mpp_clock_begin(id1) + call mpp_do_group_update(group_update, domain, zero) + call mpp_clock_end (id1) + + call mpp_clock_begin(id2) + do l = 1, num_fields + call mpp_update_domains( a2(:,:,:,l), domain, complete=l==num_fields ) + enddo + do l = 1, num_fields + call mpp_update_domains( x2(:,:,:,l), y2(:,:,:,l), domain, gridtype=CGRID_NE, complete=l==num_fields ) + enddo + call mpp_clock_end(id2) + + !--- compare checksum + if( n == num_iter ) then + do l = 1, num_fields + write(text, '(i3.3)') l + call compare_checksums(a1(INDICES_DATA_,l),a2(INDICES_DATA_,l),type//' CENTER '//text) + call compare_checksums(x1(INDICES_DATA_ISHIFT_,l),x2(INDICES_DATA_ISHIFT_,l),type//' CGRID X'//text) + call compare_checksums(y1(INDICES_DATA_JSHIFT_,l),y2(INDICES_DATA_JSHIFT_,l),type//' CGRID Y'//text) + enddo + endif + + a1 = zero + x1 = zero + y1 = zero + + do l = 1, num_fields + a1(INDICES_COMPUTE_,l) = base(INDICES_COMPUTE_) + l*1e3 + x1(INDICES_COMPUTE_ISHIFT_,l) = base(INDICES_COMPUTE_ISHIFT_) + l*1e3 + 1e6 + y1(INDICES_COMPUTE_JSHIFT_,l) = base(INDICES_COMPUTE_JSHIFT_) + l*1e3 + 2*1e6 + enddo + call mpp_clock_begin(id3) + call mpp_start_group_update(group_update, domain, zero) + call mpp_complete_group_update(group_update, domain, zero) + call mpp_clock_end (id3) + !--- compare checksum + if( n == num_iter ) then + do l = 1, num_fields + write(text, '(i3.3)') l + call compare_checksums(a1(INDICES_DATA_,l),a2(INDICES_DATA_,l), type//' nonblock CENTER '//text) + call compare_checksums(x1(INDICES_DATA_ISHIFT_,l),x2(INDICES_DATA_ISHIFT_,l), type//' nonblock CGRID X'//text) + call compare_checksums(y1(INDICES_DATA_JSHIFT_,l),y2(INDICES_DATA_JSHIFT_,l), type//' nonblock CGRID Y'//text) + enddo + endif + enddo + + call mpp_clear_group_update(group_update) + + !--- The following is to test overlapping start and complete + if( num_fields > 1 ) then + do l =1, num_fields + call mpp_create_group_update(update_list(l), a1(:,:,:,l), domain) + call mpp_create_group_update(update_list(l), x1(:,:,:,l), y1(:,:,:,l), domain, gridtype=CGRID_NE) + end do + + do n = 1, num_iter + + a1 = zero + x1 = zero + y1 = zero + + do l = 1, num_fields + a1(INDICES_COMPUTE_,l) = base(INDICES_COMPUTE_) + l*1e3 + x1(INDICES_COMPUTE_ISHIFT_,l) = base(INDICES_COMPUTE_ISHIFT_) + l*1e3 + 1e6 + y1(INDICES_COMPUTE_JSHIFT_,l) = base(INDICES_COMPUTE_JSHIFT_) + l*1e3 + 2*1e6 + enddo + do l = 1, num_fields-1 + call mpp_start_group_update(update_list(l), domain, zero) + enddo + + call mpp_complete_group_update(update_list(1), domain, zero) + call mpp_start_group_update(update_list(num_fields), domain, zero) + do l = 2, num_fields + call mpp_complete_group_update(update_list(l), domain, zero) + enddo + !--- compare checksum + if( n == num_iter ) then + do l = 1, num_fields + write(text, '(i3.3)') l + call compare_checksums(a1(INDICES_DATA_,l),a2(INDICES_DATA_,l), & + type//' multiple nonblock CENTER '//text) + call compare_checksums(x1(INDICES_DATA_ISHIFT_,l),x2(INDICES_DATA_ISHIFT_,l), & + type//' multiple nonblock CGRID X'//text) + call compare_checksums(y1(INDICES_DATA_JSHIFT_,l),y2(INDICES_DATA_JSHIFT_,l), & + type//' multiple nonblock CGRID Y'//text) + enddo + endif + enddo + endif + + do l =1, num_fields + call mpp_clear_group_update(update_list(l)) + enddo + deallocate(update_list) + + !--- test scalar 4-D variable + call mpp_create_group_update(group_update, a1(:,:,:,:), domain) + + a1 = zero + x1 = zero + y1 = zero + + do l = 1, num_fields + a1(INDICES_COMPUTE_,l) = base(INDICES_COMPUTE_) + l*1e3 + enddo + + a2 = a1 + x2 = x1 + y2 = y1 + + call mpp_clock_begin(id1) + call mpp_do_group_update(group_update, domain, zero) + call mpp_clock_end (id1) + + call mpp_clock_begin(id2) + call mpp_update_domains( a2(:,:,:,:), domain ) + call mpp_clock_end(id2) + + !--- compare checksum + do l = 1, num_fields + write(text, '(i3.3)') l + call compare_checksums(a1(INDICES_DATA_,l),a2(INDICES_DATA_,l),type//' 4D CENTER '//text) + enddo + + a1 = 0 + do l = 1, num_fields + a1(INDICES_COMPUTE_,l) = base(INDICES_COMPUTE_) + l*1e3 + enddo + call mpp_clock_begin(id3) + call mpp_start_group_update(group_update, domain, zero) + call mpp_complete_group_update(group_update, domain, zero) + call mpp_clock_end (id3) + + !--- compare checksum + do l = 1, num_fields + write(text, '(i3.3)') l + call compare_checksums(a1(INDICES_DATA_,l),a2(INDICES_DATA_,l), type//' nonblock 4D CENTER '//text) + enddo + + + + !--- test for BGRID. + deallocate(a1, x1, y1) + deallocate(a2, x2, y2) + call mpp_clear_group_update(group_update) + + allocate(a1(INDICES_MEM_IJSHIFT_, num_fields)) + allocate(x1(INDICES_MEM_IJSHIFT_, num_fields)) + allocate(y1(INDICES_MEM_IJSHIFT_, num_fields)) + allocate(a2(INDICES_MEM_IJSHIFT_, num_fields)) + allocate(x2(INDICES_MEM_IJSHIFT_, num_fields)) + allocate(y2(INDICES_MEM_IJSHIFT_, num_fields)) + + do l =1, num_fields + call mpp_create_group_update(group_update, a1(:,:,:,l), domain, position=CORNER) + call mpp_create_group_update(group_update, x1(:,:,:,l), y1(:,:,:,l), domain, gridtype=BGRID_NE) + end do + + do n = 1, num_iter + a1 = 0; x1 = 0; y1 = 0 + do l = 1, num_fields + a1(INDICES_COMPUTE_IJSHIFT_,l) = base(INDICES_COMPUTE_IJSHIFT_) + l*1e3 + x1(INDICES_COMPUTE_IJSHIFT_,l) = base(INDICES_COMPUTE_IJSHIFT_) + l*1e3 + 1e6 + y1(INDICES_COMPUTE_IJSHIFT_,l) = base(INDICES_COMPUTE_IJSHIFT_) + l*1e3 + 2*1e6 + enddo + + a2 = a1 + x2 = x1 + y2 = y1 + + call mpp_clock_begin(id1) + call mpp_do_group_update(group_update, domain, zero) + call mpp_clock_end (id1) + + call mpp_clock_begin(id2) + do l = 1, num_fields + call mpp_update_domains( a2(:,:,:,l), domain, position=CORNER, complete=l==num_fields ) + enddo + do l = 1, num_fields + call mpp_update_domains( x2(:,:,:,l), y2(:,:,:,l), domain, gridtype=BGRID_NE, complete=l==num_fields ) + enddo + call mpp_clock_end(id2) + + !--- compare checksum + if( n == num_iter ) then + do l = 1, num_fields + write(text, '(i3.3)') l + call compare_checksums(a1(INDICES_DATA_IJSHIFT_,l),a2(INDICES_DATA_IJSHIFT_,l),type // ' CORNER ' // text) + call compare_checksums(x1(INDICES_DATA_IJSHIFT_,l),x2(INDICES_DATA_IJSHIFT_,l),type // ' BGRID X' // text) + call compare_checksums(y1(INDICES_DATA_IJSHIFT_,l),y2(INDICES_DATA_IJSHIFT_,l),type // ' BGRID Y' // text) + enddo + endif + + a1 = zero + x1 = zero + y1 = zero + + do l = 1, num_fields + a1(INDICES_COMPUTE_IJSHIFT_,l) = base(INDICES_COMPUTE_IJSHIFT_) + l*1e3 + x1(INDICES_COMPUTE_IJSHIFT_,l) = base(INDICES_COMPUTE_IJSHIFT_) + l*1e3 + 1e6 + y1(INDICES_COMPUTE_IJSHIFT_,l) = base(INDICES_COMPUTE_IJSHIFT_) + l*1e3 + 2*1e6 + enddo + call mpp_clock_begin(id3) + call mpp_start_group_update(group_update, domain, zero) + call mpp_complete_group_update(group_update, domain, zero) + call mpp_clock_end (id3) + !--- compare checksum + if( n == num_iter ) then + do l = 1, num_fields + write(text, '(i3.3)') l + call compare_checksums(a1(INDICES_DATA_IJSHIFT_,l),a2(INDICES_DATA_IJSHIFT_,l), & + type//' nonblockCORNER '//text) + call compare_checksums(x1(INDICES_DATA_IJSHIFT_,l),x2(INDICES_DATA_IJSHIFT_,l), & + type//' nonblock BGRID X'//text) + call compare_checksums(y1(INDICES_DATA_IJSHIFT_,l),y2(INDICES_DATA_IJSHIFT_,l), & + type//' nonblock BGRID Y'//text) + enddo + endif + enddo + + call mpp_clear_group_update(group_update) + + !----------------------------------------------------------------------------- + ! test for AGRID vector and scalar pair + !----------------------------------------------------------------------------- + deallocate(x1, y1) + deallocate(x2, y2) + + allocate(x1(INDICES_MEM_, num_fields)) + allocate(y1(INDICES_MEM_, num_fields)) + allocate(x2(INDICES_MEM_, num_fields)) + allocate(y2(INDICES_MEM_, num_fields)) + + x1 = zero + y1 = zero + + do l = 1, num_fields + x1(INDICES_COMPUTE_,l) = base(INDICES_COMPUTE_) + l*1e3 + 1e6 + y1(INDICES_COMPUTE_,l) = base(INDICES_COMPUTE_) + l*1e3 + 2*1e6 + enddo + + x2 = x1 + y2 = y1 + + do l =1, num_fields + call mpp_create_group_update(group_update, x1(:,:,:,l), y1(:,:,:,l), domain, gridtype=AGRID) + end do + + do l = 1, num_fields + call mpp_update_domains( x2(:,:,:,l), y2(:,:,:,l), domain, gridtype=AGRID, complete=l==num_fields ) + enddo + + call mpp_start_group_update(group_update, domain, zero) + call mpp_complete_group_update(group_update, domain, zero) + + !--- compare checksum + do l = 1, num_fields + write(text, '(i3.3)') l + call compare_checksums(x1(INDICES_DATA_,l),x2(INDICES_DATA_,l),type//' AGRID X'//text) + call compare_checksums(y1(INDICES_DATA_,l),y2(INDICES_DATA_,l),type//' AGRID Y'//text) + enddo + + call mpp_clear_group_update(group_update) + + x1 = zero + y1 = zero + + do l = 1, num_fields + x1(INDICES_COMPUTE_,l) = base(INDICES_COMPUTE_) + l*1e3 + 1e6 + y1(INDICES_COMPUTE_,l) = base(INDICES_COMPUTE_) + l*1e3 + 2*1e6 + enddo + + x2 = x1 + y2 = y1 + + do l =1, num_fields + call mpp_create_group_update(group_update, x1(:,:,:,l), y1(:,:,:,l), domain, gridtype=AGRID, flags=SCALAR_PAIR) + end do + + do l = 1, num_fields + call mpp_update_domains( x2(:,:,:,l), y2(:,:,:,l), domain, gridtype=AGRID, flags=SCALAR_PAIR, & + & complete=l==num_fields) + enddo + + call mpp_start_group_update(group_update, domain, zero) + call mpp_complete_group_update(group_update, domain, zero) + + !--- compare checksum + do l = 1, num_fields + write(text, '(i3.3)') l + call compare_checksums(x1(INDICES_DATA_,l),x2(INDICES_DATA_,l),type//' AGRID SCALAR_PAIR X'//text) + call compare_checksums(y1(INDICES_DATA_,l),y2(INDICES_DATA_,l),type//' AGRID SCALAR_PAIR Y'//text) + enddo + + call mpp_clear_group_update(group_update) + + deallocate(pe_start, pe_end, tile1, tile2) + deallocate(istart1, iend1, jstart1, jend1) + deallocate(istart2, iend2, jstart2, jend2) + deallocate(layout2D, global_indices) + + deallocate(a1, x1, y1) + deallocate(a2, x2, y2) + deallocate(base) + call mpp_deallocate_domain(domain) + +end subroutine TEST_GROUP_UPDATE_ + +#undef INDICES_MEM_ +#undef INDICES_MEM_ISHIFT_ +#undef INDICES_MEM_JSHIFT_ +#undef INDICES_MEM_IJSHIFT_ +#undef INDICES_COMPUTE_ +#undef INDICES_COMPUTE_ISHIFT_ +#undef INDICES_COMPUTE_JSHIFT_ +#undef INDICES_COMPUTE_IJSHIFT_ +#undef INDICES_COMPUTE_HALO_ +#undef INDICES_DATA_ +#undef INDICES_DATA_ISHIFT_ +#undef INDICES_DATA_JSHIFT_ +#undef INDICES_DATA_IJSHIFT_ diff --git a/test_fms/mpp/test_clock_init.F90 b/test_fms/mpp/test_clock_init.F90 index 22fb53df3c..2606533cd5 100644 --- a/test_fms/mpp/test_clock_init.F90 +++ b/test_fms/mpp/test_clock_init.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file diff --git a/test_fms/mpp/test_clock_init.sh b/test_fms/mpp/test_clock_init.sh index 7ce49da379..7b0eec3b2b 100755 --- a/test_fms/mpp/test_clock_init.sh +++ b/test_fms/mpp/test_clock_init.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL Flexible Modeling System (FMS). -# -# FMS is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FMS is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/mpp/test_domains_simple.F90 b/test_fms/mpp/test_domains_simple.F90 index abc36adc24..9154788e3a 100644 --- a/test_fms/mpp/test_domains_simple.F90 +++ b/test_fms/mpp/test_domains_simple.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file diff --git a/test_fms/mpp/test_domains_utility_mod.F90 b/test_fms/mpp/test_domains_utility_mod.F90 index 65926016ed..68d0351ea5 100644 --- a/test_fms/mpp/test_domains_utility_mod.F90 +++ b/test_fms/mpp/test_domains_utility_mod.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @author Miguel Zuniga !> @brief A module with utility auxiliary interface supporting test_mpp_domains. diff --git a/test_fms/mpp/test_global_arrays.F90 b/test_fms/mpp/test_global_arrays.F90 index 4f27b0c666..724c670edc 100644 --- a/test_fms/mpp/test_global_arrays.F90 +++ b/test_fms/mpp/test_global_arrays.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @author Ryan Mulhall !> @email gfdl.climate.model.info@noaa.gov diff --git a/test_fms/mpp/test_global_arrays.sh b/test_fms/mpp/test_global_arrays.sh index 18390415e5..9790654936 100755 --- a/test_fms/mpp/test_global_arrays.sh +++ b/test_fms/mpp/test_global_arrays.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL Flexible Modeling System (FMS). -# -# FMS is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FMS is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/mpp/test_minmax.F90 b/test_fms/mpp/test_minmax.F90 index e0fecd15bc..9c84e968f9 100644 --- a/test_fms/mpp/test_minmax.F90 +++ b/test_fms/mpp/test_minmax.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @author Eric Stofferahn !> @brief Test mpp_min and mpp_max functions for various precisions of diff --git a/test_fms/mpp/test_minmax.sh b/test_fms/mpp/test_minmax.sh index 2e1a547b0e..112606e659 100755 --- a/test_fms/mpp/test_minmax.sh +++ b/test_fms/mpp/test_minmax.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL Flexible Modeling System (FMS). -# -# FMS is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FMS is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/mpp/test_mpp.F90 b/test_fms/mpp/test_mpp.F90 index 70abfbdbc4..646fd4e16e 100644 --- a/test_fms/mpp/test_mpp.F90 +++ b/test_fms/mpp/test_mpp.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** #ifdef SYSTEM_CLOCK #undef SYSTEM_CLOCK diff --git a/test_fms/mpp/test_mpp2.sh b/test_fms/mpp/test_mpp2.sh index 1a9a5c030f..fd9c8fb15c 100755 --- a/test_fms/mpp/test_mpp2.sh +++ b/test_fms/mpp/test_mpp2.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL Flexible Modeling System (FMS). -# -# FMS is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FMS is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/mpp/test_mpp_alltoall.F90 b/test_fms/mpp/test_mpp_alltoall.F90 index 85e52f3a97..f611d5537e 100644 --- a/test_fms/mpp/test_mpp_alltoall.F90 +++ b/test_fms/mpp/test_mpp_alltoall.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !! @brief unit test for mpp_alltoall diff --git a/test_fms/mpp/test_mpp_alltoall.sh b/test_fms/mpp/test_mpp_alltoall.sh index c186b11efb..13f09fd2bc 100755 --- a/test_fms/mpp/test_mpp_alltoall.sh +++ b/test_fms/mpp/test_mpp_alltoall.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL Flexible Modeling System (FMS). -# -# FMS is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FMS is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/mpp/test_mpp_broadcast.F90 b/test_fms/mpp/test_mpp_broadcast.F90 index 74f7d28886..ba96dc17c0 100644 --- a/test_fms/mpp/test_mpp_broadcast.F90 +++ b/test_fms/mpp/test_mpp_broadcast.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !! @brief unit test for mpp_broadcast diff --git a/test_fms/mpp/test_mpp_broadcast.sh b/test_fms/mpp/test_mpp_broadcast.sh index bb3a5db5ff..fbd1eb8c8a 100755 --- a/test_fms/mpp/test_mpp_broadcast.sh +++ b/test_fms/mpp/test_mpp_broadcast.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL Flexible Modeling System (FMS). -# -# FMS is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FMS is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/mpp/test_mpp_chksum.F90 b/test_fms/mpp/test_mpp_chksum.F90 index 5810e42cab..b0e9e47ec2 100644 --- a/test_fms/mpp/test_mpp_chksum.F90 +++ b/test_fms/mpp/test_mpp_chksum.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @author Ryan Mulhall !> @email gfdl.climate.model.info@noaa.gov diff --git a/test_fms/mpp/test_mpp_chksum.sh b/test_fms/mpp/test_mpp_chksum.sh index bea691aa5f..1d3d6e64bd 100755 --- a/test_fms/mpp/test_mpp_chksum.sh +++ b/test_fms/mpp/test_mpp_chksum.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL Flexible Modeling System (FMS). -# -# FMS is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FMS is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/mpp/test_mpp_clock_begin_end_id.F90 b/test_fms/mpp/test_mpp_clock_begin_end_id.F90 index 653f0b941e..f7f9dc3240 100644 --- a/test_fms/mpp/test_mpp_clock_begin_end_id.F90 +++ b/test_fms/mpp/test_mpp_clock_begin_end_id.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file diff --git a/test_fms/mpp/test_mpp_clock_begin_end_id.sh b/test_fms/mpp/test_mpp_clock_begin_end_id.sh index beeeb287e1..9e7173a054 100755 --- a/test_fms/mpp/test_mpp_clock_begin_end_id.sh +++ b/test_fms/mpp/test_mpp_clock_begin_end_id.sh @@ -1,21 +1,20 @@ #!/bin/sh #*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL Flexible Modeling System (FMS). -# -# FMS is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FMS is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/mpp/test_mpp_domains.F90 b/test_fms/mpp/test_mpp_domains.F90 index ffd9a45d26..b9ba0f3b0a 100644 --- a/test_fms/mpp/test_mpp_domains.F90 +++ b/test_fms/mpp/test_mpp_domains.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* Gnu Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** program test_mpp_domains use mpp_mod, only : FATAL, WARNING, MPP_DEBUG, NOTE, MPP_CLOCK_SYNC,MPP_CLOCK_DETAILED @@ -59,6 +58,7 @@ program test_mpp_domains use compare_data_checksums use test_domains_utility_mod use platform_mod + use fms_test_mod, only: permutable_indices_3d, factorial, arr_init, arr_compare implicit none @@ -114,7 +114,7 @@ program test_mpp_domains test_group, test_global_sum, test_subset, test_nonsym_edge, & test_halosize_performance, test_adjoint, wide_halo, & test_unstruct - integer :: i, j, k, n + integer :: i, j, k, n, p integer :: layout(2) integer :: id integer :: outunit, errunit, io_status @@ -225,10 +225,15 @@ program test_mpp_domains if (mpp_pe() == mpp_root_pe()) print *, '--------------------> Calling test_unstruct <-------------------' endif if( test_group) then - if (mpp_pe() == mpp_root_pe()) print *, '--------------------> Calling test_group <-------------------' - call test_group_update( 'Folded-north' ) - call test_group_update( 'Cubic-Grid' ) - if (mpp_pe() == mpp_root_pe()) print *, '--------------------> Calling test_group <-------------------' + if (mpp_pe() == mpp_root_pe()) print *, '--------------------> Testing group_update <-------------------' + do p=1,factorial(3) + call test_group_update_r4('Folded-north', p) + call test_group_update_r4('Cubic-Grid', p) + + call test_group_update_r8('Folded-north', p) + call test_group_update_r8('Cubic-Grid', p) + enddo + if (mpp_pe() == mpp_root_pe()) print *, '--------------------> Finished testing group_update <-------------------' endif if( test_interface ) then @@ -2469,512 +2474,17 @@ subroutine test_mpp_global_sum( type ) end subroutine test_mpp_global_sum - !############################################################### - subroutine test_group_update( type ) - character(len=*), intent(in) :: type - - type(domain2D) :: domain - integer :: num_contact, ntiles, npes_per_tile - integer :: i, j, k, l, n, shift - integer :: isc, iec, jsc, jec, isd, ied, jsd, jed - integer :: ism, iem, jsm, jem - - integer, allocatable, dimension(:) :: pe_start, pe_end, tile1, tile2 - integer, allocatable, dimension(:) :: istart1, iend1, jstart1, jend1 - integer, allocatable, dimension(:) :: istart2, iend2, jstart2, jend2 - integer, allocatable, dimension(:,:) :: layout2D, global_indices - real, allocatable, dimension(:,:,:,:) :: x1, y1, x2, y2 - real, allocatable, dimension(:,:,:,:) :: a1, a2 - real, allocatable, dimension(:,:,:) :: base - integer :: id1, id2, id3 - logical :: folded_north - logical :: cubic_grid - character(len=3) :: text - integer :: nx_save, ny_save - type(mpp_group_update_type) :: group_update - type(mpp_group_update_type), allocatable :: update_list(:) - - folded_north = .false. - cubic_grid = .false. - - nx_save = nx - ny_save = ny - !--- check the type - select case(type) - case ( 'Folded-north' ) - ntiles = 1 - shift = 0 - num_contact = 2 - folded_north = .true. - npes_per_tile = npes - if(layout_tripolar(1)*layout_tripolar(2) == npes ) then - layout = layout_tripolar - else - call mpp_define_layout( (/1,nx,1,ny/), npes_per_tile, layout ) - endif - case ( 'Cubic-Grid' ) - if( nx_cubic == 0 ) then - call mpp_error(NOTE,'test_group_update: for Cubic_grid mosaic, nx_cubic is zero, '//& - 'No test is done for Cubic-Grid mosaic. ' ) - return - endif - if( nx_cubic .NE. ny_cubic ) then - call mpp_error(NOTE,'test_group_update: for Cubic_grid mosaic, nx_cubic does not equal ny_cubic, '//& - 'No test is done for Cubic-Grid mosaic. ' ) - return - endif - shift = 1 - nx = nx_cubic - ny = ny_cubic - ntiles = 6 - num_contact = 12 - cubic_grid = .true. - if( mod(npes, ntiles) == 0 ) then - npes_per_tile = npes/ntiles - write(outunit,*)'NOTE from update_domains_performance ==> For Mosaic "', trim(type), & - '", each tile will be distributed over ', npes_per_tile, ' processors.' - else - call mpp_error(NOTE,'test_group_update: npes should be multiple of ntiles No test is done for '//trim(type)) - return - endif - if(layout_cubic(1)*layout_cubic(2) == npes_per_tile) then - layout = layout_cubic - else - call mpp_define_layout( (/1,nx,1,ny/), npes_per_tile, layout ) - endif - case default - call mpp_error(FATAL, 'test_group_update: no such test: '//type) - end select - - allocate(layout2D(2,ntiles), global_indices(4,ntiles), pe_start(ntiles), pe_end(ntiles) ) - do n = 1, ntiles - pe_start(n) = (n-1)*npes_per_tile - pe_end(n) = n*npes_per_tile-1 - end do - - do n = 1, ntiles - global_indices(:,n) = (/1,nx,1,ny/) - layout2D(:,n) = layout - end do - - allocate(tile1(num_contact), tile2(num_contact) ) - allocate(istart1(num_contact), iend1(num_contact), jstart1(num_contact), jend1(num_contact) ) - allocate(istart2(num_contact), iend2(num_contact), jstart2(num_contact), jend2(num_contact) ) - - !--- define domain - if(folded_north) then - !--- Contact line 1, between tile 1 (EAST) and tile 1 (WEST) --- cyclic - tile1(1) = 1; tile2(1) = 1 - istart1(1) = nx; iend1(1) = nx; jstart1(1) = 1; jend1(1) = ny - istart2(1) = 1; iend2(1) = 1; jstart2(1) = 1; jend2(1) = ny - !--- Contact line 2, between tile 1 (NORTH) and tile 1 (NORTH) --- folded-north-edge - tile1(2) = 1; tile2(2) = 1 - istart1(2) = 1; iend1(2) = nx/2; jstart1(2) = ny; jend1(2) = ny - istart2(2) = nx; iend2(2) = nx/2+1; jstart2(2) = ny; jend2(2) = ny - call mpp_define_mosaic(global_indices, layout2D, domain, ntiles, num_contact, tile1, tile2, & - istart1, iend1, jstart1, jend1, istart2, iend2, jstart2, jend2, & - pe_start, pe_end, whalo=whalo, ehalo=ehalo, shalo=shalo, nhalo=nhalo, & - name = type, symmetry = .false. ) - else if( cubic_grid ) then - call define_cubic_mosaic(type, domain, (/nx,nx,nx,nx,nx,nx/), (/ny,ny,ny,ny,ny,ny/), & - global_indices, layout2D, pe_start, pe_end ) - endif - - !--- setup data - call mpp_get_compute_domain( domain, isc, iec, jsc, jec ) - call mpp_get_data_domain ( domain, isd, ied, jsd, jed ) - call mpp_get_memory_domain ( domain, ism, iem, jsm, jem ) - - if(num_fields<1) then - call mpp_error(FATAL, "test_mpp_domains: num_fields must be a positive integer") - endif - - allocate(update_list(num_fields)) - - id1 = mpp_clock_id( type//' group 2D', flags=MPP_CLOCK_SYNC ) - id2 = mpp_clock_id( type//' non-group 2D', flags=MPP_CLOCK_SYNC ) - id3 = mpp_clock_id( type//' non-block group 2D', flags=MPP_CLOCK_SYNC ) - - allocate( a1(ism:iem, jsm:jem, nz, num_fields) ) - allocate( x1(ism:iem+shift,jsm:jem, nz, num_fields) ) - allocate( y1(ism:iem, jsm:jem+shift, nz, num_fields) ) - allocate( a2(ism:iem, jsm:jem, nz, num_fields) ) - allocate( x2(ism:iem+shift,jsm:jem, nz, num_fields) ) - allocate( y2(ism:iem, jsm:jem+shift, nz, num_fields) ) - allocate( base(isc:iec+shift,jsc:jec+shift,nz) ) - a1 = 0; x1 = 0; y1 = 0 - - base = 0 - do k = 1,nz - do j = jsc, jec+shift - do i = isc, iec+shift - base(i,j,k) = k + i*1e-3 + j*1e-6 - end do - end do - end do - - !--- Test for partial direction update - do l =1, num_fields - call mpp_create_group_update(group_update, a1(:,:,:,l), domain, flags=WUPDATE+SUPDATE) - end do - - do l = 1, num_fields - a1(isc:iec,jsc:jec,:,l) = base(isc:iec,jsc:jec,:) + l*1e3 - do k=1,nz - do i=isc-1,iec+1 - a1(i,jsc-1,k,l) = 999; - a1(i,jec+1,k,l) = 999; - enddo - do j=jsc,jec - a1(isc-1,j,k,l) = 999 - a1(iec+1,j,k,l) = 999 - enddo - enddo - enddo - - a2 = a1 - call mpp_do_group_update(group_update, domain, a1(isc,jsc,1,1)) - - do l = 1, num_fields - call mpp_update_domains( a2(:,:,:,l), domain, flags=WUPDATE+SUPDATE, complete=l==num_fields ) - enddo - - do l = 1, num_fields - write(text, '(i3.3)') l - call compare_checksums(a1(isd:ied,jsd:jed,:,l),a2(isd:ied,jsd:jed,:,l),type//' CENTER South West '//text) - enddo - - call mpp_clear_group_update(group_update) - - !--- Test for DGRID update - if(type == 'Cubic-Grid' ) then - x1 = 0; y1 = 0 - do l =1, num_fields - call mpp_create_group_update(group_update, x1(:,:,:,l), y1(:,:,:,l), domain, gridtype=DGRID_NE) - end do - - do l = 1, num_fields - y1(isc:iec+shift,jsc:jec, :,l) = base(isc:iec+shift,jsc:jec, :) + l*1e3 + 1e6 - x1(isc:iec, jsc:jec+shift,:,l) = base(isc:iec, jsc:jec+shift,:) + l*1e3 + 2*1e6 - enddo - x2 = x1; y2 = y1 - call mpp_start_group_update(group_update, domain, x1(isc,jsc,1,1)) - call mpp_complete_group_update(group_update, domain, x1(isc,jsc,1,1)) - - do l = 1, num_fields - call mpp_update_domains( x2(:,:,:,l), y2(:,:,:,l), domain, gridtype=DGRID_NE, complete=l==num_fields ) - enddo - - !--- compare checksum - do l = 1, num_fields - write(text, '(i3.3)') l - call compare_checksums(x1(isd:ied+shift,jsd:jed, :,l),x2(isd:ied+shift,jsd:jed, :,l),type//' DGRID X'//text) - call compare_checksums(y1(isd:ied, jsd:jed+shift,:,l),y2(isd:ied, jsd:jed+shift,:,l),type//' DGRID Y'//text) - enddo - - call mpp_clear_group_update(group_update) - endif - !--- Test for CGRID - a1 = 0; x1 = 0; y1 = 0 - do l =1, num_fields - call mpp_create_group_update(group_update, a1(:,:,:,l), domain) - call mpp_create_group_update(group_update, x1(:,:,:,l), y1(:,:,:,l), domain, gridtype=CGRID_NE) - end do - - do n = 1, num_iter - a1 = 0; x1 = 0; y1 = 0 - do l = 1, num_fields - a1(isc:iec, jsc:jec, :,l) = base(isc:iec, jsc:jec, :) + l*1e3 - x1(isc:iec+shift,jsc:jec, :,l) = base(isc:iec+shift,jsc:jec, :) + l*1e3 + 1e6 - y1(isc:iec, jsc:jec+shift,:,l) = base(isc:iec, jsc:jec+shift,:) + l*1e3 + 2*1e6 - enddo - a2 = a1; x2 = x1; y2 = y1 - call mpp_clock_begin(id1) - call mpp_do_group_update(group_update, domain, a1(isc,jsc,1,1)) - call mpp_clock_end (id1) - - call mpp_clock_begin(id2) - do l = 1, num_fields - call mpp_update_domains( a2(:,:,:,l), domain, complete=l==num_fields ) - enddo - do l = 1, num_fields - call mpp_update_domains( x2(:,:,:,l), y2(:,:,:,l), domain, gridtype=CGRID_NE, complete=l==num_fields ) - enddo - call mpp_clock_end(id2) - - !--- compare checksum - if( n == num_iter ) then - do l = 1, num_fields - write(text, '(i3.3)') l - call compare_checksums(a1(isd:ied, jsd:jed, :,l),a2(isd:ied, jsd:jed, :,l),type//' CENTER '//text) - call compare_checksums(x1(isd:ied+shift,jsd:jed, :,l),x2(isd:ied+shift,jsd:jed, :,l),type//' CGRID X'//text) - call compare_checksums(y1(isd:ied, jsd:jed+shift,:,l),y2(isd:ied, jsd:jed+shift,:,l),type//' CGRID Y'//text) - enddo - endif - a1 = 0; x1 = 0; y1 = 0 - do l = 1, num_fields - a1(isc:iec, jsc:jec, :,l) = base(isc:iec, jsc:jec, :) + l*1e3 - x1(isc:iec+shift,jsc:jec, :,l) = base(isc:iec+shift,jsc:jec, :) + l*1e3 + 1e6 - y1(isc:iec, jsc:jec+shift,:,l) = base(isc:iec, jsc:jec+shift,:) + l*1e3 + 2*1e6 - enddo - call mpp_clock_begin(id3) - call mpp_start_group_update(group_update, domain, a1(isc,jsc,1,1)) - call mpp_complete_group_update(group_update, domain, a1(isc,jsc,1,1)) - call mpp_clock_end (id3) - !--- compare checksum - if( n == num_iter ) then - do l = 1, num_fields - write(text, '(i3.3)') l - call compare_checksums(a1(isd:ied, jsd:jed, :,l),a2(isd:ied, jsd:jed, :,l), & - type//' nonblock CENTER '//text) - call compare_checksums(x1(isd:ied+shift,jsd:jed, :,l),x2(isd:ied+shift,jsd:jed, :,l), & - type//' nonblock CGRID X'//text) - call compare_checksums(y1(isd:ied, jsd:jed+shift,:,l),y2(isd:ied, jsd:jed+shift,:,l), & - type//' nonblock CGRID Y'//text) - enddo - endif - enddo - - call mpp_clear_group_update(group_update) - - !--- The following is to test overlapping start and complete - if( num_fields > 1 ) then - do l =1, num_fields - call mpp_create_group_update(update_list(l), a1(:,:,:,l), domain) - call mpp_create_group_update(update_list(l), x1(:,:,:,l), y1(:,:,:,l), domain, gridtype=CGRID_NE) - end do - - do n = 1, num_iter - - a1 = 0; x1 = 0; y1 = 0 - do l = 1, num_fields - a1(isc:iec, jsc:jec, :,l) = base(isc:iec, jsc:jec, :) + l*1e3 - x1(isc:iec+shift,jsc:jec, :,l) = base(isc:iec+shift,jsc:jec, :) + l*1e3 + 1e6 - y1(isc:iec, jsc:jec+shift,:,l) = base(isc:iec, jsc:jec+shift,:) + l*1e3 + 2*1e6 - enddo - do l = 1, num_fields-1 - call mpp_start_group_update(update_list(l), domain, a1(isc,jsc,1,1)) - enddo - - call mpp_complete_group_update(update_list(1), domain, a1(isc,jsc,1,1)) - call mpp_start_group_update(update_list(num_fields), domain, a1(isc,jsc,1,1)) - do l = 2, num_fields - call mpp_complete_group_update(update_list(l), domain, a1(isc,jsc,1,1)) - enddo - !--- compare checksum - if( n == num_iter ) then - do l = 1, num_fields - write(text, '(i3.3)') l - call compare_checksums(a1(isd:ied, jsd:jed, :,l),a2(isd:ied, jsd:jed, :,l), & - type//' multiple nonblock CENTER '//text) - call compare_checksums(x1(isd:ied+shift,jsd:jed, :,l),x2(isd:ied+shift,jsd:jed, :,l), & - type//' multiple nonblock CGRID X'//text) - call compare_checksums(y1(isd:ied, jsd:jed+shift,:,l),y2(isd:ied, jsd:jed+shift,:,l), & - type//' multiple nonblock CGRID Y'//text) - enddo - endif - enddo - endif - - do l =1, num_fields - call mpp_clear_group_update(update_list(l)) - enddo - deallocate(update_list) - - !--- test scalar 4-D variable - call mpp_create_group_update(group_update, a1(:,:,:,:), domain) - - a1 = 0; x1 = 0; y1 = 0 - do l = 1, num_fields - a1(isc:iec, jsc:jec, :,l) = base(isc:iec, jsc:jec, :) + l*1e3 - enddo - a2 = a1; x2 = x1; y2 = y1 - call mpp_clock_begin(id1) - call mpp_do_group_update(group_update, domain, a1(isc,jsc,1,1)) - call mpp_clock_end (id1) - - call mpp_clock_begin(id2) - call mpp_update_domains( a2(:,:,:,:), domain ) - call mpp_clock_end(id2) - - !--- compare checksum - do l = 1, num_fields - write(text, '(i3.3)') l - call compare_checksums(a1(isd:ied, jsd:jed, :,l),a2(isd:ied, jsd:jed, :,l),type//' 4D CENTER '//text) - enddo - - a1 = 0 - do l = 1, num_fields - a1(isc:iec, jsc:jec, :,l) = base(isc:iec, jsc:jec, :) + l*1e3 - enddo - call mpp_clock_begin(id3) - call mpp_start_group_update(group_update, domain, a1(isc,jsc,1,1)) - call mpp_complete_group_update(group_update, domain, a1(isc,jsc,1,1)) - call mpp_clock_end (id3) - - !--- compare checksum - do l = 1, num_fields - write(text, '(i3.3)') l - call compare_checksums(a1(isd:ied, jsd:jed, :,l),a2(isd:ied, jsd:jed, :,l), & - type//' nonblock 4D CENTER '//text) - enddo - - - - !--- test for BGRID. - deallocate(a1, x1, y1) - deallocate(a2, x2, y2) - call mpp_clear_group_update(group_update) - - allocate( a1(ism:iem+shift,jsm:jem+shift, nz, num_fields) ) - allocate( x1(ism:iem+shift,jsm:jem+shift, nz, num_fields) ) - allocate( y1(ism:iem+shift,jsm:jem+shift, nz, num_fields) ) - allocate( a2(ism:iem+shift,jsm:jem+shift, nz, num_fields) ) - allocate( x2(ism:iem+shift,jsm:jem+shift, nz, num_fields) ) - allocate( y2(ism:iem+shift,jsm:jem+shift, nz, num_fields) ) - - do l =1, num_fields - call mpp_create_group_update(group_update, a1(:,:,:,l), domain, position=CORNER) - call mpp_create_group_update(group_update, x1(:,:,:,l), y1(:,:,:,l), domain, gridtype=BGRID_NE) - end do - - do n = 1, num_iter - a1 = 0; x1 = 0; y1 = 0 - do l = 1, num_fields - a1(isc:iec+shift,jsc:jec+shift,:,l) = base(isc:iec+shift,jsc:jec+shift,:) + l*1e3 - x1(isc:iec+shift,jsc:jec+shift,:,l) = base(isc:iec+shift,jsc:jec+shift,:) + l*1e3 + 1e6 - y1(isc:iec+shift,jsc:jec+shift,:,l) = base(isc:iec+shift,jsc:jec+shift,:) + l*1e3 + 2*1e6 - enddo - a2 = a1; x2 = x1; y2 = y1 - call mpp_clock_begin(id1) - call mpp_do_group_update(group_update, domain, a1(isc,jsc,1,1)) - call mpp_clock_end (id1) - - call mpp_clock_begin(id2) - do l = 1, num_fields - call mpp_update_domains( a2(:,:,:,l), domain, position=CORNER, complete=l==num_fields ) - enddo - do l = 1, num_fields - call mpp_update_domains( x2(:,:,:,l), y2(:,:,:,l), domain, gridtype=BGRID_NE, complete=l==num_fields ) - enddo - call mpp_clock_end(id2) - - !--- compare checksum - if( n == num_iter ) then - do l = 1, num_fields - write(text, '(i3.3)') l - call compare_checksums(a1(isd:ied+shift,jsd:jed+shift,:,l),a2(isd:ied+shift,jsd:jed+shift,:,l),type//& - & ' CORNER '// text) - call compare_checksums(x1(isd:ied+shift,jsd:jed+shift,:,l),x2(isd:ied+shift,jsd:jed+shift,:,l),type//& - & ' BGRID X'// text) - call compare_checksums(y1(isd:ied+shift,jsd:jed+shift,:,l),y2(isd:ied+shift,jsd:jed+shift,:,l),type//& - & ' BGRID Y'// text) - enddo - endif - - a1 = 0; x1 = 0; y1 = 0 - do l = 1, num_fields - a1(isc:iec+shift,jsc:jec+shift,:,l) = base(isc:iec+shift,jsc:jec+shift,:) + l*1e3 - x1(isc:iec+shift,jsc:jec+shift,:,l) = base(isc:iec+shift,jsc:jec+shift,:) + l*1e3 + 1e6 - y1(isc:iec+shift,jsc:jec+shift,:,l) = base(isc:iec+shift,jsc:jec+shift,:) + l*1e3 + 2*1e6 - enddo - call mpp_clock_begin(id3) - call mpp_start_group_update(group_update, domain, a1(isc,jsc,1,1)) - call mpp_complete_group_update(group_update, domain, a1(isc,jsc,1,1)) - call mpp_clock_end (id3) - !--- compare checksum - if( n == num_iter ) then - do l = 1, num_fields - write(text, '(i3.3)') l - call compare_checksums(a1(isd:ied+shift,jsd:jed+shift,:,l),a2(isd:ied+shift,jsd:jed+shift,:,l), & - type//' nonblockCORNER '//text) - call compare_checksums(x1(isd:ied+shift,jsd:jed+shift,:,l),x2(isd:ied+shift,jsd:jed+shift,:,l), & - type//' nonblock BGRID X'//text) - call compare_checksums(y1(isd:ied+shift,jsd:jed+shift,:,l),y2(isd:ied+shift,jsd:jed+shift,:,l), & - type//' nonblock BGRID Y'//text) - enddo - endif - enddo - - call mpp_clear_group_update(group_update) - - !----------------------------------------------------------------------------- - ! test for AGRID vector and scalar pair - !----------------------------------------------------------------------------- - deallocate(x1, y1) - deallocate(x2, y2) - - allocate( x1(ism:iem,jsm:jem, nz, num_fields) ) - allocate( y1(ism:iem,jsm:jem, nz, num_fields) ) - allocate( x2(ism:iem,jsm:jem, nz, num_fields) ) - allocate( y2(ism:iem,jsm:jem, nz, num_fields) ) - - x1 = 0; y1 = 0 - do l = 1, num_fields - x1(isc:iec,jsc:jec,:,l) = base(isc:iec,jsc:jec,:) + l*1e3 + 1e6 - y1(isc:iec,jsc:jec,:,l) = base(isc:iec,jsc:jec,:) + l*1e3 + 2*1e6 - enddo - x2 = x1; y2 = y1 - - do l =1, num_fields - call mpp_create_group_update(group_update, x1(:,:,:,l), y1(:,:,:,l), domain, gridtype=AGRID) - end do - - do l = 1, num_fields - call mpp_update_domains( x2(:,:,:,l), y2(:,:,:,l), domain, gridtype=AGRID, complete=l==num_fields ) - enddo - - call mpp_start_group_update(group_update, domain, a1(isc,jsc,1,1)) - call mpp_complete_group_update(group_update, domain, a1(isc,jsc,1,1)) - - !--- compare checksum - do l = 1, num_fields - write(text, '(i3.3)') l - call compare_checksums(x1(isd:ied,jsd:jed,:,l),x2(isd:ied,jsd:jed,:,l),type//' AGRID X'//text) - call compare_checksums(y1(isd:ied,jsd:jed,:,l),y2(isd:ied,jsd:jed,:,l),type//' AGRID Y'//text) - enddo - - call mpp_clear_group_update(group_update) - - x1 = 0; y1 = 0 - do l = 1, num_fields - x1(isc:iec,jsc:jec,:,l) = base(isc:iec,jsc:jec,:) + l*1e3 + 1e6 - y1(isc:iec,jsc:jec,:,l) = base(isc:iec,jsc:jec,:) + l*1e3 + 2*1e6 - enddo - x2 = x1; y2 = y1 - - do l =1, num_fields - call mpp_create_group_update(group_update, x1(:,:,:,l), y1(:,:,:,l), domain, gridtype=AGRID, flags=SCALAR_PAIR) - end do - - do l = 1, num_fields - call mpp_update_domains( x2(:,:,:,l), y2(:,:,:,l), domain, gridtype=AGRID, flags=SCALAR_PAIR, & - & complete=l==num_fields) - enddo - - call mpp_start_group_update(group_update, domain, x1(isc,jsc,1,1)) - call mpp_complete_group_update(group_update, domain, x1(isc,jsc,1,1)) - - !--- compare checksum - do l = 1, num_fields - write(text, '(i3.3)') l - call compare_checksums(x1(isd:ied,jsd:jed,:,l),x2(isd:ied,jsd:jed,:,l),type//' AGRID SCALAR_PAIR X'//text) - call compare_checksums(y1(isd:ied,jsd:jed,:,l),y2(isd:ied,jsd:jed,:,l),type//' AGRID SCALAR_PAIR Y'//text) - enddo - - call mpp_clear_group_update(group_update) - - deallocate(pe_start, pe_end, tile1, tile2) - deallocate(istart1, iend1, jstart1, jend1) - deallocate(istart2, iend2, jstart2, jend2) - deallocate(layout2D, global_indices) - - deallocate(a1, x1, y1) - deallocate(a2, x2, y2) - deallocate(base) - call mpp_deallocate_domain(domain) - -end subroutine test_group_update +#define FMS_TEST_KIND_ r4_kind +#define TEST_GROUP_UPDATE_ test_group_update_r4 +#include "group_update.inc" +#undef FMS_TEST_KIND_ +#undef TEST_GROUP_UPDATE_ + +#define FMS_TEST_KIND_ r8_kind +#define TEST_GROUP_UPDATE_ test_group_update_r8 +#include "group_update.inc" +#undef FMS_TEST_KIND_ +#undef TEST_GROUP_UPDATE_ !############################################################### diff --git a/test_fms/mpp/test_mpp_domains2.sh b/test_fms/mpp/test_mpp_domains2.sh index fb4de0bf5b..a9b26f2cd3 100755 --- a/test_fms/mpp/test_mpp_domains2.sh +++ b/test_fms/mpp/test_mpp_domains2.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL Flexible Modeling System (FMS). -# -# FMS is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FMS is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to @@ -28,6 +27,9 @@ # Set common test settings. . ../test-lib.sh +# TODO: Enable this test once generalized indices work is complete +SKIP_TESTS="test_mpp_domains2.12" + # TODO edge update, fails on non-blocking with gnu #SKIP_TESTS="$SKIP_TESTS $(basename $0 .sh).6" diff --git a/test_fms/mpp/test_mpp_gatscat.F90 b/test_fms/mpp/test_mpp_gatscat.F90 index 11b676fe65..2dbdd06615 100644 --- a/test_fms/mpp/test_mpp_gatscat.F90 +++ b/test_fms/mpp/test_mpp_gatscat.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** #ifdef SYSTEM_CLOCK #undef SYSTEM_CLOCK diff --git a/test_fms/mpp/test_mpp_gatscat.sh b/test_fms/mpp/test_mpp_gatscat.sh index 38a4b70619..2a2b6f3871 100755 --- a/test_fms/mpp/test_mpp_gatscat.sh +++ b/test_fms/mpp/test_mpp_gatscat.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL Flexible Modeling System (FMS). -# -# FMS is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FMS is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/mpp/test_mpp_get_ascii_lines.F90 b/test_fms/mpp/test_mpp_get_ascii_lines.F90 index c99ec75fbf..e16479fe17 100644 --- a/test_fms/mpp/test_mpp_get_ascii_lines.F90 +++ b/test_fms/mpp/test_mpp_get_ascii_lines.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** program test_get_ascii_lines diff --git a/test_fms/mpp/test_mpp_get_ascii_lines2.sh b/test_fms/mpp/test_mpp_get_ascii_lines2.sh index 3e7ad6cb75..60cb6f98c2 100755 --- a/test_fms/mpp/test_mpp_get_ascii_lines2.sh +++ b/test_fms/mpp/test_mpp_get_ascii_lines2.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/mpp/test_mpp_global_field.F90 b/test_fms/mpp/test_mpp_global_field.F90 index 31a6bce996..514f750c05 100644 --- a/test_fms/mpp/test_mpp_global_field.F90 +++ b/test_fms/mpp/test_mpp_global_field.F90 @@ -1,45 +1,56 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** program test_mpp_global_field - use platform_mod - use compare_data_checksums - use compare_data_checksums_int - use mpp_mod, only : mpp_init, mpp_error, FATAL, mpp_init_test_requests_allocated - use mpp_mod, only : mpp_declare_pelist, mpp_pe, mpp_npes, mpp_root_pe - !use mpp_mod, only : mpp_clock_begin, mpp_clock_end, mpp_clock_id, MPP_CLOCK_SYNC, MPP_CLOCK_DETAILED - use mpp_domains_mod, only : domain2D - use mpp_domains_mod, only : CENTER, EAST, NORTH, CORNER, XUPDATE, YUPDATE - use mpp_domains_mod, only : mpp_domains_init, mpp_domains_exit - use mpp_domains_mod, only : mpp_define_layout, mpp_define_domains - use mpp_domains_mod, only : mpp_get_compute_domain, mpp_get_data_domain, mpp_domains_set_stack_size - use mpp_domains_mod, only : mpp_global_field + use mpp_mod, only: mpp_init, mpp_error, FATAL, mpp_init_test_requests_allocated + use mpp_mod, only: mpp_declare_pelist, mpp_pe, mpp_npes, mpp_root_pe + use mpp_domains_mod, only: domain2D + use mpp_domains_mod, only: CENTER, EAST, NORTH, CORNER, XUPDATE, YUPDATE + use mpp_domains_mod, only: mpp_domains_init, mpp_domains_exit + use mpp_domains_mod, only: mpp_define_layout, mpp_define_domains + use mpp_domains_mod, only: mpp_get_compute_domain, mpp_get_data_domain, mpp_domains_set_stack_size + use mpp_domains_mod, only: mpp_global_field + use fms_test_mod, only: permutable_indices_2d, permutable_indices_3d, factorial, arr_init, arr_compare implicit none + type test_params_t + logical :: symmetry + integer :: position, shift(2) + character(15) :: name + end type test_params_t + + type(test_params_t), parameter :: test_params(*) = [ & + test_params_t(symmetry=.false., position=CENTER, shift=[0,0], name="no symmetry"), & + test_params_t(symmetry=.true., position=CENTER, shift=[0,0], name="center symmetry"), & + test_params_t(symmetry=.true., position=CORNER, shift=[1,1], name="corner symmetry"), & + test_params_t(symmetry=.true., position=EAST, shift=[1,0], name="east symmetry"), & + test_params_t(symmetry=.true., position=NORTH, shift=[0,1], name="north symmetry")] + integer, parameter :: nx=20, ny=20, nz=40 integer, parameter :: whalo=2, ehalo=2, shalo=2, nhalo=2 integer, parameter :: stackmax=4000000 + FMS_TEST_TYPE_ (FMS_TEST_KIND_), parameter :: zero = 0 + integer :: pe, npes, ierr integer :: layout(2) - + integer :: i, p !> call mpp_init call mpp_init(test_level=mpp_init_test_requests_allocated) @@ -52,450 +63,92 @@ program test_mpp_global_field call mpp_domains_init() call mpp_domains_set_stack_size(stackmax) - !> call test_global_field_r4_2d - call test_global_field_r4_2d( 'Non-symmetry' ) - call test_global_field_r4_2d( 'Symmetry center' ) - call test_global_field_r4_2d( 'Symmetry corner' ) - call test_global_field_r4_2d( 'Symmetry east' ) - call test_global_field_r4_2d( 'Symmetry north' ) - !> call test_global_field_r8_2d - call test_global_field_r8_2d( 'Non-symmetry' ) - call test_global_field_r8_2d( 'Symmetry center' ) - call test_global_field_r8_2d( 'Symmetry corner' ) - call test_global_field_r8_2d( 'Symmetry east' ) - call test_global_field_r8_2d( 'Symmetry north' ) - !> call test_global_field_i4_2d - call test_global_field_i4_2d( 'Non-symmetry' ) - call test_global_field_i4_2d( 'Symmetry center' ) - call test_global_field_i4_2d( 'Symmetry corner' ) - call test_global_field_i4_2d( 'Symmetry east' ) - call test_global_field_i4_2d( 'Symmetry north' ) - !> call test_global_field_i8_2d - call test_global_field_i8_2d( 'Non-symmetry' ) - call test_global_field_i8_2d( 'Symmetry center' ) - call test_global_field_i8_2d( 'Symmetry corner' ) - call test_global_field_i8_2d( 'Symmetry east' ) - call test_global_field_i8_2d( 'Symmetry north' ) - !> call test_global_field_r4_3d tests - call test_global_field_r4_3d( 'Non-symmetry' ) - call test_global_field_r4_3d( 'Symmetry center' ) - call test_global_field_r4_3d( 'Symmetry corner' ) - call test_global_field_r4_3d( 'Symmetry east' ) - call test_global_field_r4_3d( 'Symmetry north' ) - !> call test_global_field_r8_3d tests - call test_global_field_r8_3d( 'Non-symmetry' ) - call test_global_field_r8_3d( 'Symmetry center' ) - call test_global_field_r8_3d( 'Symmetry corner' ) - call test_global_field_r8_3d( 'Symmetry east' ) - call test_global_field_r8_3d( 'Symmetry north' ) - !> call test_global_field_i4_3d tests - call test_global_field_i4_3d( 'Non-symmetry' ) - call test_global_field_i4_3d( 'Symmetry center' ) - call test_global_field_i4_3d( 'Symmetry corner' ) - call test_global_field_i4_3d( 'Symmetry east' ) - call test_global_field_i4_3d( 'Symmetry north' ) - !> call test_global_field_i8_3d tests - call test_global_field_i8_3d( 'Non-symmetry' ) - call test_global_field_i8_3d( 'Symmetry center' ) - call test_global_field_i8_3d( 'Symmetry corner' ) - call test_global_field_i8_3d( 'Symmetry east' ) - call test_global_field_i8_3d( 'Symmetry north' ) + do i=1, size(test_params) + ! 2D tests + do p=1,factorial(2) + call run_tests_2d(test_params(i), p) + enddo + + ! 3D tests + do p=1,factorial(3) + call run_tests_3d(test_params(i), p) + enddo + enddo !> exit call mpp_domains_exit() call MPI_finalize(ierr) contains - !> - !> test_global_field_r4_2d - !> - subroutine test_global_field_r4_2d( type ) - - implicit none - character(len=*), intent(in) :: type - - real(kind=r4_kind), parameter :: zero = 0.0 + subroutine run_tests_2d(test_params, p) + type(test_params_t), intent(in) :: test_params + integer, intent(in) :: p !< Permutation of array indices (ranges from 1 to rank!) type(domain2D) :: domain - integer :: position, ishift, jshift, ni, nj, i, j, k - integer :: is, ie, js, je, isd, ied, jsd, jed - !integer :: id + integer :: i, j + type(permutable_indices_2d) :: compute, data, global, global_with_halo, global_x, global_y integer, allocatable :: pelist(:) - real(kind=r4_kind), allocatable :: global1(:,:), x(:,:), gcheck(:,:) - + FMS_TEST_TYPE_ (FMS_TEST_KIND_), allocatable :: global0(:,:), local(:,:), global1(:,:) !> set up domain - call mpp_define_layout( (/1,nx,1,ny/), npes, layout ) - select case(type) - case( 'Non-symmetry' ) - call mpp_define_domains( (/1,nx,1,ny/), layout, domain, whalo=whalo, ehalo=ehalo, & - shalo=shalo, nhalo=nhalo, name=type ) - case( 'Symmetry center', 'Symmetry corner', 'Symmetry east', 'Symmetry north' ) - call mpp_define_domains( (/1,nx,1,ny/), layout, domain, whalo=whalo, ehalo=ehalo, & - shalo=shalo, nhalo=nhalo, name=type, symmetry = .true. ) - case default - call mpp_error( FATAL, 'TEST_MPP_DOMAINS: no such test: '//type//' in test_global_field' ) - end select + call mpp_define_layout([1,nx,1,ny], npes, layout) + call mpp_define_domains([1,nx,1,ny], layout, domain, whalo=whalo, ehalo=ehalo, shalo=shalo, nhalo=nhalo, & + name=trim(test_params%name), symmetry=test_params%symmetry) !> get compute domain - call mpp_get_compute_domain( domain, is, ie, js, je ) - !> get data domain - call mpp_get_data_domain ( domain, isd, ied, jsd, jed ) - - !> determine if an extra point is needed - ishift = 0 ; jshift = 0 ; position=CENTER - select case(type) - case ('Symmetry corner') - ishift = 1 ; jshift = 1 ; position=CORNER - case ('Symmetry east') - ishift = 1 ; jshift = 0 ; position=EAST - case ('Symmetry north') - ishift = 0 ; jshift = 1 ; position=NORTH - end select - - ie = ie+ishift ; je = je+jshift - ied = ied+ishift ; jed = jed+jshift - ni = nx+ishift ; nj = ny+jshift - - !> assign global - allocate( global1(1-whalo:ni+ehalo,1-shalo:nj+nhalo) ) - global1 = zero - do j=1, nj - do i=1, ni - global1(i,j) = real( i*1e-3+j*1e-6, kind=r4_kind ) - end do - enddo - - allocate( gcheck(ni,nj) ) + call mpp_get_compute_domain(domain, compute%lb(1), compute%ub(1), compute%lb(2), compute%ub(2)) + compute%ub = compute%ub + test_params%shift - !> allocate for global domain - allocate( x(isd:ied,jsd:jed) ) - x(:,:) = global1(isd:ied,jsd:jed) - - !> test the data on data domain - gcheck = zero - !id = mpp_clock_id( type//' global field on data domain', flags=MPP_CLOCK_SYNC+MPP_CLOCK_DETAILED ) - !call mpp_clock_begin(id) - call mpp_global_field( domain, x, gcheck, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums( global1(1:ni,1:nj), gcheck, type//' mpp_global_field on r4 data domain' ) - - - !> Since in the disjoint redistribute mpp test, pelist1 = (npes/2+1 .. npes-1) - !! will be declared. But for the x-direction global field, mpp_sync_self will - !! be called. For some pe count, pelist1 will be set ( only on pe of pelist1 ) - !! in the mpp_sync_self call, later when calling mpp_declare_pelist(pelist1), - !! deadlock will happen. For example npes = 6 and layout = (2,3), pelist = (4,5) - !! will be set in mpp_sync_self. To solve the problem, some explicit mpp_declare_pelist - !! on all pe is needed for those partial pelist. But for y-update, it is ok. - !! because the pelist in y-update is not continous. - allocate( pelist(0:layout(1)-1) ) - do j = 0, layout(2)-1 - do i = 0, layout(1)-1 - pelist(i) = j*layout(1) + i - end do - call mpp_declare_pelist(pelist) - end do - deallocate(pelist) - - !> xupdate - gcheck = zero - !call mpp_clock_begin(id) - call mpp_global_field( domain, x, gcheck, flags=XUPDATE, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums( global1(1:ni,js:je), gcheck(1:ni,js:je), type// & - & ' mpp_global_field xupdate only on r4 data domain' ) - - !> yupdate - gcheck = zero - !call mpp_clock_begin(id) - call mpp_global_field( domain, x, gcheck, flags=YUPDATE, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums( global1(is:ie,1:nj), gcheck(is:ie,1:nj), type// & - & ' mpp_global_field yupdate only on r4 data domain' ) - !call mpp_clock_begin(id) - call mpp_global_field( domain, x, gcheck, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums( global1(1:ni,1:nj), gcheck, type//' mpp_global_field on r4 data domain' ) - - !> test the data on compute domain - - deallocate(x) - allocate( x(is:ie,js:je) ) - x(is:ie,js:je) = global1(is:ie,js:je) - - gcheck = zero - !id = mpp_clock_id( type//' global field on compute domain', flags=MPP_CLOCK_SYNC+MPP_CLOCK_DETAILED ) - !call mpp_clock_begin(id) - call mpp_global_field( domain, x(is:ie,js:je), gcheck, position=position ) - !call mpp_clock_end(id) - !>compare checksums between global and x arrays - call compare_checksums( global1(1:ni,1:nj), gcheck, type//' mpp_global_field on r4 compute domain' ) - - !> xupdate - gcheck = zero - !call mpp_clock_begin(id) - call mpp_global_field( domain, x(is:ie,js:je), gcheck, flags=XUPDATE, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums( global1(1:ni,js:je), gcheck(1:ni,js:je), type// & - & ' mpp_global_field xupdate only on r4 compute domain' ) - - !> yupdate - gcheck = zero - !call mpp_clock_begin(id) - call mpp_global_field( domain, x(is:ie,js:je), gcheck, flags=YUPDATE, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums( global1(is:ie,1:nj), gcheck(is:ie,1:nj), type// & - & ' mpp_global_field yupdate only on r4 compute domain' ) - - deallocate(global1, gcheck, x) - - end subroutine test_global_field_r4_2d - !> - !> test_global_field_r8_2d - !> - subroutine test_global_field_r8_2d( type ) - - implicit none - - character(len=*), intent(in) :: type - - real(kind=r8_kind), parameter :: zero = 0.0 - - type(domain2D) :: domain - integer :: position, ishift, jshift, ni, nj, i, j, k - integer :: is, ie, js, je, isd, ied, jsd, jed - !integer :: id - integer, allocatable :: pelist(:) - real(kind=r8_kind), allocatable :: global1(:,:), x(:,:), gcheck(:,:) - - - !> set up domain - call mpp_define_layout( (/1,nx,1,ny/), npes, layout ) - select case(type) - case( 'Non-symmetry' ) - call mpp_define_domains( (/1,nx,1,ny/), layout, domain, whalo=whalo, ehalo=ehalo, & - shalo=shalo, nhalo=nhalo, name=type ) - case( 'Symmetry center', 'Symmetry corner', 'Symmetry east', 'Symmetry north' ) - call mpp_define_domains( (/1,nx,1,ny/), layout, domain, whalo=whalo, ehalo=ehalo, & - shalo=shalo, nhalo=nhalo, name=type, symmetry = .true. ) - case default - call mpp_error( FATAL, 'TEST_MPP_DOMAINS: no such test: '//type//' in test_global_field' ) - end select - - !> get compute domain - call mpp_get_compute_domain( domain, is, ie, js, je ) !> get data domain - call mpp_get_data_domain ( domain, isd, ied, jsd, jed ) - - !> determine if an extra point is needed - ishift = 0 ; jshift = 0 ; position=CENTER - select case(type) - case ('Symmetry corner') - ishift = 1 ; jshift = 1 ; position=CORNER - case ('Symmetry east') - ishift = 1 ; jshift = 0 ; position=EAST - case ('Symmetry north') - ishift = 0 ; jshift = 1 ; position=NORTH - end select - - ie = ie+ishift ; je = je+jshift - ied = ied+ishift ; jed = jed+jshift - ni = nx+ishift ; nj = ny+jshift - - !> assign global - allocate( global1(1-whalo:ni+ehalo,1-shalo:nj+nhalo) ) - global1 = zero - do j=1, nj - do i=1, ni - global1(i,j) = real( i*1e-3+j*1e-6, kind=r8_kind ) - end do - enddo - - allocate( gcheck(ni,nj) ) - - !> allocate for global domain - allocate( x(isd:ied,jsd:jed) ) - x(:,:) = global1(isd:ied,jsd:jed) - - !> test the data on data domain - gcheck = zero - !id = mpp_clock_id( type//' global field on data domain', flags=MPP_CLOCK_SYNC+MPP_CLOCK_DETAILED ) - !call mpp_clock_begin(id) - call mpp_global_field( domain, x, gcheck, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums( global1(1:ni,1:nj), gcheck, type//' mpp_global_field on r8 data domain' ) - - - !> Since in the disjoint redistribute mpp test, pelist1 = (npes/2+1 .. npes-1) - !! will be declared. But for the x-direction global field, mpp_sync_self will - !! be called. For some pe count, pelist1 will be set ( only on pe of pelist1 ) - !! in the mpp_sync_self call, later when calling mpp_declare_pelist(pelist1), - !! deadlock will happen. For example npes = 6 and layout = (2,3), pelist = (4,5) - !! will be set in mpp_sync_self. To solve the problem, some explicit mpp_declare_pelist - !! on all pe is needed for those partial pelist. But for y-update, it is ok. - !! because the pelist in y-update is not continous. - allocate( pelist(0:layout(1)-1) ) - do j = 0, layout(2)-1 - do i = 0, layout(1)-1 - pelist(i) = j*layout(1) + i - end do - call mpp_declare_pelist(pelist) - end do - deallocate(pelist) - - !> xupdate - gcheck = zero - !call mpp_clock_begin(id) - call mpp_global_field( domain, x, gcheck, flags=XUPDATE, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums( global1(1:ni,js:je), gcheck(1:ni,js:je), type// & - & ' mpp_global_field xupdate only on r8 data domain' ) + call mpp_get_data_domain(domain, data%lb(1), data%ub(1), data%lb(2), data%ub(2)) + data%ub = data%ub + test_params%shift - !> yupdate - gcheck = zero - !call mpp_clock_begin(id) - call mpp_global_field( domain, x, gcheck, flags=YUPDATE, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums( global1(is:ie,1:nj), gcheck(is:ie,1:nj), type// & - & ' mpp_global_field yupdate only on r8 data domain' ) - !call mpp_clock_begin(id) - call mpp_global_field( domain, x, gcheck, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums( global1(1:ni,1:nj), gcheck, type//' mpp_global_field on r8 data domain' ) - - !> test the data on compute domain + global%lb = [1, 1] + global%ub = [nx, ny] + test_params%shift - deallocate(x) - allocate( x(is:ie,js:je) ) - x(is:ie,js:je) = global1(is:ie,js:je) + global_with_halo%lb = global%lb - [whalo, shalo] + global_with_halo%ub = global%ub + [ehalo, nhalo] - gcheck = zero - !id = mpp_clock_id( type//' global field on compute domain', flags=MPP_CLOCK_SYNC+MPP_CLOCK_DETAILED ) - !call mpp_clock_begin(id) - call mpp_global_field( domain, x(is:ie,js:je), gcheck, position=position ) - !call mpp_clock_end(id) - !>compare checksums between global and x arrays - call compare_checksums( global1(1:ni,1:nj), gcheck, type//' mpp_global_field on r8 compute domain' ) + global_x%lb = [global%lb(1), compute%lb(2)] + global_x%ub = [global%ub(1), compute%ub(2)] - !> xupdate - gcheck = zero - !call mpp_clock_begin(id) - call mpp_global_field( domain, x(is:ie,js:je), gcheck, flags=XUPDATE, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums( global1(1:ni,js:je), gcheck(1:ni,js:je), type// & - & ' mpp_global_field xupdate only on r8 compute domain' ) - - !> yupdate - gcheck = zero - !call mpp_clock_begin(id) - call mpp_global_field( domain, x(is:ie,js:je), gcheck, flags=YUPDATE, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums( global1(is:ie,1:nj), gcheck(is:ie,1:nj), type// & - & ' mpp_global_field yupdate only on r8 compute domain' ) + global_y%lb = [compute%lb(1), global%lb(2)] + global_y%ub = [compute%ub(1), global%ub(2)] - deallocate(global1, gcheck, x) - - end subroutine test_global_field_r8_2d - !> - !> test_global_field_i4_2d - !> - subroutine test_global_field_i4_2d( type ) - - implicit none - - character(len=*), intent(in) :: type - - integer(kind=i4_kind), parameter :: zero = 0 - - type(domain2D) :: domain - integer :: position, ishift, jshift, ni, nj, i, j, k - integer :: is, ie, js, je, isd, ied, jsd, jed - !integer :: id - integer, allocatable :: pelist(:) - integer(kind=i4_kind), allocatable :: global1(:,:), x(:,:), gcheck(:,:) - - - !> set up domain - call mpp_define_layout( (/1,nx,1,ny/), npes, layout ) - select case(type) - case( 'Non-symmetry' ) - call mpp_define_domains( (/1,nx,1,ny/), layout, domain, whalo=whalo, ehalo=ehalo, & - shalo=shalo, nhalo=nhalo, name=type ) - case( 'Symmetry center', 'Symmetry corner', 'Symmetry east', 'Symmetry north' ) - call mpp_define_domains( (/1,nx,1,ny/), layout, domain, whalo=whalo, ehalo=ehalo, & - shalo=shalo, nhalo=nhalo, name=type, symmetry = .true. ) - case default - call mpp_error( FATAL, 'TEST_MPP_DOMAINS: no such test: '//type//' in test_global_field' ) - end select - - !> get compute domain - call mpp_get_compute_domain( domain, is, ie, js, je ) - !> get data domain - call mpp_get_data_domain ( domain, isd, ied, jsd, jed ) - - !> determine if an extra point is needed - ishift = 0 ; jshift = 0 ; position=CENTER - select case(type) - case ('Symmetry corner') - ishift = 1 ; jshift = 1 ; position=CORNER - case ('Symmetry east') - ishift = 1 ; jshift = 0 ; position=EAST - case ('Symmetry north') - ishift = 0 ; jshift = 1 ; position=NORTH - end select - - ie = ie+ishift ; je = je+jshift - ied = ied+ishift ; jed = jed+jshift - ni = nx+ishift ; nj = ny+jshift + call compute%permute(p) + call data%permute(p) + call global%permute(p) + call global_with_halo%permute(p) + call global_x%permute(p) + call global_y%permute(p) !> assign global - allocate( global1(1-whalo:ni+ehalo,1-shalo:nj+nhalo) ) - global1 = zero - do j=1, nj - do i=1, ni - global1(i,j) = int( i*1e3+j*1e6, kind=i4_kind ) - end do - enddo + allocate(global0(global_with_halo%lb(1):global_with_halo%ub(1), global_with_halo%lb(2):global_with_halo%ub(2))) + global0 = zero + call arr_init(global0(global%lb(1):global%ub(1), global%lb(2):global%ub(2))) - allocate( gcheck(ni,nj) ) + allocate(global1(global%lb(1):global%ub(1), global%lb(2):global%ub(2))) !> allocate for global domain - allocate( x(isd:ied,jsd:jed) ) - x(:,:) = global1(isd:ied,jsd:jed) + allocate(local(data%lb(1):data%ub(1), data%lb(2):data%ub(2))) + local(:,:) = global0(data%lb(1):data%ub(1), data%lb(2):data%ub(2)) !> test the data on data domain - gcheck = zero - !id = mpp_clock_id( type//' global field on data domain', flags=MPP_CLOCK_SYNC+MPP_CLOCK_DETAILED ) - !call mpp_clock_begin(id) - call mpp_global_field( domain, x, gcheck, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums_int( global1(1:ni,1:nj), gcheck, type//' mpp_global_field on i4 data domain' ) - + global1 = zero + call mpp_global_field(domain, local, global1, position=test_params%position) + call arr_compare(global0(global%lb(1):global%ub(1), global%lb(2):global%ub(2)), global1, & + 'mpp_global_field on data domain with ' // trim(test_params%name)) !> Since in the disjoint redistribute mpp test, pelist1 = (npes/2+1 .. npes-1) !! will be declared. But for the x-direction global field, mpp_sync_self will - !! be called. For some pe count, pelist1 will be set ( only on pe of pelist1 ) + !! be called. For some pe count, pelist1 will be set (only on pe of pelist1) !! in the mpp_sync_self call, later when calling mpp_declare_pelist(pelist1), !! deadlock will happen. For example npes = 6 and layout = (2,3), pelist = (4,5) !! will be set in mpp_sync_self. To solve the problem, some explicit mpp_declare_pelist !! on all pe is needed for those partial pelist. But for y-update, it is ok. !! because the pelist in y-update is not continous. - allocate( pelist(0:layout(1)-1) ) + allocate(pelist(0:layout(1)-1)) do j = 0, layout(2)-1 do i = 0, layout(1)-1 pelist(i) = j*layout(1) + i @@ -505,600 +158,124 @@ subroutine test_global_field_i4_2d( type ) deallocate(pelist) !> xupdate - gcheck = zero - !call mpp_clock_begin(id) - call mpp_global_field( domain, x, gcheck, flags=XUPDATE, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums_int( global1(1:ni,js:je), gcheck(1:ni,js:je), type// & - & ' mpp_global_field xupdate only on i4 data domain' ) - - !> yupdate - gcheck = zero - !call mpp_clock_begin(id) - call mpp_global_field( domain, x, gcheck, flags=YUPDATE, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums_int( global1(is:ie,1:nj), gcheck(is:ie,1:nj), type// & - & ' mpp_global_field yupdate only on i4 data domain' ) - !call mpp_clock_begin(id) - call mpp_global_field( domain, x, gcheck, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums_int( global1(1:ni,1:nj), gcheck, type//' mpp_global_field on i4 data domain' ) - - !> test the data on compute domain - - deallocate(x) - allocate( x(is:ie,js:je) ) - x(is:ie,js:je) = global1(is:ie,js:je) - - gcheck = zero - !id = mpp_clock_id( type//' global field on compute domain', flags=MPP_CLOCK_SYNC+MPP_CLOCK_DETAILED ) - !call mpp_clock_begin(id) - call mpp_global_field( domain, x(is:ie,js:je), gcheck, position=position ) - !call mpp_clock_end(id) - !>compare checksums between global and x arrays - call compare_checksums_int( global1(1:ni,1:nj), gcheck, type//' mpp_global_field on i4 compute domain' ) - - !> xupdate - gcheck = zero - !call mpp_clock_begin(id) - call mpp_global_field( domain, x(is:ie,js:je), gcheck, flags=XUPDATE, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums_int( global1(1:ni,js:je), gcheck(1:ni,js:je), type// & - & ' mpp_global_field xupdate only on i4 compute domain' ) + global1 = zero + call mpp_global_field(domain, local, global1, flags=XUPDATE, position=test_params%position) + call arr_compare(global0(global_x%lb(1):global_x%ub(1),global_x%lb(2):global_x%ub(2)), & + global1(global_x%lb(1):global_x%ub(1),global_x%lb(2):global_x%ub(2)), & + 'mpp_global_field xupdate only on data domain with ' // trim(test_params%name)) !> yupdate - gcheck = zero - !call mpp_clock_begin(id) - call mpp_global_field( domain, x(is:ie,js:je), gcheck, flags=YUPDATE, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums_int( global1(is:ie,1:nj), gcheck(is:ie,1:nj), type// & - & ' mpp_global_field yupdate only on i4 compute domain' ) - - deallocate(global1, gcheck, x) - - end subroutine test_global_field_i4_2d - !> - !> test_global_field_i8_2d - !> - subroutine test_global_field_i8_2d( type ) - - implicit none - - character(len=*), intent(in) :: type - - integer(kind=i8_kind), parameter :: zero = 0 - - type(domain2D) :: domain - integer :: position, ishift, jshift, ni, nj, i, j, k - integer :: is, ie, js, je, isd, ied, jsd, jed - !integer :: id - integer, allocatable :: pelist(:) - integer(kind=i8_kind), allocatable :: global1(:,:), x(:,:), gcheck(:,:) - - - !> set up domain - call mpp_define_layout( (/1,nx,1,ny/), npes, layout ) - select case(type) - case( 'Non-symmetry' ) - call mpp_define_domains( (/1,nx,1,ny/), layout, domain, whalo=whalo, ehalo=ehalo, & - shalo=shalo, nhalo=nhalo, name=type ) - case( 'Symmetry center', 'Symmetry corner', 'Symmetry east', 'Symmetry north' ) - call mpp_define_domains( (/1,nx,1,ny/), layout, domain, whalo=whalo, ehalo=ehalo, & - shalo=shalo, nhalo=nhalo, name=type, symmetry = .true. ) - case default - call mpp_error( FATAL, 'TEST_MPP_DOMAINS: no such test: '//type//' in test_global_field' ) - end select - - !> get compute domain - call mpp_get_compute_domain( domain, is, ie, js, je ) - !> get data domain - call mpp_get_data_domain ( domain, isd, ied, jsd, jed ) - - !> determine if an extra point is needed - ishift = 0 ; jshift = 0 ; position=CENTER - select case(type) - case ('Symmetry corner') - ishift = 1 ; jshift = 1 ; position=CORNER - case ('Symmetry east') - ishift = 1 ; jshift = 0 ; position=EAST - case ('Symmetry north') - ishift = 0 ; jshift = 1 ; position=NORTH - end select - - ie = ie+ishift ; je = je+jshift - ied = ied+ishift ; jed = jed+jshift - ni = nx+ishift ; nj = ny+jshift - - !> assign global - allocate( global1(1-whalo:ni+ehalo,1-shalo:nj+nhalo) ) global1 = zero - do j=1, nj - do i=1, ni - global1(i,j) = int( i*1e3+j*1e6, kind=i8_kind ) - end do - enddo - - allocate( gcheck(ni,nj) ) + call mpp_global_field(domain, local, global1, flags=YUPDATE, position=test_params%position) + call arr_compare(global0(global_y%lb(1):global_y%ub(1),global_y%lb(2):global_y%ub(2)), & + global1(global_y%lb(1):global_y%ub(1),global_y%lb(2):global_y%ub(2)), & + 'mpp_global_field yupdate only on data domain with ' // trim(test_params%name)) - !> allocate for global domain - allocate( x(isd:ied,jsd:jed) ) - x(:,:) = global1(isd:ied,jsd:jed) - - !> test the data on data domain - gcheck = zero - !id = mpp_clock_id( type//' global field on data domain', flags=MPP_CLOCK_SYNC+MPP_CLOCK_DETAILED ) - !call mpp_clock_begin(id) - call mpp_global_field( domain, x, gcheck, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums_int( global1(1:ni,1:nj), gcheck, type//' mpp_global_field on i8 data domain' ) - - - !> Since in the disjoint redistribute mpp test, pelist1 = (npes/2+1 .. npes-1) - !! will be declared. But for the x-direction global field, mpp_sync_self will - !! be called. For some pe count, pelist1 will be set ( only on pe of pelist1 ) - !! in the mpp_sync_self call, later when calling mpp_declare_pelist(pelist1), - !! deadlock will happen. For example npes = 6 and layout = (2,3), pelist = (4,5) - !! will be set in mpp_sync_self. To solve the problem, some explicit mpp_declare_pelist - !! on all pe is needed for those partial pelist. But for y-update, it is ok. - !! because the pelist in y-update is not continous. - allocate( pelist(0:layout(1)-1) ) - do j = 0, layout(2)-1 - do i = 0, layout(1)-1 - pelist(i) = j*layout(1) + i - end do - call mpp_declare_pelist(pelist) - end do - deallocate(pelist) - - !> xupdate - gcheck = zero - !call mpp_clock_begin(id) - call mpp_global_field( domain, x, gcheck, flags=XUPDATE, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums_int( global1(1:ni,js:je), gcheck(1:ni,js:je), type// & - & ' mpp_global_field xupdate only on i8 data domain' ) - - !> yupdate - gcheck = zero - !call mpp_clock_begin(id) - call mpp_global_field( domain, x, gcheck, flags=YUPDATE, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums_int( global1(is:ie,1:nj), gcheck(is:ie,1:nj), type// & - & ' mpp_global_field yupdate only on i8 data domain' ) - !call mpp_clock_begin(id) - call mpp_global_field( domain, x, gcheck, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums_int( global1(1:ni,1:nj), gcheck, type//' mpp_global_field on i8 data domain' ) + call mpp_global_field(domain, local, global1, position=test_params%position) + call arr_compare(global0(global%lb(1):global%ub(1), global%lb(2):global%ub(2)), global1, & + 'mpp_global_field on data domain with ' // trim(test_params%name)) !> test the data on compute domain - deallocate(x) - allocate( x(is:ie,js:je) ) - x(is:ie,js:je) = global1(is:ie,js:je) - - gcheck = zero - !id = mpp_clock_id( type//' global field on compute domain', flags=MPP_CLOCK_SYNC+MPP_CLOCK_DETAILED ) - !call mpp_clock_begin(id) - call mpp_global_field( domain, x(is:ie,js:je), gcheck, position=position ) - !call mpp_clock_end(id) - !>compare checksums between global and x arrays - call compare_checksums_int( global1(1:ni,1:nj), gcheck, type//' mpp_global_field on i8 compute domain' ) - - !> xupdate - gcheck = zero - !call mpp_clock_begin(id) - call mpp_global_field( domain, x(is:ie,js:je), gcheck, flags=XUPDATE, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums_int( global1(1:ni,js:je), gcheck(1:ni,js:je), type// & - & ' mpp_global_field xupdate only on i8 compute domain' ) - - !> yupdate - gcheck = zero - !call mpp_clock_begin(id) - call mpp_global_field( domain, x(is:ie,js:je), gcheck, flags=YUPDATE, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums_int( global1(is:ie,1:nj), gcheck(is:ie,1:nj), type// & - & ' mpp_global_field yupdate only on i8 compute domain' ) - - deallocate(global1, gcheck, x) + deallocate(local) + allocate(local(compute%lb(1):compute%ub(1), compute%lb(2):compute%ub(2))) + local(:,:) = global0(compute%lb(1):compute%ub(1), compute%lb(2):compute%ub(2)) - end subroutine test_global_field_i8_2d - !> - !> test_global_field_r4_3d - !> - subroutine test_global_field_r4_3d( type ) - - implicit none - - character(len=*), intent(in) :: type - - real(kind=r4_kind) :: zero = 0.0 - - type(domain2D) :: domain - integer :: position, ishift, jshift, ni, nj, i, j, k - integer :: is, ie, js, je, isd, ied, jsd, jed - !integer :: id - integer, allocatable :: pelist(:) - real(kind=r4_kind), allocatable :: global1(:,:,:), x(:,:,:), gcheck(:,:,:) - - - !> set up domain - call mpp_define_layout( (/1,nx,1,ny/), npes, layout ) - select case(type) - case( 'Non-symmetry' ) - call mpp_define_domains( (/1,nx,1,ny/), layout, domain, whalo=whalo, ehalo=ehalo, & - shalo=shalo, nhalo=nhalo, name=type ) - case( 'Symmetry center', 'Symmetry corner', 'Symmetry east', 'Symmetry north' ) - call mpp_define_domains( (/1,nx,1,ny/), layout, domain, whalo=whalo, ehalo=ehalo, & - shalo=shalo, nhalo=nhalo, name=type, symmetry = .true. ) - case default - call mpp_error( FATAL, 'TEST_MPP_DOMAINS: no such test: '//type//' in test_global_field' ) - end select - - !> get compute domain - call mpp_get_compute_domain( domain, is, ie, js, je ) - !> get data domain - call mpp_get_data_domain ( domain, isd, ied, jsd, jed ) - - !> determine if an extra point is needed - ishift = 0 ; jshift = 0 ; position = CENTER - select case(type) - case ('Symmetry corner') - ishift = 1 ; jshift = 1 ; position=CORNER - case ('Symmetry east') - ishift = 1 ; jshift = 0 ; position=EAST - case ('Symmetry north') - ishift = 0 ; jshift = 1 ; position=NORTH - end select - - ie = ie+ishift ; je = je+jshift - ied = ied+ishift ; jed = jed+jshift - ni = nx+ishift ; nj = ny+jshift - - !> assign global1 - allocate( global1(1-whalo:ni+ehalo,1-shalo:nj+nhalo,nz) ) global1 = zero - do k=1, nz - do j=1, nj - do i=1, ni - global1(i,j,k) = real( k+i*1e-3+j*1e-6, kind=r4_kind ) - end do - end do - enddo - - allocate( gcheck(ni,nj,nz) ) - - !> for data domain - allocate( x(isd:ied,jsd:jed, nz) ) - x(:,:,:) = global1(isd:ied,jsd:jed,:) - - !> test the data on data domain - gcheck = zero - !id = mpp_clock_id( type//' global field on data domain', flags=MPP_CLOCK_SYNC+MPP_CLOCK_DETAILED ) - !call mpp_clock_begin(id) - call mpp_global_field( domain, x, gcheck, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums( global1(1:ni,1:nj,:), gcheck, type//' mpp_global_field on r4 data domain' ) - - !> Since in the disjoint redistribute mpp test, pelist1 = (npes/2+1 .. npes-1) - !! will be declared. But for the x-direction global field, mpp_sync_self will - !! be called. For some pe count, pelist1 will be set ( only on pe of pelist1 ) - !! in the mpp_sync_self call, later when calling mpp_declare_pelist(pelist1), - !! deadlock will happen. For example npes = 6 and layout = (2,3), pelist = (4,5) - !! will be set in mpp_sync_self. To solve the problem, some explicit mpp_declare_pelist - !! on all pe is needed for those partial pelist. But for y-update, it is ok. - !! because the pelist in y-update is not continous. - allocate( pelist(0:layout(1)-1) ) - do j = 0, layout(2)-1 - do i = 0, layout(1)-1 - pelist(i) = j*layout(1) + i - end do - call mpp_declare_pelist(pelist) - end do - deallocate(pelist) + call mpp_global_field(domain, local, global1, position=test_params%position) + call arr_compare(global0(global%lb(1):global%ub(1), global%lb(2):global%ub(2)), global1, & + 'mpp_global_field on compute domain with ' // trim(test_params%name)) !> xupdate - gcheck = zero - !call mpp_clock_begin(id) - call mpp_global_field( domain, x, gcheck, flags=XUPDATE, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums( global1(1:ni,js:je,:), gcheck(1:ni,js:je,:),type// & - & ' mpp_global_field xupdate only on r4 data domain' ) - - !> yupdate - gcheck = zero - !call mpp_clock_begin(id) - call mpp_global_field( domain, x, gcheck, flags=YUPDATE, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums( global1(is:ie,1:nj,:), gcheck(is:ie,1:nj,:),type// & - & ' mpp_global_field yupdate only on r4 data domain' ) - - !call mpp_clock_begin(id) - call mpp_global_field( domain, x, gcheck, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums( global1(1:ni,1:nj,:), gcheck,type//' mpp_global_field on r4 data domain' ) - - !> test the data on compute domain - gcheck = zero - !id = mpp_clock_id( type//' global field on compute domain', flags=MPP_CLOCK_SYNC+MPP_CLOCK_DETAILED ) - !call mpp_clock_begin(id) - call mpp_global_field( domain, x(is:ie,js:je,:), gcheck, position=position ) - !call mpp_clock_end(id) - !>compare checksums between global and x arrays - call compare_checksums( global1(1:ni,1:nj,:), gcheck, type//' mpp_global_field on r4 compute domain' ) - - !> xupdate - gcheck = zero - !call mpp_clock_begin(id) - call mpp_global_field( domain, x(is:ie,js:je,:), gcheck, flags=XUPDATE, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums( global1(1:ni,js:je,:), gcheck(1:ni,js:je,:), & - type//' mpp_global_field xupdate only on r4 compute domain' ) + global1 = zero + call mpp_global_field(domain, local, global1, flags=XUPDATE, position=test_params%position) + call arr_compare(global0(global_x%lb(1):global_x%ub(1),global_x%lb(2):global_x%ub(2)), & + global1(global_x%lb(1):global_x%ub(1),global_x%lb(2):global_x%ub(2)), & + 'mpp_global_field xupdate only on compute domain with ' // trim(test_params%name)) !> yupdate - gcheck = zero - !call mpp_clock_begin(id) - call mpp_global_field( domain, x(is:ie,js:je,:), gcheck, flags=YUPDATE, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums( global1(is:ie,1:nj,:), gcheck(is:ie,1:nj,:), & - type//' mpp_global_field yupdate only on r4 compute domain' ) - - deallocate(global1, gcheck, x) - - end subroutine test_global_field_r4_3d - !> - !> test_global_field_r8_3d - !> - subroutine test_global_field_r8_3d( type ) - - implicit none - - character(len=*), intent(in) :: type + global1 = zero + call mpp_global_field(domain, local, global1, flags=YUPDATE, position=test_params%position) + call arr_compare(global0(global_y%lb(1):global_y%ub(1),global_y%lb(2):global_y%ub(2)), & + global1(global_y%lb(1):global_y%ub(1),global_y%lb(2):global_y%ub(2)), & + 'mpp_global_field yupdate only on compute domain with ' // trim(test_params%name)) + end subroutine run_tests_2d - real(kind=r8_kind) :: zero = 0.0 + subroutine run_tests_3d(test_params, p) + type(test_params_t), intent(in) :: test_params + integer, intent(in) :: p !< Permutation of array indices (ranges from 1 to rank!) type(domain2D) :: domain - integer :: position, ishift, jshift, ni, nj, i, j, k - integer :: is, ie, js, je, isd, ied, jsd, jed - !integer :: id + integer :: i, j + type(permutable_indices_3d) :: compute, data, global, global_with_halo, global_x, global_y integer, allocatable :: pelist(:) - real(kind=r8_kind), allocatable :: global1(:,:,:), x(:,:,:), gcheck(:,:,:) - + FMS_TEST_TYPE_ (FMS_TEST_KIND_), allocatable :: global0(:,:,:), local(:,:,:), global1(:,:,:) !> set up domain - call mpp_define_layout( (/1,nx,1,ny/), npes, layout ) - select case(type) - case( 'Non-symmetry' ) - call mpp_define_domains( (/1,nx,1,ny/), layout, domain, whalo=whalo, ehalo=ehalo, & - shalo=shalo, nhalo=nhalo, name=type ) - case( 'Symmetry center', 'Symmetry corner', 'Symmetry east', 'Symmetry north' ) - call mpp_define_domains( (/1,nx,1,ny/), layout, domain, whalo=whalo, ehalo=ehalo, & - shalo=shalo, nhalo=nhalo, name=type, symmetry = .true. ) - case default - call mpp_error( FATAL, 'TEST_MPP_DOMAINS: no such test: '//type//' in test_global_field' ) - end select + call mpp_define_layout([1,nx,1,ny], npes, layout) + call mpp_define_domains([1,nx,1,ny], layout, domain, whalo=whalo, ehalo=ehalo, shalo=shalo, nhalo=nhalo, & + name=trim(test_params%name), symmetry=test_params%symmetry) !> get compute domain - call mpp_get_compute_domain( domain, is, ie, js, je ) - !> get data domain - call mpp_get_data_domain ( domain, isd, ied, jsd, jed ) - - !> determine if an extra point is needed - ishift = 0 ; jshift = 0 ; position = CENTER - select case(type) - case ('Symmetry corner') - ishift = 1 ; jshift = 1 ; position=CORNER - case ('Symmetry east') - ishift = 1 ; jshift = 0 ; position=EAST - case ('Symmetry north') - ishift = 0 ; jshift = 1 ; position=NORTH - end select + call mpp_get_compute_domain(domain, compute%lb(1), compute%ub(1), compute%lb(2), compute%ub(2)) + compute%ub(1:2) = compute%ub(1:2) + test_params%shift + compute%lb(3) = 1 + compute%ub(3) = nz - ie = ie+ishift ; je = je+jshift - ied = ied+ishift ; jed = jed+jshift - ni = nx+ishift ; nj = ny+jshift - - !> assign global1 - allocate( global1(1-whalo:ni+ehalo,1-shalo:nj+nhalo,nz) ) - global1 = zero - do k=1, nz - do j=1, nj - do i=1, ni - global1(i,j,k) = real( k+i*1e-3+j*1e-6, kind=r8_kind ) - end do - end do - enddo - - allocate( gcheck(ni,nj,nz) ) - - !> for data domain - allocate( x(isd:ied,jsd:jed, nz) ) - x(:,:,:) = global1(isd:ied,jsd:jed,:) - - !> test the data on data domain - gcheck = zero - !id = mpp_clock_id( type//' global field on data domain', flags=MPP_CLOCK_SYNC+MPP_CLOCK_DETAILED ) - !call mpp_clock_begin(id) - call mpp_global_field( domain, x, gcheck, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums( global1(1:ni,1:nj,:), gcheck, type//' mpp_global_field on r8 data domain' ) - - !> Since in the disjoint redistribute mpp test, pelist1 = (npes/2+1 .. npes-1) - !! will be declared. But for the x-direction global field, mpp_sync_self will - !! be called. For some pe count, pelist1 will be set ( only on pe of pelist1 ) - !! in the mpp_sync_self call, later when calling mpp_declare_pelist(pelist1), - !! deadlock will happen. For example npes = 6 and layout = (2,3), pelist = (4,5) - !! will be set in mpp_sync_self. To solve the problem, some explicit mpp_declare_pelist - !! on all pe is needed for those partial pelist. But for y-update, it is ok. - !! because the pelist in y-update is not continous. - allocate( pelist(0:layout(1)-1) ) - do j = 0, layout(2)-1 - do i = 0, layout(1)-1 - pelist(i) = j*layout(1) + i - end do - call mpp_declare_pelist(pelist) - end do - deallocate(pelist) - - !> xupdate - gcheck = zero - !call mpp_clock_begin(id) - call mpp_global_field( domain, x, gcheck, flags=XUPDATE, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums( global1(1:ni,js:je,:), gcheck(1:ni,js:je,:),type// & - & ' mpp_global_field xupdate only on r8 data domain' ) - - !> yupdate - gcheck = zero - !call mpp_clock_begin(id) - call mpp_global_field( domain, x, gcheck, flags=YUPDATE, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums( global1(is:ie,1:nj,:), gcheck(is:ie,1:nj,:),type// & - & ' mpp_global_field yupdate only on r8 data domain' ) - - !call mpp_clock_begin(id) - call mpp_global_field( domain, x, gcheck, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums( global1(1:ni,1:nj,:), gcheck,type//' mpp_global_field on r8 data domain' ) - - !> test the data on compute domain - gcheck = zero - !id = mpp_clock_id( type//' global field on compute domain', flags=MPP_CLOCK_SYNC+MPP_CLOCK_DETAILED ) - !call mpp_clock_begin(id) - call mpp_global_field( domain, x(is:ie,js:je,:), gcheck, position=position ) - !call mpp_clock_end(id) - !>compare checksums between global and x arrays - call compare_checksums( global1(1:ni,1:nj,:), gcheck, type//' mpp_global_field on r8 compute domain' ) - - !> xupdate - gcheck = zero - !call mpp_clock_begin(id) - call mpp_global_field( domain, x(is:ie,js:je,:), gcheck, flags=XUPDATE, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums( global1(1:ni,js:je,:), gcheck(1:ni,js:je,:), & - type//' mpp_global_field xupdate only on r8 compute domain' ) - - !> yupdate - gcheck = zero - !call mpp_clock_begin(id) - call mpp_global_field( domain, x(is:ie,js:je,:), gcheck, flags=YUPDATE, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums( global1(is:ie,1:nj,:), gcheck(is:ie,1:nj,:), & - type//' mpp_global_field yupdate only on r8 compute domain' ) - - deallocate(global1, gcheck, x) - - end subroutine test_global_field_r8_3d - !> - !> test_global_field_i4_3d - !> - subroutine test_global_field_i4_3d( type ) - - implicit none - - character(len=*), intent(in) :: type - - integer(kind=i4_kind) :: zero = 0 + !> get data domain + call mpp_get_data_domain(domain, data%lb(1), data%ub(1), data%lb(2), data%ub(2)) + data%ub(1:2) = data%ub(1:2) + test_params%shift + data%lb(3) = 1 + data%ub(3) = nz - type(domain2D) :: domain - integer :: position, ishift, jshift, ni, nj, i, j, k - integer :: is, ie, js, je, isd, ied, jsd, jed - !integer :: id - integer, allocatable :: pelist(:) - integer(kind=i4_kind), allocatable :: global1(:,:,:), x(:,:,:), gcheck(:,:,:) + global%lb = [1, 1, 1] + global%ub = [nx, ny, nz] + global%ub(1:2) = global%ub(1:2) + test_params%shift + global_with_halo%lb = global%lb - [whalo, shalo, 0] + global_with_halo%ub = global%ub + [ehalo, nhalo, 0] - !> set up domain - call mpp_define_layout( (/1,nx,1,ny/), npes, layout ) - select case(type) - case( 'Non-symmetry' ) - call mpp_define_domains( (/1,nx,1,ny/), layout, domain, whalo=whalo, ehalo=ehalo, & - shalo=shalo, nhalo=nhalo, name=type ) - case( 'Symmetry center', 'Symmetry corner', 'Symmetry east', 'Symmetry north' ) - call mpp_define_domains( (/1,nx,1,ny/), layout, domain, whalo=whalo, ehalo=ehalo, & - shalo=shalo, nhalo=nhalo, name=type, symmetry = .true. ) - case default - call mpp_error( FATAL, 'TEST_MPP_DOMAINS: no such test: '//type//' in test_global_field' ) - end select + global_x%lb = [global%lb(1), compute%lb(2), global%lb(3)] + global_x%ub = [global%ub(1), compute%ub(2), global%ub(3)] - !> get compute domain - call mpp_get_compute_domain( domain, is, ie, js, je ) - !> get data domain - call mpp_get_data_domain ( domain, isd, ied, jsd, jed ) + global_y%lb = [compute%lb(1), global%lb(2), global%lb(3)] + global_y%ub = [compute%ub(1), global%ub(2), global%ub(3)] - !> determine if an extra point is needed - ishift = 0 ; jshift = 0 ; position = CENTER - select case(type) - case ('Symmetry corner') - ishift = 1 ; jshift = 1 ; position=CORNER - case ('Symmetry east') - ishift = 1 ; jshift = 0 ; position=EAST - case ('Symmetry north') - ishift = 0 ; jshift = 1 ; position=NORTH - end select + call compute%permute(p) + call data%permute(p) + call global%permute(p) + call global_with_halo%permute(p) + call global_x%permute(p) + call global_y%permute(p) - ie = ie+ishift ; je = je+jshift - ied = ied+ishift ; jed = jed+jshift - ni = nx+ishift ; nj = ny+jshift + !> assign global0 + allocate(global0(global_with_halo%lb(1):global_with_halo%ub(1), global_with_halo%lb(2):global_with_halo%ub(2), & + global_with_halo%lb(3):global_with_halo%ub(3))) - !> assign global1 - allocate( global1(1-whalo:ni+ehalo,1-shalo:nj+nhalo,nz) ) - global1 = zero - do k=1, nz - do j=1, nj - do i=1, ni - global1(i,j,k) = int( k+i*1e3+j*1e6, kind=i4_kind ) - end do - end do - enddo + global0 = zero + call arr_init(global0(global%lb(1):global%ub(1), global%lb(2):global%ub(2), global%lb(3):global%ub(3))) - allocate( gcheck(ni,nj,nz) ) + allocate(global1(global%lb(1):global%ub(1), global%lb(2):global%ub(2), global%lb(3):global%ub(3))) !> for data domain - allocate( x(isd:ied,jsd:jed, nz) ) - x(:,:,:) = global1(isd:ied,jsd:jed,:) + allocate(local(data%lb(1):data%ub(1), data%lb(2):data%ub(2), data%lb(3):data%ub(3))) + local(:,:,:) = global0(data%lb(1):data%ub(1), data%lb(2):data%ub(2), data%lb(3):data%ub(3)) !> test the data on data domain - gcheck = zero - !id = mpp_clock_id( type//' global field on data domain', flags=MPP_CLOCK_SYNC+MPP_CLOCK_DETAILED ) - !call mpp_clock_begin(id) - call mpp_global_field( domain, x, gcheck, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums_int( global1(1:ni,1:nj,:), gcheck, type//' mpp_global_field on i4 data domain' ) + global1 = zero + call mpp_global_field(domain, local, global1, position=test_params%position) + call arr_compare(global0(global%lb(1):global%ub(1), global%lb(2):global%ub(2), global%lb(3):global%ub(3)), & + global1, 'mpp_global_field on data domain with ' // trim(test_params%name)) !> Since in the disjoint redistribute mpp test, pelist1 = (npes/2+1 .. npes-1) !! will be declared. But for the x-direction global field, mpp_sync_self will - !! be called. For some pe count, pelist1 will be set ( only on pe of pelist1 ) + !! be called. For some pe count, pelist1 will be set (only on pe of pelist1) !! in the mpp_sync_self call, later when calling mpp_declare_pelist(pelist1), !! deadlock will happen. For example npes = 6 and layout = (2,3), pelist = (4,5) !! will be set in mpp_sync_self. To solve the problem, some explicit mpp_declare_pelist !! on all pe is needed for those partial pelist. But for y-update, it is ok. !! because the pelist in y-update is not continous. - allocate( pelist(0:layout(1)-1) ) + allocate(pelist(0:layout(1)-1)) do j = 0, layout(2)-1 do i = 0, layout(1)-1 pelist(i) = j*layout(1) + i @@ -1108,207 +285,50 @@ subroutine test_global_field_i4_3d( type ) deallocate(pelist) !> xupdate - gcheck = zero - !call mpp_clock_begin(id) - call mpp_global_field( domain, x, gcheck, flags=XUPDATE, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums_int( global1(1:ni,js:je,:), gcheck(1:ni,js:je,:),type// & - & ' mpp_global_field xupdate only on i4 data domain' ) + global1 = zero + call mpp_global_field(domain, local, global1, flags=XUPDATE, position=test_params%position) + call arr_compare(global0(global_x%lb(1):global_x%ub(1), global_x%lb(2):global_x%ub(2), & + global_x%lb(3):global_x%ub(3)), global1(global_x%lb(1):global_x%ub(1), & + global_x%lb(2):global_x%ub(2), global_x%lb(3):global_x%ub(3)), & + 'mpp_global_field xupdate only on data domain with ' // trim(test_params%name)) !> yupdate - gcheck = zero - !call mpp_clock_begin(id) - call mpp_global_field( domain, x, gcheck, flags=YUPDATE, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums_int( global1(is:ie,1:nj,:), gcheck(is:ie,1:nj,:),type// & - & ' mpp_global_field yupdate only on i4 data domain' ) + global1 = zero + call mpp_global_field(domain, local, global1, flags=YUPDATE, position=test_params%position) + call arr_compare(global0(global_y%lb(1):global_y%ub(1), global_y%lb(2):global_y%ub(2), & + global_y%lb(3):global_y%ub(3)), global1(global_y%lb(1):global_y%ub(1), & + global_y%lb(2):global_y%ub(2), global_y%lb(3):global_y%ub(3)), & + 'mpp_global_field yupdate only on data domain with ' // trim(test_params%name)) - !call mpp_clock_begin(id) - call mpp_global_field( domain, x, gcheck, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums_int( global1(1:ni,1:nj,:), gcheck,type//' mpp_global_field on i4 data domain' ) + call mpp_global_field(domain, local, global1, position=test_params%position) + call arr_compare(global0(global%lb(1):global%ub(1), global%lb(2):global%ub(2), global%lb(3):global%ub(3)), & + global1, 'mpp_global_field on data domain with ' // trim(test_params%name)) !> test the data on compute domain - gcheck = zero - !id = mpp_clock_id( type//' global field on compute domain', flags=MPP_CLOCK_SYNC+MPP_CLOCK_DETAILED ) - !call mpp_clock_begin(id) - call mpp_global_field( domain, x(is:ie,js:je,:), gcheck, position=position ) - !call mpp_clock_end(id) - !>compare checksums between global and x arrays - call compare_checksums_int( global1(1:ni,1:nj,:), gcheck, type//' mpp_global_field on i4 compute domain' ) - - !> xupdate - gcheck = zero - !call mpp_clock_begin(id) - call mpp_global_field( domain, x(is:ie,js:je,:), gcheck, flags=XUPDATE, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums_int( global1(1:ni,js:je,:), gcheck(1:ni,js:je,:), & - type//' mpp_global_field xupdate only on i4 compute domain' ) - - !> yupdate - gcheck = zero - !call mpp_clock_begin(id) - call mpp_global_field( domain, x(is:ie,js:je,:), gcheck, flags=YUPDATE, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums_int( global1(is:ie,1:nj,:), gcheck(is:ie,1:nj,:), & - type//' mpp_global_field yupdate only on i4 compute domain' ) - - deallocate(global1, gcheck, x) - - end subroutine test_global_field_i4_3d - !> - !> test_global_field_i8_3d - !> - subroutine test_global_field_i8_3d( type ) - - implicit none - - character(len=*), intent(in) :: type - - integer(kind=i8_kind) :: zero = 0 - - type(domain2D) :: domain - integer :: position, ishift, jshift, ni, nj, i, j, k - integer :: is, ie, js, je, isd, ied, jsd, jed - !integer :: id - integer, allocatable :: pelist(:) - integer(kind=i8_kind), allocatable :: global1(:,:,:), x(:,:,:), gcheck(:,:,:) - - - !> set up domain - call mpp_define_layout( (/1,nx,1,ny/), npes, layout ) - select case(type) - case( 'Non-symmetry' ) - call mpp_define_domains( (/1,nx,1,ny/), layout, domain, whalo=whalo, ehalo=ehalo, & - shalo=shalo, nhalo=nhalo, name=type ) - case( 'Symmetry center', 'Symmetry corner', 'Symmetry east', 'Symmetry north' ) - call mpp_define_domains( (/1,nx,1,ny/), layout, domain, whalo=whalo, ehalo=ehalo, & - shalo=shalo, nhalo=nhalo, name=type, symmetry = .true. ) - case default - call mpp_error( FATAL, 'TEST_MPP_DOMAINS: no such test: '//type//' in test_global_field' ) - end select - !> get compute domain - call mpp_get_compute_domain( domain, is, ie, js, je ) - !> get data domain - call mpp_get_data_domain ( domain, isd, ied, jsd, jed ) + deallocate(local) + allocate(local(compute%lb(1):compute%ub(1), compute%lb(2):compute%ub(2), compute%lb(3):compute%ub(3))) + local(:,:,:) = global0(compute%lb(1):compute%ub(1), compute%lb(2):compute%ub(2), compute%lb(3):compute%ub(3)) - !> determine if an extra point is needed - ishift = 0 ; jshift = 0 ; position = CENTER - select case(type) - case ('Symmetry corner') - ishift = 1 ; jshift = 1 ; position=CORNER - case ('Symmetry east') - ishift = 1 ; jshift = 0 ; position=EAST - case ('Symmetry north') - ishift = 0 ; jshift = 1 ; position=NORTH - end select - - ie = ie+ishift ; je = je+jshift - ied = ied+ishift ; jed = jed+jshift - ni = nx+ishift ; nj = ny+jshift - - !> assign global1 - allocate( global1(1-whalo:ni+ehalo,1-shalo:nj+nhalo,nz) ) global1 = zero - do k=1, nz - do j=1, nj - do i=1, ni - global1(i,j,k) = int( k+i*1e3+j*1e6, kind=i8_kind ) - end do - end do - enddo - - allocate( gcheck(ni,nj,nz) ) - - !> for data domain - allocate( x(isd:ied,jsd:jed, nz) ) - x(:,:,:) = global1(isd:ied,jsd:jed,:) - - !> test the data on data domain - gcheck = zero - !id = mpp_clock_id( type//' global field on data domain', flags=MPP_CLOCK_SYNC+MPP_CLOCK_DETAILED ) - !call mpp_clock_begin(id) - call mpp_global_field( domain, x, gcheck, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums_int( global1(1:ni,1:nj,:), gcheck, type//' mpp_global_field on i8 data domain' ) - - !> Since in the disjoint redistribute mpp test, pelist1 = (npes/2+1 .. npes-1) - !! will be declared. But for the x-direction global field, mpp_sync_self will - !! be called. For some pe count, pelist1 will be set ( only on pe of pelist1 ) - !! in the mpp_sync_self call, later when calling mpp_declare_pelist(pelist1), - !! deadlock will happen. For example npes = 6 and layout = (2,3), pelist = (4,5) - !! will be set in mpp_sync_self. To solve the problem, some explicit mpp_declare_pelist - !! on all pe is needed for those partial pelist. But for y-update, it is ok. - !! because the pelist in y-update is not continous. - allocate( pelist(0:layout(1)-1) ) - do j = 0, layout(2)-1 - do i = 0, layout(1)-1 - pelist(i) = j*layout(1) + i - end do - call mpp_declare_pelist(pelist) - end do - deallocate(pelist) + call mpp_global_field(domain, local, global1, position=test_params%position) + call arr_compare(global0(global%lb(1):global%ub(1), global%lb(2):global%ub(2), global%lb(3):global%ub(3)), & + global1, 'mpp_global_field on compute domain with ' // trim(test_params%name)) !> xupdate - gcheck = zero - !call mpp_clock_begin(id) - call mpp_global_field( domain, x, gcheck, flags=XUPDATE, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums_int( global1(1:ni,js:je,:), gcheck(1:ni,js:je,:),type// & - & ' mpp_global_field xupdate only on i8 data domain' ) - - !> yupdate - gcheck = zero - !call mpp_clock_begin(id) - call mpp_global_field( domain, x, gcheck, flags=YUPDATE, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums_int( global1(is:ie,1:nj,:), gcheck(is:ie,1:nj,:),type// & - & ' mpp_global_field yupdate only on i8 data domain' ) - - !call mpp_clock_begin(id) - call mpp_global_field( domain, x, gcheck, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums_int( global1(1:ni,1:nj,:), gcheck,type//' mpp_global_field on i8 data domain' ) - - !> test the data on compute domain - gcheck = zero - !id = mpp_clock_id( type//' global field on compute domain', flags=MPP_CLOCK_SYNC+MPP_CLOCK_DETAILED ) - !call mpp_clock_begin(id) - call mpp_global_field( domain, x(is:ie,js:je,:), gcheck, position=position ) - !call mpp_clock_end(id) - !>compare checksums between global and x arrays - call compare_checksums_int( global1(1:ni,1:nj,:), gcheck, type//' mpp_global_field on i8 compute domain' ) - - !> xupdate - gcheck = zero - !call mpp_clock_begin(id) - call mpp_global_field( domain, x(is:ie,js:je,:), gcheck, flags=XUPDATE, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums_int( global1(1:ni,js:je,:), gcheck(1:ni,js:je,:), & - type//' mpp_global_field xupdate only on i8 compute domain' ) + global1 = zero + call mpp_global_field(domain, local, global1, flags=XUPDATE, position=test_params%position) + call arr_compare(global0(global_x%lb(1):global_x%ub(1), global_x%lb(2):global_x%ub(2), & + global_x%lb(3):global_x%ub(3)), global1(global_x%lb(1):global_x%ub(1), & + global_x%lb(2):global_x%ub(2), global_x%lb(3):global_x%ub(3)), & + 'mpp_global_field xupdate only on compute domain with ' // trim(test_params%name)) !> yupdate - gcheck = zero - !call mpp_clock_begin(id) - call mpp_global_field( domain, x(is:ie,js:je,:), gcheck, flags=YUPDATE, position=position ) - !call mpp_clock_end(id) - !> compare checksums between global and x arrays - call compare_checksums_int( global1(is:ie,1:nj,:), gcheck(is:ie,1:nj,:), & - type//' mpp_global_field yupdate only on i8 compute domain' ) - - deallocate(global1, gcheck, x) - - end subroutine test_global_field_i8_3d - + global1 = zero + call mpp_global_field(domain, local, global1, flags=YUPDATE, position=test_params%position) + call arr_compare(global0(global_y%lb(1):global_y%ub(1), global_y%lb(2):global_y%ub(2), & + global_y%lb(3):global_y%ub(3)), global1(global_y%lb(1):global_y%ub(1), & + global_y%lb(2):global_y%ub(2), global_y%lb(3):global_y%ub(3)), & + 'mpp_global_field yupdate only on compute domain with ' // trim(test_params%name)) + end subroutine run_tests_3d end program test_mpp_global_field diff --git a/test_fms/mpp/test_mpp_global_field.sh b/test_fms/mpp/test_mpp_global_field.sh index bf32fd12a3..90f68bdeeb 100755 --- a/test_fms/mpp/test_mpp_global_field.sh +++ b/test_fms/mpp/test_mpp_global_field.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL Flexible Modeling System (FMS). -# -# FMS is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FMS is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to @@ -27,8 +26,19 @@ # Set common test settings. . ../test-lib.sh +# TODO: Enable these tests once generalized indices work is complete +SKIP_TESTS="test_mpp_global_field.1 \ + test_mpp_global_field.2 \ + test_mpp_global_field.3 \ + test_mpp_global_field.4" + touch input.nml -test_expect_success "mpp global field functions with mixed precision" ' - mpirun -n 4 ./test_mpp_global_field -' + +for datatype in r4 r8 i4 i8 +do + test_expect_success "mpp global field functions ($datatype)" " + mpirun -n 4 ./test_mpp_global_field_$datatype + " +done + test_done diff --git a/test_fms/mpp/test_mpp_global_field_ug.F90 b/test_fms/mpp/test_mpp_global_field_ug.F90 index 5a1ccda6ef..57de86477e 100644 --- a/test_fms/mpp/test_mpp_global_field_ug.F90 +++ b/test_fms/mpp/test_mpp_global_field_ug.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** program test_mpp_global_field_ug diff --git a/test_fms/mpp/test_mpp_global_field_ug.sh b/test_fms/mpp/test_mpp_global_field_ug.sh index 333a48fc03..70ee6a2b7b 100755 --- a/test_fms/mpp/test_mpp_global_field_ug.sh +++ b/test_fms/mpp/test_mpp_global_field_ug.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL Flexible Modeling System (FMS). -# -# FMS is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FMS is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/mpp/test_mpp_global_sum_ad.F90 b/test_fms/mpp/test_mpp_global_sum_ad.F90 index be78af2eab..8071ecb27d 100644 --- a/test_fms/mpp/test_mpp_global_sum_ad.F90 +++ b/test_fms/mpp/test_mpp_global_sum_ad.F90 @@ -1,21 +1,20 @@ !*********************************************************************** -!* Gnu Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . -!************************************************************ +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. +!*********************************************************************** !> @author Jessica Liptak !> @email gfdl.climate.model.info@noaa.gov !> @description Test the mpp_global_sum_ad interfaces with 32-bit and 64-bit diff --git a/test_fms/mpp/test_mpp_global_sum_ad.sh b/test_fms/mpp/test_mpp_global_sum_ad.sh index 71296789f7..942844bc67 100755 --- a/test_fms/mpp/test_mpp_global_sum_ad.sh +++ b/test_fms/mpp/test_mpp_global_sum_ad.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL Flexible Modeling System (FMS). -# -# FMS is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FMS is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/mpp/test_mpp_init_logfile.F90 b/test_fms/mpp/test_mpp_init_logfile.F90 index cffee325e2..a2282dfdf5 100644 --- a/test_fms/mpp/test_mpp_init_logfile.F90 +++ b/test_fms/mpp/test_mpp_init_logfile.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file diff --git a/test_fms/mpp/test_mpp_init_logfile.sh b/test_fms/mpp/test_mpp_init_logfile.sh index 1ae48b6bfd..2bf0400bc8 100755 --- a/test_fms/mpp/test_mpp_init_logfile.sh +++ b/test_fms/mpp/test_mpp_init_logfile.sh @@ -1,22 +1,19 @@ -!/bin/sh - #*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL Flexible Modeling System (FMS). -# -# FMS is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FMS is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/mpp/test_mpp_mem_dump.F90 b/test_fms/mpp/test_mpp_mem_dump.F90 index c0f0d1ec4b..5f4b5a49ee 100644 --- a/test_fms/mpp/test_mpp_mem_dump.F90 +++ b/test_fms/mpp/test_mpp_mem_dump.F90 @@ -4,22 +4,21 @@ !! \section LICENSE !! !*********************************************************************** -!! GNU Lesser General Public License -!! -!! This file is part of the GFDL Flexible Modeling System (FMS). -!! -!! FMS is free software: you can redistribute it and/or modify it under -!! the terms of the GNU Lesser General Public License as published by -!! the Free Software Foundation, either version 3 of the License, or (at -!! your option) any later version. -!! -!! FMS is distributed in the hope that it will be useful, but WITHOUT -!! ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!! FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!! for more details. -!! -!! You should have received a copy of the GNU Lesser General Public -!! License along with FMS. If not, see . +!* Apache License 2.0 +!* +!* This file is part of the GFDL Flexible Modeling System (FMS). +!* +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at +!* +!* http://www.apache.org/licenses/LICENSE-2.0 +!* +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !! !! \section DESCRIPTION diff --git a/test_fms/mpp/test_mpp_mem_dump.sh b/test_fms/mpp/test_mpp_mem_dump.sh index e158725d48..e865246515 100755 --- a/test_fms/mpp/test_mpp_mem_dump.sh +++ b/test_fms/mpp/test_mpp_mem_dump.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL Flexible Modeling System (FMS). -# -# FMS is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FMS is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/mpp/test_mpp_memuse.F90 b/test_fms/mpp/test_mpp_memuse.F90 index 12994a21d4..7f677374d7 100644 --- a/test_fms/mpp/test_mpp_memuse.F90 +++ b/test_fms/mpp/test_mpp_memuse.F90 @@ -4,22 +4,21 @@ !! \section LICENSE !! !*********************************************************************** -!! GNU Lesser General Public License -!! -!! This file is part of the GFDL Flexible Modeling System (FMS). -!! -!! FMS is free software: you can redistribute it and/or modify it under -!! the terms of the GNU Lesser General Public License as published by -!! the Free Software Foundation, either version 3 of the License, or (at -!! your option) any later version. -!! -!! FMS is distributed in the hope that it will be useful, but WITHOUT -!! ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!! FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!! for more details. -!! -!! You should have received a copy of the GNU Lesser General Public -!! License along with FMS. If not, see . +!* Apache License 2.0 +!* +!* This file is part of the GFDL Flexible Modeling System (FMS). +!* +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at +!* +!* http://www.apache.org/licenses/LICENSE-2.0 +!* +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !! !! \section DESCRIPTION diff --git a/test_fms/mpp/test_mpp_memuse.sh b/test_fms/mpp/test_mpp_memuse.sh index dc521d982c..fe9163e010 100755 --- a/test_fms/mpp/test_mpp_memuse.sh +++ b/test_fms/mpp/test_mpp_memuse.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL Flexible Modeling System (FMS). -# -# FMS is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FMS is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/mpp/test_mpp_memutils_begin_2x.F90 b/test_fms/mpp/test_mpp_memutils_begin_2x.F90 index f687bbab3a..bde1f639e4 100644 --- a/test_fms/mpp/test_mpp_memutils_begin_2x.F90 +++ b/test_fms/mpp/test_mpp_memutils_begin_2x.F90 @@ -4,22 +4,21 @@ !! \section LICENSE !! !*********************************************************************** -!! GNU Lesser General Public License -!! -!! This file is part of the GFDL Flexible Modeling System (FMS). -!! -!! FMS is free software: you can redistribute it and/or modify it under -!! the terms of the GNU Lesser General Public License as published by -!! the Free Software Foundation, either version 3 of the License, or (at -!! your option) any later version. -!! -!! FMS is distributed in the hope that it will be useful, but WITHOUT -!! ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!! FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!! for more details. -!! -!! You should have received a copy of the GNU Lesser General Public -!! License along with FMS. If not, see . +!* Apache License 2.0 +!* +!* This file is part of the GFDL Flexible Modeling System (FMS). +!* +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at +!* +!* http://www.apache.org/licenses/LICENSE-2.0 +!* +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !! !! \section DESCRIPTION diff --git a/test_fms/mpp/test_mpp_memutils_begin_end.F90 b/test_fms/mpp/test_mpp_memutils_begin_end.F90 index f017fda331..83c3e1642e 100644 --- a/test_fms/mpp/test_mpp_memutils_begin_end.F90 +++ b/test_fms/mpp/test_mpp_memutils_begin_end.F90 @@ -4,22 +4,21 @@ !! \section LICENSE !! !*********************************************************************** -!! GNU Lesser General Public License -!! -!! This file is part of the GFDL Flexible Modeling System (FMS). -!! -!! FMS is free software: you can redistribute it and/or modify it under -!! the terms of the GNU Lesser General Public License as published by -!! the Free Software Foundation, either version 3 of the License, or (at -!! your option) any later version. -!! -!! FMS is distributed in the hope that it will be useful, but WITHOUT -!! ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!! FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!! for more details. -!! -!! You should have received a copy of the GNU Lesser General Public -!! License along with FMS. If not, see . +!* Apache License 2.0 +!* +!* This file is part of the GFDL Flexible Modeling System (FMS). +!* +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at +!* +!* http://www.apache.org/licenses/LICENSE-2.0 +!* +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !! !! \section DESCRIPTION diff --git a/test_fms/mpp/test_mpp_memutils_end_before_begin.F90 b/test_fms/mpp/test_mpp_memutils_end_before_begin.F90 index fd69c409e5..71e5da0967 100644 --- a/test_fms/mpp/test_mpp_memutils_end_before_begin.F90 +++ b/test_fms/mpp/test_mpp_memutils_end_before_begin.F90 @@ -4,22 +4,21 @@ !! \section LICENSE !! !*********************************************************************** -!! GNU Lesser General Public License -!! -!! This file is part of the GFDL Flexible Modeling System (FMS). -!! -!! FMS is free software: you can redistribute it and/or modify it under -!! the terms of the GNU Lesser General Public License as published by -!! the Free Software Foundation, either version 3 of the License, or (at -!! your option) any later version. -!! -!! FMS is distributed in the hope that it will be useful, but WITHOUT -!! ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!! FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!! for more details. -!! -!! You should have received a copy of the GNU Lesser General Public -!! License along with FMS. If not, see . +!* Apache License 2.0 +!* +!* This file is part of the GFDL Flexible Modeling System (FMS). +!* +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at +!* +!* http://www.apache.org/licenses/LICENSE-2.0 +!* +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !! !! \section DESCRIPTION diff --git a/test_fms/mpp/test_mpp_memutils_mod.sh b/test_fms/mpp/test_mpp_memutils_mod.sh index 72bfd8dc02..1ebf2e8b86 100755 --- a/test_fms/mpp/test_mpp_memutils_mod.sh +++ b/test_fms/mpp/test_mpp_memutils_mod.sh @@ -3,22 +3,21 @@ # author @underwoo # #*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL Flexible Modeling System (FMS). -# -# FMS is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FMS is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # # Script to test the mpp_memutils_mod Fortran module code. diff --git a/test_fms/mpp/test_mpp_nesting.F90 b/test_fms/mpp/test_mpp_nesting.F90 index 8808f0e9c8..2db02437bf 100644 --- a/test_fms/mpp/test_mpp_nesting.F90 +++ b/test_fms/mpp/test_mpp_nesting.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* Gnu Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> Tests nested domain operations and routines in mpp_domains program test_mpp_nesting diff --git a/test_fms/mpp/test_mpp_nesting.sh b/test_fms/mpp/test_mpp_nesting.sh index b30f612387..405c2c4bd4 100755 --- a/test_fms/mpp/test_mpp_nesting.sh +++ b/test_fms/mpp/test_mpp_nesting.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL Flexible Modeling System (FMS). -# -# FMS is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FMS is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/mpp/test_mpp_npes.F90 b/test_fms/mpp/test_mpp_npes.F90 index 68145543d4..99347f5224 100644 --- a/test_fms/mpp/test_mpp_npes.F90 +++ b/test_fms/mpp/test_mpp_npes.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** program test_mpp_npes !> @author Tom Robinson diff --git a/test_fms/mpp/test_mpp_npes.sh b/test_fms/mpp/test_mpp_npes.sh index edc3e4997d..b27e6a26c7 100755 --- a/test_fms/mpp/test_mpp_npes.sh +++ b/test_fms/mpp/test_mpp_npes.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL Flexible Modeling System (FMS). -# -# FMS is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FMS is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/mpp/test_mpp_pe.F90 b/test_fms/mpp/test_mpp_pe.F90 index b00871a050..ae18b7423f 100644 --- a/test_fms/mpp/test_mpp_pe.F90 +++ b/test_fms/mpp/test_mpp_pe.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @author Tom Robinson !> @description This test program is for testing the mpp_pe routine. The diff --git a/test_fms/mpp/test_mpp_pe.sh b/test_fms/mpp/test_mpp_pe.sh index 8936de1174..9e054b5e38 100755 --- a/test_fms/mpp/test_mpp_pe.sh +++ b/test_fms/mpp/test_mpp_pe.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL Flexible Modeling System (FMS). -# -# FMS is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FMS is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/mpp/test_mpp_print_memuse_stats_file.F90 b/test_fms/mpp/test_mpp_print_memuse_stats_file.F90 index 389fae4c95..3200b038bd 100644 --- a/test_fms/mpp/test_mpp_print_memuse_stats_file.F90 +++ b/test_fms/mpp/test_mpp_print_memuse_stats_file.F90 @@ -4,22 +4,21 @@ !! \section LICENSE !! !*********************************************************************** -!! GNU Lesser General Public License -!! -!! This file is part of the GFDL Flexible Modeling System (FMS). -!! -!! FMS is free software: you can redistribute it and/or modify it under -!! the terms of the GNU Lesser General Public License as published by -!! the Free Software Foundation, either version 3 of the License, or (at -!! your option) any later version. -!! -!! FMS is distributed in the hope that it will be useful, but WITHOUT -!! ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!! FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!! for more details. -!! -!! You should have received a copy of the GNU Lesser General Public -!! License along with FMS. If not, see . +!* Apache License 2.0 +!* +!* This file is part of the GFDL Flexible Modeling System (FMS). +!* +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at +!* +!* http://www.apache.org/licenses/LICENSE-2.0 +!* +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !! !! \section DESCRIPTION diff --git a/test_fms/mpp/test_mpp_print_memuse_stats_stderr.F90 b/test_fms/mpp/test_mpp_print_memuse_stats_stderr.F90 index dd507cd089..6b01a1c835 100644 --- a/test_fms/mpp/test_mpp_print_memuse_stats_stderr.F90 +++ b/test_fms/mpp/test_mpp_print_memuse_stats_stderr.F90 @@ -4,22 +4,21 @@ !! \section LICENSE !! !*********************************************************************** -!! GNU Lesser General Public License -!! -!! This file is part of the GFDL Flexible Modeling System (FMS). -!! -!! FMS is free software: you can redistribute it and/or modify it under -!! the terms of the GNU Lesser General Public License as published by -!! the Free Software Foundation, either version 3 of the License, or (at -!! your option) any later version. -!! -!! FMS is distributed in the hope that it will be useful, but WITHOUT -!! ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!! FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!! for more details. -!! -!! You should have received a copy of the GNU Lesser General Public -!! License along with FMS. If not, see . +!* Apache License 2.0 +!* +!* This file is part of the GFDL Flexible Modeling System (FMS). +!* +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at +!* +!* http://www.apache.org/licenses/LICENSE-2.0 +!* +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !! !! \section DESCRIPTION diff --git a/test_fms/mpp/test_read_ascii_file.F90 b/test_fms/mpp/test_mpp_read_ascii_file.F90 similarity index 85% rename from test_fms/mpp/test_read_ascii_file.F90 rename to test_fms/mpp/test_mpp_read_ascii_file.F90 index 48d6e2716b..cd8fb1a664 100644 --- a/test_fms/mpp/test_read_ascii_file.F90 +++ b/test_fms/mpp/test_mpp_read_ascii_file.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file @@ -22,7 +21,7 @@ !! @author Colin Gladue !! @email gfdl.climate.model.info@noaa.gov -program test_read_ascii_file +program test_mpp_read_ascii_file use mpp_mod, only : mpp_init, mpp_init_test_peset_allocated use mpp_mod, only : mpp_error, FATAL, NOTE @@ -111,4 +110,4 @@ program test_read_ascii_file end if end if call MPI_FINALIZE(ierr) -end program test_read_ascii_file +end program test_mpp_read_ascii_file diff --git a/test_fms/mpp/test_read_ascii_file.sh b/test_fms/mpp/test_mpp_read_ascii_file.sh similarity index 69% rename from test_fms/mpp/test_read_ascii_file.sh rename to test_fms/mpp/test_mpp_read_ascii_file.sh index ef06f9c8ea..6982c2c1fd 100755 --- a/test_fms/mpp/test_read_ascii_file.sh +++ b/test_fms/mpp/test_mpp_read_ascii_file.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL Flexible Modeling System (FMS). -# -# FMS is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FMS is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to @@ -47,21 +46,21 @@ echo "/" >> test_numb_base_ascii.nml # Normal Usage sed "s/test_numb = [0-9]/test_numb = 1/" test_numb_base_ascii.nml>test_numb_ascii.nml test_expect_success "normal ascii usage" ' - mpirun -n 1 ../test_read_ascii_file + mpirun -n 1 ../test_mpp_read_ascii_file ' # Test 2 # get_ascii_file_num_lines not called before, fatal error sed "s/test_numb = [0-9]/test_numb = 2/" test_numb_base_ascii.nml>test_numb_ascii.nml test_expect_failure "failure caught if get_ascii_file_num_lines not called before" ' - mpirun -n 1 ../test_read_ascii_file + mpirun -n 1 ../test_mpp_read_ascii_file ' # Test 3 # File does not exist, fatal error sed "s/test_numb = [0-9]/test_numb = 3/" test_numb_base_ascii.nml>test_numb_ascii.nml test_expect_failure "failure caught if file does not exist" ' - mpirun -n 1 ../test_read_ascii_file + mpirun -n 1 ../test_mpp_read_ascii_file ' # Test 4 @@ -69,27 +68,27 @@ test_expect_failure "failure caught if file does not exist" ' sed "s/test_numb = [0-9]/test_numb = 4/" test_numb_base_ascii.nml>test_numb_ascii.nml echo "" > empty.nml test_expect_failure "failure caught from too few input lines" ' - mpirun -n 1 ../test_read_ascii_file + mpirun -n 1 ../test_mpp_read_ascii_file ' # Test 5 # Length of output string is too small, fatal error sed "s/test_numb = [0-9]/test_numb = 5/" test_numb_base_ascii.nml>test_numb_ascii.nml test_expect_failure "failure caught from too small output string" ' - mpirun -n 1 ../test_read_ascii_file + mpirun -n 1 ../test_mpp_read_ascii_file ' # Test 6 # Number of lines in file does not equal to size(Content(:)), fatal error sed "s/test_numb = [0-9]/test_numb = 6/" test_numb_base_ascii.nml>test_numb_ascii.nml test_expect_failure "failure caught from mismatching numbers of lines" ' - mpirun -n 1 ../test_read_ascii_file + mpirun -n 1 ../test_mpp_read_ascii_file ' # Test 7 # Normal usage, with optional PELIST argument passed in sed "s/test_numb = [0-9]/test_numb = 7/" test_numb_base_ascii.nml>test_numb_ascii.nml test_expect_success "normal ascii usage with PELIST" ' - mpirun -n 1 ../test_read_ascii_file + mpirun -n 1 ../test_mpp_read_ascii_file ' # Test 8 @@ -97,7 +96,7 @@ test_expect_success "normal ascii usage with PELIST" ' sed "s/test_numb = [0-9]/test_numb = 8/" test_numb_base_ascii.nml>test_numb_ascii.nml touch empty.nml test_expect_success "normal ascii usage with empty file" ' - mpirun -n 1 ../test_read_ascii_file + mpirun -n 1 ../test_mpp_read_ascii_file ' test_done diff --git a/test_fms/mpp/test_mpp_root_pe.F90 b/test_fms/mpp/test_mpp_root_pe.F90 index 3993eda76b..654008ab13 100644 --- a/test_fms/mpp/test_mpp_root_pe.F90 +++ b/test_fms/mpp/test_mpp_root_pe.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !! @brief unit test for the mpp_root_pe() function diff --git a/test_fms/mpp/test_mpp_root_pe.sh b/test_fms/mpp/test_mpp_root_pe.sh index 7970004172..9a390019ba 100755 --- a/test_fms/mpp/test_mpp_root_pe.sh +++ b/test_fms/mpp/test_mpp_root_pe.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/mpp/test_mpp_sendrecv.F90 b/test_fms/mpp/test_mpp_sendrecv.F90 index c90b7bbfcc..a31c98fc1c 100644 --- a/test_fms/mpp/test_mpp_sendrecv.F90 +++ b/test_fms/mpp/test_mpp_sendrecv.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** #ifdef SYSTEM_CLOCK #undef SYSTEM_CLOCK diff --git a/test_fms/mpp/test_mpp_sendrecv.sh b/test_fms/mpp/test_mpp_sendrecv.sh index 5151e998bc..a23020a5f2 100755 --- a/test_fms/mpp/test_mpp_sendrecv.sh +++ b/test_fms/mpp/test_mpp_sendrecv.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL Flexible Modeling System (FMS). -# -# FMS is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FMS is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/mpp/test_mpp_sum.F90 b/test_fms/mpp/test_mpp_sum.F90 index 09d0fcbe60..f713c125e1 100644 --- a/test_fms/mpp/test_mpp_sum.F90 +++ b/test_fms/mpp/test_mpp_sum.F90 @@ -1,21 +1,20 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !! @author Lauren Chilutti diff --git a/test_fms/mpp/test_mpp_sum.sh b/test_fms/mpp/test_mpp_sum.sh index fa00ea1e23..ad7a795be6 100755 --- a/test_fms/mpp/test_mpp_sum.sh +++ b/test_fms/mpp/test_mpp_sum.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL Flexible Modeling System (FMS). -# -# FMS is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FMS is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/mpp/test_mpp_transmit.F90 b/test_fms/mpp/test_mpp_transmit.F90 index 69e0e1f855..dbcb8b0881 100644 --- a/test_fms/mpp/test_mpp_transmit.F90 +++ b/test_fms/mpp/test_mpp_transmit.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !! @author Lauren Chilutti diff --git a/test_fms/mpp/test_mpp_transmit.sh b/test_fms/mpp/test_mpp_transmit.sh index 77f610f091..362e3639dd 100755 --- a/test_fms/mpp/test_mpp_transmit.sh +++ b/test_fms/mpp/test_mpp_transmit.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL Flexible Modeling System (FMS). -# -# FMS is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FMS is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/mpp/test_mpp_update_domains_main.F90 b/test_fms/mpp/test_mpp_update_domains.F90 similarity index 86% rename from test_fms/mpp/test_mpp_update_domains_main.F90 rename to test_fms/mpp/test_mpp_update_domains.F90 index b47bdff5a9..b5f541cc27 100644 --- a/test_fms/mpp/test_mpp_update_domains_main.F90 +++ b/test_fms/mpp/test_mpp_update_domains.F90 @@ -1,26 +1,25 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @author Jessica Liptak !> @brief run mpp_domains tests on arrays of integers and real numbers !! using different layouts and data precision !> @note This test calls extensions of the routine test_halo_upate in test_mpp_domains. -program test_mpp_update_domains_main +program test_mpp_update_domains use test_mpp_update_domains_real, only : test_halo_update_r8, test_halo_update_r4 use test_mpp_update_domains_real, only : test_subset_update_r8, test_subset_update_r4 @@ -94,4 +93,4 @@ program test_mpp_update_domains_main call mpp_domains_exit() !> Finalize mpp call MPI_FINALIZE(ierr) -end program test_mpp_update_domains_main +end program test_mpp_update_domains diff --git a/test_fms/mpp/test_mpp_update_domains.sh b/test_fms/mpp/test_mpp_update_domains.sh index 2ae9307994..50debf96e2 100755 --- a/test_fms/mpp/test_mpp_update_domains.sh +++ b/test_fms/mpp/test_mpp_update_domains.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL Flexible Modeling System (FMS). -# -# FMS is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FMS is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/mpp/test_mpp_update_domains_ad.F90 b/test_fms/mpp/test_mpp_update_domains_ad.F90 index aeaf253528..978dcd2b12 100644 --- a/test_fms/mpp/test_mpp_update_domains_ad.F90 +++ b/test_fms/mpp/test_mpp_update_domains_ad.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @author Jessica Liptak !> @brief Test mpp_update_domains_ad using different layouts and data precision diff --git a/test_fms/mpp/test_mpp_update_domains_ad.sh b/test_fms/mpp/test_mpp_update_domains_ad.sh index 54053f1700..104bb79cf5 100755 --- a/test_fms/mpp/test_mpp_update_domains_ad.sh +++ b/test_fms/mpp/test_mpp_update_domains_ad.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL Flexible Modeling System (FMS). -# -# FMS is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FMS is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/mpp/test_mpp_update_domains_int.F90 b/test_fms/mpp/test_mpp_update_domains_int.F90 index 11e3e80aa6..1a2870af22 100644 --- a/test_fms/mpp/test_mpp_update_domains_int.F90 +++ b/test_fms/mpp/test_mpp_update_domains_int.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief Test mpp_update_domains on arrays of integers using different layouts and data precision diff --git a/test_fms/mpp/test_mpp_update_domains_real.F90 b/test_fms/mpp/test_mpp_update_domains_real.F90 index a30a55adfa..a5ae3b2fa2 100644 --- a/test_fms/mpp/test_mpp_update_domains_real.F90 +++ b/test_fms/mpp/test_mpp_update_domains_real.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @brief Test mpp_update_domains on arrays of real numbers using different layouts and data precision diff --git a/test_fms/mpp/test_peset.F90 b/test_fms/mpp/test_peset.F90 index 300bd96f47..1e0d6e14dd 100644 --- a/test_fms/mpp/test_peset.F90 +++ b/test_fms/mpp/test_peset.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** program test_peset !> @author Jessica Liptak diff --git a/test_fms/mpp/test_peset.sh b/test_fms/mpp/test_peset.sh index befa8f9860..ad8ef3253e 100755 --- a/test_fms/mpp/test_peset.sh +++ b/test_fms/mpp/test_peset.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL Flexible Modeling System (FMS). -# -# FMS is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FMS is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/mpp/test_read_input_nml.F90 b/test_fms/mpp/test_read_input_nml.F90 index 9a28e601fe..ca8350aa6b 100644 --- a/test_fms/mpp/test_read_input_nml.F90 +++ b/test_fms/mpp/test_read_input_nml.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file diff --git a/test_fms/mpp/test_read_input_nml2.sh b/test_fms/mpp/test_read_input_nml2.sh index 5eb411429b..6dbdfd3529 100755 --- a/test_fms/mpp/test_read_input_nml2.sh +++ b/test_fms/mpp/test_read_input_nml2.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL Flexible Modeling System (FMS). -# -# FMS is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FMS is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/mpp/test_redistribute_int.F90 b/test_fms/mpp/test_redistribute_int.F90 index 144affe1c8..9ca3c08348 100644 --- a/test_fms/mpp/test_redistribute_int.F90 +++ b/test_fms/mpp/test_redistribute_int.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -! GNU Lesser General Public License -! -! This file is part of the GFDL Flexible Modeling System (FMS). -! -! FMS is free software: you can redistribute it and/or modify it under -! the terms of the GNU Lesser General Public License as published by -! the Free Software Foundation, either version 3 of the License, or (at -! your option) any later version. -! -! FMS is distributed in the hope that it will be useful, but WITHOUT -! ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -! FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -! for more details. -! -! You should have received a copy of the GNU Lesser General Public -! License along with FMS. If not, see . +!* Apache License 2.0 +!* +!* This file is part of the GFDL Flexible Modeling System (FMS). +!* +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at +!* +!* http://www.apache.org/licenses/LICENSE-2.0 +!* +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @author Ryan Mulhall diff --git a/test_fms/mpp/test_redistribute_int.sh b/test_fms/mpp/test_redistribute_int.sh index 1e1b94501a..ce77812c39 100755 --- a/test_fms/mpp/test_redistribute_int.sh +++ b/test_fms/mpp/test_redistribute_int.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL Flexible Modeling System (FMS). -# -# FMS is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FMS is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/mpp/test_stderr.F90 b/test_fms/mpp/test_stderr.F90 index 4b602d93f8..8b04efe062 100644 --- a/test_fms/mpp/test_stderr.F90 +++ b/test_fms/mpp/test_stderr.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file diff --git a/test_fms/mpp/test_stderr.sh b/test_fms/mpp/test_stderr.sh index 25f8190b65..0e40c8c488 100755 --- a/test_fms/mpp/test_stderr.sh +++ b/test_fms/mpp/test_stderr.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL Flexible Modeling System (FMS). -# -# FMS is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FMS is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/mpp/test_stdin.F90 b/test_fms/mpp/test_stdin.F90 index eb5370f5b1..83894cdec8 100644 --- a/test_fms/mpp/test_stdin.F90 +++ b/test_fms/mpp/test_stdin.F90 @@ -1,21 +1,20 @@ -!********************************************************************** -!* GNU Lesser General Public License +!*********************************************************************** +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . -!********************************************************************** +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. +!*********************************************************************** !> @file !! @brief Unit test for the STDIN function diff --git a/test_fms/mpp/test_stdin.sh b/test_fms/mpp/test_stdin.sh index 0a8df299dc..72787d3554 100755 --- a/test_fms/mpp/test_stdin.sh +++ b/test_fms/mpp/test_stdin.sh @@ -1,21 +1,20 @@ #!/bin/sh #*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL Flexible Modeling System (FMS). -# -# FMS is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FMS is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/mpp/test_stdlog.F90 b/test_fms/mpp/test_stdlog.F90 index 92b4079157..a4d888b5e6 100644 --- a/test_fms/mpp/test_stdlog.F90 +++ b/test_fms/mpp/test_stdlog.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file diff --git a/test_fms/mpp/test_stdlog.sh b/test_fms/mpp/test_stdlog.sh index 191ff93bcc..05ba421ba8 100755 --- a/test_fms/mpp/test_stdlog.sh +++ b/test_fms/mpp/test_stdlog.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL Flexible Modeling System (FMS). -# -# FMS is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FMS is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/mpp/test_stdout.F90 b/test_fms/mpp/test_stdout.F90 index 25fbbcf360..f3542c1482 100644 --- a/test_fms/mpp/test_stdout.F90 +++ b/test_fms/mpp/test_stdout.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file diff --git a/test_fms/mpp/test_stdout.sh b/test_fms/mpp/test_stdout.sh index ddce1baf2a..8f47803e25 100755 --- a/test_fms/mpp/test_stdout.sh +++ b/test_fms/mpp/test_stdout.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL Flexible Modeling System (FMS). -# -# FMS is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FMS is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/mpp/test_super_grid.F90 b/test_fms/mpp/test_super_grid.F90 index a8f6ccbb23..240a578251 100644 --- a/test_fms/mpp/test_super_grid.F90 +++ b/test_fms/mpp/test_super_grid.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief This programs tests mpp_copy_domains and makes sure the domain was diff --git a/test_fms/mpp/test_super_grid.sh b/test_fms/mpp/test_super_grid.sh index 6660d17023..b196cde83b 100755 --- a/test_fms/mpp/test_super_grid.sh +++ b/test_fms/mpp/test_super_grid.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL Flexible Modeling System (FMS). -# -# FMS is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FMS is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/mpp/test_system_clock.F90 b/test_fms/mpp/test_system_clock.F90 index 434353e9ad..1eb4c03f59 100644 --- a/test_fms/mpp/test_system_clock.F90 +++ b/test_fms/mpp/test_system_clock.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !! @author Lauren Chilutti diff --git a/test_fms/mpp/test_system_clock.sh b/test_fms/mpp/test_system_clock.sh index 0cf357e824..6b47d9ad60 100755 --- a/test_fms/mpp/test_system_clock.sh +++ b/test_fms/mpp/test_system_clock.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL Flexible Modeling System (FMS). -# -# FMS is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FMS is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/mpp/test_update_domains_performance.F90 b/test_fms/mpp/test_update_domains_performance.F90 index a0a81443e2..4fd9f66f7b 100644 --- a/test_fms/mpp/test_update_domains_performance.F90 +++ b/test_fms/mpp/test_update_domains_performance.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @author Jessica Liptak !> @brief Run performance tests using blocking communications with mpp_update_domains, diff --git a/test_fms/mpp/test_update_domains_performance.sh b/test_fms/mpp/test_update_domains_performance.sh index 36303abd53..47c426dbcc 100755 --- a/test_fms/mpp/test_update_domains_performance.sh +++ b/test_fms/mpp/test_update_domains_performance.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL Flexible Modeling System (FMS). -# -# FMS is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FMS is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/offloading/Makefile.am b/test_fms/offloading/Makefile.am new file mode 100644 index 0000000000..92cac6eddb --- /dev/null +++ b/test_fms/offloading/Makefile.am @@ -0,0 +1,50 @@ +#*********************************************************************** +#* GNU Lesser General Public License +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* FMS is free software: you can redistribute it and/or modify it under +#* the terms of the GNU Lesser General Public License as published by +#* the Free Software Foundation, either version 3 of the License, or (at +#* your option) any later version. +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +#* for more details. +#* +#* You should have received a copy of the GNU Lesser General Public +#* License along with FMS. If not, see . +#*********************************************************************** + +# This is an automake file for the test_fms/data_override directory of the FMS +# package. + +# uramirez + +# Find the needed mod and .inc files. +AM_CPPFLAGS = -I${top_srcdir}/include -I$(MODDIR) + +# Link to the FMS library. +LDADD = ${top_builddir}/libFMS/libFMS.la + +# Build this test program. +check_PROGRAMS = test_io_offloading test_metadata_transfer + +# This is the source code for the test. +test_io_offloading_SOURCES = test_io_offloading.F90 +test_metadata_transfer_SOURCES= test_metadata_transfer.F90 + +# Run the test program. +TESTS = test_io_offloading.sh + +# Define test file extensions and log driver +TEST_EXTENSIONS = .sh +SH_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ + $(abs_top_srcdir)/test_fms/tap-driver.sh + +# Include these files with the distribution. +EXTRA_DIST = test_io_offloading.sh + +# Clean up +CLEANFILES = input.nml *.out diff --git a/test_fms/offloading/test_io_offloading.F90 b/test_fms/offloading/test_io_offloading.F90 new file mode 100644 index 0000000000..1f21689b7a --- /dev/null +++ b/test_fms/offloading/test_io_offloading.F90 @@ -0,0 +1,148 @@ +!*********************************************************************** +!* Apache License 2.0 +!* +!* This file is part of the GFDL Flexible Modeling System (FMS). +!* +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at +!* +!* http://www.apache.org/licenses/LICENSE-2.0 +!* +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. +!*********************************************************************** +program test_io_offloading + use fms_mod, only: fms_init, fms_end, string, check_nml_error + use platform_mod + use mpp_mod + use mpp_domains_mod + use offloading_io_mod + use fms2_io_mod + + implicit none + + integer, parameter :: lat_lon = 1 !< Using a lat lon domain + integer, parameter :: cube_sphere = 2 !< Using a cube sphere domain + integer, allocatable :: model_pes(:) !< The model PEs + integer, allocatable :: offload_pes(:) !< The PEs for offloading + integer, allocatable :: og_pes(:) !< all of the PEs + logical :: is_root_pe !< The root PE from all of the PEs + logical :: is_model_pe !< .True. if current PE is a member of the model_pes + logical :: is_offload_pe !< .True. if current PE is a member of the offload_pes + type(domain2D) :: model_domain !< Domain for the model PEs + integer :: i !< For do loops + integer :: io !< Error code when reading namelist + integer :: ierr !< Error code for namelist + character(len=30) :: filename !< Filename for the test + type(FmsNetcdfDomainFile_t) :: fileobj !< Fileobj for the test + real(kind=r4_kind), allocatable :: var_r4(:,:) !< Variable data for the "model" + + !< Namelist variables + integer :: nx = 96 !< Number of points in the x direction (per tile) + integer :: ny = 96 !< Number of points in the y direction (per tile) + integer :: nxhalo = 2 !< Number of halo points in the x direction + integer :: nyhalo = 2 !< Number of halo points in the x direction + integer :: noffload_pes = 1 !< Number of PEs to use for offloading (need 1 per tile) + integer :: nmodel_pes = 6 !< Number of PEs to use for the model + integer :: io_layout(2) !< Io layout to use for the model domain + integer :: domain_type = lat_lon !< The type of domain to use [lat_lon or cube_sphere] + + namelist /test_io_offloading_nml/ nx, ny, nxhalo, nyhalo, noffload_pes, nmodel_pes, domain_type + + call fms_init + call offloading_io_init + + read(input_nml_file, nml=test_io_offloading_nml, iostat=io) + ierr = check_nml_error(io, 'test_io_offloading_nml') + + if (mpp_npes() .ne. nmodel_pes + noffload_pes) & + call mpp_error(FATAL, "The total number of PEs "//string(mpp_npes())//" is not equal to model_pes + noffload_pes") + + is_root_pe = mpp_pe() .eq. mpp_root_pe() + allocate(og_pes(mpp_npes())) + call mpp_get_current_pelist(og_pes) + + allocate(model_pes(nmodel_pes)) + model_pes(1) = 0 + do i = 2, nmodel_pes + model_pes(i) = model_pes(i-1) + 1 + enddo + if (is_root_pe) print *, "Model PEs:", model_pes + call mpp_declare_pelist(model_pes, "model_pes") + + allocate(offload_pes(noffload_pes)) + offload_pes(1) = model_pes(nmodel_pes) + 1 + do i = 2, noffload_pes + offload_pes(i) = offload_pes(i-1) + 1 + enddo + if (is_root_pe) print *, "Offload PEs:", offload_pes + call mpp_declare_pelist(offload_pes, "offload_pes") + + is_model_pe = .false. + is_offload_pe = .false. + if (any(model_pes .eq. mpp_pe())) is_model_pe = .true. + if (any(offload_pes .eq. mpp_pe())) is_offload_pe = .true. + + if (is_model_pe) then + call mpp_set_current_pelist( model_pes ) + ! Only the model pes are creating the domain and allocating the data + select case (domain_type) + case (lat_lon) + model_domain = create_lat_lon_domain(nx, ny, halox=nxhalo, haloy=nyhalo) + case (cube_sphere) + model_domain = create_cubic_domain(nx, ny, 6, io_layout, nhalos=nxhalo) + end select + + filename = "atmos.daily.nc" + var_r4 = create_dummy_data(model_domain) + endif + + call mpp_set_current_pelist(og_pes) !All of the PEs need to call the offloading stuff + call open_file_offload(fileobj, filename, & + model_domain, & + model_pes, offload_pes) + + call global_metadata_offload(fileobj, "Number of times Fortran made you cry", 20) + call global_metadata_offload(fileobj, "Number of lines of code", 19.54326541) + + call register_axis_offload(fileobj, "lon", "x") + call register_axis_offload(fileobj, "lat", "x") + + call register_field_offload(fileobj, "mullions", "double", (/"lon", "lat"/)) + call write_data_offload(fileobj, "mullions", var_r4) + call close_file_offload(fileobj) + call fms_end + + contains + + function create_dummy_data(domain) & + result(dummy_data) + + type(domain2D), intent(in) :: domain + real(kind=r4_kind), allocatable :: dummy_data(:,:) + + integer :: is !< Starting x index + integer :: ie !< Ending x index + integer :: js !< Starting y index + integer :: je !< Ending y index + + integer :: j, k + + !Allocate the data to the size of the data domain but only fill the compute domain with data + call mpp_get_data_domain(domain, is, ie, js, je) + allocate(dummy_data(is:ie, js:je)) + dummy_data = -999_r4_kind + + call mpp_get_compute_domain(domain, is, ie, js, je) + do j = is, ie + do k = js, je + dummy_data(j, k) = real(j, kind=r4_kind)* 100_r4_kind + & + real(k, kind=r4_kind) + enddo + enddo + end function +end program test_io_offloading diff --git a/test_fms/offloading/test_io_offloading.sh b/test_fms/offloading/test_io_offloading.sh new file mode 100755 index 0000000000..e2a4a0ee22 --- /dev/null +++ b/test_fms/offloading/test_io_offloading.sh @@ -0,0 +1,41 @@ +#!/bin/sh +#*********************************************************************** +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. +#*********************************************************************** + +# This is part of the GFDL FMS package. This is a shell script to +# execute tests in the test_fms/offloading directory. + +# Set common test settings. +. ../test-lib.sh + +cat > input.nml << _EOF +offloading_io_nml + max_offloaded_files = 10 +/ +_EOF + +# TODO fails with older gnus +#test_expect_success "test_io_offloading" ' +# mpirun -n 7 ./test_io_offloading +#' + +test_expect_success "test metadata transfer" ' + mpirun -n 4 ./test_metadata_transfer +' + +test_done diff --git a/test_fms/offloading/test_metadata_transfer.F90 b/test_fms/offloading/test_metadata_transfer.F90 new file mode 100644 index 0000000000..989c9960ec --- /dev/null +++ b/test_fms/offloading/test_metadata_transfer.F90 @@ -0,0 +1,218 @@ +!*********************************************************************** +!* Apache License 2.0 +!* +!* This file is part of the GFDL Flexible Modeling System (FMS). +!* +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at +!* +!* http://www.apache.org/licenses/LICENSE-2.0 +!* +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. +!*********************************************************************** +program test_metadata_transfer + use fms_mod, only: fms_init, fms_end, string + use mpp_mod + use metadata_transfer_mod + use platform_mod + use, intrinsic :: iso_c_binding + + implicit none + + class(metadata_class), allocatable :: file_metadata(:) + + logical :: debug = .true. + + call fms_init() + + allocate(metadata_r8_type :: file_metadata(3)) + ! all PEs need to initialize the metadata object with a datatype + call file_metadata(1)%fms_metadata_transfer_init(real8_type) + call file_metadata(2)%fms_metadata_transfer_init(real8_type) + call file_metadata(3)%fms_metadata_transfer_init(real8_type) + ! set metadata only on root PE + if (mpp_pe() .eq. mpp_root_pe()) then + call file_metadata(1)%set_attribute_name("_FillValue"//c_null_char) + select type(obj => file_metadata(1)) + type is(metadata_r8_type) + call obj%set_attribute_value([666.0_r8_kind]) + end select + call file_metadata(2)%set_attribute_name("missing_value"//c_null_char) + select type(obj => file_metadata(2)) + type is(metadata_r8_type) + call obj%set_attribute_value([-100.0_r8_kind, 100.0_r8_kind]) + end select + call file_metadata(3)%set_attribute_name("a_third_name"//c_null_char) + select type(obj => file_metadata(3)) + type is(metadata_r8_type) + call obj%set_attribute_value([-200.0_r8_kind, -50.0_r8_kind, 0.0_r8_kind, 50.0_r8_kind, 200.0_r8_kind]) + end select + endif + ! Broadcast the metadata to all PEs + call fms_metadata_broadcast_all(file_metadata) + ! Check data on all PEs + select type(file_metadata) + type is(metadata_r8_type) + if(debug) call dump_metadata_r8(file_metadata) + call check_metadata_r8(file_metadata) + end select + call mpp_sync() + deallocate(file_metadata) !! fails here on every PE besides root + + !! test with real4_type metadata + allocate(metadata_r4_type :: file_metadata(1)) + call file_metadata(1)%fms_metadata_transfer_init(real4_type) + if(mpp_pe() .eq. mpp_root_pe()) then + call file_metadata(1)%set_attribute_name("Valuez_r4"//c_null_char) + select type(obj => file_metadata(1)) + type is(metadata_r4_type) + call obj%set_attribute_value([666.0_r4_kind, -100.0_r4_kind, 100.0_r4_kind, -200.0_r4_kind, & + -50.0_r4_kind, 0.0_r4_kind, 50.0_r4_kind, 200.0_r4_kind]) + end select + endif + call fms_metadata_broadcast_all(file_metadata) + select type(file_metadata) + type is(metadata_r4_type) + print *, "PE: ", mpp_pe(), " metadata name is ", trim(adjustl(file_metadata(1)%get_attribute_name())) + print *, "PE: ", mpp_pe(), " metadata value is ", file_metadata(1)%get_attribute_value() + call check_metadata_r4(file_metadata) + end select + deallocate(file_metadata) + + !! test with int4_type metadata + allocate(metadata_i4_type :: file_metadata(1)) + call file_metadata(1)%fms_metadata_transfer_init(int4_type) + if(mpp_pe() .eq. mpp_root_pe()) then + call file_metadata(1)%set_attribute_name("Valuez_int4"//c_null_char) + select type(obj => file_metadata(1)) + type is(metadata_i4_type) + call obj%set_attribute_value([666, -100, 100, -200, & + -50, 0, 50, 200]) + end select + endif + call fms_metadata_broadcast_all(file_metadata) + select type(file_metadata) + type is(metadata_i4_type) + print *, "PE: ", mpp_pe(), " metadata name is ", trim(adjustl(file_metadata(1)%get_attribute_name())) + print *, "PE: ", mpp_pe(), " metadata value is ", file_metadata(1)%get_attribute_value() + end select + deallocate(file_metadata) + + !! test with int8_type metadata + allocate(metadata_i8_type :: file_metadata(1)) + call file_metadata(1)%fms_metadata_transfer_init(int8_type) + if(mpp_pe() .eq. mpp_root_pe()) then + call file_metadata(1)%set_attribute_name("Valuez_int8"//c_null_char) + select type(obj => file_metadata(1)) + type is(metadata_i8_type) + call obj%set_attribute_value([666_i8_kind, -100_i8_kind, 100_i8_kind, -200_i8_kind, & + -50_i8_kind, 0_i8_kind, 50_i8_kind, 200_i8_kind]) + end select + endif + call fms_metadata_broadcast_all(file_metadata) + select type(file_metadata) + type is(metadata_i8_type) + print *, "PE: ", mpp_pe(), " metadata name is ", trim(adjustl(file_metadata(1)%get_attribute_name())) + print *, "PE: ", mpp_pe(), " metadata value is ", file_metadata(1)%get_attribute_value() + end select + deallocate(file_metadata) + + !! test with str_type metadata + allocate(metadata_str_type :: file_metadata(1)) + call file_metadata(1)%fms_metadata_transfer_init(int4_type) + if(mpp_pe() .eq. mpp_root_pe()) then + call file_metadata(1)%set_attribute_name("foo"//c_null_char) + select type(obj => file_metadata(1)) + type is(metadata_str_type) + call obj%set_attribute_value("bar") + end select + endif + call fms_metadata_broadcast_all(file_metadata) + select type(file_metadata) + type is(metadata_str_type) + print *, "PE: ", mpp_pe(), " metadata name is ", trim(adjustl(file_metadata(1)%get_attribute_name())) + print *, "PE: ", mpp_pe(), " metadata value is ", file_metadata(1)%get_attribute_value() + if(trim(file_metadata(1)%get_attribute_name()) .ne. "foo"//c_null_char .or. & + trim(file_metadata(1)%get_attribute_value()) .ne. "bar") then + call mpp_error(FATAL, "incorrect metadata name") + endif + end select + deallocate(file_metadata) + + call fms_end() + + contains + + subroutine dump_metadata_r8(this) + type(metadata_r8_type), intent(inout) :: this(:) + real(r8_kind), allocatable :: arr(:) + + integer :: i + do i = 1, size(this) + arr = this(i)%get_attribute_value() + print *, "pe: ", mpp_pe(), "i: ", i, " attribute_name is ", trim(adjustl(this(i)%get_attribute_name())) + print *, "pe: ", mpp_pe(), "i: ", i, " attribute_value is ", arr + enddo + end subroutine + + subroutine check_metadata_r8(this) + type(metadata_r8_type), intent(inout) :: this(:) + real(r8_kind), allocatable :: arr(:) + character(len=32) :: attr_names(3) + real(r8_kind) :: attr_vals(8) + integer :: i, j, last_j =1 + + attr_names(1) = "_FillValue"//c_null_char + attr_names(2) = "missing_value"//c_null_char + attr_names(3) = "a_third_name"//c_null_char + attr_vals = (/ 666.0_r8_kind, -100.0_r8_kind, 100.0_r8_kind, -200.0_r8_kind, & + -50.0_r8_kind, 0.0_r8_kind, 50.0_r8_kind, 200.0_r8_kind /) + + do i = 1, size(this) + arr = this(i)%get_attribute_value() + if (trim(this(i)%get_attribute_name()) .ne. attr_names(i)) then + call mpp_error(FATAL, "incorrect metadata name") + endif + + do j=1, size(arr) + if (arr(j) .ne. attr_vals(last_j)) then + print *, "got ", arr(j), " expected ", attr_vals(last_j) + call mpp_error(FATAL, "incorrect metadata value") + endif + last_j = last_j + 1 + enddo + + enddo + end subroutine + + subroutine check_metadata_r4(this) + type(metadata_r4_type), intent(inout) :: this(:) + real(r4_kind), allocatable :: arr(:) + character(len=32) :: attr_name + real(r4_kind) :: attr_vals(8) + integer :: j, last_j =1 + + attr_name = "Valuez_r4"//c_null_char + attr_vals = (/ 666.0_r4_kind, -100.0_r4_kind, 100.0_r4_kind, -200.0_r4_kind, & + -50.0_r4_kind, 0.0_r4_kind, 50.0_r4_kind, 200.0_r4_kind /) + + arr = this(1)%get_attribute_value() + if (trim(this(1)%get_attribute_name()) .ne. attr_name) then + print *, "got ", trim(this(1)%get_attribute_name()), " expected ", trim(attr_name) + call mpp_error(FATAL, "incorrect metadata name") + endif + + do j=1, size(arr) + if (arr(j) .ne. attr_vals(j)) then + print *, "got ", arr(j), " expected ", attr_vals(last_j) + call mpp_error(FATAL, "incorrect metadata value") + endif + enddo + end subroutine + +end program diff --git a/test_fms/parser/Makefile.am b/test_fms/parser/Makefile.am index 569f64e901..859fbd586a 100644 --- a/test_fms/parser/Makefile.am +++ b/test_fms/parser/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the test_fms/data_override directory of the FMS @@ -52,11 +51,10 @@ SH_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ $(abs_top_srcdir)/test_fms/tap-driver.sh if USING_YAML -skipflag="" + TESTS_ENVIRONMENT = parser_skip="" else -skipflag="skip" + TESTS_ENVIRONMENT = parser_skip=skip endif -TESTS_ENVIRONMENT = parser_skip=${skipflag} # Clean up CLEANFILES = input.nml *.nc* *.out *.yaml *.dpi *.spi *.dyn *.spl diff --git a/test_fms/parser/check_crashes.F90 b/test_fms/parser/check_crashes.F90 index f19b680483..db182f80b6 100644 --- a/test_fms/parser/check_crashes.F90 +++ b/test_fms/parser/check_crashes.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** program check_crashes diff --git a/test_fms/parser/generic_blocks.F90 b/test_fms/parser/generic_blocks.F90 index d44beb9fcb..c025e988d9 100644 --- a/test_fms/parser/generic_blocks.F90 +++ b/test_fms/parser/generic_blocks.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief This programs tests the subroutines get_num_unique_blocks, get_unique_block_ids, and diff --git a/test_fms/parser/parser_demo.F90 b/test_fms/parser/parser_demo.F90 index 208e41e807..1f00cbb320 100644 --- a/test_fms/parser/parser_demo.F90 +++ b/test_fms/parser/parser_demo.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** program parser_demo diff --git a/test_fms/parser/parser_demo2.F90 b/test_fms/parser/parser_demo2.F90 index 674ab85fbb..99f65edff1 100644 --- a/test_fms/parser/parser_demo2.F90 +++ b/test_fms/parser/parser_demo2.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** program parser_demo diff --git a/test_fms/parser/test_output_yaml.F90 b/test_fms/parser/test_output_yaml.F90 index e5a144caba..9956b38a1b 100644 --- a/test_fms/parser/test_output_yaml.F90 +++ b/test_fms/parser/test_output_yaml.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> \author Tom Robinson diff --git a/test_fms/parser/test_yaml_parser.F90 b/test_fms/parser/test_yaml_parser.F90 index d921365429..7bb11aaec1 100644 --- a/test_fms/parser/test_yaml_parser.F90 +++ b/test_fms/parser/test_yaml_parser.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief This programs tests the public subroutines in parser/yaml_parser.F90 diff --git a/test_fms/parser/test_yaml_parser.sh b/test_fms/parser/test_yaml_parser.sh index e5405baaf3..fb310bae8a 100755 --- a/test_fms/parser/test_yaml_parser.sh +++ b/test_fms/parser/test_yaml_parser.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to @@ -26,7 +25,7 @@ . ../test-lib.sh if [ ! -z $parser_skip ]; then - SKIP_TESTS='test_yaml_parser.[1-25]' + SKIP_TESTS='test_yaml_parser.[1-27]' fi touch input.nml @@ -329,4 +328,51 @@ _EOF test_expect_failure "Use an invalid yaml" ' mpirun -n 1 ./parser_demo ' + +cat <<_EOF > diag_table.yaml +name: &name + - varName: tdata + reduction: False + module: mullions + mullions: 10 + fill_value: -999.9 + - varName: pdata + outName: pressure + reduction: False + kind: double + module: "moist" + +name2: &name2 + - varName: tdata + reduction: False + module: "moist" + +title: c384L49_esm5PIcontrol +baseDate: [1960 1 1 1 1 1 1] +diag_files: +- fileName: "atmos_daily" + freq: 24 + frequnit: hours + timeunit: days + unlimdim: time + varlist: + - *name +- fileName: atmos_8xdaily + freq: 3 + frequnit: hours + timeunit: days + unlimdim: time + varlist: + - *name2 +_EOF + +test_expect_success "test_yaml_parser using anchors" ' + mpirun -n 1 ./test_yaml_parser +' + +sed 's/\*name/*invalid_name/' diag_table.yaml > diag_table.yaml +test_expect_failure "test_yaml_parser using anchors" ' + mpirun -n 1 ./test_yaml_parser +' + test_done diff --git a/test_fms/random_numbers/Makefile.am b/test_fms/random_numbers/Makefile.am index e365ed80bf..a37481df1e 100644 --- a/test_fms/random_numbers/Makefile.am +++ b/test_fms/random_numbers/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the test_fms/data_override directory of the FMS @@ -35,8 +34,8 @@ check_PROGRAMS = \ test_random_numbers_r4_SOURCES = test_random_numbers.F90 test_random_numbers_r8_SOURCES = test_random_numbers.F90 -test_random_numbers_r4_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_RN_KIND_=r4_kind -test_random_numbers_r8_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_RN_KIND_=r8_kind +test_random_numbers_r4_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_FMS_KIND_=r4_kind +test_random_numbers_r8_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_FMS_KIND_=r8_kind TEST_EXTENSIONS = .sh SH_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ diff --git a/test_fms/random_numbers/test_random_numbers.F90 b/test_fms/random_numbers/test_random_numbers.F90 index a4243f21fc..e5470cfd9f 100644 --- a/test_fms/random_numbers/test_random_numbers.F90 +++ b/test_fms/random_numbers/test_random_numbers.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** program test_random_numbers @@ -32,7 +31,7 @@ program test_random_numbers integer, parameter :: n0_2d = 50 !> Initial dimensions of 2D random sample array integer, parameter :: seeds(*) = [0, -5, 3] !> Seed constants -integer, parameter :: k = TEST_RN_KIND_ !> Either r4_kind or r8_kind +integer, parameter :: k = TEST_FMS_KIND_ !> Either r4_kind or r8_kind real(k), dimension(n_moments) :: moment_mu !> Expected moment values real(k), dimension(n_moments) :: moment_sigma !> Standard deviations of sample moments diff --git a/test_fms/random_numbers/test_random_numbers.sh b/test_fms/random_numbers/test_random_numbers.sh index 7c7d8fc180..22e1772f46 100755 --- a/test_fms/random_numbers/test_random_numbers.sh +++ b/test_fms/random_numbers/test_random_numbers.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # Set common test settings. diff --git a/test_fms/sat_vapor_pres/Makefile.am b/test_fms/sat_vapor_pres/Makefile.am index a00109247b..a622fa5649 100644 --- a/test_fms/sat_vapor_pres/Makefile.am +++ b/test_fms/sat_vapor_pres/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the test_fms/time_manager directory of the FMS @@ -34,8 +33,8 @@ check_PROGRAMS = test_sat_vapor_pres_r4 test_sat_vapor_pres_r8 test_sat_vapor_pres_r4_SOURCES = test_sat_vapor_pres.F90 test_sat_vapor_pres_r8_SOURCES = test_sat_vapor_pres.F90 -test_sat_vapor_pres_r4_CPPFLAGS=-DTEST_SVP_KIND_=4 -I$(MODDIR) -test_sat_vapor_pres_r8_CPPFLAGS=-DTEST_SVP_KIND_=8 -I$(MODDIR) +test_sat_vapor_pres_r4_CPPFLAGS=-DTEST_FMS_KIND_=4 -I$(MODDIR) +test_sat_vapor_pres_r8_CPPFLAGS=-DTEST_FMS_KIND_=8 -I$(MODDIR) TEST_EXTENSIONS = .sh SH_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(abs_top_srcdir)/test_fms/tap-driver.sh diff --git a/test_fms/sat_vapor_pres/test_sat_vapor_pres.F90 b/test_fms/sat_vapor_pres/test_sat_vapor_pres.F90 index 853de63d9d..5779d77ce7 100644 --- a/test_fms/sat_vapor_pres/test_sat_vapor_pres.F90 +++ b/test_fms/sat_vapor_pres/test_sat_vapor_pres.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !! @brief unit test for the mpp_root_pe() function @@ -102,14 +101,14 @@ subroutine test_compute_qs() implicit none - real(kind=TEST_SVP_KIND_) :: temp, press, answer, qsat - real(kind=TEST_SVP_KIND_), dimension(1) :: temp_1d, press_1d, answer_1d, qsat_1d - real(kind=TEST_SVP_KIND_), dimension(1,1) :: temp_2d, press_2d, answer_2d, qsat_2d - real(kind=TEST_SVP_KIND_), dimension(1,1,1) :: temp_3d, press_3d, answer_3d, qsat_3d + real(kind=TEST_FMS_KIND_) :: temp, press, answer, qsat + real(kind=TEST_FMS_KIND_), dimension(1) :: temp_1d, press_1d, answer_1d, qsat_1d + real(kind=TEST_FMS_KIND_), dimension(1,1) :: temp_2d, press_2d, answer_2d, qsat_2d + real(kind=TEST_FMS_KIND_), dimension(1,1,1) :: temp_3d, press_3d, answer_3d, qsat_3d real(kind=r8_kind), parameter :: EPSILO=real(RDGAS,r8_kind)/real(RVGAS, r8_kind) - integer, parameter :: lkind=TEST_SVP_KIND_ !< local kind value; using TEST_SVP_KIND_ in cases - !! such as 1.0_TEST_SVP_KIND_ cannot be compiled with + integer, parameter :: lkind=TEST_FMS_KIND_ !< local kind value; using TEST_FMS_KIND_ in cases + !! such as 1.0_TEST_FMS_KIND_ cannot be compiled with !! with gcc compilers. !---- 0d ----! @@ -144,39 +143,39 @@ subroutine test_compute_mrs() !! The tests for this section is not comprehensive and more tests should be added. implicit none - real(kind=TEST_SVP_KIND_) :: temp, press, answer, mrsat - real(kind=TEST_SVP_KIND_), dimension(1) :: temp_1d, press_1d, answer_1d, mrsat_1d - real(kind=TEST_SVP_KIND_), dimension(1,1) :: temp_2d, press_2d, answer_2d, mrsat_2d - real(kind=TEST_SVP_KIND_), dimension(1,1,1) :: temp_3d, press_3d, answer_3d, mrsat_3d + real(kind=TEST_FMS_KIND_) :: temp, press, answer, mrsat + real(kind=TEST_FMS_KIND_), dimension(1) :: temp_1d, press_1d, answer_1d, mrsat_1d + real(kind=TEST_FMS_KIND_), dimension(1,1) :: temp_2d, press_2d, answer_2d, mrsat_2d + real(kind=TEST_FMS_KIND_), dimension(1,1,1) :: temp_3d, press_3d, answer_3d, mrsat_3d real(kind=r8_kind), parameter :: EPSILO=real(RDGAS,r8_kind)/real(RVGAS, r8_kind) - integer, parameter :: lkind=TEST_SVP_KIND_ !< local kind value; using TEST_SVP_KIND_ in cases - !! such as 1.0_TEST_SVP_KIND_ cannot be compiled with + integer, parameter :: lkind=TEST_FMS_KIND_ !< local kind value; using TEST_FMS_KIND_ in cases + !! such as 1.0_TEST_FMS_KIND_ cannot be compiled with !! with gcc compilers. !--------0d--------! !> press is 0. Therefore the answer should be eps=EPSILO=RDGAS/RVGAS temp= 270.0_lkind ; press= 0.0_lkind ; answer=real(EPSILO,lkind) call compute_mrs(temp, press, mrsat) - call check_answer_0d(answer,mrsat,'test_compute_mrs_0d precision=TEST_SVP_KIND_') + call check_answer_0d(answer,mrsat,'test_compute_mrs_0d precision=TEST_FMS_KIND_') !--------1d--------! !> press is 0. Therefore the answer should be eps=EPSILO=RDGAS/RVGAS temp_1d = 270.0_lkind ; press_1d = 0.0_lkind ; answer_1d=real(EPSILO,lkind) call compute_mrs(temp_1d, press_1d, mrsat_1d) - call check_answer_1d(answer_1d,mrsat_1d,'test_compute_mrs_1d precision=TEST_SVP_KIND_') + call check_answer_1d(answer_1d,mrsat_1d,'test_compute_mrs_1d precision=TEST_FMS_KIND_') !--------2d--------! !> press is 0. Therefore the answer should be eps=EPSILO=RDGAS/RVGAS temp_2d = 270.0_lkind ; press_2d = 0.0_lkind ; answer_2d=real(EPSILO,lkind) call compute_mrs(temp_2d, press_2d, mrsat_2d) - call check_answer_2d(answer_2d,mrsat_2d,'test_compute_mrs_2d precision=TEST_SVP_KIND_') + call check_answer_2d(answer_2d,mrsat_2d,'test_compute_mrs_2d precision=TEST_FMS_KIND_') !--------3d--------! !> press is 0. Therefore the answer should be eps=EPSILO=RDGAS/RVGAS temp_3d = 270.0_lkind ; press_3d = 0.0_lkind ; answer_3d=real(EPSILO,lkind) call compute_mrs(temp_3d, press_3d, mrsat_3d) - call check_answer_3d(answer_3d,mrsat_3d,'test_compute_mrs_3d precision=TEST_SVP_KIND_') + call check_answer_3d(answer_3d,mrsat_3d,'test_compute_mrs_3d precision=TEST_FMS_KIND_') end subroutine test_compute_mrs !----------------------------------------------------------------------- @@ -186,13 +185,13 @@ subroutine test_lookup_es_des !! TEST: at the maximum temperature (TCMAX), the pressures should correspond to the last element in the (D)TABLE implicit none - real(kind=TEST_SVP_KIND_) :: temp, esat, desat, esat_answer, desat_answer - real(kind=TEST_SVP_KIND_), dimension(1) :: temp_1d, esat_1d, desat_1d, esat_answer_1d, desat_answer_1d - real(kind=TEST_SVP_KIND_), dimension(1,1) :: temp_2d, esat_2d, desat_2d, esat_answer_2d, desat_answer_2d - real(kind=TEST_SVP_KIND_), dimension(1,1,1) :: temp_3d, esat_3d, desat_3d, esat_answer_3d, desat_answer_3d + real(kind=TEST_FMS_KIND_) :: temp, esat, desat, esat_answer, desat_answer + real(kind=TEST_FMS_KIND_), dimension(1) :: temp_1d, esat_1d, desat_1d, esat_answer_1d, desat_answer_1d + real(kind=TEST_FMS_KIND_), dimension(1,1) :: temp_2d, esat_2d, desat_2d, esat_answer_2d, desat_answer_2d + real(kind=TEST_FMS_KIND_), dimension(1,1,1) :: temp_3d, esat_3d, desat_3d, esat_answer_3d, desat_answer_3d - integer, parameter :: lkind=TEST_SVP_KIND_ !< local kind value; using TEST_SVP_KIND_ in cases - !! such as 1.0_TEST_SVP_KIND_ cannot be compiled with + integer, parameter :: lkind=TEST_FMS_KIND_ !< local kind value; using TEST_FMS_KIND_ in cases + !! such as 1.0_TEST_FMS_KIND_ cannot be compiled with !! with gcc compilers !-----0d test-------! @@ -386,13 +385,13 @@ subroutine test_lookup_es2_des2 !! TEST: at the maximum temperature (TCMAX), the pressures should correspond to the last element in the (D)TABLE2 implicit none - real(kind=TEST_SVP_KIND_) :: temp, esat, desat, esat_answer, desat_answer - real(kind=TEST_SVP_KIND_), dimension(1) :: temp_1d, esat_1d, desat_1d, esat_answer_1d, desat_answer_1d - real(kind=TEST_SVP_KIND_), dimension(1,1) :: temp_2d, esat_2d, desat_2d, esat_answer_2d, desat_answer_2d - real(kind=TEST_SVP_KIND_), dimension(1,1,1) :: temp_3d, esat_3d, desat_3d, esat_answer_3d, desat_answer_3d + real(kind=TEST_FMS_KIND_) :: temp, esat, desat, esat_answer, desat_answer + real(kind=TEST_FMS_KIND_), dimension(1) :: temp_1d, esat_1d, desat_1d, esat_answer_1d, desat_answer_1d + real(kind=TEST_FMS_KIND_), dimension(1,1) :: temp_2d, esat_2d, desat_2d, esat_answer_2d, desat_answer_2d + real(kind=TEST_FMS_KIND_), dimension(1,1,1) :: temp_3d, esat_3d, desat_3d, esat_answer_3d, desat_answer_3d - integer, parameter :: lkind=TEST_SVP_KIND_ !< local kind value; using TEST_SVP_KIND_ in cases - !! such as 1.0_TEST_SVP_KIND_ cannot be compiled with + integer, parameter :: lkind=TEST_FMS_KIND_ !< local kind value; using TEST_FMS_KIND_ in cases + !! such as 1.0_TEST_FMS_KIND_ cannot be compiled with !! with gcc compilers. !-----0d test-------! @@ -578,13 +577,13 @@ subroutine test_lookup_es3_des3 !! TEST: at the maximum temperature (TCMAX), the pressures should correspond to the last element in the (D)TABLE3 implicit none - real(kind=TEST_SVP_KIND_) :: temp, esat, desat, esat_answer, desat_answer - real(kind=TEST_SVP_KIND_), dimension(1) :: temp_1d, esat_1d, desat_1d, esat_answer_1d, desat_answer_1d - real(kind=TEST_SVP_KIND_), dimension(1,1) :: temp_2d, esat_2d, desat_2d, esat_answer_2d, desat_answer_2d - real(kind=TEST_SVP_KIND_), dimension(1,1,1) :: temp_3d, esat_3d, desat_3d, esat_answer_3d, desat_answer_3d + real(kind=TEST_FMS_KIND_) :: temp, esat, desat, esat_answer, desat_answer + real(kind=TEST_FMS_KIND_), dimension(1) :: temp_1d, esat_1d, desat_1d, esat_answer_1d, desat_answer_1d + real(kind=TEST_FMS_KIND_), dimension(1,1) :: temp_2d, esat_2d, desat_2d, esat_answer_2d, desat_answer_2d + real(kind=TEST_FMS_KIND_), dimension(1,1,1) :: temp_3d, esat_3d, desat_3d, esat_answer_3d, desat_answer_3d - integer, parameter :: lkind=TEST_SVP_KIND_ !< local kind value; using TEST_SVP_KIND_ in cases - !! such as 1.0_TEST_SVP_KIND_ cannot be compiled with + integer, parameter :: lkind=TEST_FMS_KIND_ !< local kind value; using TEST_FMS_KIND_ in cases + !! such as 1.0_TEST_FMS_KIND_ cannot be compiled with !! with gcc compilers. !-----0d test-------! @@ -764,10 +763,11 @@ end subroutine test_lookup_es3_des3 subroutine check_answer_0d(answer,fms_result,whoami) implicit none - real(TEST_SVP_KIND_), intent(in) :: answer, fms_result + real(TEST_FMS_KIND_), intent(in) :: answer, fms_result character(len=*), intent(in) :: whoami + real(TEST_FMS_KIND_), parameter :: tol = 1.0e-6 - if(answer .ne. fms_result) then + if(abs(answer - fms_result) .gt. tol) then write(*,*) 'Expected ', answer, ' but got ', fms_result call mpp_error(FATAL,'ERROR:'//trim(whoami) ) end if @@ -777,7 +777,7 @@ end subroutine check_answer_0d subroutine check_answer_1d(answer,fms_result,whoami) implicit none - real(TEST_SVP_KIND_), dimension(:), intent(in) :: answer, fms_result + real(TEST_FMS_KIND_), dimension(:), intent(in) :: answer, fms_result character(len=*), intent(in) :: whoami if(answer(1) .ne. fms_result(1)) then @@ -790,7 +790,7 @@ end subroutine check_answer_1d subroutine check_answer_2d(answer,fms_result,whoami) implicit none - real(TEST_SVP_KIND_), dimension(:,:), intent(in) :: answer, fms_result + real(TEST_FMS_KIND_), dimension(:,:), intent(in) :: answer, fms_result character(len=*), intent(in) :: whoami if(answer(1,1) .ne. fms_result(1,1)) then @@ -803,7 +803,7 @@ end subroutine check_answer_2d subroutine check_answer_3d(answer,fms_result,whoami) implicit none - real(TEST_SVP_KIND_), dimension(:,:,:), intent(in) :: answer, fms_result + real(TEST_FMS_KIND_), dimension(:,:,:), intent(in) :: answer, fms_result character(len=*), intent(in) :: whoami if(answer(1,1,1) .ne. fms_result(1,1,1)) then @@ -958,8 +958,8 @@ function compute_es_liq_k(tem, TFREEZE) result (es) !! see smithsonian meteorological tables page 350. x = -7.90298_r8_kind*(TBASW/tem(i)-one) & +5.02808_r8_kind*log10(TBASW/tem(i)) & - -1.3816e-07_r8_kind*(ten**((one-tem(i)/TBASW)*11.344_r8_kind)-one) & - +8.1328e-03_r8_kind*(ten**((TBASW/tem(i)-one)*-3.49149_r8_kind)-one)& + -1.3816e-07_r8_kind*(ten**(11.344_r8_kind *(one-tem(i)/TBASW))-one) & + +8.1328e-03_r8_kind*(ten**(-3.49149_r8_kind*(TBASW/tem(i)-one))-one) & +log10(ESBASW) esh2o = ten**(x) es(i) = esh2o diff --git a/test_fms/sat_vapor_pres/test_sat_vapor_pres.sh b/test_fms/sat_vapor_pres/test_sat_vapor_pres.sh index 7a6c2baca0..4f30c726c8 100755 --- a/test_fms/sat_vapor_pres/test_sat_vapor_pres.sh +++ b/test_fms/sat_vapor_pres/test_sat_vapor_pres.sh @@ -1,13 +1,19 @@ -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#*********************************************************************** +#* Apache License 2.0 #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/string_utils/Makefile.am b/test_fms/string_utils/Makefile.am index 425b83fd3c..959e0d07bb 100644 --- a/test_fms/string_utils/Makefile.am +++ b/test_fms/string_utils/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the test_fms/data_override directory of the FMS diff --git a/test_fms/string_utils/test_string_utils.F90 b/test_fms/string_utils/test_string_utils.F90 index 41d4923c71..a19e5fd516 100644 --- a/test_fms/string_utils/test_string_utils.F90 +++ b/test_fms/string_utils/test_string_utils.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @brief This programs tests the public subroutines in test_fms_string_utils: diff --git a/test_fms/string_utils/test_string_utils.sh b/test_fms/string_utils/test_string_utils.sh index 631a932a9f..8c039d6608 100755 --- a/test_fms/string_utils/test_string_utils.sh +++ b/test_fms/string_utils/test_string_utils.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/tap-driver.sh b/test_fms/tap-driver.sh index 7b76565002..5fc8b58317 100755 --- a/test_fms/tap-driver.sh +++ b/test_fms/tap-driver.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL Flexible Modeling System (FMS). -# -# FMS is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FMS is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # Ryan Mulhall 2/2021 diff --git a/test_fms/test-lib.sh.in b/test_fms/test-lib.sh.in index 93ba65d08e..5f92ad7639 100644 --- a/test_fms/test-lib.sh.in +++ b/test_fms/test-lib.sh.in @@ -1,22 +1,21 @@ # Test framework for FMS. # #*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL Flexible Modeling System (FMS). -# -# FMS is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FMS is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . +#* Apache License 2.0 +#* +#* This file is part of the GFDL Flexible Modeling System (FMS). +#* +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # # Copyright (c) 2005 Junio C Hamano @@ -26,8 +25,8 @@ # Thank you Junio. # Useful locations -top_srcdir='@abs_top_srcdir@' -top_buildir='@abs_top_builddir@' +top_srcdir='@abs_top_srcdir@@CMAKE_CURRENT_SOURCE_DIR@' +top_buildir='@abs_top_builddir@@CMAKE_CURRENT_SOURCE_DIR@' TEST_NAME="$(basename "$0" .sh)" TEST_NUMBER="${TEST_NAME%%-*}" @@ -146,6 +145,7 @@ test_failure_ () { test_known_broken_ok_ () { test_fixed=$(($test_fixed+1)) + test_failure=$(($test_failure + 1)) say_color error "ok $test_count - $@ # TODO known breakage vanished" } @@ -319,6 +319,15 @@ test_expect_success () { test_done () { EXIT_OK=t + cmake="@USING_CMAKE@" + if test $cmake + then + if test $test_failure != 0 + then + echo "$test_failure tests failed in $TEST_NAME. Exiting.." + exit 1 + fi + fi say "1..$test_count" } # creates and enters output dir and deletes previous if present diff --git a/test_fms/time_interp/Makefile.am b/test_fms/time_interp/Makefile.am index 92156b6841..19ed56c78c 100644 --- a/test_fms/time_interp/Makefile.am +++ b/test_fms/time_interp/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the test_fms/time_interp directory of the FMS @@ -29,20 +28,26 @@ AM_CPPFLAGS = -I$(MODDIR) LDADD = $(top_builddir)/libFMS/libFMS.la # Build these test programs. -check_PROGRAMS = test_time_interp_r4 test_time_interp_r8 test_time_interp_external_r4 test_time_interp_external_r8 +check_PROGRAMS = test_time_interp_r4 test_time_interp_r8 \ + test_time_interp_external_r4 test_time_interp_external_r8 \ + test_time_interp_conservative_hi_r4 test_time_interp_conservative_hi_r8 # These are the sources for the tests. test_time_interp_r4_SOURCES = test_time_interp.F90 test_time_interp_r8_SOURCES = test_time_interp.F90 test_time_interp_external_r4_SOURCES = test_time_interp_external.F90 test_time_interp_external_r8_SOURCES = test_time_interp_external.F90 +test_time_interp_conservative_hi_r4_SOURCES = test_time_interp_conservative_hi.F90 +test_time_interp_conservative_hi_r8_SOURCES = test_time_interp_conservative_hi.F90 # filter out any added precision flags # adds r8 flag, otherwise no-flag default is 4 -test_time_interp_r4_CPPFLAGS=-DTI_TEST_KIND_=4 -I$(MODDIR) -test_time_interp_r8_CPPFLAGS=-DTI_TEST_KIND_=8 -I$(MODDIR) -test_time_interp_external_r4_CPPFLAGS=-DTI_TEST_KIND_=4 -I$(MODDIR) -test_time_interp_external_r8_CPPFLAGS=-DTI_TEST_KIND_=8 -I$(MODDIR) +test_time_interp_r4_CPPFLAGS=-DTEST_FMS_KIND_=4 -I$(MODDIR) +test_time_interp_r8_CPPFLAGS=-DTEST_FMS_KIND_=8 -I$(MODDIR) +test_time_interp_external_r4_CPPFLAGS=-DTEST_FMS_KIND_=4 -I$(MODDIR) +test_time_interp_external_r8_CPPFLAGS=-DTEST_FMS_KIND_=8 -I$(MODDIR) +test_time_interp_conservative_hi_r4_CPPFLAGS=-DTEST_FMS_KIND_=4 -I$(MODDIR) +test_time_interp_conservative_hi_r8_CPPFLAGS=-DTEST_FMS_KIND_=8 -I$(MODDIR) # Run the test programs. TESTS = test_time_interp2.sh diff --git a/test_fms/time_interp/test_time_interp.F90 b/test_fms/time_interp/test_time_interp.F90 index 387d0e1807..8fe503b434 100644 --- a/test_fms/time_interp/test_time_interp.F90 +++ b/test_fms/time_interp/test_time_interp.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** program test_time_interp @@ -28,16 +27,16 @@ program test_time_interp implicit none - integer, parameter :: num_Time=6, kindl = TI_TEST_KIND_ + integer, parameter :: num_Time=6, kindl = TEST_FMS_KIND_ type(time_type) :: Time_beg, Time_end, Time(num_Time) type(time_type), allocatable, dimension(:) :: Timelist integer :: index1, index2, mo, yr, outunit, ntest, nline - real(TI_TEST_KIND_) :: weight - real(TI_TEST_KIND_) :: ref_weights(num_Time), ref_weights_leap(num_Time) - real(TI_TEST_KIND_), parameter :: SMALL = 1.0e-7_kindl ! r4 will fail with 8 - real(TI_TEST_KIND_), parameter :: midpoint = 0.483870967741935_kindl - real(TI_TEST_KIND_), parameter :: day_before_leap_day = 0.964285714285714_kindl - real(TI_TEST_KIND_), parameter :: day_before_leap_day_with_ly = 0.931034482758621_kindl + real(TEST_FMS_KIND_) :: weight + real(TEST_FMS_KIND_) :: ref_weights(num_Time), ref_weights_leap(num_Time) + real(TEST_FMS_KIND_), parameter :: SMALL = 1.0e-7_kindl ! r4 will fail with 8 + real(TEST_FMS_KIND_), parameter :: midpoint = 0.483870967741935_kindl + real(TEST_FMS_KIND_), parameter :: day_before_leap_day = 0.964285714285714_kindl + real(TEST_FMS_KIND_), parameter :: day_before_leap_day_with_ly = 0.931034482758621_kindl integer :: nmin, nmax @@ -357,7 +356,7 @@ end subroutine diagram logical function is_valid_indices(ind1, ind2, tList, tintv, res_weight, mtime) integer, intent(in) :: ind1, ind2 type(time_type), intent(in) :: tList(:), tintv - real(TI_TEST_KIND_), intent(in) :: res_weight + real(TEST_FMS_KIND_), intent(in) :: res_weight integer, intent(in) :: mtime integer :: i diff --git a/test_fms/time_interp/test_time_interp2.sh b/test_fms/time_interp/test_time_interp2.sh index 0f30909e7e..d7c36c9de2 100755 --- a/test_fms/time_interp/test_time_interp2.sh +++ b/test_fms/time_interp/test_time_interp2.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to @@ -65,4 +64,11 @@ test_expect_success "test time interpolation external with r4_kind (no_leap)" ' mpirun -n 4 ./test_time_interp_external_r4 ' +test_expect_success "test time interpolation external with conservative horizontal interp r8_kind" ' + mpirun -n 4 ./test_time_interp_conservative_hi_r8 +' +test_expect_success "test time interpolation external with conservative horizontal interp r4_kind" ' + mpirun -n 4 ./test_time_interp_conservative_hi_r4 +' + test_done diff --git a/test_fms/time_interp/test_time_interp_conservative_hi.F90 b/test_fms/time_interp/test_time_interp_conservative_hi.F90 new file mode 100644 index 0000000000..7e86bda196 --- /dev/null +++ b/test_fms/time_interp/test_time_interp_conservative_hi.F90 @@ -0,0 +1,213 @@ +!*********************************************************************** +!* Apache License 2.0 +!* +!* This file is part of the GFDL Flexible Modeling System (FMS). +!* +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at +!* +!* http://www.apache.org/licenses/LICENSE-2.0 +!* +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. +!*********************************************************************** + +program test_time_interp_with_interp + + use constants_mod, only: DEG_TO_RAD + + use fms_mod, only: fms_init, fms_end + + use fms2_io_mod, only: FmsNetcdfFile_t, fms2_io_init, open_file, close_file, register_axis, write_data + use fms2_io_mod, only: register_field, unlimited, register_variable_attribute + + use horiz_interp_mod, only: horiz_interp_type, horiz_interp_new, horiz_interp_init + + use mpp_mod, only: input_nml_file, mpp_pe, mpp_root_pe, mpp_npes, mpp_error, FATAL + use mpp_domains_mod, only: mpp_define_layout, mpp_define_domains, domain2d, mpp_get_compute_domain + + use time_interp_external2_mod, only: init_external_field, time_interp_external_init, time_interp_external + + use time_manager_mod, only: JULIAN, time_type, set_date, set_calendar_type, time_manager_init + + implicit none + + integer, parameter :: rkind = TEST_FMS_KIND_ + + integer, parameter :: ntime = 3 + integer, parameter :: nlon_model = 90 + integer, parameter :: nlat_model = 46 + integer, parameter :: nlon_file = nlon_model / 2 + integer, parameter :: nlat_file = nlat_model / 2 + + !time_interp data file + character(len=128) :: filename='INPUT/aerosol2.climatology.nc' + character(len=128) :: fieldname='so4_anthro' + + !grid + real(TEST_FMS_KIND_), allocatable :: lon_model(:,:), lat_model(:,:) + real(TEST_FMS_KIND_), allocatable :: lon_file(:,:), lat_file(:,:) + + !horiz_interp + type(horiz_interp_type) :: interp + + !domain + integer :: isc, iec, jsc, jec + type(domain2d) :: domain_model + integer :: layout(2), global_indices(4) + + !time + type(time_type) :: time + integer :: times(ntime) = (/0,2,4/) + integer :: test_times(ntime-1) = (/1,3/) + + !time_interp_external + integer :: field_id + real(TEST_FMS_KIND_), allocatable :: data_out(:,:) + real(TEST_FMS_KIND_), allocatable :: data_file(:,:) + real(TEST_FMS_KIND_), allocatable :: answers(:,:) + + !counter + integer :: i, j, ii, jj + + !initialize fms + call fms_init() + call time_interp_external_init() + call time_manager_init() + call horiz_interp_init() + + !set up domain_model + global_indices = (/1, nlon_model, 1, nlat_model/) + call mpp_define_layout(global_indices, mpp_npes(), layout) + call mpp_define_domains(global_indices, layout, domain_model) + call mpp_get_compute_domain(domain_model, isc, iec, jsc, jec) + + !allocate arrays + allocate(lon_model(isc:iec+1, jsc:jec+1), lat_model(isc:iec+1, jsc:jec+1)) + allocate(lon_file(nlon_file+1, nlat_file+1), lat_file(nlon_file+1, nlat_file+1)) + allocate(data_out(isc:iec, jsc:jec)) + allocate(data_file(nlon_file, nlat_file)) + allocate(answers(isc:iec, jsc:jec)) + + !set model coordintes + do j=jsc, jec+1 + do i=isc, iec+1 + lon_model(i,j) = real(i-1, rkind) * DEG_TO_RAD + lat_model(i,j) = real(j-1, rkind) * DEG_TO_RAD + end do + end do + + !set file coordinates + do j=1, nlat_file+1 + do i=1, nlon_file+1 + lon_file(i,j) = real(2*(i-1), rkind) + lat_file(i,j) = real(2*(j-1), rkind) + end do + end do + + data_out = 0.0_rkind + + !set file data + do j=1, nlat_file + do i=1, nlon_file + data_file(i,j) = real(i*nlon_file + j, rkind) + end do + end do + + !answers + do j=jsc, jec + jj = (j+1)/2 + do i=isc, iec + ii = (i+1)/2 + answers(i,j) = data_file(ii,jj) + end do + end do + + !generate_file + call generate_file(filename, lon_file, lat_file, times, fieldname, data_file) + lon_file = lon_file * DEG_TO_RAD + lat_file = lat_file * DEG_TO_RAD + + !set time + call set_calendar_type(JULIAN) + + !get interp + call horiz_interp_new(interp, lon_file, lat_file, lon_model, lat_model, & + interp_method="conservative", is_latlon_in=.false., is_latlon_out=.false.) + + !initialize field + field_id = init_external_field(filename, fieldname, domain=domain_model, override=.true.) + + do i=1, ntime-1 + time = set_date(1800, 1, test_times(i), 0, 0, 0) + !time interpolate + call time_interp_external(field_id, time, data_out, horz_interp=interp) + ! check answers + if(.not.all(i*1000 + answers == data_out)) then + call mpp_error(FATAL, "time_interp error with conservative horizontal interpolation") + end if + end do + + deallocate(lon_model) + deallocate(lon_file) + deallocate(data_out) + deallocate(data_file) + deallocate(answers) + + call fms_end() + +contains + + subroutine generate_file(filename, lon, lat, times, fieldname, data) + + character(len=*), intent(in) :: filename + real(TEST_FMS_KIND_), intent(in) :: lon(:,:), lat(:,:) + integer, intent(in) :: times(:) + character(len=*), intent(in) :: fieldname + real(TEST_FMS_KIND_), intent(inout) :: data(:,:) + + type(FmsNetcdfFile_t) :: fileobj !< fileobj + integer :: nlon, nlat, i, j + + nlon = size(data, 1) + nlat = size(data, 2) + + !< Create a file to test with: + if (mpp_pe() .eq. mpp_root_pe()) then + if (open_file(fileobj, filename, "overwrite")) then + call register_axis(fileobj, "lon", nlon) + call register_axis(fileobj, "lat", nlat) + call register_axis(fileobj, "time", unlimited) + + call register_field(fileobj, "lon", "double", dimensions=(/"lon"/)) + call register_field(fileobj, "lat", "double", dimensions=(/"lat"/)) + call register_field(fileobj, "time", "double", dimensions=(/"time"/)) + + call register_field(fileobj, fieldname, "double", dimensions=(/"lon ", "lat ", "time"/)) + + call register_variable_attribute(fileobj, "lon", "cartesian_axis", "X", str_len=1) + call register_variable_attribute(fileobj, "lat", "cartesian_axis", "Y", str_len=1) + + call register_variable_attribute(fileobj, "time", "cartesian_axis", "T", str_len=1) + call register_variable_attribute(fileobj, "time", "units", "days since 1800-01-01 00:00:00",str_len=30) + call register_variable_attribute(fileobj, "time", "calendar", "julian", str_len=6) + + !center points + call write_data(fileobj, "lat", lat(1,1:nlat)) + call write_data(fileobj, "lon", lon(1:nlon,1)) + call write_data(fileobj, "time", times) + + do i=0, size(times) - 1 + call write_data(fileobj, fieldname, (i+1)*1000 + data, unlim_dim_level=i+1) + enddo + call close_file(fileobj) + endif + end if + + end subroutine generate_file + +end program test_time_interp_with_interp diff --git a/test_fms/time_interp/test_time_interp_external.F90 b/test_fms/time_interp/test_time_interp_external.F90 index c933dbddca..6df2537371 100644 --- a/test_fms/time_interp/test_time_interp_external.F90 +++ b/test_fms/time_interp/test_time_interp_external.F90 @@ -1,21 +1,20 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** program test_time_interp_external @@ -38,6 +37,7 @@ program test_time_interp_external use axis_utils2_mod, only : axis_edges use fms2_io_mod, only : FmsNetcdfFile_t, fms2_io_init, open_file, close_file, write_data, register_axis use fms2_io_mod, only : register_field, unlimited, register_variable_attribute +use platform_mod implicit none @@ -45,27 +45,31 @@ program test_time_interp_external integer :: i !< Index for loops integer :: ierr !< io return status character(len=128) :: filename='INPUT/aerosol.climatology.nc' +character(len=128) :: filename_1d='INPUT/solar_constant.nc' character(len=128) :: fieldname='so4_anthro' +character(len=128) :: fieldname_1d_band='ssi_band' +character(len=128) :: fieldname_1d_band2='ssi_band2' type(time_type) :: time !< "model" time -integer, parameter :: kindl = TI_TEST_KIND_ -real(TI_TEST_KIND_) :: data_d_0d = 1.0_kindl !< interpolated data in compute domain -real(TI_TEST_KIND_) :: data_g_0d = 1.0_kindl !< interpolated global data +integer, parameter :: kindl = TEST_FMS_KIND_ +real(TEST_FMS_KIND_) :: data_d_0d = 1.0_kindl !< interpolated data in compute domain +real(TEST_FMS_KIND_) :: data_g_0d = 1.0_kindl !< interpolated global data type(domain2d) :: domain ! Writes netcdf input files with fields to interpolate + subroutine create_input_files_1d + !< Create a file to test with: + if (mpp_pe() .eq. mpp_root_pe()) then + if (open_file(fileobj, filename_1d, "overwrite")) then + call register_axis(fileobj, "lon", 179) + call register_axis(fileobj, "time", unlimited) + + call register_field(fileobj, "lon", "double", dimensions=(/"lon"/)) + call register_field(fileobj, "time", "double", dimensions=(/"time"/)) + + call register_field(fileobj, fieldname_1d_band, "double", dimensions=(/"lon ", "time"/)) + call register_field(fileobj, trim(fieldname_1d_band2), "double", dimensions=(/"lon ","time"/)) + + call register_variable_attribute(fileobj, "lon", "cartesian_axis", "X", str_len=1) + + call register_variable_attribute(fileobj, "time", "cartesian_axis", "T", str_len=1) + call register_variable_attribute(fileobj, "time", "units", "days since 1800-01-01 00:00:00",str_len=30) + call register_variable_attribute(fileobj, "time", "calendar", "julian", str_len=6) + + !call register_global_attribute(fileobj, "global_scalar", 1024.0_r8_kind) + + call write_data(fileobj, "lon", (/(-180.0_kindl+i*2.0_kindl,i=1,179)/)) + call write_data(fileobj, "time", (/(1+i*2, i=0,2)/)) + + allocate(data_in_1d(179)) + do i=0, 2 + data_in_1d = real((1+i*2), TEST_FMS_KIND_) + call write_data(fileobj, fieldname_1d_band, data_in_1d, unlim_dim_level=i+1) + data_in_1d = - data_in_1d + call write_data(fileobj, trim(fieldname_1d_band2), data_in_1d, unlim_dim_level=i+1) + enddo + call close_file(fileobj) + deallocate(data_in_1d) + endif + endif + !< Wait for the root pe to catch up + call mpp_sync() + end subroutine create_input_files_1d + subroutine time_interpolate_3d_data - real(TI_TEST_KIND_), allocatable :: data_d_3d(:,:,:) !< interpolated data in compute domain - real(TI_TEST_KIND_), allocatable :: data_g_3d(:,:,:) !< interpolated global data - real(TI_TEST_KIND_), allocatable :: lon_local_out(:,:) !< lat grid to interpolate to (compute) - real(TI_TEST_KIND_), allocatable :: lat_local_out(:,:) !< lon grid to interpolate to (compute) - real(TI_TEST_KIND_), allocatable :: lon_in(:) !< lat grid in file - real(TI_TEST_KIND_), allocatable :: lat_in(:) !< lat grid in file + real(TEST_FMS_KIND_), allocatable :: data_d_3d(:,:,:) !< interpolated data in compute domain + real(TEST_FMS_KIND_), allocatable :: data_g_3d(:,:,:) !< interpolated global data + real(TEST_FMS_KIND_), allocatable :: lon_local_out(:,:) !< lat grid to interpolate to (compute) + real(TEST_FMS_KIND_), allocatable :: lat_local_out(:,:) !< lon grid to interpolate to (compute) + real(TEST_FMS_KIND_), allocatable :: lon_in(:) !< lat grid in file + real(TEST_FMS_KIND_), allocatable :: lat_in(:) !< lat grid in file outunit = stdout() write(outunit,*) 'INTERPOLATING NON DECOMPOSED FIELDS' @@ -278,12 +326,12 @@ subroutine time_interpolate_3d_data end subroutine time_interpolate_3d_data subroutine time_interpolate_2d_data - real(TI_TEST_KIND_), allocatable :: data_d_2d(:,:) !< interpolated data in compute domain - real(TI_TEST_KIND_), allocatable :: data_g_2d(:,:) !< interpolated global data - real(TI_TEST_KIND_), allocatable :: lon_local_out(:,:) !< lat grid to interpolate to (compute) - real(TI_TEST_KIND_), allocatable :: lat_local_out(:,:) !< lon grid to interpolate to (compute) - real(TI_TEST_KIND_), allocatable :: lon_in(:) !< lat grid in file - real(TI_TEST_KIND_), allocatable :: lat_in(:) !< lat grid in file + real(TEST_FMS_KIND_), allocatable :: data_d_2d(:,:) !< interpolated data in compute domain + real(TEST_FMS_KIND_), allocatable :: data_g_2d(:,:) !< interpolated global data + real(TEST_FMS_KIND_), allocatable :: lon_local_out(:,:) !< lat grid to interpolate to (compute) + real(TEST_FMS_KIND_), allocatable :: lat_local_out(:,:) !< lon grid to interpolate to (compute) + real(TEST_FMS_KIND_), allocatable :: lon_in(:) !< lat grid in file + real(TEST_FMS_KIND_), allocatable :: lat_in(:) !< lat grid in file outunit = stdout() write(outunit,*) 'INTERPOLATING NON DECOMPOSED FIELDS' @@ -410,8 +458,84 @@ subroutine time_interpolate_2d_data deallocate(data_d_2d, data_g_2d, lon_local_out, lat_local_out, lon_in, lat_in) end subroutine time_interpolate_2d_data + subroutine time_interpolate_1d_data + real(TEST_FMS_KIND_), allocatable :: data_d_1d(:) !< interpolated data in compute domain + real(TEST_FMS_KIND_), allocatable :: data_g_1d(:) !< interpolated global data + real(TEST_FMS_KIND_), allocatable :: lon_local_out(:) !< lat grid to interpolate to (compute) + real(TEST_FMS_KIND_), allocatable :: lat_local_out(:) !< lon grid to interpolate to (compute) + real(TEST_FMS_KIND_), allocatable :: lon_in(:) !< lat grid in file + real(TEST_FMS_KIND_), allocatable :: lat_in(:) !< lat grid in file + + outunit = stdout() + write(outunit,*) 'INTERPOLATING NON DECOMPOSED FIELDS 1D' + write(outunit,*) '======================================' + !< Here every rank is on the same x/y grid + + id = init_external_field(filename_1d,fieldname_1d_band,verbose=.false.) + fld_size = get_external_field_size(id) + + ! check field size + write(*,*) 'FIELD SIZE', fld_size + + if(fld_size(1) /= 179) call mpp_error(FATAL, "incorrect X field size for time_interp_external_1d") + if(fld_size(2) /= 1) call mpp_error(FATAL, "incorrect Y field size for time_interp_external_1d") + if(fld_size(3) /= 1) call mpp_error(FATAL, "incorrect Z field size for time_interp_external_1d") + if(fld_size(4) /= 3) call mpp_error(FATAL, "incorrect T field size for time_interp_external_1d") + + allocate(data_g_1d(fld_size(1))) + data_g_1d = 0.0_kindl + + !< Corresponds to time=1 in the file, so no time_interpolation + time = set_date(1800,1,2,0,0,0) + call time_interp_external(id,time,data_g_1d,verbose=.true.) + !check answers + do i=1, fld_size(1) + if(data_g_1d(i) /= 1.0) call mpp_error(FATAL, "incorrect interpolation for t=1 in time_interp_external_1d") + end do + + !< Corresponds to time=2, so there will be time_interpolation between time=1 and + !time =3 in the file + time = set_date(1800,1,3,0,0,0) + call time_interp_external(id,time,data_g_1d,verbose=.true.) + !check answers + do i=1, fld_size(1) + if(data_g_1d(i) /= 2.0) call mpp_error(FATAL, "incorrect interpolation for t=3 in time_interp_external_1d") + end do + + !< Here every rank has its own section + + call mpp_define_layout((/1,fld_size(1),1,fld_size(2)/),mpp_npes(),layout) + call mpp_define_domains((/1,fld_size(1),1,fld_size(2)/),layout,domain) + call mpp_get_compute_domain(domain,isc,iec,jsc,jec) + call mpp_get_compute_domain(domain,isd,ied,jsd,jed) + + call mpp_domains_set_stack_size(fld_size(1)*fld_size(2)*min(fld_size(3),1)*2) + allocate(data_d_1d(isd:ied)) + data_d_1d = 0 + + id = init_external_field(filename_1d,fieldname_1d_band2,domain=domain, verbose=.false.) + + time = set_date(1800,1,2,0,0,0) + call time_interp_external(id,time,data_d_1d,verbose=.true.) + ! answer check + do i=isd, ied + if(data_d_1d(i) /= -1.0) call mpp_error(FATAL, "incorrect interpolation for t=1 in time_interp_external_1d") + end do + + !< Corresponds to time=2, so there will be time_interpolation between time=1 and + !time =3 in the file + time = set_date(1800,1,3,0,0,0) + call time_interp_external(id,time,data_d_1d,verbose=.true.) + ! answer check + do i=isd, ied + if(data_d_1d(i) /= -2.0) call mpp_error(FATAL, "incorrect interpolation for t=1 in time_interp_external_1d") + end do + + deallocate(data_d_1d, data_g_1d) + end subroutine time_interpolate_1d_data + subroutine time_interpolate_scalar_data - real(TI_TEST_KIND_) :: data_scalar !< scalar to interpolate + real(TEST_FMS_KIND_) :: data_scalar !< scalar to interpolate id = init_external_field(filename, fieldname,verbose=.false.) diff --git a/test_fms/time_manager/Makefile.am b/test_fms/time_manager/Makefile.am index b002c9064b..2836ec2bdd 100644 --- a/test_fms/time_manager/Makefile.am +++ b/test_fms/time_manager/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the test_fms/time_manager directory of the FMS diff --git a/test_fms/time_manager/test_time_manager.F90 b/test_fms/time_manager/test_time_manager.F90 index 1d98971595..9c765caf6a 100644 --- a/test_fms/time_manager/test_time_manager.F90 +++ b/test_fms/time_manager/test_time_manager.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** program test_time_manager @@ -49,20 +48,15 @@ program test_time_manager character(len=8) :: test_name character(len=256) :: out_msg - !: for testing set/get_date_gregorian - integer, parameter :: days_in_400_year_period = 146097 - integer, dimension(days_in_400_year_period) :: coded_date - integer, dimension(400,12,31) :: date_to_day - logical :: test1 =.true.,test2 =.true.,test3 =.true.,test4 =.true.,test5 =.true.,test6 =.true.,test7 =.true., & & test8 =.true. logical :: test9 =.true.,test10=.true.,test11=.true.,test12=.true.,test13=.true.,test14=.true.,test15=.true., & & test16=.true. - logical :: test17=.true.,test18=.true.,test19=.true.,test20=.true. + logical :: test17=.true.,test18=.true.,test19=.true. namelist / test_nml / test1 ,test2 ,test3 ,test4 ,test5 ,test6 ,test7 ,test8, & test9 ,test10,test11,test12,test13,test14,test15,test16, & - test17,test18,test19,test20 + test17,test18,test19 call fms_init call constants_init @@ -619,171 +613,6 @@ program test_time_manager write(outunit,'(a,i6)') ' ticks_per_second=',get_ticks_per_second() !============================================================================================== - ! Tests the new set/get_date_gregorian by comparing against the old set/get_date_gregorian - ! copied over to this test program - ! This test loops through every day up to year 3200 - - if(test20) then - write(outunit,'(/,a)') '################################# test20 #################################' - write(outunit,'(/,a)') ' =====================================================' - write(outunit,'(a)') ' Test get/set_date_gregorian with get/set_date_gregorian_old' - write(outunit,'(a,/)') ' =====================================================' - call set_calendar_type(GREGORIAN) - call get_coded_date( coded_date, date_to_day )!assign coded_date and date_to_day used by get/set_date_gregorian_old - - ! test the new Gregorian methods and compare with the old methods - do year=1, 3200 - leap = mod(year,4) == 0 - leap = leap .and. .not.mod(year,100) == 0 - leap = leap .or. mod(year,400) == 0 - do month=1,12 - days_this_month = days_per_month(month) - if(leap .and. month == 2) days_this_month = 29 - do dday=1,days_this_month - ! test new set_date_gregorian - Time = set_date(year, month, dday, 0, 0, 0) - Time0 = set_date_gregorian_old(year, month, dday, 0, 0, 0, 0, date_to_day) - if( .not. (Time==Time0) ) then - write(outunit,'("ERROR with year",i5,"mo",i5,"dday",i5)') year, month, dday - call mpp_error(FATAL, 'ERROR testing set_date_gregorian: Time!=Time0') - end if - ! test #1 get_date - call get_date(Time0, yr, mo, day, hr, min, sec) - call get_date_gregorian_old(Time0, coded_date, yr0, mo0, day0, hr0, min0, sec0, ticks0) - if( yr0.ne.yr .or. mo0.ne.mo .or. day0.ne.day ) then - write(outunit,"('expected year ',i5,'but got year ',i5)") yr0, yr - write(outunit,"('expected month',i5,'but got month',i5)") mo0, mo - write(outunit,"('expected day ',i5,'but got day ',i5)") day0, day - call mpp_error(FATAl,'Error testing get_date_gregorian 1') - end if - ! test #2 get_date - call get_date(Time, yr, mo, day, hr, min, sec) - call get_date_gregorian_old(Time, coded_date, yr0, mo0, day0, hr0, min0, sec0, ticks0) - if( yr0.ne.yr .or. mo0.ne.mo .or. day0.ne.day ) then - write(outunit,"('expected year ',i5,'but got year ',i5)") yr0, yr - write(outunit,"('expected month',i5,'but got month',i5)") mo0, mo - write(outunit,"('expected day ',i5,'but got day ',i5)") day0, day - call mpp_error(FATAl,'Error testing get_date_gregorian 2') - end if - ! test #3 get_date - call get_date(Time, yr, mo, day, hr, min, sec) - call get_date_gregorian_old(Time0, coded_date, yr0, mo0, day0, hr0, min0, sec0, ticks0) - if( yr0.ne.yr .or. mo0.ne.mo .or. day0.ne.day ) then - write(outunit,"('expected year ',i5,'but got year ',i5)") yr0, yr - write(outunit,"('expected month',i5,'but got month',i5)") mo0, mo - write(outunit,"('expected day ',i5,'but got day ',i5)") day0, day - call mpp_error(FATAl,'Error testing get_date_gregorian 3') - end if - ! test #4 get_date - call get_date(Time0, yr, mo, day, hr, min, sec) - call get_date_gregorian_old(Time, coded_date, yr0, mo0, day0, hr0, min0, sec0, ticks0) - if( yr0.ne.yr .or. mo0.ne.mo .or. day0.ne.day ) then - write(outunit,"('expected year ',i5,'but got year ',i5)") yr0, yr - write(outunit,"('expected month',i5,'but got month',i5)") mo0, mo - write(outunit,"('expected day ',i5,'but got day ',i5)") day0, day - call mpp_error(FATAl,'Error testing get_date_gregorian 4') - end if - enddo - enddo - enddo - write(outunit,'(a)') 'set_date_gregorian and get_date_gregorian tests successful' - endif - call fms_end -contains - - ! get_coded_date: copied from subroutine set_calendar_type in time_manager and slightly modified - ! to work in this test program. - subroutine get_coded_date(coded_date_old, date_to_day_old) - - implicit none - - integer, intent(out), dimension(146097) :: coded_date_old - integer, intent(out), dimension(400,12,31) :: date_to_day_old - - integer :: iday, days_this_month, year, month, day - logical :: leap - - iday = 0 - date_to_day = -1 ! invalid_date = -1 in time_manager - do year=1,400 - leap = mod(year,4) == 0 - leap = leap .and. .not.mod(year,100) == 0 - leap = leap .or. mod(year,400) == 0 - do month=1,12 - days_this_month = days_per_month(month) - if(leap .and. month ==2) days_this_month = 29 - do day=1,days_this_month - date_to_day_old(year,month,day) = iday - iday = iday+1 - coded_date_old(iday) = day + 32*(month + 16*year) - enddo ! do day - enddo ! do month - enddo ! do year - - end subroutine get_coded_date - - ! get_date_gregorian_old: original get_date_gregorian subroutine in time_manager that has been slightly - ! modified to work in this test program - subroutine get_date_gregorian_old(time, coded_date, year, month, day, hour, minute, second, tick) - - use time_manager_mod, only : set_time - - integer, parameter :: days_in_400_year_period = 146097 - - type(time_type), intent(in) :: time - integer, intent(in), dimension(days_in_400_year_period) :: coded_date - integer, intent(out) :: year, month, day, hour, minute, second - integer, intent(out) :: tick - - integer :: iday, isec, time_days, time_seconds, time_ticks - - ! set time_days=Time%days and time_seconds=Time%seconds, time_ticks=Time%ticks - call get_time(Time, seconds=time_seconds, days=time_days, ticks=time_ticks) - - iday = mod(time_days+1, days_in_400_year_period) - if(iday == 0) iday = days_in_400_year_period - - year = coded_date(iday)/512 - day = mod(coded_date(iday),32) - month = coded_date(iday)/32 - 16*year - - year = year + 400*(time_days/days_in_400_year_period) - - hour = time_seconds / 3600 - isec = time_seconds - 3600*hour - minute = isec / 60 - second = isec - 60*minute - tick = time_ticks - - end subroutine get_date_gregorian_old - - ! set_date_gregorian_old: original set_date_gregorian function in time_manager that has been slightly - ! modified to work in this test program - function set_date_gregorian_old(year, month, day, hour, minute, second, tick, date_to_day) - - use time_manager_mod, only: set_time - - type(time_type) :: set_date_gregorian_old - - integer, parameter :: days_in_400_year_period = 146097 - - integer, intent(in) :: year, month, day, hour, minute, second, tick - integer, intent(in), dimension(400,12,31) :: date_to_day - - integer :: yr1, day1, second1 - - second1 = second + 60*(minute + 60*hour) - - yr1 = mod(year,400) - if(yr1 == 0) yr1 = 400 - day1 = date_to_day(yr1,month,day) - - day1 = day1 + days_in_400_year_period*((year-1)/400) - - set_date_gregorian_old = set_time(seconds=second1, days=day1, ticks=tick) - - end function set_date_gregorian_old - end program test_time_manager diff --git a/test_fms/time_manager/test_time_manager2.sh b/test_fms/time_manager/test_time_manager2.sh index 432c80fcf3..a36f26b91f 100755 --- a/test_fms/time_manager/test_time_manager2.sh +++ b/test_fms/time_manager/test_time_manager2.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/topography/Makefile.am b/test_fms/topography/Makefile.am index 8f873da1a9..580bcda558 100644 --- a/test_fms/topography/Makefile.am +++ b/test_fms/topography/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the test_fms/topography directory of the @@ -38,8 +37,8 @@ test_topography_r4_SOURCES = test_topography.F90 test_topography_r8_SOURCES = test_topography.F90 # Set r4_kind and r8_kind -test_topography_r4_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_TOP_KIND_=r4_kind -test_topography_r8_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_TOP_KIND_=r8_kind +test_topography_r4_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_FMS_KIND_=r4_kind +test_topography_r8_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_FMS_KIND_=r8_kind # Run the test program. TESTS = test_topography.sh diff --git a/test_fms/topography/test_topography.F90 b/test_fms/topography/test_topography.F90 index a8f2b9b71c..29f9e5145b 100644 --- a/test_fms/topography/test_topography.F90 +++ b/test_fms/topography/test_topography.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !> @author Caitlyn McAllister @@ -47,15 +46,15 @@ program test_top type(FmsNetcdfFile_t) :: top_fileobj ! fileobj for fms2_io character(len=128) :: topog_file, water_file ! filenames needed for topography_mod - real(kind=TEST_TOP_KIND_) :: xdat(3), ydat(3), zdat(2,2) ! specifc data topog_mod looks for + real(kind=TEST_FMS_KIND_) :: xdat(3), ydat(3), zdat(2,2) ! specifc data topog_mod looks for integer :: ipts, jpts ! axis for files integer :: iptsp1, jptsp1 ! serves as a counter for data integer :: ipts_r, jpts_r ! sub axis - integer, parameter :: lkind = TEST_TOP_KIND_ ! kind parameter for mixed precision + integer, parameter :: lkind = TEST_FMS_KIND_ ! kind parameter for mixed precision - real(kind=TEST_TOP_KIND_), parameter :: deg2rad = real(pi, TEST_TOP_KIND_)/180.0_lkind - real(kind=TEST_TOP_KIND_), dimension(2,2) :: lon2d, lat2d ! in radians - real(kind=TEST_TOP_KIND_), dimension(2) :: lon1d, lat1d ! in radians + real(kind=TEST_FMS_KIND_), parameter :: deg2rad = real(pi, TEST_FMS_KIND_)/180.0_lkind + real(kind=TEST_FMS_KIND_), dimension(2,2) :: lon2d, lat2d ! in radians + real(kind=TEST_FMS_KIND_), dimension(2) :: lon1d, lat1d ! in radians call fms_init call topography_init @@ -103,8 +102,8 @@ program test_top call register_field(top_fileobj, "ydat", "double", dimensions=(/"j_ydat"/)) call register_field(top_fileobj, "zdat", "double", dimensions=(/"i_zdat", "j_zdat"/)) - call write_data(top_fileobj, "ipts", real(ipts, TEST_TOP_KIND_)) - call write_data(top_fileobj, "jpts", real(jpts, TEST_TOP_KIND_)) + call write_data(top_fileobj, "ipts", real(ipts, TEST_FMS_KIND_)) + call write_data(top_fileobj, "jpts", real(jpts, TEST_FMS_KIND_)) call write_data(top_fileobj, "xdat", xdat) call write_data(top_fileobj, "ydat", ydat) call write_data(top_fileobj, "zdat", zdat) @@ -131,8 +130,8 @@ program test_top call register_field(top_fileobj, "ydat", "double", dimensions=(/"j_ydat"/)) call register_field(top_fileobj, "zdat", "double", dimensions=(/"i_zdat", "j_zdat"/)) - call write_data(top_fileobj, "ipts", real(ipts, TEST_TOP_KIND_)) - call write_data(top_fileobj, "jpts", real(jpts, TEST_TOP_KIND_)) + call write_data(top_fileobj, "ipts", real(ipts, TEST_FMS_KIND_)) + call write_data(top_fileobj, "jpts", real(jpts, TEST_FMS_KIND_)) call write_data(top_fileobj, "xdat", xdat) call write_data(top_fileobj, "ydat", ydat) call write_data(top_fileobj, "zdat", zdat) @@ -158,10 +157,10 @@ subroutine test_topog_mean(lat2d, lon2d, lat1d, lon1d) !! tested with. In this case, the sizes of both zmean2d and zmean1d are both the !! same size but have to be these specific dimensions per the topography_mod code implicit none - real(kind=TEST_TOP_KIND_), dimension(2,2), intent(in) :: lat2d, lon2d - real(kind=TEST_TOP_KIND_), dimension(2), intent(in) :: lat1d, lon1d - real(kind=TEST_TOP_KIND_), dimension(size(lon2d,1)-1,size(lat2d,2)-1) :: zmean2d - real(kind=TEST_TOP_KIND_), dimension(size(lon1d)-1,size(lat1d)-1) :: zmean1d + real(kind=TEST_FMS_KIND_), dimension(2,2), intent(in) :: lat2d, lon2d + real(kind=TEST_FMS_KIND_), dimension(2), intent(in) :: lat1d, lon1d + real(kind=TEST_FMS_KIND_), dimension(size(lon2d,1)-1,size(lat2d,2)-1) :: zmean2d + real(kind=TEST_FMS_KIND_), dimension(size(lon1d)-1,size(lat1d)-1) :: zmean1d logical :: get_mean_answer !---------------------------------------- test topog mean 2d ---------------------------------------------! @@ -191,10 +190,10 @@ subroutine test_topog_stdev(lat2d, lon2d, lat1d, lon1d) !! tested with. In this case, the sizes of both stdev2d and stdev1d are both the !! same size but have to be these specific dimensions per the topography_mod code implicit none - real(kind=TEST_TOP_KIND_), dimension(2,2), intent(in) :: lat2d, lon2d - real(kind=TEST_TOP_KIND_), dimension(2), intent(in) :: lat1d, lon1d - real(kind=TEST_TOP_KIND_), dimension(size(lon2d,1)-1,size(lat2d,2)-1) :: stdev2d - real(kind=TEST_TOP_KIND_), dimension(size(lon1d)-1,size(lat1d)-1) :: stdev1d + real(kind=TEST_FMS_KIND_), dimension(2,2), intent(in) :: lat2d, lon2d + real(kind=TEST_FMS_KIND_), dimension(2), intent(in) :: lat1d, lon1d + real(kind=TEST_FMS_KIND_), dimension(size(lon2d,1)-1,size(lat2d,2)-1) :: stdev2d + real(kind=TEST_FMS_KIND_), dimension(size(lon1d)-1,size(lat1d)-1) :: stdev1d logical :: get_stdev_answer !---------------------------------------- test topog stdev 2d ---------------------------------------------! @@ -224,10 +223,10 @@ subroutine test_get_ocean_frac(lat2d, lon2d, lat1d, lon1d) !! tested with. In this case, the sizes of both ocean_frac2d and ocean_frac1d are both the !! same size but have to be these specific dimensions per the topography_mod code implicit none - real(kind=TEST_TOP_KIND_), dimension(2,2), intent(in) :: lat2d, lon2d - real(kind=TEST_TOP_KIND_), dimension(2), intent(in) :: lat1d, lon1d - real(kind=TEST_TOP_KIND_), dimension(size(lon2d,1)-1,size(lat2d,2)-1) :: ocean_frac2d - real(kind=TEST_TOP_KIND_), dimension(size(lon1d)-1,size(lat1d)-1) :: ocean_frac1d + real(kind=TEST_FMS_KIND_), dimension(2,2), intent(in) :: lat2d, lon2d + real(kind=TEST_FMS_KIND_), dimension(2), intent(in) :: lat1d, lon1d + real(kind=TEST_FMS_KIND_), dimension(size(lon2d,1)-1,size(lat2d,2)-1) :: ocean_frac2d + real(kind=TEST_FMS_KIND_), dimension(size(lon1d)-1,size(lat1d)-1) :: ocean_frac1d logical :: get_ocean_frac_answer !---------------------------------------- test get_ocean_frac 2d ---------------------------------------------! @@ -256,8 +255,8 @@ subroutine test_get_ocean_mask(lat2d, lon2d, lat1d, lon1d) !! tested with. In this case, the sizes of both ocean_mask2d and ocean_mask1d are both the !! same size but have to be these specific dimensions per the topography_mod code implicit none - real(kind=TEST_TOP_KIND_), dimension(2,2), intent(in) :: lat2d, lon2d - real(kind=TEST_TOP_KIND_), dimension(2), intent(in) :: lat1d, lon1d + real(kind=TEST_FMS_KIND_), dimension(2,2), intent(in) :: lat2d, lon2d + real(kind=TEST_FMS_KIND_), dimension(2), intent(in) :: lat1d, lon1d logical, dimension(size(lon2d,1)-1,size(lat2d,2)-1) :: ocean_mask2d logical, dimension(size(lon1d)-1,size(lat1d)-1) :: ocean_mask1d logical :: get_ocean_mask_answer @@ -289,10 +288,10 @@ subroutine test_get_water_frac(lat2d, lon2d, lat1d, lon1d) !! tested with. In this case, the sizes of both water_frac2d and water_frac1d are both the !! same size but have to be these specific dimensions per the topography_mod code implicit none - real(kind=TEST_TOP_KIND_), dimension(2,2), intent(in) :: lat2d, lon2d - real(kind=TEST_TOP_KIND_), dimension(2), intent(in) :: lat1d, lon1d - real(kind=TEST_TOP_KIND_), dimension(size(lon2d,1)-1,size(lat2d,2)-1) :: water_frac2d - real(kind=TEST_TOP_KIND_), dimension(size(lon1d)-1,size(lat1d)-1) :: water_frac1d + real(kind=TEST_FMS_KIND_), dimension(2,2), intent(in) :: lat2d, lon2d + real(kind=TEST_FMS_KIND_), dimension(2), intent(in) :: lat1d, lon1d + real(kind=TEST_FMS_KIND_), dimension(size(lon2d,1)-1,size(lat2d,2)-1) :: water_frac2d + real(kind=TEST_FMS_KIND_), dimension(size(lon1d)-1,size(lat1d)-1) :: water_frac1d logical :: get_water_frac_answer !---------------------------------------- test get_water_frac 2d ---------------------------------------------! @@ -322,8 +321,8 @@ subroutine test_get_water_mask(lat2d, lon2d, lat1d, lon1d) !! tested with. In this case, the sizes of both water_mask2d and water_mask1d are both the !! same size but have to be these specific dimensions per the topography_mod code implicit none - real(kind=TEST_TOP_KIND_), dimension(2,2), intent(in) :: lat2d, lon2d - real(kind=TEST_TOP_KIND_), dimension(2), intent(in) :: lat1d, lon1d + real(kind=TEST_FMS_KIND_), dimension(2,2), intent(in) :: lat2d, lon2d + real(kind=TEST_FMS_KIND_), dimension(2), intent(in) :: lat1d, lon1d logical, dimension(size(lon2d,1)-1,size(lat2d,2)-1) :: water_mask2d logical, dimension(size(lon1d)-1,size(lat1d)-1) :: water_mask1d logical :: get_water_mask_answer @@ -351,8 +350,8 @@ end subroutine test_get_water_mask subroutine check_answers(calculated_answer, expected_answer, what_error) implicit none - real(kind=TEST_TOP_KIND_) :: calculated_answer ! value calculated from script - real(kind=TEST_TOP_KIND_) :: expected_answer ! expected answer + real(kind=TEST_FMS_KIND_) :: calculated_answer ! value calculated from script + real(kind=TEST_FMS_KIND_) :: expected_answer ! expected answer character(*) :: what_error ! error message to print if (calculated_answer.ne. expected_answer) then diff --git a/test_fms/topography/test_topography.sh b/test_fms/topography/test_topography.sh index f9c55afda5..07b5ab5010 100755 --- a/test_fms/topography/test_topography.sh +++ b/test_fms/topography/test_topography.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/test_fms/tracer_manager/Makefile.am b/test_fms/tracer_manager/Makefile.am index 747151344e..11f51c589a 100644 --- a/test_fms/tracer_manager/Makefile.am +++ b/test_fms/tracer_manager/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the test_fms/tracer_manager directory of @@ -35,18 +34,17 @@ check_PROGRAMS = test_tracer_manager_r4 test_tracer_manager_r8 test_tracer_manager_r4_SOURCES = test_tracer_manager.F90 test_tracer_manager_r8_SOURCES = test_tracer_manager.F90 -test_tracer_manager_r4_CPPFLAGS=-DTEST_TM_KIND_=4 -I$(MODDIR) -test_tracer_manager_r8_CPPFLAGS=-DTEST_TM_KIND_=8 -I$(MODDIR) +test_tracer_manager_r4_CPPFLAGS=-DTEST_FMS_KIND_=4 -I$(MODDIR) +test_tracer_manager_r8_CPPFLAGS=-DTEST_FMS_KIND_=8 -I$(MODDIR) if USING_YAML -skipflag="skip" + TESTS_ENVIRONMENT = parser_skip="" else -skipflag="" + TESTS_ENVIRONMENT = parser_skip=skip endif TEST_EXTENSIONS = .sh SH_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(abs_top_srcdir)/test_fms/tap-driver.sh -TESTS_ENVIRONMENT= parser_skip=${skipflag} # Run the test program. TESTS = test_tracer_manager2.sh diff --git a/test_fms/tracer_manager/test_tracer_manager.F90 b/test_fms/tracer_manager/test_tracer_manager.F90 index f8697f7c04..bc4f974825 100644 --- a/test_fms/tracer_manager/test_tracer_manager.F90 +++ b/test_fms/tracer_manager/test_tracer_manager.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @file !! @brief unit test for set_tracer_profile function @@ -47,11 +46,11 @@ subroutine test_set_tracer_profile integer :: tracer_index, i, j, k logical :: success - real(TEST_TM_KIND_) :: top_value, bottom_value, surf_value, multiplier - real(TEST_TM_KIND_) :: tracer_out1(1,1,1), tracer_out2(npoints,npoints,numlevels) - real(TEST_TM_KIND_) :: answer1(1,1,1), answer2(npoints,npoints,numlevels) + real(TEST_FMS_KIND_) :: top_value, bottom_value, surf_value, multiplier + real(TEST_FMS_KIND_) :: tracer_out1(1,1,1), tracer_out2(npoints,npoints,numlevels) + real(TEST_FMS_KIND_) :: answer1(1,1,1), answer2(npoints,npoints,numlevels) - integer, parameter :: lkind=TEST_TM_KIND_ + integer, parameter :: lkind=TEST_FMS_KIND_ character(128) :: err_message diff --git a/test_fms/tracer_manager/test_tracer_manager2.sh b/test_fms/tracer_manager/test_tracer_manager2.sh index 0c85ac76a5..bad0d3ab42 100755 --- a/test_fms/tracer_manager/test_tracer_manager2.sh +++ b/test_fms/tracer_manager/test_tracer_manager2.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to @@ -58,7 +57,7 @@ _EOF test_expect_success "tracer_manager r4 with the legacy field table" 'mpirun -n 2 ./test_tracer_manager_r4' test_expect_success "tracer_manager r8 with the legacy field table" 'mpirun -n 2 ./test_tracer_manager_r8' -if [ $parser_skip ]; then +if [ -z $parser_skip ]; then rm -rf field_table cat <<_EOF > input.nml &field_manager_nml diff --git a/test_fms/tridiagonal/Makefile.am b/test_fms/tridiagonal/Makefile.am index 211869202b..c4383bdb9c 100644 --- a/test_fms/tridiagonal/Makefile.am +++ b/test_fms/tridiagonal/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the test_fms/tridiagonal directory of the FMS @@ -35,8 +34,8 @@ check_PROGRAMS = test_tridiagonal_r4 test_tridiagonal_r8 test_tridiagonal_r4_SOURCES=test_tridiagonal.F90 test_tridiagonal_r8_SOURCES=test_tridiagonal.F90 -test_tridiagonal_r4_CPPFLAGS=-DTRID_REAL_TYPE=tridiag_r4 -DTEST_TRIDIAG_REAL=r4_kind -I$(MODDIR) -test_tridiagonal_r8_CPPFLAGS=-DTRID_REAL_TYPE=tridiag_r8 -DTEST_TRIDIAG_REAL=r8_kind -I$(MODDIR) +test_tridiagonal_r4_CPPFLAGS=-DTEST_FMS_KIND_=r4_kind -I$(MODDIR) +test_tridiagonal_r8_CPPFLAGS=-DTEST_FMS_KIND_=r8_kind -I$(MODDIR) # Run the test program. TESTS = test_tridiagonal.sh diff --git a/test_fms/tridiagonal/test_tridiagonal.F90 b/test_fms/tridiagonal/test_tridiagonal.F90 index 18200a8c77..a37ad9501f 100644 --- a/test_fms/tridiagonal/test_tridiagonal.F90 +++ b/test_fms/tridiagonal/test_tridiagonal.F90 @@ -1,25 +1,20 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** -#ifndef TEST_TRIDIAG_KIND -#define TEST_TRIDIAG_KIND 8 -#endif - !> Tests the tridiagonal module routines (tri_invert and close_tridiagonal) !! Tests reals with the kind value set above, program test_tridiagonal @@ -32,16 +27,16 @@ program test_tridiagonal implicit none integer, parameter :: IN_LEN = 8 !< length of input arrays - integer, parameter :: kindl = TEST_TRIDIAG_KIND !< kind value for all reals in this test - !! set by TEST_TRIDIAG_KIND cpp macro - real(TEST_TRIDIAG_KIND), allocatable :: d(:,:,:), x(:,:,:), ref_array(:,:,:) - real(TEST_TRIDIAG_KIND), allocatable :: a(:,:,:), b(:,:,:), c(:,:,:) + integer, parameter :: kindl = TEST_FMS_KIND_ !< kind value for all reals in this test + !! set by TEST_FMS_KIND_ cpp macro + real(TEST_FMS_KIND_), allocatable :: d(:,:,:), x(:,:,:), ref_array(:,:,:) + real(TEST_FMS_KIND_), allocatable :: a(:,:,:), b(:,:,:), c(:,:,:) real(r4_kind), allocatable :: d_r4(:,:,:), x_r4(:,:,:) real(r4_kind), allocatable :: a_r4(:,:,:), b_r4(:,:,:), c_r4(:,:,:) real(r8_kind), allocatable :: d_r8(:,:,:), x_r8(:,:,:) real(r8_kind), allocatable :: a_r8(:,:,:), b_r8(:,:,:), c_r8(:,:,:) integer :: i, end, ierr, io - real(TEST_TRIDIAG_KIND) :: k + real(TEST_FMS_KIND_) :: k ! nml logical :: do_error_check = .false. namelist / test_tridiagonal_nml/ do_error_check @@ -96,17 +91,17 @@ program test_tridiagonal ref_array = ref_array * k ! check do i=1, IN_LEN - if(ABS(x(1,1,i) - ref_array(1,1,i)) .gt. 0.1e-12_kindl) then + if(ABS(x(1,1,i) - ref_array(1,1,i)) .gt. 1.0e-6_kindl) then print *, i, x(1,1,i), ref_array(1,1,i) call mpp_error(FATAL, "test_tridiagonal: failed reference check for tri_invert") endif enddo !! check with stored data arrays d = -1.0_kindl - ref_array = ref_array * -1.0_kindl + ref_array = -1.0_kindl * ref_array call tri_invert(x, d) do i=1, IN_LEN - if(ABS(x(1,1,i) - ref_array(1,1,i)) .gt. 0.1e-12_kindl) then + if(ABS(x(1,1,i) - ref_array(1,1,i)) .gt. 1.0e-6_kindl) then print *, i, x(1,1,i), ref_array(1,1,i) call mpp_error(FATAL, "test_tridiagonal: failed reference check for tri_invert with saved values") endif @@ -170,4 +165,4 @@ program test_tridiagonal call mpp_exit -end program \ No newline at end of file +end program diff --git a/test_fms/tridiagonal/test_tridiagonal.sh b/test_fms/tridiagonal/test_tridiagonal.sh index 4be1fa80b1..caacc83c58 100755 --- a/test_fms/tridiagonal/test_tridiagonal.sh +++ b/test_fms/tridiagonal/test_tridiagonal.sh @@ -1,22 +1,21 @@ #!/bin/sh #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is part of the GFDL FMS package. This is a shell script to diff --git a/time_interp/Makefile.am b/time_interp/Makefile.am index ac9bd26654..f83eb5d8dc 100644 --- a/time_interp/Makefile.am +++ b/time_interp/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the time_interp directory of the FMS diff --git a/time_interp/include/time_interp.inc b/time_interp/include/time_interp.inc index faefe121fa..b8e2f3f7b9 100644 --- a/time_interp/include/time_interp.inc +++ b/time_interp/include/time_interp.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup time_interp_mod diff --git a/time_interp/include/time_interp_external2.inc b/time_interp/include/time_interp_external2.inc index d02f626504..2ea61949b2 100644 --- a/time_interp/include/time_interp_external2.inc +++ b/time_interp/include/time_interp_external2.inc @@ -1,25 +1,49 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @ingroup time_interp !> @addtogroup time_interp_external2_mod !> @{ + !> @brief 1D interpolation for @ref time_interp_external + subroutine TIME_INTERP_EXTERNAL_1D_(index, time, data_in, interp, verbose,horz_interp, mask_out, & + is_in, ie_in, window_id) + + integer, intent(in) :: index + type(time_type), intent(in) :: time + real(FMS_TI_KIND_), dimension(:), intent(inout) :: data_in + integer, intent(in), optional :: interp + logical, intent(in), optional :: verbose + type(horiz_interp_type),intent(in), optional :: horz_interp + logical, dimension(:), intent(out), optional :: mask_out !< set to true where output data is valid + integer, intent(in), optional :: is_in, ie_in + integer, intent(in), optional :: window_id + + real(FMS_TI_KIND_), dimension(size(data_in,1), 1, 1) :: data_out + logical, dimension(size(data_in), 1, 1) :: mask3d + + data_out(:,1,1) = data_in(:) ! fill initial values for the portions of array that are not touched by 3d routine + call time_interp_external(index, time, data_out, interp, verbose, horz_interp, mask3d, & + is_in=is_in,ie_in=ie_in,js_in=1,je_in=1,window_id=window_id) + data_in(:) = data_out(:,1,1) + if (PRESENT(mask_out)) mask_out(:) = mask3d(:,1,1) + + end subroutine TIME_INTERP_EXTERNAL_1D_ + !> @brief 2D interpolation for @ref time_interp_external subroutine TIME_INTERP_EXTERNAL_2D_(index, time, data_in, interp, verbose,horz_interp, mask_out, & is_in, ie_in, js_in, je_in, window_id) diff --git a/time_interp/include/time_interp_external2_bridge.inc b/time_interp/include/time_interp_external2_bridge.inc index e550b42296..b1748b6d74 100644 --- a/time_interp/include/time_interp_external2_bridge.inc +++ b/time_interp/include/time_interp_external2_bridge.inc @@ -1,25 +1,51 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @ingroup time_interp !> @addtogroup time_interp_external2_mod !> @{ + !> @brief 1D interpolation for @ref time_interp_external_bridge + subroutine TIME_INTERP_EXTERNAL_BRIDGE_1D_(index1, index2, time, data_in, interp, verbose,horz_interp, mask_out, & + is_in, ie_in, window_id) + + integer, intent(in) :: index1 !< index of first external field + integer, intent(in) :: index2 !< index of second external field + type(time_type), intent(in) :: time !< target time for data + real(FMS_TI_KIND_), dimension(:), intent(inout) :: data_in !< global or local data array + integer, intent(in), optional :: interp !< hardcoded to linear + logical, intent(in), optional :: verbose !< flag for debugging + type(horiz_interp_type),intent(in), optional :: horz_interp !< horizontal interpolation type + logical, dimension(:), intent(out), optional :: mask_out !< set to true where output data is valid + integer, intent(in), optional :: is_in, ie_in !< horizontal indices for load_record + integer, intent(in), optional :: window_id !< harcoded to 1 in load_record + + real(FMS_TI_KIND_), dimension(size(data_in,1), 1, 1) :: data_out !< 3d version of data_in + logical, dimension(size(data_in,1), 1, 1) :: mask3d !< 3d version of mask_out + + data_out(:,1,1) = data_in(:) ! fill initial values for the portions of array that are not touched by 3d routine + call time_interp_external_bridge(index1, index2, time, data_out, interp, verbose, horz_interp, mask3d, & + is_in=is_in,ie_in=ie_in,js_in=1,je_in=1,window_id=window_id) + data_in(:) = data_out(:,1,1) + if (PRESENT(mask_out)) mask_out(:) = mask3d(:,1,1) + + end subroutine TIME_INTERP_EXTERNAL_BRIDGE_1D_ + + !> @brief 2D interpolation for @ref time_interp_external_bridge subroutine TIME_INTERP_EXTERNAL_BRIDGE_2D_(index1, index2, time, data_in, interp, verbose,horz_interp, mask_out, & is_in, ie_in, js_in, je_in, window_id) diff --git a/time_interp/include/time_interp_external2_bridge_r4.fh b/time_interp/include/time_interp_external2_bridge_r4.fh index 1e8fafe4d1..26a9395bbf 100644 --- a/time_interp/include/time_interp_external2_bridge_r4.fh +++ b/time_interp/include/time_interp_external2_bridge_r4.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** #undef FMS_TI_KIND_ #define FMS_TI_KIND_ r4_kind @@ -22,6 +21,9 @@ #undef TIME_INTERP_EXTERNAL_BRIDGE_0D_ #define TIME_INTERP_EXTERNAL_BRIDGE_0D_ time_interp_external_bridge_0d_r4 +#undef TIME_INTERP_EXTERNAL_BRIDGE_1D_ +#define TIME_INTERP_EXTERNAL_BRIDGE_1D_ time_interp_external_bridge_1d_r4 + #undef TIME_INTERP_EXTERNAL_BRIDGE_2D_ #define TIME_INTERP_EXTERNAL_BRIDGE_2D_ time_interp_external_bridge_2d_r4 diff --git a/time_interp/include/time_interp_external2_bridge_r8.fh b/time_interp/include/time_interp_external2_bridge_r8.fh index ef6d2fe209..b0b8e3b61f 100644 --- a/time_interp/include/time_interp_external2_bridge_r8.fh +++ b/time_interp/include/time_interp_external2_bridge_r8.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** #undef FMS_TI_KIND_ #define FMS_TI_KIND_ r8_kind @@ -22,6 +21,9 @@ #undef TIME_INTERP_EXTERNAL_BRIDGE_0D_ #define TIME_INTERP_EXTERNAL_BRIDGE_0D_ time_interp_external_bridge_0d_r8 +#undef TIME_INTERP_EXTERNAL_BRIDGE_1D_ +#define TIME_INTERP_EXTERNAL_BRIDGE_1D_ time_interp_external_bridge_1d_r8 + #undef TIME_INTERP_EXTERNAL_BRIDGE_2D_ #define TIME_INTERP_EXTERNAL_BRIDGE_2D_ time_interp_external_bridge_2d_r8 diff --git a/time_interp/include/time_interp_external2_r4.fh b/time_interp/include/time_interp_external2_r4.fh index 0a26096b4a..c78fabbd92 100644 --- a/time_interp/include/time_interp_external2_r4.fh +++ b/time_interp/include/time_interp_external2_r4.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** #undef FMS_TI_KIND_ #define FMS_TI_KIND_ r4_kind @@ -22,6 +21,9 @@ #undef TIME_INTERP_EXTERNAL_0D_ #define TIME_INTERP_EXTERNAL_0D_ time_interp_external_0d_r4 +#undef TIME_INTERP_EXTERNAL_1D_ +#define TIME_INTERP_EXTERNAL_1D_ time_interp_external_1d_r4 + #undef TIME_INTERP_EXTERNAL_2D_ #define TIME_INTERP_EXTERNAL_2D_ time_interp_external_2d_r4 diff --git a/time_interp/include/time_interp_external2_r8.fh b/time_interp/include/time_interp_external2_r8.fh index 9ebf7e3892..d2992f0ba4 100644 --- a/time_interp/include/time_interp_external2_r8.fh +++ b/time_interp/include/time_interp_external2_r8.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** #undef FMS_TI_KIND_ #define FMS_TI_KIND_ r8_kind @@ -22,6 +21,9 @@ #undef TIME_INTERP_EXTERNAL_0D_ #define TIME_INTERP_EXTERNAL_0D_ time_interp_external_0d_r8 +#undef TIME_INTERP_EXTERNAL_1D_ +#define TIME_INTERP_EXTERNAL_1D_ time_interp_external_1d_r8 + #undef TIME_INTERP_EXTERNAL_2D_ #define TIME_INTERP_EXTERNAL_2D_ time_interp_external_2d_r8 diff --git a/time_interp/include/time_interp_r4.fh b/time_interp/include/time_interp_r4.fh index ee63000469..34bffc8905 100644 --- a/time_interp/include/time_interp_r4.fh +++ b/time_interp/include/time_interp_r4.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** #undef FMS_TI_KIND_ #define FMS_TI_KIND_ r4_kind diff --git a/time_interp/include/time_interp_r8.fh b/time_interp/include/time_interp_r8.fh index c3e046f0a8..fd0d15e8a6 100644 --- a/time_interp/include/time_interp_r8.fh +++ b/time_interp/include/time_interp_r8.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** #undef FMS_TI_KIND_ #define FMS_TI_KIND_ r8_kind diff --git a/time_interp/time_interp.F90 b/time_interp/time_interp.F90 index 1e1642c527..b51fed485c 100644 --- a/time_interp/time_interp.F90 +++ b/time_interp/time_interp.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup time_interp_mod time_interp_mod !> @ingroup time_interp diff --git a/time_interp/time_interp_external2.F90 b/time_interp/time_interp_external2.F90 index 5f7bc25bbf..d5a9e0f22f 100644 --- a/time_interp/time_interp_external2.F90 +++ b/time_interp/time_interp_external2.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup time_interp_external2_mod time_interp_external2_mod !> @ingroup time_interp @@ -57,6 +56,7 @@ module time_interp_external2_mod use fms_mod, only : lowercase, check_nml_error use platform_mod, only: r8_kind, FMS_PATH_LEN, FMS_FILE_LEN use horiz_interp_mod, only : horiz_interp, horiz_interp_type + use horiz_interp_type_mod, only : CONSERVE use fms2_io_mod, only : Valid_t, FmsNetcdfDomainFile_t, open_file, get_unlimited_dimension_name, & variable_att_exists, FmsNetcdfFile_t, & variable_exists, get_valid, get_variable_num_dimensions, read_data, & @@ -144,18 +144,22 @@ module time_interp_external2_mod !> @ingroup time_interp_external2_mod interface time_interp_external module procedure time_interp_external_0d_r4 + module procedure time_interp_external_1d_r4 module procedure time_interp_external_2d_r4 module procedure time_interp_external_3d_r4 module procedure time_interp_external_0d_r8 + module procedure time_interp_external_1d_r8 module procedure time_interp_external_2d_r8 module procedure time_interp_external_3d_r8 end interface interface time_interp_external_bridge module procedure time_interp_external_bridge_0d_r4 + module procedure time_interp_external_bridge_1d_r4 module procedure time_interp_external_bridge_2d_r4 module procedure time_interp_external_bridge_3d_r4 module procedure time_interp_external_bridge_0d_r8 + module procedure time_interp_external_bridge_1d_r8 module procedure time_interp_external_bridge_2d_r8 module procedure time_interp_external_bridge_3d_r8 end interface @@ -821,7 +825,11 @@ subroutine load_record(field, rec, interp, is_in, ie_in, js_in, je_in, window_id where (is_valid(field%src_data(:,:,:,ib), field%valid)) mask_in = 1.0_r8_kind if ( field%region_type .NE. NO_REGION ) then if( ANY(mask_in == 0.0_r8_kind) ) then - call mpp_error(FATAL, "time_interp_external: mask_in should be all 1 when region_type is not NO_REGION") + call mpp_error(FATAL, "time_interp_external: mask_in should be all 1 when region_type is not NO_REGION") + end if + if(interp%interp_method == CONSERVE) then + call mpp_error(WARNING, & + "conservative interpolation when region_type is not NO_REGION. Make sure interp matches the region") endif if( field%region_type == OUTSIDE_REGION) then do j = js_region, je_region @@ -837,6 +845,7 @@ subroutine load_record(field, rec, interp, is_in, ie_in, js_in, je_in, window_id enddo endif endif + !! added for mixed mode. Data is always read in as r8 (via ext_fieldtype). if existing horiz_interp_type was !! initialized in r4, needs to cast down in order to match up with saved values in horiz_interp_type. !! creates some temporary arrays since intent(out) vars can't get passed in directly @@ -850,8 +859,13 @@ subroutine load_record(field, rec, interp, is_in, ie_in, js_in, je_in, window_id ! copy over to r4 hi_tmp_data = real(field%domain_data, r4_kind) ! do interpolation - call horiz_interp(interp, real(field%src_data(:,:,:,ib),r4_kind), hi_tmp_data(isw:iew,jsw:jew,:,ib), & - mask_in=real(mask_in,r4_kind), mask_out=hi_tmp_msk_out) + if(interp%interp_method == CONSERVE) then + call horiz_interp(interp, real(field%src_data(:,:,:,ib),r4_kind), hi_tmp_data(isw:iew,jsw:jew,:,ib)) + hi_tmp_msk_out = 1.0_r4_kind + else + call horiz_interp(interp, real(field%src_data(:,:,:,ib),r4_kind), hi_tmp_data(isw:iew,jsw:jew,:,ib), & + mask_in=real(mask_in,r4_kind), mask_out=hi_tmp_msk_out) + end if ! assign any output field%domain_data = real(hi_tmp_data, r8_kind) field%mask(isw:iew,jsw:jew,:,ib) = hi_tmp_msk_out(isw:iew,jsw:jew,:) > 0.0_r4_kind @@ -860,9 +874,13 @@ subroutine load_record(field, rec, interp, is_in, ie_in, js_in, je_in, window_id if(allocated(hi_tmp_msk_out)) deallocate(hi_tmp_msk_out) else allocate(mask_out(isw:iew,jsw:jew, size(field%src_data,3))) - call horiz_interp(interp, field%src_data(:,:,:,ib),field%domain_data(isw:iew,jsw:jew,:,ib), & - mask_in=mask_in, & - mask_out=mask_out) + if(interp%interp_method == CONSERVE) then + call horiz_interp(interp, field%src_data(:,:,:,ib), field%domain_data(isw:iew,jsw:jew,:,ib)) + mask_out = 1.0_r8_kind + else + call horiz_interp(interp, field%src_data(:,:,:,ib),field%domain_data(isw:iew,jsw:jew,:,ib), & + mask_in=mask_in, mask_out=mask_out) + end if field%mask(isw:iew,jsw:jew,:,ib) = mask_out(isw:iew,jsw:jew,:) > 0.0_r8_kind deallocate(mask_out) endif diff --git a/time_manager/Makefile.am b/time_manager/Makefile.am index 32c6885e13..44852aa33e 100644 --- a/time_manager/Makefile.am +++ b/time_manager/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the time_manager directory of the FMS diff --git a/time_manager/get_cal_time.F90 b/time_manager/get_cal_time.F90 index b87e5ebabd..f2e75359ec 100644 --- a/time_manager/get_cal_time.F90 +++ b/time_manager/get_cal_time.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup get_cal_time_mod get_cal_time_mod !> @ingroup time_manager diff --git a/time_manager/time_manager.F90 b/time_manager/time_manager.F90 index 6625967a1c..537d08f4cd 100644 --- a/time_manager/time_manager.F90 +++ b/time_manager/time_manager.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup time_manager_mod time_manager_mod !> @ingroup time_manager diff --git a/topography/Makefile.am b/topography/Makefile.am index 14a2249b8c..f54ba97041 100644 --- a/topography/Makefile.am +++ b/topography/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the topography directory of the FMS diff --git a/topography/gaussian_topog.F90 b/topography/gaussian_topog.F90 index e8ae51548a..376b85e5fd 100644 --- a/topography/gaussian_topog.F90 +++ b/topography/gaussian_topog.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup gaussian_topog_mod gaussian_topog_mod !> @ingroup topography diff --git a/topography/include/gaussian_topog.inc b/topography/include/gaussian_topog.inc index 1a39983ca8..ce456ae1c3 100644 --- a/topography/include/gaussian_topog.inc +++ b/topography/include/gaussian_topog.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup gaussian_topog_mod gaussian_topog_mod !> @ingroup topography diff --git a/topography/include/gaussian_topog_r4.fh b/topography/include/gaussian_topog_r4.fh index 54b38b093b..b9c3ea95af 100644 --- a/topography/include/gaussian_topog_r4.fh +++ b/topography/include/gaussian_topog_r4.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup gaussian_topog_mod gaussian_topog_mod !> @ingroup topography diff --git a/topography/include/gaussian_topog_r8.fh b/topography/include/gaussian_topog_r8.fh index 5e4d423bd0..00a05f3e8e 100644 --- a/topography/include/gaussian_topog_r8.fh +++ b/topography/include/gaussian_topog_r8.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup gaussian_topog_mod gaussian_topog_mod !> @ingroup topography diff --git a/topography/include/topography.inc b/topography/include/topography.inc index 0f2cffbdc2..141b748acc 100644 --- a/topography/include/topography.inc +++ b/topography/include/topography.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup topography_mod topography_mod !> @ingroup topography diff --git a/topography/include/topography_r4.fh b/topography/include/topography_r4.fh index fff4595933..26352d1649 100644 --- a/topography/include/topography_r4.fh +++ b/topography/include/topography_r4.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup gaussian_topog_mod gaussian_topog_mod !> @ingroup topography diff --git a/topography/include/topography_r8.fh b/topography/include/topography_r8.fh index a0ec32060e..0672298d77 100644 --- a/topography/include/topography_r8.fh +++ b/topography/include/topography_r8.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup gaussian_topog_mod gaussian_topog_mod !> @ingroup topography diff --git a/topography/topography.F90 b/topography/topography.F90 index c35a79cbc3..8bd3f27122 100644 --- a/topography/topography.F90 +++ b/topography/topography.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup topography_mod topography_mod !> @ingroup topography diff --git a/tracer_manager/Makefile.am b/tracer_manager/Makefile.am index 476d86796d..ded77ce0d0 100644 --- a/tracer_manager/Makefile.am +++ b/tracer_manager/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the tracer_manager directory of the FMS diff --git a/tracer_manager/include/tracer_manager.inc b/tracer_manager/include/tracer_manager.inc index 2954ec170d..367d2d6b31 100644 --- a/tracer_manager/include/tracer_manager.inc +++ b/tracer_manager/include/tracer_manager.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup tracer_manager_mod tracer_manager_mod !> @ingroup tracer_manager diff --git a/tracer_manager/include/tracer_manager_r4.fh b/tracer_manager/include/tracer_manager_r4.fh index 7b3a0513c9..83702c513e 100644 --- a/tracer_manager/include/tracer_manager_r4.fh +++ b/tracer_manager/include/tracer_manager_r4.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup tracer_manager_mod tracer_manager_mod !> @ingroup tracer_manager diff --git a/tracer_manager/include/tracer_manager_r8.fh b/tracer_manager/include/tracer_manager_r8.fh index d330e82734..e3fa8601f8 100644 --- a/tracer_manager/include/tracer_manager_r8.fh +++ b/tracer_manager/include/tracer_manager_r8.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup tracer_manager_mod tracer_manager_mod !> @ingroup tracer_manager diff --git a/tracer_manager/tracer_manager.F90 b/tracer_manager/tracer_manager.F90 index 70375b5ab1..80379b990d 100644 --- a/tracer_manager/tracer_manager.F90 +++ b/tracer_manager/tracer_manager.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup tracer_manager_mod tracer_manager_mod !> @ingroup tracer_manager diff --git a/tridiagonal/Makefile.am b/tridiagonal/Makefile.am index d8b90c409b..fdf1281306 100644 --- a/tridiagonal/Makefile.am +++ b/tridiagonal/Makefile.am @@ -1,20 +1,19 @@ #*********************************************************************** -#* GNU Lesser General Public License +#* Apache License 2.0 #* #* This file is part of the GFDL Flexible Modeling System (FMS). #* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. +#* Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +#* You may obtain a copy of the License at #* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. +#* http://www.apache.org/licenses/LICENSE-2.0 #* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . +#* FMS is distributed in the hope that it will be useful, but WITHOUT +#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +#* PARTICULAR PURPOSE. See the License for the specific language +#* governing permissions and limitations under the License. #*********************************************************************** # This is an automake file for the tridiagonal directory of the FMS diff --git a/tridiagonal/include/tridiagonal.inc b/tridiagonal/include/tridiagonal.inc index 95788eb795..61d8fe6c68 100644 --- a/tridiagonal/include/tridiagonal.inc +++ b/tridiagonal/include/tridiagonal.inc @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @addtogroup tridiagonal_mod diff --git a/tridiagonal/include/tridiagonal_r4.fh b/tridiagonal/include/tridiagonal_r4.fh index 09e0ad57ac..1c334d28a4 100644 --- a/tridiagonal/include/tridiagonal_r4.fh +++ b/tridiagonal/include/tridiagonal_r4.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** #undef FMS_TRID_KIND_ diff --git a/tridiagonal/include/tridiagonal_r8.fh b/tridiagonal/include/tridiagonal_r8.fh index b007941723..24a06fc2ac 100644 --- a/tridiagonal/include/tridiagonal_r8.fh +++ b/tridiagonal/include/tridiagonal_r8.fh @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** #undef FMS_TRID_KIND_ diff --git a/tridiagonal/tridiagonal.F90 b/tridiagonal/tridiagonal.F90 index e34feb4d92..8ceb5a75c0 100644 --- a/tridiagonal/tridiagonal.F90 +++ b/tridiagonal/tridiagonal.F90 @@ -1,20 +1,19 @@ !*********************************************************************** -!* GNU Lesser General Public License +!* Apache License 2.0 !* !* This file is part of the GFDL Flexible Modeling System (FMS). !* -!* FMS is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. +!* Licensed under the Apache License, Version 2.0 (the "License"); +!* you may not use this file except in compliance with the License. +!* You may obtain a copy of the License at !* -!* FMS is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. +!* http://www.apache.org/licenses/LICENSE-2.0 !* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FMS. If not, see . +!* FMS is distributed in the hope that it will be useful, but WITHOUT +!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied; +!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +!* PARTICULAR PURPOSE. See the License for the specific language +!* governing permissions and limitations under the License. !*********************************************************************** !> @defgroup tridiagonal_mod tridiagonal_mod !> @ingroup tridiagonal