From fdd6817e2c4b3fa91dfd2bf1218da1e6e7e71793 Mon Sep 17 00:00:00 2001 From: Jessica Meixner Date: Wed, 19 Jan 2022 17:22:42 -0500 Subject: [PATCH] Remove old cmake in esmf folder and update for grib (#4) * use NCEP2 if you want grib output * remove ufs/esmf specific cmake * remove file --- model/esmf/CMakeLists.txt | 107 ------- model/esmf/cmake/FindESMF.cmake | 105 ------- model/esmf/cmake/FindNetCDF.cmake | 337 ---------------------- model/esmf/run_w3adc.sh | 29 -- regtests/ww3_tp2.17/input/switch_NO_PDLIB | 2 +- regtests/ww3_tp2.17/input/switch_PDLIB | 2 +- regtests/ww3_ufs1.1/input/switch_MPI | 2 +- regtests/ww3_ufs1.1/input/switch_MPI_OMPH | 2 +- regtests/ww3_ufs1.2/input/switch_MPI_OMPH | 2 +- regtests/ww3_ufs1.3/input/switch_MPI_OMPH | 2 +- 10 files changed, 6 insertions(+), 584 deletions(-) delete mode 100644 model/esmf/CMakeLists.txt delete mode 100644 model/esmf/cmake/FindESMF.cmake delete mode 100644 model/esmf/cmake/FindNetCDF.cmake delete mode 100755 model/esmf/run_w3adc.sh diff --git a/model/esmf/CMakeLists.txt b/model/esmf/CMakeLists.txt deleted file mode 100644 index f211bf2a9..000000000 --- a/model/esmf/CMakeLists.txt +++ /dev/null @@ -1,107 +0,0 @@ -cmake_minimum_required(VERSION 3.15) - -project(ww3nemslib VERSION 7.00 LANGUAGES Fortran) - -list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) - -find_package(NetCDF REQUIRED Fortran) -find_package(MPI REQUIRED) -find_package(ESMF MODULE REQUIRED) - -if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") - set(CMAKE_Fortran_FLAGS "-fno-second-underscore -ffree-line-length-none -fconvert=big-endian -O3 -march=native") -elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Intel") - set(CMAKE_Fortran_FLAGS "-no-fma -ip -g -i4 -real-size 32 -fp-model precise -assume byterecl -convert big_endian -fno-alias -fno-fnalias -sox -xhost -O3") -endif() - -set(SRCS - constants.ftn - w3adatmd.ftn - w3arrymd.ftn - w3cspcmd.ftn - w3dispmd.ftn - w3fldsmd.ftn - w3flx1md.ftn - w3gdatmd.ftn - w3gsrumd.ftn - w3idatmd.ftn - w3initmd.ftn - w3iobcmd.ftn - w3iogomd.ftn - w3iogrmd.ftn - w3iopomd.ftn - w3iorsmd.ftn - w3iosfmd.ftn - w3iotrmd.ftn - w3nmlmultimd.ftn - w3odatmd.ftn - w3parall.ftn - w3partmd.ftn - w3pro3md.ftn - w3profsmd.ftn - w3sbt1md.ftn - w3sdb1md.ftn - w3servmd.ftn - w3snl1md.ftn - w3src4md.ftn - w3srcemd.ftn - w3timemd.ftn - w3triamd.ftn - w3updtmd.ftn - w3uqckmd.ftn - w3wavemd.ftn - w3wdasmd.ftn - w3wdatmd.ftn - wmesmfmd.ftn - wmfinlmd.ftn - wmgridmd.ftn - wminiomd.ftn - wminitmd.ftn - wmiopomd.ftn - wmmdatmd.ftn - wmscrpmd.ftn - wmunitmd.ftn - wmupdtmd.ftn - wmwavemd.ftn - SCRIP/scrip_constants.f - SCRIP/scrip_errormod.f90 - SCRIP/scrip_grids.f - SCRIP/scrip_interface.ftn - SCRIP/scrip_iounitsmod.f90 - SCRIP/scrip_kindsmod.f90 - SCRIP/scrip_netcdfmod.f90 - SCRIP/scrip_remap_conservative.f - SCRIP/scrip_remap_read.f - SCRIP/scrip_remap_vars.f - SCRIP/scrip_remap_write.f - SCRIP/scrip_timers.f -) - -get_filename_component(tools_dir "${CMAKE_CURRENT_SOURCE_DIR}/../tools" ABSOLUTE) -get_filename_component(ftn_dir "${CMAKE_CURRENT_SOURCE_DIR}/../ftn" ABSOLUTE) - -message(STATUS "tools_dir ${tools_dir}") -message(STATUS "ftn_dir ${ftn_dir}") - -add_executable(w3adc ../tools/w3adc.f) - -foreach(src_file ${SRCS}) - STRING(REGEX REPLACE ".ftn" ".F90" gen_src_file ${src_file}) - STRING(REGEX REPLACE "/" "_" gen_log_file ${gen_src_file}) - add_custom_command( - OUTPUT ${gen_src_file} - DEPENDS w3adc ${ftn_dir}/${src_file} - COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/run_w3adc.sh ${ftn_dir} ${src_file} > ${gen_log_file}.w3adc.log 2>&1 - COMMENT "Running w3adc ${src_file}") - list(APPEND SRCS_F90 ${gen_src_file}) -endforeach() - -add_library(ww3_multi_esmf STATIC ${SRCS_F90}) - -set(mod_dir ${CMAKE_CURRENT_BINARY_DIR}/mod) -set_target_properties(ww3_multi_esmf PROPERTIES Fortran_MODULE_DIRECTORY ${mod_dir}) - -target_include_directories(ww3_multi_esmf PUBLIC ${mod_dir}) -target_include_directories(ww3_multi_esmf PRIVATE ${ftn_dir} ${ESMF_MOD}) - -target_link_libraries(ww3_multi_esmf PUBLIC esmf NetCDF::NetCDF_Fortran MPI::MPI_Fortran) diff --git a/model/esmf/cmake/FindESMF.cmake b/model/esmf/cmake/FindESMF.cmake deleted file mode 100644 index 82b648e08..000000000 --- a/model/esmf/cmake/FindESMF.cmake +++ /dev/null @@ -1,105 +0,0 @@ -# - Try to find ESMF -# -# Requires setting ESMFMKFILE to the filepath of esmf.mk. If this is NOT set, -# then ESMF_FOUND will always be FALSE. If ESMFMKFILE exists, then ESMF_FOUND=TRUE -# and all ESMF makefile variables will be set in the global scope. Optionally, -# set ESMF_MKGLOBALS to a string list to filter makefile variables. For example, -# to globally scope only ESMF_LIBSDIR and ESMF_APPSDIR variables, use this CMake -# command in CMakeLists.txt: -# -# set(ESMF_MKGLOBALS "LIBSDIR" "APPSDIR") - - -# Add the ESMFMKFILE path to the cache if defined as system env variable -if (DEFINED ENV{ESMFMKFILE} AND NOT DEFINED ESMFMKFILE) - set(ESMFMKFILE $ENV{ESMFMKFILE} CACHE FILEPATH "Path to ESMF mk file") -endif () - -# Found the mk file and ESMF exists on the system -if (EXISTS ${ESMFMKFILE}) - set(ESMF_FOUND TRUE CACHE BOOL "ESMF mk file found" FORCE) - # Did not find the ESMF mk file -else() - set(ESMF_FOUND FALSE CACHE BOOL "ESMF mk file NOT found" FORCE) - # Best to warn users that without the mk file there is no way to find ESMF - if (NOT DEFINED ESMFMKFILE) - message(FATAL_ERROR "ESMFMKFILE not defined. This is the path to esmf.mk file. \ -Without this filepath, ESMF_FOUND will always be FALSE.") - endif () -endif() - -# Only parse the mk file if it is found -if (ESMF_FOUND) - # Read the mk file - file(STRINGS "${ESMFMKFILE}" esmfmkfile_contents) - # Parse each line in the mk file - foreach(str ${esmfmkfile_contents}) - # Only consider uncommented lines - string(REGEX MATCH "^[^#]" def ${str}) - # Line is not commented - if (def) - # Extract the variable name - string(REGEX MATCH "^[^=]+" esmf_varname ${str}) - # Extract the variable's value - string(REGEX MATCH "=.+$" esmf_vardef ${str}) - # Only for variables with a defined value - if (esmf_vardef) - # Get rid of the assignment string - string(SUBSTRING ${esmf_vardef} 1 -1 esmf_vardef) - # Remove whitespace - string(STRIP ${esmf_vardef} esmf_vardef) - # A string or single-valued list - if(NOT DEFINED ESMF_MKGLOBALS) - # Set in global scope - set(${esmf_varname} ${esmf_vardef}) - # Don't display by default in GUI - mark_as_advanced(esmf_varname) - else() # Need to filter global promotion - foreach(m ${ESMF_MKGLOBALS}) - string(FIND ${esmf_varname} ${m} match) - # Found the string - if(NOT ${match} EQUAL -1) - # Promote to global scope - set(${esmf_varname} ${esmf_vardef}) - # Don't display by default in the GUI - mark_as_advanced (esmf_varname) - # No need to search for the current string filter - break() - endif() - endforeach() - endif() - endif() - endif() - endforeach() - - separate_arguments(ESMF_F90COMPILEPATHS NATIVE_COMMAND ${ESMF_F90COMPILEPATHS}) - foreach (ITEM ${ESMF_F90COMPILEPATHS}) - string(REGEX REPLACE "^-I" "" ITEM "${ITEM}") - list(APPEND tmp ${ITEM}) - endforeach() - set(ESMF_F90COMPILEPATHS ${tmp}) - - add_library(esmf UNKNOWN IMPORTED) - # Look for static library, if not found try dynamic library - find_library(esmf_lib NAMES libesmf.a PATHS ${ESMF_LIBSDIR}) - if(esmf_lib MATCHES "esmf_lib-NOTFOUND") - message(STATUS "Static ESMF library not found, searching for dynamic library instead") - find_library(esmf_lib NAMES esmf_fullylinked PATHS ${ESMF_LIBSDIR}) - if(esmf_lib MATCHES "esmf_lib-NOTFOUND") - message(FATAL_ERROR "Neither the dynamic nor the static ESMF library was found") - else() - message(STATUS "Found ESMF library: ${esmf_lib}") - endif() - set(ESMF_INTERFACE_LINK_LIBRARIES "") - else() - # When linking the static library, also need the ESMF linker flags; strip any leading/trailing whitespaces - string(STRIP "${ESMF_F90ESMFLINKRPATHS} ${ESMF_F90ESMFLINKPATHS} ${ESMF_F90LINKLIBS} ${ESMF_F90LINKOPTS}" ESMF_INTERFACE_LINK_LIBRARIES) - message(STATUS "Found ESMF library: ${esmf_lib}") - endif() - - set_target_properties(esmf PROPERTIES - IMPORTED_LOCATION ${esmf_lib} - INTERFACE_INCLUDE_DIRECTORIES "${ESMF_F90COMPILEPATHS}" - INTERFACE_LINK_LIBRARIES "${ESMF_INTERFACE_LINK_LIBRARIES}") - -endif() diff --git a/model/esmf/cmake/FindNetCDF.cmake b/model/esmf/cmake/FindNetCDF.cmake deleted file mode 100644 index 1439ae848..000000000 --- a/model/esmf/cmake/FindNetCDF.cmake +++ /dev/null @@ -1,337 +0,0 @@ -# (C) Copyright 2011- ECMWF. -# -# This software is licensed under the terms of the Apache Licence Version 2.0 -# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -# In applying this licence, ECMWF does not waive the privileges and immunities -# granted to it by virtue of its status as an intergovernmental organisation nor -# does it submit to any jurisdiction. - -# Try to find NetCDF includes and library. -# Supports static and shared libaries and allows each component to be found in sepearte prefixes. -# -# This module defines -# -# - NetCDF_FOUND - System has NetCDF -# - NetCDF_INCLUDE_DIRS - the NetCDF include directories -# - NetCDF_VERSION - the version of NetCDF -# - NetCDF_CONFIG_EXECUTABLE - the netcdf-config executable if found -# - NetCDF_PARALLEL - Boolean True if NetCDF4 has parallel IO support via hdf5 and/or pnetcdf -# - NetCDF_HAS_PNETCDF - Boolean True if NetCDF4 has pnetcdf support -# -# Deprecated Defines -# - NetCDF_LIBRARIES - [Deprecated] Use NetCDF::NetCDF_ targets instead. -# -# -# Following components are available: -# -# - C - C interface to NetCDF (netcdf) -# - CXX - CXX4 interface to NetCDF (netcdf_c++4) -# - Fortran - Fortran interface to NetCDF (netcdff) -# -# For each component the following are defined: -# -# - NetCDF__FOUND - whether the component is found -# - NetCDF__LIBRARIES - the libraries for the component -# - NetCDF__LIBRARY_SHARED - Boolean is true if libraries for component are shared -# - NetCDF__INCLUDE_DIRS - the include directories for specified component -# - NetCDF::NetCDF_ - target of component to be used with target_link_libraries() -# -# The following paths will be searched in order if set in CMake (first priority) or environment (second priority) -# -# - NetCDF_ROOT - root of NetCDF installation -# - NetCDF_PATH - root of NetCDF installation -# -# The search process begins with locating NetCDF Include headers. If these are in a non-standard location, -# set one of the following CMake or environment variables to point to the location: -# -# - NetCDF_INCLUDE_DIR or NetCDF_${comp}_INCLUDE_DIR -# - NetCDF_INCLUDE_DIRS or NetCDF_${comp}_INCLUDE_DIR -# -# Notes: -# -# - Use "NetCDF::NetCDF_" targets only. NetCDF_LIBRARIES exists for backwards compatibility and should not be used. -# - These targets have all the knowledge of include directories and library search directories, and a single -# call to target_link_libraries will provide all these transitive properties to your target. Normally all that is -# needed to build and link against NetCDF is, e.g.: -# target_link_libraries(my_c_tgt PUBLIC NetCDF::NetCDF_C) -# - "NetCDF" is always the preferred naming for this package, its targets, variables, and environment variables -# - For compatibility, some variables are also set/checked using alternate names NetCDF4, NETCDF, or NETCDF4 -# - Environments relying on these older environment variable names should move to using a "NetCDF_ROOT" environment variable -# - Preferred component capitalization follows the CMake LANGUAGES variables: i.e., C, Fortran, CXX -# - For compatibility, alternate capitalizations are supported but should not be used. -# - If no components are defined, all components will be searched -# - -list( APPEND _possible_components C CXX Fortran ) - -## Include names for each component -set( NetCDF_C_INCLUDE_NAME netcdf.h ) -set( NetCDF_CXX_INCLUDE_NAME netcdf ) -set( NetCDF_Fortran_INCLUDE_NAME netcdf.mod ) - -## Library names for each component -set( NetCDF_C_LIBRARY_NAME netcdf ) -set( NetCDF_CXX_LIBRARY_NAME netcdf_c++4 ) -set( NetCDF_Fortran_LIBRARY_NAME netcdff ) - -## Enumerate search components -foreach( _comp ${_possible_components} ) - string( TOUPPER "${_comp}" _COMP ) - set( _arg_${_COMP} ${_comp} ) - set( _name_${_COMP} ${_comp} ) -endforeach() - -set( _search_components C) -foreach( _comp ${${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS} ) - string( TOUPPER "${_comp}" _COMP ) - set( _arg_${_COMP} ${_comp} ) - list( APPEND _search_components ${_name_${_COMP}} ) - if( NOT _name_${_COMP} ) - message(SEND_ERROR "Find${CMAKE_FIND_PACKAGE_NAME}: COMPONENT ${_comp} is not a valid component. Valid components: ${_possible_components}" ) - endif() -endforeach() -list( REMOVE_DUPLICATES _search_components ) - -## Search hints for finding include directories and libraries -foreach( _comp IN ITEMS "_" "_C_" "_Fortran_" "_CXX_" ) - foreach( _name IN ITEMS NetCDF4 NetCDF NETCDF4 NETCDF ) - foreach( _var IN ITEMS ROOT PATH ) - list(APPEND _search_hints ${${_name}${_comp}${_var}} $ENV{${_name}${_comp}${_var}} ) - list(APPEND _include_search_hints - ${${_name}${_comp}INCLUDE_DIR} $ENV{${_name}${_comp}INCLUDE_DIR} - ${${_name}${_comp}INCLUDE_DIRS} $ENV{${_name}${_comp}INCLUDE_DIRS} ) - endforeach() - endforeach() -endforeach() -#Old-school HPC module env variable names -foreach( _name IN ITEMS NetCDF4 NetCDF NETCDF4 NETCDF ) - foreach( _comp IN ITEMS "_C" "_Fortran" "_CXX" ) - list(APPEND _search_hints ${${_name}} $ENV{${_name}}) - list(APPEND _search_hints ${${_name}${_comp}} $ENV{${_name}${_comp}}) - endforeach() -endforeach() - -## Find headers for each component -set(NetCDF_INCLUDE_DIRS) -set(_new_search_components) -foreach( _comp IN LISTS _search_components ) - if(NOT ${PROJECT_NAME}_NetCDF_${_comp}_FOUND) - list(APPEND _new_search_components ${_comp}) - endif() - find_file(NetCDF_${_comp}_INCLUDE_FILE - NAMES ${NetCDF_${_comp}_INCLUDE_NAME} - DOC "NetCDF ${_comp} include directory" - HINTS ${_include_search_hints} ${_search_hints} - PATH_SUFFIXES include include/netcdf - ) - mark_as_advanced(NetCDF_${_comp}_INCLUDE_FILE) - message(DEBUG "NetCDF_${_comp}_INCLUDE_FILE: ${NetCDF_${_comp}_INCLUDE_FILE}") - if( NetCDF_${_comp}_INCLUDE_FILE ) - get_filename_component(NetCDF_${_comp}_INCLUDE_FILE ${NetCDF_${_comp}_INCLUDE_FILE} ABSOLUTE) - get_filename_component(NetCDF_${_comp}_INCLUDE_DIR ${NetCDF_${_comp}_INCLUDE_FILE} DIRECTORY) - list(APPEND NetCDF_INCLUDE_DIRS ${NetCDF_${_comp}_INCLUDE_DIR}) - endif() -endforeach() -if(NetCDF_INCLUDE_DIRS) - list(REMOVE_DUPLICATES NetCDF_INCLUDE_DIRS) -endif() -set(NetCDF_INCLUDE_DIRS "${NetCDF_INCLUDE_DIRS}" CACHE STRING "NetCDF Include directory paths" FORCE) - -## Find n*-config executables for search components -foreach( _comp IN LISTS _search_components ) - if( _comp MATCHES "^(C)$" ) - set(_conf "c") - elseif( _comp MATCHES "^(Fortran)$" ) - set(_conf "f") - elseif( _comp MATCHES "^(CXX)$" ) - set(_conf "cxx4") - endif() - find_program( NetCDF_${_comp}_CONFIG_EXECUTABLE - NAMES n${_conf}-config - HINTS ${NetCDF_INCLUDE_DIRS} ${_include_search_hints} ${_search_hints} - PATH_SUFFIXES bin Bin ../bin ../../bin - DOC "NetCDF n${_conf}-config helper" ) - message(DEBUG "NetCDF_${_comp}_CONFIG_EXECUTABLE: ${NetCDF_${_comp}_CONFIG_EXECUTABLE}") -endforeach() - -set(_C_libs_flag --libs) -set(_Fortran_libs_flag --flibs) -set(_CXX_libs_flag --libs) -set(_C_includes_flag --includedir) -set(_Fortran_includes_flag --includedir) -set(_CXX_includes_flag --includedir) -function(netcdf_config exec flag output_var) - set(${output_var} False PARENT_SCOPE) - if( exec ) - execute_process( COMMAND ${exec} ${flag} RESULT_VARIABLE _ret OUTPUT_VARIABLE _val) - if( _ret EQUAL 0 ) - string( STRIP ${_val} _val ) - set( ${output_var} ${_val} PARENT_SCOPE ) - endif() - endif() -endfunction() - -## Find libraries for each component -set( NetCDF_LIBRARIES ) -foreach( _comp IN LISTS _search_components ) - string( TOUPPER "${_comp}" _COMP ) - - find_library( NetCDF_${_comp}_LIBRARY - NAMES ${NetCDF_${_comp}_LIBRARY_NAME} - DOC "NetCDF ${_comp} library" - HINTS ${NetCDF_${_comp}_INCLUDE_DIRS} ${_search_hints} - PATH_SUFFIXES lib64 lib ../lib64 ../lib ../../lib64 ../../lib ) - mark_as_advanced( NetCDF_${_comp}_LIBRARY ) - get_filename_component(NetCDF_${_comp}_LIBRARY ${NetCDF_${_comp}_LIBRARY} ABSOLUTE) - set(NetCDF_${_comp}_LIBRARY ${NetCDF_${_comp}_LIBRARY} CACHE STRING "NetCDF ${_comp} library" FORCE) - message(DEBUG "NetCDF_${_comp}_LIBRARY: ${NetCDF_${_comp}_LIBRARY}") - - if( NetCDF_${_comp}_LIBRARY ) - if( NetCDF_${_comp}_LIBRARY MATCHES ".a$" ) - set( NetCDF_${_comp}_LIBRARY_SHARED FALSE ) - set( _library_type STATIC) - else() - list( APPEND NetCDF_LIBRARIES ${NetCDF_${_comp}_LIBRARY} ) - set( NetCDF_${_comp}_LIBRARY_SHARED TRUE ) - set( _library_type SHARED) - endif() - endif() - - #Use nc-config to set per-component LIBRARIES variable if possible - netcdf_config( ${NetCDF_${_comp}_CONFIG_EXECUTABLE} ${_${_comp}_libs_flag} _val ) - if( _val ) - set( NetCDF_${_comp}_LIBRARIES ${_val} ) - if(NOT NetCDF_${_comp}_LIBRARY_SHARED AND NOT NetCDF_${_comp}_FOUND) #Static targets should use nc_config to get a proper link line with all necessary static targets. - list( APPEND NetCDF_LIBRARIES ${NetCDF_${_comp}_LIBRARIES} ) - endif() - else() - set( NetCDF_${_comp}_LIBRARIES ${NetCDF_${_comp}_LIBRARY} ) - if(NOT NetCDF_${_comp}_LIBRARY_SHARED) - message(SEND_ERROR "Unable to properly find NetCDF. Found static libraries at: ${NetCDF_${_comp}_LIBRARY} but could not run nc-config: ${NetCDF_CONFIG_EXECUTABLE}") - endif() - endif() - - #Use nc-config to set per-component INCLUDE_DIRS variable if possible - netcdf_config( ${NetCDF_${_comp}_CONFIG_EXECUTABLE} ${_${_comp}_includes_flag} _val ) - if( _val ) - string( REPLACE " " ";" _val ${_val} ) - set( NetCDF_${_comp}_INCLUDE_DIRS ${_val} ) - else() - set( NetCDF_${_comp}_INCLUDE_DIRS ${NetCDF_${_comp}_INCLUDE_DIR} ) - endif() - - if( NetCDF_${_comp}_LIBRARIES AND NetCDF_${_comp}_INCLUDE_DIRS ) - set( ${CMAKE_FIND_PACKAGE_NAME}_${_arg_${_COMP}}_FOUND TRUE ) - if (NOT TARGET NetCDF::NetCDF_${_comp}) - add_library(NetCDF::NetCDF_${_comp} ${_library_type} IMPORTED) - set_target_properties(NetCDF::NetCDF_${_comp} PROPERTIES - IMPORTED_LOCATION ${NetCDF_${_comp}_LIBRARY} - INTERFACE_INCLUDE_DIRECTORIES "${NetCDF_${_comp}_INCLUDE_DIRS}" - INTERFACE_LINK_LIBRARIES ${NetCDF_${_comp}_LIBRARIES} ) - endif() - endif() -endforeach() -if(NetCDF_LIBRARIES AND NetCDF_${_comp}_LIBRARY_SHARED) - list(REMOVE_DUPLICATES NetCDF_LIBRARIES) -endif() -set(NetCDF_LIBRARIES "${NetCDF_LIBRARIES}" CACHE STRING "NetCDF library targets" FORCE) - -## Find version via netcdf-config if possible -if (NetCDF_INCLUDE_DIRS) - if( NetCDF_C_CONFIG_EXECUTABLE ) - netcdf_config( ${NetCDF_C_CONFIG_EXECUTABLE} --version _vers ) - if( _vers ) - string(REGEX REPLACE ".* ((([0-9]+)\\.)+([0-9]+)).*" "\\1" NetCDF_VERSION "${_vers}" ) - endif() - else() - foreach( _dir IN LISTS NetCDF_INCLUDE_DIRS) - if( EXISTS "${_dir}/netcdf_meta.h" ) - file(STRINGS "${_dir}/netcdf_meta.h" _netcdf_version_lines - REGEX "#define[ \t]+NC_VERSION_(MAJOR|MINOR|PATCH|NOTE)") - string(REGEX REPLACE ".*NC_VERSION_MAJOR *\([0-9]*\).*" "\\1" _netcdf_version_major "${_netcdf_version_lines}") - string(REGEX REPLACE ".*NC_VERSION_MINOR *\([0-9]*\).*" "\\1" _netcdf_version_minor "${_netcdf_version_lines}") - string(REGEX REPLACE ".*NC_VERSION_PATCH *\([0-9]*\).*" "\\1" _netcdf_version_patch "${_netcdf_version_lines}") - string(REGEX REPLACE ".*NC_VERSION_NOTE *\"\([^\"]*\)\".*" "\\1" _netcdf_version_note "${_netcdf_version_lines}") - set(NetCDF_VERSION "${_netcdf_version_major}.${_netcdf_version_minor}.${_netcdf_version_patch}${_netcdf_version_note}") - unset(_netcdf_version_major) - unset(_netcdf_version_minor) - unset(_netcdf_version_patch) - unset(_netcdf_version_note) - unset(_netcdf_version_lines) - endif() - endforeach() - endif() -endif () - -## Detect additional package properties -netcdf_config(${NetCDF_C_CONFIG_EXECUTABLE} --has-parallel4 _val) -if( NOT _val MATCHES "^(yes|no)$" ) - netcdf_config(${NetCDF_C_CONFIG_EXECUTABLE} --has-parallel _val) -endif() -if( _val MATCHES "^(yes)$" ) - set(NetCDF_PARALLEL TRUE CACHE STRING "NetCDF has parallel IO capability via pnetcdf or hdf5." FORCE) -else() - set(NetCDF_PARALLEL FALSE CACHE STRING "NetCDF has no parallel IO capability." FORCE) -endif() - -## Finalize find_package -include(FindPackageHandleStandardArgs) - -if(NOT NetCDF_FOUND OR _new_search_components) - find_package_handle_standard_args( ${CMAKE_FIND_PACKAGE_NAME} - REQUIRED_VARS NetCDF_INCLUDE_DIRS NetCDF_LIBRARIES - VERSION_VAR NetCDF_VERSION - HANDLE_COMPONENTS ) -endif() - -foreach( _comp IN LISTS _search_components ) - if( NetCDF_${_comp}_FOUND ) - #Record found components to avoid duplication in NetCDF_LIBRARIES for static libraries - set(NetCDF_${_comp}_FOUND ${NetCDF_${_comp}_FOUND} CACHE BOOL "NetCDF ${_comp} Found" FORCE) - #Set a per-package, per-component found variable to communicate between multiple calls to find_package() - set(${PROJECT_NAME}_NetCDF_${_comp}_FOUND True) - endif() -endforeach() - -if( ${CMAKE_FIND_PACKAGE_NAME}_FOUND AND NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY AND _new_search_components) - message( STATUS "Find${CMAKE_FIND_PACKAGE_NAME} defines targets:" ) - message( STATUS " - NetCDF_VERSION [${NetCDF_VERSION}]") - message( STATUS " - NetCDF_PARALLEL [${NetCDF_PARALLEL}]") - foreach( _comp IN LISTS _new_search_components ) - string( TOUPPER "${_comp}" _COMP ) - message( STATUS " - NetCDF_${_comp}_CONFIG_EXECUTABLE [${NetCDF_${_comp}_CONFIG_EXECUTABLE}]") - if( ${CMAKE_FIND_PACKAGE_NAME}_${_arg_${_COMP}}_FOUND ) - get_filename_component(_root ${NetCDF_${_comp}_INCLUDE_DIR}/.. ABSOLUTE) - if( NetCDF_${_comp}_LIBRARY_SHARED ) - message( STATUS " - NetCDF::NetCDF_${_comp} [SHARED] [Root: ${_root}] Lib: ${NetCDF_${_comp}_LIBRARY} ") - else() - message( STATUS " - NetCDF::NetCDF_${_comp} [STATIC] [Root: ${_root}] Lib: ${NetCDF_${_comp}_LIBRARY} ") - endif() - endif() - endforeach() -endif() - -foreach( _prefix NetCDF NetCDF4 NETCDF NETCDF4 ${CMAKE_FIND_PACKAGE_NAME} ) - set( ${_prefix}_INCLUDE_DIRS ${NetCDF_INCLUDE_DIRS} ) - set( ${_prefix}_LIBRARIES ${NetCDF_LIBRARIES}) - set( ${_prefix}_VERSION ${NetCDF_VERSION} ) - set( ${_prefix}_FOUND ${${CMAKE_FIND_PACKAGE_NAME}_FOUND} ) - set( ${_prefix}_CONFIG_EXECUTABLE ${NetCDF_CONFIG_EXECUTABLE} ) - set( ${_prefix}_PARALLEL ${NetCDF_PARALLEL} ) - - foreach( _comp ${_search_components} ) - string( TOUPPER "${_comp}" _COMP ) - set( _arg_comp ${_arg_${_COMP}} ) - set( ${_prefix}_${_comp}_FOUND ${${CMAKE_FIND_PACKAGE_NAME}_${_arg_comp}_FOUND} ) - set( ${_prefix}_${_COMP}_FOUND ${${CMAKE_FIND_PACKAGE_NAME}_${_arg_comp}_FOUND} ) - set( ${_prefix}_${_arg_comp}_FOUND ${${CMAKE_FIND_PACKAGE_NAME}_${_arg_comp}_FOUND} ) - - set( ${_prefix}_${_comp}_LIBRARIES ${NetCDF_${_comp}_LIBRARIES} ) - set( ${_prefix}_${_COMP}_LIBRARIES ${NetCDF_${_comp}_LIBRARIES} ) - set( ${_prefix}_${_arg_comp}_LIBRARIES ${NetCDF_${_comp}_LIBRARIES} ) - - set( ${_prefix}_${_comp}_INCLUDE_DIRS ${NetCDF_${_comp}_INCLUDE_DIRS} ) - set( ${_prefix}_${_COMP}_INCLUDE_DIRS ${NetCDF_${_comp}_INCLUDE_DIRS} ) - set( ${_prefix}_${_arg_comp}_INCLUDE_DIRS ${NetCDF_${_comp}_INCLUDE_DIRS} ) - endforeach() -endforeach() diff --git a/model/esmf/run_w3adc.sh b/model/esmf/run_w3adc.sh deleted file mode 100755 index bef344bf4..000000000 --- a/model/esmf/run_w3adc.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -set -eux - -if [ $# -ne 2 ]; then - echo "Error in run_w3adc.sh" - exit 1 -fi - -ftn_dir=$1 -filename=$2 - -switches=$(cat ${ftn_dir}/../esmf/switch | tr '\n' ' ') - -extension="${filename##*.}" -basename="${filename%.*}" -inputname="${filename//\//_}.input" - -mkdir -p $( dirname ${filename} ) - -if [[ $extension == "ftn" ]]; then - echo "0 0" > ${inputname} - echo "'${ftn_dir}/${filename}' '${basename}.F90'" >> ${inputname} - echo "'${switches}'" >> ${inputname} - ./w3adc < ${inputname} -else - cp ${ftn_dir}/${filename} ${filename} -fi - -echo "Done running w3adc for ${filename}" diff --git a/regtests/ww3_tp2.17/input/switch_NO_PDLIB b/regtests/ww3_tp2.17/input/switch_NO_PDLIB index 3fde57a23..5b781103b 100644 --- a/regtests/ww3_tp2.17/input/switch_NO_PDLIB +++ b/regtests/ww3_tp2.17/input/switch_NO_PDLIB @@ -1 +1 @@ -NOGRB TRKNC DIST MPI SCRIP MLIM PR3 UQ FLX0 LN1 ST4 STAB0 NL1 BT4 DB1 TR0 BS0 IS0 IC0 REF0 WNT2 WNX1 RWND CRT1 CRX1 O0 O1 O2 O2a O2b O2c O3 O4 O5 O6 O7 +NCEP2 TRKNC DIST MPI SCRIP MLIM PR3 UQ FLX0 LN1 ST4 STAB0 NL1 BT4 DB1 TR0 BS0 IS0 IC0 REF0 WNT2 WNX1 RWND CRT1 CRX1 O0 O1 O2 O2a O2b O2c O3 O4 O5 O6 O7 diff --git a/regtests/ww3_tp2.17/input/switch_PDLIB b/regtests/ww3_tp2.17/input/switch_PDLIB index 4a8f93755..c87ee35b6 100644 --- a/regtests/ww3_tp2.17/input/switch_PDLIB +++ b/regtests/ww3_tp2.17/input/switch_PDLIB @@ -1 +1 @@ -NOGRB TRKNC DIST MPI SCRIP MLIM PR3 UQ FLX0 PDLIB LN1 ST4 STAB0 NL1 BT4 DB1 TR0 BS0 IS0 IC0 REF0 WNT2 WNX1 RWND CRT1 CRX1 O0 O1 O2 O2a O2b O2c O3 O4 O5 O6 O7 +NCEP2 TRKNC DIST MPI SCRIP MLIM PR3 UQ FLX0 PDLIB LN1 ST4 STAB0 NL1 BT4 DB1 TR0 BS0 IS0 IC0 REF0 WNT2 WNX1 RWND CRT1 CRX1 O0 O1 O2 O2a O2b O2c O3 O4 O5 O6 O7 diff --git a/regtests/ww3_ufs1.1/input/switch_MPI b/regtests/ww3_ufs1.1/input/switch_MPI index fc9261f35..c240ce930 100644 --- a/regtests/ww3_ufs1.1/input/switch_MPI +++ b/regtests/ww3_ufs1.1/input/switch_MPI @@ -1 +1 @@ -NCO NOGRB DIST MPI SCRIP SCRIPNC WRST PR3 UQ FLX0 SEED ST4 STAB0 NL1 BT1 DB1 MLIM FLD2 TR0 BS0 RWND WNX1 WNT1 CRX1 CRT1 O0 O1 O2 O3 O4 O5 O6 O7 O14 O15 IC0 IS0 REF0 +NCO NCEP2 DIST MPI SCRIP SCRIPNC WRST PR3 UQ FLX0 SEED ST4 STAB0 NL1 BT1 DB1 MLIM FLD2 TR0 BS0 RWND WNX1 WNT1 CRX1 CRT1 O0 O1 O2 O3 O4 O5 O6 O7 O14 O15 IC0 IS0 REF0 diff --git a/regtests/ww3_ufs1.1/input/switch_MPI_OMPH b/regtests/ww3_ufs1.1/input/switch_MPI_OMPH index 8be0a29a5..3ceffb710 100644 --- a/regtests/ww3_ufs1.1/input/switch_MPI_OMPH +++ b/regtests/ww3_ufs1.1/input/switch_MPI_OMPH @@ -1 +1 @@ -NCO NOGRB DIST MPI OMPG OMGH SCRIP SCRIPNC WRST PR3 UQ FLX0 SEED ST4 STAB0 NL1 BT1 DB1 MLIM FLD2 TR0 BS0 RWND WNX1 WNT1 CRX1 CRT1 O0 O1 O2 O3 O4 O5 O6 O7 O14 O15 IC0 IS0 REF0 +NCO NCEP2 DIST MPI OMPG OMGH SCRIP SCRIPNC WRST PR3 UQ FLX0 SEED ST4 STAB0 NL1 BT1 DB1 MLIM FLD2 TR0 BS0 RWND WNX1 WNT1 CRX1 CRT1 O0 O1 O2 O3 O4 O5 O6 O7 O14 O15 IC0 IS0 REF0 diff --git a/regtests/ww3_ufs1.2/input/switch_MPI_OMPH b/regtests/ww3_ufs1.2/input/switch_MPI_OMPH index 8be0a29a5..3ceffb710 100644 --- a/regtests/ww3_ufs1.2/input/switch_MPI_OMPH +++ b/regtests/ww3_ufs1.2/input/switch_MPI_OMPH @@ -1 +1 @@ -NCO NOGRB DIST MPI OMPG OMGH SCRIP SCRIPNC WRST PR3 UQ FLX0 SEED ST4 STAB0 NL1 BT1 DB1 MLIM FLD2 TR0 BS0 RWND WNX1 WNT1 CRX1 CRT1 O0 O1 O2 O3 O4 O5 O6 O7 O14 O15 IC0 IS0 REF0 +NCO NCEP2 DIST MPI OMPG OMGH SCRIP SCRIPNC WRST PR3 UQ FLX0 SEED ST4 STAB0 NL1 BT1 DB1 MLIM FLD2 TR0 BS0 RWND WNX1 WNT1 CRX1 CRT1 O0 O1 O2 O3 O4 O5 O6 O7 O14 O15 IC0 IS0 REF0 diff --git a/regtests/ww3_ufs1.3/input/switch_MPI_OMPH b/regtests/ww3_ufs1.3/input/switch_MPI_OMPH index 8be0a29a5..3ceffb710 100644 --- a/regtests/ww3_ufs1.3/input/switch_MPI_OMPH +++ b/regtests/ww3_ufs1.3/input/switch_MPI_OMPH @@ -1 +1 @@ -NCO NOGRB DIST MPI OMPG OMGH SCRIP SCRIPNC WRST PR3 UQ FLX0 SEED ST4 STAB0 NL1 BT1 DB1 MLIM FLD2 TR0 BS0 RWND WNX1 WNT1 CRX1 CRT1 O0 O1 O2 O3 O4 O5 O6 O7 O14 O15 IC0 IS0 REF0 +NCO NCEP2 DIST MPI OMPG OMGH SCRIP SCRIPNC WRST PR3 UQ FLX0 SEED ST4 STAB0 NL1 BT1 DB1 MLIM FLD2 TR0 BS0 RWND WNX1 WNT1 CRX1 CRT1 O0 O1 O2 O3 O4 O5 O6 O7 O14 O15 IC0 IS0 REF0