From 4238bc82791f702966949a916575c749f23094bc Mon Sep 17 00:00:00 2001 From: Soren Rasmussen Date: Thu, 2 May 2024 15:03:03 -0600 Subject: [PATCH] Replacing exterior w3emc dependency with w3emc module built by CCPP Physics --- scm/src/CMakeLists.txt | 23 ++++++++++------------- scm/src/GFS_typedefs.F90 | 3 ++- scm/src/scm.F90 | 1 + scm/src/scm_input.F90 | 1 + 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/scm/src/CMakeLists.txt b/scm/src/CMakeLists.txt index 2ef20bb84..739c47617 100644 --- a/scm/src/CMakeLists.txt +++ b/scm/src/CMakeLists.txt @@ -50,7 +50,7 @@ else() RESULT_VARIABLE return_code ) endif() - + # Check return code from CCPP prebuild.py if(return_code EQUAL 0) message (STATUS "CCPP prebuild step completed successfully") @@ -70,7 +70,6 @@ SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/../../CMakeModule find_package(NetCDF REQUIRED COMPONENTS C Fortran) find_package(bacio REQUIRED) find_package(sp REQUIRED) -find_package(w3emc REQUIRED) SET(CCPP_FRAMEWORK_SRC ${CMAKE_SOURCE_DIR}/../../ccpp/framework) SET(CCPP_PHYSICS_SRC ${CMAKE_SOURCE_DIR}/../../ccpp/physics) @@ -130,15 +129,15 @@ set(SIMDMULTIARCH OFF CACHE BOOL "Enable multi-target SIMD instruction sets") # Set compile options if (${CMAKE_Fortran_COMPILER_ID} MATCHES "GNU") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ggdb -fbacktrace -cpp -fcray-pointer -ffree-line-length-none -fno-range-check") - + if(${CMAKE_Fortran_COMPILER_VERSION} VERSION_GREATER_EQUAL 10) set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fallow-argument-mismatch -fallow-invalid-boz") endif() - + if(NOT 32BIT) set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-real-8 -fdefault-double-8") endif() - + if (${CMAKE_BUILD_TYPE} MATCHES "Debug") set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -O0 -fno-unsafe-math-optimizations -frounding-math -fsignaling-nans -ffpe-trap=invalid,zero,overflow -fbounds-check") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0") @@ -146,7 +145,7 @@ if (${CMAKE_Fortran_COMPILER_ID} MATCHES "GNU") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -O2") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2") endif() - + set(CMAKE_C_FLAGS_RELEASE "-O2 -fPIC" CACHE STRING "" FORCE) set(CMAKE_Fortran_FLAGS_RELEASE "-O2 -fPIC" CACHE STRING "" FORCE) set(CMAKE_C_FLAGS_BITFORBIT "-O2 -fPIC" CACHE STRING "" FORCE) @@ -154,11 +153,11 @@ if (${CMAKE_Fortran_COMPILER_ID} MATCHES "GNU") elseif (${CMAKE_Fortran_COMPILER_ID} MATCHES "Intel") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -g -traceback -fpp -fno-alias -auto -safe-cray-ptr -ftz -assume byterecl -nowarn -sox -align array64byte -qno-opt-dynamic-align") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -qno-opt-dynamic-align -sox -fp-model source") - + if(NOT 32BIT) set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -real-size 64") endif() - + if (${CMAKE_BUILD_TYPE} MATCHES "Debug") set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -O0 -check -check noarg_temp_created -check nopointer -warn -warn noerrors -fp-stack-check -fstack-protector-all -fpe0 -debug -ftrapuv -init=snan,arrays") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -ftrapuv") @@ -181,7 +180,7 @@ elseif (${CMAKE_Fortran_COMPILER_ID} MATCHES "Intel") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=core-avx-i") endif() endif() - + set(CMAKE_C_FLAGS_RELEASE "-O2 -fPIC" CACHE STRING "" FORCE) set(CMAKE_Fortran_FLAGS_RELEASE "-O2 -fPIC" CACHE STRING "" FORCE) set(CMAKE_C_FLAGS_BITFORBIT "-O2 -fPIC" CACHE STRING "" FORCE) @@ -199,7 +198,7 @@ elseif (${CMAKE_Fortran_COMPILER_ID} MATCHES "NVHPC") if(NOT 32BIT) set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -r8") endif() - + if (${CMAKE_BUILD_TYPE} MATCHES "Debug") set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -O0 -g") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -g") @@ -211,7 +210,7 @@ elseif (${CMAKE_Fortran_COMPILER_ID} MATCHES "NVHPC") set(MPI_C_COMPILER mpicc) set(MPI_CXX_COMPILER mpicxx) set(MPI_Fortran_COMPILER mpif90) - + set(CMAKE_C_FLAGS_RELEASE "-O2 -fPIC" CACHE STRING "" FORCE) set(CMAKE_Fortran_FLAGS_RELEASE "-O2 -fPIC" CACHE STRING "" FORCE) set(CMAKE_C_FLAGS_BITFORBIT "-O2 -fPIC" CACHE STRING "" FORCE) @@ -279,7 +278,6 @@ endif() TARGET_LINK_LIBRARIES(scm NetCDF::NetCDF_Fortran) TARGET_LINK_LIBRARIES(scm bacio::bacio_4) TARGET_LINK_LIBRARIES(scm sp::sp_d) -TARGET_LINK_LIBRARIES(scm w3emc::w3emc_d) TARGET_LINK_LIBRARIES(scm ccpp_framework) TARGET_LINK_LIBRARIES(scm ccpp_physics) @@ -292,4 +290,3 @@ ADD_CUSTOM_COMMAND( COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_SOURCE_DIR}/run_scm.py ${CMAKE_CURRENT_BINARY_DIR}/run_scm.py) - diff --git a/scm/src/GFS_typedefs.F90 b/scm/src/GFS_typedefs.F90 index 2e822487a..cff32d1ba 100644 --- a/scm/src/GFS_typedefs.F90 +++ b/scm/src/GFS_typedefs.F90 @@ -1,7 +1,8 @@ module GFS_typedefs use machine, only: kind_phys, kind_dbl_prec, kind_sngl_prec - + use w3emc, only: w3difdat, w3kind + use module_radsw_parameters, only: topfsw_type, sfcfsw_type use module_radlw_parameters, only: topflw_type, sfcflw_type use h2o_def, only: levh2o, h2o_coeff diff --git a/scm/src/scm.F90 b/scm/src/scm.F90 index ba152f1c1..9c990db10 100644 --- a/scm/src/scm.F90 +++ b/scm/src/scm.F90 @@ -15,6 +15,7 @@ subroutine scm_main_sub() use scm_time_integration use scm_output use scm_type_defs + use w3emc, only: w3movdat use :: ccpp_static_api, & only: ccpp_physics_init, & diff --git a/scm/src/scm_input.F90 b/scm/src/scm_input.F90 index cc3effcd5..a913caaa4 100644 --- a/scm/src/scm_input.F90 +++ b/scm/src/scm_input.F90 @@ -7,6 +7,7 @@ module scm_input use scm_kinds, only : sp, dp, qp use netcdf use scm_type_defs, only: character_length +use w3emc, only: w3difdat implicit none