diff --git a/hydro/CMakeLists.txt b/hydro/CMakeLists.txt index 5cf8615149..2c566b6f64 100644 --- a/hydro/CMakeLists.txt +++ b/hydro/CMakeLists.txt @@ -1,12 +1,20 @@ -# additions that WRF-Hydro's top CMakeLists.txt handles -add_compile_options( "${PROJECT_COMPILE_OPTIONS}" ) -add_compile_definitions( "${PROJECT_COMPILE_DEFINITIONS}" ) -set(CMAKE_Fortran_MODULE_DIRECTORY ${PROJECT_BINARY_DIR}/hydro/mods) -add_definitions(-DMPP_LAND) -if (WRF_HYDRO_NUDGING STREQUAL "1") - add_definitions(-DWRF_HYDRO_NUDGING=1) +if(${PROJECT_NAME} STREQUAL "WRF") + # additions that WRF-Hydro's top CMakeLists.txt handles + add_compile_options( "${PROJECT_COMPILE_OPTIONS}" ) + add_compile_definitions( "${PROJECT_COMPILE_DEFINITIONS}" ) + set(CMAKE_Fortran_MODULE_DIRECTORY ${PROJECT_BINARY_DIR}/hydro/mods) + add_definitions(-DMPP_LAND) + if (WRF_HYDRO_NUDGING STREQUAL "1") + add_definitions(-DWRF_HYDRO_NUDGING=1) + endif() + if (OUTPUT_CHAN_CONN STREQUAL "1" ) + add_definitions(-DOUTPUT_CHAN_CONN) + # requires nudging io module + set(WRF_HYDRO_NUDGING_IO "1") + endif() endif() + # build the various sup-projects add_subdirectory("MPP") add_subdirectory("utils") @@ -16,10 +24,19 @@ add_subdirectory("Debug_Utilities") add_subdirectory("Routing/Overland") add_subdirectory("Routing/Subsurface") add_subdirectory("Routing/Reservoirs") +add_subdirectory("Routing/Diversions") add_subdirectory("Data_Rec") add_subdirectory("Routing") add_subdirectory("HYDRO_drv") -add_subdirectory("CPL/WRF_cpl") +if(${PROJECT_NAME} STREQUAL "WRF") + add_subdirectory("CPL/WRF_cpl") +endif() + +if (WRF_HYDRO_NUDGING_IO STREQUAL "1" OR + WRF_HYDRO_NUDGING STREQUAL "1") + add_subdirectory("nudging/io") + add_dependencies(hydro_routing hydro_nudging_io) +endif() if (WRF_HYDRO_NUDGING STREQUAL "1") add_subdirectory("nudging") @@ -27,6 +44,10 @@ if (WRF_HYDRO_NUDGING STREQUAL "1") add_dependencies(hydro_driver hydro_nudging) endif() +if (WRF_HYDRO_NUOPC STREQUAL "1") + add_subdirectory("CPL/NUOPC_cpl") +endif() + # add module dependencies add_dependencies(hydro_debug_utils hydro_mpp) add_dependencies(hydro_utils hydro_mpp) @@ -75,21 +96,164 @@ add_dependencies(hydro_data_rec hydro_routing_reservoirs ) -add_library(wrfhydro INTERFACE) -target_link_libraries(wrfhydro INTERFACE - hydro_utils - hydro_mpp - hydro_debug_utils - hydro_routing_overland - hydro_routing_subsurface - hydro_data_rec - hydro_routing - hydro_routing_reservoirs_levelpool - hydro_routing_reservoirs_hybrid - hydro_routing_reservoirs_rfc - hydro_routing_reservoirs - hydro_wrf_cpl - hydro_orchestrator - hydro_netcdf_layer - hydro_driver -) +if (HYDRO_LSM MATCHES "NoahMP") + message("-- Building NoahMP LSM") + add_subdirectory("Land_models/NoahMP") + + add_subdirectory("CPL/NoahMP_cpl") + add_dependencies(hydro_noahmp_cpl hydro_routing) + add_dependencies(hydro_noahmp_cpl hydro_mpp ) + add_dependencies(hydro_noahmp_cpl hydro_driver ) + + add_executable(wrfhydro + Land_models/NoahMP/IO_code/main_hrldas_driver.F + Land_models/NoahMP/IO_code/module_hrldas_netcdf_io.F + Land_models/NoahMP/IO_code/module_NoahMP_hrldas_driver.F + ) + + target_include_directories(wrfhydro BEFORE PUBLIC ${PROJECT_BINARY_DIR}/mods) + + target_link_libraries(wrfhydro + hydro_utils + hydro_mpp + hydro_debug_utils + hydro_routing_overland + hydro_routing_subsurface + hydro_data_rec + hydro_routing + hydro_routing_reservoirs_levelpool + hydro_routing_reservoirs_hybrid + hydro_routing_reservoirs_rfc + hydro_routing_reservoirs + hydro_driver + noahmp_util + noahmp_phys + noahmp_data + hydro_noahmp_cpl + ${NETCDF_LIBRARIES} + # hydro_routing_groundwater + # hydro_routing_groundwater_bucket + # hydro_routing_groundwater_nhd + # hydro_routing_groundwater_simple + ) + + if (WRF_HYDRO_NUDGING_IO STREQUAL "1") + target_link_libraries(wrfhydro hydro_nudging_io) + add_dependencies(wrfhydro hydro_nudging_io) + endif() + + if (WRF_HYDRO_NUDGING STREQUAL "1") + target_link_libraries(wrfhydro hydro_nudging) + target_link_libraries(wrfhydro hydro_routing_diversions) + add_dependencies(wrfhydro hydro_nudging) + add_dependencies(wrfhydro hydro_routing_diversions) + endif() + + # bash commands to copy namelists to the Run directory + set(BASH_CP_HRLDAS_NML "if [[ ! -f ${CMAKE_BINARY_DIR}/Run/namelist.hrldas ]]\; then cp ${PROJECT_SOURCE_DIR}/src/template/NoahMP/namelist.hrldas ${CMAKE_BINARY_DIR}/Run \; fi\;") + set(BASH_CP_HYDRO_NML "if [[ ! -f ${CMAKE_BINARY_DIR}/Run/hydro.namelist ]]\; then cp ${PROJECT_SOURCE_DIR}/src/template/HYDRO/hydro.namelist ${CMAKE_BINARY_DIR}/Run \; fi\;") + + add_custom_command(TARGET wrfhydro POST_BUILD + COMMAND mkdir -p ${CMAKE_BINARY_DIR}/Run + COMMAND cp ${PROJECT_SOURCE_DIR}/tests/ctests/run_dir_makefile.mk ${CMAKE_BINARY_DIR}/Run/Makefile + # copy tables + COMMAND cp ${PROJECT_SOURCE_DIR}/src/template/HYDRO/CHANPARM.TBL ${CMAKE_BINARY_DIR}/Run + COMMAND cp ${PROJECT_SOURCE_DIR}/src/template/HYDRO/HYDRO.TBL ${CMAKE_BINARY_DIR}/Run + COMMAND cp ${PROJECT_SOURCE_DIR}/src/Land_models/NoahMP/run/*.TBL ${CMAKE_BINARY_DIR}/Run + # copy namelists + COMMAND bash -c "${BASH_CP_HRLDAS_NML}" + COMMAND bash -c "${BASH_CP_HYDRO_NML}" + # copy and setup executables + COMMAND rm -f ${CMAKE_BINARY_DIR}/Run/wrf_hydro + COMMAND rm -f ${CMAKE_BINARY_DIR}/Run/wrf_hydro_NoahMP + COMMAND cp ${PROJECT_BINARY_DIR}/src/wrfhydro ${CMAKE_BINARY_DIR}/Run/wrf_hydro + COMMAND ln -sf ${CMAKE_BINARY_DIR}/Run/wrf_hydro ${CMAKE_BINARY_DIR}/Run/wrf_hydro_NoahMP + COMMAND rm ${PROJECT_BINARY_DIR}/src/wrfhydro + ) + if(WRF_HYDRO_CREATE_EXE_SYMLINK) + add_custom_command(TARGET wrfhydro POST_BUILD + COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/Run/wrf_hydro ${CMAKE_BINARY_DIR}/Run/wrf_hydro.exe + ) + endif() + +elseif (HYDRO_LSM MATCHES "Noah") + message("-- Building Noah LSM") + add_subdirectory("Land_models/Noah") + add_subdirectory("CPL/Noah_cpl") + + add_dependencies(hydro_noah_cpl hydro_routing) + add_dependencies(hydro_noah_cpl hydro_mpp ) + add_dependencies(hydro_noah_cpl hydro_driver ) + + add_executable(wrfhydro + Land_models/Noah/IO_code/module_hrldas_netcdf_io.F + Land_models/Noah/IO_code/Noah_hrldas_driver.F + ) + + target_include_directories(wrfhydro BEFORE PUBLIC ${PROJECT_BINARY_DIR}/mods) + + target_link_libraries(wrfhydro + hydro_utils + hydro_mpp + hydro_debug_utils + hydro_routing_overland + hydro_routing_subsurface + hydro_data_rec + hydro_routing + hydro_driver + hydro_routing_reservoirs_levelpool + hydro_routing_reservoirs_hybrid + hydro_routing_reservoirs_rfc + hydro_routing_reservoirs + noah_util + noah + hydro_noah_cpl + ${NETCDF_LIBRARIES} + ${MPI_Fortran_LIBRARIES} + # hydro_routing_groundwater + # hydro_routing_groundwater_bucket + # hydro_routing_groundwater_nhd + # hydro_routing_groundwater_simple + ) + + if (WRF_HYDRO_NUDGING STREQUAL "1") + target_link_libraries(wrfhydro hydro_nudging) + add_dependencies(wrfhydro hydro_nudging) + endif() + + add_custom_command(TARGET wrfhydro POST_BUILD + COMMAND mkdir -p ${CMAKE_BINARY_DIR}/Run + COMMAND rm -f ${CMAKE_BINARY_DIR}/Run/* + COMMAND cp ${PROJECT_BINARY_DIR}/src/wrfhydro ${CMAKE_BINARY_DIR}/Run/wrf_hydro_Noah + COMMAND cp ${PROJECT_SOURCE_DIR}/src/template/Noah/* ${CMAKE_BINARY_DIR}/Run + COMMAND cp ${PROJECT_SOURCE_DIR}/src/template/HYDRO/CHANPARM.TBL ${CMAKE_BINARY_DIR}/Run + COMMAND cp ${PROJECT_SOURCE_DIR}/src/template/HYDRO/hydro.namelist ${CMAKE_BINARY_DIR}/Run + COMMAND cp ${PROJECT_SOURCE_DIR}/src/template/HYDRO/HYDRO.TBL ${CMAKE_BINARY_DIR}/Run + COMMAND cp ${PROJECT_SOURCE_DIR}/src/Land_models/Noah/Run/*.TBL ${CMAKE_BINARY_DIR}/Run + COMMAND ln -sf ${CMAKE_BINARY_DIR}/Run/wrf_hydro_Noah ${CMAKE_BINARY_DIR}/Run/wrf_hydro + COMMAND ln -sf ${CMAKE_BINARY_DIR}/Run/wrf_hydro_Noah ${CMAKE_BINARY_DIR}/Run/wrf_hydro.exe + COMMAND rm ${PROJECT_BINARY_DIR}/src/wrfhydro + ) + +elseif(${PROJECT_NAME} STREQUAL "WRF") + add_library(wrfhydro INTERFACE) + target_link_libraries(wrfhydro INTERFACE + hydro_utils + hydro_mpp + hydro_debug_utils + hydro_routing_overland + hydro_routing_subsurface + hydro_data_rec + hydro_routing + hydro_routing_reservoirs_levelpool + hydro_routing_reservoirs_hybrid + hydro_routing_reservoirs_rfc + hydro_routing_reservoirs + hydro_wrf_cpl + hydro_orchestrator + hydro_netcdf_layer + hydro_driver + ) +else() + message("Unknown land surface model:" ${HYDRO_LSM} ) +endif() diff --git a/hydro/CPL/WRF_cpl/CMakeLists.txt b/hydro/CPL/WRF_cpl/CMakeLists.txt index c98d242ddc..78ff27a6d6 100644 --- a/hydro/CPL/WRF_cpl/CMakeLists.txt +++ b/hydro/CPL/WRF_cpl/CMakeLists.txt @@ -14,7 +14,7 @@ add_dependencies(hydro_wrf_cpl MPI::MPI_Fortran ) -target_link_libraries( hydro_wrf_cpl PRIVATE hydro_driver ) +target_link_libraries(hydro_wrf_cpl PRIVATE hydro_driver) target_include_directories(hydro_wrf_cpl PRIVATE diff --git a/hydro/Data_Rec/module_namelist.F90 b/hydro/Data_Rec/module_namelist.F90 index c72a4275d3..083aee4ece 100644 --- a/hydro/Data_Rec/module_namelist.F90 +++ b/hydro/Data_Rec/module_namelist.F90 @@ -33,6 +33,7 @@ subroutine read_rt_nlst(nlst) character(len=256) :: route_lake_f="" character(len=256) :: route_direction_f="" character(len=256) :: route_order_f="" + character(len=256) :: diversions_file="" logical :: reservoir_persistence_usgs logical :: reservoir_persistence_usace character(len=256) :: reservoir_parameter_file="" @@ -105,8 +106,8 @@ subroutine read_rt_nlst(nlst) RT_OPTION, CHANRTSWCRT, channel_option, & SUBRTSWCRT,OVRTSWCRT,AGGFACTRT, dtrt_ter,dtrt_ch,dxrt,& GwSpinCycles, GwPreCycles, GwSpinUp, GwPreDiag, GwPreDiagInterval, gwIhShift, & - GWBASESWCRT, gwChanCondSw, gwChanCondConstIn, gwChanCondConstOut , & - route_topo_f,route_chan_f,route_link_f, compound_channel, route_lake_f, & + GWBASESWCRT, gwChanCondSw, gwChanCondConstIn, gwChanCondConstOut, & + route_topo_f,route_chan_f,route_link_f, compound_channel, route_lake_f, diversions_file, & reservoir_persistence_usgs, reservoir_persistence_usace, reservoir_parameter_file, reservoir_usgs_timeslice_path, & reservoir_usace_timeslice_path, reservoir_observation_lookback_hours, reservoir_observation_update_time_interval_seconds, & reservoir_rfc_forecasts, reservoir_rfc_forecasts_time_series_path, reservoir_rfc_forecasts_lookback_hours, & @@ -248,6 +249,7 @@ subroutine read_rt_nlst(nlst) nlst%DEEPGWSPIN = DEEPGWSPIN nlst%SOLVEG_INITSWC = SOLVEG_INITSWC nlst%reservoir_obs_dir = "testDirectory" + nlst%diversions_file = diversions_file nlst%reservoir_persistence_usgs = reservoir_persistence_usgs nlst%reservoir_persistence_usace = reservoir_persistence_usace nlst%reservoir_parameter_file = reservoir_parameter_file diff --git a/hydro/Data_Rec/module_namelist_inc.F90 b/hydro/Data_Rec/module_namelist_inc.F90 index c34b9d768c..52922903c9 100644 --- a/hydro/Data_Rec/module_namelist_inc.F90 +++ b/hydro/Data_Rec/module_namelist_inc.F90 @@ -42,6 +42,7 @@ module module_namelist_inc character(len=256) :: route_chan_f="" character(len=256) :: route_link_f="" character(len=256) :: route_lake_f="" + character(len=256) :: diversions_file="" logical :: reservoir_persistence_usgs logical :: reservoir_persistence_usace character(len=256) :: reservoir_parameter_file="" diff --git a/hydro/HYDRO_drv/module_HYDRO_drv.F90 b/hydro/HYDRO_drv/module_HYDRO_drv.F90 index a5a6a37df3..0efbc46ef5 100644 --- a/hydro/HYDRO_drv/module_HYDRO_drv.F90 +++ b/hydro/HYDRO_drv/module_HYDRO_drv.F90 @@ -29,6 +29,7 @@ module module_HYDRO_drv #endif use module_hydro_stop, only: HYDRO_stop use module_UDMAP, only: get_basn_area_nhd + use module_channel_diversions, only: init_diversions use netcdf implicit none @@ -1583,6 +1584,11 @@ subroutine HYDRO_ini(ntime, did,ix0,jx0, vegtyp,soltyp) if(nlst(did)%CHANRTSWCRT .ne. 0) call init_stream_nudging #endif +!#ifdef WRF_HYDRO_DIVERSIONS +! TODO: should this check to make sure we have nudging on too? [RC] + call init_diversions(nlst(did)%diversions_file, nlst(did)%timeSlicePath) +!#endif + ! if (trim(nlst_rt(did)%restart_file) == "") then ! output at the initial time diff --git a/hydro/Makefile b/hydro/Makefile index 240e9d359d..f624055ffc 100644 --- a/hydro/Makefile +++ b/hydro/Makefile @@ -1,6 +1,7 @@ -# Makefile +# Makefile # -CMD = Run/wrf_hydro.exe +CMD = Run/wrf_hydro +.PHONY: $(CMD) all: $(CMD) @@ -8,7 +9,7 @@ $(CMD): @if [ ! -d "Run" ]; then \ (mkdir Run);\ fi - (rm -f Run/wrf_hydro.exe ) + (rm -f Run/wrf_hydro ) (make -f Makefile.comm BASIC) @if [ -d "LandModel_cpl" ]; then \ (cd LandModel_cpl; make) \ @@ -24,16 +25,16 @@ $(CMD): (cd LandModel; make ) \ fi -debug:: - @echo 'F90FLAGS := $$(DEBUGFLAGS) $$(F90FLAGS)' >> ./macros +debug:: + @echo 'F90FLAGS := $$(DEBUGFLAGS) $$(F90FLAGS)' >> ./macros @echo 'F90FLAGS := $$(DEBUGFLAGS) $$(F90FLAGS)' >> ./LandModel/user_build_options debug:: $(CMD) install: - -rm -f ./Run/wrf_hydro.exe; \ - mv LandModel/run/hrldas.exe ./Run/wrf_hydro.exe + -rm -f ./Run/wrf_hydro + mv LandModel/run/hrldas.exe ./Run/wrf_hydro test: - @echo "No libraries or utilities are built, skip testing." + @echo "No libraries or utilities are built, skip testing." clean: @if [ -d "LandModel_cpl" ]; then \ (cd LandModel_cpl; make clean) \ @@ -42,7 +43,7 @@ clean: @if [ -d "LandModel" ]; then \ (cd LandModel; make clean) \ fi - if [ $(WRF_HYDRO_RAPID) -eq 1 ]; then \ - (cd Rapid_routing; make -f makefile.cpl clean); \ + @if [ "$(WRF_HYDRO_RAPID)" = "1" ]; then \ + (cd Rapid_routing; make -f makefile.cpl clean); \ fi - (rm -f */*.mod */*.o lib/*.a Run/wrf_hydro.exe) + (rm -f */*.mod */*.o lib/*.a Run/wrf_hydro) diff --git a/hydro/OrchestratorLayer/config.F90 b/hydro/OrchestratorLayer/config.F90 index 6e6d772959..7b957aff9e 100644 --- a/hydro/OrchestratorLayer/config.F90 +++ b/hydro/OrchestratorLayer/config.F90 @@ -124,6 +124,7 @@ module config_base character(len=256) :: route_link_f="" character(len=256) :: route_lake_f="" integer :: lake_option + character(len=256) :: diversions_file="" logical :: reservoir_persistence_usgs logical :: reservoir_persistence_usace character(len=256) :: reservoir_parameter_file="" @@ -170,7 +171,7 @@ module config_base integer :: maxAgePairsBiasPersist logical :: invDistTimeWeightBias logical :: noConstInterfBias - character(len=256) :: timeSlicePath + character(len=256) :: timeSlicePath = "./nudgingTimeSliceObs/" integer :: nLastObs integer :: bucket_loss integer :: imperv_adj @@ -554,6 +555,7 @@ subroutine init_namelist_rt_field(did) integer :: channel_loss_option = 0 character(len=256) :: route_lake_f="" integer :: lake_option !0: lakes off 1: level pool 2: passthrough, 3: reservoir da + character(len=256) :: diversions_file="" logical :: reservoir_persistence_usgs logical :: reservoir_persistence_usace character(len=256) :: reservoir_parameter_file="" @@ -628,7 +630,7 @@ subroutine init_namelist_rt_field(did) SUBRTSWCRT,OVRTSWCRT,AGGFACTRT, dtrt_ter,dtrt_ch,dxrt,& GwSpinCycles, GwPreCycles, GwSpinUp, GwPreDiag, GwPreDiagInterval, gwIhShift, & GWBASESWCRT, gwChanCondSw, gwChanCondConstIn, gwChanCondConstOut , & - route_topo_f,route_chan_f,route_link_f, compound_channel, channel_loss_option, lake_option, route_lake_f, & + route_topo_f,route_chan_f,route_link_f, compound_channel, channel_loss_option, lake_option, route_lake_f, diversions_file, & route_direction_f,route_order_f,gwbasmskfil, & geo_finegrid_flnm, gwstrmfil,GW_RESTART,RSTRT_SWC,TERADJ_SOLAR, sys_cpl, & order_to_write , rst_typ, rst_bi_in, rst_bi_out, gwsoilcpl, & @@ -880,6 +882,8 @@ subroutine init_namelist_rt_field(did) nlst(did)%route_link_f = route_link_f nlst(did)%route_lake_f = route_lake_f + nlst(did)%diversions_file = diversions_file + nlst(did)%reservoir_persistence_usgs = reservoir_persistence_usgs nlst(did)%reservoir_persistence_usace = reservoir_persistence_usace nlst(did)%reservoir_parameter_file = reservoir_parameter_file diff --git a/hydro/Routing/CMakeLists.txt b/hydro/Routing/CMakeLists.txt index 8c40440b07..748b941e8d 100644 --- a/hydro/Routing/CMakeLists.txt +++ b/hydro/Routing/CMakeLists.txt @@ -20,7 +20,6 @@ add_library(hydro_routing STATIC target_link_libraries(hydro_routing PRIVATE MPI::MPI_Fortran - netCDF::netcdff hydro_mpp hydro_utils hydro_orchestrator @@ -31,4 +30,12 @@ target_link_libraries(hydro_routing hydro_routing_reservoirs_hybrid hydro_data_rec hydro_routing_reservoirs_rfc + hydro_routing_diversions ) + +if (WRF_HYDRO_NUDGING_IO STREQUAL "1") + target_link_libraries(hydro_routing + PRIVATE + hydro_nudging_io + ) +endif() diff --git a/hydro/Routing/Diversions/CMakeLists.txt b/hydro/Routing/Diversions/CMakeLists.txt new file mode 100644 index 0000000000..c2b688564b --- /dev/null +++ b/hydro/Routing/Diversions/CMakeLists.txt @@ -0,0 +1,10 @@ +add_library(hydro_routing_diversions STATIC + module_diversions.F90 + module_diversions_timeslice.F90 +) + +add_dependencies(hydro_routing_diversions hydro_orchestrator) +add_dependencies(hydro_routing_diversions fortglob) + +target_link_libraries(hydro_routing_diversions PUBLIC hydro_orchestrator) +target_link_libraries(hydro_routing_diversions PUBLIC fortglob) diff --git a/hydro/Routing/Diversions/Makefile b/hydro/Routing/Diversions/Makefile new file mode 100644 index 0000000000..c7200a472b --- /dev/null +++ b/hydro/Routing/Diversions/Makefile @@ -0,0 +1,27 @@ +# Makefile +# +include ../../macros + +OBJS = \ + module_diversions_timeslice.o \ + module_diversions.o + +all: $(OBJS) + +%.o: %.F90 + @echo "Routing Diversions Makefile:" + $(COMPILER90) $(CPPINVOKE) $(CPPFLAGS) -o $(@) $(F90FLAGS) $(LDFLAGS) -I"../../mod" -I$(NETCDFINC) $(*).F90 + @echo "" + ar -r ../../lib/libHYDRO.a $(@) + cp *.mod ../../mod + + +fortglob_dir: + make -C ../../utils/fortglob + +module_diversions_timeslice.o: fortglob_dir + +module_diversions.o: module_diversions_timeslice.o + +clean: + rm -f *.o *.mod *.stb *~ diff --git a/hydro/Routing/Diversions/module_diversions.F90 b/hydro/Routing/Diversions/module_diversions.F90 new file mode 100644 index 0000000000..159731be2d --- /dev/null +++ b/hydro/Routing/Diversions/module_diversions.F90 @@ -0,0 +1,188 @@ +module module_channel_diversions + use netcdf + use iso_fortran_env, only: int8, int16, int64 + use ieee_arithmetic, only: ieee_is_nan + + use module_diversions_timeslice, only: get_flow_for_gage, init_timeslices + use module_hydro_stop, only: hydro_stop + + implicit none + + type diversion_t + character(len=128) :: name + + character(len=16) :: da_src, da_dest + integer(kind=int8) :: type_div, type_src, type_dest + integer(kind=int64) :: id_src, id_dest, src_index, dest_index + real :: capacity, fraction + integer(kind=int16) :: lookback + + real :: persisted_flow_src, persisted_flow_dest + end type + + logical :: diversions_active = .false. + integer :: ndivs = 0 + + type(diversion_t), allocatable :: diversions(:) + + character(*), parameter :: free = '(*(g0,1x))' + +contains + subroutine init_diversions(diversions_file, timeslice_path) + character(*), intent(in) :: diversions_file + character(*), intent(in) :: timeslice_path + + integer :: g, i, ierr = 0 + character(len=20) :: istr + character(len=256) :: char_tmp + + integer :: ncid, dimid + integer :: name_vid, type_div_vid, type_src_vid, type_dest_vid, da_src_vid, da_dest_vid + integer :: id_src_vid, id_dest_vid, capacity_vid, fraction_vid, lookback_vid + + if (len_trim(diversions_file) > 0) then + print *, "Loading diversions data from " // trim(diversions_file) + ierr = nf90_open(trim(diversions_file), NF90_NOWRITE, ncid) + if (ierr /= 0) call hydro_stop("Could not open diversions file: " // trim(diversions_file)) + ierr = nf90_inq_dimid(ncid, "diversion", dimid) + if (ierr /= 0) call hydro_stop("Error reading diversions file: " // trim(diversions_file)) + ierr = nf90_inquire_dimension(ncid, dimid, len=ndivs) + if (ierr /= 0) call hydro_stop("Error reading diversions file: " // trim(diversions_file)) + + write (istr, *) ndivs + print *, "Diversions file has " // trim(adjustl(istr)) // " diversions" + + ! get fields + ierr = 0 + ierr = ierr + nf90_inq_varid(ncid, "Diversion_Name", name_vid) + ierr = ierr + nf90_inq_varid(ncid, "DivType", type_div_vid) + ierr = ierr + nf90_inq_varid(ncid, "FromType", type_src_vid) + ierr = ierr + nf90_inq_varid(ncid, "ToType", type_dest_vid) + ierr = ierr + nf90_inq_varid(ncid, "DA_Src", da_src_vid) + ierr = ierr + nf90_inq_varid(ncid, "DA_Dest", da_dest_vid) + ierr = ierr + nf90_inq_varid(ncid, "DivFrom", id_src_vid) + ierr = ierr + nf90_inq_varid(ncid, "DivTo", id_dest_vid) + ierr = ierr + nf90_inq_varid(ncid, "DivCap", capacity_vid) + ierr = ierr + nf90_inq_varid(ncid, "DivFrac", fraction_vid) + ierr = ierr + nf90_inq_varid(ncid, "Lookback", lookback_vid) + + if (ierr /= 0) then + print free, "WARNING: error occurred accessing diversion file variables, will disable diversions" + return + end if + + if (ndivs > 0) then + ! Read the timeslice data + ierr = init_timeslices(timeslice_path) + if (ierr /= 0) then + print free, "WARNING: No timeslice files available when initializing diversions, will disable diversions" + return + end if + + diversions_active = .true. + + allocate(diversions(ndivs)) + do i = 1, ndivs + associate (div => diversions(i)) + div = diversion_t('', '', '', -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1) + + ierr = 0 + !ierr = ierr + nf_get_var1(ncid, name_vid, i, div%name) !! can't read string with Fortran :-( + + ierr = ierr + nf90_get_var(ncid, da_src_vid, div%da_src, start=(/i/), count=(/15/)) + div%persisted_flow_src = get_flow_for_gage(div%da_src) + ierr = ierr + nf90_get_var(ncid, da_dest_vid, div%da_dest, start=(/i/), count=(/15/)) + div%persisted_flow_dest = get_flow_for_gage(div%da_dest) + + ierr = ierr + nf90_get_var(ncid, type_div_vid, div%type_div, start=(/i/)) + ierr = ierr + nf90_get_var(ncid, type_src_vid, div%type_src, start=(/i/)) + ierr = ierr + nf90_get_var(ncid, type_dest_vid, div%type_dest, start=(/i/)) + ierr = ierr + nf90_get_var(ncid, id_src_vid, div%id_src, start=(/i/)) + ierr = ierr + nf90_get_var(ncid, id_dest_vid, div%id_dest, start=(/i/)) + ierr = ierr + nf90_get_var(ncid, capacity_vid, div%capacity, start=(/i/)) + ierr = ierr + nf90_get_var(ncid, fraction_vid, div%fraction, start=(/i/)) + ierr = ierr + nf90_get_var(ncid, lookback_vid, div%lookback, start=(/i/)) + + if (ierr /= 0) then + print free, "WARNING: error occurred reading diversion variables from diversion file, will disable diversions" + diversions_active = .false. + return + end if + end associate + end do + + end if + end if + + end subroutine + + subroutine calculate_diversion(src_link_in, qlink_src_in, diversion_quantity_out, diversion_quantity_in) + integer(kind=int64), intent(in) :: src_link_in + ! integer(kind=int64), intent(out) :: dst_out + real, intent(in) :: qlink_src_in + real, intent(out) :: diversion_quantity_out, diversion_quantity_in + + integer :: i + + diversion_quantity_out = 0 + diversion_quantity_in = 0 + + ! bail if we're inactive + if (.not. diversions_active) return + + ! link to gage + ! look to see what type of diversion it is + ! call into sub-procedure to handle type=1, type=2, type=3, etc + + do i = 1, ndivs + if (src_link_in == diversions(i)%id_src) then + if (diversions(i)%type_div /= 3) then + print free, "!!! UNSUPPORTED DIVERSION TYPE (", diversions(i)%type_div, "), skipping" + else + call gage_assisted_diversion(src_link_in, diversions(i), qlink_src_in, diversion_quantity_out) + ! dst_out = diversions(i)%id_dest + end if + end if + + if (src_link_in == diversions(i)%id_dest) then + if (diversions(i)%type_div /= 3) then + print free, "!!! UNSUPPORTED DIVERSION TYPE (", diversions(i)%type_div, "), skipping" + else + if (.not. ieee_is_nan(diversions(i)%persisted_flow_dest)) & + diversion_quantity_in = diversions(i)%persisted_flow_dest + end if + end if + end do + + ! subtract dst_out from source gage + + end subroutine + + subroutine gage_assisted_diversion(src_link, diversion, qlink_src, div_gage_flow) + integer(kind=int64), intent(in) :: src_link + type(diversion_t), intent(in) :: diversion + real, intent(in) :: qlink_src + real, intent(out) :: div_gage_flow + + real :: fraction + + ! This is the so-called "Type 3" diversion. We take the observed flow from div_gage, + ! and subtract it from the upstream qlink_src, if it's a valid flow (not-NaN). + ! + ! If it's not a valid flow, we try to use the Fraction property of the diversion, + ! and if -that's- not available, we just leave the flow untouched. + + div_gage_flow = diversion%persisted_flow_dest + if (ieee_is_nan(div_gage_flow)) then + fraction = diversion%fraction + if (fraction == -1) then + print free, "WARNING: No fractional diversion value specified for diversion at gage '" // trim(adjustl(diversion%da_dest)) // "', skipping" + fraction = 0 + else + print free, "INFO: No gage discharge available for diversion '" // trim(adjustl(diversion%da_dest)) // "', using fixed fractional diversion of", fraction + end if + div_gage_flow = qlink_src * fraction + end if + end subroutine + +end module diff --git a/hydro/Routing/Diversions/module_diversions_timeslice.F90 b/hydro/Routing/Diversions/module_diversions_timeslice.F90 new file mode 100644 index 0000000000..4cb59df682 --- /dev/null +++ b/hydro/Routing/Diversions/module_diversions_timeslice.F90 @@ -0,0 +1,81 @@ +module module_diversions_timeslice + use fortglob, only: glob_t, globfiles + use module_hydro_stop, only: hydro_stop + + use netcdf + use ieee_arithmetic, only: ieee_value, ieee_quiet_nan, ieee_is_nan + implicit none + + integer, parameter :: PATH_MAX = 4096 + type(glob_t) :: timeslice_files + + character(*), parameter :: free = '(*(g0,1x))' + + contains + + integer function init_timeslices(timeslice_path) result(ierr) + character(*), intent(in) :: timeslice_path + character(len=PATH_MAX) :: tslice_glob + + ierr = 0 + tslice_glob = trim(adjustl(timeslice_path)) // '/' // "*.15min.usgsTimeSlice.ncdf" + timeslice_files = globfiles(tslice_glob) + + if (timeslice_files%nfiles == 0) ierr = 1 + end function + + real function get_flow_for_gage(gage) result(flow) + character(len=15), intent(in) :: gage + + integer :: i, ierr=0, ncid, dimid, varid, num_stns, found(1) + real :: discharge(1) + character(len=15), allocatable :: gage_ids(:) + + flow = ieee_value(flow, ieee_quiet_nan) + + if (gage(1:4) == 'None') then + return + end if + + ! start looking at files, going backward from most recent + do i = timeslice_files%nfiles, 1, -1 + ierr = nf90_open(trim(timeslice_files%filenames(i)), NF90_NOWRITE, ncid) + + ! look for gage + ierr = ierr + nf90_inq_dimid(ncid, 'stationIdInd', dimid) + ierr = ierr + nf90_inquire_dimension(ncid, dimid, len=num_stns) + + allocate(gage_ids(num_stns)) + ierr = ierr + nf90_inq_varid(ncid, 'stationId', varid) + ierr = ierr + nf90_get_var(ncid, varid, gage_ids) + + if (ierr /= 0) call hydro_stop("Error occurred reading gage data from " // trim(timeslice_files%filenames(i))) + + found = findloc(gage_ids, gage) + if (found(1) /= 0) then +#ifdef HYDRO_D + print free, "DEBUG: Reading diversion discharge for gage " // trim(adjustl(gage)) // " from " // trim(timeslice_files%filenames(i)) +#endif + ierr = ierr + nf90_inq_varid(ncid, 'discharge', varid) + ierr = ierr + nf90_get_var(ncid, varid, discharge, start=found, count=(/1/)) + if (ierr /= 0) call hydro_stop("Error occurred reading gage data from " // trim(timeslice_files%filenames(i))) + + if (discharge(1) >= 0) then + flow = discharge(1) + deallocate(gage_ids) + return +#ifdef HYDRO_D + else + print free, "DEBUG: Diversion discharge value invalid, continuing search if able" +#endif + end if + end if + + deallocate(gage_ids) + ierr = nf90_close(ncid) + end do + + print free, "WARNING: Valid gage discharge not found in any timeslice file, falling back to fractional diversion" + end function + +end module \ No newline at end of file diff --git a/hydro/Routing/Makefile b/hydro/Routing/Makefile index 65d6ca4575..fbcb946cba 100644 --- a/hydro/Routing/Makefile +++ b/hydro/Routing/Makefile @@ -83,6 +83,7 @@ module_RT.o: module_GW_baseflow.o \ module_HYDRO_io.o \ module_noah_chan_param_init_rt.o \ module_UDMAP.o \ + module_channel_routing.o \ ../Data_Rec/module_namelist.o \ ../Data_Rec/module_RT_data.o \ ../Data_Rec/module_gw_gw2d_data.o @@ -102,9 +103,11 @@ endif module_UDMAP.o: ../Data_Rec/module_namelist.o ../Data_Rec/module_RT_data.o ifneq ($(WRF_HYDRO_NUDGING),-DWRF_HYDRO_NUDGING) -module_channel_routing.o: module_UDMAP.o +module_channel_routing.o: module_UDMAP.o \ + Diversions/module_diversions.o else -module_channel_routing.o: module_UDMAP.o\ +module_channel_routing.o: module_UDMAP.o \ + Diversions/module_diversions.o \ ../nudging/module_date_utils_nudging.o \ ../nudging/module_nudging_utils.o \ ../nudging/module_stream_nudging.o diff --git a/hydro/Routing/module_channel_routing.F90 b/hydro/Routing/module_channel_routing.F90 index c9d64962a6..cb4b79549d 100644 --- a/hydro/Routing/module_channel_routing.F90 +++ b/hydro/Routing/module_channel_routing.F90 @@ -509,10 +509,10 @@ subroutine SUBMUSKINGCUNGE( & !comment out to prevent excessive file sizes when running model !print*, "qloss,dx,WP,WPk,depth,ChannK,qdc,ql,dt,D", qloss,dx,WP,WPk,depth,ChannK,qdc,ql,dt,D if((qloss*dt)/D > ((ql*dt)/D - C4)) then - qloss = ql - C4*(D/dt) - if (qloss < 0) then - print*, 'WARNING CHANNEL LOSS IS NEGATIVE',qloss - endif + qloss = ql - C4*(D/dt) + if ((qloss < 0) .and. (ChannK /= 0)) then + print*, 'WARNING CHANNEL LOSS IS NEGATIVE',qloss + endif endif ! ---------------------------------------------------------------- @@ -876,7 +876,7 @@ Subroutine drive_CHANNEL(did, latval,lonval,KT, IXRT,JXRT, SUBRTSWCRT, & ! endif do k = 1, NLINKSL - if(TYPEL(k) .ne. 2) then + if(TYPEL(k) .ne. 1) then QLINK(k,2) = tmpQLINK(k,2) endif QLINK(k,1) = QLINK(k,2) !assing link flow of current to be previous for next time step @@ -1645,7 +1645,8 @@ subroutine drive_CHANNEL_RSL(did, UDMP_OPT,KT, IXRT,JXRT, & nudgeWAdvance, & nudge_apply_upstream_muskingumCunge #endif - + use module_channel_diversions, only: calculate_diversion + use ieee_arithmetic, only: ieee_is_nan implicit none @@ -1756,6 +1757,10 @@ subroutine drive_CHANNEL_RSL(did, UDMP_OPT,KT, IXRT,JXRT, & real, allocatable,dimension(:) :: tmpAssimilatedValue character(len=256), allocatable,dimension(:) :: tmpAssimilatedSourceFile + ! diversions + real :: div_src, div_dst + character(*), parameter :: free = '(*(g0,1x))' + #ifdef MPP_LAND if(my_id .eq. io_id) then #endif @@ -2005,6 +2010,41 @@ subroutine drive_CHANNEL_RSL(did, UDMP_OPT,KT, IXRT,JXRT, & ! QLateral(k), DTRT_CH, So(k), CHANLEN(k), & ! MannN(k), ChSSlp(k), Bw(k), Tw(k) ) + ! HANDLE DIVERSIONS + + call calculate_diversion(LINKID(k), Quc, div_src, div_dst) + + if (div_src /= 0) then + ! remove from upstream +#ifdef HYDRO_D + print free, "DEBUG: diverting", div_src, "of", Quc, "from link id =", LINKID(k) !, "on processor", my_id + if (div_src > Quc) & + print free, "DEBUG WARNING: diverted flow (", div_src, ") exceeds total flow, zeroing." +#endif + Quc = max(0.0, Quc - div_src) + Qup = max(0.0, Qup - div_src) + end if + + if (div_dst /= 0) then + ! apply observed value to downstream +#ifdef HYDRO_D + print free, "DEBUG: diverting", div_dst, "to link id =", LINKID(k) !, "on processor", my_id +#endif + Qup = div_dst + Quc = div_dst + tmpQLINK(k,2) = div_dst + + ! reset any NaNs that got through + if (ieee_is_nan(div_dst)) then + ! fallback to zero if div_dst is NaN + if (ieee_is_nan(QLINK(k,1))) QLINK(k,1) = 0.0 + if (ieee_is_nan(QLINK(k,2))) QLINK(k,2) = 0.0 + else + if (ieee_is_nan(QLINK(k,1))) QLINK(k,1) = tmpQLINK(k,2) + if (ieee_is_nan(QLINK(k,2))) QLINK(k,2) = tmpQLINK(k,2) + end if + end if + #ifdef WRF_HYDRO_NUDGING call nudge_apply_upstream_muskingumCunge( Qup, Quc, nudge(k), k ) #endif diff --git a/hydro/arc/Makefile.mpp b/hydro/arc/Makefile.mpp index 665961ede5..f93b78774a 100644 --- a/hydro/arc/Makefile.mpp +++ b/hydro/arc/Makefile.mpp @@ -1,4 +1,4 @@ -# Makefile +# Makefile all: (make -f Makefile.comm BASIC) @@ -6,8 +6,10 @@ all: BASIC: make -C MPP make -C IO + make -C utils/fortglob make -C utils make -C OrchestratorLayer + make -C Routing/Diversions make -C Routing/Overland make -C Routing/Subsurface make -C Routing/Reservoirs @@ -17,15 +19,17 @@ BASIC: make -C HYDRO_drv clean: - (cd IO; make -f Makefile clean) - (cd OrchestratorLayer; make -f Makefile clean) - (cd utils ; make -f Makefile clean) + make -C IO clean + make -C OrchestratorLayer clean + make -C utils clean + make -C utils/fortglob clean + make -C Routing/Diversions clean make -C Routing/Overland clean make -C Routing/Subsurface clean make -C Routing/Reservoirs clean - (cd Data_Rec; make -f Makefile clean) - (cd HYDRO_drv; make -f Makefile clean) - (cd MPP; make -f Makefile clean) + make -C Data_Rec clean + make -C HYDRO_drv clean + make -C MPP clean make -C Debug_Utilities/ clean - (cd Routing; make -f Makefile clean) + make -C Routing clean (rm -f lib/*.a */*.mod */*.o CPL/*/*.o CPL/*/*.mod) diff --git a/hydro/arc/Makefile.seq b/hydro/arc/Makefile.seq deleted file mode 100644 index 386935ce9f..0000000000 --- a/hydro/arc/Makefile.seq +++ /dev/null @@ -1,36 +0,0 @@ -# Makefile - -all: - (make -f Makefile BASIC) - -BASIC: - (cd Data_Rec ; make -f Makefile) - (cd Routing; make -f Makefile) - ifeq ($(WRF_HYDRO_NUDGING),-DWRF_HYDRO_NUDGING) - (cd nudging; make -f Makefile) - endif - (cd HYDRO_drv; make -f Makefile) - -LIS: - (make -f Makefile BASIC) - (cd LIS_cpl ; make -f Makefile) - -CLM: - (make -f Makefile BASIC) - (cd CLM_cpl ; make -f Makefile) - -WRF: - (make -f Makefile BASIC) - (cd WRF_cpl ; make -f Makefile) - -HYDRO: - (make -f Makefile BASIC) - -clean: - (cd Data_Rec; make -f Makefile clean) - (cd HYDRO_drv; make -f Makefile clean) - ifeq ($(WRF_HYDRO_NUDGING),-DWRF_HYDRO_NUDGING) - (cd nudging; make -f Makefile clean) - endif - (cd Routing; make -f Makefile clean) - (rm -f lib/*.a */*.mod CPL/*/*.o CPL/*/*.mod) diff --git a/hydro/arc/macros.mpp.cray_fortran b/hydro/arc/macros.mpp.cray_fortran index a222ca8ca6..315d3b8971 100644 --- a/hydro/arc/macros.mpp.cray_fortran +++ b/hydro/arc/macros.mpp.cray_fortran @@ -3,7 +3,7 @@ ifeq ($(SPATIAL_SOIL),1) SPATIAL_SOIL = -DSPATIAL_SOIL else -SPATIAL_SOIL = +SPATIAL_SOIL = endif ifeq ($(HYDRO_REALTIME),1) @@ -32,19 +32,19 @@ endif ifeq ($(WRF_HYDRO_NUDGING),1) WRF_HYDRO_NUDGING = -DWRF_HYDRO_NUDGING else -WRF_HYDRO_NUDGING = +WRF_HYDRO_NUDGING = endif ifeq ($(OUTPUT_CHAN_CONN),1) OUTPUT_CHAN_CONN = -DOUTPUT_CHAN_CONN else -OUTPUT_CHAN_CONN = +OUTPUT_CHAN_CONN = endif ifeq ($(PRECIP_DOUBLE),1) PRECIP_DOUBLE = -DPRECIP_DOUBLE else -PRECIP_DOUBLE = +PRECIP_DOUBLE = endif ifeq ($(NWM_META),1) @@ -61,6 +61,7 @@ endif RMD = rm -f COMPILER90 = ftn +COMPILERCC = cc FORMAT_FREE = -f free BYTESWAPIO = -h byteswapio F90FLAGS = -O2 -c -ef -h alias=none -h fp1 $(FORMAT_FREE) $(BYTESWAPIO) @@ -69,6 +70,6 @@ MODFLAG = -I./ -I ../../MPP -I ../MPP -I ../mod LDFLAGS = CPPINVOKE = -eT CPPFLAGS = -DMPP_LAND -I ../Data_Rec $(HYDRO_D) $(SPATIAL_SOIL) $(NWM_META) $(WRF_HYDRO_NUDGING) $(OUTPUT_CHAN_CONN) $(PRECIP_DOUBLE) $(NCEP_WCOSS) -LIBS = +LIBS = NETCDFINC = $(NETCDF_INC) NETCDFLIB = -L$(NETCDF_LIB) -lnetcdff -lnetcdf diff --git a/hydro/arc/macros.mpp.gfort b/hydro/arc/macros.mpp.gfort index 5f22389e02..ac8c56ff84 100644 --- a/hydro/arc/macros.mpp.gfort +++ b/hydro/arc/macros.mpp.gfort @@ -55,7 +55,8 @@ endif RMD = rm -f -COMPILER90 = mpif90 +COMPILER90 = mpif90 +COMPILERCC = mpicc F90FLAGS = -w -c -O2 -ffree-form -ffree-line-length-none -fconvert=big-endian -frecord-marker=4 -std=legacy DEBUGFLAGS = -DHYDRO_D -g -Wall -Wextra -Warray-temporaries -Wconversion -fimplicit-none -fbacktrace -ffree-line-length-0 -fcheck=all -ffpe-trap=invalid,zero,overflow,underflow -finit-real=nan MODFLAG = -I"./" -I"../../MPP" -I"../MPP" -I"../mod" diff --git a/hydro/arc/macros.mpp.ifort b/hydro/arc/macros.mpp.ifort index eb4c94b322..12e74cf49b 100644 --- a/hydro/arc/macros.mpp.ifort +++ b/hydro/arc/macros.mpp.ifort @@ -61,6 +61,7 @@ endif RMD = rm -f COMPILER90 = mpif90 +COMPILERCC = mpicc FORMAT_FREE = -FR BYTESWAPIO = -convert big_endian F90FLAGS = -O2 -g -w -c -ftz -align all -fno-alias -fp-model precise $(FORMAT_FREE) $(BYTESWAPIO) diff --git a/hydro/arc/macros.mpp.ifort.luna b/hydro/arc/macros.mpp.ifort.luna deleted file mode 100644 index 39ac0d6362..0000000000 --- a/hydro/arc/macros.mpp.ifort.luna +++ /dev/null @@ -1,107 +0,0 @@ -## If you have multiple mpi biulds on a single machine -## this example may be relevant to you. -## Ex: The hydro-c1 machine has mpi and netcdf built against portland -## fortran in the PATH. However mpi and netcd built against intel -## fortran is also available. Here's how I build WRF HYDRO against -## intel -## Below, in this file, I make the changes: -## COMPILER90 = $(ifortCompiler90) -## LDFLAGS = $(ifortLdFlags) -## NETCDFINC = $(ifortNetcdfInc) -## NETCDFLIB = -L$(ifortNetcdfLib) -lnetcdff -lnetcdf -## In my ~/.bashrc I have -## ## WRF HYDRO -## export NETCDF=/opt/netcdf -## export WRF_HYDRO=1 -## export HYDRO_D=1 -## ### manage ifort on hydro -## export ifortNetcdfLib="/opt/netcdf-4.3.0+ifort-12.1/lib/" -## export ifortNetcdfInc="/opt/netcdf-4.3.0+ifort-12.1/include/" -## # RPATH for ifort (pgi is already default so no need) -## ifortMpiLib="/opt/openmpi-1.10.0-intel/lib/" -## export ifortLdFlags="-Wl,-rpath,${ifortNetcdfLib}:${ifortMpiLib} -L${ifortNetcdfLib} -L${ifortMpiLib}" -## export ifortCompiler90='/opt/openmpi-1.10.0-intel/bin/mpif90' -## # Aliases for invoking ifort -## alias impirun='/opt/openmpi-1.10.0-intel/bin/mpirun' -## alias iman='man -M/opt/openmpi+intel/man' -## # Bonus: Check your wrf hydro environment - up you to maintain to your needs. -## alias henv='printenv | egrep -i "(HYDRO|NUDG|PRECIP|CHAN_CONN|^NETCDF|^LDFLAGS|^ifort)" | egrep -v PWD' - -.IGNORE: - -ifeq ($(SPATIAL_SOIL),1) -SPATIAL_SOIL = -DSPATIAL_SOIL -else -SPATIAL_SOIL = -endif - -ifeq ($(HYDRO_REALTIME),1) -HYDRO_REALTIME = -DHYDRO_REALTIME -else -HYDRO_REALTIME = -endif - -ifeq ($(WRF_HYDRO),1) -WRF_HYDRO = -DWRF_HYDRO $(HYDRO_REALTIME) -else -WRF_HYDRO = -endif - -ifeq ($(WRF_HYDRO_RAPID),1) -WRF_HYDRO = -DWRF_HYDRO -DWRF_HYDRO_RAPID $(HYDRO_REALTIME) -endif - -ifeq ($(HYDRO_D),1) -HYDRO_D = -DHYDRO_D $(WRF_HYDRO) -else -HYDRO_D = $(WRF_HYDRO) -endif - - -ifeq ($(WRF_HYDRO_NUDGING),1) -WRF_HYDRO_NUDGING = -DWRF_HYDRO_NUDGING -else -WRF_HYDRO_NUDGING = -endif - -ifeq ($(OUTPUT_CHAN_CONN),1) -OUTPUT_CHAN_CONN = -DOUTPUT_CHAN_CONN -else -OUTPUT_CHAN_CONN = -endif - -ifeq ($(PRECIP_DOUBLE),1) -PRECIP_DOUBLE = -DPRECIP_DOUBLE -else -PRECIP_DOUBLE = -endif - -ifeq ($(NCEP_WCOSS),1) -NCEP_WCOSS = -DNCEP_WCOSS -else -NCEP_WCOSS = -endif - -ifeq ($(NWM_META),1) -NWM_META = -DNWM_META -else -NWM_META = -endif - -RMD = rm -f -COMPILER90 = ftn -FORMAT_FREE = -FR -BYTESWAPIO = -convert big_endian -F90FLAGS = -w -c -ftz -align all -fno-alias -fp-model precise $(FORMAT_FREE) $(BYTESWAPIO) -DEBUGFLAGS = -DHYDRO_D -g -traceback -debug all -check all -MODFLAG = -I./ -I ../../MPP -I ../MPP -I ../mod -# -# Used for DMAPP -# module load dmapp/7.0.1-1.0502.11080.8.76.ari -#LDFLAGS = $(HDF5_LDFLAGS) -Wl,--whole-archive,-ldmapp,--no-whole-archive -LDFLAGS = $(HDF5_LDFLAGS) -CPPINVOKE = -fpp -CPPFLAGS = -DMPP_LAND -I ../Data_Rec $(HYDRO_D) $(SPATIAL_SOIL) $(NWM_META) $(WRF_HYDRO_NUDGING) $(OUTPUT_CHAN_CONN) $(PRECIP_DOUBLE) $(NCEP_WCOSS) -LIBS =$(Z_LIB) -NETCDFINC = $(NETCDF_INC) -NETCDFLIB = -L$(NETCDF_LIB) -lnetcdff -lnetcdf diff --git a/hydro/arc/macros.mpp.ifort.summit_has b/hydro/arc/macros.mpp.ifort.summit_has deleted file mode 100644 index f11747332a..0000000000 --- a/hydro/arc/macros.mpp.ifort.summit_has +++ /dev/null @@ -1,79 +0,0 @@ -.IGNORE: - -ifeq ($(SPATIAL_SOIL),1) -SPATIAL_SOIL = -DSPATIAL_SOIL -else -SPATIAL_SOIL = -endif - -ifeq ($(HYDRO_REALTIME),1) -HYDRO_REALTIME = -DHYDRO_REALTIME -else -HYDRO_REALTIME = -endif - -ifeq ($(WRF_HYDRO),1) -WRF_HYDRO = -DWRF_HYDRO $(HYDRO_REALTIME) -else -WRF_HYDRO = -endif - -ifeq ($(WRF_HYDRO_RAPID),1) -WRF_HYDRO = -DWRF_HYDRO -DWRF_HYDRO_RAPID $(HYDRO_REALTIME) -endif - -ifeq ($(HYDRO_D),1) -HYDRO_D = -DHYDRO_D $(WRF_HYDRO) -else -HYDRO_D = $(WRF_HYDRO) -endif - -ifeq ($(WRFIO_NCD_LARGE_FILE_SUPPORT),1) -WRFIO_NCD_LARGE_FILE_SUPPORT = -DWRFIO_NCD_LARGE_FILE_SUPPORT -else -WRFIO_NCD_LARGE_FILE_SUPPORT = -endif - -ifeq ($(WRF_HYDRO_NUDGING),1) -WRF_HYDRO_NUDGING = -DWRF_HYDRO_NUDGING -else -WRF_HYDRO_NUDGING = -endif - -ifeq ($(OUTPUT_CHAN_CONN),1) -OUTPUT_CHAN_CONN = -DOUTPUT_CHAN_CONN -else -OUTPUT_CHAN_CONN = -endif - -ifeq ($(PRECIP_DOUBLE),1) -PRECIP_DOUBLE = -DPRECIP_DOUBLE -else -PRECIP_DOUBLE = -endif - -ifeq ($(NCEP_WCOSS),1) -NCEP_WCOSS = -DNCEP_WCOSS -else -NCEP_WCOSS = -endif - -ifeq ($(NWM_META),1) -NWM_META = -DNWM_META -else -NWM_META = -endif - -RMD = rm -f -COMPILER90 = mpiifort -FORMAT_FREE = -FR -BYTESWAPIO = -convert big_endian -F90FLAGS = -O2 -g -w -c -ftz -align all -fno-alias -fp-model precise $(FORMAT_FREE) $(BYTESWAPIO) -DEBUGFLAGS = -DHYDRO_D -g -traceback -debug all -check all -MODFLAG = -I./ -I ../../MPP -I ../MPP -I ../mod -LDFLAGS = -CPPINVOKE = -fpp -CPPFLAGS = -DMPP_LAND -I ../Data_Rec $(HYDRO_D) $(SPATIAL_SOIL) $(WRFIO_NCD_LARGE_FILE_SUPPORT) $(NWM_META) $(WRF_HYDRO_NUDGING) $(OUTPUT_CHAN_CONN) $(PRECIP_DOUBLE) $(NCEP_WCOSS) -LIBS = -NETCDFINC = $(NETCDF_INC) -NETCDFLIB = -L$(NETCDF_LIB) -lnetcdff -lnetcdf diff --git a/hydro/arc/macros.mpp.ifort.theia b/hydro/arc/macros.mpp.ifort.theia deleted file mode 100644 index 62e61dc176..0000000000 --- a/hydro/arc/macros.mpp.ifort.theia +++ /dev/null @@ -1,92 +0,0 @@ -.IGNORE: - -ifeq ($(HYDRO_REALTIME),1) -HYDRO_REALTIME = -DHYDRO_REALTIME -else -HYDRO_REALTIME = -endif - -ifeq ($(WRF_HYDRO),1) -WRF_HYDRO = -DWRF_HYDRO $(HYDRO_REALTIME) -else -WRF_HYDRO = -endif - -ifeq ($(WRF_HYDRO_RAPID),1) -WRF_HYDRO = -DWRF_HYDRO -DWRF_HYDRO_RAPID $(HYDRO_REALTIME) -endif - -ifeq ($(HYDRO_D),1) -HYDRO_D = -DHYDRO_D $(WRF_HYDRO) -else -HYDRO_D = $(WRF_HYDRO) -endif - - -ifneq ($(origin ESMFMKFILE), environment) -$(error Environment variable ESMFMKFILE was not set.) -endif -include $(ESMFMKFILE) - -RMD = rm -f -COMPILER90 = $(ESMF_F90COMPILER) -FORMAT_FREE = -FR -BYTESWAPIO = -convert big_endian -F90FLAGS = -w -c -ftz -align all -fno-alias -fp-model precise $(FORMAT_FREE) $(BYTESWAPIO) -# -w Disables all warning messages -# -c Prevents linking. -# -g Produces symbolic debug information in the object -# file. -# -ftz Flushes denormal results to zero when the application -# is in the gradual underflow mode. -# -align all Tells the compiler to add padding bytes whenever -# possible to obtain the natural alignment of data -# items in common blocks, derived types, and record -# structures. -# -fno-alias Specifies that aliasing should not be assumed in -# the program. -# -fp-model precise Enables value-safe optimizations on floating- -# point data and rounds intermediate results to -# source-defined precision. -# -FR Specifies source files are in free format -# -convert big_endian Specifies that the format will be big endian for -# INTEGER*1, INTEGER*2, INTEGER*4, or INTEGER*8, -# and big endian IEEE floating-point for REAL*4, -# REAL*8, REAL*16, COMPLEX*8, COMPLEX*16, or COM- -# PLEX*32. -# -u Sets the default type of a variable to undefined -# (IMPLICIT NONE) -# -traceback Tells the compiler to generate extra information in -# the object file to allow the display of source file -# traceback information at run time when a severe -# error occurs. -# -fpe0 Floating-point invalid, divide-by-zero, and -# overflow exceptions are enabled -# -nomixed_str_len_arg The hidden length passed for a character argument -# is to be placed in sequential order at the end of -# the argument list. [default] -# -names lowercase Causes the compiler to ignore case differences in -# identifiers and to convert external names to -# lowercase. [default] -# -convert big_endian Specifies that the format will be big endian for -# INTEGER*1, INTEGER*2, INTEGER*4, or INTEGER*8, -# and big endian IEEE floating-point for REAL*4, -# REAL*8, REAL*16, COMPLEX*8, COMPLEX*16, or COM- -# PLEX*32. -# -assume byterecl Specifies that the units for the OPEN statement -# RECL specifier (record length) value are in bytes -# for unformatted data files, not longwords (four- -# byte units) -DEBUGFLAGS = -DHYDRO_D -g -traceback -debug all -check all -MODFLAG = -I./ -I../../MPP -I../MPP -I../mod -LDFLAGS = -CPPINVOKE = -fpp -CPPFLAGS = -DMPP_LAND -I../Data_Rec $(HYDRO_D) -# -C: Do not discard comments. -# -P: Inhibit generation of linemarkers in the output -# from the preprocessor. -# -traditional: Try to imitate the behavior of old-fashioned C -# preprocessors, as opposed to ISO C preprocessors. -LIBS = -NETCDFINC = $(NETCDF)/include -NETCDFLIB = -L$(NETCDF)/lib -lnetcdff -lnetcdf diff --git a/hydro/arc/macros.mpp.linux b/hydro/arc/macros.mpp.linux index 8bb08839ad..ce3f13a7f8 100644 --- a/hydro/arc/macros.mpp.linux +++ b/hydro/arc/macros.mpp.linux @@ -3,7 +3,7 @@ ifeq ($(SPATIAL_SOIL),1) SPATIAL_SOIL = -DSPATIAL_SOIL else -SPATIAL_SOIL = +SPATIAL_SOIL = endif ifeq ($(HYDRO_REALTIME),1) @@ -32,32 +32,33 @@ endif ifeq ($(WRF_HYDRO_NUDGING),1) WRF_HYDRO_NUDGING = -DWRF_HYDRO_NUDGING else -WRF_HYDRO_NUDGING = +WRF_HYDRO_NUDGING = endif ifeq ($(OUTPUT_CHAN_CONN),1) OUTPUT_CHAN_CONN = -DOUTPUT_CHAN_CONN else -OUTPUT_CHAN_CONN = +OUTPUT_CHAN_CONN = endif ifeq ($(PRECIP_DOUBLE),1) PRECIP_DOUBLE = -DPRECIP_DOUBLE else -PRECIP_DOUBLE = +PRECIP_DOUBLE = endif -RM = rm -f -RMD = rm -f +RM = rm -f +RMD = rm -f COMPILER90= mpif90 -F90FLAGS = -Mfree -c -byteswapio -O2 -Kieee -DEBUGFLAGS = -DHYDRO_D -g +COMPILERCC= mpicc +F90FLAGS = -Mfree -c -byteswapio -O2 -Kieee +DEBUGFLAGS = -DHYDRO_D -g LDFLAGS = $(F90FLAGS) MODFLAG = -I./ -I ../../MPP -I ../MPP -I ../mod -I ../../mod -I ../../../mod -LDFLAGS = +LDFLAGS = CPPINVOKE = -Mpreprocess CPPFLAGS = -DMPP_LAND -I../Data_Rec $(HYDRO_D) $(SPATIAL_SOIL) $(WRF_HYDRO_NUDGING) $(OUTPUT_CHAN_CONN) $(PRECIP_DOUBLE) -LIBS = -NETCDFINC = $(NETCDF_INC) +LIBS = +NETCDFINC = $(NETCDF_INC) NETCDFLIB = -L$(NETCDF_LIB) -lnetcdff -lnetcdf diff --git a/hydro/arc/macros.seq.IBM.xlf90_r b/hydro/arc/macros.seq.IBM.xlf90_r deleted file mode 100644 index e5aebcc18c..0000000000 --- a/hydro/arc/macros.seq.IBM.xlf90_r +++ /dev/null @@ -1,39 +0,0 @@ -.IGNORE: - -ifeq ($(HYDRO_REALTIME),1) -HYDRO_REALTIME = -DHYDRO_REALTIME -else -HYDRO_REALTIME = -endif - -ifeq ($(WRF_HYDRO),1) -WRF_HYDRO = -DWRF_HYDRO $(HYDRO_REALTIME) -else -WRF_HYDRO = -endif - -ifeq ($(WRF_HYDRO_RAPID),1) -WRF_HYDRO = -DWRF_HYDRO -DWRF_HYDRO_RAPID $(HYDRO_REALTIME) -endif - -ifeq ($(HYDRO_D),1) -HYDRO_D = -DHYDRO_D $(WRF_HYDRO) -else -HYDRO_D = $(WRF_HYDRO) -endif - - - - -RM = rm -f -RMD = rm -f -COMPILER90= xlf90_r -F90FLAGS = -c -O2 -qfree=f90 -qmaxmem=819200 -DEBUGFLAGS = -DHYDRO_D -g -MODFLAG = -I./ -I ../../MPP -I ../MPP -I ../mod -LDFLAGS = -CPP = cpp -C -P -CPPFLAGS = -I../Data_Rec $(HYDRO_D) -LIBS = -NETCDFINC = $(NETCDF_INC) -NETCDFLIB = -L$(NETCDF_LIB) -lnetcdf diff --git a/hydro/arc/macros.seq.gfort b/hydro/arc/macros.seq.gfort deleted file mode 100644 index 22bdfb68b9..0000000000 --- a/hydro/arc/macros.seq.gfort +++ /dev/null @@ -1,43 +0,0 @@ -.IGNORE: - -ifeq ($(SPATIAL_SOIL),1) -SPATIAL_SOIL = -DSPATIAL_SOIL -else -SPATIAL_SOIL = -endif - -ifeq ($(HYDRO_REALTIME),1) -HYDRO_REALTIME = -DHYDRO_REALTIME -else -HYDRO_REALTIME = -endif - -ifeq ($(WRF_HYDRO),1) -WRF_HYDRO = -DWRF_HYDRO $(HYDRO_REALTIME) -else -WRF_HYDRO = -endif - -ifeq ($(WRF_HYDRO_RAPID),1) -WRF_HYDRO = -DWRF_HYDRO -DWRF_HYDRO_RAPID $(HYDRO_REALTIME) -endif - -ifeq ($(HYDRO_D),1) -HYDRO_D = -DHYDRO_D $(WRF_HYDRO) -else -HYDRO_D = $(WRF_HYDRO) -endif - - - -RMD = rm -f -COMPILER90= gfortran -F90FLAGS = -w -c -ffree-form -ffree-line-length-none -fconvert=big-endian -frecord-marker=4 -DEBUGFLAGS = -DHYDRO_D -g -Wall -Wextra -Warray-temporaries -Wconversion -fimplicit-none -fbacktrace -ffree-line-length-0 -fcheck=all -ffpe-trap=invalid,zero,overflow,underflow -finit-real=nan -MODFLAG = -I./ -I../mod -LDFLAGS = -CPPINVOKE = -cpp -CPPFLAGS = -I"../Data_Rec" $(HYDRO_D) $(SPATIAL_SOIL) -LIBS = -NETCDFINC = $(NETCDF_INC) -NETCDFLIB = -L$(NETCDF_LIB) -lnetcdff -lnetcdf diff --git a/hydro/arc/macros.seq.ifort b/hydro/arc/macros.seq.ifort deleted file mode 100644 index be68951c08..0000000000 --- a/hydro/arc/macros.seq.ifort +++ /dev/null @@ -1,56 +0,0 @@ -.IGNORE: - -ifeq ($(SPATIAL_SOIL),1) -SPATIAL_SOIL = -DSPATIAL_SOIL -else -SPATIAL_SOIL = -endif - -ifeq ($(HYDRO_REALTIME),1) -HYDRO_REALTIME = -DHYDRO_REALTIME -else -HYDRO_REALTIME = -endif - -ifeq ($(WRF_HYDRO),1) -WRF_HYDRO = -DWRF_HYDRO $(HYDRO_REALTIME) -else -WRF_HYDRO = -endif - -ifeq ($(WRF_HYDRO_RAPID),1) -WRF_HYDRO = -DWRF_HYDRO -DWRF_HYDRO_RAPID $(HYDRO_REALTIME) -endif - -ifeq ($(HYDRO_D),1) -HYDRO_D = -DHYDRO_D $(WRF_HYDRO) -else -HYDRO_D = $(WRF_HYDRO) -endif - - -ifeq ($(WRF_HYDRO_NUDGING),1) -WRF_HYDRO_NUDGING = -DWRF_HYDRO_NUDGING -else -WRF_HYDRO_NUDGING = -endif - -ifeq ($(OUTPUT_CHAN_CONN),1) -OUTPUT_CHAN_CONN = -DOUTPUT_CHAN_CONN -else -OUTPUT_CHAN_CONN = -endif - -RMD = rm -f -COMPILER90= ifort -##F90FLAGS = -w -c -ffree-form -ffree-line-length-none -fconvert=big-endian -frecord-marker=4 -F90FLAGS = -w -c -ftz -align all -fno-alias -fp-model precise -FR -convert big_endian -DEBUGFLAGS = -DHYDRO_D -g -traceback -debug all -check all - -MODFLAG = -I./ -I ../mod -LDFLAGS = -CPPINVOKE = -fpp -CPPFLAGS = -I ../Data_Rec $(HYDRO_D) $(SPATIAL_SOIL) $(WRF_HYDRO_NUDGING) $(OUTPUT_CHAN_CONN) -LIBS = -NETCDFINC = $(NETCDF_INC) -NETCDFLIB = -L$(NETCDF_LIB) -lnetcdff -lnetcdf diff --git a/hydro/arc/macros.seq.linux b/hydro/arc/macros.seq.linux deleted file mode 100644 index 614a7e0b51..0000000000 --- a/hydro/arc/macros.seq.linux +++ /dev/null @@ -1,57 +0,0 @@ -.IGNORE: - -ifeq ($(SPATIAL_SOIL),1) -SPATIAL_SOIL = -DSPATIAL_SOIL -else -SPATIAL_SOIL = -endif - -ifeq ($(HYDRO_REALTIME),1) -HYDRO_REALTIME = -DHYDRO_REALTIME -else -HYDRO_REALTIME = -endif - -ifeq ($(WRF_HYDRO),1) -WRF_HYDRO = -DWRF_HYDRO $(HYDRO_REALTIME) -else -WRF_HYDRO = -endif - -ifeq ($(WRF_HYDRO_RAPID),1) -WRF_HYDRO = -DWRF_HYDRO -DWRF_HYDRO_RAPID $(HYDRO_REALTIME) -endif - -ifeq ($(HYDRO_D),1) -HYDRO_D = -DHYDRO_D $(WRF_HYDRO) -else -HYDRO_D = $(WRF_HYDRO) -endif - - -ifeq ($(WRF_HYDRO_NUDGING),1) -WRF_HYDRO_NUDGING = -DWRF_HYDRO_NUDGING -else -WRF_HYDRO_NUDGING = -endif - -ifeq ($(OUTPUT_CHAN_CONN),1) -OUTPUT_CHAN_CONN = -DOUTPUT_CHAN_CONN -else -OUTPUT_CHAN_CONN = -endif - - -RMD = ls -RM = rm -f -COMPILER90= pgf90 -F90FLAGS = -Mfree -Mfptrap -c -byteswapio -Ktrap=fp -O2 -Kieee -DEBUGFLAGS = -DHYDRO_D -g -LDFLAGS = $(F90FLAGS) -MODFLAG = -I./ -I ../mod -LDFLAGS = -CPPINVOKE = -CPPFLAGS = -I ../Data_Rec $(HYDRO_D) $(WRF_HYDRO) $(SPATIAL_SOIL) $(WRF_HYDRO_NUDGING) $(OUTPUT_CHAN_CONN) -LIBS = -NETCDFINC = $(NETCDF_INC) -NETCDFLIB = -L$(NETCDF_LIB) -lnetcdff -lnetcdf diff --git a/hydro/arc/macros.theia.debug b/hydro/arc/macros.theia.debug deleted file mode 100644 index 5b5b5799f1..0000000000 --- a/hydro/arc/macros.theia.debug +++ /dev/null @@ -1,92 +0,0 @@ -.IGNORE: - -ifeq ($(HYDRO_REALTIME),1) -HYDRO_REALTIME = -DHYDRO_REALTIME -else -HYDRO_REALTIME = -endif - -ifeq ($(WRF_HYDRO),1) -WRF_HYDRO = -DWRF_HYDRO $(HYDRO_REALTIME) -else -WRF_HYDRO = -endif - -ifeq ($(WRF_HYDRO_RAPID),1) -WRF_HYDRO = -DWRF_HYDRO -DWRF_HYDRO_RAPID $(HYDRO_REALTIME) -endif - -ifeq ($(HYDRO_D),1) -HYDRO_D = -DHYDRO_D $(WRF_HYDRO) -else -HYDRO_D = $(WRF_HYDRO) -endif - - -ifneq ($(origin ESMFMKFILE), environment) -$(error Environment variable ESMFMKFILE was not set.) -endif -include $(ESMFMKFILE) - -RMD = rm -f -COMPILER90 = $(ESMF_F90COMPILER) -FORMAT_FREE = -FR -BYTESWAPIO = -convert big_endian -F90FLAGS = -w -c -ftz -align all -fno-alias -fp-model precise $(FORMAT_FREE) $(BYTESWAPIO) -F90FLAGS += -g -traceback -# -w Disables all warning messages -# -c Prevents linking. -# -g Produces symbolic debug information in the object -# file. -# -ftz Flushes denormal results to zero when the application -# is in the gradual underflow mode. -# -align all Tells the compiler to add padding bytes whenever -# possible to obtain the natural alignment of data -# items in common blocks, derived types, and record -# structures. -# -fno-alias Specifies that aliasing should not be assumed in -# the program. -# -fp-model precise Enables value-safe optimizations on floating- -# point data and rounds intermediate results to -# source-defined precision. -# -FR Specifies source files are in free format -# -convert big_endian Specifies that the format will be big endian for -# INTEGER*1, INTEGER*2, INTEGER*4, or INTEGER*8, -# and big endian IEEE floating-point for REAL*4, -# REAL*8, REAL*16, COMPLEX*8, COMPLEX*16, or COM- -# PLEX*32. -# -u Sets the default type of a variable to undefined -# (IMPLICIT NONE) -# -traceback Tells the compiler to generate extra information in -# the object file to allow the display of source file -# traceback information at run time when a severe -# error occurs. -# -fpe0 Floating-point invalid, divide-by-zero, and -# overflow exceptions are enabled -# -nomixed_str_len_arg The hidden length passed for a character argument -# is to be placed in sequential order at the end of -# the argument list. [default] -# -names lowercase Causes the compiler to ignore case differences in -# identifiers and to convert external names to -# lowercase. [default] -# -convert big_endian Specifies that the format will be big endian for -# INTEGER*1, INTEGER*2, INTEGER*4, or INTEGER*8, -# and big endian IEEE floating-point for REAL*4, -# REAL*8, REAL*16, COMPLEX*8, COMPLEX*16, or COM- -# PLEX*32. -# -assume byterecl Specifies that the units for the OPEN statement -# RECL specifier (record length) value are in bytes -# for unformatted data files, not longwords (four- -# byte units) -MODFLAG = -I./ -I../../MPP -I../MPP -I../mod -LDFLAGS = -CPPINVOKE = -fpp -CPPFLAGS = -DMPP_LAND -I../Data_Rec $(HYDRO_D) -# -C: Do not discard comments. -# -P: Inhibit generation of linemarkers in the output -# from the preprocessor. -# -traditional: Try to imitate the behavior of old-fashioned C -# preprocessors, as opposed to ISO C preprocessors. -LIBS = -NETCDFINC = $(NETCDF)/include -NETCDFLIB = -L$(NETCDF)/lib -lnetcdff -lnetcdf diff --git a/hydro/arc/macros.yellowstone b/hydro/arc/macros.yellowstone deleted file mode 100644 index 8c5318c0f4..0000000000 --- a/hydro/arc/macros.yellowstone +++ /dev/null @@ -1,92 +0,0 @@ -.IGNORE: - -ifeq ($(HYDRO_REALTIME),1) -HYDRO_REALTIME = -DHYDRO_REALTIME -else -HYDRO_REALTIME = -endif - -ifeq ($(WRF_HYDRO),1) -WRF_HYDRO = -DWRF_HYDRO $(HYDRO_REALTIME) -else -WRF_HYDRO = -endif - -ifeq ($(WRF_HYDRO_RAPID),1) -WRF_HYDRO = -DWRF_HYDRO -DWRF_HYDRO_RAPID $(HYDRO_REALTIME) -endif - -ifeq ($(HYDRO_D),1) -HYDRO_D = -DHYDRO_D $(WRF_HYDRO) -else -HYDRO_D = $(WRF_HYDRO) -endif - - -ifneq ($(origin ESMFMKFILE), environment) -$(error Environment variable ESMFMKFILE was not set.) -endif -include $(ESMFMKFILE) - -RMD = rm -f -COMPILER90 = $(ESMF_F90COMPILER) -FORMAT_FREE = -FR -BYTESWAPIO = -convert big_endian -F90FLAGS = -w -c -ftz -align all -fno-alias -fp-model precise $(FORMAT_FREE) $(BYTESWAPIO) -# -w Disables all warning messages -# -c Prevents linking. -# -g Produces symbolic debug information in the object -# file. -# -ftz Flushes denormal results to zero when the application -# is in the gradual underflow mode. -# -align all Tells the compiler to add padding bytes whenever -# possible to obtain the natural alignment of data -# items in common blocks, derived types, and record -# structures. -# -fno-alias Specifies that aliasing should not be assumed in -# the program. -# -fp-model precise Enables value-safe optimizations on floating- -# point data and rounds intermediate results to -# source-defined precision. -# -FR Specifies source files are in free format -# -convert big_endian Specifies that the format will be big endian for -# INTEGER*1, INTEGER*2, INTEGER*4, or INTEGER*8, -# and big endian IEEE floating-point for REAL*4, -# REAL*8, REAL*16, COMPLEX*8, COMPLEX*16, or COM- -# PLEX*32. -# -u Sets the default type of a variable to undefined -# (IMPLICIT NONE) -# -traceback Tells the compiler to generate extra information in -# the object file to allow the display of source file -# traceback information at run time when a severe -# error occurs. -# -fpe0 Floating-point invalid, divide-by-zero, and -# overflow exceptions are enabled -# -nomixed_str_len_arg The hidden length passed for a character argument -# is to be placed in sequential order at the end of -# the argument list. [default] -# -names lowercase Causes the compiler to ignore case differences in -# identifiers and to convert external names to -# lowercase. [default] -# -convert big_endian Specifies that the format will be big endian for -# INTEGER*1, INTEGER*2, INTEGER*4, or INTEGER*8, -# and big endian IEEE floating-point for REAL*4, -# REAL*8, REAL*16, COMPLEX*8, COMPLEX*16, or COM- -# PLEX*32. -# -assume byterecl Specifies that the units for the OPEN statement -# RECL specifier (record length) value are in bytes -# for unformatted data files, not longwords (four- -# byte units) -DEBUGFLAGS = -DHYDRO_D -g -traceback -debug all -check all -MODFLAG = -I./ -I../../MPP -I../MPP -I../mod -LDFLAGS = -CPP = cpp -CPPFLAGS = -P -traditional -DMPP_LAND -I../Data_Rec $(HYDRO_D) -# -C: Do not discard comments. -# -P: Inhibit generation of linemarkers in the output -# from the preprocessor. -# -traditional: Try to imitate the behavior of old-fashioned C -# preprocessors, as opposed to ISO C preprocessors. -LIBS = -NETCDFINC = $(NETCDF)/include -NETCDFLIB = -L$(NETCDF)/lib -lnetcdff -lnetcdf diff --git a/hydro/arc/macros.yellowstone.debug b/hydro/arc/macros.yellowstone.debug deleted file mode 100644 index 93e7aec444..0000000000 --- a/hydro/arc/macros.yellowstone.debug +++ /dev/null @@ -1,92 +0,0 @@ -.IGNORE: - -ifeq ($(HYDRO_REALTIME),1) -HYDRO_REALTIME = -DHYDRO_REALTIME -else -HYDRO_REALTIME = -endif - -ifeq ($(WRF_HYDRO),1) -WRF_HYDRO = -DWRF_HYDRO $(HYDRO_REALTIME) -else -WRF_HYDRO = -endif - -ifeq ($(WRF_HYDRO_RAPID),1) -WRF_HYDRO = -DWRF_HYDRO -DWRF_HYDRO_RAPID $(HYDRO_REALTIME) -endif - -ifeq ($(HYDRO_D),1) -HYDRO_D = -DHYDRO_D $(WRF_HYDRO) -else -HYDRO_D = $(WRF_HYDRO) -endif - - -ifneq ($(origin ESMFMKFILE), environment) -$(error Environment variable ESMFMKFILE was not set.) -endif -include $(ESMFMKFILE) - -RMD = rm -f -COMPILER90 = $(ESMF_F90COMPILER) -FORMAT_FREE = -FR -BYTESWAPIO = -convert big_endian -F90FLAGS = -w -c -ftz -align all -fno-alias -fp-model precise $(FORMAT_FREE) $(BYTESWAPIO) -F90FLAGS += -g -traceback -# -w Disables all warning messages -# -c Prevents linking. -# -g Produces symbolic debug information in the object -# file. -# -ftz Flushes denormal results to zero when the application -# is in the gradual underflow mode. -# -align all Tells the compiler to add padding bytes whenever -# possible to obtain the natural alignment of data -# items in common blocks, derived types, and record -# structures. -# -fno-alias Specifies that aliasing should not be assumed in -# the program. -# -fp-model precise Enables value-safe optimizations on floating- -# point data and rounds intermediate results to -# source-defined precision. -# -FR Specifies source files are in free format -# -convert big_endian Specifies that the format will be big endian for -# INTEGER*1, INTEGER*2, INTEGER*4, or INTEGER*8, -# and big endian IEEE floating-point for REAL*4, -# REAL*8, REAL*16, COMPLEX*8, COMPLEX*16, or COM- -# PLEX*32. -# -u Sets the default type of a variable to undefined -# (IMPLICIT NONE) -# -traceback Tells the compiler to generate extra information in -# the object file to allow the display of source file -# traceback information at run time when a severe -# error occurs. -# -fpe0 Floating-point invalid, divide-by-zero, and -# overflow exceptions are enabled -# -nomixed_str_len_arg The hidden length passed for a character argument -# is to be placed in sequential order at the end of -# the argument list. [default] -# -names lowercase Causes the compiler to ignore case differences in -# identifiers and to convert external names to -# lowercase. [default] -# -convert big_endian Specifies that the format will be big endian for -# INTEGER*1, INTEGER*2, INTEGER*4, or INTEGER*8, -# and big endian IEEE floating-point for REAL*4, -# REAL*8, REAL*16, COMPLEX*8, COMPLEX*16, or COM- -# PLEX*32. -# -assume byterecl Specifies that the units for the OPEN statement -# RECL specifier (record length) value are in bytes -# for unformatted data files, not longwords (four- -# byte units) -MODFLAG = -I./ -I../../MPP -I../MPP -I../mod -LDFLAGS = -CPP = cpp -CPPFLAGS = -C -P -traditional -DMPP_LAND -I../Data_Rec $(HYDRO_D) -# -C: Do not discard comments. -# -P: Inhibit generation of linemarkers in the output -# from the preprocessor. -# -traditional: Try to imitate the behavior of old-fashioned C -# preprocessors, as opposed to ISO C preprocessors. -LIBS = -NETCDFINC = $(NETCDF)/include -NETCDFLIB = -L$(NETCDF)/lib -lnetcdff -lnetcdf diff --git a/hydro/configure b/hydro/configure index ce896c95fe..46a5ba0e33 100755 --- a/hydro/configure +++ b/hydro/configure @@ -4,6 +4,17 @@ theArgument=$1 ################################### ## Setup the HOSTNAME if not set +echo "---------------------------------------------------" +echo " WARNING" +echo "---------------------------------------------------" +echo "WARNING: configure is being deprecated and removed in the future." +echo " See docs/BUILD.md for more detail on building." +echo " Please switch to using CMake from the top directory." +echo " $ mkdir build" +echo " $ cd build" +echo " $ cmake .." +echo " $ make -j 4" +echo "---------------------------------------------------" if [ -z ${HOSTNAME+x} ]; then HOSTNAME=`hostname` @@ -48,9 +59,15 @@ if [[ -z $NETCDF_LIB ]]; then fi if [[ ! -e ${NETCDF_LIB}/libnetcdff.a ]]; then - echo "NETCDFLIB = -L${NETCDF_LIB} -lnetcdf" >> macros.tmp + echo "NETCDFLIB = -L${NETCDF_LIB} -lnetcdf" >> macros.tmp fi - + +# add any additional F90 flags that came out of nf-config (most likely separate module/library path) +if command -v nf-config &> /dev/null; then # ignore if nf-config isn't available + echo "F90FLAGS += $(nf-config --fflags)" >> macros.tmp + echo "NETCDFLIB += $(nf-config --flibs)" >> macros.tmp +fi + ################################### ## File/dir setups if [[ -e macros ]]; then rm -f macros; fi @@ -63,18 +80,17 @@ if [[ ! -e mod ]]; then mkdir mod; fi if [[ -z $theArgument ]]; then echo "Please select from following supported linux compilers" echo "using either the number or key (not case sensitive):" - echo + echo echo "Number Key Description" echo "---------------------------------------------------" - echo " 1 pgi PGI parallel" + echo " 1 nvfort nvidia parallel" echo " 2 gfort gfortran parallel" - echo " 3 ifort intel parallel (incl. Theia, Gordon, Summit)" - echo " 4 luna intel parallel (WCOSS Luna)" + echo " 3 ifx|ifort intel parallel" + echo " 4 cray cray (ftn) parallel" echo " 5 ifort_omp intel openmp" echo " 6 intel.cray_xc intel parallel (cray_xc)" - echo " 7 cray_fortran Cray Fortran PE (ftn)" echo " 0 exit exit" - echo + echo read -p "Enter selection: " theArgument echo fi @@ -86,57 +102,34 @@ theArgument=`echo $theArgument | tr '[:upper:]' '[:lower:]'` ################################### ## What to do with the choice -if [[ "$theArgument" == "1" ]] || [[ "$theArgument" == "pgi" ]]; then - cp arc/macros.mpp.linux macros - cp arc/Makefile.mpp Makefile.comm - echo "Configured: PGI" +if [[ "$theArgument" == "1" ]] || [[ "$theArgument" == "nvfort" ]]; then + cp arc/macros.mpp.linux macros + cp arc/Makefile.mpp Makefile.comm + echo "Configured: nvfort" fi if [[ "$theArgument" == "2" ]] || [[ "$theArgument" == "gfort" ]]; then - cp arc/macros.mpp.gfort macros + cp arc/macros.mpp.gfort macros cp arc/Makefile.mpp Makefile.comm echo "Configured: gfort" fi -if [[ "$theArgument" == "3" ]] || [[ "$theArgument" == "ifort" ]]; then - - ## theia login machines self identify as "tfe" and have - ## their own intel macros. We handle luna more explicitly... - if [[ $HOSTNAME = *tfe* ]]; then - cp arc/macros.mpp.ifort.theia macros - echo "Configured: ifort on Theia" - - elif [[ $HOSTNAME = *gordon* ]]; then - cp arc/macros.mpp.intel.cray_xc macros - echo "Configured: ifort on Gordon" - - elif [[ $HOSTNAME = *shas* ]]; then - cp arc/macros.mpp.ifort.summit_has macros - echo "Configured: ifort on Summit haswell" - - else - cp arc/macros.mpp.ifort macros - echo "Configured: ifort" - fi +if [[ "$theArgument" == "3" ]] || [[ "$theArgument" =~ ^(ifort|ifx|intel)$ ]]; then + cp arc/macros.mpp.ifort macros + echo "Configured: Intel" cp arc/Makefile.mpp Makefile.comm fi -if [[ "$theArgument" == "4" ]] || [[ "$theArgument" == "luna" ]]; then - cp arc/macros.mpp.ifort.luna macros +if [[ "$theArgument" == "4" ]] || [[ "$theArgument" == "cray" ]]; then + cp arc/macros.mpp.cray_fortran macros cp arc/Makefile.mpp Makefile.comm - echo "Configured: ifort on Luna" + echo "Configured: Cray Fortran PrgEnv" fi + if [[ "$theArgument" == "5" ]] || [[ "$theArgument" == "ifort_omp" ]]; then - ## theia login machines self identify as "tfe" and have - ## their own intel macros. We handle luna more explicitly... - if [[ $HOSTNAME != *tfe* ]]; then - cp arc/macros.mpp.ifort.omp macros - echo "Configured: ifort with OpenMP" - else - cp arc/macros.mpp.ifort.theia macros - echo "Configured: ifort on Theia" - fi + cp arc/macros.mpp.ifort.omp macros + echo "Configured: ifort with OpenMP" cp arc/Makefile.mpp Makefile.comm fi @@ -146,11 +139,6 @@ if [[ "$theArgument" == "6" ]] || [[ "$theArgument" == "intel.cray_xc" ]]; then echo "Configured: ifort on cray_xc" fi -if [[ "$theArgument" == "7" ]] || [[ "$theArgument" == "cray_fortran" ]]; then - cp arc/macros.mpp.cray_fortran macros - cp arc/Makefile.mpp Makefile.comm - echo "Configured: Cray Fortran PrgEnv" -fi ## The above result in a new macros file which was @@ -163,16 +151,6 @@ if [[ ! -e macros ]]; then exit 1 fi -# PGI sequential -# cp arc/macros.seq.linux macros -# cp arc/Makefile.seq Makefile.comm -# gfortran sequential -#zystem "cp arc/macros.seq.gfort macros -#cp arc/Makefile.seq Makefile.comm -# ifort sequential -#cp arc/macros.seq.ifort macros -#cp arc/Makefile.seq Makefile.comm - if [[ -e macros.tmp ]]; then cat macros macros.tmp > macros.a rm -f macros.tmp diff --git a/hydro/nudging/CMakeLists.txt b/hydro/nudging/CMakeLists.txt index efaa841343..e7b3856670 100644 --- a/hydro/nudging/CMakeLists.txt +++ b/hydro/nudging/CMakeLists.txt @@ -1,15 +1,13 @@ # build the version static library add_library(hydro_nudging STATIC module_date_utils_nudging.F90 - module_nudging_io.F90 module_nudging_utils.F90 module_stream_nudging.F90 ) target_link_libraries(hydro_nudging PRIVATE + hydro_nudging_io hydro_mpp hydro_data_rec hydro_orchestrator - netCDF::netcdff ) - diff --git a/hydro/nudging/io/CMakeLists.txt b/hydro/nudging/io/CMakeLists.txt new file mode 100644 index 0000000000..e7fdc6a1e8 --- /dev/null +++ b/hydro/nudging/io/CMakeLists.txt @@ -0,0 +1,10 @@ +# build the version static library +add_library(hydro_nudging_io STATIC + module_nudging_io.F90 +) + +target_link_libraries(hydro_nudging_io PRIVATE + hydro_orchestrator + hydro_data_rec + hydro_mpp +) diff --git a/hydro/nudging/module_nudging_io.F90 b/hydro/nudging/io/module_nudging_io.F90 similarity index 98% rename from hydro/nudging/module_nudging_io.F90 rename to hydro/nudging/io/module_nudging_io.F90 index 80f8780e1e..ff4c225071 100644 --- a/hydro/nudging/module_nudging_io.F90 +++ b/hydro/nudging/io/module_nudging_io.F90 @@ -1169,11 +1169,11 @@ end subroutine read_network_reexpression subroutine output_chan_connectivity( & inCHLAT, inCHLON, & !! Channel grid lat, lon. inCHANLEN, & !! The distance between channel grid centers in m. - inFROM_NODE, inTO_NODE, & !! Index of a given cell and the index which it flows to. + inFrom_node, inTo_node, & !! Index of a given cell and the index which it flows to. inCHANXI, inCHANYJ, & !! Index on fine/routing grid of grid cells. - inTYPEL, inLAKENODE & !! Lake type? and node? indications. + inTYPEL, inLakeNode & !! Lake type? and node? indications. ) - + use iso_fortran_env, only: int64 #ifdef MPP_LAND use module_mpp_land @@ -1183,7 +1183,9 @@ subroutine output_chan_connectivity( & !! These are the names used in module_HYDRO_io.F: SUBROUTINE READ_CHROUTING1 real, dimension(:), intent(in) :: inCHLAT, inCHLON, inCHANLEN -integer, dimension(:), intent(in) :: inFROM_NODE, inTO_NODE, inCHANXI, inCHANYJ, inTYPEL, inLAKENODE +integer, dimension(:), intent(in) :: inCHANXI, inCHANYJ, inTYPEL +integer(kind=int64), dimension(:), intent(in) :: inFrom_node, inTo_node +integer(kind=int64), dimension(:), intent(in) :: inLakeNode integer :: nStreamCells, streamCellDimID integer :: iret, projInfo_flag @@ -1196,7 +1198,9 @@ subroutine output_chan_connectivity( & character(len=256), parameter :: output_flnm = "CHANNEL_CONNECTIVITY.nc" real, allocatable, dimension(:) :: CHLAT, CHLON, CHANLEN -integer, allocatable, dimension(:) :: FROM_NODE, TO_NODE, CHANXI, CHANYJ, TYPEL, LAKENODE +integer, allocatable, dimension(:) :: CHANXI, CHANYJ, TYPEL +integer(kind=int64), allocatable, dimension(:) :: from_node, to_node +integer(kind=int64), allocatable, dimension(:) :: lakeNode !! handle the parallelization in this routine instead of in the main code. @@ -1219,9 +1223,9 @@ subroutine output_chan_connectivity( & rt_domain(did)%gnlinks, rt_domain(did)%nlinks, chLon) call write_chanel_real(inChanLen, rt_domain(did)%map_l2g, & rt_domain(did)%gnlinks, rt_domain(did)%nlinks, chanLen) -call write_chanel_int(inFrom_node, rt_domain(did)%map_l2g, & +call write_chanel_int8(inFrom_node, rt_domain(did)%map_l2g, & rt_domain(did)%gnlinks, rt_domain(did)%nlinks, from_node) -call write_chanel_int(inTo_node, rt_domain(did)%map_l2g, & +call write_chanel_int8(inTo_node, rt_domain(did)%map_l2g, & rt_domain(did)%gnlinks, rt_domain(did)%nlinks, to_node) call write_chanel_int(inChanXI, rt_domain(did)%map_l2g, & rt_domain(did)%gnlinks, rt_domain(did)%nlinks, chanXI) @@ -1229,7 +1233,7 @@ subroutine output_chan_connectivity( & rt_domain(did)%gnlinks, rt_domain(did)%nlinks, chanYJ) call write_chanel_int(inTypeL, rt_domain(did)%map_l2g, & rt_domain(did)%gnlinks, rt_domain(did)%nlinks, typeL) -call write_chanel_int(inLakeNode, rt_domain(did)%map_l2g, & +call write_chanel_int8(inLakeNode, rt_domain(did)%map_l2g, & rt_domain(did)%gnlinks, rt_domain(did)%nlinks, lakeNode) #else diff --git a/hydro/utils/CMakeLists.txt b/hydro/utils/CMakeLists.txt index b6d2e57540..77f11eb09b 100644 --- a/hydro/utils/CMakeLists.txt +++ b/hydro/utils/CMakeLists.txt @@ -19,3 +19,5 @@ add_library(hydro_utils STATIC module_hydro_stop.F90 ) target_link_libraries(hydro_utils PRIVATE MPI::MPI_Fortran) + +add_subdirectory(fortglob) diff --git a/hydro/utils/fortglob/CMakeLists.txt b/hydro/utils/fortglob/CMakeLists.txt new file mode 100644 index 0000000000..54ef8bc904 --- /dev/null +++ b/hydro/utils/fortglob/CMakeLists.txt @@ -0,0 +1,4 @@ +add_library(fortglob STATIC + libfortglob.c + fortglob.F90 +) diff --git a/hydro/utils/fortglob/Makefile b/hydro/utils/fortglob/Makefile new file mode 100644 index 0000000000..423a33b53b --- /dev/null +++ b/hydro/utils/fortglob/Makefile @@ -0,0 +1,33 @@ +# Makefile + +.PHONY: cp *.F90 *.c + +include ../../macros + +OBJS = \ + fortglob.o \ + libfortglob.o + +all: $(OBJS) cp + +cp: + cp *.mod ../../mod + +%.o: %.F90 + @echo "Utils fortglob Makefile: %.F90" + $(COMPILER90) $(CPPINVOKE) $(CPPFLAGS) -o $(@) $(F90FLAGS) $(LDFLAGS) -I../../ -I$(NETCDFINC) $(*).F90 + @echo "" + ar -r ../../lib/libHYDRO.a $(@) +%.o: %.c + @echo "Utils fortglob Makefile: %.c" + $(COMPILERCC) -o $(@) -c $(*).c + ar -r ../../lib/libHYDRO.a $(@) + @echo "" +# +# Dependencies: +# +fortglob.o: libfortglob.o + + +clean: + rm -f *.o *.mod *.stb *~ diff --git a/hydro/utils/fortglob/fortglob.F90 b/hydro/utils/fortglob/fortglob.F90 new file mode 100644 index 0000000000..658c537d27 --- /dev/null +++ b/hydro/utils/fortglob/fortglob.F90 @@ -0,0 +1,76 @@ +module fortglob + use iso_c_binding + implicit none + + private + public :: glob_t, globfiles + + integer, parameter :: PATH_MAX = 4096 + + type :: glob_t + integer :: nfiles + character(len=PATH_MAX), allocatable :: filenames(:) + end type + + type, bind(c) :: globrec_c + integer (c_size_t) :: nfiles + type(c_ptr) :: filenames + type(c_ptr) :: globptr + end type globrec_c + + interface + function globfiles_c(pattern) bind(c) + use iso_c_binding + character(kind=c_char), dimension(*), intent(in) :: pattern + type(c_ptr) :: globfiles_c + end function globfiles_c + + subroutine freeglobrec(recptr) bind (c) + use iso_c_binding + type(c_ptr), intent(in) :: recptr + end subroutine + + function strlen(s) bind(c) + use iso_c_binding + type(c_ptr), intent(in), value :: s + integer(c_size_t) :: strlen + end function strlen + end interface + + contains + + function globfiles(pattern) + use iso_c_binding + + type(glob_t) :: globfiles + character(len=*), intent(in) :: pattern + + integer :: i, j, slen + character(len=PATH_MAX) :: pattern_c + type(c_ptr) :: glob_c_ptr + type(globrec_c), pointer :: glob_f_ptr + type(c_ptr), pointer :: c_strs(:) + character(kind=c_char), pointer, dimension(:) :: temp_fstrp + + pattern_c = pattern + slen = len_trim(pattern_c) + pattern_c(slen+1:slen+1) = c_null_char + glob_c_ptr = globfiles_c(pattern_c) + call c_f_pointer(glob_c_ptr, glob_f_ptr) + globfiles%nfiles = glob_f_ptr%nfiles + + allocate(globfiles%filenames(globfiles%nfiles)) + + call c_f_pointer(glob_f_ptr%filenames, c_strs, [glob_f_ptr%nfiles]) + do i = 1, globfiles%nfiles + slen = strlen(c_strs(i)) + call c_f_pointer(c_strs(i), temp_fstrp, [slen]) + globfiles%filenames(i) = '' + do j = 1, slen + globfiles%filenames(i)(j:j) = temp_fstrp(j) + end do + end do + + call freeglobrec(glob_f_ptr%globptr) + end function +end module diff --git a/hydro/utils/fortglob/libfortglob.c b/hydro/utils/fortglob/libfortglob.c new file mode 100644 index 0000000000..5a188746b2 --- /dev/null +++ b/hydro/utils/fortglob/libfortglob.c @@ -0,0 +1,19 @@ +#include "libfortglob.h" + +globrec * globfiles_c(const char * pattern) { + globrec *record = malloc(sizeof(globrec)); + glob_t *globbuf = malloc(sizeof(glob_t)); + + glob(pattern, 0, NULL, globbuf); + record->nfiles = globbuf->gl_pathc; + record->filenames = globbuf->gl_pathv; + record->__globptr = globbuf; + + return record; +} + +void freeglobrec(glob_t ** rec) { + glob_t *glob = *rec; + globfree(glob); + free(glob); +} diff --git a/hydro/utils/fortglob/libfortglob.h b/hydro/utils/fortglob/libfortglob.h new file mode 100644 index 0000000000..aec96808f7 --- /dev/null +++ b/hydro/utils/fortglob/libfortglob.h @@ -0,0 +1,13 @@ +#include +#include +#include +#include + +typedef struct globrec { + size_t nfiles; + char ** filenames; + glob_t * __globptr; +} globrec; + +globrec * globfiles_c(const char * pattern); +void freeglobrec(glob_t **rec); diff --git a/hydro/wrf_hydro_config b/hydro/wrf_hydro_config index 4e0e8becb7..5ab885a2fd 100755 --- a/hydro/wrf_hydro_config +++ b/hydro/wrf_hydro_config @@ -8,9 +8,9 @@ if($#ARGV ne 1) { $x = lc(shift(@ARGV)); $paropt = lc(shift(@ARGV)); - print("Configure option for Hydro : $x $paropt \n"); + print("Configure option for Hydro : $x $paropt \n"); if($x =~ "pgi") { - if($paropt eq 'serial') { + if($paropt eq 'serial') { # system("./configure 1"); print "Error : option not defined in WRF-Hyro. \n"; exit(1); @@ -24,15 +24,15 @@ if($#ARGV ne 1) { else {system("./configure 4");} } if($x =~ "gfortran") { - if($paropt eq 'serial') { + if($paropt eq 'serial') { # system("./configure 5"); print "Error : option not defined in WRF-Hyro. \n"; exit(1); } else {system("./configure 2"); exit(0);} } - if($x =~ "ifort") { - if($paropt eq 'serial') { + if ($x =~ /(?:ifort|ifx|intel|oneapi)/i) { + if($paropt eq 'serial') { #system("./configure 7"); print "Error : option not defined. \n"; exit(1); @@ -41,4 +41,3 @@ if($#ARGV ne 1) { } print "Error : option not defined. \n"; exit(1); -