Skip to content

Commit be78296

Browse files
committed
Merge remote-tracking branch 'remotes/upstream/dev/ufs-weather-model' into feature/hafsv2p2_baseline
2 parents 7114597 + 2a96637 commit be78296

File tree

163 files changed

+13038
-9962
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

163 files changed

+13038
-9962
lines changed

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ if(hasParent)
1616
# Unset flags that come from Parent (ie UFS or other coupled build)
1717
# for potential (-r8/-r4) conflict
1818
set(CMAKE_Fortran_FLAGS "")
19+
if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$")
20+
set(CMAKE_Fortran_FLAGS_DEBUG "-check all -check noarg_temp_created -ftrapuv")
21+
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(IntelLLVM)$")
22+
set(CMAKE_Fortran_FLAGS_DEBUG "-check all -check noarg_temp_created -ftrapuv")
23+
else()
24+
message(WARNING "Fortran compiler with ID ${CMAKE_Fortran_COMPILER_ID} will be used with CMake default options")
25+
endif()
1926
set(CMAKE_C_FLAGS "")
2027
remove_definitions(-DDEBUG)
2128
endif()

cmake/FindSCOTCH.cmake

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,46 @@ find_package_handle_standard_args(
7777
REQUIRED_VARS ptscotchparmetis_lib
7878
ptscotchparmetis_inc)
7979

80+
81+
## Find version of scotch if possible
82+
if( EXISTS "${scotch_inc}/scotch.h" )
83+
84+
file(READ "${scotch_inc}/scotch.h" header_content)
85+
86+
# Extract the major version number using regex
87+
string(REGEX MATCH "SCOTCH_VERSION ([0-9]+)" VERSION_MAJOR_MATCH "${header_content}")
88+
if(VERSION_MAJOR_MATCH)
89+
set(SCOTCH_VERSION_MAJOR "${CMAKE_MATCH_1}")
90+
message(STATUS "SCOTCH_VERSION_MAJOR: ${SCOTCH_VERSION_MAJOR}")
91+
else()
92+
message(WARNING "Could not find SCOTCH_VERSION in scotch.h")
93+
endif()
94+
95+
# Extract the minor version number using regex
96+
string(REGEX MATCH "SCOTCH_RELEASE ([0-9]+)" VERSION_MINOR_MATCH "${header_content}")
97+
if(VERSION_MINOR_MATCH)
98+
set(SCOTCH_RELEASE "${CMAKE_MATCH_1}")
99+
message(STATUS "SCOTCH_RELEASE: ${SCOTCH_RELEASE}")
100+
else()
101+
message(WARNING "Could not find SCOTCH_RELEASE in scotch.h")
102+
endif()
103+
104+
# Extract the patch version number using regex
105+
string(REGEX MATCH "SCOTCH_PATCHLEVEL ([0-9]+)" VERSION_PATCH_MATCH "${header_content}")
106+
if(VERSION_PATCH_MATCH)
107+
set(SCOTCH_PATCHLEVEL "${CMAKE_MATCH_1}")
108+
message(STATUS "SCOTCH_PATCHLEVEL: ${SCOTCH_PATCHLEVEL}")
109+
else()
110+
message(WARNING "Could not find VERSION_PATCH in scotch.h")
111+
endif()
112+
set(SCOTCH_VERSION "${SCOTCH_VERSION_MAJOR}.${SCOTCH_RELEASE}.${SCOTCH_PATCHLEVEL}")
113+
endif()
114+
80115
message(STATUS "Found SCOTCH: ${scotch_lib}")
81116
message(STATUS "Found PTSCOTCH: ${ptscotch_lib}")
82117
message(STATUS "Found SCOTCHerr: ${scotcherr_lib}")
83118
message(STATUS "Found PTSCOTCHerr: ${ptscotcherr_lib}")
84119
message(STATUS "Found PTSCOTCHparmetis: ${ptscotchparmetis_lib}")
120+
message(STATUS "SCOTCH version: ${SCOTCH_VERSION}")
121+
122+

model/inp/ww3_grid.inp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,10 @@ $ P2SF : ......
528528
$ CALTYPE: Calendar type. The only accepted
529529
$ values are 'standard' (default),
530530
$ '365_day', or '360_day'.
531+
$ IC_NUMERICS: Logical variable (T/F). Set to T to
532+
$ allow the user to place the 'sea ice'
533+
$ source terms with other source terms
534+
$ Default is F (PR_1294)
531535
$
532536
$ Diagnostic Sea-state Dependent Stress- - - - - - - - - - - - - - - - -
533537
$ Reichl et al. 2014 : Namelist FLD1

model/inp/ww3_strt.inp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ $ ITYPE = 5 ---------------------------------------------------------- $
6767
$ Starting from calm conditions.
6868
$ - No additional data.
6969
$
70+
$ ITYPE = 6 ---------------------------------------------------------- $
71+
$ Similar to ITYPE = 3, but with manually specified fetch.
72+
$ - assumed fetch (m):
73+
$
74+
$ 5000
75+
$
7076
$ -------------------------------------------------------------------- $
7177
$ End of input file $
7278
$ -------------------------------------------------------------------- $

model/src/CMakeLists.txt

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,6 @@ elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Cray")
105105
set(compile_flags_debug -O0 -Rbcps -Ktrap=fp)
106106
endif()
107107

108-
target_compile_options(ww3_lib PUBLIC "$<$<COMPILE_LANGUAGE:Fortran>:${compile_flags}>")
109-
target_compile_options(ww3_lib PUBLIC "$<$<AND:$<CONFIG:Debug>,$<COMPILE_LANGUAGE:Fortran>>:${compile_flags_debug}>")
110-
target_compile_options(ww3_lib PUBLIC "$<$<AND:$<CONFIG:Release>,$<COMPILE_LANGUAGE:Fortran>>:${compile_flags_release}>")
111-
112108
# Executables to always build
113109
set(programs ww3_strt ww3_grid ww3_bound ww3_outf ww3_outp ww3_trck ww3_grib
114110
ww3_gint gx_outf gx_outp ww3_uprstr ww3_shel ww3_prep ww3_gspl ww3_multi ww3_systrk)
@@ -119,6 +115,8 @@ set(netcdf_programs ww3_ounf ww3_ounp ww3_bounc ww3_trnc ww3_prnc)
119115
if("OASIS" IN_LIST switches)
120116
find_package(OASIS REQUIRED)
121117
target_link_libraries(ww3_lib PUBLIC OASIS::OASIS)
118+
find_package(MPI REQUIRED COMPONENTS Fortran)
119+
target_link_libraries(ww3_lib PUBLIC MPI::MPI_Fortran)
122120
endif()
123121

124122
if(NETCDF)
@@ -169,28 +167,35 @@ if("OMPG" IN_LIST switches)
169167
target_link_libraries(ww3_lib PUBLIC OpenMP::OpenMP_Fortran)
170168
endif()
171169

172-
if("MPI" IN_LIST switches)
173-
find_package(MPI REQUIRED COMPONENTS Fortran)
174-
target_link_libraries(ww3_lib PUBLIC MPI::MPI_Fortran)
175-
endif()
176-
177170
if("PIO" IN_LIST switches)
178171
target_sources(ww3_lib PRIVATE ${pio_src})
179172
endif()
180173

181174
# Handle PDLIB, SCRIP, SCRIPNC build files directly instead of through configuration file
182175
if("PDLIB" IN_LIST switches)
183176
if("SCOTCH" IN_LIST switches)
184-
find_package(SCOTCH REQUIRED)
185-
target_sources(ww3_lib PRIVATE ${pdlib_src})
186-
target_link_libraries(ww3_lib PUBLIC PTSCOTCHparmetis::PTSCOTCHparmetis)
187-
elseif("METIS" IN_LIST switches)
188-
find_package(ParMETIS REQUIRED)
189-
target_sources(ww3_lib PRIVATE ${pdlib_src})
190-
target_link_libraries(ww3_lib PUBLIC ParMETIS::ParMETIS)
177+
find_package(SCOTCH REQUIRED)
178+
target_sources(ww3_lib PRIVATE ${pdlib_src})
179+
target_link_libraries(ww3_lib PUBLIC PTSCOTCHparmetis::PTSCOTCHparmetis)
180+
if(SCOTCH_VERSION VERSION_GREATER "7.0.6")
181+
list(APPEND compile_flags -DSCOTCH_707)
182+
list(APPEND compile_flags_release -DSCOTCH_707)
183+
list(APPEND compile_flags_debug -DSCOTCH_707)
184+
else()
185+
message(STATUS "SOCTCH version 7.06 or lower")
186+
endif()
187+
elseif("METIS" IN_LIST switches)
188+
find_package(ParMETIS REQUIRED)
189+
target_sources(ww3_lib PRIVATE ${pdlib_src})
190+
target_link_libraries(ww3_lib PUBLIC ParMETIS::ParMETIS)
191191
else()
192192
message(FATAL_ERROR "PDLIB requires METIS or SCOTCH library for domain decomposition")
193-
endif()
193+
endif()
194+
endif()
195+
196+
if("MPI" IN_LIST switches)
197+
find_package(MPI REQUIRED COMPONENTS Fortran)
198+
target_link_libraries(ww3_lib PUBLIC MPI::MPI_Fortran)
194199
endif()
195200

196201
if("SCRIP" IN_LIST switches)
@@ -224,6 +229,10 @@ foreach(program ${programs})
224229
target_link_libraries(${program} PRIVATE ww3_lib)
225230
endforeach()
226231

232+
target_compile_options(ww3_lib PUBLIC "$<$<COMPILE_LANGUAGE:Fortran>:${compile_flags}>")
233+
target_compile_options(ww3_lib PUBLIC "$<$<AND:$<CONFIG:Debug>,$<COMPILE_LANGUAGE:Fortran>>:${compile_flags_debug}>")
234+
target_compile_options(ww3_lib PUBLIC "$<$<AND:$<CONFIG:Release>,$<COMPILE_LANGUAGE:Fortran>>:${compile_flags_release}>")
235+
227236
install(
228237
TARGETS ${programs} ww3_lib
229238
EXPORT WW3Exports

model/src/PDLIB/yowpdlibmain.F90

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,13 +629,23 @@ subroutine runParmetis(MNP)
629629

630630
!if(debugParmetis) write(710+myrank,*) "Run ParMETIS now..."
631631
#ifdef W3_SCOTCH
632+
#ifdef SCOTCH_707
633+
! Starting with SCOTCH 7.0.7 need ot explicitly call the SCOTCHF
634+
call SCOTCHFParMETIS_V3_PartGeomKway(vtxdist, xadj, adjncy, &
635+
vwgt, & !vwgt - ignore weights
636+
adjwgt, & ! adjwgt - ignore weights
637+
wgtflag, &
638+
numflag,ndims,xyz,ncon,nparts,tpwgts,ubvec,options, &
639+
edgecut,part, comm,ref)
640+
#else
632641
call SCOTCH_ParMETIS_V3_PartGeomKway(vtxdist, xadj, adjncy, &
633642
vwgt, & !vwgt - ignore weights
634643
adjwgt, & ! adjwgt - ignore weights
635644
wgtflag, &
636645
numflag,ndims,xyz,ncon,nparts,tpwgts,ubvec,options, &
637646
edgecut,part, comm,ref)
638647
#endif
648+
#endif
639649

640650
#ifdef W3_METIS
641651
call ParMETIS_V3_PartGeomKway(vtxdist, xadj, adjncy, &

0 commit comments

Comments
 (0)