diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index f5c6966415..2f4415cf77 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -43,4 +43,4 @@ jobs: - name: Compile run: | cmake -S . -B build/Debug -D CMAKE_BUILD_TYPE=Debug - cd build/Debug && make -j \ No newline at end of file + cd build/Debug && make -j diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f1c6fa6ca..ab0bf5ae08 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,8 +63,6 @@ else () message ("Unknown C compiler default flags only...") endif() -find_package(NetCDF) - string(TOUPPER ${CMAKE_BUILD_TYPE} BUILD_TYPE) message("Using Fortran flags: ${CMAKE_Fortran_FLAGS} ${CMAKE_Fortran_FLAGS_${BUILD_TYPE}}") message("Using C flags: ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${BUILD_TYPE}}") diff --git a/FindNetCDF.cmake b/FindNetCDF.cmake deleted file mode 100644 index 8c9c3309f9..0000000000 --- a/FindNetCDF.cmake +++ /dev/null @@ -1,200 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#[=======================================================================[.rst: -FindNetCDF ----------- - -Find NetCDF4 library - -based on: https://github.com/Kitware/VTK/blob/master/CMake/FindNetCDF.cmake -in general, NetCDF requires C compiler even if only using Fortran - -Imported targets -^^^^^^^^^^^^^^^^ - -This module defines the following :prop_tgt:`IMPORTED` target: - -``NetCDF::NetCDF_C`` - NetCDF C / C++ libraries - -``NetCDF::NetCDF_Fortran`` - NetCDF Fortran libraries - -Result Variables -^^^^^^^^^^^^^^^^ - -This module defines the following variables: - -``NetCDF_FOUND`` - NetCDF4 is found (also ``NetCDF_C_FOUND`` and ``NetCDF_Fortran_FOUND``) -``NetCDF_C_LIBRARIES`` and ``NetCDF_Fortran_LIBRARIES - uncached list of libraries (using full path name) to link against -``NetCDF_C_INCLUDE_DIRS`` and ``NetCDF_Fortran_INCLUDE_DIRS`` - uncached list of libraries (using full path name) to include - -Search details: - -1. look for CMake-build config files (for C / C++ only) -2. CMake manual search optionally using pkg-config (this step always needed for Fortran, and for C if step 1 fails) - -#]=======================================================================] - -include(CheckSourceCompiles) - -function(netcdf_c) - -if(PkgConfig_FOUND AND NOT NetCDF_C_LIBRARY) - pkg_search_module(pc_nc netcdf) -endif() - -find_path(NetCDF_C_INCLUDE_DIR - NAMES netcdf.h - HINTS ${pc_nc_INCLUDE_DIRS} - DOC "NetCDF C include directory") - -if(NOT NetCDF_C_INCLUDE_DIR) - return() -endif() - -find_library(NetCDF_C_LIBRARY - NAMES netcdf - HINTS ${pc_nc_LIBRARY_DIRS} ${pc_nc_LIBDIR} - DOC "NetCDF C library") - -if(NOT NetCDF_C_LIBRARY) - return() -endif() - -set(CMAKE_REQUIRED_FLAGS) -set(CMAKE_REQUIRED_INCLUDES ${NetCDF_C_INCLUDE_DIR}) -set(CMAKE_REQUIRED_LIBRARIES ${NetCDF_C_LIBRARY}) - -check_source_compiles(C -"#include -#include - -int main(void){ -printf(\"%s\", nc_inq_libvers()); -return 0; -} -" NetCDF_C_links) - -if(NOT NetCDF_C_links) - return() -endif() - -set(NetCDF_C_FOUND true PARENT_SCOPE) -set(NetCDF_C_INCLUDE_DIR ${NetCDF_C_INCLUDE_DIR} PARENT_SCOPE) -set(NetCDF_C_LIBRARY ${NetCDF_C_LIBRARY} PARENT_SCOPE) - -endfunction(netcdf_c) - - -function(netcdf_fortran) - -if(PkgConfig_FOUND AND NOT NetCDF_Fortran_LIBRARY) - pkg_search_module(pc_ncf netcdf-fortran netcdf) -endif() - -find_path(NetCDF_Fortran_INCLUDE_DIR - names netcdf.mod - HINTS ${pc_ncf_INCLUDE_DIRS} - DOC "NetCDF Fortran Include") - -if(NOT NetCDF_Fortran_INCLUDE_DIR) - return() -endif() - -find_library(NetCDF_Fortran_LIBRARY - NAMES netcdff - HINTS ${pc_ncf_LIBRARY_DIRS} ${pc_ncf_LIBDIR} - DOC "NetCDF Fortran library") - -if(NOT NetCDF_Fortran_LIBRARY) - return() -endif() - -set(CMAKE_REQUIRED_FLAGS) -set(CMAKE_REQUIRED_INCLUDES ${NetCDF_Fortran_INCLUDE_DIR}) -set(CMAKE_REQUIRED_LIBRARIES ${NetCDF_Fortran_LIBRARY}) - -check_source_compiles(Fortran "use netcdf; end" NetCDF_Fortran_links) - -if(NOT NetCDF_Fortran_links) - return() -endif() - -set(NetCDF_Fortran_FOUND true PARENT_SCOPE) -set(NetCDF_Fortran_INCLUDE_DIR ${NetCDF_Fortran_INCLUDE_DIR} PARENT_SCOPE) -set(NetCDF_Fortran_LIBRARY ${NetCDF_Fortran_LIBRARY} PARENT_SCOPE) - -endfunction(netcdf_fortran) - -#============================================================ -# main program - -# 1. CMake-built NetCDF. -find_package(netCDF CONFIG QUIET) -if(netCDF_FOUND) - set(NetCDF_C_FOUND "${netCDF_FOUND}") - set(NetCDF_C_INCLUDE_DIR "${netCDF_INCLUDE_DIR}") - set(NetCDF_C_LIBRARY "${netCDF_LIBRARIES}") - set(NetCDF_VERSION "${NetCDFVersion}") -endif(netCDF_FOUND) - -# 2. manual search for Fortran (and C if needed) using optional pkg-config -find_package(PkgConfig) -if(NOT NetCDF_C_FOUND) - netcdf_c() -endif() -set(_ncdf_req ${NetCDF_C_LIBRARY}) - -if(Fortran IN_LIST NetCDF_FIND_COMPONENTS) - netcdf_fortran() - list(APPEND _ncdf_req ${NetCDF_Fortran_LIBRARY}) -endif() - -set(CMAKE_REQUIRED_FLAGS) -set(CMAKE_REQUIRED_INCLUDES) -set(CMAKE_REQUIRED_LIBRARIES) - -mark_as_advanced(NetCDF_C_INCLUDE_DIR NetCDF_Fortran_INCLUDE_DIR NetCDF_C_LIBRARY NetCDF_Fortran_LIBRARY) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(NetCDF - REQUIRED_VARS _ncdf_req - HANDLE_COMPONENTS) - -if(NetCDF_FOUND) - set(NetCDF_C_INCLUDE_DIRS ${NetCDF_C_INCLUDE_DIR}) - set(NetCDF_C_LIBRARIES ${NetCDF_C_LIBRARY}) - - if(NetCDF_Fortran_FOUND) - set(NetCDF_Fortran_INCLUDE_DIRS ${NetCDF_Fortran_INCLUDE_DIR}) - set(NetCDF_Fortran_LIBRARIES ${NetCDF_Fortran_LIBRARY}) - if(NOT TARGET NetCDF::NetCDF_Fortran) - add_library(NetCDF::NetCDF_Fortran INTERFACE IMPORTED) - set_target_properties(NetCDF::NetCDF_Fortran PROPERTIES - INTERFACE_LINK_LIBRARIES "${NetCDF_Fortran_LIBRARY}" - INTERFACE_INCLUDE_DIRECTORIES "${NetCDF_Fortran_INCLUDE_DIR}") - endif() - endif() - - if(NOT TARGET NetCDF::NetCDF_C) - add_library(NetCDF::NetCDF_C INTERFACE IMPORTED) - set_target_properties(NetCDF::NetCDF_C PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${NetCDF_C_INCLUDE_DIR}") - if (TARGET "netCDF::netcdf") - # 4.7.3 - set_target_properties(NetCDF::NetCDF_C PROPERTIES - INTERFACE_LINK_LIBRARIES "netCDF::netcdf") - elseif (TARGET "netcdf") - set_target_properties(NetCDF::NetCDF_C PROPERTIES - INTERFACE_LINK_LIBRARIES "netcdf") - else() - set_target_properties(NetCDF::NetCDF_C PROPERTIES - INTERFACE_LINK_LIBRARIES "${NetCDF_C_LIBRARY}") - endif() - endif() -endif() diff --git a/README.md b/README.md index 5d4b8aa8b3..d1e0710467 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![CI](https://github.com/mom-ocean/FMS/actions/workflows/CI.yml/badge.svg)](https://github.com/mom-ocean/FMS/actions/workflows/CI.yml) + # Flexible Modeling System (FMS) The Flexible Modeling System (FMS) is a software framework for supporting the @@ -6,6 +8,22 @@ of atmospheric, oceanic, and climate system models. More information is available on the [GFDL FMS page](http://www.gfdl.noaa.gov/fms). +# MOM5 Version + +This is a [GitHub fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) of +the [Official FMS repository](https://github.com/NOAA-GFDL/FMS) for the purpose of maintaining +a version of FMS that is compatible with the MOM5 ocean model. + +The GFDL `master` branch is tracked in the `https://github.com/mom-ocean/FMS/tree/gfdl/master` branch +on this repository. + +The `master` branch in this repository is included as a [subtree](https://www.atlassian.com/git/tutorials/git-subtree) +within the MOM5 repository. The forked occurred from the commit for the +[Warsaw 201803 Release](https://github.com/mom-ocean/FMS/commit/e8940fe90d68c3dc7c0d6bf1b8f552a577251754). After +this point the codebases started to diverge and it was decided it would be too difficult to udpate +driver code for all the supported model configurations. + +Note that this is not the version of FMS that is used for [MOM6](https://github.com/mom-ocean/MOM6). # Disclaimer The United States Department of Commerce (DOC) GitHub project code is provided diff --git a/fms/fms.F90 b/fms/fms.F90 index a85cdd9f01..378f772112 100644 --- a/fms/fms.F90 +++ b/fms/fms.F90 @@ -300,7 +300,6 @@ module fms_mod ! ---- private data for check_nml_error ---- - integer, private :: num_nml_error_codes, nml_error_codes(20) logical, private :: do_nml_error_init = .true. private nml_error_init @@ -441,7 +440,6 @@ subroutine fms_init (localcomm ) if (mpp_pe() == mpp_root_pe()) then unit = stdlog() write (unit, nml=fms_nml) - write (unit,*) 'nml_error_codes=', nml_error_codes(1:num_nml_error_codes) endif call memutils_init( print_memory_usage ) diff --git a/random_numbers/MersenneTwister.F90 b/random_numbers/MersenneTwister.F90 index 23918a5900..e140e98acb 100644 --- a/random_numbers/MersenneTwister.F90 +++ b/random_numbers/MersenneTwister.F90 @@ -146,11 +146,13 @@ elemental function temper(y) integer, intent(in) :: y integer :: temper + integer :: x + ! Tempering - temper = ieor(y, ishft(y, -11)) - temper = ieor(temper, iand(ishft(temper, 7), TMASKB)) - temper = ieor(temper, iand(ishft(temper, 15), TMASKC)) - temper = ieor(temper, ishft(temper, -18)) + x = ieor(y, ishft(y, -11)) + x = ieor(x, iand(ishft(x, 7), TMASKB)) + x = ieor(x, iand(ishft(x, 15), TMASKC)) + temper = ieor(x, ishft(x, -18)) end function temper ! ------------------------------------------------------------- ! Public (but hidden) functions