Skip to content

Commit

Permalink
Merge pull request #106 from climbfuji/update_gsl_develop_from_main_2…
Browse files Browse the repository at this point in the history
…0210921

Update gsl/develop from main 2021/09/21
  • Loading branch information
DomHeinzeller authored Sep 22, 2021
2 parents 1263361 + 08cd1e2 commit 097597a
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 57 deletions.
57 changes: 16 additions & 41 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ endif (NOT PROJECT)
#------------------------------------------------------------------------------
cmake_minimum_required(VERSION 3.0)

project(ccppphys
VERSION 4.0.0
LANGUAGES C CXX Fortran)
project(ccpp_physics
VERSION 5.0.0
LANGUAGES Fortran)

# Use rpaths on MacOSX
set(CMAKE_MACOSX_RPATH 1)
Expand All @@ -31,25 +31,9 @@ set(AUTHORS "Grant Firl" "Dom Heinzeller" "Man Zhang" "Laurie Carson")
if (OPENMP)
include(detect_openmp)
detect_openmp()
#set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
#set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
#set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${OpenMP_Fortran_FLAGS}")
message(STATUS "Enable OpenMP support for C/C++/Fortran compiler")
message(STATUS "Enable OpenMP support")
else (OPENMP)
message (STATUS "Disable OpenMP support for C/C++/Fortran compiler")
endif()

#------------------------------------------------------------------------------
# The Fortran compiler/linker flag inserted by cmake to create shared libraries
# with the Intel compiler is deprecated (-i_dynamic), correct here.
# CMAKE_Fortran_COMPILER_ID = {"Intel", "PGI", "GNU", "Clang", "MSVC", ...}
if ("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "Intel")
string(REPLACE "-i_dynamic" "-shared-intel"
CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS
"${CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS}")
string(REPLACE "-i_dynamic" "-shared-intel"
CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS
"${CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS}")
message (STATUS "Disable OpenMP support")
endif()

#------------------------------------------------------------------------------
Expand Down Expand Up @@ -321,22 +305,8 @@ else()
message (FATAL_ERROR "This program has only been compiled with gfortran, pgf90 and ifort. If another compiler is needed, the appropriate flags must be added in ${GFS_PHYS_SRC}/CMakeLists.txt")
endif()

# The auto-generated caps can contain calls to physics schemes in
# which some of the arguments (pointers, arrays) are not associated/allocated.
# This is on purpose to avoid allocating fields that are not used inside the
# scheme if, for example, certain conditions are not met. To avoid
# Fortran runtime errors, it is necessary to remove checks for pointers
# that are not associated and for array bounds from the caps ONLY. For the
# physics schemes, these checks can and should remain enabled. Overwriting
# the pointer check flags explicitly works for Intel and GNU, but not for PGI.
if (${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU")
set_property(SOURCE ${CAPS} APPEND_STRING PROPERTY COMPILE_FLAGS " -fcheck=no-pointer,no-bounds ")
elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel")
set_property(SOURCE ${CAPS} APPEND_STRING PROPERTY COMPILE_FLAGS " -check nopointers,nobounds ")
endif ()

#------------------------------------------------------------------------------
add_library(ccppphys STATIC ${SCHEMES} ${SCHEMES_SFX_OPT} ${CAPS})
add_library(ccpp_physics STATIC ${SCHEMES} ${SCHEMES_SFX_OPT} ${CAPS})
# Generate list of Fortran modules from defined sources
foreach(source_f90 ${CAPS})
get_filename_component(tmp_source_f90 ${source_f90} NAME)
Expand All @@ -345,20 +315,25 @@ foreach(source_f90 ${CAPS})
list(APPEND MODULES_F90 ${CMAKE_CURRENT_BINARY_DIR}/${module_f90})
endforeach()

set_target_properties(ccppphys PROPERTIES VERSION ${PROJECT_VERSION}
set_target_properties(ccpp_physics PROPERTIES VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR})

target_include_directories(ccpp_physics PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)

target_link_libraries(ccpp_physics PUBLIC w3nco::w3nco_d NetCDF::NetCDF_Fortran)

if (PROJECT STREQUAL "CCPP-FV3")
# Define where to install the library
install(TARGETS ccppphys
EXPORT ccppphys-targets
install(TARGETS ccpp_physics
EXPORT ccpp_physics-targets
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION lib
)
# Export our configuration
install(EXPORT ccppphys-targets
FILE ccppphys-config.cmake
install(EXPORT ccpp_physics-targets
FILE ccpp_physics-config.cmake
DESTINATION lib/cmake
)
# Define where to install the C headers and Fortran modules
Expand Down
10 changes: 5 additions & 5 deletions physics/GFS_DCNV_generic.meta
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@
standard_name = convective_transportable_tracers
long_name = array to contain cloud water and other convective trans. tracers
units = kg kg-1
dimensions = (horizontal_loop_extent,vertical_dimension,number_of_tracers_for_convective_transport)
dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_tracers_for_convective_transport)
type = real
kind = kind_phys
intent = in
Expand Down Expand Up @@ -477,7 +477,7 @@
standard_name = cumulative_change_of_state_variables
long_name = diagnostic tendencies for state variables
units = various
dimensions = (horizontal_loop_extent,vertical_dimension,number_of_cumulative_change_processes)
dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_cumulative_change_processes)
type = real
kind = kind_phys
intent = inout
Expand Down Expand Up @@ -534,7 +534,7 @@
standard_name = tracer_concentration_of_new_state
long_name = tracer concentration updated by physics
units = kg kg-1
dimensions = (horizontal_loop_extent,vertical_dimension,number_of_tracers)
dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_tracers)
type = real
kind = kind_phys
intent = in
Expand All @@ -543,7 +543,7 @@
standard_name = tracer_concentration_save
long_name = tracer concentration before entering a physics scheme
units = kg kg-1
dimensions = (horizontal_loop_extent,vertical_dimension,number_of_tracers)
dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_tracers)
type = real
kind = kind_phys
intent = in
Expand Down Expand Up @@ -778,7 +778,7 @@
standard_name = convective_transportable_tracers
long_name = array to contain cloud water and other convective trans. tracers
units = kg kg-1
dimensions = (horizontal_loop_extent,vertical_dimension,number_of_tracers_for_convective_transport)
dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_tracers_for_convective_transport)
type = real
kind = kind_phys
intent = in
Expand Down
4 changes: 2 additions & 2 deletions physics/GFS_MP_generic.meta
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@
standard_name = cumulative_change_of_state_variables
long_name = diagnostic tendencies for state variables
units = various
dimensions = (horizontal_loop_extent,vertical_dimension,number_of_cumulative_change_processes)
dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_cumulative_change_processes)
type = real
kind = kind_phys
intent = inout
Expand All @@ -832,7 +832,7 @@
standard_name = cumulative_change_of_state_variables_outer_index
long_name = index of state-variable and process in last dimension of diagnostic tendencies array AKA cumulative_change_index
units = index
dimensions = (number_of_tracers_plus_one_hundred,number_of_causes)
dimensions = (number_of_tracers_plus_one_hundred,number_of_cumulative_change_processes)
type = integer
intent = in
optional = F
Expand Down
2 changes: 1 addition & 1 deletion physics/GFS_PBL_generic.meta
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@
standard_name = cumulative_change_of_state_variables
long_name = diagnostic tendencies for state variables
units = various
dimensions = (horizontal_loop_extent,vertical_dimension,number_of_cumulative_change_processes)
dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_cumulative_change_processes)
type = real
kind = kind_phys
intent = inout
Expand Down
2 changes: 1 addition & 1 deletion physics/GFS_SCNV_generic.meta
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@
standard_name = convective_transportable_tracers
long_name = array to contain cloud water and other convective trans. tracers
units = kg kg-1
dimensions = (horizontal_loop_extent,vertical_dimension,number_of_tracers_for_convective_transport)
dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_tracers_for_convective_transport)
type = real
kind = kind_phys
intent = in
Expand Down
2 changes: 1 addition & 1 deletion physics/GFS_rrtmg_pre.meta
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@
standard_name = surface_stochastic_weights_from_coupled_process
long_name = weights for stochastic surface physics perturbation
units = none
dimensions = (horizontal_loop_extent,number_of_surface_perturbations)
dimensions = (horizontal_loop_extent,number_of_perturbed_land_surface_variables)
type = real
kind = kind_phys
intent = in
Expand Down
10 changes: 5 additions & 5 deletions physics/GFS_suite_interstitial.meta
Original file line number Diff line number Diff line change
Expand Up @@ -1605,7 +1605,7 @@
standard_name = liquid_cloud_number_concentration_save
long_name = liquid cloud number concentration before entering a physics scheme
units = kg kg-1
dimensions = (horizontal_loop_extent,vertical_dimension)
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
intent = inout
Expand All @@ -1614,7 +1614,7 @@
standard_name = ice_cloud_number_concentration_save
long_name = ice cloud number concentration before entering a physics scheme
units = kg kg-1
dimensions = (horizontal_loop_extent,vertical_dimension)
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
intent = inout
Expand Down Expand Up @@ -1886,7 +1886,7 @@
standard_name = liquid_cloud_number_concentration_save
long_name = liquid cloud number concentration before entering a physics scheme
units = kg kg-1
dimensions = (horizontal_loop_extent,vertical_dimension)
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
intent = in
Expand All @@ -1895,7 +1895,7 @@
standard_name = ice_cloud_number_concentration_save
long_name = ice cloud number concentration before entering a physics scheme
units = kg kg-1
dimensions = (horizontal_loop_extent,vertical_dimension)
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
intent = in
Expand Down Expand Up @@ -1993,7 +1993,7 @@
standard_name = cumulative_change_of_state_variables
long_name = diagnostic tendencies for state variables
units = various
dimensions = (horizontal_loop_extent,vertical_dimension,number_of_cumulative_change_processes)
dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_cumulative_change_processes)
type = real
kind = kind_phys
intent = inout
Expand Down
2 changes: 1 addition & 1 deletion physics/drag_suite.meta
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@
standard_name = cumulative_change_of_state_variables
long_name = diagnostic tendencies for state variables
units = various
dimensions = (horizontal_loop_extent,vertical_dimension,number_of_cumulative_change_processes)
dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_cumulative_change_processes)
type = real
kind = kind_phys
active = (flag_for_diagnostics_3D)
Expand Down
2 changes: 2 additions & 0 deletions physics/sfcsub.F
Original file line number Diff line number Diff line change
Expand Up @@ -2019,12 +2019,14 @@ subroutine sfccycle(lugb,len,lsoil,sig1t,deltsfc &
! *,' tsffcs=',tsffcs(iprnt),' slianl=',slianl(iprnt)

do i=1,len
if (nint(slmskl(i)) /= 1) then
if (sicanl(i) >= min_ice(i)) then
slianl(i) = 2.0_kind_io8
else
slianl(i) = zero
sicanl(i) = zero
endif
endif
enddo

if (fh-deltsfc > -0.001 ) then
Expand Down

0 comments on commit 097597a

Please sign in to comment.