Skip to content

Commit

Permalink
Some more changes. Still not running. Work in progress.
Browse files Browse the repository at this point in the history
  • Loading branch information
dustinswales committed Sep 30, 2024
1 parent 6d1fecb commit 0613d69
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 28 deletions.
53 changes: 28 additions & 25 deletions scm/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ set(PROJECT "CCPP-SCM")
#------------------------------------------------------------------------------
get_filename_component(TEST_ROOT "${CMAKE_SOURCE_DIR}" DIRECTORY)
get_filename_component(CCPP_ROOT "${TEST_ROOT}" DIRECTORY)

#------------------------------------------------------------------------------
#
# Create list of SCHEME_FILES, HOST_FILES, and SUITE_FILES
Expand All @@ -21,9 +22,6 @@ get_filename_component(CCPP_ROOT "${TEST_ROOT}" DIRECTORY)
LIST(APPEND SCHEME_FILES "${CCPP_ROOT}/ccpp/config/scheme_files.txt")
LIST(APPEND HOST_FILES "${CCPP_ROOT}/ccpp/config/host_files.txt")
LIST(APPEND SUITE_FILES "${CCPP_ROOT}/ccpp/suites/suite_SCM_GFS_v16.xml")
# HOST is the name of the executable we will build.
# We assume there are files ${HOST}.meta and ${HOST}.F90 in CMAKE_SOURCE_DIR
SET(HOST "${CMAKE_PROJECT_NAME}")

#------------------------------------------------------------------------------
#
Expand All @@ -39,25 +37,30 @@ SET(CCPP_CAP_FILES "${CMAKE_BINARY_DIR}/ccpp" CACHE

SET(CCPP_FRAMEWORK ${CCPP_ROOT}/ccpp/framework/scripts)

ADD_COMPILE_OPTIONS(-O0)
# DJS2024: Haven't tested Capgen in DEBUG mode wtih SCM. *ToDo*
#ADD_COMPILE_OPTIONS(-O0)

if (${CMAKE_Fortran_COMPILER_ID} MATCHES "GNU")
MESSAGE(STATUS "gfortran being used.")
ADD_COMPILE_OPTIONS(-fcheck=all)
ADD_COMPILE_OPTIONS(-fbacktrace)
ADD_COMPILE_OPTIONS(-ffpe-trap=zero)
ADD_COMPILE_OPTIONS(-finit-real=nan)
ADD_COMPILE_OPTIONS(-ggdb)
ADD_COMPILE_OPTIONS(-ffree-line-length-none)
ADD_COMPILE_OPTIONS(-fbacktrace)
ADD_COMPILE_OPTIONS(-cpp)
ADD_COMPILE_OPTIONS(-fcray-pointer)
ADD_COMPILE_OPTIONS(-ffree-line-length-none)
ADD_COMPILE_OPTIONS(-fno-range-check)
elseif (${CMAKE_Fortran_COMPILER_ID} MATCHES "Intel")
MESSAGE(STATUS "ifort being used.")
#ADD_COMPILE_OPTIONS(-check all)
ADD_COMPILE_OPTIONS(-fpe0)
ADD_COMPILE_OPTIONS(-warn)
ADD_COMPILE_OPTIONS(-traceback)
ADD_COMPILE_OPTIONS(-debug extended)
ADD_COMPILE_OPTIONS(-fpp)
ADD_COMPILE_OPTIONS(-g)
ADD_COMPILE_OPTIONS(-fno-alias)
ADD_COMPILE_OPTIONS(-auto)
ADD_COMPILE_OPTIONS(-safe-cray-ptr)
ADD_COMPILE_OPTIONS(-ftz)
ADD_COMPILE_OPTIONS(-assume byterecl)
ADD_COMPILE_OPTIONS(-nowarn)
ADD_COMPILE_OPTIONS(-sox)
ADD_COMPILE_OPTIONS(-align)
else (${CMAKE_Fortran_COMPILER_ID} MATCHES "GNU")
message (WARNING "This program has only been compiled with gfortran and ifort. If another compiler is needed, the appropriate flags SHOULD be added in ${CMAKE_SOURCE_DIR}/CMakeLists.txt")
endif (${CMAKE_Fortran_COMPILER_ID} MATCHES "GNU")
Expand Down Expand Up @@ -381,24 +384,24 @@ SET(scm_source_files scm.F90
scm_output.F90
)

ADD_EXECUTABLE(ccpp_scm ${scm_source_files} ${CCPP_CAPS})
ADD_EXECUTABLE(scm ${scm_source_files} ${CCPP_CAPS})

if(OPENMP)
TARGET_LINK_LIBRARIES(ccpp_scm PUBLIC OpenMP::OpenMP_Fortran)
TARGET_LINK_LIBRARIES(scm PUBLIC OpenMP::OpenMP_Fortran)
endif()
TARGET_LINK_LIBRARIES(ccpp_scm NetCDF::NetCDF_Fortran)
TARGET_LINK_LIBRARIES(ccpp_scm bacio::bacio_4)
TARGET_LINK_LIBRARIES(ccpp_scm sp::sp_d)
TARGET_LINK_LIBRARIES(ccpp_scm w3emc::w3emc_d)
TARGET_LINK_LIBRARIES(ccpp_scm ccpp_framework)
TARGET_LINK_LIBRARIES(ccpp_scm ccpp_physics)
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)

SET_TARGET_PROPERTIES(ccpp_scm PROPERTIES
COMPILE_FLAGS "${CMAKE_Fortran_FLAGS}"
LINK_FLAGS "${CMAKE_Fortran_FLAGS}")
SET_TARGET_PROPERTIES(scm PROPERTIES
COMPILE_FLAGS "${CMAKE_Fortran_FLAGS}"
LINK_FLAGS "${CMAKE_Fortran_FLAGS}")

ADD_CUSTOM_COMMAND(
TARGET ccpp_scm POST_BUILD
TARGET scm POST_BUILD
COMMAND ${CMAKE_COMMAND} -E create_symlink
${CMAKE_SOURCE_DIR}/run_scm.py
${CMAKE_CURRENT_BINARY_DIR}/run_scm.py)
Expand Down
18 changes: 18 additions & 0 deletions scm/src/GFS_typedefs.meta
Original file line number Diff line number Diff line change
Expand Up @@ -5919,12 +5919,30 @@
units = count
dimensions = ()
type = integer
[nstf_name]
standard_name = configurations_for_nsstm
long_name = NSSTM configuration
units = flag
dimensions = (5)
type = integer
[nstf_name(index_to_control_for_nsstm)]
standard_name = control_for_nsstm
long_name = NSSTM flag: off/uncoupled/coupled=0/1/2
units = flag
dimensions = ()
type = integer
[nstf_name(index_for_nsstm_spinup)]
standard_name = control_for_nsstm_spinup
long_name = NSSTM control for spinup
units = flag
dimensions = ()
type = integer
[nstf_name(index_for_nsstm_analysis)]
standard_name = control_for_nsstm_analysis
long_name = NSSTM control for analysis
units = flag
dimensions = ()
type = integer
[nstf_name(index_for_lower_bound_for_depth_of_sea_temperature_for_nsstm)]
standard_name = lower_bound_for_depth_of_sea_temperature_for_nsstm
long_name = zsea1 in mm
Expand Down
2 changes: 1 addition & 1 deletion scm/src/scm.F90
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ subroutine scm_main_sub()
call physics%Diag%phys_zero (physics%Model)
endif

do isuite_part=1,len(ccpp_suite_parts)
do isuite_part=1,size(ccpp_suite_parts)
call ccpp_physics_run(suite_name = trim(trim(adjustl(scm_state%physics_suite_name))), &
suite_part = ccpp_suite_parts(isuite_part), &
physics = physics, &
Expand Down
4 changes: 2 additions & 2 deletions scm/src/scm_time_integration.F90
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ subroutine do_time_step(scm_state, physics, ccpp_cfg, in_spinup, ccpp_errflg, cc
call physics%Diag%phys_zero (physics%Model)
endif

do isuite_part=1,len(ccpp_suite_parts)
do isuite_part=1,size(ccpp_suite_parts)
call ccpp_physics_run(suite_name = trim(trim(adjustl(scm_state%physics_suite_name))), &
suite_part = ccpp_suite_parts(isuite_part), &
suite_part = trim(trim(adjustl(ccpp_suite_parts(isuite_part)))), &
physics = physics, &
ccpp_cfg = ccpp_cfg, &
errflg = ccpp_errflg, &
Expand Down

0 comments on commit 0613d69

Please sign in to comment.